Fixed issue #313.

This commit is contained in:
Branimir Karadžić 2015-03-30 20:36:31 -07:00
parent ec9ba5d15b
commit 590996b704

View file

@ -117,6 +117,11 @@ int _main_(int /*_argc*/, char** /*_argv*/)
, 0
);
const bgfx::Caps* caps = bgfx::getCaps();
const bool computeSupported = !!(caps->supported & BGFX_CAPS_COMPUTE);
if (computeSupported)
{
// Imgui.
imguiCreate();
@ -320,6 +325,30 @@ int _main_(int /*_argc*/, char** /*_argv*/)
bgfx::destroyIndexBuffer(ibh);
bgfx::destroyVertexBuffer(vbh);
bgfx::destroyProgram(particleProgram);
}
else
{
int64_t timeOffset = bx::getHPCounter();
entry::MouseState mouseState;
while (!entry::processEvents(width, height, debug, reset, &mouseState) )
{
int64_t now = bx::getHPCounter();
float time = (float)( (now - timeOffset)/double(bx::getHPFrequency() ) );
bgfx::setViewRect(0, 0, 0, width, height);
bgfx::dbgTextClear();
bgfx::dbgTextPrintf(0, 1, 0x4f, "bgfx/examples/24-nbody");
bgfx::dbgTextPrintf(0, 2, 0x6f, "Description: N-body simulation with compute shaders using buffers.");
bool blink = uint32_t(time*3.0f)&1;
bgfx::dbgTextPrintf(0, 5, blink ? 0x1f : 0x01, " Compute is not supported by GPU. ");
bgfx::submit(0);
bgfx::frame();
}
}
// Shutdown bgfx.
bgfx::shutdown();