summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
authorTim Foley <tfoleyNV@users.noreply.github.com>2018-11-06 16:16:52 -0800
committerGitHub <noreply@github.com>2018-11-06 16:16:52 -0800
commit02e18b55faff56c037a76645c793b24b712fa375 (patch)
tree3f1ad284f7d9b0b30671dbe4aec95d106e9373e1 /source
parent1185bd464092f372430cbfaa15a7be4dcaa90752 (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 'source')
-rw-r--r--source/slang/hlsl.meta.slang5
-rw-r--r--source/slang/hlsl.meta.slang.h5
2 files changed, 10 insertions, 0 deletions
diff --git a/source/slang/hlsl.meta.slang b/source/slang/hlsl.meta.slang
index fb03dfcfc..c666dadd3 100644
--- a/source/slang/hlsl.meta.slang
+++ b/source/slang/hlsl.meta.slang
@@ -871,7 +871,12 @@ __generic<let N : int> float noise(vector<float, N> x);
/// to this function as necessary in output code, rather than make this
/// the user's responsibility, so that the default behavior of the language
/// is more semantically "correct."
+__target_intrinsic(glsl, nonuniformEXT)
+__glsl_extension(GL_EXT_nonuniform_qualifier)
uint NonUniformResourceIndex(uint index);
+
+__target_intrinsic(glsl, nonuniformEXT)
+__glsl_extension(GL_EXT_nonuniform_qualifier)
int NonUniformResourceIndex(int index);
// Normalize a vector
diff --git a/source/slang/hlsl.meta.slang.h b/source/slang/hlsl.meta.slang.h
index e1e080d25..2db710ccb 100644
--- a/source/slang/hlsl.meta.slang.h
+++ b/source/slang/hlsl.meta.slang.h
@@ -916,7 +916,12 @@ SLANG_RAW("/// Note: a future version of Slang may take responsibility for inser
SLANG_RAW("/// to this function as necessary in output code, rather than make this\n")
SLANG_RAW("/// the user's responsibility, so that the default behavior of the language\n")
SLANG_RAW("/// is more semantically \"correct.\"\n")
+SLANG_RAW("__target_intrinsic(glsl, nonuniformEXT)\n")
+SLANG_RAW("__glsl_extension(GL_EXT_nonuniform_qualifier)\n")
SLANG_RAW("uint NonUniformResourceIndex(uint index);\n")
+SLANG_RAW("\n")
+SLANG_RAW("__target_intrinsic(glsl, nonuniformEXT)\n")
+SLANG_RAW("__glsl_extension(GL_EXT_nonuniform_qualifier)\n")
SLANG_RAW("int NonUniformResourceIndex(int index);\n")
SLANG_RAW("\n")
SLANG_RAW("// Normalize a vector\n")