Module: vkd3d Branch: master Commit: 77259da1ad3fa654916f04172a290564861507d3 URL: https://gitlab.winehq.org/wine/vkd3d/-/commit/77259da1ad3fa654916f04172a2905...
Author: Conor McCarthy cmccarthy@codeweavers.com Date: Tue Apr 23 22:03:14 2024 +1000
vkd3d-shader/spirv: Implement the WAVE_PREFIX_BIT_COUNT instruction.
---
libs/vkd3d-shader/spirv.c | 4 +++- tests/hlsl/wave-ops-uint.shader_test | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/libs/vkd3d-shader/spirv.c b/libs/vkd3d-shader/spirv.c index 015dbe90..a78af601 100644 --- a/libs/vkd3d-shader/spirv.c +++ b/libs/vkd3d-shader/spirv.c @@ -9902,7 +9902,8 @@ static void spirv_compiler_emit_wave_bit_count(struct spirv_compiler *compiler, SpvGroupOperation group_op; uint32_t type_id, val_id;
- group_op = SpvGroupOperationReduce; + group_op = (instruction->handler_idx == VKD3DSIH_WAVE_PREFIX_BIT_COUNT) ? SpvGroupOperationExclusiveScan + : SpvGroupOperationReduce;
val_id = spirv_compiler_emit_group_nonuniform_ballot(compiler, instruction->src); type_id = vkd3d_spirv_get_type_id(builder, VKD3D_SHADER_COMPONENT_UINT, 1); @@ -10288,6 +10289,7 @@ static int spirv_compiler_handle_instruction(struct spirv_compiler *compiler, spirv_compiler_emit_wave_alu_op(compiler, instruction); break; case VKD3DSIH_WAVE_ALL_BIT_COUNT: + case VKD3DSIH_WAVE_PREFIX_BIT_COUNT: spirv_compiler_emit_wave_bit_count(compiler, instruction); break; case VKD3DSIH_WAVE_IS_FIRST_LANE: diff --git a/tests/hlsl/wave-ops-uint.shader_test b/tests/hlsl/wave-ops-uint.shader_test index 9bae40ca..fd7d7695 100644 --- a/tests/hlsl/wave-ops-uint.shader_test +++ b/tests/hlsl/wave-ops-uint.shader_test @@ -196,7 +196,7 @@ void main(uint id : SV_GroupIndex) }
[test] -todo dispatch 4 1 1 +dispatch 4 1 1 probe uav 1 (0) rui (0) probe uav 1 (1) rui (1) probe uav 1 (2) rui (1)