vkd3d-shader/hlsl: Allocate unused variables with register reservations on SM1.

This commit is contained in:
Francisco Casas 2024-05-03 19:32:52 -04:00 committed by Alexandre Julliard
parent 7b3644d9f2
commit 657e460d11
Notes: Alexandre Julliard 2024-05-13 22:57:39 +02:00
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Henri Verbeet (@hverbeet)
Approved-by: Elizabeth Figura (@zfigura)
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/851
3 changed files with 6 additions and 6 deletions

View File

@ -1713,7 +1713,7 @@ static void write_sm1_uniforms(struct hlsl_ctx *ctx, struct vkd3d_bytecode_buffe
for (r = 0; r <= HLSL_REGSET_LAST; ++r) for (r = 0; r <= HLSL_REGSET_LAST; ++r)
{ {
if (var->semantic.name || !var->regs[r].allocated) if (var->semantic.name || !var->regs[r].allocated || !var->last_read)
continue; continue;
++uniform_count; ++uniform_count;
@ -1751,7 +1751,7 @@ static void write_sm1_uniforms(struct hlsl_ctx *ctx, struct vkd3d_bytecode_buffe
for (r = 0; r <= HLSL_REGSET_LAST; ++r) for (r = 0; r <= HLSL_REGSET_LAST; ++r)
{ {
if (var->semantic.name || !var->regs[r].allocated) if (var->semantic.name || !var->regs[r].allocated || !var->last_read)
continue; continue;
put_u32(buffer, 0); /* name */ put_u32(buffer, 0); /* name */
@ -1780,7 +1780,7 @@ static void write_sm1_uniforms(struct hlsl_ctx *ctx, struct vkd3d_bytecode_buffe
{ {
size_t var_offset, name_offset; size_t var_offset, name_offset;
if (var->semantic.name || !var->regs[r].allocated) if (var->semantic.name || !var->regs[r].allocated || !var->last_read)
continue; continue;
var_offset = vars_start + (uniform_count * 5 * sizeof(uint32_t)); var_offset = vars_start + (uniform_count * 5 * sizeof(uint32_t));

View File

@ -4529,7 +4529,7 @@ static void allocate_const_registers(struct hlsl_ctx *ctx, struct hlsl_ir_functi
{ {
unsigned int reg_size = var->data_type->reg_size[HLSL_REGSET_NUMERIC]; unsigned int reg_size = var->data_type->reg_size[HLSL_REGSET_NUMERIC];
if (!var->is_uniform || !var->last_read || reg_size == 0) if (!var->is_uniform || reg_size == 0)
continue; continue;
if (var->reg_reservation.reg_type == 'c') if (var->reg_reservation.reg_type == 'c')

View File

@ -339,7 +339,7 @@ uniform 16 float 4
uniform 20 float 5 uniform 20 float 5
uniform 24 float 6 uniform 24 float 6
draw quad draw quad
todo probe all rgba (0, 6, 0, 0) probe all rgba (0, 6, 0, 0)
[pixel shader] [pixel shader]
@ -372,7 +372,7 @@ uniform 16 float 4
uniform 20 float 5 uniform 20 float 5
uniform 24 float 6 uniform 24 float 6
draw quad draw quad
todo probe all rgba (6, 1, 0, 0) probe all rgba (6, 1, 0, 0)
[pixel shader todo] [pixel shader todo]