Бранимир Караџић 5 rokov pred
rodič
commit
387ac7fc25
2 zmenil súbory, kde vykonal 5 pridanie a 3 odobranie
  1. 3 3
      src/bgfx.cpp
  2. 2 0
      src/bgfx_p.h

+ 3 - 3
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.");
 

+ 2 - 0
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])