Return bgfx::RenderFrame::Timeout when internal semaphore times out and skips rendering.
This commit is contained in:
parent
1d6b4794a9
commit
7e76736082
@ -19,6 +19,7 @@ typedef enum bgfx_render_frame
|
||||
{
|
||||
BGFX_RENDER_FRAME_NO_CONTEXT,
|
||||
BGFX_RENDER_FRAME_RENDER,
|
||||
BGFX_RENDER_FRAME_TIMEOUT,
|
||||
BGFX_RENDER_FRAME_EXITING,
|
||||
|
||||
BGFX_RENDER_FRAME_COUNT
|
||||
|
@ -6,7 +6,7 @@
|
||||
#ifndef BGFX_DEFINES_H_HEADER_GUARD
|
||||
#define BGFX_DEFINES_H_HEADER_GUARD
|
||||
|
||||
#define BGFX_API_VERSION UINT32_C(35)
|
||||
#define BGFX_API_VERSION UINT32_C(36)
|
||||
|
||||
///
|
||||
#define BGFX_STATE_RGB_WRITE UINT64_C(0x0000000000000001) //!< Enable RGB write.
|
||||
|
@ -25,6 +25,7 @@ namespace bgfx
|
||||
{
|
||||
NoContext,
|
||||
Render,
|
||||
Timeout,
|
||||
Exiting,
|
||||
|
||||
Count
|
||||
|
19
src/bgfx.cpp
19
src/bgfx.cpp
@ -1032,16 +1032,16 @@ namespace bgfx
|
||||
}
|
||||
|
||||
BGFX_CHECK_RENDER_THREAD();
|
||||
if (s_ctx->renderFrame() )
|
||||
RenderFrame::Enum result = s_ctx->renderFrame(BGFX_CONFIG_API_SEMAPHORE_TIMEOUT);
|
||||
if (RenderFrame::Exiting == result)
|
||||
{
|
||||
Context* ctx = s_ctx;
|
||||
ctx->apiSemWait();
|
||||
s_ctx = NULL;
|
||||
ctx->renderSemPost();
|
||||
return RenderFrame::Exiting;
|
||||
}
|
||||
|
||||
return RenderFrame::Render;
|
||||
return result;
|
||||
}
|
||||
|
||||
BX_CHECK(false, "This call only makes sense if used with multi-threaded renderer.");
|
||||
@ -1646,7 +1646,7 @@ namespace bgfx
|
||||
return m_uniformRef[_handle.idx].m_name.getPtr();
|
||||
}
|
||||
|
||||
bool Context::renderFrame()
|
||||
RenderFrame::Enum Context::renderFrame(int32_t _msecs)
|
||||
{
|
||||
BGFX_PROFILER_SCOPE(bgfx, render_frame, 0xff2040ff);
|
||||
|
||||
@ -1658,7 +1658,7 @@ namespace bgfx
|
||||
m_flipped = true;
|
||||
}
|
||||
|
||||
if (apiSemWait(BGFX_CONFIG_API_SEMAPHORE_TIMEOUT) )
|
||||
if (apiSemWait(_msecs) )
|
||||
{
|
||||
rendererExecCommands(m_render->m_cmdPre);
|
||||
if (m_rendererInitialized)
|
||||
@ -1678,8 +1678,15 @@ namespace bgfx
|
||||
m_flipped = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return RenderFrame::Timeout;
|
||||
}
|
||||
|
||||
return m_exit;
|
||||
return m_exit
|
||||
? RenderFrame::Exiting
|
||||
: RenderFrame::Render
|
||||
;
|
||||
}
|
||||
|
||||
void rendererUpdateUniforms(RendererContextI* _renderCtx, UniformBuffer* _uniformBuffer, uint32_t _begin, uint32_t _end)
|
||||
|
@ -4041,7 +4041,7 @@ namespace bgfx
|
||||
const char* getName(UniformHandle _handle) const;
|
||||
|
||||
// render thread
|
||||
bool renderFrame();
|
||||
RenderFrame::Enum renderFrame(int32_t _msecs = -1);
|
||||
void flushTextureUpdateBatch(CommandBuffer& _cmdbuf);
|
||||
void rendererExecCommands(CommandBuffer& _cmdbuf);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user