summaryrefslogtreecommitdiffstats
path: root/tests/cross-compile
diff options
context:
space:
mode:
authorTim Foley <tfoley@nvidia.com>2017-07-17 08:58:47 -0700
committerTim Foley <tfoley@nvidia.com>2017-07-17 08:58:47 -0700
commit15aba2fe81fea44969e036e181a4cf252ff41963 (patch)
tree489534f470b3d2dcbb61660458bf473e0a2c0552 /tests/cross-compile
parenteecb6c56da5792010e88f2a0d6d1503244b081a4 (diff)
Handle `flat` interpolation cases in cross compilation
Fixes #104 - Map HLSL `nointerpolation` to GLSL `flat` - When lowering a `struct` type varying input/output, look for interpolation modifiers along the "chain" from the leaf field up to the original shader input variable (and take the first one found) - Not sure if this is strictly needed, but it seems like a reasonable policy - Add `flat` to varying input of integer type, with no other interpolation modifier - Note: I do *not* do anything to ignore a manually imposed interpolation modifier that might be incorrect
Diffstat (limited to 'tests/cross-compile')
-rw-r--r--tests/cross-compile/integer-input.slang11
-rw-r--r--tests/cross-compile/integer-input.slang.glsl26
-rw-r--r--tests/cross-compile/nointerpolation-input.slang11
-rw-r--r--tests/cross-compile/nointerpolation-input.slang.glsl26
4 files changed, 74 insertions, 0 deletions
diff --git a/tests/cross-compile/integer-input.slang b/tests/cross-compile/integer-input.slang
new file mode 100644
index 000000000..2069091c6
--- /dev/null
+++ b/tests/cross-compile/integer-input.slang
@@ -0,0 +1,11 @@
+//TEST:CROSS_COMPILE: -profile ps_5_0 -entry main -target spirv-assembly
+
+struct VS_OUT
+{
+ uint drawID : DRAW_ID;
+};
+
+float4 main(VS_OUT vsOut) : SV_Target
+{
+ return float4(float(vsOut.drawID));
+}
diff --git a/tests/cross-compile/integer-input.slang.glsl b/tests/cross-compile/integer-input.slang.glsl
new file mode 100644
index 000000000..ce6998a9a
--- /dev/null
+++ b/tests/cross-compile/integer-input.slang.glsl
@@ -0,0 +1,26 @@
+//TEST_IGNORE_FILE:
+
+struct VS_OUT
+{
+ uint drawID;
+};
+
+in flat uint SLANG_in_vsOut_drawID;
+
+out vec4 SLANG_out_main_result;
+
+vec4 main_(VS_OUT vsOut)
+{
+ return vec4(float(vsOut.drawID));
+}
+
+void main()
+{
+ VS_OUT vsOut;
+ vsOut.drawID = SLANG_in_vsOut_drawID;
+
+ vec4 main_result;
+ main_result = main_(vsOut);
+
+ SLANG_out_main_result = main_result;
+}
diff --git a/tests/cross-compile/nointerpolation-input.slang b/tests/cross-compile/nointerpolation-input.slang
new file mode 100644
index 000000000..c215f380a
--- /dev/null
+++ b/tests/cross-compile/nointerpolation-input.slang
@@ -0,0 +1,11 @@
+//TEST:CROSS_COMPILE: -profile ps_5_0 -entry main -target spirv-assembly
+
+struct VS_OUT
+{
+ nointerpolation float drawID : DRAW_ID;
+};
+
+float4 main(VS_OUT vsOut) : SV_Target
+{
+ return float4(vsOut.drawID);
+}
diff --git a/tests/cross-compile/nointerpolation-input.slang.glsl b/tests/cross-compile/nointerpolation-input.slang.glsl
new file mode 100644
index 000000000..279590fa5
--- /dev/null
+++ b/tests/cross-compile/nointerpolation-input.slang.glsl
@@ -0,0 +1,26 @@
+//TEST_IGNORE_FILE:
+
+struct VS_OUT
+{
+ float drawID;
+};
+
+in flat float SLANG_in_vsOut_drawID;
+
+out vec4 SLANG_out_main_result;
+
+vec4 main_(VS_OUT vsOut)
+{
+ return vec4(vsOut.drawID);
+}
+
+void main()
+{
+ VS_OUT vsOut;
+ vsOut.drawID = SLANG_in_vsOut_drawID;
+
+ vec4 main_result;
+ main_result = main_(vsOut);
+
+ SLANG_out_main_result = main_result;
+}