26#define g_renderContext (ctx().tryGet<RenderContext>())
27#define g_resourceManager (ctx().tryGet<resource::ResourceManager>())
41 const auto target = rm->preferredShaderTarget();
44 if (vert.empty() || frag.empty()) {
45 ES_LOG_ERROR(
"material_compileEsshader: stage assembly failed for '{}'", parsed.
name);
53 rm->preferredShaderLanguage(), rm->deferLinks());
54 if (!handle.
isValid())
return 0;
56 if (
Shader* s = rm->getShader(handle)) {
60 rc->materials().rememberSource(handle, source, featuresCsv);
87 rec.
depthBias =
static_cast<i16>(std::clamp(depthBias, -32768, 32767));
88 rc->materials().define(materialId, rec);
95 const f32 vals[4] = { v0, v1, v2, v3 };
96 rc->materials().setUniform(materialId, name, vals, arity);
#define g_resourceManager
Logging utilities for ESEngine.
#define ES_LOG_ERROR(...)
Logs an error message.
Material + .esshader entry points, for whichever core is embedded.
Engine-side material registry — the resolved "how to draw" for a material handle.
Rendering context containing all renderer state.
Central resource management system.
Parser for unified .esshader file format.
GPU shader program abstraction.
GPU texture abstraction for 2D images.
static MaterialUniformLayout layoutOf(const resource::ParsedShader &parsed)
static void seedSamplers(Shader &shader, const resource::ParsedShader &parsed)
Point each of shader's texture params at its unit.
GPU shader program for rendering.
bool isValid() const
Checks if the handle references a valid resource.
IdType id() const
Gets the packed identifier (index + generation).
static std::vector< std::string > splitFeatures(const std::string &csv)
Split a comma-separated feature/switch list into trimmed, non-empty entries — the form the boundary c...
static ParsedShader parse(const std::string &source)
Parses shader source into structured format (no include support).
static std::string assembleStage(const ParsedShader &parsed, ShaderStage stage, const std::string &platform="", const std::vector< std::string > &features={}, ShaderTargetLanguage target=ShaderTargetLanguage::GLSL_ES300)
Assembles final GLSL source for a specific stage.
Handle< esengine::Shader > ShaderHandle
Handle to a shader resource.
Handle< esengine::Texture > TextureHandle
Handle to a texture resource.
void material_setUniform(u32 materialId, const std::string &name, u32 arity, f32 v0, f32 v1, f32 v2, f32 v3)
u32 material_compileEsshader(const std::string &source, const std::string &featuresCsv)
std::int32_t i32
Signed 32-bit integer.
void material_setTexture(u32 materialId, const std::string &name, u32 textureHandle)
void material_define(u32 materialId, u32 shaderHandle, u32 blendMode, u32 flags, i32 depthBias)
std::int16_t i16
Signed 16-bit integer.
std::uint32_t u32
Unsigned 32-bit integer.
BlendMode
Predefined blend modes for rendering.
void material_undefine(u32 materialId)
static EstellaContext & ctx()
EstellaContext & activeCtx()
The engine context every binding routes through — single source of truth.
CullMode
Triangle culling mode baked into a material's pipeline.
float f32
32-bit floating point
A material's resolved render state (P0) plus its packed std140 constants (P1).
resource::ShaderHandle shaderRef
u32 shader
Program id; 0 means "use the path's default batch shader".
Result of parsing an .esshader file.
std::string errorMessage
Parse error if any.
bool valid
True if parsing succeeded.
std::string name
Shader name.