mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2024-11-23 10:14:13 +08:00
vc4/lower_blend: don't read non-existent channels
nir_lower_texcoord_replace_late had swapped parameters in nir_undef. Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Reviewed-by: Emma Anholt <emma@anholt.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32173>
This commit is contained in:
parent
4da5b11ca9
commit
3affe3cb17
@ -767,6 +767,15 @@ nir_channel(nir_builder *b, nir_def *def, unsigned c)
|
||||
return nir_swizzle(b, def, &c, 1);
|
||||
}
|
||||
|
||||
static inline nir_def *
|
||||
nir_channel_or_undef(nir_builder *b, nir_def *def, signed int channel)
|
||||
{
|
||||
if (channel >= 0 && channel < def->num_components)
|
||||
return nir_channel(b, def, channel);
|
||||
else
|
||||
return nir_undef(b, 1, def->bit_size);
|
||||
}
|
||||
|
||||
static inline nir_def *
|
||||
nir_channels(nir_builder *b, nir_def *def, nir_component_mask_t mask)
|
||||
{
|
||||
|
@ -13,15 +13,6 @@ struct opts {
|
||||
bool point_coord_is_sysval;
|
||||
};
|
||||
|
||||
static nir_def *
|
||||
nir_channel_or_undef(nir_builder *b, nir_def *def, signed int channel)
|
||||
{
|
||||
if (channel >= 0 && channel < def->num_components)
|
||||
return nir_channel(b, def, channel);
|
||||
else
|
||||
return nir_undef(b, def->bit_size, 1);
|
||||
}
|
||||
|
||||
static bool
|
||||
pass(nir_builder *b, nir_instr *instr, void *data)
|
||||
{
|
||||
|
@ -1473,15 +1473,6 @@ agx_nir_lower_clip_m1_1(nir_builder *b, nir_intrinsic_instr *intr,
|
||||
return true;
|
||||
}
|
||||
|
||||
static nir_def *
|
||||
nir_channel_or_undef(nir_builder *b, nir_def *def, signed int channel)
|
||||
{
|
||||
if (channel >= 0 && channel < def->num_components)
|
||||
return nir_channel(b, def, channel);
|
||||
else
|
||||
return nir_undef(b, 1, def->bit_size);
|
||||
}
|
||||
|
||||
/*
|
||||
* To implement point sprites, we'll replace TEX0...7 with point coordinate
|
||||
* reads as required. However, the .zw needs to read back 0.0/1.0. This pass
|
||||
|
@ -443,7 +443,7 @@ vc4_nir_blend_pipeline(struct vc4_compile *c, nir_builder *b, nir_def *src,
|
||||
nir_def *dst_vec4 = nir_unpack_unorm_4x8(b, packed_dst_color);
|
||||
nir_def *src_color[4], *unpacked_dst_color[4];
|
||||
for (unsigned i = 0; i < 4; i++) {
|
||||
src_color[i] = nir_channel(b, src, i);
|
||||
src_color[i] = nir_channel_or_undef(b, src, i);
|
||||
unpacked_dst_color[i] = nir_channel(b, dst_vec4, i);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user