|
Estella 0.113.0
A fast 2D and 3D game engine powered by WebAssembly and ECS
|
Result of parsing an .esshader file. More...
#include <ShaderParser.hpp>
Public Attributes | |
| std::string | name |
| Shader name. | |
| std::string | version |
| GLSL version. | |
| std::string | sharedCode |
| Code shared by all stages. | |
| std::unordered_map< ShaderStage, std::string > | stages |
| Stage source code. | |
| std::unordered_map< std::string, std::string > | variants |
| Platform variants. | |
| std::vector< std::string > | features |
| bool | lightingDirect = false |
| std::vector< ShaderSwitch > | switches |
| Material-controlled #pragma switch toggles (name + default). | |
| std::vector< ShaderProperty > | properties |
| Exposed material params (#pragma param / properties block). | |
| std::string | domain = "Unlit" |
| std::string | coverageParam |
| std::string | tipParam |
| std::string | hairShadowParam |
| bool | usesGBuffer = false |
| bool | usesLights = false |
| bool | highPrecision = false |
| std::string | vertexHook |
| std::string | wgslVertexHook |
| std::string | depthInput |
| float | vertexBounds = 0.0f |
| u32 | materialBlockSize = 0 |
| std::string | errorMessage |
| Parse error if any. | |
| bool | valid = false |
| True if parsing succeeded. | |
| std::vector< SourceLine > | expandedLineMap |
| Line map for the expanded pre-parse source. | |
| std::unordered_map< ShaderStage, std::vector< SourceLine > > | stageLineMaps |
| Per-stage line maps, parallel to stages[]. | |
| std::unordered_map< ShaderStage, std::string > | wgslStages |
| WGSL twin stage bodies (#pragma vertex wgsl / #pragma fragment
wgsl sections), keyed like stages[]. | |
| std::unordered_map< ShaderStage, std::vector< SourceLine > > | wgslStageLineMaps |
| Line maps for wgslStages, same convention as stageLineMaps. | |
| std::unordered_map< ShaderStage, bool > | wgslStageFull |
| Stages whose WGSL twin is a SELF-CONTAINED program (#pragma vertex
wgsl full / #pragma fragment wgsl full): assembly skips every injected header — the body carries its own declarations at the engine's binding conventions (group 0 UBO slots, group-1 texture/sampler unit map). The shape a cook-time GLSL→WGSL conversion emits, since a translator returns whole programs. | |
| bool | wgslVertexIsCanonical = false |
| True when the WGSL vertex stage is the injected canonical one. The WGSL fragment assembly then also injects the matching VSOut struct, so fragment-only twins write fs_main(v : VSOut) against an engine-owned interface. Authored twin pairs declare their own. | |
| bool | vertexIsCanonical = false |
| True when the GLSL vertex stage is the injected canonical one. | |
Result of parsing an .esshader file.
Contains all extracted information from a unified shader file including stages, properties, and platform variants.
Definition at line 147 of file ShaderParser.hpp.
| std::string esengine::resource::ParsedShader::coverageParam |
#pragma coverage <param>: while that float param is above zero, the shader's output alpha is coverage (a cutout sharpened to one texel), so an opaque draw may turn it into multisample coverage instead of a hard edge.
Definition at line 163 of file ShaderParser.hpp.
Referenced by esengine::MaterialStore::layoutOf(), esengine::resource::ShaderParser::parse(), esengine::MaterialStore::prepassCoverageProgram(), and esengine::MaterialStore::shadowProgram().
| std::string esengine::resource::ParsedShader::depthInput |
#pragma depthinput names the sole texture affecting a vertex hook's silhouette. Such a hook may otherwise depend only on geometry, instance records and material constants.
Definition at line 191 of file ShaderParser.hpp.
Referenced by esengine::MaterialStore::layoutOf(), and esengine::resource::ShaderParser::parse().
| std::string esengine::resource::ParsedShader::domain = "Unlit" |
#pragma domain (Unlit/Lit/PostProcess/UI)
Definition at line 159 of file ShaderParser.hpp.
Referenced by esengine::resource::ShaderParser::assembleStageEx(), esengine::esshader_cookInfo(), and esengine::resource::ShaderParser::parse().
| std::string esengine::resource::ParsedShader::errorMessage |
Parse error if any.
Definition at line 199 of file ShaderParser.hpp.
Referenced by esengine::esshader_cookInfo(), esengine::material_compileEsshader(), and esengine::resource::ShaderParser::parse().
| std::vector<SourceLine> esengine::resource::ParsedShader::expandedLineMap |
Line map for the expanded pre-parse source.
expandedLineMap[i] is the original SourceLine that produced line (i + 1) of the post-#include-expansion source. Callers that know the expanded-source line of a compile error can resolve it back to the original file.
Definition at line 210 of file ShaderParser.hpp.
Referenced by esengine::resource::ShaderParser::parse().
| std::vector<std::string> esengine::resource::ParsedShader::features |
Declared #pragma feature keywords (compile-time variants)
Definition at line 153 of file ShaderParser.hpp.
Referenced by esengine::resource::ShaderParser::assembleStageEx(), esengine::esshader_cookInfo(), and esengine::resource::ShaderParser::parse().
| std::string esengine::resource::ParsedShader::hairShadowParam |
#pragma hairshadow <param>: while that float param is above zero, meshes drawn with the material are hair — the frame fits a shadow cascade to them alone (so their layers are not lost in a texel of the view's own cascades), and the shader reads the shadow as a density along the light (a strand layer lets part of the light through) in place of a hard compare. The value is the density, in opacity per world unit.
Definition at line 172 of file ShaderParser.hpp.
Referenced by esengine::MaterialStore::layoutOf(), and esengine::resource::ShaderParser::parse().
| bool esengine::resource::ParsedShader::highPrecision = false |
#pragma highprecision: what this post-process shader writes is a measurement, not a picture, so its target is a float one whenever the device can render to one — even in a chain of 8-bit pictures.
Definition at line 182 of file ShaderParser.hpp.
Referenced by esengine::MaterialStore::layoutOf(), and esengine::resource::ShaderParser::parse().
| bool esengine::resource::ParsedShader::lightingDirect = false |
#pragma lighting direct: compiled with ES_LIGHT_DIRECT. Lit by the sixteen lights of the block and hard-edged shadows only, without what most scenes never reach and every pixel pays for regardless (on a phone, a third of a water's frame): the tiled lights, the 2D light masks, the soft and hair shadows.
Definition at line 156 of file ShaderParser.hpp.
Referenced by esengine::resource::ShaderParser::assembleStageEx(), and esengine::resource::ShaderParser::parse().
| u32 esengine::resource::ParsedShader::materialBlockSize = 0 |
std140 byte size of the generated MaterialConstants block (16-aligned), 0 if no non-texture params. The render path sizes the per-material UBO to this.
Definition at line 198 of file ShaderParser.hpp.
Referenced by esengine::resource::ShaderParser::assembleStageEx(), esengine::MaterialStore::layoutOf(), esengine::MaterialStore::prepassCoverageProgram(), and esengine::MaterialStore::shadowProgram().
| std::string esengine::resource::ParsedShader::name |
Shader name.
Definition at line 148 of file ShaderParser.hpp.
Referenced by esengine::esshader_cookInfo(), esengine::MaterialStore::layoutOf(), esengine::material_compileEsshader(), esengine::resource::ShaderParser::parse(), and esengine::MaterialStore::prepassCoverageProgram().
| std::vector<ShaderProperty> esengine::resource::ParsedShader::properties |
Exposed material params (#pragma param / properties block).
Definition at line 158 of file ShaderParser.hpp.
Referenced by esengine::resource::ShaderParser::assembleStageEx(), esengine::esshader_cookInfo(), esengine::MaterialStore::layoutOf(), esengine::resource::ShaderParser::parse(), esengine::MaterialStore::prepassCoverageProgram(), esengine::MaterialStore::seedSamplers(), and esengine::MaterialStore::shadowProgram().
| std::string esengine::resource::ParsedShader::sharedCode |
Code shared by all stages.
Definition at line 150 of file ShaderParser.hpp.
Referenced by esengine::resource::ShaderParser::assembleStageEx(), and esengine::resource::ShaderParser::parse().
| std::unordered_map<ShaderStage, std::vector<SourceLine> > esengine::resource::ParsedShader::stageLineMaps |
Per-stage line maps, parallel to stages[].
Entry N is the SourceLine for line (N + 1) of the stage body (the code between #pragma vertex/#pragma fragment and #pragma end, not including the assembled #version/sharedCode prefix).
Definition at line 219 of file ShaderParser.hpp.
Referenced by esengine::resource::ShaderParser::parse().
| std::unordered_map<ShaderStage, std::string> esengine::resource::ParsedShader::stages |
Stage source code.
Definition at line 151 of file ShaderParser.hpp.
Referenced by esengine::resource::ShaderParser::assembleStageEx(), and esengine::resource::ShaderParser::parse().
| std::vector<ShaderSwitch> esengine::resource::ParsedShader::switches |
Material-controlled #pragma switch toggles (name + default).
Definition at line 157 of file ShaderParser.hpp.
Referenced by esengine::esshader_cookInfo(), and esengine::resource::ShaderParser::parse().
| std::string esengine::resource::ParsedShader::tipParam |
#pragma tips <param>: while that float param is above zero, the shader draws a second, blended pass (compiled with ES_TIP_PASS) over the opaque one: the soft outer band of a cutout that coverage alone would stair-step.
Definition at line 167 of file ShaderParser.hpp.
Referenced by esengine::MaterialStore::layoutOf(), and esengine::resource::ShaderParser::parse().
| bool esengine::resource::ParsedShader::usesGBuffer = false |
#pragma gbuffer: a post-process shader reads the scene's surface record (normal, roughness, metalness) at unit kGBufferUnit, so the frame must draw one for it.
Definition at line 175 of file ShaderParser.hpp.
Referenced by esengine::MaterialStore::layoutOf(), and esengine::resource::ShaderParser::parse().
| bool esengine::resource::ParsedShader::usesLights = false |
#pragma lights: a post-process shader reads the frame's light block — which light is the sun, where it stands, and (through sunVisibility) whether the shadow map says a point of air is lit — so the pipeline binds the block and the shadow atlas for it.
Definition at line 179 of file ShaderParser.hpp.
Referenced by esengine::resource::ShaderParser::assembleStageEx(), esengine::MaterialStore::layoutOf(), and esengine::resource::ShaderParser::parse().
| bool esengine::resource::ParsedShader::valid = false |
True if parsing succeeded.
Definition at line 200 of file ShaderParser.hpp.
Referenced by esengine::resource::ShaderParser::assembleStageEx(), esengine::esshader_cookInfo(), esengine::resource::ShaderParser::featuresRead(), esengine::material_compileEsshader(), esengine::resource::ShaderParser::parse(), esengine::MaterialStore::prepassCoverageProgram(), and esengine::MaterialStore::shadowProgram().
| std::unordered_map<std::string, std::string> esengine::resource::ParsedShader::variants |
Platform variants.
Definition at line 152 of file ShaderParser.hpp.
Referenced by esengine::resource::ShaderParser::assembleStageEx(), and esengine::resource::ShaderParser::parse().
| std::string esengine::resource::ParsedShader::version |
GLSL version.
Definition at line 149 of file ShaderParser.hpp.
Referenced by esengine::resource::ShaderParser::assembleStageEx(), and esengine::resource::ShaderParser::parse().
| float esengine::resource::ParsedShader::vertexBounds = 0.0f |
#pragma vertexbounds <units>: how far the hook can move a vertex from the mesh's own bounds, in the mesh's local units — what culling must grow its box by so a bent mesh is not dropped while still visible. Zero when the material has no hook.
Definition at line 195 of file ShaderParser.hpp.
Referenced by esengine::MaterialStore::layoutOf(), and esengine::resource::ShaderParser::parse().
| std::string esengine::resource::ParsedShader::vertexHook |
#pragma vertexoffset: the body of esMaterialVertex(inout local, inout localNormal, uv), run on a resident mesh's local-space vertex before it is posed and placed. It is the material's own, so the canonical mesh vertex stage calls it and a material without one assembles exactly as before. The WGSL twin takes pointers instead of inout.
Definition at line 187 of file ShaderParser.hpp.
Referenced by esengine::resource::ShaderParser::assembleStageEx(), esengine::MaterialStore::layoutOf(), esengine::resource::ShaderParser::parse(), esengine::MaterialStore::prepassCoverageProgram(), and esengine::MaterialStore::shadowProgram().
| bool esengine::resource::ParsedShader::vertexIsCanonical = false |
True when the GLSL vertex stage is the injected canonical one.
Only then does the engine decide how a vertex reaches clip space, which is what lets a material be compiled for a second vertex source (MESH). A shader that writes its own vertex stage owns that decision and cannot be retargeted behind its back.
Definition at line 260 of file ShaderParser.hpp.
Referenced by esengine::resource::ShaderParser::assembleStageEx(), and esengine::resource::ShaderParser::parse().
| std::unordered_map<ShaderStage, bool> esengine::resource::ParsedShader::wgslStageFull |
Stages whose WGSL twin is a SELF-CONTAINED program (#pragma vertex wgsl full / #pragma fragment wgsl full): assembly skips every injected header — the body carries its own declarations at the engine's binding conventions (group 0 UBO slots, group-1 texture/sampler unit map). The shape a cook-time GLSL→WGSL conversion emits, since a translator returns whole programs.
Definition at line 243 of file ShaderParser.hpp.
Referenced by esengine::resource::ShaderParser::parse().
| std::unordered_map<ShaderStage, std::vector<SourceLine> > esengine::resource::ParsedShader::wgslStageLineMaps |
Line maps for wgslStages, same convention as stageLineMaps.
Definition at line 233 of file ShaderParser.hpp.
Referenced by esengine::resource::ShaderParser::parse().
| std::unordered_map<ShaderStage, std::string> esengine::resource::ParsedShader::wgslStages |
WGSL twin stage bodies (#pragma vertex wgsl / #pragma fragment wgsl sections), keyed like stages[].
A 2D-domain shader with a WGSL fragment but no WGSL vertex gets the canonical 2D vertex injected here at parse (wgslVertexIsCanonical). An empty map means the shader has no WGSL twin: assembling for the WGSL target reports a descriptive error.
Definition at line 230 of file ShaderParser.hpp.
Referenced by esengine::esshader_cookInfo(), and esengine::resource::ShaderParser::parse().
| std::string esengine::resource::ParsedShader::wgslVertexHook |
Definition at line 188 of file ShaderParser.hpp.
Referenced by esengine::resource::ShaderParser::parse(), and esengine::MaterialStore::shadowProgram().
| bool esengine::resource::ParsedShader::wgslVertexIsCanonical = false |
True when the WGSL vertex stage is the injected canonical one. The WGSL fragment assembly then also injects the matching VSOut struct, so fragment-only twins write fs_main(v : VSOut) against an engine-owned interface. Authored twin pairs declare their own.
Definition at line 251 of file ShaderParser.hpp.
Referenced by esengine::resource::ShaderParser::parse().