Closed Bug 1102891 Opened 11 years ago Closed 9 years ago

GLSL break statement ignored in shader

Categories

(Core :: Graphics: CanvasWebGL, defect)

31 Branch
x86_64
Windows 7
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: gclements, Unassigned)

Details

Consider a fragment shader like: #define MAX_POINTS 16 uniform int npoints; ..for (int i = 0; i < MAX_POINTS; i++) { ......if (i >= npoints) ..........break; ......// loop body ..} The intent is to perform a variable number of iterations in spite of the GLSL-ES restriction that iteration counts must be fixed at compile time (appendix A.4). The "break" statement appears to be silently ignored, i.e. the loop body is execute on all iterations. In this case, replacing the "break" with "continue" provides a sufficient workaround (once i>=npoints becomes true, it will remain true for all further iterations). But "break" statements are valid in the OpenGL ES 2.0 version of GLSL. Hardware: AMD Radeon HD 7800 Series OpenGL Driver Version: 6.14.10.12618
Component: Web Apps → Canvas: WebGL
Product: Firefox → Core
Sounds like an Angle issue to me, given that you are running Windows 7. I tried making a simple shader with such a loop and compiling it via Angle to HLSL, and I can see the `break` is still there in the right place, so it seems rather weird that you'd get this issue. Could you provide a test case?
Flags: needinfo?(glynn)
I can't reproduce this in my current version of Firefox (40.0.3).
The reporter can't repro it any more, considering this fixed.
Status: UNCONFIRMED → RESOLVED
Closed: 9 years ago
Flags: needinfo?(glynn)
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.