mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-01-28 13:05:02 -08:00
vkd3d-shader/hlsl: Cache matrix types.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Giovanni Mascellani <gmascellani@codeweavers.com> Signed-off-by: Matteo Bruni <mbruni@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
b8502ed51c
commit
ec8d8e6f73
@ -200,7 +200,7 @@ static void hlsl_type_calculate_reg_size(struct hlsl_ctx *ctx, struct hlsl_type
|
||||
}
|
||||
}
|
||||
|
||||
struct hlsl_type *hlsl_new_type(struct hlsl_ctx *ctx, const char *name, enum hlsl_type_class type_class,
|
||||
static struct hlsl_type *hlsl_new_type(struct hlsl_ctx *ctx, const char *name, enum hlsl_type_class type_class,
|
||||
enum hlsl_base_type base_type, unsigned dimx, unsigned dimy)
|
||||
{
|
||||
struct hlsl_type *type;
|
||||
@ -1658,6 +1658,7 @@ static void declare_predefined_types(struct hlsl_ctx *ctx)
|
||||
sprintf(name, "%s%ux%u", names[bt], y, x);
|
||||
type = hlsl_new_type(ctx, hlsl_strdup(ctx, name), HLSL_CLASS_MATRIX, bt, x, y);
|
||||
hlsl_scope_add_type(ctx->globals, type);
|
||||
ctx->builtin_types.matrix[bt][x - 1][y - 1] = type;
|
||||
|
||||
if (y == 1)
|
||||
{
|
||||
|
@ -459,6 +459,8 @@ struct hlsl_ctx
|
||||
{
|
||||
struct hlsl_type *scalar[HLSL_TYPE_LAST_SCALAR + 1];
|
||||
struct hlsl_type *vector[HLSL_TYPE_LAST_SCALAR + 1][4];
|
||||
/* matrix[float][2][4] is a float4x2, i.e. dimx = 2, dimy = 4 */
|
||||
struct hlsl_type *matrix[HLSL_TYPE_LAST_SCALAR + 1][4][4];
|
||||
struct hlsl_type *sampler[HLSL_SAMPLER_DIM_MAX + 1];
|
||||
struct hlsl_type *Void;
|
||||
} builtin_types;
|
||||
@ -653,8 +655,6 @@ struct hlsl_ir_swizzle *hlsl_new_swizzle(struct hlsl_ctx *ctx, DWORD s, unsigned
|
||||
struct hlsl_ir_node *val, struct vkd3d_shader_location *loc);
|
||||
struct hlsl_ir_var *hlsl_new_synthetic_var(struct hlsl_ctx *ctx, const char *name, struct hlsl_type *type,
|
||||
const struct vkd3d_shader_location loc);
|
||||
struct hlsl_type *hlsl_new_type(struct hlsl_ctx *ctx, const char *name, enum hlsl_type_class type_class,
|
||||
enum hlsl_base_type base_type, unsigned dimx, unsigned dimy);
|
||||
struct hlsl_ir_constant *hlsl_new_uint_constant(struct hlsl_ctx *ctx, unsigned int n,
|
||||
const struct vkd3d_shader_location loc);
|
||||
struct hlsl_ir_node *hlsl_new_unary_expr(struct hlsl_ctx *ctx, enum hlsl_ir_expr_op op, struct hlsl_ir_node *arg,
|
||||
|
@ -1019,7 +1019,7 @@ static struct hlsl_type *expr_common_type(struct hlsl_ctx *ctx, struct hlsl_type
|
||||
return ctx->builtin_types.scalar[base];
|
||||
if (type == HLSL_CLASS_VECTOR)
|
||||
return ctx->builtin_types.vector[base][dimx - 1];
|
||||
return hlsl_new_type(ctx, NULL, type, base, dimx, dimy);
|
||||
return ctx->builtin_types.matrix[base][dimx - 1][dimy - 1];
|
||||
}
|
||||
|
||||
static struct hlsl_ir_expr *add_expr(struct hlsl_ctx *ctx, struct list *instrs, enum hlsl_ir_expr_op op,
|
||||
@ -2425,7 +2425,7 @@ type:
|
||||
YYABORT;
|
||||
}
|
||||
|
||||
$$ = hlsl_new_type(ctx, NULL, HLSL_CLASS_MATRIX, $3->base_type, $7, $5);
|
||||
$$ = ctx->builtin_types.matrix[$3->base_type][$7 - 1][$5 - 1];
|
||||
}
|
||||
| KW_VOID
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user