summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/bugs/gh-841.slang19
-rw-r--r--tests/bugs/gh-841.slang.glsl35
-rw-r--r--tests/reflection/sample-index-input.hlsl.expected1
-rw-r--r--tests/reflection/sample-rate-input.hlsl.expected2
-rw-r--r--tests/reflection/vertex-input-semantics.hlsl.expected8
5 files changed, 65 insertions, 0 deletions
diff --git a/tests/bugs/gh-841.slang b/tests/bugs/gh-841.slang
new file mode 100644
index 000000000..becf741c1
--- /dev/null
+++ b/tests/bugs/gh-841.slang
@@ -0,0 +1,19 @@
+// gh-841.slang
+
+//TEST:CROSS_COMPILE: -profile ps_5_0 -entry main -target spirv-assembly
+
+// GitHub issue #841: failing to emit `flat` modifier in output GLSL when required
+
+struct RasterVertex
+{
+ float4 c : COLOR;
+ uint u : FLAGS;
+};
+
+float4 main(RasterVertex v) : SV_Target
+{
+ float4 result = v.c;
+ if(v.u & 1)
+ result += 1.0;
+ return result;
+}
diff --git a/tests/bugs/gh-841.slang.glsl b/tests/bugs/gh-841.slang.glsl
new file mode 100644
index 000000000..caee80928
--- /dev/null
+++ b/tests/bugs/gh-841.slang.glsl
@@ -0,0 +1,35 @@
+//TEST_IGNORE_FILE:
+#version 450
+
+layout(location = 0)
+out vec4 _S1;
+
+layout(location = 0)
+in vec4 _S2;
+
+flat layout(location = 1)
+in uint _S3;
+
+struct RasterVertex_0
+{
+ vec4 c_0;
+ uint u_0;
+};
+
+void main()
+{
+ vec4 result_0;
+ RasterVertex_0 _S4 = RasterVertex_0(_S2, _S3);
+ vec4 result_1 = _S4.c_0;
+
+ if(bool(_S4.u_0 & uint(1)))
+ {
+ result_0 = result_1 + 1.0;
+ }
+ else
+ {
+ result_0 = result_1;
+ }
+ _S1 = result_0;
+ return;
+}
diff --git a/tests/reflection/sample-index-input.hlsl.expected b/tests/reflection/sample-index-input.hlsl.expected
index c799f8f25..5bf5f297e 100644
--- a/tests/reflection/sample-index-input.hlsl.expected
+++ b/tests/reflection/sample-index-input.hlsl.expected
@@ -29,6 +29,7 @@ standard output = {
"scalarType": "float32"
}
},
+ "stage": "fragment",
"binding": {"kind": "varyingInput", "index": 0},
"semanticName": "COLOR"
},
diff --git a/tests/reflection/sample-rate-input.hlsl.expected b/tests/reflection/sample-rate-input.hlsl.expected
index ec6cfca6e..0c86ebecb 100644
--- a/tests/reflection/sample-rate-input.hlsl.expected
+++ b/tests/reflection/sample-rate-input.hlsl.expected
@@ -29,6 +29,7 @@ standard output = {
"scalarType": "float32"
}
},
+ "stage": "fragment",
"binding": {"kind": "varyingInput", "index": 0},
"semanticName": "EXTRA"
},
@@ -42,6 +43,7 @@ standard output = {
"scalarType": "float32"
}
},
+ "stage": "fragment",
"binding": {"kind": "varyingInput", "index": 1},
"semanticName": "COLOR"
}
diff --git a/tests/reflection/vertex-input-semantics.hlsl.expected b/tests/reflection/vertex-input-semantics.hlsl.expected
index 2ff8d7847..06b7bc95a 100644
--- a/tests/reflection/vertex-input-semantics.hlsl.expected
+++ b/tests/reflection/vertex-input-semantics.hlsl.expected
@@ -44,6 +44,7 @@ standard output = {
"scalarType": "int32"
}
},
+ "stage": "vertex",
"binding": {"kind": "varyingInput", "index": 0},
"semanticName": "B"
},
@@ -63,6 +64,7 @@ standard output = {
"scalarType": "float32"
}
},
+ "stage": "vertex",
"binding": {"kind": "varyingInput", "index": 0},
"semanticName": "B",
"semanticIndex": 1
@@ -77,12 +79,14 @@ standard output = {
"scalarType": "float32"
}
},
+ "stage": "vertex",
"binding": {"kind": "varyingInput", "index": 1},
"semanticName": "B",
"semanticIndex": 2
}
]
},
+ "stage": "vertex",
"binding": {"kind": "varyingInput", "index": 1, "count": 2},
"semanticName": "B",
"semanticIndex": 1
@@ -114,6 +118,7 @@ standard output = {
"scalarType": "float32"
}
},
+ "stage": "vertex",
"binding": {"kind": "varyingInput", "index": 0},
"semanticName": "CX"
},
@@ -127,12 +132,14 @@ standard output = {
"scalarType": "float32"
}
},
+ "stage": "vertex",
"binding": {"kind": "varyingInput", "index": 1},
"semanticName": "CX",
"semanticIndex": 1
}
]
},
+ "stage": "vertex",
"binding": {"kind": "varyingInput", "index": 0, "count": 2},
"semanticName": "CX"
},
@@ -146,6 +153,7 @@ standard output = {
"scalarType": "int32"
}
},
+ "stage": "vertex",
"binding": {"kind": "varyingInput", "index": 2},
"semanticName": "CY"
}