FyroxEngine/Fyrox · warning

Couldn't find uniform block U

Error message

Couldn't find uniform block U{}

What it means

When binding shader resources, the GL backend looks up each named uniform block by its resource definition; if the shader's compiled uniform block list contains no block matching the definition name, the block binding cannot be set and this warning is logged. The GPU program still runs, but the uniform block keeps default binding 0.

Solutions

  1. Verify the uniform block name in the shader GLSL exactly matches the resource definition name
  2. Ensure the property group is non-empty and actually used in the shader so it is not eliminated
  3. Rebuild/reimport the shader so its reflection data includes the block

Example fix

// before (shader GLSL)
// no declaration of the block
// after
uniform TLight { vec4 light_color; } Light; // name must match the definition's
Defensive patterns

Strategy: validation

Validate before calling

// confirm the shader declares the block before binding
let declared = glsl_source.contains("uniform T") && glsl_source.contains(&definition_name);
assert!(declared, "shader does not declare uniform block {}", definition_name);

Prevention

When it happens

Trigger: A shader material references a uniform block (PropertyGroup) that the shader program never declares (name mismatch or the block was optimized out / skipped as empty as in the 'Uniform block ... is empty' path).

Common situations: Renaming a property group in a shader file without updating material code; the GLSL compiler eliminating an unused uniform block; mixing shader versions where one declares the block and another doesn't.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


AI-assisted analysis of FyroxEngine/Fyrox@76c91aad8e (2026-09-10). Data as JSON: /api/errors/c7d6163a2a29dfde. Report an issue: GitHub.

Appendix: source

Thrown at fyrox-graphics-gl/src/program.rs:407

                        .get_uniform_location(program.id, &resource_definition.name)
                    {
                        server
                            .gl
                            .uniform_1_i32(Some(&location), resource_definition.binding as i32);
                    }
                }
                ShaderResourceKind::PropertyGroup { .. } => {
                    if let Some(shader_block_index) = server.gl.get_uniform_block_index(
                        program.id,
                        &format!("U{}", resource_definition.name),
                    ) {
                        server.gl.uniform_block_binding(
                            program.id,
                            shader_block_index,
                            resource_definition.binding as u32,
                        )
                    } else {
                        Log::warn(format!(
                            "Couldn't find uniform block U{}",
                            resource_definition.name
                        ));
                    }
                }
            }
        }
    }
}

impl GlProgram {
    pub fn from_source_and_resources(
        server: &GlGraphicsServer,
        program_name: &str,
        vertex_source: String,
        vertex_source_line_offset: isize,
        fragment_source: String,
        fragment_source_line_offset: isize,

View on GitHub (pinned to 76c91aad8e)