vkd3d-shader/hlsl: Do not lower index expressions for effects.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
This commit is contained in:
Nikolay Sivov 2024-09-22 10:35:16 +02:00 committed by Henri Verbeet
parent 849d4b3b2b
commit 2722346ffb
Notes: Henri Verbeet 2024-10-02 22:37:09 +02:00
Approved-by: Elizabeth Figura (@zfigura)
Approved-by: Henri Verbeet (@hverbeet)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1101
3 changed files with 7 additions and 1 deletions

View File

@ -1402,6 +1402,7 @@ struct hlsl_state_block_entry *clone_stateblock_entry(struct hlsl_ctx *ctx,
struct hlsl_state_block_entry *src, const char *name, bool lhs_has_index,
unsigned int lhs_index, unsigned int arg_index);
void hlsl_lower_index_loads(struct hlsl_ctx *ctx, struct hlsl_block *body);
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);

View File

@ -648,6 +648,7 @@ static struct hlsl_default_value evaluate_static_expression(struct hlsl_ctx *ctx
/* Wrap the node into a src to allow the reference to survive the multiple const passes. */
hlsl_src_from_node(&src, node);
hlsl_lower_index_loads(ctx, &expr);
hlsl_run_const_passes(ctx, &expr);
node = src.node;
hlsl_src_remove(&src);

View File

@ -6184,12 +6184,16 @@ static void remove_unreachable_code(struct hlsl_ctx *ctx, struct hlsl_block *bod
}
}
void hlsl_lower_index_loads(struct hlsl_ctx *ctx, struct hlsl_block *body)
{
lower_ir(ctx, lower_index_loads, body);
}
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));