vkd3d-shader/hlsl: Parse texture types.

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Giovanni Mascellani <gmascellani@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura
2021-10-07 21:58:53 -05:00
committed by Alexandre Julliard
parent 64bd7f677c
commit fcb03a9947
3 changed files with 40 additions and 2 deletions

View File

@@ -261,6 +261,21 @@ struct hlsl_type *hlsl_new_struct_type(struct hlsl_ctx *ctx, const char *name, s
return type;
}
struct hlsl_type *hlsl_new_texture_type(struct hlsl_ctx *ctx, enum hlsl_sampler_dim dim)
{
struct hlsl_type *type;
if (!(type = vkd3d_calloc(1, sizeof(*type))))
return NULL;
type->type = HLSL_CLASS_OBJECT;
type->base_type = HLSL_TYPE_TEXTURE;
type->dimx = 4;
type->dimy = 1;
type->sampler_dim = dim;
list_add_tail(&ctx->types, &type->entry);
return type;
}
struct hlsl_type *hlsl_get_type(struct hlsl_scope *scope, const char *name, bool recursive)
{
struct rb_entry *entry = rb_get(&scope->types, name);
@@ -329,7 +344,8 @@ bool hlsl_types_are_equal(const struct hlsl_type *t1, const struct hlsl_type *t2
return false;
if (t1->base_type != t2->base_type)
return false;
if (t1->base_type == HLSL_TYPE_SAMPLER && t1->sampler_dim != t2->sampler_dim)
if ((t1->base_type == HLSL_TYPE_SAMPLER || t1->base_type == HLSL_TYPE_TEXTURE)
&& t1->sampler_dim != t2->sampler_dim)
return false;
if ((t1->modifiers & HLSL_MODIFIER_ROW_MAJOR)
!= (t2->modifiers & HLSL_MODIFIER_ROW_MAJOR))
@@ -734,7 +750,8 @@ static int compare_param_hlsl_types(const struct hlsl_type *t1, const struct hls
}
if (t1->base_type != t2->base_type)
return t1->base_type - t2->base_type;
if (t1->base_type == HLSL_TYPE_SAMPLER && t1->sampler_dim != t2->sampler_dim)
if ((t1->base_type == HLSL_TYPE_SAMPLER || t1->base_type == HLSL_TYPE_TEXTURE)
&& t1->sampler_dim != t2->sampler_dim)
return t1->sampler_dim - t2->sampler_dim;
if (t1->dimx != t2->dimx)
return t1->dimx - t2->dimx;