vkd3d-shader/hlsl: Introduce hlsl_type.e.resource.

This commit is contained in:
Henri Verbeet
2024-02-19 13:57:54 +01:00
committed by Alexandre Julliard
parent d9c68ee481
commit 49d14613a5
Notes: Alexandre Julliard 2024-02-21 23:33:25 +01:00
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Henri Verbeet (@hverbeet)
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/659
5 changed files with 27 additions and 23 deletions

View File

@@ -751,7 +751,7 @@ struct hlsl_type *hlsl_new_texture_type(struct hlsl_ctx *ctx, enum hlsl_sampler_
type->dimx = 4;
type->dimy = 1;
type->sampler_dim = dim;
type->e.resource_format = format;
type->e.resource.format = format;
type->sample_count = sample_count;
hlsl_type_calculate_reg_size(ctx, type);
list_add_tail(&ctx->types, &type->entry);
@@ -771,7 +771,7 @@ struct hlsl_type *hlsl_new_uav_type(struct hlsl_ctx *ctx,
type->dimy = 1;
type->sampler_dim = dim;
type->modifiers = modifiers;
type->e.resource_format = format;
type->e.resource.format = format;
hlsl_type_calculate_reg_size(ctx, type);
list_add_tail(&ctx->types, &type->entry);
return type;
@@ -888,7 +888,7 @@ bool hlsl_types_are_equal(const struct hlsl_type *t1, const struct hlsl_type *t2
if (t1->sampler_dim != t2->sampler_dim)
return false;
if (t1->base_type == HLSL_TYPE_TEXTURE && t1->sampler_dim != HLSL_SAMPLER_DIM_GENERIC
&& !hlsl_types_are_equal(t1->e.resource_format, t2->e.resource_format))
&& !hlsl_types_are_equal(t1->e.resource.format, t2->e.resource.format))
return false;
}
if ((t1->modifiers & HLSL_MODIFIER_ROW_MAJOR)
@@ -1009,7 +1009,7 @@ struct hlsl_type *hlsl_type_clone(struct hlsl_ctx *ctx, struct hlsl_type *old,
if (type->base_type == HLSL_TYPE_TECHNIQUE)
type->e.version = old->e.version;
if (old->base_type == HLSL_TYPE_TEXTURE || old->base_type == HLSL_TYPE_UAV)
type->e.resource_format = old->e.resource_format;
type->e.resource.format = old->e.resource.format;
break;
default:
@@ -1573,7 +1573,7 @@ struct hlsl_ir_node *hlsl_new_index(struct hlsl_ctx *ctx, struct hlsl_ir_node *v
return NULL;
if (type->class == HLSL_CLASS_OBJECT)
type = type->e.resource_format;
type = type->e.resource.format;
else if (type->class == HLSL_CLASS_MATRIX)
type = hlsl_get_vector_type(ctx, type->base_type, type->dimx);
else
@@ -2201,7 +2201,7 @@ struct vkd3d_string_buffer *hlsl_type_to_string(struct hlsl_ctx *ctx, const stru
return string;
}
assert(type->e.resource_format->base_type < ARRAY_SIZE(base_types));
assert(type->e.resource.format->base_type < ARRAY_SIZE(base_types));
if (type->sampler_dim == HLSL_SAMPLER_DIM_BUFFER)
{
vkd3d_string_buffer_printf(string, "Buffer");
@@ -2211,7 +2211,7 @@ struct vkd3d_string_buffer *hlsl_type_to_string(struct hlsl_ctx *ctx, const stru
assert(type->sampler_dim < ARRAY_SIZE(dimensions));
vkd3d_string_buffer_printf(string, "Texture%s", dimensions[type->sampler_dim]);
}
if ((inner_string = hlsl_type_to_string(ctx, type->e.resource_format)))
if ((inner_string = hlsl_type_to_string(ctx, type->e.resource.format)))
{
vkd3d_string_buffer_printf(string, "<%s>", inner_string->buffer);
hlsl_release_string_buffer(ctx, inner_string);
@@ -2225,7 +2225,7 @@ struct vkd3d_string_buffer *hlsl_type_to_string(struct hlsl_ctx *ctx, const stru
vkd3d_string_buffer_printf(string, "RWStructuredBuffer");
else
vkd3d_string_buffer_printf(string, "RWTexture%s", dimensions[type->sampler_dim]);
if ((inner_string = hlsl_type_to_string(ctx, type->e.resource_format)))
if ((inner_string = hlsl_type_to_string(ctx, type->e.resource.format)))
{
vkd3d_string_buffer_printf(string, "<%s>", inner_string->buffer);
hlsl_release_string_buffer(ctx, inner_string);