From: Francisco Casas fcasas@codeweavers.com
--- Makefile.am | 1 + libs/vkd3d-shader/hlsl.y | 6 +++++- tests/cbuffer.shader_test | 17 +++++++++++++++++ 3 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 tests/cbuffer.shader_test
diff --git a/Makefile.am b/Makefile.am index 581010fd..a84418a4 100644 --- a/Makefile.am +++ b/Makefile.am @@ -65,6 +65,7 @@ vkd3d_shader_tests = \ tests/cast-to-half.shader_test \ tests/cast-to-int.shader_test \ tests/cast-to-uint.shader_test \ + tests/cbuffer.shader_test \ tests/compute.shader_test \ tests/conditional.shader_test \ tests/floor.shader_test \ diff --git a/libs/vkd3d-shader/hlsl.y b/libs/vkd3d-shader/hlsl.y index 6461ade5..750ae9de 100644 --- a/libs/vkd3d-shader/hlsl.y +++ b/libs/vkd3d-shader/hlsl.y @@ -3345,7 +3345,11 @@ buffer_declaration: }
buffer_body: - '{' declaration_statement_list '}' + '{' '}' + { + ctx->cur_buffer = ctx->globals_buffer; + } + | '{' declaration_statement_list '}' { ctx->cur_buffer = ctx->globals_buffer; } diff --git a/tests/cbuffer.shader_test b/tests/cbuffer.shader_test new file mode 100644 index 00000000..07ef18db --- /dev/null +++ b/tests/cbuffer.shader_test @@ -0,0 +1,17 @@ +[pixel shader] +// Test empty constant buffer. +cbuffer Constants : register(b1) +{ +}; + +float4 foo; + +float4 main() : sv_target +{ + return foo; +} + +[test] +uniform 0 float4 1.0 2.0 3.0 4.0 +draw quad +probe all rgba (1.0, 2.0, 3.0, 4.0)