Estella 0.113.0
A fast 2D and 3D game engine powered by WebAssembly and ECS
Loading...
Searching...
No Matches
WebGPUMappings.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: Apache-2.0
2// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
20#pragma once
21
22#include "../../core/Types.hpp"
23#include "../rhi/GfxEnums.hpp"
24#include "../draw/BlendMode.hpp"
27
28#include <webgpu/webgpu.h>
29
30#include <cstdlib>
31#include <cstring>
32
34
35// =============================================================================
36// Blend
37// =============================================================================
38
41 WGPUBlendComponent color;
42 WGPUBlendComponent alpha;
43};
44
48inline BlendStateWGPU toWGPUBlend(BlendMode mode, bool layerAlpha = false) {
49 auto comp = [](WGPUBlendOperation op, WGPUBlendFactor src, WGPUBlendFactor dst) {
50 WGPUBlendComponent c{};
51 c.operation = op;
52 c.srcFactor = src;
53 c.dstFactor = dst;
54 return c;
55 };
56 const auto add = WGPUBlendOperation_Add;
57 if (layerAlpha && (mode == BlendMode::Additive || mode == BlendMode::PmaAdditive)) {
58 return { comp(add, mode == BlendMode::Additive ? WGPUBlendFactor_SrcAlpha : WGPUBlendFactor_One, WGPUBlendFactor_One),
59 comp(add, WGPUBlendFactor_Zero, WGPUBlendFactor_One) };
60 }
61 switch (mode) {
63 return { comp(add, WGPUBlendFactor_SrcAlpha, WGPUBlendFactor_One),
64 comp(add, WGPUBlendFactor_One, WGPUBlendFactor_One) };
66 return { comp(add, WGPUBlendFactor_Dst, WGPUBlendFactor_OneMinusSrcAlpha),
67 comp(add, WGPUBlendFactor_One, WGPUBlendFactor_OneMinusSrcAlpha) };
69 return { comp(add, WGPUBlendFactor_One, WGPUBlendFactor_OneMinusSrc),
70 comp(add, WGPUBlendFactor_One, WGPUBlendFactor_OneMinusSrcAlpha) };
72 return { comp(add, WGPUBlendFactor_One, WGPUBlendFactor_OneMinusSrcAlpha),
73 comp(add, WGPUBlendFactor_One, WGPUBlendFactor_OneMinusSrcAlpha) };
75 return { comp(add, WGPUBlendFactor_One, WGPUBlendFactor_One),
76 comp(add, WGPUBlendFactor_One, WGPUBlendFactor_One) };
78 return { comp(WGPUBlendOperation_Max, WGPUBlendFactor_One, WGPUBlendFactor_One),
79 comp(WGPUBlendOperation_Max, WGPUBlendFactor_One, WGPUBlendFactor_One) };
81 return { comp(WGPUBlendOperation_Min, WGPUBlendFactor_One, WGPUBlendFactor_One),
82 comp(WGPUBlendOperation_Min, WGPUBlendFactor_One, WGPUBlendFactor_One) };
83 // None never reaches a live blend state — the pipeline drops the blend target
84 // entirely (WebGPUDevice: target.blend = blendEnabled ? &state : nullptr) — but
85 // it is spelled out so the mapping stays total rather than leaning on `default`.
86 case BlendMode::None:
89 default:
90 return { comp(add, WGPUBlendFactor_SrcAlpha, WGPUBlendFactor_OneMinusSrcAlpha),
91 comp(add, WGPUBlendFactor_One, WGPUBlendFactor_OneMinusSrcAlpha) };
92 }
93}
94
95// =============================================================================
96// Vertex layout
97// =============================================================================
98
101inline constexpr WGPUVertexFormat kInvalidVertexFormat = WGPUVertexFormat_Force32;
102
106inline WGPUVertexFormat toWGPUVertexFormat(u8 components, GfxDataType type, bool normalized) {
107 switch (type) {
109 switch (components) {
110 case 1: return WGPUVertexFormat_Float32;
111 case 2: return WGPUVertexFormat_Float32x2;
112 case 3: return WGPUVertexFormat_Float32x3;
113 case 4: return WGPUVertexFormat_Float32x4;
114 default: return kInvalidVertexFormat;
115 }
117 // The engine's u8 attributes are colors (normalized RGBA8) — 4 lanes only.
118 if (components == 4) return normalized ? WGPUVertexFormat_Unorm8x4 : WGPUVertexFormat_Uint8x4;
119 if (components == 2) return normalized ? WGPUVertexFormat_Unorm8x2 : WGPUVertexFormat_Uint8x2;
122 if (components == 2) return normalized ? WGPUVertexFormat_Unorm16x2 : WGPUVertexFormat_Uint16x2;
123 if (components == 4) return normalized ? WGPUVertexFormat_Unorm16x4 : WGPUVertexFormat_Uint16x4;
125 case GfxDataType::Int:
126 switch (components) {
127 case 1: return WGPUVertexFormat_Sint32;
128 case 2: return WGPUVertexFormat_Sint32x2;
129 case 3: return WGPUVertexFormat_Sint32x3;
130 case 4: return WGPUVertexFormat_Sint32x4;
131 default: return kInvalidVertexFormat;
132 }
134 switch (components) {
135 case 1: return WGPUVertexFormat_Uint32;
136 case 2: return WGPUVertexFormat_Uint32x2;
137 case 3: return WGPUVertexFormat_Uint32x3;
138 case 4: return WGPUVertexFormat_Uint32x4;
139 default: return kInvalidVertexFormat;
140 }
141 default:
143 }
144}
145
147inline WGPUIndexFormat toWGPUIndexFormat(GfxDataType type) {
148 switch (type) {
149 case GfxDataType::UnsignedShort: return WGPUIndexFormat_Uint16;
150 case GfxDataType::UnsignedInt: return WGPUIndexFormat_Uint32;
151 default: return WGPUIndexFormat_Undefined;
152 }
153}
154
155// =============================================================================
156// Textures / samplers
157// =============================================================================
158
159inline WGPUTextureFormat toWGPUTextureFormat(GfxPixelFormat fmt) {
160 switch (fmt) {
161 // WebGPU has no 3-channel color format; RGB8 sources upload as RGBA8
162 // (the GL backend's swizzle-free equivalent — expansion happens at upload).
163 case GfxPixelFormat::RGB8: return WGPUTextureFormat_RGBA8Unorm;
164 case GfxPixelFormat::RGBA8: return WGPUTextureFormat_RGBA8Unorm;
165 case GfxPixelFormat::SRGB8_ALPHA8: return WGPUTextureFormat_RGBA8UnormSrgb;
166 case GfxPixelFormat::RGBA16F: return WGPUTextureFormat_RGBA16Float;
167 case GfxPixelFormat::RGBA32F: return WGPUTextureFormat_RGBA32Float;
168 case GfxPixelFormat::DepthComponent24: return WGPUTextureFormat_Depth24Plus;
169 case GfxPixelFormat::Depth24Stencil8: return WGPUTextureFormat_Depth24PlusStencil8;
170 default: return WGPUTextureFormat_RGBA8Unorm;
171 }
172}
173
176 if (fmt == GfxPixelFormat::RGBA16F) return 8u;
177 if (fmt == GfxPixelFormat::RGBA32F) return 16u;
178 return 4u;
179}
180
181inline WGPUTextureFormat toWGPUCompressedFormat(GfxCompressedFormat fmt) {
182 switch (fmt) {
183 case GfxCompressedFormat::ETC2_RGB8: return WGPUTextureFormat_ETC2RGB8Unorm;
184 case GfxCompressedFormat::ETC2_RGBA8: return WGPUTextureFormat_ETC2RGBA8Unorm;
185 case GfxCompressedFormat::ASTC_4x4: return WGPUTextureFormat_ASTC4x4Unorm;
186 case GfxCompressedFormat::ASTC_8x8: return WGPUTextureFormat_ASTC8x8Unorm;
187 case GfxCompressedFormat::S3TC_DXT1: return WGPUTextureFormat_BC1RGBAUnorm;
188 case GfxCompressedFormat::S3TC_DXT5: return WGPUTextureFormat_BC3RGBAUnorm;
189 case GfxCompressedFormat::ETC2_RGBA8_SRGB: return WGPUTextureFormat_ETC2RGBA8UnormSrgb;
190 case GfxCompressedFormat::ASTC_4x4_SRGB: return WGPUTextureFormat_ASTC4x4UnormSrgb;
191 case GfxCompressedFormat::S3TC_DXT5_SRGB: return WGPUTextureFormat_BC3RGBAUnormSrgb;
192 default: return WGPUTextureFormat_Undefined;
193 }
194}
195
197inline WGPUFeatureName compressionFeatureFor(GfxCompressedFormat fmt) {
198 switch (fmt) {
201 case GfxCompressedFormat::S3TC_DXT5_SRGB: return WGPUFeatureName_TextureCompressionBC;
204 case GfxCompressedFormat::ASTC_4x4_SRGB: return WGPUFeatureName_TextureCompressionASTC;
208 default: return WGPUFeatureName_TextureCompressionETC2;
209 }
210}
211
212inline WGPUFilterMode toWGPUFilter(TextureFilter filter) {
213 return filter == TextureFilter::Nearest ? WGPUFilterMode_Nearest : WGPUFilterMode_Linear;
214}
215
216inline WGPUAddressMode toWGPUAddressMode(TextureWrap wrap) {
217 switch (wrap) {
218 case TextureWrap::ClampToEdge: return WGPUAddressMode_ClampToEdge;
219 case TextureWrap::MirroredRepeat: return WGPUAddressMode_MirrorRepeat;
221 default: return WGPUAddressMode_Repeat;
222 }
223}
224
225// =============================================================================
226// Buffers
227// =============================================================================
228
229inline WGPUBufferUsage toWGPUBufferUsage(GfxBufferUsage usage) {
230 switch (usage) {
231 case GfxBufferUsage::Vertex: return WGPUBufferUsage_Vertex | WGPUBufferUsage_CopyDst;
232 case GfxBufferUsage::Index: return WGPUBufferUsage_Index | WGPUBufferUsage_CopyDst;
233 case GfxBufferUsage::Uniform: return WGPUBufferUsage_Uniform | WGPUBufferUsage_CopyDst;
234 // Copy both ways: a compute buffer is filled from the CPU and read back to it. Vertex too: what a
235 // kernel wrote can be drawn as it lies (GPU particles), in a later pass.
236 case GfxBufferUsage::Storage: return WGPUBufferUsage_Storage | WGPUBufferUsage_Vertex | WGPUBufferUsage_CopyDst | WGPUBufferUsage_CopySrc;
237 default: return WGPUBufferUsage_CopyDst;
238 }
239}
240
241// =============================================================================
242// Depth / stencil (PipelineDesc → WGPUDepthStencilState pieces)
243// =============================================================================
244
245inline WGPUCompareFunction toWGPUCompare(GfxStencilFunc func) {
246 switch (func) {
247 case GfxStencilFunc::Never: return WGPUCompareFunction_Never;
248 case GfxStencilFunc::Less: return WGPUCompareFunction_Less;
249 case GfxStencilFunc::Equal: return WGPUCompareFunction_Equal;
250 case GfxStencilFunc::LEqual: return WGPUCompareFunction_LessEqual;
251 case GfxStencilFunc::Greater: return WGPUCompareFunction_Greater;
252 case GfxStencilFunc::NotEqual: return WGPUCompareFunction_NotEqual;
253 case GfxStencilFunc::GEqual: return WGPUCompareFunction_GreaterEqual;
255 default: return WGPUCompareFunction_Always;
256 }
257}
258
259inline WGPUStencilOperation toWGPUStencilOp(GfxStencilOp op) {
260 switch (op) {
261 case GfxStencilOp::Zero: return WGPUStencilOperation_Zero;
262 case GfxStencilOp::Replace: return WGPUStencilOperation_Replace;
263 case GfxStencilOp::Incr: return WGPUStencilOperation_IncrementClamp;
264 case GfxStencilOp::Decr: return WGPUStencilOperation_DecrementClamp;
265 case GfxStencilOp::Invert: return WGPUStencilOperation_Invert;
266 case GfxStencilOp::IncrWrap: return WGPUStencilOperation_IncrementWrap;
267 case GfxStencilOp::DecrWrap: return WGPUStencilOperation_DecrementWrap;
269 default: return WGPUStencilOperation_Keep;
270 }
271}
272
276inline WGPUStencilFaceState toWGPUStencilFace(GfxStencilMode mode) {
277 WGPUStencilFaceState face{};
278 face.depthFailOp = WGPUStencilOperation_Keep;
279 switch (mode) {
281 face.compare = WGPUCompareFunction_Always;
282 face.failOp = WGPUStencilOperation_Replace;
283 face.passOp = WGPUStencilOperation_Replace;
284 break;
286 face.compare = WGPUCompareFunction_Equal;
287 face.failOp = WGPUStencilOperation_Keep;
288 face.passOp = WGPUStencilOperation_Keep;
289 break;
293 face.compare = WGPUCompareFunction_Equal;
294 face.failOp = WGPUStencilOperation_Keep;
295 face.passOp = mode == GfxStencilMode::Increment ? WGPUStencilOperation_IncrementClamp
296 : mode == GfxStencilMode::Decrement ? WGPUStencilOperation_DecrementClamp
297 : WGPUStencilOperation_Zero;
298 break;
300 face.compare = WGPUCompareFunction_NotEqual;
301 face.failOp = WGPUStencilOperation_Keep;
302 face.passOp = WGPUStencilOperation_Keep;
303 break;
305 default:
306 face.compare = WGPUCompareFunction_Always;
307 face.failOp = WGPUStencilOperation_Keep;
308 face.passOp = WGPUStencilOperation_Keep;
309 break;
310 }
311 return face;
312}
313
317 return writesStencil(mode) ? 0xFFu : 0x00u;
318}
319
327inline WGPUDepthStencilState toWGPUDepthStencil(const PipelineDesc& desc, WGPUTextureFormat format) {
328 WGPUDepthStencilState ds{};
329 ds.format = format;
330 ds.depthWriteEnabled = (desc.depthTest && desc.depthWrite) ? WGPUOptionalBool_True
331 : WGPUOptionalBool_False;
332 ds.depthCompare = desc.depthTest ? (desc.depthEqual ? WGPUCompareFunction_LessEqual : WGPUCompareFunction_Less) : WGPUCompareFunction_Always;
333 ds.stencilFront = toWGPUStencilFace(desc.stencil);
334 ds.stencilBack = toWGPUStencilFace(desc.stencil);
335 ds.stencilReadMask = 0xFFu;
336 ds.stencilWriteMask = toWGPUStencilWriteMask(desc.stencil);
337 // Both terms, for the reason GLDevice::setDepthBias gives: head-on the
338 // constant separates coplanar surfaces, at a grazing angle only the
339 // slope-scaled one does.
340 ds.depthBias = desc.depthBias;
341 ds.depthBiasSlopeScale = static_cast<float>(desc.depthBias);
342 return ds;
343}
344
347inline bool hasStencilPlanes(WGPUTextureFormat format) {
348 return format == WGPUTextureFormat_Depth24PlusStencil8 ||
349 format == WGPUTextureFormat_Depth32FloatStencil8 ||
350 format == WGPUTextureFormat_Stencil8;
351}
352
353// =============================================================================
354// Render pass load-ops (RenderPassDesc carries the values since the load-op
355// unification; a scoped clear region has NO load-op equivalent — the device
356// emulates it with a scissored clear-quad, exactly as documented in GfxEnums).
357// =============================================================================
358
359inline WGPULoadOp toWGPULoadOp(bool clearRequested, bool scoped) {
360 // A region-scoped clear must LOAD the attachment and clear the region by
361 // other means; only a full-target clear maps to a real load-op.
362 return (clearRequested && !scoped) ? WGPULoadOp_Clear : WGPULoadOp_Load;
363}
364
365inline WGPUColor toWGPUClearColor(const RenderPassDesc& desc) {
366 return WGPUColor{ desc.clearColorValue[0], desc.clearColorValue[1],
367 desc.clearColorValue[2], desc.clearColorValue[3] };
368}
369
372inline WGPUCullMode toWGPUCullMode(bool enabled, bool front) {
373 if (!enabled) return WGPUCullMode_None;
374 return front ? WGPUCullMode_Front : WGPUCullMode_Back;
375}
376
377// =============================================================================
378// Group-1 binding convention (texture units → bindings)
379// =============================================================================
380
383
384// The unit -> binding convention and the two source scans live in rhi/WgslBindings.hpp:
385// the shader assembler EMITS what this backend reads back, so one of them owns the rule.
386
391inline u64 scanWGSLTextureKindMask(const char* source, u32 group, const char* kind) {
392 if (!source) return 0;
393 u64 mask = 0;
394 for (const char* p = source; (p = std::strstr(p, "@group(")) != nullptr;) {
395 p += 7;
396 char* end = nullptr;
397 const unsigned long g = std::strtoul(p, &end, 10);
398 if (end == p) continue;
399 p = end;
400 if (g != group) continue;
401 const char* b = std::strstr(p, "@binding(");
402 if (!b) break;
403 b += 9;
404 const unsigned long idx = std::strtoul(b, &end, 10);
405 if (end == b) continue;
406 p = end;
407 // The declaration this binding attributes: up to the `;` that ends it,
408 // so a matching type further down the file cannot be read as this one's.
409 const char* semi = std::strchr(p, ';');
410 const char* type = std::strstr(p, kind);
411 if (idx < 64 && type && (!semi || type < semi)) mask |= (u64{1} << idx);
412 }
413 return mask;
414}
415
422inline u64 scanWGSLDepthTextureMask(const char* source, u32 group) {
423 return scanWGSLTextureKindMask(source, group, "texture_depth_2d");
424}
425
430inline u64 scanWGSLArrayTextureMask(const char* source, u32 group) {
431 return scanWGSLTextureKindMask(source, group, "texture_2d_array");
432}
433
438inline u64 scanWGSLVolumeTextureMask(const char* source, u32 group) {
439 return scanWGSLTextureKindMask(source, group, "texture_3d");
440}
441
445inline u32 alignedWriteSize(u32 size) { return (size + 3u) & ~3u; }
446inline bool needsWriteStaging(u32 size) { return (size & 3u) != 0; }
447
450inline bool writeFitsInBuffer(u32 offset, u32 size, u32 capacity) {
451 return size <= capacity && offset <= capacity - size;
452}
453
454} // namespace esengine::webgpu
Blend mode enumeration for custom rendering.
Backend-agnostic graphics enumerations.
Immutable GPU pipeline state — the backend-agnostic unit of "how to draw".
Core type definitions and utilities for ESEngine.
What a texture unit is called in WGSL, and what a WGSL source says about the group-1 bindings it hold...
bool writeFitsInBuffer(u32 offset, u32 size, u32 capacity)
WGPUStencilFaceState toWGPUStencilFace(GfxStencilMode mode)
The engine's two stencil modes as WebGPU face states (same table as GLDevice::applyPipeline: Write = ...
WGPUVertexFormat toWGPUVertexFormat(u8 components, GfxDataType type, bool normalized)
Maps one RHI attribute (components × type × normalized) to a WGPUVertexFormat, or kInvalidVertexForma...
u64 scanWGSLVolumeTextureMask(const char *source, u32 group)
Bit mask of the group's bindings a WGSL source declares as texture_3d.
WGPUDepthStencilState toWGPUDepthStencil(const PipelineDesc &desc, WGPUTextureFormat format)
A pipeline's full depth-stencil state against a pass attachment format.
u32 wgpuBytesPerPixel(GfxPixelFormat fmt)
WGPUIndexFormat toWGPUIndexFormat(GfxDataType type)
Index type for drawElements' GfxDataType.
WGPUFilterMode toWGPUFilter(TextureFilter filter)
u32 toWGPUStencilWriteMask(GfxStencilMode mode)
Stencil write mask per mode — the applyStencilMode table: Write fills all planes, Test reads without ...
bool hasStencilPlanes(WGPUTextureFormat format)
True when a depth-stencil format carries stencil planes (drives whether a pass may set stencil load/s...
WGPUStencilOperation toWGPUStencilOp(GfxStencilOp op)
bool needsWriteStaging(u32 size)
WGPUAddressMode toWGPUAddressMode(TextureWrap wrap)
BlendStateWGPU toWGPUBlend(BlendMode mode, bool layerAlpha=false)
Maps BlendMode to its WebGPU blend components — mirrors GLDevice's setBlendMode table (Overlay render...
u64 scanWGSLTextureKindMask(const char *source, u32 group, const char *kind)
Bit mask of the group's bindings whose declaration names the type kind.
WGPUCompareFunction toWGPUCompare(GfxStencilFunc func)
WGPUFeatureName compressionFeatureFor(GfxCompressedFormat fmt)
constexpr WGPUVertexFormat kInvalidVertexFormat
Sentinel for "no WGPU spelling": the header defines no Undefined vertex format, so the enum's non-val...
u64 scanWGSLArrayTextureMask(const char *source, u32 group)
Bit mask of the group's bindings a WGSL source declares as texture_2d_array.
constexpr u32 kGroup1TextureUnits
Texture units the group-1 convention spans — see WGSL_MAX_TEXTURE_UNITS.
WGPUCullMode toWGPUCullMode(bool enabled, bool front)
Cull state (PipelineDesc.cullEnabled/cullFront). Front face is CCW, matching the GL backend's default...
WGPUColor toWGPUClearColor(const RenderPassDesc &desc)
WGPUBufferUsage toWGPUBufferUsage(GfxBufferUsage usage)
WGPUTextureFormat toWGPUTextureFormat(GfxPixelFormat fmt)
WGPULoadOp toWGPULoadOp(bool clearRequested, bool scoped)
WGPUTextureFormat toWGPUCompressedFormat(GfxCompressedFormat fmt)
u64 scanWGSLDepthTextureMask(const char *source, u32 group)
Bit mask of the group's bindings a WGSL source declares as DEPTH textures.
u32 alignedWriteSize(u32 size)
@ MirroredRepeat
Tile with mirroring.
Definition GfxEnums.hpp:65
@ Repeat
Tile the texture.
Definition GfxEnums.hpp:63
@ ClampToEdge
Clamp to edge pixels.
Definition GfxEnums.hpp:64
bool writesStencil(GfxStencilMode mode)
std::uint64_t u64
Unsigned 64-bit integer.
Definition Types.hpp:47
GfxStencilMode
Stencil behaviour baked into a pipeline. The reference value is dynamic (GfxDevice::setStencilReferen...
@ Test
Draw only INSIDE the mask: func Equal, op Keep.
@ Write
Write the reference where drawn (mask fill): func Always, op Replace, color write off.
@ Decrement
Restore the parent reference on leaving a nested mask.
@ Increment
Enter a nested mask only where the parent reference matches.
@ TestOutside
Draw only OUTSIDE it: func NotEqual, op Keep — a hole, not a window.
@ Off
No stencil test; full color write.
@ Zero
Retire a root mask without writing color.
@ Storage
Read and written by compute shaders (var<storage, read_write>), and readable back....
Definition GfxEnums.hpp:77
@ Nearest
No interpolation (pixelated look).
Definition GfxEnums.hpp:58
GfxCompressedFormat
GPU-compressed texture internal formats for createCompressedTexture.
Definition GfxEnums.hpp:326
@ ETC2_RGBA8_SRGB
GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC (core).
Definition GfxEnums.hpp:333
@ S3TC_DXT5
GL_COMPRESSED_RGBA_S3TC_DXT5_EXT (extension).
Definition GfxEnums.hpp:332
@ ETC2_RGB8
GL_COMPRESSED_RGB8_ETC2 (core).
Definition GfxEnums.hpp:327
@ S3TC_DXT5_SRGB
GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT (extension).
Definition GfxEnums.hpp:335
@ ASTC_8x8
GL_COMPRESSED_RGBA_ASTC_8x8_KHR (extension).
Definition GfxEnums.hpp:330
@ S3TC_DXT1
GL_COMPRESSED_RGBA_S3TC_DXT1_EXT (extension).
Definition GfxEnums.hpp:331
@ ASTC_4x4_SRGB
GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR (extension).
Definition GfxEnums.hpp:334
@ ETC2_RGBA8
GL_COMPRESSED_RGBA8_ETC2_EAC (core).
Definition GfxEnums.hpp:328
@ ASTC_4x4
GL_COMPRESSED_RGBA_ASTC_4x4_KHR (extension).
Definition GfxEnums.hpp:329
std::uint32_t u32
Unsigned 32-bit integer.
Definition Types.hpp:45
BlendMode
Predefined blend modes for rendering.
Definition BlendMode.hpp:22
std::uint8_t u8
Unsigned 8-bit integer.
Definition Types.hpp:41
constexpr u32 WGSL_MAX_TEXTURE_UNITS
Units a tN / sN name can carry — the batch stream and a material's own.
Immutable description of a draw pipeline. Equality keys the pipeline cache, so two draws with the sam...
One render pass: a target, which attachments to clear on entry, and the clear values — full load-op s...
Definition GfxEnums.hpp:485
One RHI blend mode as a full WebGPU blend state (color + alpha).