vkd3d-shader/hlsl: Add some swizzle manipulation definitions.

This commit is contained in:
Zebediah Figura
2023-01-12 15:52:49 -06:00
committed by Alexandre Julliard
parent 337b4c5db0
commit 8fd30aa87d
Notes: Alexandre Julliard 2023-01-24 22:27:58 +01:00
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Zebediah Figura (@zfigura)
Approved-by: Henri Verbeet (@hverbeet)
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/51
4 changed files with 15 additions and 11 deletions

View File

@@ -752,7 +752,7 @@ static struct hlsl_ir_node *copy_propagation_compute_replacement(struct hlsl_ctx
TRACE("No single source for propagating load from %s[%u-%u].\n", var->name, start, start + count);
return NULL;
}
*swizzle |= value->component << i * 2;
*swizzle |= value->component << HLSL_SWIZZLE_SHIFT(i);
}
TRACE("Load from %s[%u-%u] propagated as instruction %p%s.\n",
@@ -1316,7 +1316,7 @@ static bool remove_trivial_swizzles(struct hlsl_ctx *ctx, struct hlsl_ir_node *i
return false;
for (i = 0; i < instr->data_type->dimx; ++i)
if (((swizzle->swizzle >> (2 * i)) & 3) != i)
if (hlsl_swizzle_get_component(swizzle->swizzle, i) != i)
return false;
hlsl_replace_node(instr, swizzle->val.node);