summaryrefslogtreecommitdiff
path: root/Source/Core/VideoBackends/D3D/D3DState.cpp
diff options
context:
space:
mode:
authorshuffle2 <godisgovernment@gmail.com>2014-12-18 02:59:51 -0800
committershuffle2 <godisgovernment@gmail.com>2014-12-18 02:59:51 -0800
commit717e155ce16d7bbfa9c2066f41547d99f7907dda (patch)
treee9e9e38793d55446ff14a07c9445cee34e9f05df /Source/Core/VideoBackends/D3D/D3DState.cpp
parent418e006e88306b6f9f3877f946ac5c17dd7e8751 (diff)
parent5688c27610f2a6d67b62e8f90f689e3c1d90a953 (diff)
Merge pull request #1689 from kayru/d3d_efb_copy_fix
D3D: Fixed D3D validation error during EFB to texture copy
Diffstat (limited to 'Source/Core/VideoBackends/D3D/D3DState.cpp')
-rw-r--r--Source/Core/VideoBackends/D3D/D3DState.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/Source/Core/VideoBackends/D3D/D3DState.cpp b/Source/Core/VideoBackends/D3D/D3DState.cpp
index 33310c9957..d4d98e35b8 100644
--- a/Source/Core/VideoBackends/D3D/D3DState.cpp
+++ b/Source/Core/VideoBackends/D3D/D3DState.cpp
@@ -199,6 +199,33 @@ void StateManager::Apply()
m_dirtyFlags = 0;
}
+u32 StateManager::UnsetTexture(ID3D11ShaderResourceView* srv)
+{
+ u32 mask = 0;
+
+ for (u32 index = 0; index < 8; ++index)
+ {
+ if (m_current.textures[index] == srv)
+ {
+ SetTexture(index, nullptr);
+ mask |= 1 << index;
+ }
+ }
+
+ return mask;
+}
+
+void StateManager::SetTextureByMask(u32 textureSlotMask, ID3D11ShaderResourceView* srv)
+{
+ while (textureSlotMask)
+ {
+ unsigned long index;
+ _BitScanForward(&index, textureSlotMask);
+ SetTexture(index, srv);
+ textureSlotMask &= ~(1 << index);
+ }
+}
+
} // namespace D3D
ID3D11SamplerState* StateCache::Get(SamplerState state)