From c8cc1b1a2476a4c518756fd7604d37e8c1611af3 Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Sat, 17 Aug 2024 14:06:05 +0200 Subject: [PATCH] vkd3d-shader/fx: Fix the matrix type class for fx_2_0. CTAB type correctly reflects matrix majority, unlike effects type data that does not respond to majority modifiers at all. It doesn't transpose default values either. Signed-off-by: Nikolay Sivov --- libs/vkd3d-shader/fx.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/libs/vkd3d-shader/fx.c b/libs/vkd3d-shader/fx.c index 7e98b6d5..a1d1fd65 100644 --- a/libs/vkd3d-shader/fx.c +++ b/libs/vkd3d-shader/fx.c @@ -894,6 +894,13 @@ static uint32_t write_fx_2_string(const char *string, struct fx_write_context *f return offset; } +static uint32_t get_fx_2_type_class(const struct hlsl_type *type) +{ + if (type->class == HLSL_CLASS_MATRIX) + return D3DXPC_MATRIX_ROWS; + return hlsl_sm1_class(type); +} + static uint32_t write_fx_2_parameter(const struct hlsl_type *type, const char *name, const struct hlsl_semantic *semantic, struct fx_write_context *fx) { @@ -912,7 +919,7 @@ static uint32_t write_fx_2_parameter(const struct hlsl_type *type, const char *n semantic_offset = semantic->raw_name ? write_string(semantic->raw_name, fx) : 0; offset = put_u32(buffer, hlsl_sm1_base_type(type)); - put_u32(buffer, hlsl_sm1_class(type)); + put_u32(buffer, get_fx_2_type_class(type)); put_u32(buffer, name_offset); put_u32(buffer, semantic_offset); put_u32(buffer, elements_count);