From dc0e9d7bca21d8a67ec9f044c0d390bda6ebfcbf Mon Sep 17 00:00:00 2001 From: Tim Foley Date: Mon, 17 Jul 2017 10:51:18 -0700 Subject: 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. --- .../cross-compile/gl-layer-pick-version.slang.glsl | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 tests/cross-compile/gl-layer-pick-version.slang.glsl (limited to 'tests/cross-compile/gl-layer-pick-version.slang.glsl') 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 -- cgit v1.2.3