summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorTim Foley <tfoley@nvidia.com>2017-07-17 10:51:18 -0700
committerTim Foley <tfoley@nvidia.com>2017-07-17 10:54:05 -0700
commitdc0e9d7bca21d8a67ec9f044c0d390bda6ebfcbf (patch)
tree2db423b4b6e8420e614cb49fe7534f2b7591078d /tests
parent0b4992fb69e359a7e566cca42331a196904556f5 (diff)
Pick correct GLSL version when `gl_Layer` used
`gl_Layer` as a fragment input requires at least version 4.30 of GLSL, so we try to track that information when we see the name used. Note that this does *not* override a user-specified `#version` line. This required re-ordering when lowering happens relative to emitting the `#version` directive, since this code works by actually modifying the chosen profile for the entry point. Yes, that is kind of gross and we should do something cleaner in the long term.
Diffstat (limited to 'tests')
-rw-r--r--tests/cross-compile/gl-layer-pick-version.slang11
-rw-r--r--tests/cross-compile/gl-layer-pick-version.slang.glsl25
2 files changed, 36 insertions, 0 deletions
diff --git a/tests/cross-compile/gl-layer-pick-version.slang b/tests/cross-compile/gl-layer-pick-version.slang
new file mode 100644
index 000000000..c68d68427
--- /dev/null
+++ b/tests/cross-compile/gl-layer-pick-version.slang
@@ -0,0 +1,11 @@
+//TEST:CROSS_COMPILE: -profile ps_5_0 -entry main -target spirv-assembly
+
+struct VS_OUT
+{
+ nointerpolation uint layerID : SV_RenderTargetArrayIndex;
+};
+
+float4 main(VS_OUT vsOut) : SV_Target
+{
+ return float4(float(vsOut.layerID));
+}
diff --git a/tests/cross-compile/gl-layer-pick-version.slang.glsl b/tests/cross-compile/gl-layer-pick-version.slang.glsl
new file mode 100644
index 000000000..55d419405
--- /dev/null
+++ b/tests/cross-compile/gl-layer-pick-version.slang.glsl
@@ -0,0 +1,25 @@
+//TEST_IGNORE_FILE:
+#version 430
+
+struct VS_OUT
+{
+ uint layerID;
+};
+
+vec4 main_(VS_OUT vsOut) : SV_Target
+{
+ return vec4(float(vsOut.layerID));
+}
+
+out vec4 SLANG_out_main_result;
+
+void main()
+{
+ VS_OUT vsOut;
+ vsOut.layerID = gl_Layer;
+
+ vec4 main_result;
+ main_result = main_(vsOut);
+
+ SLANG_out_main_result = main_result;
+} \ No newline at end of file