From 058b720a4ef94b2cb91fd7a7e6d2e0ca87c80ff5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Branimir=20Karad=C5=BEi=C4=87?= Date: Sun, 27 Mar 2016 22:36:52 -0700 Subject: [PATCH] D3D1x: Fixed blend factor logic. Issue #732. --- src/renderer_d3d11.cpp | 10 +++++----- src/renderer_d3d12.cpp | 9 ++++----- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/renderer_d3d11.cpp b/src/renderer_d3d11.cpp index e86b09eaa..20ffef818 100644 --- a/src/renderer_d3d11.cpp +++ b/src/renderer_d3d11.cpp @@ -2705,11 +2705,11 @@ BX_PRAGMA_DIAGNOSTIC_POP(); m_blendStateCache.add(hash, bs); } - const uint64_t f0 = BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_FACTOR, BGFX_STATE_BLEND_FACTOR); - const uint64_t f1 = BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_INV_FACTOR, BGFX_STATE_BLEND_INV_FACTOR); - bool hasFactor = false - || f0 == (_state & f0) - || f1 == (_state & f1) + 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) ) ; float blendFactor[4] = { 1.0f, 1.0f, 1.0f, 1.0f }; diff --git a/src/renderer_d3d12.cpp b/src/renderer_d3d12.cpp index 40366c590..39c31c05b 100644 --- a/src/renderer_d3d12.cpp +++ b/src/renderer_d3d12.cpp @@ -4629,9 +4629,6 @@ data.NumQualityLevels = 0; m_backBufferColorIdx = m_swapChain->GetCurrentBackBufferIndex(); #endif // BX_PLATFORM_WINDOWS - const uint64_t f0 = BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_FACTOR, BGFX_STATE_BLEND_FACTOR); - const uint64_t f1 = BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_INV_FACTOR, BGFX_STATE_BLEND_INV_FACTOR); - D3D12_GPU_DESCRIPTOR_HANDLE gpuHandle; ScratchBufferD3D12& scratchBuffer = m_scratchBuffer[m_backBufferColorIdx]; scratchBuffer.reset(gpuHandle); @@ -5027,8 +5024,10 @@ data.NumQualityLevels = 0; { const uint64_t state = draw.m_stateFlags; bool hasFactor = 0 - || f0 == (state & f0) - || f1 == (state & f1) + || 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) ) ; const VertexBufferD3D12& vb = m_vertexBuffers[draw.m_vertexBuffer.idx];