intel/fs: fix nir_opt_peephole_ffma max vec assumption
There can be larger vec than vec4. Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Cc: mesa-stable Reviewed-by: Marcin Ślusarz <marcin.slusarz@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21782>
This commit is contained in:

committed by
Marge Bot

parent
efde1917c9
commit
18bdc71459
@@ -68,9 +68,9 @@ are_all_uses_fadd(nir_ssa_def *def)
|
||||
|
||||
static nir_alu_instr *
|
||||
get_mul_for_src(nir_alu_src *src, unsigned num_components,
|
||||
uint8_t swizzle[4], bool *negate, bool *abs)
|
||||
uint8_t *swizzle, bool *negate, bool *abs)
|
||||
{
|
||||
uint8_t swizzle_tmp[4];
|
||||
uint8_t swizzle_tmp[NIR_MAX_VEC_COMPONENTS];
|
||||
assert(src->src.is_ssa && !src->abs && !src->negate);
|
||||
|
||||
nir_instr *instr = src->src.ssa->parent_instr;
|
||||
@@ -133,7 +133,7 @@ get_mul_for_src(nir_alu_src *src, unsigned num_components,
|
||||
* Expected output swizzle = zyxx
|
||||
* If we reuse swizzle in the loop, then output swizzle would be zyzz.
|
||||
*/
|
||||
memcpy(swizzle_tmp, swizzle, 4*sizeof(uint8_t));
|
||||
memcpy(swizzle_tmp, swizzle, NIR_MAX_VEC_COMPONENTS*sizeof(uint8_t));
|
||||
for (int i = 0; i < num_components; i++)
|
||||
swizzle[i] = swizzle_tmp[src->swizzle[i]];
|
||||
|
||||
@@ -189,10 +189,10 @@ brw_nir_opt_peephole_ffma_instr(nir_builder *b,
|
||||
return false;
|
||||
|
||||
nir_alu_instr *mul;
|
||||
uint8_t add_mul_src, swizzle[4];
|
||||
uint8_t add_mul_src, swizzle[NIR_MAX_VEC_COMPONENTS];
|
||||
bool negate, abs;
|
||||
for (add_mul_src = 0; add_mul_src < 2; add_mul_src++) {
|
||||
for (unsigned i = 0; i < 4; i++)
|
||||
for (unsigned i = 0; i < NIR_MAX_VEC_COMPONENTS; i++)
|
||||
swizzle[i] = i;
|
||||
|
||||
negate = false;
|
||||
|
Reference in New Issue
Block a user