diff --git a/internal/shaderir/glsl.go b/internal/shaderir/glsl.go index e6d08fc34..663722dc2 100644 --- a/internal/shaderir/glsl.go +++ b/internal/shaderir/glsl.go @@ -219,8 +219,10 @@ func (p *Program) glslBlock(b *Block, level int, localVarIndex int) []string { return fmt.Sprintf("V%d", idx) case idx == nv: return "gl_FragCoord" + case idx == nv+1: + return "gl_FragColor" default: - return fmt.Sprintf("l%d", idx-(nv+1)) + return fmt.Sprintf("l%d", idx-(nv+2)) } default: return fmt.Sprintf("l%d", idx) diff --git a/internal/shaderir/ir_test.go b/internal/shaderir/ir_test.go index 99f6efeed..7f7ed214d 100644 --- a/internal/shaderir/ir_test.go +++ b/internal/shaderir/ir_test.go @@ -757,9 +757,9 @@ void main(void) { vec2 l0; vec4 l1; float l2; - l2 = V0; - l0 = V1; - l1 = gl_FragCoord; + l1 = V0; + gl_FragColor = V1; + l0 = gl_FragCoord; }`, }, }