diff --git a/libs/vkd3d-shader/d3dbc.c b/libs/vkd3d-shader/d3dbc.c index 24a95224..c7991407 100644 --- a/libs/vkd3d-shader/d3dbc.c +++ b/libs/vkd3d-shader/d3dbc.c @@ -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) { - if (var->semantic.name || !var->regs[r].allocated) + if (var->semantic.name || !var->regs[r].allocated || !var->last_read) continue; ++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) { - if (var->semantic.name || !var->regs[r].allocated) + if (var->semantic.name || !var->regs[r].allocated || !var->last_read) continue; 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; - if (var->semantic.name || !var->regs[r].allocated) + if (var->semantic.name || !var->regs[r].allocated || !var->last_read) continue; var_offset = vars_start + (uniform_count * 5 * sizeof(uint32_t)); diff --git a/libs/vkd3d-shader/hlsl_codegen.c b/libs/vkd3d-shader/hlsl_codegen.c index 8882deaf..4af55293 100644 --- a/libs/vkd3d-shader/hlsl_codegen.c +++ b/libs/vkd3d-shader/hlsl_codegen.c @@ -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]; - if (!var->is_uniform || !var->last_read || reg_size == 0) + if (!var->is_uniform || reg_size == 0) continue; if (var->reg_reservation.reg_type == 'c') diff --git a/tests/hlsl/sm1-const-allocation.shader_test b/tests/hlsl/sm1-const-allocation.shader_test index ca641b14..0a4340ea 100644 --- a/tests/hlsl/sm1-const-allocation.shader_test +++ b/tests/hlsl/sm1-const-allocation.shader_test @@ -339,7 +339,7 @@ uniform 16 float 4 uniform 20 float 5 uniform 24 float 6 draw quad -todo probe all rgba (0, 6, 0, 0) +probe all rgba (0, 6, 0, 0) [pixel shader] @@ -372,7 +372,7 @@ uniform 16 float 4 uniform 20 float 5 uniform 24 float 6 draw quad -todo probe all rgba (6, 1, 0, 0) +probe all rgba (6, 1, 0, 0) [pixel shader todo]