diff options
| author | Tim Foley <tfoleyNV@users.noreply.github.com> | 2018-11-06 16:16:52 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-11-06 16:16:52 -0800 |
| commit | 02e18b55faff56c037a76645c793b24b712fa375 (patch) | |
| tree | 3f1ad284f7d9b0b30671dbe4aec95d106e9373e1 /tests | |
| parent | 1185bd464092f372430cbfaa15a7be4dcaa90752 (diff) | |
Translate NonUniformResourceIndex() calls to Vulkan GLSL (#713)
These calls translate to uses of the `nonuniformEXT` qualifier introduced by the `GL_EXT_nonuniform_qualifier` extension.
The standard library changes in this case are straightforward uses of existing compiler mechanisms. The test case is one of the less pleasant ones where we compare SPIR-V output against SPIR-V generated from a hand-coded GLSL baseline. This is a case where a simpler test type that just checks for specific textual matches in the output (and not whole files) would be better, but that is out of scope for this change.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/cross-compile/non-uniform-indexing.slang | 13 | ||||
| -rw-r--r-- | tests/cross-compile/non-uniform-indexing.slang.glsl | 28 |
2 files changed, 41 insertions, 0 deletions
diff --git a/tests/cross-compile/non-uniform-indexing.slang b/tests/cross-compile/non-uniform-indexing.slang new file mode 100644 index 000000000..647742df8 --- /dev/null +++ b/tests/cross-compile/non-uniform-indexing.slang @@ -0,0 +1,13 @@ +//TEST:CROSS_COMPILE:-target spirv-assembly -entry main -stage fragment + +// Confirm that `NonUniformResourceIndex` translates to SPIR-V as expeted + +Texture2D t[10]; +SamplerState s; + +float4 main( + float3 uv : UV) + : SV_Target +{ + return t[NonUniformResourceIndex(int(uv.z))].Sample(s, uv.xy); +} diff --git a/tests/cross-compile/non-uniform-indexing.slang.glsl b/tests/cross-compile/non-uniform-indexing.slang.glsl new file mode 100644 index 000000000..83f63c70d --- /dev/null +++ b/tests/cross-compile/non-uniform-indexing.slang.glsl @@ -0,0 +1,28 @@ +//TEST_IGNORE_FILE +#version 450 + +#extension GL_EXT_nonuniform_qualifier : require + +layout(binding = 0) +uniform texture2D t_0[10]; + +layout(binding = 1) +uniform sampler s_0; + +layout(location = 0) +out vec4 _S1; + +layout(location = 0) +in vec3 _S2; + +void main() +{ + vec3 _S3 = _S2; + + int _S4 = nonuniformEXT(int(_S3.z)); + + vec4 _S5 = texture(sampler2D(t_0[_S4],s_0), _S3.xy); + + _S1 = _S5; + return; +} |
