v3d/compiler: use mask for 16bit and 32bit return values

There are only ever two possibilities here so lets use a mask.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34742>
This commit is contained in:
Ella Stanforth
2025-04-29 17:29:55 +01:00
committed by Marge Bot
parent bb07364c54
commit 9a71e6dcc2
6 changed files with 41 additions and 62 deletions
+5 -3
View File
@@ -408,9 +408,11 @@ static inline uint8_t v3d_slot_get_component(struct v3d_varying_slot slot)
}
struct v3d_key {
struct {
uint8_t return_size;
} sampler[V3D_MAX_TEXTURE_SAMPLERS];
/* Mask of sampler return sizes.
* 0 is 16bit
* 1 is 32bit
*/
uint32_t sampler_is_32b;
uint8_t ucp_enables;
bool is_last_geometry_stage;
+1 -1
View File
@@ -239,7 +239,7 @@ v3d_vir_emit_tex(struct v3d_compile *c, nir_tex_instr *instr)
* parameter if the output is 32 bit
*/
bool output_type_32_bit =
c->key->sampler[sampler_idx].return_size == 32;
(c->key->sampler_is_32b & (1 << sampler_idx));
struct V3D42_TMU_CONFIG_PARAMETER_0 p0_unpacked = {
};
+2 -2
View File
@@ -601,8 +601,8 @@ lower_tex_packing_cb(const nir_tex_instr *tex, const void *data)
int sampler_index = nir_tex_instr_need_sampler(tex) ?
tex->sampler_index : tex->backend_flags;
return c->key->sampler[sampler_index].return_size == 16 ?
nir_lower_tex_packing_16 : nir_lower_tex_packing_none;
return (c->key->sampler_is_32b & (1 << sampler_index)) ?
nir_lower_tex_packing_none : nir_lower_tex_packing_16;
}
static bool