File tree Expand file tree Collapse file tree 5 files changed +221
-46
lines changed
Expand file tree Collapse file tree 5 files changed +221
-46
lines changed Original file line number Diff line number Diff line change @@ -64,6 +64,10 @@ if(WEBGPU_SUPPORTED)
6464 target_link_libraries (DiligentCoreTest PRIVATE libtint)
6565endif ()
6666
67+ if (PLATFORM_WIN32)
68+ copy_shader_compiler_dlls(DiligentCoreTest DXCOMPILER_FOR_SPIRV YES )
69+ endif ()
70+
6771source_group (TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES ${SOURCE} ${SHADERS} })
6872
6973set_target_properties (DiligentCoreTest
Original file line number Diff line number Diff line change @@ -27,19 +27,16 @@ RWTexture2D<float4> StorageTex : register(u1);
2727// Sampler
2828SamplerState Sampler : register(s0);
2929
30- // Test for push constants
30+ // Test struct for push constants
3131struct PushConstants_t
3232{
3333 float2 Offset;
3434 float Time;
3535 uint FrameCount;
3636};
3737
38- [[vk::push_constant]]
39- cbuffer PushConstants
40- {
41- PushConstants_t g_PushConstants;
42- };
38+ //note that cbuffer PushConstants is not allowed in DXC, but ConstantBuffer<PushConstants_t> is allowed
39+ [[vk::push_constant]] ConstantBuffer<PushConstants_t> PushConstants;
4340
4441float4 main() : SV_Target
4542{
@@ -59,8 +56,8 @@ float4 main() : SV_Target
5956 StorageTex[uint2(0, 0)] = color;
6057
6158 // Use push constant data
62- color.xy += g_PushConstants .Offset;
63- color.rgb *= sin(g_PushConstants .Time) * 0.5 + 0.5;
59+ color.xy += PushConstants .Offset;
60+ color.rgb *= sin(PushConstants .Time) * 0.5 + 0.5;
6461
6562 return color;
6663}
Original file line number Diff line number Diff line change 1- // Test for push constants
1+ // Test struct for push constants
22struct PushConstants_t
33{
44 float4x4 g_MVPMatrix;
@@ -8,19 +8,16 @@ struct PushConstants_t
88 uint g_Padding;
99};
1010
11- [[vk::push_constant]]
12- cbuffer PushConstants
13- {
14- PushConstants_t g_PushConstants;
15- };
11+ //note that cbuffer PushConstants is not allowed in DXC, but ConstantBuffer<PushConstants_t> is allowed
12+ [[vk::push_constant]] ConstantBuffer<PushConstants_t> PushConstants;
1613
1714float4 main() : SV_Target
1815{
1916 // Use push constant data through the structure instance
20- float4 result = g_PushConstants .g_Color * g_PushConstants .g_Scale;
17+ float4 result = PushConstants .g_Color * PushConstants .g_Scale;
2118
2219 // Apply offset to result (simplified example)
23- result.xy += g_PushConstants .g_Offset;
20+ result.xy += PushConstants .g_Offset;
2421
2522 return result;
2623}
Original file line number Diff line number Diff line change 11// Test for uniform buffers (constant buffers)
2- cbuffer CB0 : register(b0)
3- {
4- float4x4 g_WorldViewProj;
5- };
62
73cbuffer CB1 : register(b1)
84{
You can’t perform that action at this time.
0 commit comments