From 387ac7fc25e4322bac3ac16f4fb0aa3e3bdbbeb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=91=D1=80=D0=B0=D0=BD=D0=B8=D0=BC=D0=B8=D1=80=20=D0=9A?= =?UTF-8?q?=D0=B0=D1=80=D0=B0=D1=9F=D0=B8=D1=9B?= Date: Wed, 18 Mar 2020 21:39:48 -0700 Subject: [PATCH] Cleanup. --- src/bgfx.cpp | 6 +++--- src/bgfx_p.h | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/bgfx.cpp b/src/bgfx.cpp index 1fc9023f3..94ea6753b 100644 --- a/src/bgfx.cpp +++ b/src/bgfx.cpp @@ -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."); diff --git a/src/bgfx_p.h b/src/bgfx_p.h index 968dfb9e7..072252cc4 100644 --- a/src/bgfx_p.h +++ b/src/bgfx_p.h @@ -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])