ConfettiFX / The-Forge

The Forge Cross-Platform Rendering Framework PC Windows, Steamdeck (native), Ray Tracing, macOS / iOS, Android, XBOX, PS4, PS5, Switch, Quest 2
Apache License 2.0
4.65k stars 491 forks source link

HLSL ByteAddressBuffer type mapped to DESCRIPTOR_TYPE_RW_BUFFER (Vk) #224

Closed gjaegy closed 2 years ago

gjaegy commented 2 years ago

Hi,

I'm facing a little issue, but I'm not sure exactly whether it's a bug or was done on purpose.

Our shader, written in HLSL, contains a ByteAddressBuffer resource.

When compiled to SPIR-V (using DirectXShaderCompiler), this resource ends up being a SPIRV_TYPE_STORAGE_BUFFERS.

In The Forge, SPIRV_TYPE_STORAGE_BUFFERS is then mapped to an internal DESCRIPTOR_TYPE_RW_BUFFER type (through the sSPIRV_TO_DESCRIPTOR mapping table).

Actually, the issue is that a ByteAddressBuffer is defined as being a read-only resource (i.e. SRV) in the specs, but ends up being considered as a UAV in The Forge.

In my opinion ByteAddressBuffer should be mapped to a DESCRIPTOR_TYPE_BUFFER_RAW type.

What have I missed ?

Cheers, Greg

gjaegy commented 2 years ago

Nevermind, I realized SPIRV doesn't really make any difference between some different types available in HLSL.