vkd3d-shader/hlsl: Parse matrix constructors.

Signed-off-by: Giovanni Mascellani <gmascellani@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Giovanni Mascellani
2022-04-27 10:56:26 +02:00
committed by Alexandre Julliard
parent ff3ec5d4a5
commit cf7cf05cb7
4 changed files with 23 additions and 28 deletions

View File

@@ -2024,16 +2024,12 @@ static struct list *add_call(struct hlsl_ctx *ctx, const char *name,
static struct list *add_constructor(struct hlsl_ctx *ctx, struct hlsl_type *type,
struct parse_initializer *params, struct vkd3d_shader_location loc)
{
unsigned int i, writemask_offset = 0;
struct hlsl_ir_store *store;
static unsigned int counter;
struct hlsl_ir_load *load;
struct hlsl_ir_var *var;
unsigned int i, idx = 0;
char name[23];
if (type->type == HLSL_CLASS_MATRIX)
hlsl_fixme(ctx, &loc, "Matrix constructor.");
sprintf(name, "<constructor-%x>", counter++);
if (!(var = hlsl_new_synthetic_var(ctx, name, type, loc)))
return NULL;
@@ -2041,7 +2037,6 @@ static struct list *add_constructor(struct hlsl_ctx *ctx, struct hlsl_type *type
for (i = 0; i < params->args_count; ++i)
{
struct hlsl_ir_node *arg = params->args[i];
unsigned int width;
if (arg->data_type->type == HLSL_CLASS_OBJECT)
{
@@ -2053,24 +2048,8 @@ static struct list *add_constructor(struct hlsl_ctx *ctx, struct hlsl_type *type
hlsl_release_string_buffer(ctx, string);
continue;
}
width = hlsl_type_component_count(arg->data_type);
if (width > 4)
{
FIXME("Constructor argument with %u components.\n", width);
continue;
}
if (!(arg = add_implicit_conversion(ctx, params->instrs, arg,
hlsl_get_vector_type(ctx, type->base_type, width), &arg->loc)))
continue;
if (!(store = hlsl_new_store(ctx, var, NULL, arg,
((1u << width) - 1) << writemask_offset, arg->loc)))
return NULL;
list_add_tail(params->instrs, &store->node.entry);
writemask_offset += width;
initialize_var_components(ctx, params->instrs, var, &idx, arg, &loc);
}
if (!(load = hlsl_new_var_load(ctx, var, loc)))