mirror of
https://github.com/doitsujin/dxvk.git
synced 2024-12-04 07:24:15 +01:00
[d3d9] Unbind RTs which are unwritten by a PS
Otherwise we can end up with feedback loops on RTs with a 0 color mask. Closes: #3447
This commit is contained in:
parent
b9b2db510e
commit
8560efa3c7
@ -3278,21 +3278,33 @@ namespace dxvk {
|
|||||||
|
|
||||||
m_state.pixelShader = shader;
|
m_state.pixelShader = shader;
|
||||||
|
|
||||||
|
D3D9ShaderMasks newShaderMasks;
|
||||||
|
|
||||||
if (shader != nullptr) {
|
if (shader != nullptr) {
|
||||||
m_flags.set(D3D9DeviceFlag::DirtyFFPixelShader);
|
m_flags.set(D3D9DeviceFlag::DirtyFFPixelShader);
|
||||||
|
|
||||||
BindShader<DxsoProgramTypes::PixelShader>(GetCommonShader(shader));
|
BindShader<DxsoProgramTypes::PixelShader>(GetCommonShader(shader));
|
||||||
m_psShaderMasks = newShader->GetShaderMask();
|
newShaderMasks = newShader->GetShaderMask();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// TODO: What fixed function textures are in use?
|
// TODO: What fixed function textures are in use?
|
||||||
// Currently we are making all 8 of them as in use here.
|
// Currently we are making all 8 of them as in use here.
|
||||||
|
|
||||||
// The RT output is always 0 for fixed function.
|
// The RT output is always 0 for fixed function.
|
||||||
m_psShaderMasks = FixedFunctionMask;
|
newShaderMasks = FixedFunctionMask;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If we have any RTs we would have bound to the the FB
|
||||||
|
// not in the new shader mask, mark the framebuffer as dirty
|
||||||
|
// so we unbind them.
|
||||||
|
if (m_activeRTs & m_psShaderMasks.rtMask & (~newShaderMasks.rtMask))
|
||||||
|
m_flags.set(D3D9DeviceFlag::DirtyFramebuffer);
|
||||||
|
|
||||||
|
if (m_psShaderMasks.samplerMask != newShaderMasks.samplerMask ||
|
||||||
|
m_psShaderMasks.rtMask != newShaderMasks.rtMask) {
|
||||||
|
m_psShaderMasks = newShaderMasks;
|
||||||
UpdateActiveHazardsRT(UINT32_MAX);
|
UpdateActiveHazardsRT(UINT32_MAX);
|
||||||
|
}
|
||||||
|
|
||||||
return D3D_OK;
|
return D3D_OK;
|
||||||
}
|
}
|
||||||
@ -5666,6 +5678,9 @@ namespace dxvk {
|
|||||||
if (!m_state.renderStates[ColorWriteIndex(i)])
|
if (!m_state.renderStates[ColorWriteIndex(i)])
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if (!(m_psShaderMasks.rtMask & (1 << i)))
|
||||||
|
continue;
|
||||||
|
|
||||||
attachments.color[i] = {
|
attachments.color[i] = {
|
||||||
m_state.renderTargets[i]->GetRenderTargetView(srgb),
|
m_state.renderTargets[i]->GetRenderTargetView(srgb),
|
||||||
m_state.renderTargets[i]->GetRenderTargetLayout(m_hazardLayout) };
|
m_state.renderTargets[i]->GetRenderTargetLayout(m_hazardLayout) };
|
||||||
|
Loading…
Reference in New Issue
Block a user