From 2eb71d157c03baf6b679179953f838388432bc97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20Briano?= Date: Fri, 8 Mar 2024 16:02:23 -0800 Subject: [PATCH] compiler/types: fix serialization of cooperative matrix Encoding of cmat_desc is overwriting the base_type with the type of the elements of the matrix. Fixes: 2d0f4f2c17b ("compiler/types: Add support for Cooperative Matrix types") Reviewed-by: Caio Oliveira Part-of: (cherry picked from commit e1b66f9707c010a4b554b3039649afb13cba61de) --- .pick_status.json | 2 +- src/compiler/glsl_types.c | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.pick_status.json b/.pick_status.json index b1f61c76acc..28c7c67ce27 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -1744,7 +1744,7 @@ "description": "compiler/types: fix serialization of cooperative matrix", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "2d0f4f2c17b79830e9780a68bc473718d4abd4ad", "notes": null diff --git a/src/compiler/glsl_types.c b/src/compiler/glsl_types.c index 71edd9e98b5..88eeeae5c41 100644 --- a/src/compiler/glsl_types.c +++ b/src/compiler/glsl_types.c @@ -3145,6 +3145,11 @@ encode_type_to_blob(struct blob *blob, const glsl_type *type) encode_type_to_blob(blob, type->fields.array); return; case GLSL_TYPE_COOPERATIVE_MATRIX: + /* The first 5 bits of encoded/decoded are used to identify the + * actual type, but cmat_desc already is 32-bit without that tag, so + * encode just the cmat base type first, then the actual cmat desc. + */ + blob_write_uint32(blob, encoded.u32); encoded.cmat_desc = type->cmat_desc; blob_write_uint32(blob, encoded.u32); return; @@ -3255,6 +3260,7 @@ decode_type_from_blob(struct blob_reader *blob) explicit_stride); } case GLSL_TYPE_COOPERATIVE_MATRIX: { + encoded.u32 = blob_read_uint32(blob); return glsl_cmat_type(&encoded.cmat_desc); } case GLSL_TYPE_STRUCT: