vkd3d-shader/hlsl: Move sampler_dim_count() to hlsl.h.

Signed-off-by: Francisco Casas <fcasas@codeweavers.com>
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:
Francisco Casas 2022-01-27 15:31:22 -03:00 committed by Alexandre Julliard
parent f5f9cddda2
commit ce2454db6d
2 changed files with 20 additions and 20 deletions

View File

@ -668,6 +668,23 @@ static inline struct hlsl_type *hlsl_get_numeric_type(const struct hlsl_ctx *ctx
return hlsl_get_matrix_type(ctx, base_type, dimx, dimy);
}
static inline unsigned int hlsl_sampler_dim_count(enum hlsl_sampler_dim dim)
{
switch (dim)
{
case HLSL_SAMPLER_DIM_1D:
return 1;
case HLSL_SAMPLER_DIM_2D:
return 2;
case HLSL_SAMPLER_DIM_3D:
case HLSL_SAMPLER_DIM_CUBE:
return 3;
default:
assert(0);
return 0;
}
}
const char *debug_hlsl_expr_op(enum hlsl_ir_expr_op op);
const char *debug_hlsl_type(struct hlsl_ctx *ctx, const struct hlsl_type *type);
const char *debug_hlsl_writemask(unsigned int writemask);

View File

@ -1513,23 +1513,6 @@ static struct list *declare_vars(struct hlsl_ctx *ctx, struct hlsl_type *basic_t
return statements_list;
}
static unsigned int sampler_dim_count(enum hlsl_sampler_dim dim)
{
switch (dim)
{
case HLSL_SAMPLER_DIM_1D:
return 1;
case HLSL_SAMPLER_DIM_2D:
return 2;
case HLSL_SAMPLER_DIM_3D:
case HLSL_SAMPLER_DIM_CUBE:
return 3;
default:
assert(0);
return 0;
}
}
struct find_function_call_args
{
const struct parse_initializer *params;
@ -1890,7 +1873,7 @@ static bool add_method_call(struct hlsl_ctx *ctx, struct list *instrs, struct hl
if (!strcmp(name, "Load"))
{
const unsigned int sampler_dim = sampler_dim_count(object_type->sampler_dim);
const unsigned int sampler_dim = hlsl_sampler_dim_count(object_type->sampler_dim);
struct hlsl_ir_resource_load *load;
struct hlsl_ir_node *coords;
@ -1916,7 +1899,7 @@ static bool add_method_call(struct hlsl_ctx *ctx, struct list *instrs, struct hl
}
else if (!strcmp(name, "Sample"))
{
const unsigned int sampler_dim = sampler_dim_count(object_type->sampler_dim);
const unsigned int sampler_dim = hlsl_sampler_dim_count(object_type->sampler_dim);
const struct hlsl_type *sampler_type;
struct hlsl_ir_resource_load *load;
struct hlsl_ir_node *offset = NULL;
@ -1967,7 +1950,7 @@ static bool add_method_call(struct hlsl_ctx *ctx, struct list *instrs, struct hl
else if (!strcmp(name, "Gather") || !strcmp(name, "GatherRed") || !strcmp(name, "GatherBlue")
|| !strcmp(name, "GatherGreen") || !strcmp(name, "GatherAlpha"))
{
const unsigned int sampler_dim = sampler_dim_count(object_type->sampler_dim);
const unsigned int sampler_dim = hlsl_sampler_dim_count(object_type->sampler_dim);
enum hlsl_resource_load_type load_type;
const struct hlsl_type *sampler_type;
struct hlsl_ir_resource_load *load;