summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/cross-compile/array-of-buffers.slang.hlsl2
-rw-r--r--tests/cross-compile/dual-source-blending.slang26
-rw-r--r--tests/cross-compile/dual-source-blending.slang.glsl37
3 files changed, 64 insertions, 1 deletions
diff --git a/tests/cross-compile/array-of-buffers.slang.hlsl b/tests/cross-compile/array-of-buffers.slang.hlsl
index 129993edc..37f4639a7 100644
--- a/tests/cross-compile/array-of-buffers.slang.hlsl
+++ b/tests/cross-compile/array-of-buffers.slang.hlsl
@@ -17,7 +17,7 @@ struct S_0
ConstantBuffer<S_0> cb_0 [3] : register(b1);
StructuredBuffer<S_0> sb1_0[4] : register(t0);
-RWStructuredBuffer<float4> sb2_0[5] : register(u1);
+RWStructuredBuffer<float4> sb2_0[5] : register(u0);
ByteAddressBuffer bb_0[6] : register(t4);
float4 main() : SV_TARGET
diff --git a/tests/cross-compile/dual-source-blending.slang b/tests/cross-compile/dual-source-blending.slang
new file mode 100644
index 000000000..51af956b2
--- /dev/null
+++ b/tests/cross-compile/dual-source-blending.slang
@@ -0,0 +1,26 @@
+//dual-source-blending.slang
+
+// Test handling of `vk::location` and
+// `vk::index` attributes to compile
+// for dual-source color blending.
+
+//TEST:CROSS_COMPILE:-target spirv-assembly -entry main -stage fragment
+//TEST_DISABLED:SIMPLE:-target glsl
+
+struct FragmentOutput
+{
+ [[vk::location(0)]]
+ float4 a : SV_Target0;
+
+ [[vk::location(0), vk::index(1)]]
+ float4 b : SV_Target1;
+}
+
+[shader("fragment")]
+FragmentOutput main(float4 v : V)
+{
+ FragmentOutput f = {};
+ f.a = v;
+ f.b = v;
+ return f;
+}
diff --git a/tests/cross-compile/dual-source-blending.slang.glsl b/tests/cross-compile/dual-source-blending.slang.glsl
new file mode 100644
index 000000000..f10eb77a0
--- /dev/null
+++ b/tests/cross-compile/dual-source-blending.slang.glsl
@@ -0,0 +1,37 @@
+//dual-source-blending.slang.glsl
+#version 450
+
+layout(row_major) uniform;
+layout(row_major) buffer;
+
+layout(location = 0)
+out vec4 _S1;
+
+layout(location = 0, index = 1)
+out vec4 _S2;
+
+layout(location = 0)
+in vec4 _S3;
+
+struct FragmentOutput_0
+{
+ vec4 a_0;
+ vec4 b_0;
+};
+
+void main()
+{
+ FragmentOutput_0 f_0;
+
+ FragmentOutput_0 _S4 = { vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0) };
+ f_0 = _S4;
+
+ f_0.a_0 = _S3;
+ f_0.b_0 = _S3;
+
+ FragmentOutput_0 _S5 = f_0;
+ _S1 = _S5.a_0;
+ _S2 = _S5.b_0;
+
+ return;
+}