cancel
Showing results for 
Search instead for 
Did you mean: 

OpenGL & Vulkan

Zarkonnen
Adept I

Simple vertex shader mis-compiles with driver version 22.8.1, works fine with 22.5.1

I'm the developer of an indie game that's using some pretty old-fashioned OpenGL via lwjgl2. As of AMD drivers version 22.8.1, the shaders I use no longer work, whereas they used to work in 22.5.1. The shaders still compile with no errors in the log, but it seems the attribute names are truncated to two letters.

Specific example:

 

#version 150 compatibility

attribute vec4 tint;

void main() {
    gl_TexCoord[0] = gl_MultiTexCoord0;
    gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
    gl_FrontColor = tint;
}

 

When I compile this shader and enumerate these attributes on driver version 22.8.1, I get the attribute names "ti" and "gl". On version 22.5.1, and on any non-AMD cards, I get the attributes "gl_Vertex", "gl_MultiTexCoord0", and "tint".

I've tried various version and compatibility directives but the problem either persists, of if I increase the version enough, the driver understandably complains that stuff like gl_ModelViewProjectionMatrix is no longer supported.

So this appears to be a regression in the shaders between 22.5.1 and 22.8.1. I've asked users affected by this to report it via the AMD reporting tool, but so far there's been no indication that the reports have been processed.

Do you have any advice on what to do? (Except port the whole graphics system to a newer version of OpenGL, which is a prohibitive amount of work at this point.)

12 Replies
dipak
Big Boss

Hi @Zarkonnen ,

Thank you for reporting it. I have whitelisted you and moved the post to the OpenGL forum.

Please check the issue with the latest Adrenalin driver available here: Adrenalin 23.2.1

If the issue still persists, please mention the gpu information.

Thanks.

I can confirm that the issue persists with Adrenalin 23.2.1 - the attribute names are still truncated to two characters. I had users confirm this on a Radeon RX 6600 XT and a RX 580. (Links go to DxDiag outputs of the cards.)

0 Likes

Thanks for the above information. I have reported the issue to the OpenGL team.

Just to let you know, a bug ticket has been created to track this issue. Once I get any update on this, I will notify you.

Thanks.

Hi @Zarkonnen ,

As I have been informed, the OpenGL team was unable to reproduce the issue. They were trying to use OpenGL API glGetActiveAttrib to query the attribute names, and it worked well.

So, could you please let us know how you are getting the attribute names?

Thanks.

0 Likes

So the game uses the Slick2D and lwjgl2 Java libraries, which means I had to do some digging, but from what I can tell, it does the following:

getObjectParameterivARB(GL_ACTIVE_ATTRIBUTES) to get the number of attributes
getObjectParameterivARB(GL_ACTIVE_ATTRIBUTE_MAX_LENGTH) to get the max length of attribute names

and then it loops using glGetActiveAttribARB and glGetAttribLocationARB to get the information.

Next steps I can do:
- I can supply you with a link to the entire game executable, but that's hardly a minimum reproduction case.
- I will check if, for some reason, getObjectParameterivARB(GL_ACTIVE_ATTRIBUTE_MAX_LENGTH) returns 2, because that would account for the truncation.
- I can start working on a minimum reproduction case using the Java libraries.

0 Likes

Thanks for the above information. I will pass it on to the OpenGL team.

Once you have a minimal reproducible test-case, please provide it. 

Thanks.

OK, I have a minimum test case in Java now. You can download a compiled and executable version from here. Note that this test case still relies on the lwjgl2 bindings, which I've included the Java libraries and native DLLs for.

The test program source. (I can't post it inline because it contains an escaped void main, which it doesn't want to let me post.) I think the lwlgl2 bindings are fairly low-level so this may be easily translatable into C.

This prints the following on a computer without the bug (GeForce GTX 1050)

GL_ACTIVE_ATTRIBUTES = 3
GL_ACTIVE_ATTRIBUTE_MAX_LENGTH = 18
Attribute Names:
tint
gl_MultiTexCoord0
gl_Vertex

But on one with the bug (RX6600) it prints:

GL_ACTIVE_ATTRIBUTES = 3
GL_ACTIVE_ATTRIBUTE_MAX_LENGTH = 3
Attribute Names:
gl
gl
ti

But here is where it gets... interesting.

If I change the example shader to have an additional attribute, say "meat":

 

#version 150 compatibility

attribute vec4 tint;
attribute vec4 meat;

void main() {
    gl_TexCoord[0] = gl_MultiTexCoord0;
    gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
    gl_FrontColor = tint + meat;
}

 

Then the output on the machine with the bug is now:

GL_ACTIVE_ATTRIBUTES = 4
GL_ACTIVE_ATTRIBUTE_MAX_LENGTH = 4
Attribute Names:
gl_
gl_
tin
mea

If I ignore the result of glGetObjectParameteriARB(id, GL20.GL_ACTIVE_ATTRIBUTE_MAX_LENGTH) and just use 18 as the attribute max length, on the same buggy machine I get:

GL_ACTIVE_ATTRIBUTES = 3
GL_ACTIVE_ATTRIBUTE_MAX_LENGTH = 3
Attribute Names:
gl_MultiTexCoord0
gl_Vertex
tint

Finally, if I reverse the orders of the calls so I ask for GL_ACTIVE_ATTRIBUTE_MAX_LENGTH  first and then GL_ACTIVE_ATTRIBUTES, it doesn't matter on my machine, but on the buggy machine I get:

GL_ACTIVE_ATTRIBUTES = 3
GL_ACTIVE_ATTRIBUTE_MAX_LENGTH = 32
Attribute Names:
gl_MultiTexCoord0
gl_Vertex
tint

So it seems that glGetObjectParameteriARB(id, GL20.GL_ACTIVE_ATTRIBUTE_MAX_LENGTH) returns the result of whatever the previous glGetObjectParameteriARB invocation was. But glGetObjectParameteriARB(id, GL20.GL_ACTIVE_ATTRIBUTES)  returns the correct value.

And this only happens on machines affected by this bug, ie AMD cards with driver versions later than 22.5.1.

Thanks for providing the reproducible test-case and the related information. I have shared it with the OpenGL team. 

Thanks.

0 Likes

Update:

The OpenGL team has investigated the issue and they have implemented a fix for it.

Thanks.

 

0 Likes

Hi @Zarkonnen ,

Could you please try the latest driver (Adrenalin 23.7.1 ) and let us know if this issue has been fixed?

Thanks.

0 Likes

Hi @Zarkonnen ,

Could you please try the latest driver (Adrenalin 23.7.1 ) to check if the above issue has been fixed?

Thanks.

0 Likes