mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d-shader/hlsl: Skip unallocated variables when looking for reservation conflicts.
This commit is contained in:
parent
aec9ea085e
commit
d4b5e79c8b
Notes:
Alexandre Julliard
2023-07-13 23:33:33 +02:00
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/253
@ -3689,7 +3689,7 @@ static void allocate_buffers(struct hlsl_ctx *ctx)
|
||||
}
|
||||
|
||||
static const struct hlsl_ir_var *get_allocated_object(struct hlsl_ctx *ctx, enum hlsl_regset regset,
|
||||
uint32_t index)
|
||||
uint32_t index, bool allocated_only)
|
||||
{
|
||||
const struct hlsl_ir_var *var;
|
||||
unsigned int start, count;
|
||||
@ -3703,6 +3703,9 @@ static const struct hlsl_ir_var *get_allocated_object(struct hlsl_ctx *ctx, enum
|
||||
* bound there even if the reserved vars aren't used. */
|
||||
start = var->reg_reservation.reg_index;
|
||||
count = var->data_type->reg_size[regset];
|
||||
|
||||
if (!var->regs[regset].allocated && allocated_only)
|
||||
continue;
|
||||
}
|
||||
else if (var->regs[regset].allocated)
|
||||
{
|
||||
@ -3743,6 +3746,7 @@ static void allocate_objects(struct hlsl_ctx *ctx, enum hlsl_regset regset)
|
||||
if (count == 0)
|
||||
continue;
|
||||
|
||||
/* The variable was already allocated if it has a reservation. */
|
||||
if (var->regs[regset].allocated)
|
||||
{
|
||||
const struct hlsl_ir_var *reserved_object, *last_reported = NULL;
|
||||
@ -3761,7 +3765,10 @@ static void allocate_objects(struct hlsl_ctx *ctx, enum hlsl_regset regset)
|
||||
{
|
||||
index = var->regs[regset].id + i;
|
||||
|
||||
reserved_object = get_allocated_object(ctx, regset, index);
|
||||
/* get_allocated_object() may return "var" itself, but we
|
||||
* actually want that, otherwise we'll end up reporting the
|
||||
* same conflict between the same two variables twice. */
|
||||
reserved_object = get_allocated_object(ctx, regset, index, true);
|
||||
if (reserved_object && reserved_object != var && reserved_object != last_reported)
|
||||
{
|
||||
hlsl_error(ctx, &var->loc, VKD3D_SHADER_ERROR_HLSL_OVERLAPPING_RESERVATIONS,
|
||||
@ -3780,7 +3787,7 @@ static void allocate_objects(struct hlsl_ctx *ctx, enum hlsl_regset regset)
|
||||
|
||||
while (available < count)
|
||||
{
|
||||
if (get_allocated_object(ctx, regset, index))
|
||||
if (get_allocated_object(ctx, regset, index, false))
|
||||
available = 0;
|
||||
else
|
||||
++available;
|
||||
|
@ -144,7 +144,7 @@ draw quad
|
||||
probe all rgba (2.0, 2.0, 2.0, 99.0)
|
||||
|
||||
|
||||
[pixel shader todo]
|
||||
[pixel shader]
|
||||
Texture2D tex1 : register(t2);
|
||||
Texture2D tex2 : register(t2);
|
||||
|
||||
@ -154,5 +154,5 @@ float4 main() : sv_target
|
||||
}
|
||||
|
||||
[test]
|
||||
todo draw quad
|
||||
draw quad
|
||||
probe all rgba (2.0, 2.0, 2.0, 99.0)
|
||||
|
Loading…
x
Reference in New Issue
Block a user