1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-01-19 05:52:11 +01:00

[d3d9] Only bind RT if we actually write to it

The alternative render path for shadow maps in Dead Space relies on this.
This commit is contained in:
Robin Kertels 2022-03-29 22:51:59 +02:00 committed by Joshie
parent bdafa16e39
commit 3004026db8

View File

@ -1795,8 +1795,9 @@ namespace dxvk {
return m_recorder->SetRenderState(State, Value);
auto& states = m_state.renderStates;
DWORD old = states[State];
bool changed = states[State] != Value;
bool changed = old != Value;
if (likely(changed)) {
const bool oldClipPlaneEnabled = IsClipPlaneEnabled();
@ -1880,19 +1881,31 @@ namespace dxvk {
break;
case D3DRS_COLORWRITEENABLE:
if (likely(!old != !Value)) {
m_flags.set(D3D9DeviceFlag::DirtyFramebuffer);
UpdateActiveRTs(0);
}
m_flags.set(D3D9DeviceFlag::DirtyBlendState);
break;
case D3DRS_COLORWRITEENABLE1:
if (likely(!old != !Value && m_state.renderTargets[1] != nullptr)) {
m_flags.set(D3D9DeviceFlag::DirtyFramebuffer);
UpdateActiveRTs(1);
}
m_flags.set(D3D9DeviceFlag::DirtyBlendState);
break;
case D3DRS_COLORWRITEENABLE2:
if (likely(!old != !Value && m_state.renderTargets[2] != nullptr)) {
m_flags.set(D3D9DeviceFlag::DirtyFramebuffer);
UpdateActiveRTs(2);
}
m_flags.set(D3D9DeviceFlag::DirtyBlendState);
break;
case D3DRS_COLORWRITEENABLE3:
if (likely(!old != !Value && m_state.renderTargets[3] != nullptr)) {
m_flags.set(D3D9DeviceFlag::DirtyFramebuffer);
UpdateActiveRTs(3);
}
m_flags.set(D3D9DeviceFlag::DirtyBlendState);
break;
@ -5555,6 +5568,9 @@ namespace dxvk {
else if (unlikely(sampleCount != rtImageInfo.sampleCount))
continue;
if (!m_state.renderStates[ColorWriteIndex(i)])
continue;
attachments.color[i] = {
m_state.renderTargets[i]->GetRenderTargetView(srgb),
m_state.renderTargets[i]->GetRenderTargetLayout() };