vkd3d-shader/hlsl: Support column-major matrix indexing in the lhs.

This commit is contained in:
Francisco Casas 2023-03-10 17:23:49 -03:00 committed by Alexandre Julliard
parent dc2a34824d
commit af1aa63ace
Notes: Alexandre Julliard 2023-04-13 23:20:40 +02:00
Approved-by: Zebediah Figura (@zfigura)
Approved-by: Francisco Casas (@fcasas)
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Henri Verbeet (@hverbeet)
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/124
2 changed files with 40 additions and 5 deletions

View File

@ -1769,8 +1769,43 @@ static struct hlsl_ir_node *add_assignment(struct hlsl_ctx *ctx, struct list *in
}
else if (lhs->type == HLSL_IR_INDEX && hlsl_index_is_noncontiguous(hlsl_ir_index(lhs)))
{
hlsl_fixme(ctx, &lhs->loc, "Column-major matrix index store.");
return NULL;
struct hlsl_ir_index *row = hlsl_ir_index(lhs);
struct hlsl_ir_node *mat = row->val.node;
unsigned int i, k = 0;
for (i = 0; i < mat->data_type->dimx; ++i)
{
struct hlsl_ir_store *store;
struct hlsl_ir_constant *c;
struct hlsl_ir_node *cell;
struct hlsl_ir_load *load;
struct hlsl_deref deref;
if (!(writemask & (1 << i)))
continue;
if (!(c = hlsl_new_uint_constant(ctx, i, &lhs->loc)))
return NULL;
list_add_tail(instrs, &c->node.entry);
if (!(cell = hlsl_new_index(ctx, &row->node, &c->node, &lhs->loc)))
return NULL;
list_add_tail(instrs, &cell->entry);
if (!(load = add_load_component(ctx, instrs, rhs, k++, &rhs->loc)))
return NULL;
if (!hlsl_init_deref_from_index_chain(ctx, &deref, cell))
return NULL;
if (!(store = hlsl_new_store_index(ctx, &deref, NULL, &load->node, 0, &rhs->loc)))
{
hlsl_cleanup_deref(&deref);
return NULL;
}
list_add_tail(instrs, &store->node.entry);
hlsl_cleanup_deref(&deref);
}
}
else
{

View File

@ -78,7 +78,7 @@ draw quad
probe all rgba (1.0, 5.0, 7.0, 12.0)
[pixel shader todo]
[pixel shader]
float4 main() : SV_TARGET
{
float3x2 m = {1, 2, 3, 4, 5, 6};
@ -89,8 +89,8 @@ float4 main() : SV_TARGET
}
[test]
todo draw quad
todo probe all rgba (30.0, 40.0, 5.0, 6.0)
draw quad
probe all rgba (30.0, 40.0, 5.0, 6.0)
[pixel shader]