On Wed, Jul 20, 2022 at 3:24 PM Francisco Casas fcasas@codeweavers.com wrote:
Signed-off-by: Francisco Casas fcasas@codeweavers.com
v3:
- No changes.
The recursive structure of prepend_input_var_copy() and append_output_var_copy() could be preserved creating additional loads to complete the paths. Otherwise we would be requiring passing whole paths as arguments.
These additional loads should be handled by DCE.
Still, matrix vectors are copied iteratively instead of recursively now, to avoid the boilerplate of creating new loads in this last step.
Signed-off-by: Francisco Casas fcasas@codeweavers.com
libs/vkd3d-shader/hlsl_codegen.c | 188 +++++++++++++++++++------------ 1 file changed, 116 insertions(+), 72 deletions(-)
diff --git a/libs/vkd3d-shader/hlsl_codegen.c b/libs/vkd3d-shader/hlsl_codegen.c index 6437006b..7a245007 100644 --- a/libs/vkd3d-shader/hlsl_codegen.c +++ b/libs/vkd3d-shader/hlsl_codegen.c @@ -239,59 +239,75 @@ static struct hlsl_ir_var *add_semantic_var(struct hlsl_ctx *ctx, struct hlsl_ir return ext_var; }
-static void prepend_input_copy(struct hlsl_ctx *ctx, struct list *instrs, struct hlsl_ir_var *var,
struct hlsl_type *type, unsigned int field_offset, unsigned int modifiers, const struct hlsl_semantic *semantic)
+static void prepend_input_copy(struct hlsl_ctx *ctx, struct list *instrs, struct hlsl_ir_load *lhs,
struct hlsl_type *type, unsigned int modifiers, const struct hlsl_semantic *semantic)
I haven't put a lot of thought into this, but it seems to me we could pass a deref instead of a redundant load and be mostly set. Mostly because we then need to add the instructions to the instruction list in some other way (e.g. by passing an explicit list).