nir+drivers: add helpers to get # of src/dest components
Add helpers to get the number of src/dest components for an intrinsic, and update spots that were open-coding this logic to use the helpers instead. Signed-off-by: Rob Clark <robdclark@gmail.com> Reviewed-by: Eric Anholt <eric@anholt.net>
This commit is contained in:
@@ -3821,6 +3821,7 @@ fs_visitor::nir_emit_intrinsic(const fs_builder &bld, nir_intrinsic_instr *instr
|
||||
const unsigned arr_dims = type->sampler_array ? 1 : 0;
|
||||
const unsigned surf_dims = type->coordinate_components() - arr_dims;
|
||||
const unsigned format = var->data.image.format;
|
||||
const unsigned dest_components = nir_intrinsic_dest_components(instr);
|
||||
|
||||
/* Get the arguments of the image intrinsic. */
|
||||
const fs_reg image = get_nir_image_deref(instr->variables[0]);
|
||||
@@ -3844,15 +3845,13 @@ fs_visitor::nir_emit_intrinsic(const fs_builder &bld, nir_intrinsic_instr *instr
|
||||
|
||||
else
|
||||
tmp = emit_image_atomic(bld, image, addr, src0, src1,
|
||||
surf_dims, arr_dims, info->dest_components,
|
||||
surf_dims, arr_dims, dest_components,
|
||||
get_image_atomic_op(instr->intrinsic, type));
|
||||
|
||||
/* Assign the result. */
|
||||
if (nir_intrinsic_infos[instr->intrinsic].has_dest) {
|
||||
for (unsigned c = 0; c < info->dest_components; ++c) {
|
||||
bld.MOV(offset(retype(dest, base_type), bld, c),
|
||||
offset(tmp, bld, c));
|
||||
}
|
||||
for (unsigned c = 0; c < dest_components; ++c) {
|
||||
bld.MOV(offset(retype(dest, base_type), bld, c),
|
||||
offset(tmp, bld, c));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
Reference in New Issue
Block a user