[DXBC] Fix interpolator copying from v# to r# in PS

The bit count was of `(1<<i)-1` itself (thus couldn't handle interpolators with a smaller index skipped), not of `bits&((1<<i)-1)`.
This commit is contained in:
Triang3l 2022-10-18 13:12:20 +03:00
parent 45050b2380
commit cdb40ddb28
1 changed files with 8 additions and 9 deletions

View File

@ -691,15 +691,14 @@ void DxbcShaderTranslator::StartPixelShader() {
if (i == param_gen_interpolator) { if (i == param_gen_interpolator) {
continue; continue;
} }
a_.OpMov( a_.OpMov(uses_register_dynamic_addressing ? dxbc::Dest::X(0, i)
uses_register_dynamic_addressing ? dxbc::Dest::X(0, i) : dxbc::Dest::R(i),
: dxbc::Dest::R(i), (i < xenos::kMaxInterpolators &&
(i < xenos::kMaxInterpolators && (interpolator_mask & (UINT32_C(1) << i)))
(interpolator_mask & (UINT32_C(1) << i))) ? dxbc::Src::V1D(in_reg_ps_interpolators_ +
? dxbc::Src::V1D( xe::bit_count(interpolator_mask &
in_reg_ps_interpolators_ + ((UINT32_C(1) << i) - 1)))
xe::bit_count((interpolator_mask & (UINT32_C(1) << i)) - 1)) : dxbc::Src::LF(0.0f));
: dxbc::Src::LF(0.0f));
} }
// Write the pixel parameters to the specified interpolator register // Write the pixel parameters to the specified interpolator register