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
|
||||||
{
|
{
|
||||||
struct hlsl_type *scalar[HLSL_TYPE_LAST_SCALAR + 1];
|
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 *sampler[HLSL_SAMPLER_DIM_MAX + 1];
|
||||||
struct hlsl_type *Void;
|
struct hlsl_type *Void;
|
||||||
} builtin_types;
|
} builtin_types;
|
||||||
|
|
|
@ -237,6 +237,7 @@ static void declare_predefined_types(struct hlsl_scope *scope)
|
||||||
sprintf(name, "%s%u", names[bt], x);
|
sprintf(name, "%s%u", names[bt], x);
|
||||||
type = new_hlsl_type(d3dcompiler_strdup(name), HLSL_CLASS_VECTOR, bt, x, y);
|
type = new_hlsl_type(d3dcompiler_strdup(name), HLSL_CLASS_VECTOR, bt, x, y);
|
||||||
add_type_to_scope(scope, type);
|
add_type_to_scope(scope, type);
|
||||||
|
hlsl_ctx.builtin_types.vector[bt][x - 1] = type;
|
||||||
|
|
||||||
if (x == 1)
|
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)
|
if (type == HLSL_CLASS_SCALAR)
|
||||||
return hlsl_ctx.builtin_types.scalar[base];
|
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);
|
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);
|
assert(swizzle_type->type == HLSL_CLASS_VECTOR);
|
||||||
if (swizzle_type->dimx != width)
|
if (swizzle_type->dimx != width)
|
||||||
{
|
swizzle->node.data_type = hlsl_ctx.builtin_types.vector[swizzle_type->base_type][width - 1];
|
||||||
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;
|
|
||||||
}
|
|
||||||
rhs = &swizzle->node;
|
rhs = &swizzle->node;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue