Estella 0.113.0
A fast 2D and 3D game engine powered by WebAssembly and ECS
Loading...
Searching...
No Matches
WgslBindings.hpp File Reference

What a texture unit is called in WGSL, and what a WGSL source says about the group-1 bindings it holds. More...

#include "../../core/Types.hpp"
#include <cstdlib>
#include <cstring>
Include dependency graph for WgslBindings.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  esengine

Functions

constexpr u32 esengine::textureBindingForUnit (u32 unit)
 Group-1 binding of a texture unit. Units 0-7 are the batch stream and take bindings 0-7; a material's own units start at 8 and take 16 upward, leaving 8-15 for the samplers underneath the first eight.
constexpr u32 esengine::samplerBindingForUnit (u32 unit)
 Group-1 binding of a texture unit's sampler (see textureBindingForUnit).
u64 esengine::scanWGSLBindingMask (const char *source, u32 group)
 Bit mask of the @group(N) @binding(i) indices a WGSL source declares.
void esengine::scanWGSLReachedUnits (const char *source, u32 &textures, u32 &samplers)
 The tN / sN names a WGSL source REACHES, by unit.

Variables

constexpr u32 esengine::WGSL_MAX_TEXTURE_UNITS = 17
 Units a tN / sN name can carry — the batch stream and a material's own.

Detailed Description

What a texture unit is called in WGSL, and what a WGSL source says about the group-1 bindings it holds.

One author for a convention three places acted on: the shader assembler emits these declarations, the WebGPU backend builds its bind-group layouts from them, and the twin generator writes them into a cooked shader. Backend neutral on purpose — the assembler runs in a build with no WebGPU in it.

Definition in file WgslBindings.hpp.