This commit is contained in:
Branimir Karadžić 2015-11-02 13:13:57 -08:00
parent dcb80a3f41
commit 202bfbd174
6 changed files with 27 additions and 18 deletions

View File

@ -353,6 +353,9 @@
#define BGFX_RESET_SRGB_BACKBUFFER UINT32_C(0x00008000) //!< Enable sRGB backbuffer.
#define BGFX_RESET_HIDPI UINT32_C(0x00010000) //!< Enable HiDPI rendering.
#define BGFX_RESET_RESERVED_SHIFT 31 //!< Internal bits shift.
#define BGFX_RESET_RESERVED_MASK UINT32_C(0x80000000) //!< Internal bits mask.
///
#define BGFX_CAPS_TEXTURE_COMPARE_LEQUAL UINT64_C(0x0000000000000001) //!< Texture compare less equal mode is supported.
#define BGFX_CAPS_TEXTURE_COMPARE_ALL UINT64_C(0x0000000000000003) //!< All texture compare modes are supported.
@ -401,6 +404,9 @@
#define BGFX_SUBMIT_EYE_MASK UINT8_C(0x03) //!<
#define BGFX_SUBMIT_EYE_FIRST BGFX_SUBMIT_EYE_LEFT
#define BGFX_SUBMIT_RESERVED_SHIFT 7 //!< Internal bits shift.
#define BGFX_SUBMIT_RESERVED_MASK UINT8_C(0x80) //!< Internal bits mask.
///
#define BGFX_PCI_ID_NONE UINT16_C(0x0000) //!< Autoselect adapter.
#define BGFX_PCI_ID_SOFTWARE_RASTERIZER UINT16_C(0x0001) //!< Software rasterizer.

View File

@ -2365,6 +2365,7 @@ again:
void reset(uint32_t _width, uint32_t _height, uint32_t _flags)
{
BGFX_CHECK_MAIN_THREAD();
BX_CHECK(0 == (_flags&BGFX_RESET_RESERVED_MASK), "Do not set reset reserved flags!");
s_ctx->reset(_width, _height, _flags);
}

View File

@ -180,6 +180,8 @@ namespace stl
#define BGFX_STATE_INTERNAL_SCISSOR UINT64_C(0x2000000000000000)
#define BGFX_STATE_INTERNAL_OCCLUSION_QUERY UINT64_C(0x4000000000000000)
#define BGFX_SUBMIT_INTERNAL_OCCLUSION_VISIBLE UINT8_C(0x80)
#define BGFX_RENDERER_DIRECT3D9_NAME "Direct3D 9"
#define BGFX_RENDERER_DIRECT3D11_NAME "Direct3D 11"
#define BGFX_RENDERER_DIRECT3D12_NAME "Direct3D 12"
@ -1374,7 +1376,7 @@ namespace bgfx
void setCondition(OcclusionQueryHandle _handle, bool _visible)
{
m_draw.m_occlusionQuery = _handle;
BX_UNUSED(_visible);
m_draw.m_submitFlags |= _visible ? BGFX_SUBMIT_INTERNAL_OCCLUSION_VISIBLE : 0;
}
void setStencil(uint32_t _fstencil, uint32_t _bstencil)

View File

@ -2729,10 +2729,10 @@ BX_PRAGMA_DIAGNOSTIC_POP();
return sampler;
}
bool isVisible(OcclusionQueryHandle _handle)
bool isVisible(OcclusionQueryHandle _handle, bool _visible)
{
m_occlusionQuery.resolve();
return m_occlusion[_handle.idx];
return _visible == m_occlusion[_handle.idx];
}
DXGI_FORMAT getBufferFormat()
@ -5053,7 +5053,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
const bool hasOcclusionQuery = 0 != (draw.m_stateFlags & BGFX_STATE_INTERNAL_OCCLUSION_QUERY);
if (isValid(draw.m_occlusionQuery)
&& !hasOcclusionQuery
&& !isVisible(draw.m_occlusionQuery) )
&& !isVisible(draw.m_occlusionQuery, 0 != (draw.m_submitFlags&BGFX_SUBMIT_INTERNAL_OCCLUSION_VISIBLE) ) )
{
continue;
}

View File

@ -1565,10 +1565,10 @@ namespace bgfx { namespace d3d9
}
}
bool isVisible(OcclusionQueryHandle _handle)
bool isVisible(OcclusionQueryHandle _handle, bool _visible)
{
m_occlusionQuery.resolve();
return m_occlusion[_handle.idx];
return _visible == m_occlusion[_handle.idx];
}
void capturePreReset()
@ -3539,7 +3539,7 @@ namespace bgfx { namespace d3d9
const bool hasOcclusionQuery = 0 != (draw.m_stateFlags & BGFX_STATE_INTERNAL_OCCLUSION_QUERY);
if (isValid(draw.m_occlusionQuery)
&& !hasOcclusionQuery
&& !isVisible(draw.m_occlusionQuery) )
&& !isVisible(draw.m_occlusionQuery, 0 != (draw.m_submitFlags&BGFX_SUBMIT_INTERNAL_OCCLUSION_VISIBLE) ) )
{
continue;
}

View File

@ -2712,10 +2712,10 @@ namespace bgfx { namespace gl
}
}
bool isVisible(OcclusionQueryHandle _handle)
bool isVisible(OcclusionQueryHandle _handle, bool _visible)
{
m_occlusionQuery.resolve();
return m_occlusion[_handle.idx];
return _visible == m_occlusion[_handle.idx];
}
void ovrPostReset()
@ -5605,7 +5605,7 @@ namespace bgfx { namespace gl
const bool hasOcclusionQuery = 0 != (draw.m_stateFlags & BGFX_STATE_INTERNAL_OCCLUSION_QUERY);
if (isValid(draw.m_occlusionQuery)
&& !hasOcclusionQuery
&& !isVisible(draw.m_occlusionQuery) )
&& !isVisible(draw.m_occlusionQuery, 0 != (draw.m_submitFlags&BGFX_SUBMIT_INTERNAL_OCCLUSION_VISIBLE) ) )
{
continue;
}