Bug 10476

Summary: GLSL texture3D method generates Seg Fault
Product: Mesa Reporter: Tim Bentley <tim.bentley>
Component: OtherAssignee: mesa-dev
Status: RESOLVED FIXED QA Contact:
Severity: critical    
Priority: highest    
Version: 6.5   
Hardware: All   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: Sample application showing shader problem

Description Tim Bentley 2007-03-30 09:01:19 UTC
I keep encountering a Segmentation fault when the GLSL texture3D method is executed in a fragment shader.
Comment 1 Tim Bentley 2007-03-30 09:04:46 UTC
Created attachment 9385 [details]
Sample application showing shader problem

Attached is a sample application showing the problem.  The file should be unpacked in the progs directory and then the application can be built.
Comment 2 Brian Paul 2007-03-30 12:30:33 UTC
Looks like you've got a bug in your fragment shader.

It's illegal to write to a uniform variable in your shader:

   uniform vec3 normalNoise;
   ...
   normalNoise = texture3D(NoiseTex, noiseTexCoord);\n"

I'll add an error check for that in Mesa.

Are you using Mesa from git?
Comment 3 Tim Bentley 2007-03-30 13:46:20 UTC
Thanks for the quick reqponse.

I looked at the code and saw what you are talking about.  That was pointed out to me before but I forgot to fix it, sorry about that.

None the less, if you remove the declaration from the top of the shader and declare it in the in the code (ie. "vec3 normalNoise = texture3D(NoiseTex, noiseTexCoord);") you get the same results.  Again if you comment the line out, the application runs.

I have tried it with Release Version 6.5.2 and from the latest in git (as of 28 March 2007).  I was going to try it with the glsl-compiler-1 branch but I could not get it to compile.

Tim
Comment 4 Brian Paul 2007-03-30 14:31:29 UTC
You've got a number of bugs in your program.  For example, the texture sampler binding is incorrect.  It's supposed to be the texture unit, not texture object ID.

The texcoords are suspect too.  In fact, Mesa's rasterizer is crashing because one of the texture coords is extremely large.

Another thing: you seem to be mixing OpenGL 2.0 and GL_ARB_shader_objects functions.  You should stick with one or the other exclusively.

I'll send you a hacked version of your demo that seems to work for me.
Comment 5 Brian Paul 2007-04-07 10:35:00 UTC
Added a check in the compiler to generate warning on assignment to read-only values.  Closing.  Re-open if there's anything else.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.