diff --git a/src/renderer_d3d11.cpp b/src/renderer_d3d11.cpp index 20ffef818..cba0841ee 100644 --- a/src/renderer_d3d11.cpp +++ b/src/renderer_d3d11.cpp @@ -2705,11 +2705,15 @@ BX_PRAGMA_DIAGNOSTIC_POP(); m_blendStateCache.add(hash, bs); } + const uint64_t f0 = BGFX_STATE_BLEND_FACTOR; + const uint64_t f1 = BGFX_STATE_BLEND_INV_FACTOR; + const uint64_t f2 = BGFX_STATE_BLEND_FACTOR<<4; + const uint64_t f3 = BGFX_STATE_BLEND_INV_FACTOR<<4; bool hasFactor = 0 - || 0 != (_state & BGFX_STATE_BLEND_FACTOR ) - || 0 != (_state & BGFX_STATE_BLEND_INV_FACTOR ) - || 0 != (_state & (BGFX_STATE_BLEND_FACTOR <<4) ) - || 0 != (_state & (BGFX_STATE_BLEND_INV_FACTOR<<4) ) + || f0 == (_state & f0) + || f1 == (_state & f1) + || f2 == (_state & f2) + || f3 == (_state & f3) ; float blendFactor[4] = { 1.0f, 1.0f, 1.0f, 1.0f }; diff --git a/src/renderer_d3d12.cpp b/src/renderer_d3d12.cpp index 39c31c05b..9cb4f1915 100644 --- a/src/renderer_d3d12.cpp +++ b/src/renderer_d3d12.cpp @@ -4629,6 +4629,11 @@ data.NumQualityLevels = 0; m_backBufferColorIdx = m_swapChain->GetCurrentBackBufferIndex(); #endif // BX_PLATFORM_WINDOWS + const uint64_t f0 = BGFX_STATE_BLEND_FACTOR; + const uint64_t f1 = BGFX_STATE_BLEND_INV_FACTOR; + const uint64_t f2 = BGFX_STATE_BLEND_FACTOR<<4; + const uint64_t f3 = BGFX_STATE_BLEND_INV_FACTOR<<4; + D3D12_GPU_DESCRIPTOR_HANDLE gpuHandle; ScratchBufferD3D12& scratchBuffer = m_scratchBuffer[m_backBufferColorIdx]; scratchBuffer.reset(gpuHandle); @@ -5024,10 +5029,10 @@ data.NumQualityLevels = 0; { const uint64_t state = draw.m_stateFlags; bool hasFactor = 0 - || 0 != (state & BGFX_STATE_BLEND_FACTOR ) - || 0 != (state & BGFX_STATE_BLEND_INV_FACTOR ) - || 0 != (state & (BGFX_STATE_BLEND_FACTOR <<4) ) - || 0 != (state & (BGFX_STATE_BLEND_INV_FACTOR<<4) ) + || f0 == (state & f0) + || f1 == (state & f1) + || f2 == (state & f2) + || f3 == (state & f3) ; const VertexBufferD3D12& vb = m_vertexBuffers[draw.m_vertexBuffer.idx];