mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d-shader/hlsl: Support complex numeric initializers.
Signed-off-by: Francisco Casas <fcasas@codeweavers.com> 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:
parent
9c518b45d1
commit
aefadb87b6
@ -1447,6 +1447,39 @@ static bool add_increment(struct hlsl_ctx *ctx, struct list *instrs, bool decrem
|
||||
return true;
|
||||
}
|
||||
|
||||
static void initialize_numeric_var(struct hlsl_ctx *ctx, struct hlsl_ir_var *var,
|
||||
struct parse_initializer *initializer, unsigned int reg_offset, struct hlsl_type *type,
|
||||
unsigned int *initializer_offset)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
if (type->type == HLSL_CLASS_MATRIX)
|
||||
hlsl_fixme(ctx, &var->loc, "Matrix initializer.");
|
||||
|
||||
for (i = 0; i < type->dimx; i++)
|
||||
{
|
||||
struct hlsl_ir_store *store;
|
||||
struct hlsl_ir_constant *c;
|
||||
struct hlsl_ir_node *node;
|
||||
|
||||
node = initializer->args[*initializer_offset];
|
||||
*initializer_offset += 1;
|
||||
|
||||
if (!(node = add_implicit_conversion(ctx, initializer->instrs, node,
|
||||
hlsl_get_scalar_type(ctx, type->base_type), &node->loc)))
|
||||
return;
|
||||
|
||||
if (!(c = hlsl_new_uint_constant(ctx, reg_offset + i, &node->loc)))
|
||||
return;
|
||||
list_add_tail(initializer->instrs, &c->node.entry);
|
||||
|
||||
if (!(store = hlsl_new_store(ctx, var, &c->node, node, 0, node->loc)))
|
||||
return;
|
||||
|
||||
list_add_tail(initializer->instrs, &store->node.entry);
|
||||
}
|
||||
}
|
||||
|
||||
static void struct_var_initializer(struct hlsl_ctx *ctx, struct hlsl_ir_var *var,
|
||||
struct parse_initializer *initializer)
|
||||
{
|
||||
@ -1612,6 +1645,7 @@ static struct list *declare_vars(struct hlsl_ctx *ctx, struct hlsl_type *basic_t
|
||||
if (v->initializer.braces)
|
||||
{
|
||||
unsigned int size = initializer_size(&v->initializer);
|
||||
unsigned int initializer_offset = 0;
|
||||
|
||||
if (type->type <= HLSL_CLASS_LAST_NUMERIC && type->dimx * type->dimy != size)
|
||||
{
|
||||
@ -1647,10 +1681,15 @@ static struct list *declare_vars(struct hlsl_ctx *ctx, struct hlsl_type *basic_t
|
||||
}
|
||||
else
|
||||
{
|
||||
hlsl_fixme(ctx, &v->loc, "Complex initializer.");
|
||||
free_parse_initializer(&v->initializer);
|
||||
vkd3d_free(v);
|
||||
continue;
|
||||
if (v->initializer.args_count != size)
|
||||
{
|
||||
hlsl_fixme(ctx, &v->loc, "Flatten initializer.");
|
||||
free_parse_initializer(&v->initializer);
|
||||
vkd3d_free(v);
|
||||
continue;
|
||||
}
|
||||
|
||||
initialize_numeric_var(ctx, var, &v->initializer, 0, type, &initializer_offset);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -37,8 +37,8 @@ float4 main() : sv_target
|
||||
}
|
||||
|
||||
[test]
|
||||
todo draw quad
|
||||
probe all rgba (40, 10, 20, 30)
|
||||
draw quad
|
||||
todo probe all rgba (40, 10, 20, 30)
|
||||
|
||||
|
||||
[pixel shader]
|
||||
|
@ -6,7 +6,7 @@ float4 main() : sv_target
|
||||
}
|
||||
|
||||
[test]
|
||||
todo draw quad
|
||||
draw quad
|
||||
probe all rgba (1, 2, 3, 4)
|
||||
|
||||
|
||||
|
@ -6,7 +6,7 @@ float4 main() : sv_target
|
||||
}
|
||||
|
||||
[test]
|
||||
todo draw quad
|
||||
draw quad
|
||||
probe all rgba (1.0, 2.0, 3.0, 4.0) 4
|
||||
|
||||
|
||||
@ -18,7 +18,7 @@ float4 main() : sv_target
|
||||
}
|
||||
|
||||
[test]
|
||||
todo draw quad
|
||||
draw quad
|
||||
probe all rgba (1.0, 2.0, 3.0, 4.0) 4
|
||||
|
||||
|
||||
@ -31,7 +31,7 @@ float4 main() : sv_target
|
||||
}
|
||||
|
||||
[test]
|
||||
todo draw quad
|
||||
draw quad
|
||||
probe all rgba (1.0, 2.0, 3.0, 4.0) 4
|
||||
|
||||
|
||||
@ -44,5 +44,5 @@ float4 main() : sv_target
|
||||
}
|
||||
|
||||
[test]
|
||||
todo draw quad
|
||||
draw quad
|
||||
probe all rgba (10.1, 1.1, 1.2, 2.1) 4
|
||||
|
Loading…
Reference in New Issue
Block a user