Strange GLSL bug

Started by
9 comments, last by Rene Z 12 years, 9 months ago

a

Advertisement
Completely guessing - but it could have something to do with the fact that the while loop is unbounded (could be infinite).

ccc

Can't be that, the COMPILER crashes, it never even executes it.
Does it crash, or fail to link the shader, causing your program to crash? If the driver crashes, how do you get the error from it? [edit]Oh, does OpenTK throw an exception when you try to compile the shader? Does the exception contain any information from the driver's compiler about why it failed?

The compiler may be attempting to determine an upper-bound on the loop, and when it can't, it may return failure, which maybe OpenTK is translating into an exception for you.

Also, is this OpenGL or GLES, and which version of GLSL are you using?
either this is not the real error(somehting what happens before, or it is a driver error(did u upgrade your video drivers latly?)

to find out, test your code on another machiene and if it fails their also try to simplify your hole programm until u know what causes the bug.

ccc

can u rewrite your shader a little bit, so it will do the same thing but perhaps with other kind of loops or so?

If I remember correct there was a case that a compiler wouldn't comple a for loop if it had to many possible iterations, perhaps with your video card/driver the same is happining, could u post your hole shader code?
The problem is definately in that while() loop; I gave this a quick go (compiling on my Nvidia card) and the linker failed. I realize that the code you've given here is a simplified version, but I can't understand the fragment shader at all; as Hodgman said the while() loop could be infinite, and perhaps that's what's troubling the compiler.

Also (although this won't be what's causing the problem), 'varying' and 'ftransform' are deprecated, you need to specify that you're using the compatibillity profile or that your shaders are adhering to an older GLSL spec. Maybe you're doing this and just haven't included it in the example code.

Anyway, I'd second Danny02 and say that you should factor out that while() loop.
I've seen similar errors on Nvidia cards before:

1. Try updating your drivers.
2. Make sure your shader is only using characters that can be represented by ASCII. This is a GLSL limitation and shaders *will* fail mysteriously if you use other character sets, either in comments or in actual code.

[OpenTK: C# OpenGL 4.4, OpenGL ES 3.0 and OpenAL 1.1. Now with Linux/KMS support!]

ccc

This topic is closed to new replies.

Advertisement