mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 20:08:06 +02:00
vtn: Fix vtn_mediump_upconvert_value() with transposed matrices
We can produce a transposed value sometimes, and we have to make sure
that val->transposed is also updated when that happens.
Noticed by inspection after the previous commit.
Cc: mesa-stable
(cherry picked from commit c13bdaaa40)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40488>
This commit is contained in:
parent
e234dcf62c
commit
f7d31e8681
4 changed files with 18 additions and 8 deletions
|
|
@ -64,7 +64,7 @@
|
|||
"description": "vtn: Fix vtn_mediump_upconvert_value() with transposed matrices",
|
||||
"nominated": true,
|
||||
"nomination_type": 1,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": null,
|
||||
"notes": null
|
||||
|
|
|
|||
|
|
@ -550,17 +550,26 @@ vtn_mediump_upconvert(struct vtn_builder *b, enum glsl_base_type base_type, nir_
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
struct vtn_ssa_value *
|
||||
vtn_mediump_upconvert_value(struct vtn_builder *b, struct vtn_ssa_value *value)
|
||||
{
|
||||
enum glsl_base_type base_type = glsl_get_base_type(value->type);
|
||||
|
||||
if (value->transposed) {
|
||||
struct vtn_ssa_value *transposed =
|
||||
vtn_mediump_upconvert_value(b, value->transposed);
|
||||
return vtn_ssa_transpose(b, transposed);
|
||||
}
|
||||
|
||||
struct vtn_ssa_value *value_full = vtn_create_ssa_value(b, value->type);
|
||||
if (glsl_type_is_vector_or_scalar(value->type)) {
|
||||
value->def = vtn_mediump_upconvert(b, base_type, value->def);
|
||||
value_full->def = vtn_mediump_upconvert(b, base_type, value->def);
|
||||
} else {
|
||||
for (int i = 0; i < glsl_get_matrix_columns(value->type); i++)
|
||||
value->elems[i]->def = vtn_mediump_upconvert(b, base_type, value->elems[i]->def);
|
||||
value_full->elems[i]->def = vtn_mediump_upconvert(b, base_type, value->elems[i]->def);
|
||||
}
|
||||
|
||||
return value_full;
|
||||
}
|
||||
|
||||
static nir_def *
|
||||
|
|
@ -748,7 +757,7 @@ vtn_handle_alu(struct vtn_builder *b, SpvOp opcode,
|
|||
struct vtn_ssa_value *dest = vtn_handle_matrix_alu(b, opcode, vtn_src[0], vtn_src[1]);
|
||||
|
||||
if (mediump_16bit)
|
||||
vtn_mediump_upconvert_value(b, dest);
|
||||
dest = vtn_mediump_upconvert_value(b, dest);
|
||||
|
||||
vtn_push_ssa_value(b, w[2], dest);
|
||||
b->nb.fp_math_ctrl = b->exact ? nir_fp_exact : nir_fp_fast_math;
|
||||
|
|
@ -1096,7 +1105,7 @@ vtn_handle_alu(struct vtn_builder *b, SpvOp opcode,
|
|||
}
|
||||
|
||||
if (mediump_16bit)
|
||||
vtn_mediump_upconvert_value(b, dest);
|
||||
dest = vtn_mediump_upconvert_value(b, dest);
|
||||
vtn_push_ssa_value(b, w[2], dest);
|
||||
|
||||
b->nb.fp_math_ctrl = b->exact ? nir_fp_exact : nir_fp_fast_math;
|
||||
|
|
|
|||
|
|
@ -640,7 +640,7 @@ handle_glsl450_alu(struct vtn_builder *b, enum GLSLstd450 entrypoint,
|
|||
b->nb.fp_math_ctrl = b->exact ? nir_fp_exact : nir_fp_fast_math;
|
||||
|
||||
if (mediump_16bit)
|
||||
vtn_mediump_upconvert_value(b, dest);
|
||||
dest = vtn_mediump_upconvert_value(b, dest);
|
||||
|
||||
vtn_push_ssa_value(b, w[2], dest);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1065,7 +1065,8 @@ nir_def *
|
|||
vtn_mediump_downconvert(struct vtn_builder *b, enum glsl_base_type base_type, nir_def *def);
|
||||
struct vtn_ssa_value *
|
||||
vtn_mediump_downconvert_value(struct vtn_builder *b, struct vtn_ssa_value *src);
|
||||
void vtn_mediump_upconvert_value(struct vtn_builder *b, struct vtn_ssa_value *value);
|
||||
struct vtn_ssa_value *
|
||||
vtn_mediump_upconvert_value(struct vtn_builder *b, struct vtn_ssa_value *value);
|
||||
|
||||
static inline int
|
||||
cmp_uint32_t(const void *pa, const void *pb)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue