From 184a3ecf2a98adaeb3fe4df05d3dfbda8448475b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Thu, 31 Oct 2024 00:36:03 +0100 Subject: [PATCH] Code fixes. Correct the UWP fix --- Common/DbgNew.h | 5 ++++- Common/GPU/OpenGL/thin3d_gl.cpp | 2 +- ext/imgui/imgui.h | 8 ++++++-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/Common/DbgNew.h b/Common/DbgNew.h index 3bb0851c3b..13f603fd1c 100644 --- a/Common/DbgNew.h +++ b/Common/DbgNew.h @@ -1,11 +1,14 @@ #pragma once +#include + // Utility file for using the MS CRT's memory tracking. // crtdbg.h overloads malloc with malloc_dbg etc, but does not catch new. So here we go. // To add a full check of memory overruns, throw in a _CrtCheckMemory(). Useful to narrow things down. -#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) && WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP +#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) + #include #if defined(_DEBUG) diff --git a/Common/GPU/OpenGL/thin3d_gl.cpp b/Common/GPU/OpenGL/thin3d_gl.cpp index e7e0ecc7f8..7319881181 100644 --- a/Common/GPU/OpenGL/thin3d_gl.cpp +++ b/Common/GPU/OpenGL/thin3d_gl.cpp @@ -444,7 +444,7 @@ public: void DrawIndexed(int vertexCount, int offset) override; void DrawUP(const void *vdata, int vertexCount) override; void DrawIndexedUP(const void *vdata, int vertexCount, const void *idata, int indexCount, IndexFormat ifmt) override; - void DrawIndexedClippedBatchUP(const void *vdata, int vertexCount, const void *idata, int indexCount, IndexFormat ifmt, Slice draws); + void DrawIndexedClippedBatchUP(const void *vdata, int vertexCount, const void *idata, int indexCount, IndexFormat ifmt, Slice draws) override; void Clear(int mask, uint32_t colorval, float depthVal, int stencilVal) override; diff --git a/ext/imgui/imgui.h b/ext/imgui/imgui.h index 4716b2cd3b..6b41c09734 100644 --- a/ext/imgui/imgui.h +++ b/ext/imgui/imgui.h @@ -1947,18 +1947,22 @@ struct ImGuiTableColumnSortSpecs // Defining a custom placement new() with a custom parameter allows us to bypass including which on some platforms complains when user has disabled exceptions. //----------------------------------------------------------------------------- +#ifdef _WIN32 #undef new +#endif struct ImNewWrapper {}; inline void* operator new(size_t, ImNewWrapper, void* ptr) { return ptr; } inline void operator delete(void*, ImNewWrapper, void*) {} // This is only required so we can use the symmetrical new() #define IM_ALLOC(_SIZE) ImGui::MemAlloc(_SIZE) #define IM_FREE(_PTR) ImGui::MemFree(_PTR) -#define IM_PLACEMENT_NEW(_PTR) new(ImNewWrapper(), _PTR) -#define IM_NEW(_TYPE) new(ImNewWrapper(), ImGui::MemAlloc(sizeof(_TYPE))) _TYPE +#define IM_PLACEMENT_NEW(_PTR) new(ImNewWrapper{}, _PTR) +#define IM_NEW(_TYPE) new(ImNewWrapper{}, ImGui::MemAlloc(sizeof(_TYPE))) _TYPE template void IM_DELETE(T* p) { if (p) { p->~T(); ImGui::MemFree(p); } } +#ifdef _WIN32 #include "Common/DbgNew.h" +#endif //----------------------------------------------------------------------------- // ImVector<>