From 6a8ad6eb4cab72c18de48762768e04d08b60a21c Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Wed, 22 Aug 2018 11:36:02 -0400 Subject: Support for [[vk::push_constant]] (#629) * Support for attributed [[vk::push_constant]] and [[push_constant]]. Can also use layout(push_constant). * Fix test so matches the expected output. * Add expected output to binding-push-constant-gl.hlsl * Trivial change to force travis rebuild to test the gcc linux build really has a problem. --- tests/reflection/binding-push-constant-gl.hlsl | 57 ++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 tests/reflection/binding-push-constant-gl.hlsl (limited to 'tests/reflection/binding-push-constant-gl.hlsl') 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 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 -- cgit v1.2.3