mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-01-28 13:05:02 -08:00
vkd3d-shader/hlsl: Support evaluated expressions for sample count in multisampled textures declarations.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
This commit is contained in:
parent
73d422a0e0
commit
a65c0b0e22
Notes:
Alexandre Julliard
2023-07-04 23:25:55 +02:00
Approved-by: Giovanni Mascellani (@giomasce) Approved-by: Zebediah Figura (@zfigura) Approved-by: Francisco Casas (@fcasas) Approved-by: Henri Verbeet (@hverbeet) Approved-by: Alexandre Julliard (@julliard) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/256
@ -1139,20 +1139,28 @@ static unsigned int evaluate_static_expression_as_uint(struct hlsl_ctx *ctx, str
|
||||
{
|
||||
struct hlsl_ir_constant *constant;
|
||||
struct hlsl_ir_node *node;
|
||||
struct hlsl_block expr;
|
||||
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))
|
||||
if (!hlsl_clone_block(ctx, &expr, &ctx->static_initializers))
|
||||
return 0;
|
||||
hlsl_block_add_block(&expr, block);
|
||||
|
||||
if (!add_implicit_conversion(ctx, &expr.instrs, node_from_list(&expr.instrs),
|
||||
hlsl_get_scalar_type(ctx, HLSL_TYPE_UINT), loc))
|
||||
{
|
||||
hlsl_block_cleanup(&expr);
|
||||
return 0;
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
progress = hlsl_transform_ir(ctx, hlsl_fold_constant_exprs, block, NULL);
|
||||
progress |= hlsl_copy_propagation_execute(ctx, block);
|
||||
progress = hlsl_transform_ir(ctx, hlsl_fold_constant_exprs, &expr, NULL);
|
||||
progress |= hlsl_copy_propagation_execute(ctx, &expr);
|
||||
} while (progress);
|
||||
|
||||
node = node_from_list(&block->instrs);
|
||||
node = node_from_list(&expr.instrs);
|
||||
if (node->type == HLSL_IR_CONSTANT)
|
||||
{
|
||||
constant = hlsl_ir_constant(node);
|
||||
@ -1164,6 +1172,8 @@ static unsigned int evaluate_static_expression_as_uint(struct hlsl_ctx *ctx, str
|
||||
"Failed to evaluate constant expression %d.", node->type);
|
||||
}
|
||||
|
||||
hlsl_block_cleanup(&expr);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -5675,7 +5685,7 @@ arrays:
|
||||
uint32_t *new_array;
|
||||
unsigned int size;
|
||||
|
||||
hlsl_clone_block(ctx, &block, &ctx->static_initializers);
|
||||
hlsl_block_init(&block);
|
||||
list_move_tail(&block.instrs, $2);
|
||||
|
||||
size = evaluate_static_expression_as_uint(ctx, &block, &@2);
|
||||
|
@ -37,7 +37,8 @@ probe (0, 1) rgba (0.5, 0.7, 0.6, 0.8)
|
||||
probe (1, 1) rgba (0.8, 0.0, 0.7, 1.0)
|
||||
|
||||
[pixel shader]
|
||||
Texture2DMS<float4, 1> t;
|
||||
static const int size = 2;
|
||||
Texture2DMS<float4, size - 1> t;
|
||||
|
||||
float4 main(float4 pos : sv_position) : sv_target
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user