cancel
Showing results for 
Search instead for 
Did you mean: 

OpenGL & Vulkan

waylan
Adept I

Issues with ARB_gl_spirv

With AMD on Windows SPIR-V shaders in OpenGL don't seem to work properly. I encountered issues where nothing is rendered at all and others seem to have similar issues (How to Load SPIR-V Shaders in OpenGL | Geeks3D ). I appended a simple example, which on my machine results in a segfault on the draw command when using the SPIR-V shaders. By the way, there is generally no helpful debug output in these cases.

I don't have a setup to test it on Intel/Nvidia on Windows, but the same example runs just fine on AMD/Intel on Linux with Mesa 20. The example also includes a switch, 'USE_SPIRV', which, when set to '0' uses the same glsl shaders instead, which also runs just fine.

To reproduce, just unzip, compile with cmake and run spirvtest.exe.

The shaders have been compiled with glslangValidator -G.

Either I can't see a very obvious mistake here or the SPIR-V support for OpenGL is broken.

My config:

GPU: RX480

Radeon Adrenaline Edition 20.2.2

edit: A small test repository is available at GitHub - jothalha/spirv-example: SPIR-V Test repository 

0 Likes
7 Replies
marzRX
Adept I

Hi, I tried your program.

It will work correctry, if you comment out glDetachShader().

waylan
Adept I

Thanks for the tip. It seems a bit odd to me that glDetachShader doesn't work properly for spir-v.

Unfortunately one of the major issues I'm facing is that I can't seem to get uniforms to work for spir-v. I tried both standalone uniforms and uniform buffer objects, but neither seem to work - the result is just a blank screen. I added a link to a test repository in the OP, which contains a variant of my original example (color), uniform and ubo. color seems to work just fine, but neither uniform nor ubo produce output. Again, on Linux all of these run fine.

0 Likes

Hi, I've tested your NEW spirv samples with three GPU. Uniform and ubo sample is blinking red triangle. right?

1) AMD Ryzen3 2200G with Radeon Vega Graphcis x 4, Linux Mint 19.3 Mesa 20.0.0-devel

2) NVIDIA Geforce GTX 750 Ti, Windows7

3) AMD Radeon RX 560, Windows7

1),2) All GLSL route and SPIR-V route work correctry.

3) Uniform and ubo sample, SPIR-V route doesn't work. All GLSL and color sample SPIR-V route work.

Yes, This is the same problem I have. I don't know how to use UBO(Uniform Block Object) and SSBO(Shader Storage Buffer Object) with SPIR-V shader on AMD.

0 Likes

Thanks again for confirming the issue and testing on multiple platforms. Unfortunately this makes SPIR-V shaders pretty much unusable on Windows with AMD cards at the moment.

0 Likes
tim-rex
Adept I

Did you manage to get anywhere with this? I'm having very similar problems - all my SPIRV shaders run just fine on AMD/Intel on Linux.. black screens all the way on AMD/Windows.

Intel drivers aren't free of issues either it seems, but AMD drivers on Windows seem particularly stubborn 😕

I've posted seperately about it here: https://community.amd.com/message/2989582#comments 

Sadly, I think I've pretty much exhausted my options at this point.

0 Likes

Unfortunately no. The only workaround idea that I have is to use spirv-cross to convert spirv shaders back to glsl if really necessary, which is ridiculous. At this point I have to assume that either the spirv route for 4.6 is not tested at all and/or nobody cares about it - which is interesting since the driver claims to support it since 2018.

0 Likes
tim-rex
Adept I

This was my fear as well.. it's clearly not widely used, as there's scant little information in the wider community about it.

But if it doesn't actually work, then that's not too surprising.

It's frustrating when I read things like "SPIR-V appears to be the future of shader programming in the Vulkan/OpenGL space" and "The future of SPIR-V is very bright".. Not so much for OpenGL then.

0 Likes