-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
area: graphicsGraphics related issueGraphics related issue
Description
This is a vertex shader we use to render to shadow map.
uniform mat4 matrix_viewProjection;
uniform mat4 matrix_model;
uniform mat3 matrix_normal;
vec3 dPositionW;
mat4 dModelMatrix;
mat3 dNormalMatrix;
mat4 getModelMatrix() {
return matrix_model;
}
vec4 getPosition() {
dModelMatrix = getModelMatrix();
vec3 localPos = vertex_position;
vec4 posW = dModelMatrix * vec4(localPos, 1.0);
dPositionW = posW.xyz;
vec4 screenPos;
screenPos = matrix_viewProjection * posW;
return screenPos;
}
vec3 getWorldPosition() {
return dPositionW;
}
vec3 getNormal() {
dNormalMatrix = matrix_normal;
vec3 tempNormal = vertex_normal;
return normalize(dNormalMatrix * tempNormal);
}
void main(void) {
gl_Position = getPosition();
vPositionW = getWorldPosition();
vNormalW = getNormal();
}
I added some new warnings to engine (commented out for now), and it triggers this:
Shader [Shader Id 0 standard] requires uniform [matrix_normal] which has not been set
When WebGL translates the shader for the platform, the uniform is not stripped out as dead code, but is compiled out on the driver level.
Ideally we'd change the shader generator to not include it to avoid - as we unnecessarily handle it. On WebGPU we need to allocate space for it in the uniform buffer as well.
When this is done, the warning should be enabled, as it's very helpful to have.
// Debug.warnOnce(`Shader [${shader.label}] requires uniform [${uniform.scopeId.name}] which has not been set, while rendering [${DebugGraphics.toString()}]`);
Metadata
Metadata
Assignees
Labels
area: graphicsGraphics related issueGraphics related issue