0
\$\begingroup\$

What could I've done wrong to get the following error message when trying to create a GLSL shader in Löve2D?

I'm sincerely clueless of what the mistake could be, though I suspect the error being a compile-time error because it's happening during love.load, in which I require the shader from another file (and not during love.draw).

The full code can be found here.

\$\endgroup\$

2 Answers 2

1
\$\begingroup\$

That error means that you're trying to use (directly or indirectly) a fragment shader that has too many uniform variables. Specifically, your hardware or GL implementation has a upper limit of about 3.5k bytes of uniform storage per shader (3584 bytes is room for 896 4-byte floats or 224 4-component float vectors).

Look through your shaders for one that declares a lot of uniforms and find a way to reduce the number of uniforms required (for example by moving the data into buffers of some sort).

\$\endgroup\$
2
  • \$\begingroup\$ This seems completely legit, as I'm actually sending the doubled 0 - 255 array needed for creating a Perlin Noise value from Lua to the Shader. How could I solve it? Should I send a single array with 256 elements and mod each access to that array by 256? \$\endgroup\$ Jun 11, 2016 at 16:20
  • \$\begingroup\$ Offhand, it sounds to me like a case for putting that data into a texture, constant buffer, or maybe as vertex attributes; no matter how you slice it, if you send it as a bunch of uniforms you're going to hit that uniform limit \$\endgroup\$
    – user1430
    Jun 11, 2016 at 16:22
0
\$\begingroup\$

extern float perm[512];

Note that uniforms allocated in vectors, not in single floats.
This array of 512 floats actually takes 512 vectors, (2048 floats)
You could try to pack this data in vec4 first, you will fit in 128 vectors then.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .