mirror of
https://github.com/bkaradzic/bgfx.git
synced 2026-06-08 03:13:52 +00:00
This commit is contained in:
committed by
GitHub
parent
9dc9749b53
commit
ac6aa47b41
@@ -2301,6 +2301,30 @@ static_assert(BX_COUNTOF(s_accessNames) == Access::Count, "Invalid s_accessNames
|
||||
return isValid(fb.m_depthHandle);
|
||||
}
|
||||
|
||||
bool hasStencil(FrameBufferHandle _fbh)
|
||||
{
|
||||
if (!isValid(_fbh) )
|
||||
{
|
||||
return NULL != m_mainFrameBuffer.m_swapChain
|
||||
&& NULL != m_mainFrameBuffer.m_swapChain->m_backBufferStencil
|
||||
;
|
||||
}
|
||||
|
||||
const FrameBufferMtl& fb = m_frameBuffers[_fbh.idx];
|
||||
if (NULL != fb.m_swapChain)
|
||||
{
|
||||
return NULL != fb.m_swapChain->m_backBufferStencil;
|
||||
}
|
||||
|
||||
if (!isValid(fb.m_depthHandle) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
const TextureMtl& depthTexture = m_textures[fb.m_depthHandle.idx];
|
||||
return 0 < bimg::getBlockInfo(bimg::TextureFormat::Enum(depthTexture.m_textureFormat) ).stencilBits;
|
||||
}
|
||||
|
||||
void setDepthStencilState(uint64_t _state, uint64_t _stencil = 0)
|
||||
{
|
||||
_state &= BGFX_STATE_WRITE_Z|BGFX_STATE_DEPTH_TEST_MASK;
|
||||
@@ -2310,6 +2334,11 @@ static_assert(BX_COUNTOF(s_accessNames) == Access::Count, "Invalid s_accessNames
|
||||
_state &= ~(BGFX_STATE_WRITE_Z|BGFX_STATE_DEPTH_TEST_MASK);
|
||||
}
|
||||
|
||||
if (!hasStencil(m_fbh) )
|
||||
{
|
||||
_stencil = 0;
|
||||
}
|
||||
|
||||
uint32_t fstencil = unpackStencil(0, _stencil);
|
||||
uint32_t ref = (fstencil&BGFX_STENCIL_FUNC_REF_MASK)>>BGFX_STENCIL_FUNC_REF_SHIFT;
|
||||
|
||||
|
||||
@@ -3235,6 +3235,11 @@ WGPU_IMPORT
|
||||
|
||||
void setDepthStencilState(WGPUDepthStencilState& _outDepthStencilState, TextureFormat::Enum _format, uint64_t _state, uint64_t _stencil)
|
||||
{
|
||||
if (!hasStencil(_format) )
|
||||
{
|
||||
_stencil = 0;
|
||||
}
|
||||
|
||||
_stencil = 0 == _stencil ? kStencilDisabled : _stencil;
|
||||
|
||||
const uint32_t fstencil = unpackStencil(0, _stencil);
|
||||
|
||||
Reference in New Issue
Block a user