{"record":{"id":"4d609f65dd4b71bc","repo":"a-b-street/abstreet","slug":"backend-glow","errorCode":null,"errorMessage":"{}","messagePattern":"\\{\\}","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"widgetry/src/backend_glow.rs","lineNumber":34,"sourceCode":"    gl: &glow::Context,\n    vertex_shader_src: &str,\n    fragment_shader_src: &str,\n) -> anyhow::Result<glow::Program> {\n    let program = gl.create_program().expect(\"Cannot create program\");\n\n    let shaders = [\n        compile_shader(gl, glow::VERTEX_SHADER, vertex_shader_src)?,\n        compile_shader(gl, glow::FRAGMENT_SHADER, fragment_shader_src)?,\n    ];\n\n    for shader in &shaders {\n        gl.attach_shader(program, *shader);\n    }\n\n    gl.link_program(program);\n    if !gl.get_program_link_status(program) {\n        error!(\"Linking error: {}\", gl.get_program_info_log(program));\n        panic!(\"{}\", gl.get_program_info_log(program));\n    }\n\n    for shader in &shaders {\n        gl.detach_shader(program, *shader);\n        gl.delete_shader(*shader);\n    }\n\n    gl.use_program(Some(program));\n\n    gl.enable(glow::SCISSOR_TEST);\n    gl.enable(glow::DEPTH_TEST);\n    gl.depth_func(glow::LEQUAL);\n    gl.enable(glow::BLEND);\n    gl.blend_func_separate(\n        glow::ONE,\n        glow::ONE_MINUS_SRC_ALPHA,\n        glow::ONE_MINUS_DST_ALPHA,\n        glow::ONE,","sourceCodeStart":16,"sourceCodeEnd":52,"githubUrl":"https://github.com/a-b-street/abstreet/blob/0964f29315820c91b171b585eb51e300164e9197/widgetry/src/backend_glow.rs#L16-L52","documentation":"widgetry panics when a WebGL shader program fails to link. The library attaches the compiled shaders, calls link_program, and checks get_program_link_status; on failure it logs and panics with the driver's info log. This means a vertex/fragment shader failed to compile or link (varying mismatch, uniform type conflicts, unsupported GLSL).","triggerScenarios":"Calling setup/webgl1_program/webgl2_program with shader source that compiles individually but fails to link: mismatched varyings between vertex and fragment stages, uniform declared with different types across stages, too many uniforms for the GPU, or GLSL syntax the driver rejects.","commonSituations":"Running on drivers/ANGLE backends with stricter linking rules, upgrading GPU drivers changing GLSL validation, hand-edited shader strings with typos in varying names, using GLSL features unsupported by WebGL1 (e.g. dynamic loop bounds).","solutions":["Read the panic message: it contains gl.get_program_info_log with the driver's exact link error.","Check the error! log line emitted just before the panic for the same info log.","Diff varying/attribute names and types between the vertex and fragment shaders; they must match exactly in WebGL1.","Test the shaders on the failing target (browser/GPU) — a program linking on desktop GL may fail on WebGL1/ANGLE.","Reduce uniform/attribute count if the log reports resource limits exceeded."],"exampleFix":"// before\nvarying vec3 pos; // fragment shader\n// after\nvarying vec3 world_pos; // matching name and type in BOTH vertex and fragment shaders","handlingStrategy":"validation","validationCode":"// Compile each stage first and check status before linking\nassert!(gl.get_shader_compile_status(vs), \"vs: {}\", gl.get_shader_info_log(vs));\nassert!(gl.get_shader_compile_status(fs), \"fs: {}\", gl.get_shader_info_log(fs));","typeGuard":null,"tryCatchPattern":"// Not catchable in Rust: this is a panic. Validate shader pairs before shipping; in release, wrap startup in catch_unwind to surface the info log.","preventionTips":["Log shader info logs at compile time, not just link time","Keep varying names/types identical between vertex and fragment stages","Test shaders on WebGL1 and WebGL2 targets and multiple GPUs","Keep uniform count within conservative limits"],"tags":["webgl","shader","gpu","panic"],"backgroundTag":"module-init-failed","analyzedSha":"0964f29315820c91b171b585eb51e300164e9197","analyzedAt":"2026-09-13T18:02:03.421Z","contentChangedAt":"2026-09-13T18:02:03.421Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}