This commit is contained in:
Бранимир Караџић 2020-03-18 21:39:48 -07:00
parent 7f8471e168
commit 387ac7fc25
2 changed files with 5 additions and 3 deletions

View File

@ -3421,7 +3421,7 @@ namespace bgfx
errorState = ErrorState::ContextAllocated;
s_ctx = BX_ALIGNED_NEW(g_allocator, Context, 64);
s_ctx = BX_ALIGNED_NEW(g_allocator, Context, Context::kAlignment);
if (s_ctx->init(_init) )
{
BX_TRACE("Init complete.");
@ -3434,7 +3434,7 @@ namespace bgfx
switch (errorState)
{
case ErrorState::ContextAllocated:
BX_ALIGNED_DELETE(g_allocator, s_ctx, 64);
BX_ALIGNED_DELETE(g_allocator, s_ctx, Context::kAlignment);
s_ctx = NULL;
BX_FALLTHROUGH;
@ -3470,7 +3470,7 @@ namespace bgfx
ctx->shutdown();
BX_CHECK(NULL == s_ctx, "bgfx is should be uninitialized here.");
BX_ALIGNED_DELETE(g_allocator, ctx, 64);
BX_ALIGNED_DELETE(g_allocator, ctx, Context::kAlignment);
BX_TRACE("Shutdown complete.");

View File

@ -2841,6 +2841,8 @@ constexpr uint64_t kSortKeyComputeProgramMask = uint64_t(BGFX_CONFIG_MAX_PROGRA
struct Context
{
static constexpr uint32_t kAlignment = 64;
Context()
: m_render(&m_frame[0])
, m_submit(&m_frame[BGFX_CONFIG_MULTITHREADED ? 1 : 0])