d3dcompiler: Cache vector types.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com> Signed-off-by: Matteo Bruni <mbruni@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
9c985e703b
commit
10601d9ac5
|
@ -988,6 +988,7 @@ struct hlsl_parse_ctx
|
|||
struct
|
||||
{
|
||||
struct hlsl_type *scalar[HLSL_TYPE_LAST_SCALAR + 1];
|
||||
struct hlsl_type *vector[HLSL_TYPE_LAST_SCALAR + 1][4];
|
||||
struct hlsl_type *sampler[HLSL_SAMPLER_DIM_MAX + 1];
|
||||
struct hlsl_type *Void;
|
||||
} builtin_types;
|
||||
|
|
|
@ -237,6 +237,7 @@ static void declare_predefined_types(struct hlsl_scope *scope)
|
|||
sprintf(name, "%s%u", names[bt], x);
|
||||
type = new_hlsl_type(d3dcompiler_strdup(name), HLSL_CLASS_VECTOR, bt, x, y);
|
||||
add_type_to_scope(scope, type);
|
||||
hlsl_ctx.builtin_types.vector[bt][x - 1] = type;
|
||||
|
||||
if (x == 1)
|
||||
{
|
||||
|
|
|
@ -1296,6 +1296,8 @@ static struct hlsl_type *expr_common_type(struct hlsl_type *t1, struct hlsl_type
|
|||
|
||||
if (type == HLSL_CLASS_SCALAR)
|
||||
return hlsl_ctx.builtin_types.scalar[base];
|
||||
if (type == HLSL_CLASS_VECTOR)
|
||||
return hlsl_ctx.builtin_types.vector[base][dimx - 1];
|
||||
return new_hlsl_type(NULL, type, base, dimx, dimy);
|
||||
}
|
||||
|
||||
|
@ -1495,15 +1497,7 @@ struct hlsl_ir_node *make_assignment(struct hlsl_ir_node *lhs, enum parse_assign
|
|||
}
|
||||
assert(swizzle_type->type == HLSL_CLASS_VECTOR);
|
||||
if (swizzle_type->dimx != width)
|
||||
{
|
||||
struct hlsl_type *type;
|
||||
if (!(type = new_hlsl_type(NULL, HLSL_CLASS_VECTOR, swizzle_type->base_type, width, 1)))
|
||||
{
|
||||
d3dcompiler_free(assign);
|
||||
return NULL;
|
||||
}
|
||||
swizzle->node.data_type = type;
|
||||
}
|
||||
swizzle->node.data_type = hlsl_ctx.builtin_types.vector[swizzle_type->base_type][width - 1];
|
||||
rhs = &swizzle->node;
|
||||
}
|
||||
else
|
||||
|
|
Loading…
Reference in New Issue