When I click the “compile and show code” button, I get this list of six D3D errors. Can anyone tell me what it means?
If I check the error in the console I see things like this:
The only other mention I’ve found of this “maximum temp register index exceeded” error was in this unanswered thread relating to shader debugging.
The lines of code where the errors occur are shown below. I didn’t write them; they are from a GLSL water-ripple effect I found somewhere online which I’m using as a placeholder until I have time to sit down and figure out something better-suited to the look I want.
// line 53
return frac(sin(p.x * 15.32 + p.y * 35.78) * 43758.23);
// line 57
return float2(hash(p * 0.754),hash(1.5743 * p.yx + 4.5891)) - 0.5;
// line 74
float3 ny = h*h*h*h* float3( dot(a,hash2(i+4.5)), dot(b,hash2(i+o+4.5)), dot(c,hash2(i+1.0+4.5)));
So it appears I have too many variables in this shader. Assuming I understood that discussion correctly, my question is this: Is it the number of variables being used at any given moment, or is it about the total number of variables used by the shader overall?
I’m guessing it’s the number used at a given moment. The huge calc on line 74 makes multiple calls to hash2(), line 57 is the return from hash2() which itself calls hash(), and line 53 is the return from hash(). Clearly that’s a pretty deep stack of temps before you get the final result.
Or did I misunderstand and the problem is something else entirely?
Oddly I don’t get this error in the editor any more, but when I do a real build it still shows up. (Different lines, I’ve changed the shader quite a lot since then.)