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: 2d0f4f2c17 ("compiler/types: Add support for Cooperative Matrix types")

Reviewed-by: Caio Oliveira <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28086>
This commit is contained in:
Iván Briano 2024-03-08 16:02:23 -08:00 committed by Marge Bot
parent fc2b619621
commit e1b66f9707

View File

@ -3161,6 +3161,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;
@ -3271,6 +3276,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: