mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-09-12 18:50:22 -07:00
vkd3d-shader/fx: Handle nameless structure types.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
This commit is contained in:
committed by
Henri Verbeet
parent
a4e43402e5
commit
11d4fcff46
Notes:
Henri Verbeet
2025-05-24 21:48:21 +02:00
Approved-by: Henri Verbeet (@hverbeet) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1510
@@ -369,18 +369,23 @@ static uint32_t write_type(const struct hlsl_type *type, struct fx_write_context
|
|||||||
name = get_fx_4_type_name(element_type);
|
name = get_fx_4_type_name(element_type);
|
||||||
modifiers = element_type->modifiers & HLSL_MODIFIERS_MAJORITY_MASK;
|
modifiers = element_type->modifiers & HLSL_MODIFIERS_MAJORITY_MASK;
|
||||||
|
|
||||||
LIST_FOR_EACH_ENTRY(type_entry, &fx->types, struct type_entry, entry)
|
/* We don't try to reuse nameless types; they will get the same
|
||||||
|
* "<unnamed>" name, but are not available for the type cache. */
|
||||||
|
if (name)
|
||||||
{
|
{
|
||||||
if (strcmp(type_entry->name, name))
|
LIST_FOR_EACH_ENTRY(type_entry, &fx->types, struct type_entry, entry)
|
||||||
continue;
|
{
|
||||||
|
if (strcmp(type_entry->name, name))
|
||||||
|
continue;
|
||||||
|
|
||||||
if (type_entry->elements_count != elements_count)
|
if (type_entry->elements_count != elements_count)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (type_entry->modifiers != modifiers)
|
if (type_entry->modifiers != modifiers)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
return type_entry->offset;
|
return type_entry->offset;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(type_entry = hlsl_alloc(fx->ctx, sizeof(*type_entry))))
|
if (!(type_entry = hlsl_alloc(fx->ctx, sizeof(*type_entry))))
|
||||||
@@ -391,7 +396,8 @@ static uint32_t write_type(const struct hlsl_type *type, struct fx_write_context
|
|||||||
type_entry->elements_count = elements_count;
|
type_entry->elements_count = elements_count;
|
||||||
type_entry->modifiers = modifiers;
|
type_entry->modifiers = modifiers;
|
||||||
|
|
||||||
list_add_tail(&fx->types, &type_entry->entry);
|
if (name)
|
||||||
|
list_add_tail(&fx->types, &type_entry->entry);
|
||||||
|
|
||||||
return type_entry->offset;
|
return type_entry->offset;
|
||||||
}
|
}
|
||||||
@@ -1238,7 +1244,7 @@ static uint32_t write_fx_4_type(const struct hlsl_type *type, struct fx_write_co
|
|||||||
|
|
||||||
name = get_fx_4_type_name(element_type);
|
name = get_fx_4_type_name(element_type);
|
||||||
|
|
||||||
name_offset = write_string(name, fx);
|
name_offset = write_string(name ? name : "<unnamed>", fx);
|
||||||
if (element_type->class == HLSL_CLASS_STRUCT)
|
if (element_type->class == HLSL_CLASS_STRUCT)
|
||||||
{
|
{
|
||||||
if (!(field_offsets = hlsl_calloc(ctx, element_type->e.record.field_count, sizeof(*field_offsets))))
|
if (!(field_offsets = hlsl_calloc(ctx, element_type->e.record.field_count, sizeof(*field_offsets))))
|
||||||
|
@@ -56,6 +56,19 @@ BlendState bs
|
|||||||
BlendOpAlpha = add;
|
BlendOpAlpha = add;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
[effect]
|
||||||
|
cbuffer cb1
|
||||||
|
{
|
||||||
|
float a1;
|
||||||
|
};
|
||||||
|
cbuffer cb2
|
||||||
|
{
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
float a2;
|
||||||
|
} s1;
|
||||||
|
};
|
||||||
|
|
||||||
[effect fail]
|
[effect fail]
|
||||||
BlendState bs
|
BlendState bs
|
||||||
{
|
{
|
||||||
|
@@ -58,6 +58,19 @@ BlendState bs
|
|||||||
BlendOpAlpha[4] = add;
|
BlendOpAlpha[4] = add;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
[effect]
|
||||||
|
cbuffer cb1
|
||||||
|
{
|
||||||
|
float a1;
|
||||||
|
};
|
||||||
|
cbuffer cb2
|
||||||
|
{
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
float a2;
|
||||||
|
} s1;
|
||||||
|
};
|
||||||
|
|
||||||
[effect]
|
[effect]
|
||||||
BlendState bs
|
BlendState bs
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user