summaryrefslogtreecommitdiffstats
path: root/external
diff options
context:
space:
mode:
authorTim Foley <tfoleyNV@users.noreply.github.com>2018-07-31 09:02:22 -0700
committerGitHub <noreply@github.com>2018-07-31 09:02:22 -0700
commit5ea746a571ced32a8975eb3a238c562b3d487149 (patch)
tree8f041cf1a17215ee908b2459168d637f2b93f71d /external
parent9914ca800c92e9b3fe768dec4e913a302f3d678d (diff)
Fix imageStore output for types other than 4-vectors (#622)
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.
Diffstat (limited to 'external')
0 files changed, 0 insertions, 0 deletions