vkd3d-shader/fx: Only add numeric variables when writing buffers.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
This commit is contained in:
Nikolay Sivov 2024-08-31 01:24:51 +02:00 committed by Henri Verbeet
parent ee2da76e6d
commit 1ed4543007
Notes: Henri Verbeet 2024-09-04 11:48:06 +02:00
Approved-by: Henri Verbeet (@hverbeet)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1030

View File

@ -575,6 +575,12 @@ static const char * get_fx_4_type_name(const struct hlsl_type *type)
} }
} }
static bool is_numeric_fx_4_type(const struct hlsl_type *type)
{
type = hlsl_get_multiarray_element_type(type);
return type->class == HLSL_CLASS_STRUCT || hlsl_is_numeric_type(type);
}
static uint32_t write_fx_4_type(const struct hlsl_type *type, struct fx_write_context *fx) static uint32_t write_fx_4_type(const struct hlsl_type *type, struct fx_write_context *fx)
{ {
struct field_offsets struct field_offsets
@ -667,7 +673,7 @@ static uint32_t write_fx_4_type(const struct hlsl_type *type, struct fx_write_co
/* Structures can only contain numeric fields, this is validated during variable declaration. */ /* Structures can only contain numeric fields, this is validated during variable declaration. */
total_size = stride = type->reg_size[HLSL_REGSET_NUMERIC] * sizeof(float); total_size = stride = type->reg_size[HLSL_REGSET_NUMERIC] * sizeof(float);
packed_size = 0; packed_size = 0;
if (type->class == HLSL_CLASS_STRUCT || hlsl_is_numeric_type(type)) if (is_numeric_fx_4_type(type))
packed_size = hlsl_type_component_count(type) * sizeof(float); packed_size = hlsl_type_component_count(type) * sizeof(float);
if (elements_count) if (elements_count)
{ {
@ -2401,6 +2407,9 @@ static void write_fx_4_buffer(struct hlsl_buffer *b, struct fx_write_context *fx
size = 0; size = 0;
LIST_FOR_EACH_ENTRY(var, &ctx->extern_vars, struct hlsl_ir_var, extern_entry) LIST_FOR_EACH_ENTRY(var, &ctx->extern_vars, struct hlsl_ir_var, extern_entry)
{ {
if (!is_numeric_fx_4_type(var->data_type))
continue;
if (var->buffer != b) if (var->buffer != b)
continue; continue;