vkd3d-shader/ir: Determine the correct writemask for destinations with fixed masks.

This commit is contained in:
Shaun Ren
2025-10-02 16:15:18 -04:00
committed by Henri Verbeet
parent e5081a1bf9
commit b5e2e1dd06
Notes: Henri Verbeet 2025-10-16 15:22:12 +02:00
Approved-by: Francisco Casas (@fcasas)
Approved-by: Elizabeth Figura (@zfigura)
Approved-by: Henri Verbeet (@hverbeet)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1766
2 changed files with 17 additions and 0 deletions

View File

@@ -9311,6 +9311,7 @@ struct temp_allocator
enum vkd3d_shader_register_type type;
unsigned int idx;
bool force_first;
bool fixed_mask;
} *ssa_regs, *temp_regs;
size_t ssa_count, temp_count;
unsigned int new_temp_count;
@@ -9430,7 +9431,16 @@ static void temp_allocator_set_dst(struct temp_allocator *allocator,
dst->reg.type = VKD3DSPR_TEMP;
dst->reg.dimension = VSIR_DIMENSION_VEC4;
dst->reg.idx[0].offset = reg->temp_id;
if (reg->fixed_mask)
{
VKD3D_ASSERT((reg->allocated_mask & dst->write_mask) == dst->write_mask);
return;
}
remapped_mask = vsir_combine_write_masks(reg->allocated_mask, dst->write_mask);
VKD3D_ASSERT(vkd3d_popcount(remapped_mask) == vkd3d_popcount(dst->write_mask));
if (dst->write_mask != remapped_mask)
{
dst->write_mask = remapped_mask;
@@ -9508,6 +9518,7 @@ static void temp_allocator_open_register(struct temp_allocator *allocator, struc
{
reg->temp_id = i;
reg->allocated_mask = liveness_reg->mask;
reg->fixed_mask = true;
current_allocation[i] |= reg->allocated_mask;
allocator->new_temp_count = max(allocator->new_temp_count, i + 1);
TRACE("Allocated r%u%s for %s (liveness %u-%u).\n",
@@ -9534,6 +9545,7 @@ static void temp_allocator_open_register(struct temp_allocator *allocator, struc
reg->temp_id = i;
reg->allocated_mask = vsir_combine_write_masks(available_mask, mask);
reg->fixed_mask = false;
current_allocation[i] |= reg->allocated_mask;
allocator->new_temp_count = max(allocator->new_temp_count, i + 1);
TRACE("Allocated r%u%s for %s (liveness %u-%u).\n",

View File

@@ -1,3 +1,8 @@
[require]
% The sincos instruction has different semantics in SM2 and SM3. Test both versions.
compile shader model 2.0
compile shader model 3.0
[vertex shader]
void main(float4 pos : position, out float tex : texcoord, out float4 out_pos : sv_position)
{