mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-09-12 18:50:22 -07:00
vkd3d-shader/hlsl: Handle static constants in array size expressions.
This commit is contained in:
committed by
Alexandre Julliard
parent
38c89442ac
commit
d856be0519
Notes:
Alexandre Julliard
2023-06-12 23:10:20 +02:00
Approved-by: Zebediah Figura (@zfigura) Approved-by: Giovanni Mascellani (@giomasce) Approved-by: Henri Verbeet (@hverbeet) Approved-by: Alexandre Julliard (@julliard) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/228
@@ -1098,12 +1098,17 @@ static unsigned int evaluate_static_expression_as_uint(struct hlsl_ctx *ctx, str
|
||||
struct hlsl_ir_constant *constant;
|
||||
struct hlsl_ir_node *node;
|
||||
unsigned int ret = 0;
|
||||
bool progress;
|
||||
|
||||
if (!add_implicit_conversion(ctx, &block->instrs, node_from_list(&block->instrs),
|
||||
hlsl_get_scalar_type(ctx, HLSL_TYPE_UINT), loc))
|
||||
return 0;
|
||||
|
||||
while (hlsl_transform_ir(ctx, hlsl_fold_constant_exprs, block, NULL));
|
||||
do
|
||||
{
|
||||
progress = hlsl_transform_ir(ctx, hlsl_fold_constant_exprs, block, NULL);
|
||||
progress |= hlsl_copy_propagation_execute(ctx, block);
|
||||
} while (progress);
|
||||
|
||||
node = node_from_list(&block->instrs);
|
||||
if (node->type == HLSL_IR_CONSTANT)
|
||||
@@ -5494,7 +5499,7 @@ arrays:
|
||||
uint32_t *new_array;
|
||||
unsigned int size;
|
||||
|
||||
hlsl_block_init(&block);
|
||||
hlsl_clone_block(ctx, &block, &ctx->static_initializers);
|
||||
list_move_tail(&block.instrs, $2);
|
||||
|
||||
size = evaluate_static_expression_as_uint(ctx, &block, &@2);
|
||||
|
||||
Reference in New Issue
Block a user