summaryrefslogtreecommitdiffstats
path: root/tests/bugs
diff options
context:
space:
mode:
authorTim Foley <tfoley@nvidia.com>2017-07-21 12:19:01 -0700
committerTim Foley <tfoley@nvidia.com>2017-07-21 12:19:01 -0700
commit0048a81aeb06d3942362c9f00f9ca004a79bc56b (patch)
tree1e6b270289924060c4a5700d134435005e134d8e /tests/bugs
parent3fa85ede1a6d532b0e86c8b71d3f37d30c353aad (diff)
Don't add `flat` qualifier to integer fragment output
Fixes #133 We already had logic to skip adding `flat` to a vertex input, and this just extends it to not adding `flat` to a fragment output. Note that explicit qualifiers in the input HLSL/Slang will still be carried through to the output, so it is still possible for a Slang user to shoot themself in the foot with interpolation qualifiers.
Diffstat (limited to 'tests/bugs')
-rw-r--r--tests/bugs/gh-133.slang21
-rw-r--r--tests/bugs/gh-133.slang.glsl28
2 files changed, 49 insertions, 0 deletions
diff --git a/tests/bugs/gh-133.slang b/tests/bugs/gh-133.slang
new file mode 100644
index 000000000..56a896ec9
--- /dev/null
+++ b/tests/bugs/gh-133.slang
@@ -0,0 +1,21 @@
+//TEST:CROSS_COMPILE: -profile ps_5_0 -entry main -target spirv-assembly
+
+// Ensure that an integer output from
+// a fragment shader doesn't get a `flat` qualifier
+
+struct Fragment
+{
+ uint foo;
+};
+
+cbuffer U
+{
+ uint bar;
+}
+
+Fragment main() : SV_Target
+{
+ Fragment result;
+ result.foo = bar;
+ return result;
+}
diff --git a/tests/bugs/gh-133.slang.glsl b/tests/bugs/gh-133.slang.glsl
new file mode 100644
index 000000000..82f5fda49
--- /dev/null
+++ b/tests/bugs/gh-133.slang.glsl
@@ -0,0 +1,28 @@
+#version 420
+//TEST_IGNORE_FILE:
+
+struct Fragment
+{
+ uint foo;
+};
+
+uniform U
+{
+ uint bar;
+};
+
+Fragment main_()
+{
+ Fragment result;
+ result.foo = bar;
+ return result;
+}
+
+layout(location = 0)
+out uint SLANG_out_main_result_foo;
+
+void main()
+{
+ Fragment main_result = main_();
+ SLANG_out_main_result_foo = main_result.foo;
+}