PDA

View Full Version : Something in FF Pipe affecting rendering...



scratt
02-22-2009, 08:05 AM
I think perhaps I am forgetting some aspect of the OpenGL Fixed Function Pipeline..

Sorry for the length of this post.

Basically I have a HUD overlaid on a complex OpenGL scene. The scene almost entirely relies on shaders for drawing and is totally stable. The HUD does not use shaders at all. So it is affected by the state of OpenGL. Earlier today after apparently no code change a problem occurred. Believe me I have tried rolling back but the problem persists.

Looking in some directions in my scene the HUD text and images are drawn using their correct colours. In other directions the colours (whilst still being similar to their definition) are varying degrees of washed out. Almost like lighting is on, or some blending mode is not as I expect. My first instinct was that it was the blend mode, or GL_TEXTURE_ENV_MODE that was being altered by the scene and the state was affecting my HUD.

So I profiled the code and took comprehensive text dumps of the OpenGL state just before the HUD is drawn in both styles. i.e. Looking once in each direction that gives different results. I then did a diff on the resulting text files to find what attributes were changed.

I found that a couple of colour pointers had changed, but I don't use arrays in the HUD and just to make sure forced all the pointers and client states to NULL/off.

I found that lighting was not on, but in any case forced it off.

I also noticed that there was a difference in the GL_TEXTURE_ENV_MODE for one texture, which I thought for sure was the culprit. I fixed that.

I now have 20 or so lines of OpenGL code before the HUD is drawn simply to squash any and all pointer, texture mode, blend mode, array pointers etc. being in any state that might cause problems.

Off the top of anyones head, bearing in mind that my GL profiler shows no further differences other than some matrix differences, and no shaders or buffer objects are enabled what could be causing this effect?

tamlin
02-22-2009, 09:49 AM
Just an idea, but have you tried to reboot?

I have experienced "unexplainable" errors, from time to time, that have turned out to likely be driver or even h/w bugs; if a problem (not necessarily a noticable one) has been encountered, all following attempts to do something (seemingly unrelated) that "should work" has failed to produce the requested/intended result, and only a reboot has solved it.

But before a reboot, I'd suggest a test-run using Mesa3D in software mode if possible. Sure, it'll be slow (with all the shaders), but it should at least be repeatable and deterministic.

++luck;

scratt
02-22-2009, 09:56 AM
Thanks for the idea. You may have a point with the hardware problem. I have just had a run of GUI lockups for no explainable reason... Unfortunately that means I have rebooted and the problem has not gone away...

This might be more serious than I thought!
Fingers crossed for it being my fault still. My new machine is still getting some last minute lovin' at the Apple factory!

tamlin
02-22-2009, 10:13 AM
Do you have any translucent surfaces drawn when it fails? I'm just thinking... alpha test/blend state not properly restored/set by you/driver/hardware? Residual FBO not properly unmapped? Perhaps as simple as shaders using different FB target alpha coords than FF? You did mention something about some matrix differences...

scratt
02-22-2009, 10:20 AM
Here is the diff with the things I think are inconsequential..
i.e. Have not / cannot fix to be identical..




