Skip to content
Snippets Groups Projects
Commit 18baf467 authored by Francisco Casas's avatar Francisco Casas
Browse files

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

parent d0e02873
No related branches found
Tags wine-0.9.54
No related merge requests found
......@@ -1719,8 +1719,42 @@ static struct hlsl_ir_node *add_assignment(struct hlsl_ctx *ctx, struct list *in
}
else if (lhs->type == HLSL_IR_INDEX && hlsl_index_is_crooked_matrix_indexing(hlsl_ir_index(lhs)))
{
hlsl_fixme(ctx, &lhs->loc, "Column-major matrix index store.");
return NULL;
struct hlsl_ir_node *mat = hlsl_ir_index(lhs)->val.node, *idx = hlsl_ir_index(lhs)->idx.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_load *load;
struct hlsl_ir_index *col;
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 (!(col = hlsl_new_index(ctx, mat, &c->node, true, &lhs->loc)))
return NULL;
list_add_tail(instrs, &col->node.entry);
if (!(load = add_load_component(ctx, instrs, rhs, k++, &rhs->loc)))
return NULL;
if (!hlsl_init_deref_from_index_chain(ctx, &deref, &col->node))
return NULL;
if (!(store = hlsl_new_store_index(ctx, &deref, idx, &load->node, 0, &rhs->loc)))
{
hlsl_cleanup_deref(&deref);
return NULL;
}
list_add_tail(instrs, &store->node.entry);
hlsl_cleanup_deref(&deref);
}
}
else
{
......
......@@ -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]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment