Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

D3D9: Fix fixed function sampler mask #4341

Merged
merged 2 commits into from
Oct 9, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 17 additions & 17 deletions src/d3d9/d3d9_device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5353,7 +5353,7 @@ namespace dxvk {

*pDynamicVBOs = dynamicSysmemVBOs;

if (pDynamicIBO)
if (unlikely(pDynamicIBO))
*pDynamicIBO = dynamicSysmemIBO;

if (likely(!dynamicSysmemVBOs && !dynamicSysmemIBO))
Expand Down Expand Up @@ -6908,7 +6908,7 @@ namespace dxvk {
const uint32_t buffersToUpload = m_activeVertexBuffersToUpload & usedBuffersMask;
for (uint32_t bufferIdx : bit::BitMask(buffersToUpload)) {
auto* vbo = GetCommonBuffer(m_state.vertexBuffers[bufferIdx].vertexBuffer);
if (vbo != nullptr && vbo->NeedsUpload())
if (likely(vbo != nullptr && vbo->NeedsUpload()))
misyltoad marked this conversation as resolved.
Show resolved Hide resolved
FlushBuffer(vbo);
}
m_activeVertexBuffersToUpload &= ~buffersToUpload;
Expand All @@ -6926,44 +6926,44 @@ namespace dxvk {
GenerateTextureMips(texturesToGen);

auto* ibo = GetCommonBuffer(m_state.indices);
if (UploadIBO && ibo != nullptr && ibo->NeedsUpload())
if (unlikely(UploadIBO && ibo != nullptr && ibo->NeedsUpload()))
FlushBuffer(ibo);

UpdateFog();

if (m_flags.test(D3D9DeviceFlag::DirtyFramebuffer))
if (unlikely(m_flags.test(D3D9DeviceFlag::DirtyFramebuffer)))
BindFramebuffer();

if (m_flags.test(D3D9DeviceFlag::DirtyViewportScissor))
if (unlikely(m_flags.test(D3D9DeviceFlag::DirtyViewportScissor)))
BindViewportAndScissor();

const uint32_t activeDirtySamplers = m_dirtySamplerStates & usedTextureMask;
if (activeDirtySamplers)
if (unlikely(activeDirtySamplers))
UndirtySamplers(activeDirtySamplers);

const uint32_t usedDirtyTextures = m_dirtyTextures & usedSamplerMask;
if (usedDirtyTextures)
if (likely(usedDirtyTextures))
UndirtyTextures(usedDirtyTextures);

if (m_flags.test(D3D9DeviceFlag::DirtyBlendState))
if (unlikely(m_flags.test(D3D9DeviceFlag::DirtyBlendState)))
BindBlendState();

if (m_flags.test(D3D9DeviceFlag::DirtyDepthStencilState))
if (unlikely(m_flags.test(D3D9DeviceFlag::DirtyDepthStencilState)))
BindDepthStencilState();

if (m_flags.test(D3D9DeviceFlag::DirtyRasterizerState))
if (unlikely(m_flags.test(D3D9DeviceFlag::DirtyRasterizerState)))
BindRasterizerState();

if (m_flags.test(D3D9DeviceFlag::DirtyDepthBias))
if (unlikely(m_flags.test(D3D9DeviceFlag::DirtyDepthBias)))
BindDepthBias();

if (m_flags.test(D3D9DeviceFlag::DirtyMultiSampleState))
if (unlikely(m_flags.test(D3D9DeviceFlag::DirtyMultiSampleState)))
BindMultiSampleState();

if (m_flags.test(D3D9DeviceFlag::DirtyAlphaTestState))
if (unlikely(m_flags.test(D3D9DeviceFlag::DirtyAlphaTestState)))
BindAlphaTestState();

if (m_flags.test(D3D9DeviceFlag::DirtyClipPlanes))
if (unlikely(m_flags.test(D3D9DeviceFlag::DirtyClipPlanes)))
UpdateClipPlanes();

UpdatePointMode(PrimitiveType == D3DPT_POINTLIST);
Expand All @@ -6989,7 +6989,7 @@ namespace dxvk {
UpdateFixedFunctionVS();
}

if (m_flags.test(D3D9DeviceFlag::DirtyInputLayout))
if (unlikely(m_flags.test(D3D9DeviceFlag::DirtyInputLayout)))
BindInputLayout();

if (likely(UseProgrammablePS())) {
Expand Down Expand Up @@ -7022,7 +7022,7 @@ namespace dxvk {
const uint32_t drefClampMask = m_drefClamp & depthTextureMask;
UpdateCommonSamplerSpec(nullTextureMask, depthTextureMask, drefClampMask);

if (m_flags.test(D3D9DeviceFlag::DirtySharedPixelShaderData)) {
if (unlikely(m_flags.test(D3D9DeviceFlag::DirtySharedPixelShaderData))) {
m_flags.clr(D3D9DeviceFlag::DirtySharedPixelShaderData);

auto mapPtr = m_psShared.AllocSlice();
Expand All @@ -7043,7 +7043,7 @@ namespace dxvk {
}
}

if (m_flags.test(D3D9DeviceFlag::DirtyDepthBounds)) {
if (unlikely(m_flags.test(D3D9DeviceFlag::DirtyDepthBounds))) {
m_flags.clr(D3D9DeviceFlag::DirtyDepthBounds);

DxvkDepthBounds db;
Expand Down