14c14
< GL_COLOR_ARRAY_POINTER 0x3154f000
---
> GL_COLOR_ARRAY_POINTER 0x00000000
16c16
< GL_COLOR_ARRAY_STRIDE 24
---
> GL_COLOR_ARRAY_STRIDE 12
143c143
< GL_CURRENT_MATRIX_ARB {0.663626, 0.0139477, 0.747935, 0, -0.0151205, 0.999872, -0.00522987, 0, -0.747912, -0.00783843, 0.663752, 0, 11.2187, 0.117576, -9.95627, 1}
---
> GL_CURRENT_MATRIX_ARB {0.966794, 0.0139477, 0.255175, 0, -0.015486, 0.999872, 0.00402028, 0, -0.255087, -0.00783844, 0.966886, 0, 3.8263, 0.117577, -14.5033, 1}
235c235
< GL_POSITION {11.2187, 0.117576, -9.95627, 1}
---
> GL_POSITION {3.8263, 0.117577, -14.5033, 1}
1136c1136
< GL_TEXTURE_BINDING_2D 38
---
> GL_TEXTURE_BINDING_2D 20
1391c1391
< GL_TEXTURE_BINDING_3D 39
---
> GL_TEXTURE_BINDING_3D 17
1400c1400
< GL_TEXTURE_3D 128
---
> GL_TEXTURE_3D 64
1411c1411
< GL_TEXTURE_3D 128
---
> GL_TEXTURE_3D 64
1422c1422
< GL_TEXTURE_3D 4
---
> GL_TEXTURE_3D 8
1899c1899
< GL_TEXTURE_BINDING_3D 40
---
> GL_TEXTURE_BINDING_3D 18
1908c1908
< GL_TEXTURE_3D 128
---
> GL_TEXTURE_3D 64
1919c1919
< GL_TEXTURE_3D 128
---
> GL_TEXTURE_3D 64
1930c1930
< GL_TEXTURE_3D 4
---
> GL_TEXTURE_3D 8
2888,2889c2888,2889
< GL_MODELVIEW_MATRIX {0.663626, 0.0139477, 0.747935, 0, -0.0151205, 0.999872, -0.00522987, 0, -0.747912, -0.00783843, 0.663752, 0, 11.2187, 0.117576, -9.95627, 1}
< GL_TRANSPOSE_MODELVIEW_MATRIX {0.663626, -0.0151205, -0.747912, 11.2187, 0.0139477, 0.999872, -0.00783843, 0.117576, 0.747935, -0.00522987, 0.663752, -9.95627, 0, 0, 0, 1}
---
> GL_MODELVIEW_MATRIX {0.966794, 0.0139477, 0.255175, 0, -0.015486, 0.999872, 0.00402028, 0, -0.255087, -0.00783844, 0.966886, 0, 3.8263, 0.117577, -14.5033, 1}
> GL_TRANSPOSE_MODELVIEW_MATRIX {0.966794, -0.015486, -0.255087, 3.8263, 0.0139477, 0.999872, -0.00783844, 0.117577, 0.255175, 0.00402028, 0.966886, -14.5033, 0, 0, 0, 1}
2891c2891
< GL_TRANSPOSE_CURRENT_MATRIX_ARB {0.663626, -0.0151205, -0.747912, 11.2187, 0.0139477, 0.999872, -0.00783843, 0.117576, 0.747935, -0.00522987, 0.663752, -9.95627, 0, 0, 0, 1}
---
> GL_TRANSPOSE_CURRENT_MATRIX_ARB {0.966794, -0.015486, -0.255087, 3.8263, 0.0139477, 0.999872, -0.00783844, 0.117577, 0.255175, 0.00402028, 0.966886, -14.5033, 0, 0, 0, 1}
2898c2898
< GL_TRANSPOSE_CURRENT_MATRIX_ARB {0.663626, -0.0151205, -0.747912, 11.2187, 0.0139477, 0.999872, -0.00783843, 0.117576, 0.747935, -0.00522987, 0.663752, -9.95627, 0, 0, 0, 1}
---
> GL_TRANSPOSE_CURRENT_MATRIX_ARB {0.966794, -0.015486, -0.255087, 3.8263, 0.0139477, 0.999872, -0.00783844, 0.117577, 0.255175, 0.00402028, 0.966886, -14.5033, 0, 0, 0, 1}

zeoverlord
02-22-2009, 11:14 AM
what about an extra active multitexture that wasn't disabled.

scratt
02-22-2009, 11:36 AM
Interesting, but as I am almost totally shader based I don't use it.

I am worried that it is something like that though.
I guess one solution would be to simply take my HUD into shaders also!

I have had two more GPU lockups, so unless I have managed to corrupt something badly enough to crash my WIndow Server, and take out OpenGL etc. this is looking worryingly like a GPU on it's last legs.