Signed-off-by: Francisco Casas fcasas@codeweavers.com
---
This in order to make this function accessible from the new hlsl_constant_ops.c file in the following patches.
I also needed to call it from hlsl.y to implement the implicit conversion of overloaded function parameters, which I will probably send in the future.
Signed-off-by: Francisco Casas fcasas@codeweavers.com --- libs/vkd3d-shader/hlsl.c | 14 ++++++++++++++ libs/vkd3d-shader/hlsl.h | 2 ++ libs/vkd3d-shader/hlsl_codegen.c | 13 ------------- 3 files changed, 16 insertions(+), 13 deletions(-)
diff --git a/libs/vkd3d-shader/hlsl.c b/libs/vkd3d-shader/hlsl.c index d2ea4c34..3fb84b28 100644 --- a/libs/vkd3d-shader/hlsl.c +++ b/libs/vkd3d-shader/hlsl.c @@ -1384,6 +1384,20 @@ void hlsl_dump_function(struct hlsl_ctx *ctx, const struct hlsl_ir_function_decl vkd3d_string_buffer_cleanup(&buffer); }
+void replace_node(struct hlsl_ir_node *old, struct hlsl_ir_node *new) +{ + struct hlsl_src *src, *next; + + LIST_FOR_EACH_ENTRY_SAFE(src, next, &old->uses, struct hlsl_src, entry) + { + hlsl_src_remove(src); + hlsl_src_from_node(src, new); + } + list_remove(&old->entry); + hlsl_free_instr(old); +} + + void hlsl_free_type(struct hlsl_type *type) { struct hlsl_struct_field *field, *next_field; diff --git a/libs/vkd3d-shader/hlsl.h b/libs/vkd3d-shader/hlsl.h index 57acf3a0..393b3f1f 100644 --- a/libs/vkd3d-shader/hlsl.h +++ b/libs/vkd3d-shader/hlsl.h @@ -680,6 +680,8 @@ void hlsl_dump_function(struct hlsl_ctx *ctx, const struct hlsl_ir_function_decl
int hlsl_emit_dxbc(struct hlsl_ctx *ctx, struct hlsl_ir_function_decl *entry_func, struct vkd3d_shader_code *out);
+void replace_node(struct hlsl_ir_node *old, struct hlsl_ir_node *new); + void hlsl_free_instr(struct hlsl_ir_node *node); void hlsl_free_instr_list(struct list *list); void hlsl_free_type(struct hlsl_type *type); diff --git a/libs/vkd3d-shader/hlsl_codegen.c b/libs/vkd3d-shader/hlsl_codegen.c index 75716bdf..00f3dae3 100644 --- a/libs/vkd3d-shader/hlsl_codegen.c +++ b/libs/vkd3d-shader/hlsl_codegen.c @@ -224,19 +224,6 @@ static bool transform_ir(struct hlsl_ctx *ctx, bool (*func)(struct hlsl_ctx *ctx return progress; }
-static void replace_node(struct hlsl_ir_node *old, struct hlsl_ir_node *new) -{ - struct hlsl_src *src, *next; - - LIST_FOR_EACH_ENTRY_SAFE(src, next, &old->uses, struct hlsl_src, entry) - { - hlsl_src_remove(src); - hlsl_src_from_node(src, new); - } - list_remove(&old->entry); - hlsl_free_instr(old); -} - /* Lower casts from vec1 to vecN to swizzles. */ static bool lower_broadcasts(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, void *context) {