Updated vkd3d-latest patchset

This commit is contained in:
Alistair Leslie-Hughes 2024-05-16 11:58:46 +10:00
parent a2170c577b
commit 05c875caa5
8 changed files with 1096 additions and 6 deletions

View File

@ -1,4 +1,4 @@
From fe4f6075b7b5ec6e9bb86bd41c8f62e547d78e9e Mon Sep 17 00:00:00 2001
From ba798c39689ed7d2f3952a250825f0c3a0b4cf88 Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Thu, 7 Mar 2024 10:40:41 +1100
Subject: [PATCH] Updated vkd3d to 4a209efb6278586d412ceb0a7cbe21e6769a7367.

View File

@ -1,4 +1,4 @@
From ea3477f55df517065cc716c27e2df7ea68f6760e Mon Sep 17 00:00:00 2001
From 7365c2f891b2cdfa4b9610b143bdccafd80851ec Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Tue, 23 Apr 2024 08:01:19 +1000
Subject: [PATCH] Updated vkd3d to 7b4a1fdfbc192cfd02ffb6cf18c0a86b2f6eaeb4.

View File

@ -1,4 +1,4 @@
From 417a497121a93250fa896b536dd56af55f562cba Mon Sep 17 00:00:00 2001
From ddfe189d39a3dd3f1c99773c57bb0650e39e8354 Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Wed, 24 Apr 2024 09:05:20 +1000
Subject: [PATCH] Updated vkd3d to 46fca3f9f4a9b47b32e9dfbacda0f3d19536c02c.

View File

@ -1,4 +1,4 @@
From 22ce76c9299aa5cd9b6df4244fb7614e322818fa Mon Sep 17 00:00:00 2001
From e91e957dbee71d7729e7e6fe7aa6c04bf13c360b Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Sun, 28 Apr 2024 09:46:44 +1000
Subject: [PATCH] Updated vkd3d to 13e1491941a1af32ddfc1019fa304231fd121c4d.

View File

@ -1,4 +1,4 @@
From 64c8a6f765bc07221a5b9d0b78bb12db0eae898e Mon Sep 17 00:00:00 2001
From a10a5f6d7f227464e7b594421cda94412460d7dc Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Fri, 3 May 2024 07:31:39 +1000
Subject: [PATCH] Updated vkd3d to 62a512c4f8c4070f0f4f3ed8e70b6f0bc885da30.

View File

@ -1,4 +1,4 @@
From 9db69085387899436ec12182c76ea25b4c773219 Mon Sep 17 00:00:00 2001
From 669dcd4183544055c8b512d6a60df7536e82b453 Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Mon, 13 May 2024 09:29:08 +1000
Subject: [PATCH] Updated vkd3d to 4b3a948edcb5e83074b63aad25ecf450dcae4130.

View File

