Known bugs in OpenGL 3, OpenGL 4 implementations
As we all get to know eventually, the specification is one thing and the implementation is another. Most of bugs we cause ourselves, but sometimes that's not the case.
I believe it'd be useful to make a small list of:
What are the currently known bugs in the GPU drivers, related to the implementation of recent versions of开发者_C百科 OpenGL and GLSL?
Please remember to always post the relevant graphics card and driver version.
Let me start:
- GPU: confirmed on AMD/ATI Radeon HD 4650
- Type: GLSL problem
- GL version related: confirmed on 3.3, probably 3.1 and up (or even before)
- Relevant link: http://forums.amd.com/devforum/messageview.cfm?catid=392&threadid=139288
- Driver version: confirmed on Catalyst 10.10 (9-28-2010)
- Status: as of 2010-11-27 it has a fix, but it aparrently didn't reach the public driver release yet (so even if the fix gets released, users with not-so-recent version of drivers will still be affected for like months)
- Description:
If in your vertex shader you have any attribute
(in
) variable whose name is lexically after gl_
, then you cannot use built-in attributes, namely gl_VertexID
and gl_InstanceID
. If you try, the shader won't work (blank screen, likely).
- Workaround (new):
Only available with GLSL 3.3 and up, or with the GL_ARB_explicit_attrib_location extension.
Define any attribute's location explicitly to be equal to 0, by appending layout(location=0)
to its declaration in the vertex shader. You may, but don't need to use this for other attributes; the important thing is that ANY attribute needs to have location equal to 0. After you do that, the naming is no longer important.
- Workaround (alternative):
Use a name convention which requires you to name your attribute variables starting with a_
, which won't hurt your code readability and will make all of them be lexically before gl_
(safe zone).
Another gl_VertexID bug:
- GPU: NVIDIA GeForce 9400M
- Type: GLSL problem
- Driver version: NVDANV50Hal 1.6.36
- OpenGL version: 2.1, GLSL 1.2 using GL_EXT_gpu_shader4 extension
This occurs on Macbooks. It's possible that the new driver enabling OpenGL 3.2 that comes with OS X Lion has fixed the issue but a lot of frameworks are only configured to use the legacy 2.1 drivers so this is still relevant.
If you read gl_VertexID before you read another attribute in a vertex shader, the latter attribute will return junk data. If the other attribute is gl_Color, regardless of how it is used, nothing will be rendered. Accessing other built-in attributes can lead to other strange behavior.
- Workaround:
If you must use gl_VertexID, read all other attributes you will need first. If you read another attribute first, followed by gl_VertexID, any subsequent reads of the attribute will work fine.
精彩评论