vkd3d-shader/hlsl: Support vector indexing.

Signed-off-by: Giovanni Mascellani <gmascellani@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Francisco Casas <fcasas@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Giovanni Mascellani 2022-04-18 08:34:01 +02:00 committed by Alexandre Julliard
parent aaa743033a
commit d1fac2660c
2 changed files with 12 additions and 6 deletions

View File

@ -592,11 +592,19 @@ static bool add_array_load(struct hlsl_ctx *ctx, struct list *instrs, struct hls
if (expr_type->type == HLSL_CLASS_ARRAY)
{
data_type = expr_type->e.array.type;
if (!(c = hlsl_new_uint_constant(ctx, hlsl_type_get_array_element_reg_size(data_type), &loc)))
return false;
}
else if (expr_type->type == HLSL_CLASS_MATRIX || expr_type->type == HLSL_CLASS_VECTOR)
else if (expr_type->type == HLSL_CLASS_MATRIX)
{
/* This needs to be lowered now, while we still have type information. */
FIXME("Index of matrix or vector type.\n");
FIXME("Index of matrix type.\n");
return false;
}
else if (expr_type->type == HLSL_CLASS_VECTOR)
{
data_type = hlsl_get_scalar_type(ctx, expr_type->base_type);
if (!(c = hlsl_new_uint_constant(ctx, 1, &loc)))
return false;
}
else
@ -608,8 +616,6 @@ static bool add_array_load(struct hlsl_ctx *ctx, struct list *instrs, struct hls
return false;
}
if (!(c = hlsl_new_uint_constant(ctx, hlsl_type_get_array_element_reg_size(data_type), &loc)))
return false;
list_add_tail(instrs, &c->node.entry);
if (!(mul = hlsl_new_binary_expr(ctx, HLSL_OP2_MUL, index, &c->node)))
return false;

View File

@ -10,7 +10,7 @@ float4 main() : SV_TARGET
}
[test]
todo draw quad
draw quad
probe all rgba (0.02, 0.245, 0.351, 1.0)
[pixel shader]
@ -23,5 +23,5 @@ float4 main() : SV_TARGET
[test]
uniform 0 float4 1.0 2.0 3.0 4.0
todo draw quad
draw quad
probe all rgba (1.0, 2.0, 2.0, 3.0)