cancel
Showing results for 
Search instead for 
Did you mean: 

OpenGL & Vulkan

UnidayStudio
Journeyman III

Bug report: Nested Struct issue in some Cards/Driver

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:

  • GLSL version: 430 core
  • OpenGL Context: 4.0, compatibility mode

 

Cards with this issue:

  • Integrated Radeon RX Vega 11, processor: AMD Ryzen 5 2400G, driver version: 22.10.1
  • AMD Radeon RX550, driver version: adrenaline 22.10.2

Not every user had this problem. So here is some cards that did NOT had this issue:

  • AMD Radeon RX570, driver version: unkown (I'll try to update this with more info)

 

I can provide a test file and more information if needed, just let me know where to upload.

Thank you!

0 Likes
6 Replies
dipak
Big Boss

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.

0 Likes
UnidayStudio
Journeyman III

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!

0 Likes

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.

0 Likes

Update:

A bug ticket has been created to track this issue.

 

0 Likes

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.

0 Likes

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.

0 Likes