mirror of
https://github.com/bkaradzic/bgfx.git
synced 2026-11-11 02:25:34 +00:00
Fixed MRT clear with UINT8_MAX palette index clearing the attachment on clear quad. (#4006)
This commit is contained in:
+19
-5
@@ -2901,7 +2901,7 @@ namespace bgfx { namespace d3d11
|
||||
setInputLayout(BX_COUNTOF(layouts), layouts, _program, _numInstanceData);
|
||||
}
|
||||
|
||||
void setBlendState(uint64_t _state, uint32_t _rgba = 0, uint32_t _sampleMask = UINT32_MAX)
|
||||
void setBlendState(uint64_t _state, uint32_t _rgba = 0, uint32_t _sampleMask = UINT32_MAX, uint8_t _mrtMask = UINT8_MAX)
|
||||
{
|
||||
_state &= BGFX_D3D11_BLEND_STATE_MASK;
|
||||
|
||||
@@ -2912,6 +2912,7 @@ namespace bgfx { namespace d3d11
|
||||
? _rgba
|
||||
: -1
|
||||
);
|
||||
murmur.add(_mrtMask);
|
||||
const uint32_t hash = murmur.end();
|
||||
|
||||
ID3D11BlendState* bs = m_blendStateCache.find(hash);
|
||||
@@ -2981,6 +2982,19 @@ namespace bgfx { namespace d3d11
|
||||
}
|
||||
}
|
||||
|
||||
if (UINT8_MAX != _mrtMask)
|
||||
{
|
||||
desc.IndependentBlendEnable = true;
|
||||
|
||||
for (uint32_t ii = 0; ii < BX_COUNTOF(desc.RenderTarget); ++ii)
|
||||
{
|
||||
if (0 == (_mrtMask & (1<<ii) ) )
|
||||
{
|
||||
desc.RenderTarget[ii].RenderTargetWriteMask = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DX_CHECK(m_device->CreateBlendState(&desc, &bs) );
|
||||
|
||||
m_blendStateCache.add(hash, bs);
|
||||
@@ -3854,10 +3868,6 @@ namespace bgfx { namespace d3d11
|
||||
: 0
|
||||
;
|
||||
|
||||
setBlendState(state);
|
||||
setDepthStencilState(state, stencil);
|
||||
setRasterizerState(state);
|
||||
|
||||
uint32_t numMrt = 1;
|
||||
FrameBufferHandle fbh = m_fbh;
|
||||
if (isValid(fbh) )
|
||||
@@ -3866,6 +3876,10 @@ namespace bgfx { namespace d3d11
|
||||
numMrt = bx::max(1, fb.m_num);
|
||||
}
|
||||
|
||||
setBlendState(state, 0, UINT32_MAX, uint8_t(~_clear.getColorSkipMask(numMrt) ) );
|
||||
setDepthStencilState(state, stencil);
|
||||
setRasterizerState(state);
|
||||
|
||||
ProgramD3D11& program = m_program[_clearQuad.m_program[numMrt-1].idx];
|
||||
m_currentProgram = &program;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user