https://github.com/shader-slang/slang
Revision 5ea746a571ced32a8975eb3a238c562b3d487149 authored by Tim Foley on 31 July 2018, 16:02:22 UTC, committed by GitHub on 31 July 2018, 16:02:22 UTC
Fixes issue #620 Given a `RWTexture*` store operation like: ```hlsl RWTexture3D a<float>; ... float x = 1.0f; a[crd] = x; ``` We were generating output GLSL like: ```glsl layout(rgba32f) image3D a; ... float x = 1.0f; imageStore(a, crd, x); ``` but in that case, the `imageStore` operation expected a `vec4` and not a `float` for the last argument, and we fail GLSL compilation. This change extends our handling of the `imageStore` operation in the stdlib so that we pad out the last argument if it is not a 4-vector. We also flesh out the code that was picking a `layout(...)` modifier for image formats so that it doesn't just blindly use `layout(rgba32f)` and instead takes the element type fed to `RWTexture3D<...>` into account. With these two changes, the above HLSL/Slang code now translates to: ```glsl layout(r32f) image3D a; ... float x = 1.0f; imageStore(a, crd, vec4(x, float(0), float(0), float(0))); ``` Note that we are padding out the `x` argument to a full vector, and also that we declare the image with `layout(r32f)` to reflect the fact that it has only as single channel.
1 parent 9914ca8
Tip revision: 5ea746a571ced32a8975eb3a238c562b3d487149 authored by Tim Foley on 31 July 2018, 16:02:22 UTC
Fix imageStore output for types other than 4-vectors (#622)
Fix imageStore output for types other than 4-vectors (#622)
Tip revision: 5ea746a
File | Mode | Size |
---|---|---|
docs | ||
examples | ||
external | ||
source | ||
tests | ||
tools | ||
.editorconfig | -rw-r--r-- | 937 bytes |
.gitattributes | -rw-r--r-- | 95 bytes |
.gitignore | -rw-r--r-- | 398 bytes |
.gitmodules | -rw-r--r-- | 107 bytes |
.travis.yml | -rw-r--r-- | 1.7 KB |
CODE_OF_CONDUCT.md | -rw-r--r-- | 3.1 KB |
LICENSE | -rw-r--r-- | 1.1 KB |
Makefile | -rw-r--r-- | 6.3 KB |
README.md | -rw-r--r-- | 4.9 KB |
appveyor.yml | -rw-r--r-- | 3.7 KB |
premake5.lua | -rw-r--r-- | 21.4 KB |
slang-com-helper.h | -rw-r--r-- | 3.9 KB |
slang-com-ptr.h | -rw-r--r-- | 4.8 KB |
slang.h | -rw-r--r-- | 64.4 KB |
slang.sln | -rw-r--r-- | 9.7 KB |
test.bat | -rw-r--r-- | 1.4 KB |
Computing file changes ...