glsl - What is the limit on work item (shader instance) memory in WebGL? -


i declare array in webgl vertex shader:

attribute vec2 position;

void main() {    #define length 1024   float arr[length];   // use arr doesn't optimized away 

this works, if increase length 2048 gl.drawarrays nothing. there no errors- shaders compile, program links , passes gl.validateprogram. i'm guessing tried use memory on stack. there better, programmatic way discover limit? doing else wrong?

there no errors- shaders compile, program links , passes gl.validateprogram.

as guaranteed spec!

section 2.10: "vertex shaders", page 42:

a shader should not fail compile, , program object should not fail link due lack of instruction space or lack of temporary variables.

the glsl spec helpfully notes:

appendix a, section 3: "usage of temporary variables":

the maximum number of variables defined conformance tests.

you can own copy of conformance tests low, low price of $14,000-$19,000.

however, can @ least detect situation (section 2.10, page 41):

it not possible determine @ link time if program object execute. therefore validation done when first rendering command (drawarrays or drawelements) issued, determine if active program object can executed. if cannot executed no fragments rendered, , the rendering command generate error invalid_operation.


Comments