summaryrefslogtreecommitdiff
path: root/tests/reflection/binding-push-constant-gl.hlsl
diff options
context:
space:
mode:
Diffstat (limited to 'tests/reflection/binding-push-constant-gl.hlsl')
-rw-r--r--tests/reflection/binding-push-constant-gl.hlsl57
1 files changed, 57 insertions, 0 deletions
diff --git a/tests/reflection/binding-push-constant-gl.hlsl b/tests/reflection/binding-push-constant-gl.hlsl
new file mode 100644
index 000000000..f6bf13602
--- /dev/null
+++ b/tests/reflection/binding-push-constant-gl.hlsl
@@ -0,0 +1,57 @@
+//TEST:REFLECTION:-profile ps_4_0 -target spirv
+
+// Confirm that we can generate reflection info for arrays
+//
+// Note: just working with fixed-size arrays for now.
+// Unbounded arrays may require more work.
+
+layout(binding=0, set = 1) cbuffer MyConstantBuffer
+{
+ float x;
+
+ float a[10];
+
+ float y;
+}
+
+struct MyPushConstantStruct
+{
+ float pushX;
+ float pushY;
+};
+
+/* This style doesn't work
+[[vk::push_constant]] MyPushConstantStruct pushConstantBuffer;
+*/
+
+// This style does work
+[[vk::push_constant]]ConstantBuffer<MyPushConstantStruct> pushConstantBuffer;
+
+/* This style works too
+layout(push_constant)
+cbuffer MyPushConstantBuffer
+{
+ float pushX;
+ float pushY;
+}
+*/
+
+/* This works too
+[[vk::push_constant]] cbuffer MyPushConstantBuffer
+{
+ float pushX;
+ float pushY;
+}
+*/
+
+[[vk::binding(1,2)]] Texture2D tx;
+[gl::binding(2,3)] Texture2D ta;
+Texture2D ty;
+SamplerState sx;
+SamplerState sa[4];
+SamplerState sy;
+
+float4 main() : SV_Target
+{
+ return 0.0 + pushConstantBuffer.pushX;
+} \ No newline at end of file