intel/cmat: Add lowering for cmat_bitcast

v2: Use nir_component_mask(...) instead of 0xffff. Assert that source
and destination are same size. Both suggested by Caio.

Reviewed-by: Caio Oliveira <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25994>
This commit is contained in:
Ian Romanick 2023-07-21 16:06:48 -07:00
parent 7303315a8b
commit 502be565da

View file

@ -494,9 +494,18 @@ lower_cmat_instr(nir_builder *b, nir_instr *instr, void *_state)
/* FINISHME. */
return NIR_LOWER_INSTR_PROGRESS_REPLACE;
case nir_intrinsic_cmat_bitcast:
/* FINISHME. */
case nir_intrinsic_cmat_bitcast: {
nir_deref_instr *dst_slice = nir_src_as_deref(intrin->src[0]);
nir_deref_instr *src_slice = nir_src_as_deref(intrin->src[1]);
const unsigned num_components = glsl_get_vector_elements(dst_slice->type);
assert(glsl_get_vector_elements(src_slice->type) == num_components);
nir_store_deref(b, dst_slice, nir_load_deref(b, src_slice),
nir_component_mask(num_components));
return NIR_LOWER_INSTR_PROGRESS_REPLACE;
}
case nir_intrinsic_cmat_copy:
nir_copy_deref(b,