mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2025-02-16 11:50:19 -05:00
Fixed issue #313.
This commit is contained in:
parent
ec9ba5d15b
commit
590996b704
1 changed files with 212 additions and 183 deletions
|
@ -117,6 +117,11 @@ int _main_(int /*_argc*/, char** /*_argv*/)
|
||||||
, 0
|
, 0
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const bgfx::Caps* caps = bgfx::getCaps();
|
||||||
|
const bool computeSupported = !!(caps->supported & BGFX_CAPS_COMPUTE);
|
||||||
|
|
||||||
|
if (computeSupported)
|
||||||
|
{
|
||||||
// Imgui.
|
// Imgui.
|
||||||
imguiCreate();
|
imguiCreate();
|
||||||
|
|
||||||
|
@ -320,6 +325,30 @@ int _main_(int /*_argc*/, char** /*_argv*/)
|
||||||
bgfx::destroyIndexBuffer(ibh);
|
bgfx::destroyIndexBuffer(ibh);
|
||||||
bgfx::destroyVertexBuffer(vbh);
|
bgfx::destroyVertexBuffer(vbh);
|
||||||
bgfx::destroyProgram(particleProgram);
|
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.
|
// Shutdown bgfx.
|
||||||
bgfx::shutdown();
|
bgfx::shutdown();
|
||||||
|
|
Loading…
Reference in a new issue