|
Estella 0.113.0
A fast 2D and 3D game engine powered by WebAssembly and ECS
|
Per-draw shader parameter block — the UBO home for what used to be loose uniforms. More...


Go to the source code of this file.
Classes | |
| struct | esengine::DrawParamSlot |
| One lifted uniform's slot in a shader's std140 DrawParams block. More... | |
| struct | esengine::DrawParamsLayout |
| A shader's DrawParams layout: lifted members + 16-aligned block size. More... | |
| struct | esengine::DrawParamsRewrite |
| Result of rewriteLooseUniforms; layout.empty() ⇒ sources unchanged. More... | |
Namespaces | |
| namespace | esengine |
Enumerations | |
| enum class | esengine::DrawParamType : u8 { esengine::Float , esengine::Int , esengine::Vec2 , esengine::Vec3 , esengine::Vec4 , esengine::Mat3 , esengine::Mat4 } |
| GLSL type of one lifted uniform (the subset the rewriter supports). More... | |
Functions | |
| void | esengine::drawParamSizeAlign (DrawParamType t, u32 &size, u32 &align) |
| std140 size/base-alignment of a supported param type. | |
| DrawParamsRewrite | esengine::rewriteLooseUniforms (const std::string &vertexSrc, const std::string &fragmentSrc) |
| Lifts loose non-sampler uniform declarations out of both stages into one shared std140 DrawParams block. | |
Variables | |
| constexpr u32 | esengine::DRAW_PARAMS_BINDING = 4 |
| Indexed UBO binding point for the per-draw DrawParams block. (0 = FrameConstants, 1 = MaterialConstants, 2 = LightConstants, 3 = TimeConstants.). | |
| constexpr const char * | esengine::DRAW_PARAMS_BLOCK = "DrawParams" |
| GLSL block name; must match the rewriter's generated block + Shader::compile lookup. | |
| constexpr u32 | esengine::DRAW_PARAMS_FALLBACK_SIZE = 4096 |
| Size of the zeroed fallback UBO RenderContext binds at DRAW_PARAMS_BINDING each frame. | |
Per-draw shader parameter block — the UBO home for what used to be loose uniforms.
Shaders created through ResourceManager::createShader (user draw shaders, post-process effects) may declare loose non-sampler uniforms; rewriteLooseUniforms() lifts those declarations into one layout(std140) uniform DrawParams { ... } block and reports the member layout. Shader keeps a CPU shadow of the block: setUniform writes land in the shadow by std140 offset and commitParams() uploads + binds the shader's UBO at DRAW_PARAMS_BINDING before the draw. Samplers stay loose uniforms (GL sampler units; bind-group entries on future backends). The setUniform authoring surface is unchanged while all uniform DATA flows through the buffer seam a WebGPU backend requires.
Definition in file DrawParams.hpp.