gfx-rs/wgpu · error

Could not find color uniform in shader clear shader

Error message

Could not find color uniform in shader clear shader

What it means

Panic in the GLES adapter's shader-clear program setup: after linking the internal clear shader, the 'color' uniform location could not be found, so the clear helper cannot be driven. This indicates the internal shader linked abnormally or the context is degraded.

Source

Thrown at wgpu-hal/src/gles/adapter.rs:1071

                glow::FRAGMENT_SHADER,
                es,
            )?
        };
        unsafe { gl.attach_shader(program, vertex) };
        unsafe { gl.attach_shader(program, fragment) };
        unsafe { gl.link_program(program) };

        let linked_ok = unsafe { gl.get_program_link_status(program) };
        let msg = unsafe { gl.get_program_info_log(program) };
        if !msg.is_empty() {
            log::error!("Shader link error: {msg}");
        }
        if !linked_ok {
            return None;
        }

        let color_uniform_location = unsafe { gl.get_uniform_location(program, "color") }
            .expect("Could not find color uniform in shader clear shader");
        unsafe { gl.delete_shader(vertex) };
        unsafe { gl.delete_shader(fragment) };

        Some(ShaderClearProgram {
            program,
            color_uniform_location,
        })
    }
}

impl crate::Adapter for super::Adapter {
    type A = super::Api;

    unsafe fn open(
        &self,
        features: wgt::Features,
        _limits: &wgt::Limits,
        _memory_hints: &wgt::MemoryHints,

View on GitHub (pinned to 3e11ff59bf)

Solutions

  1. Report as a wgpu/driver bug with GL driver details
  2. Retry with a fresh context; treat clear operations as unusable on this driver
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at wgpu-hal/src/gles/adapter.rs:1071 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of gfx-rs/wgpu@3e11ff59bf (2026-09-03). Data as JSON: /api/errors/50496294d351e641. Report an issue: GitHub.