Hi! I'm a Senior Game Engine dev at Uniday Studio (unidaystudio.com.br), a Brazilian game developer and we also have our own game engine, Cave (https://unidaystudio.itch.io/cave-engine). I'd like to report a potential bug we found in some AMD cards. Since I'm a newcomer in this forum, I was not able to post somewhere else.
Some of our AMD players and users started reporting some weird undefined behaviours in some of our games and later in the engine itself. Most of them were not able to see anything on screen other than the background and UI (different shaders, not important here). Some of our uniforms were wrong.
After some debugging, we found the issue. Turns out that it came from the existence of nested structs in the GLSL code. We have a ColorSampler struct, with a sampler2D field, then we have the Material struct with some ColorSamplers inside of it. In the end, the Material is passed as an uniform to our shaders. Here nis a minimal example:
struct ColorSampler{
vec4 color;
sampler2D texture;
bool useTexture;
};
struct Material{
[...]
// The issue seems to be here:
ColorSampler albedo;
[...]
};
As I said, this Material struct is later passed like this:
uniform Material material;
The cards that experienced this problem presented some unfedined behaviours when accessing the material.albedo structure. Probably with trash memory in it. It turns out that not having the nested structs (either by inlining the ColorSampler or creating a separate uniform for them) resolvers the problem.
Unfortunately we were not able to further investigate the bug due to time and deadline constraints here in the studio, but something that I think that it's worth keeping an eye on it is the fact that the first struct does have a sampler2D in it.
Our engine's OpenGL specs:
Cards with this issue:
Not every user had this problem. So here is some cards that did NOT had this issue:
I can provide a test file and more information if needed, just let me know where to upload.
Thank you!
Hi @UnidayStudio ,
Thank you for reporting it. I have whitelisted you and moved the post to the OpenGL forum.
Please provide a test-case that reproduces this issue [you can attach it here or you can share a link to download the test file].
Thanks.
Thank you for whitelisting me, @dipak .
I was not able to locate where to attach the file here, so I've uploaded it on an external website:
https://mega.nz/file/9IhRUYbC#g15tK3RH5oZQYdAUq3BoS7TqPAkWoEGST0KtYsUCTUI
The version above does have this problem in some cards. Simply open the engine and create a new project and you'll notice that the viewport will have nothing on it (but it is supposed to have).
Latest version (0.9.8b) of the engine don't have the problem (I've fixed it by not nesting the structs). You can download it here:
https://unidaystudio.itch.io/cave-engine
If you have any additional questions, let me know!
Thank you for providing the reproducible test-case. I have reported the issue to the OpenGL team. If I get any update on this, I will let you know.
Thanks.
Update:
A bug ticket has been created to track this issue.
Hi @UnidayStudio ,
As I have been informed, the dev team was unable to access the repro using the link below. Could you please attach it here?
https://mega.nz/file/9IhRUYbC#g15tK3RH5oZQYdAUq3BoS7TqPAkWoEGST0KtYsUCTUI
When you click the "Reply" button to post a reply, you will get the "Drag and drop here or browse files to attach" option. If you don't see it, please let me know.
Thanks.
Hi @UnidayStudio ,
As mentioned above, the OpenGL team couldn't access the files using the download link. Could you please attach the repro here?
Thanks.