Module: Mesa
Branch: staging/19.1
Commit: 6ba4ce97b722f9561cac8c8263e0355b4212378c
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=6ba4ce97b722f9561cac8c8263e0355b4212378c

Author: Caio Marcelo de Oliveira Filho <[email protected]>
Date:   Wed Jul  3 12:47:53 2019 -0700

spirv: Fix stride calculation when lowering Workgroup to offsets

Use alignment to calculate the stride associated with the pointer
types.  That stride is used when the pointers are casted to arrays.

Note that size alone is not sufficient, e.g. struct { vec2 a; vec1 b;
} will have element an element size of 12 bytes, but the stride needs
to be 16 bytes to respect the 8 byte alignment.

Fixes: 050eb6389a8 "spirv: Ignore ArrayStride in OpPtrAccessChain for Workgroup"
Reviewed-by: Jason Ekstrand <[email protected]>
(cherry picked from commit 026cfa10995ff3316476fa19507fa27adc531de5)

---

 src/compiler/spirv/spirv_to_nir.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/compiler/spirv/spirv_to_nir.c 
b/src/compiler/spirv/spirv_to_nir.c
index 98df7a87e94..1a5d4c7988d 100644
--- a/src/compiler/spirv/spirv_to_nir.c
+++ b/src/compiler/spirv/spirv_to_nir.c
@@ -1432,7 +1432,7 @@ vtn_handle_type(struct vtn_builder *b, SpvOp opcode,
             val->type->align = align;
 
             /* Override any ArrayStride previously set. */
-            val->type->stride = size;
+            val->type->stride = vtn_align_u32(size, align);
          }
       }
       break;

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to