You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am a Chromium/Dawn developer and now I am meeting several issues in SPIR-V Cross when I am implementing storage textures in Dawn.
Now readonly-storage-texture and writeonly-storage-texture have been supported as WebGPU binding types, on D3D12. readonly-storage-texture is intended to match SRVs, and writeonly-storage-texture is intended to match UAVs.
But in SPIRV-Cross, I find whether I declare DecorationNonReadable or DecorationNonWritable on an image variable, the image variable is always translated into RWTexture2D when it is translated into HLSL. In D3D, "typed UAV loads" are not allowed on all texture formats (in fact only R32_FLOAT, R32_UINT and R32_SINT are always supported on all feature level 11_0 hardwares) so we prefer the non-writable images to be translated into read-only Texture2D in WebGPU.
Could you consider supporting a way in SPIRV-Cross to translate the image with DecorationNonWritable into Texture2D rather than RWTexture2D?
Here is an example. Considering the following GLSL shader:
Here is the translation result of translating 1.spv into HLSL shaders. We can see both image0 and image1, and they are all translated into RWTexture2D.
Hi SPIRV-Cross developers:
I am a Chromium/Dawn developer and now I am meeting several issues in SPIR-V Cross when I am implementing storage textures in Dawn.
Now
readonly-storage-texture
andwriteonly-storage-texture
have been supported as WebGPU binding types, on D3D12.readonly-storage-texture
is intended to match SRVs, andwriteonly-storage-texture
is intended to match UAVs.But in SPIRV-Cross, I find whether I declare
DecorationNonReadable
orDecorationNonWritable
on an image variable, the image variable is always translated intoRWTexture2D
when it is translated into HLSL. In D3D, "typed UAV loads" are not allowed on all texture formats (in fact onlyR32_FLOAT
,R32_UINT
andR32_SINT
are always supported on all feature level 11_0 hardwares) so we prefer the non-writable images to be translated into read-onlyTexture2D
in WebGPU.Could you consider supporting a way in SPIRV-Cross to translate the image with
DecorationNonWritable
intoTexture2D
rather thanRWTexture2D
?Here is an example. Considering the following GLSL shader:
Here is the translation result of 1.comp with glslang. You can see
NonWritable
andNonReadable
has been correctly translated in the result.Here is the translation result of translating 1.spv into HLSL shaders. We can see both image0 and image1, and they are all translated into
RWTexture2D
.The text was updated successfully, but these errors were encountered: