mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-17 05:18:12 +02:00
spirv: preserve the explicit stride for untyped pointers with matrices
Make sure to cast with the deref type that contains more information than the returned type because it's valid in SPIR-V. This fixes dEQP-VK.binding_model.descriptor_heap.graphics.*_vectors and also the PositiveGpuAV.HeapWithUntypedPointers VVL test. Cc: mesa-stable Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41469>
This commit is contained in:
parent
907cc49c32
commit
975ae01208
1 changed files with 12 additions and 1 deletions
|
|
@ -2699,9 +2699,20 @@ vtn_cast_pointer(struct vtn_builder *b, struct vtn_pointer *p,
|
|||
vtn_assert(pointed == casted->type->pointed);
|
||||
|
||||
if (p->deref) {
|
||||
const struct glsl_type *deref_type = pointed->type;
|
||||
|
||||
/* Preserve the explicit stride when casting an untyped pointer to a raw
|
||||
* SPIR-V matrix type because the raw type lacks it.
|
||||
*/
|
||||
if (glsl_type_is_matrix(p->deref->type) &&
|
||||
glsl_type_is_matrix(deref_type) &&
|
||||
glsl_get_explicit_stride(p->deref->type) > 0 &&
|
||||
glsl_get_explicit_stride(deref_type) == 0)
|
||||
deref_type = p->deref->type;
|
||||
|
||||
casted->deref = nir_build_deref_cast(&b->nb, &p->deref->def,
|
||||
p->deref->modes,
|
||||
pointed->type, 0);
|
||||
deref_type, 0);
|
||||
} else if (p->desc_index != NULL) {
|
||||
/* Nothing to do for descriptor index pointers. */
|
||||
} else if (p->var != NULL) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue