mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-01-31 14: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:
parent
bdafa16e39
commit
3004026db8
@ -1795,8 +1795,9 @@ namespace dxvk {
|
|||||||
return m_recorder->SetRenderState(State, Value);
|
return m_recorder->SetRenderState(State, Value);
|
||||||
|
|
||||||
auto& states = m_state.renderStates;
|
auto& states = m_state.renderStates;
|
||||||
|
DWORD old = states[State];
|
||||||
|
|
||||||
bool changed = states[State] != Value;
|
bool changed = old != Value;
|
||||||
|
|
||||||
if (likely(changed)) {
|
if (likely(changed)) {
|
||||||
const bool oldClipPlaneEnabled = IsClipPlaneEnabled();
|
const bool oldClipPlaneEnabled = IsClipPlaneEnabled();
|
||||||
@ -1880,19 +1881,31 @@ namespace dxvk {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case D3DRS_COLORWRITEENABLE:
|
case D3DRS_COLORWRITEENABLE:
|
||||||
UpdateActiveRTs(0);
|
if (likely(!old != !Value)) {
|
||||||
|
m_flags.set(D3D9DeviceFlag::DirtyFramebuffer);
|
||||||
|
UpdateActiveRTs(0);
|
||||||
|
}
|
||||||
m_flags.set(D3D9DeviceFlag::DirtyBlendState);
|
m_flags.set(D3D9DeviceFlag::DirtyBlendState);
|
||||||
break;
|
break;
|
||||||
case D3DRS_COLORWRITEENABLE1:
|
case D3DRS_COLORWRITEENABLE1:
|
||||||
UpdateActiveRTs(1);
|
if (likely(!old != !Value && m_state.renderTargets[1] != nullptr)) {
|
||||||
|
m_flags.set(D3D9DeviceFlag::DirtyFramebuffer);
|
||||||
|
UpdateActiveRTs(1);
|
||||||
|
}
|
||||||
m_flags.set(D3D9DeviceFlag::DirtyBlendState);
|
m_flags.set(D3D9DeviceFlag::DirtyBlendState);
|
||||||
break;
|
break;
|
||||||
case D3DRS_COLORWRITEENABLE2:
|
case D3DRS_COLORWRITEENABLE2:
|
||||||
UpdateActiveRTs(2);
|
if (likely(!old != !Value && m_state.renderTargets[2] != nullptr)) {
|
||||||
|
m_flags.set(D3D9DeviceFlag::DirtyFramebuffer);
|
||||||
|
UpdateActiveRTs(2);
|
||||||
|
}
|
||||||
m_flags.set(D3D9DeviceFlag::DirtyBlendState);
|
m_flags.set(D3D9DeviceFlag::DirtyBlendState);
|
||||||
break;
|
break;
|
||||||
case D3DRS_COLORWRITEENABLE3:
|
case D3DRS_COLORWRITEENABLE3:
|
||||||
UpdateActiveRTs(3);
|
if (likely(!old != !Value && m_state.renderTargets[3] != nullptr)) {
|
||||||
|
m_flags.set(D3D9DeviceFlag::DirtyFramebuffer);
|
||||||
|
UpdateActiveRTs(3);
|
||||||
|
}
|
||||||
m_flags.set(D3D9DeviceFlag::DirtyBlendState);
|
m_flags.set(D3D9DeviceFlag::DirtyBlendState);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -5555,6 +5568,9 @@ namespace dxvk {
|
|||||||
else if (unlikely(sampleCount != rtImageInfo.sampleCount))
|
else if (unlikely(sampleCount != rtImageInfo.sampleCount))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if (!m_state.renderStates[ColorWriteIndex(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_state.renderTargets[i]->GetRenderTargetLayout() };
|
||||||
|
Loading…
x
Reference in New Issue
Block a user