This commit is contained in:
bkaradzic 2012-05-31 22:10:32 -07:00
parent a48b3a9ee3
commit 63a76ae99d
5 changed files with 22 additions and 45 deletions

View file

@ -528,10 +528,10 @@ namespace bgfx
s_ctx.frame();
}
void renderFrame()
bool renderFrame()
{
BGFX_RENDER_THREAD();
s_ctx.renderFrame();
return s_ctx.renderFrame();
}
static const uint32_t s_attribTypeSize[AttribType::Count] =
@ -730,6 +730,16 @@ namespace bgfx
m_render->destroy();
}
#if BX_PLATFORM_WINDOWS
DWORD WINAPI renderThread(LPVOID)
#else
void* renderThread(void*)
#endif // BX_PLATFORM_WINDOWS
{
while (!renderFrame() );
return EXIT_SUCCESS;
}
const Memory* alloc(uint32_t _size)
{
Memory* mem = (Memory*)g_realloc(NULL, sizeof(Memory) + _size);

View file

@ -114,11 +114,10 @@ namespace bgfx
extern freeFn g_free;
extern cacheFn g_cache;
extern void fatal(bgfx::Fatal::Enum _code, const char* _format, ...);
extern void release(Memory* _mem);
extern void saveTga(const char* _filePath, uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _data);
extern const char* getAttribName(Attrib::Enum _attr);
extern void renderFrame();
void fatal(bgfx::Fatal::Enum _code, const char* _format, ...);
void release(Memory* _mem);
void saveTga(const char* _filePath, uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _data);
const char* getAttribName(Attrib::Enum _attr);
inline uint32_t uint16_min(uint16_t _a, uint16_t _b)
{
@ -1324,6 +1323,7 @@ namespace bgfx
, m_frames(0)
, m_debug(BGFX_DEBUG_NONE)
, m_rendererInitialized(false)
, m_exit(false)
{
}
@ -1880,7 +1880,7 @@ namespace bgfx
void flip();
// render thread
void renderFrame()
bool renderFrame()
{
flip();
@ -1894,6 +1894,8 @@ namespace bgfx
rendererExecCommands(m_render->m_cmdPost);
renderSemPost();
return m_exit;
}
void rendererInit();
@ -1972,6 +1974,7 @@ namespace bgfx
{
rendererShutdown();
m_rendererInitialized = false;
m_exit = true;
}
break;
@ -2544,6 +2547,7 @@ namespace bgfx
#endif // BX_PLATFORM_WINDOWS
bool m_rendererInitialized;
bool m_exit;
};
} // namespace bgfx

View file

@ -1158,20 +1158,6 @@ namespace bgfx
DX_CHECK(s_renderCtx.m_device->SetTexture(_stage, m_colorTexture) );
}
static bool s_exit = false;
DWORD WINAPI renderThread(LPVOID _arg)
{
while (!s_exit)
{
renderFrame();
}
s_exit = false;
return EXIT_SUCCESS;
}
void ConstantBuffer::commit(bool _force)
{
reset();
@ -1316,7 +1302,6 @@ namespace bgfx
void Context::rendererShutdown()
{
s_renderCtx.shutdown();
s_exit = true;
}
void Context::rendererCreateIndexBuffer(IndexBufferHandle _handle, Memory* _mem)

View file

@ -1210,8 +1210,6 @@ namespace bgfx
m_depth.destroy();
}
static bool s_exit = false;
void ConstantBuffer::commit(bool _force)
{
reset();
@ -1444,7 +1442,6 @@ namespace bgfx
void Context::rendererShutdown()
{
s_exit = true;
}
void Context::rendererCreateIndexBuffer(IndexBufferHandle _handle, Memory* _mem)
@ -2137,22 +2134,6 @@ namespace bgfx
GREMEDY_FRAMETERMINATOR();
}
#if BX_PLATFORM_WINDOWS
DWORD WINAPI renderThread(LPVOID)
#else
void* renderThread(void*)
#endif // BX_PLATFORM_WINDOWS
{
while (!s_exit)
{
renderFrame();
}
s_exit = false;
return 0;
}
}
#endif // (BGFX_CONFIG_RENDERER_OPENGLES|BGFX_CONFIG_RENDERER_OPENGL)

View file

@ -9,8 +9,6 @@
namespace bgfx
{
static bool s_exit = false;
void ConstantBuffer::commit(bool _force)
{
}
@ -33,7 +31,6 @@ namespace bgfx
void Context::rendererShutdown()
{
s_exit = true;
}
void Context::rendererCreateIndexBuffer(IndexBufferHandle _handle, Memory* _mem)