@ -0,0 +1,153 @@
From cda6dd1902e0113ad3730c1f696138b668bbfacb Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Thu, 16 May 2024 11:56:37 +1000
Subject: [PATCH] Updated vkd3d to 061dc390367b4c83022d5fe1255f8d38f6b7ce9c.
---
libs/vkd3d/libs/vkd3d-shader/hlsl.h | 1 +
libs/vkd3d/libs/vkd3d-shader/hlsl.y | 13 ++--
libs/vkd3d/libs/vkd3d-shader/hlsl_codegen.c | 69 ++++++++++++---------
3 files changed, 47 insertions(+), 36 deletions(-)
diff --git a/libs/vkd3d/libs/vkd3d-shader/hlsl.h b/libs/vkd3d/libs/vkd3d-shader/hlsl.h
index 08a017874ae..27814f3a56f 100644
--- a/libs/vkd3d/libs/vkd3d-shader/hlsl.h
+++ b/libs/vkd3d/libs/vkd3d-shader/hlsl.h
@@ -1250,6 +1250,7 @@ bool hlsl_clone_block(struct hlsl_ctx *ctx, struct hlsl_block *dst_block, const
void hlsl_dump_function(struct hlsl_ctx *ctx, const struct hlsl_ir_function_decl *func);
+void hlsl_run_const_passes(struct hlsl_ctx *ctx, struct hlsl_block *body);
int hlsl_emit_bytecode(struct hlsl_ctx *ctx, struct hlsl_ir_function_decl *entry_func,
enum vkd3d_shader_target_type target_type, struct vkd3d_shader_code *out);
int hlsl_emit_effect_binary(struct hlsl_ctx *ctx, struct vkd3d_shader_code *out);
diff --git a/libs/vkd3d/libs/vkd3d-shader/hlsl.y b/libs/vkd3d/libs/vkd3d-shader/hlsl.y
index c6b6219eb4b..9c1bdef926d 100644
--- a/libs/vkd3d/libs/vkd3d-shader/hlsl.y
+++ b/libs/vkd3d/libs/vkd3d-shader/hlsl.y
@@ -1293,7 +1293,7 @@ static unsigned int evaluate_static_expression_as_uint(struct hlsl_ctx *ctx, str
struct hlsl_ir_node *node;
struct hlsl_block expr;
unsigned int ret = 0;
- bool progress;
+ struct hlsl_src src;
LIST_FOR_EACH_ENTRY(node, &block->instrs, struct hlsl_ir_node, entry)
{
@@ -1330,13 +1330,12 @@ static unsigned int evaluate_static_expression_as_uint(struct hlsl_ctx *ctx, str
return 0;
}
- do
- {
- progress = hlsl_transform_ir(ctx, hlsl_fold_constant_exprs, &expr, NULL);
- progress |= hlsl_copy_propagation_execute(ctx, &expr);
- } while (progress);
+ /* Wrap the node into a src to allow the reference to survive the multiple const passes. */
+ hlsl_src_from_node(&src, node_from_block(&expr));
+ hlsl_run_const_passes(ctx, &expr);
+ node = src.node;
+ hlsl_src_remove(&src);
- node = node_from_block(&expr);
if (node->type == HLSL_IR_CONSTANT)
{
constant = hlsl_ir_constant(node);
diff --git a/libs/vkd3d/libs/vkd3d-shader/hlsl_codegen.c b/libs/vkd3d/libs/vkd3d-shader/hlsl_codegen.c
index 26179042082..27f16af51c5 100644
--- a/libs/vkd3d/libs/vkd3d-shader/hlsl_codegen.c
+++ b/libs/vkd3d/libs/vkd3d-shader/hlsl_codegen.c
@@ -5408,6 +5408,44 @@ static void remove_unreachable_code(struct hlsl_ctx *ctx, struct hlsl_block *bod
}
}
+void hlsl_run_const_passes(struct hlsl_ctx *ctx, struct hlsl_block *body)
+{
+ bool progress;
+
+ lower_ir(ctx, lower_matrix_swizzles, body);
+ lower_ir(ctx, lower_index_loads, body);
+
+ lower_ir(ctx, lower_broadcasts, body);
+ while (hlsl_transform_ir(ctx, fold_redundant_casts, body, NULL));
+ do
+ {
+ progress = hlsl_transform_ir(ctx, split_array_copies, body, NULL);
+ progress |= hlsl_transform_ir(ctx, split_struct_copies, body, NULL);
+ }
+ while (progress);
+ hlsl_transform_ir(ctx, split_matrix_copies, body, NULL);
+
+ lower_ir(ctx, lower_narrowing_casts, body);
+ lower_ir(ctx, lower_int_dot, body);
+ lower_ir(ctx, lower_int_division, body);
+ lower_ir(ctx, lower_int_modulus, body);
+ lower_ir(ctx, lower_int_abs, body);
+ lower_ir(ctx, lower_casts_to_bool, body);
+ lower_ir(ctx, lower_float_modulus, body);
+ hlsl_transform_ir(ctx, fold_redundant_casts, body, NULL);
+
+ do
+ {
+ progress = hlsl_transform_ir(ctx, hlsl_fold_constant_exprs, body, NULL);
+ progress |= hlsl_transform_ir(ctx, hlsl_fold_constant_identities, body, NULL);
+ progress |= hlsl_transform_ir(ctx, hlsl_fold_constant_swizzles, body, NULL);
+ progress |= hlsl_copy_propagation_execute(ctx, body);
+ progress |= hlsl_transform_ir(ctx, fold_swizzle_chains, body, NULL);
+ progress |= hlsl_transform_ir(ctx, remove_trivial_swizzles, body, NULL);
+ progress |= hlsl_transform_ir(ctx, remove_trivial_conditional_branches, body, NULL);
+ } while (progress);
+}
+
int hlsl_emit_bytecode(struct hlsl_ctx *ctx, struct hlsl_ir_function_decl *entry_func,
enum vkd3d_shader_target_type target_type, struct vkd3d_shader_code *out)
{
@@ -5416,7 +5454,6 @@ int hlsl_emit_bytecode(struct hlsl_ctx *ctx, struct hlsl_ir_function_decl *entry
struct recursive_call_ctx recursive_call_ctx;
struct hlsl_ir_var *var;
unsigned int i;
- bool progress;
list_move_head(&body->instrs, &ctx->static_initializers.instrs);
@@ -5494,35 +5531,9 @@ int hlsl_emit_bytecode(struct hlsl_ctx *ctx, struct hlsl_ir_function_decl *entry
{
hlsl_transform_ir(ctx, lower_discard_neg, body, NULL);
}
- lower_ir(ctx, lower_broadcasts, body);
- while (hlsl_transform_ir(ctx, fold_redundant_casts, body, NULL));
- do
- {
- progress = hlsl_transform_ir(ctx, split_array_copies, body, NULL);
- progress |= hlsl_transform_ir(ctx, split_struct_copies, body, NULL);
- }
- while (progress);
- hlsl_transform_ir(ctx, split_matrix_copies, body, NULL);
- lower_ir(ctx, lower_narrowing_casts, body);
- lower_ir(ctx, lower_int_dot, body);
- lower_ir(ctx, lower_int_division, body);
- lower_ir(ctx, lower_int_modulus, body);
- lower_ir(ctx, lower_int_abs, body);
- lower_ir(ctx, lower_casts_to_bool, body);
- lower_ir(ctx, lower_float_modulus, body);
- hlsl_transform_ir(ctx, fold_redundant_casts, body, NULL);
- do
- {
- progress = hlsl_transform_ir(ctx, hlsl_fold_constant_exprs, body, NULL);
- progress |= hlsl_transform_ir(ctx, hlsl_fold_constant_identities, body, NULL);
- progress |= hlsl_transform_ir(ctx, hlsl_fold_constant_swizzles, body, NULL);
- progress |= hlsl_copy_propagation_execute(ctx, body);
- progress |= hlsl_transform_ir(ctx, fold_swizzle_chains, body, NULL);
- progress |= hlsl_transform_ir(ctx, remove_trivial_swizzles, body, NULL);
- progress |= hlsl_transform_ir(ctx, remove_trivial_conditional_branches, body, NULL);
- }
- while (progress);
+ hlsl_run_const_passes(ctx, body);
+
remove_unreachable_code(ctx, body);
hlsl_transform_ir(ctx, normalize_switch_cases, body, NULL);
--
2.43.0