summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/cross-compile/vk-push-constant-set.slang23
-rw-r--r--tests/cross-compile/vk-push-constant-set.slang.glsl28
2 files changed, 51 insertions, 0 deletions
diff --git a/tests/cross-compile/vk-push-constant-set.slang b/tests/cross-compile/vk-push-constant-set.slang
new file mode 100644
index 000000000..ee9c68ed8
--- /dev/null
+++ b/tests/cross-compile/vk-push-constant-set.slang
@@ -0,0 +1,23 @@
+// vk-push-constant.slang
+
+// Test to confirm that a `[[vk::push_constant]]` buffer
+// doesn't end up reserving `space=0` for global scope
+// parameters and shifting a parameer block over to
+// `space=1`.
+
+//TEST:CROSS_COMPILE:-target spirv-assembly -entry main -stage fragment
+
+struct S
+{
+ float4 v;
+}
+
+[[vk::push_constant]]
+ConstantBuffer<S> x;
+
+ParameterBlock<S> y;
+
+float4 main() : SV_Target
+{
+ return x.v + y.v;
+}
diff --git a/tests/cross-compile/vk-push-constant-set.slang.glsl b/tests/cross-compile/vk-push-constant-set.slang.glsl
new file mode 100644
index 000000000..189b14caf
--- /dev/null
+++ b/tests/cross-compile/vk-push-constant-set.slang.glsl
@@ -0,0 +1,28 @@
+// vk-push-constant.slang.glsl
+#version 450
+
+struct S_0
+{
+ vec4 v_0;
+};
+
+layout(push_constant)
+layout(std140) uniform _S1
+{
+ S_0 _data;
+} x_0;
+
+layout(binding = 0, set = 0)
+layout(std140) uniform _S2
+{
+ S_0 _data;
+} y_0;
+
+layout(location = 0)
+out vec4 _S3;
+
+void main()
+{
+ _S3 = x_0._data.v_0 + y_0._data.v_0;
+ return;
+}