cancel
Showing results for 
Search instead for 
Did you mean: 

OpenGL & Vulkan

marzRX
Adept I

SPIR-V shader on AMD GPU

I tried latest AMD gpu driver. But my SPIR-V program doesn't work.

fbo_ubo:
This program use uniform block object. SPIR-V route doesn't work correctly.
I think GPU can not receive the data of uniform block. It seems that the data in the uniform block is all zero.

fbo_ubo_result.png

ripple:
I added a dump module to find out what the active attributes and uniform variables are.

NVIDIA SPIR-V (Geforce 750ti)
[Attribute: 2]
Idx Type           Name
  0 vec3           'a_pos'
  1 vec3           'a_uv'
[Uniform: 3]
Idx Type           Name
  0 sampler2d      'image'
  1 vec2           'rippledata.center1'
  2 vec2           'rippledata.img_size'
[UniformBlock: 1]
Idx Name
  0 'rippledata'(block member count: 2)
  |_Idx Type       Offset Name
      0 vec2            8 'rippledata.center1'
      1 vec2            0 'rippledata.img_size'
----------------------------------------------------------------------
AMD SPIR-V (Radeon RX560)
[Attribute: 2]
Idx Type           Name
  0 vec4           ''
  0 vec4           ''
[Uniform: 1]
Idx Type           Name
  0 sampler2d      ''
[UniformBlock: 0]
----------------------------------------------------------------------
AMD GLSL (Radeon RX560)
[Attribute: 2]
Idx Type           Name
  0 vec3           'a_pos'
  1 vec3           'a_uv'
[Uniform: 3]
Idx Type           Name
  0 vec2           'rippledata.img_size'
  1 vec2           'rippledata.center1'
  2 sampler2d      'image'
[UniformBlock: 1]
Idx Name
  0 'rippledata'(block member count: 2)
  |_Idx Type       Offset Name
      0 vec2            0 'rippledata.img_size'
      1 vec2            8 'rippledata.center1'
----------------------------------------------------------------------

ripple_result.png

This program uses uniform block with named-block.  I also tested name-less uniform block and default uniform block(= uniform), but none of them worked.

Am I making something wrong? 🙂

These programs work fine following GPU/GPU driver.
* NVIDIA Geforce GTX 750 Ti, Windows7
* AMD Ryzen3 2200G with Radeon Vega Graphcis x 4, Linux Mint 19.3 Mesa 20.0.0-devel

Thank you.

6 Replies
tim-rex
Adept I

I don't suppose you managed to get anywhere with this?

I've posted separately about similar problems, but not sure I'm going to get much further..   https://community.amd.com/message/2989582#comments 

0 Likes

I guess it is an AMD driver issue. I'm just waiting for AMD's driver to be fixed.

Today, I tried the 20.8.1 driver. There were no fixes for SPIR-V.

dorisyan
Staff

Thanks for your report, marzRX, OK, I see, I will take a look into it soon

0 Likes
inolen
Adept I

Just hit this issue in 2023.

This feels somewhat absurd - basic glUniform* uniforms don't work with SPIR-V shaders still 3 years later. Converted them over to a single SSBO as a workaround.

joshklint
Adept II

I just integrated SPIR-V with OpenGL and had no issues. If you are using regular uniform variables you have to be careful to parse the SPIRV file correctly.

0 Likes
marzRX
Adept I

Hello. I found some relevant information on the Hazel project's GitHub discussion board that I'd like to share.

 

AMD issues with SPIR-V Shaders #440 

Linked from the above discussion, drsnuggles8 reported the following on another thread:

Fixed AMD issues with SPIR-V Shaders #522 
> This seems to have been resolved with one of the driver updates from AMD. I'm currently on version 23.5.2, and it runs just fine without any AMD workaround (which I had been using until now, but was causing other issues).

Reading this, it appears that the problem related to SPIR-V has been resolved with an AMD driver update (23.5.2). However, I have already switched to NVIDIA, so I have not personally confirmed this. According to information from joshklint, SPIR-V is functioning well, which might suggest that this issue has indeed been resolved.