mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d-shader/spirv: Implement the WAVE_READ_LANE_FIRST instruction.
This commit is contained in:
parent
cb9b10bf4d
commit
e1c774bfeb
Notes:
Alexandre Julliard
2024-05-14 23:00:18 +02:00
Approved-by: Giovanni Mascellani (@giomasce) Approved-by: Henri Verbeet (@hverbeet) Approved-by: Alexandre Julliard (@julliard) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/863
@ -1791,6 +1791,14 @@ static uint32_t vkd3d_spirv_build_op_group_nonuniform_shuffle(struct vkd3d_spirv
|
||||
vkd3d_spirv_get_op_scope_subgroup(builder), val_id, lane_id);
|
||||
}
|
||||
|
||||
static uint32_t vkd3d_spirv_build_op_group_nonuniform_broadcast_first(struct vkd3d_spirv_builder *builder,
|
||||
uint32_t result_type, uint32_t val_id)
|
||||
{
|
||||
vkd3d_spirv_enable_capability(builder, SpvCapabilityGroupNonUniformBallot);
|
||||
return vkd3d_spirv_build_op_tr2(builder, &builder->function_stream, SpvOpGroupNonUniformBroadcastFirst,
|
||||
result_type, vkd3d_spirv_get_op_scope_subgroup(builder), val_id);
|
||||
}
|
||||
|
||||
static uint32_t vkd3d_spirv_build_op_glsl_std450_tr1(struct vkd3d_spirv_builder *builder,
|
||||
enum GLSLstd450 op, uint32_t result_type, uint32_t operand)
|
||||
{
|
||||
@ -9969,6 +9977,22 @@ static void spirv_compiler_emit_wave_read_lane_at(struct spirv_compiler *compile
|
||||
spirv_compiler_emit_store_dst(compiler, dst, val_id);
|
||||
}
|
||||
|
||||
static void spirv_compiler_emit_wave_read_lane_first(struct spirv_compiler *compiler,
|
||||
const struct vkd3d_shader_instruction *instruction)
|
||||
{
|
||||
struct vkd3d_spirv_builder *builder = &compiler->spirv_builder;
|
||||
const struct vkd3d_shader_dst_param *dst = instruction->dst;
|
||||
const struct vkd3d_shader_src_param *src = instruction->src;
|
||||
uint32_t type_id, val_id;
|
||||
|
||||
type_id = vkd3d_spirv_get_type_id_for_data_type(builder, dst->reg.data_type,
|
||||
vsir_write_mask_component_count(dst->write_mask));
|
||||
val_id = spirv_compiler_emit_load_src(compiler, src, dst->write_mask);
|
||||
val_id = vkd3d_spirv_build_op_group_nonuniform_broadcast_first(builder, type_id, val_id);
|
||||
|
||||
spirv_compiler_emit_store_dst(compiler, dst, val_id);
|
||||
}
|
||||
|
||||
/* This function is called after declarations are processed. */
|
||||
static void spirv_compiler_emit_main_prolog(struct spirv_compiler *compiler)
|
||||
{
|
||||
@ -10344,6 +10368,9 @@ static int spirv_compiler_handle_instruction(struct spirv_compiler *compiler,
|
||||
case VKD3DSIH_WAVE_READ_LANE_AT:
|
||||
spirv_compiler_emit_wave_read_lane_at(compiler, instruction);
|
||||
break;
|
||||
case VKD3DSIH_WAVE_READ_LANE_FIRST:
|
||||
spirv_compiler_emit_wave_read_lane_first(compiler, instruction);
|
||||
break;
|
||||
case VKD3DSIH_DCL:
|
||||
case VKD3DSIH_DCL_HS_MAX_TESSFACTOR:
|
||||
case VKD3DSIH_DCL_INPUT_CONTROL_POINT_COUNT:
|
||||
|
@ -111,7 +111,7 @@ void main(uint id : SV_GroupIndex)
|
||||
}
|
||||
|
||||
[test]
|
||||
todo dispatch 4 1 1
|
||||
dispatch 4 1 1
|
||||
probe uav 1 (0) rgba (7.0, 2.0, 8.0, 5.0)
|
||||
probe uav 1 (1) rgba (7.0, 2.0, 8.0, 5.0)
|
||||
probe uav 1 (2) rgba (7.0, 2.0, 8.0, 5.0)
|
||||
@ -451,7 +451,7 @@ float4 main(float4 pos : SV_Position) : SV_Target
|
||||
|
||||
[test]
|
||||
clear rtv 0 0.25 0.5 0.75 1.0
|
||||
todo draw quad
|
||||
draw quad
|
||||
probe rtv 0 (0, 0) rgba (0.25, 0.5, 0.75, 1.0)
|
||||
probe rtv 0 (1, 0) rgba (1.0, 0.0, 0.0, 1.0)
|
||||
probe rtv 0 (0, 1) rgba (1.0, 0.0, 0.0, 1.0)
|
||||
|
@ -139,7 +139,7 @@ void main(uint id : SV_GroupIndex)
|
||||
}
|
||||
|
||||
[test]
|
||||
todo dispatch 4 1 1
|
||||
dispatch 4 1 1
|
||||
probe uav 1 (0) rui (23)
|
||||
probe uav 1 (1) rui (23)
|
||||
probe uav 1 (2) rui (23)
|
||||
|
Loading…
Reference in New Issue
Block a user