mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-04-10 12:45:46 +00:00
D3D: Replaced explicit _BitScanForward with LeastSignificantSetBit
This commit is contained in:
parent
2b664f5d89
commit
df5750edfd
@ -2,6 +2,7 @@
|
|||||||
// Licensed under GPLv2
|
// Licensed under GPLv2
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
|
#include "Common/BitSet.h"
|
||||||
#include "Common/Logging/Log.h"
|
#include "Common/Logging/Log.h"
|
||||||
|
|
||||||
#include "VideoBackends/D3D/D3DBase.h"
|
#include "VideoBackends/D3D/D3DBase.h"
|
||||||
@ -87,11 +88,8 @@ void StateManager::Apply()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned long textureMaskShift;
|
int textureMaskShift = LeastSignificantSetBit((u32)DirtyFlag_Texture0);
|
||||||
_BitScanForward(&textureMaskShift, DirtyFlag_Texture0);
|
int samplerMaskShift = LeastSignificantSetBit((u32)DirtyFlag_Sampler0);
|
||||||
|
|
||||||
unsigned long samplerMaskShift;
|
|
||||||
_BitScanForward(&samplerMaskShift, DirtyFlag_Sampler0);
|
|
||||||
|
|
||||||
u32 dirtyTextures = (m_dirtyFlags & (DirtyFlag_Texture0 | DirtyFlag_Texture1 | DirtyFlag_Texture2 | DirtyFlag_Texture3
|
u32 dirtyTextures = (m_dirtyFlags & (DirtyFlag_Texture0 | DirtyFlag_Texture1 | DirtyFlag_Texture2 | DirtyFlag_Texture3
|
||||||
| DirtyFlag_Texture4 | DirtyFlag_Texture5 | DirtyFlag_Texture6 | DirtyFlag_Texture7)) >> textureMaskShift;
|
| DirtyFlag_Texture4 | DirtyFlag_Texture5 | DirtyFlag_Texture6 | DirtyFlag_Texture7)) >> textureMaskShift;
|
||||||
@ -157,9 +155,7 @@ void StateManager::Apply()
|
|||||||
|
|
||||||
while (dirtyTextures)
|
while (dirtyTextures)
|
||||||
{
|
{
|
||||||
unsigned long index;
|
int index = LeastSignificantSetBit(dirtyTextures);
|
||||||
_BitScanForward(&index, dirtyTextures);
|
|
||||||
|
|
||||||
if (m_current.textures[index] != m_pending.textures[index])
|
if (m_current.textures[index] != m_pending.textures[index])
|
||||||
{
|
{
|
||||||
D3D::context->PSSetShaderResources(index, 1, &m_pending.textures[index]);
|
D3D::context->PSSetShaderResources(index, 1, &m_pending.textures[index]);
|
||||||
@ -171,9 +167,7 @@ void StateManager::Apply()
|
|||||||
|
|
||||||
while (dirtySamplers)
|
while (dirtySamplers)
|
||||||
{
|
{
|
||||||
unsigned long index;
|
int index = LeastSignificantSetBit(dirtySamplers);
|
||||||
_BitScanForward(&index, dirtySamplers);
|
|
||||||
|
|
||||||
if (m_current.samplers[index] != m_pending.samplers[index])
|
if (m_current.samplers[index] != m_pending.samplers[index])
|
||||||
{
|
{
|
||||||
D3D::context->PSSetSamplers(index, 1, &m_pending.samplers[index]);
|
D3D::context->PSSetSamplers(index, 1, &m_pending.samplers[index]);
|
||||||
@ -227,8 +221,7 @@ void StateManager::SetTextureByMask(u32 textureSlotMask, ID3D11ShaderResourceVie
|
|||||||
{
|
{
|
||||||
while (textureSlotMask)
|
while (textureSlotMask)
|
||||||
{
|
{
|
||||||
unsigned long index;
|
int index = LeastSignificantSetBit(textureSlotMask);
|
||||||
_BitScanForward(&index, textureSlotMask);
|
|
||||||
SetTexture(index, srv);
|
SetTexture(index, srv);
|
||||||
textureSlotMask &= ~(1 << index);
|
textureSlotMask &= ~(1 << index);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user