From cfff531a23884dd0d4a669383389c09912596286 Mon Sep 17 00:00:00 2001 From: Mr_Goldberg Date: Sat, 23 Jan 2021 16:46:44 -0500 Subject: [PATCH] Put back the if new frame for overlay. --- ImGui/impls/imgui_impl_opengl3.cpp | 5 +++-- ImGui/impls/imgui_impl_opengl3.h | 2 +- ImGui/impls/windows/imgui_impl_dx10.cpp | 6 ++++-- ImGui/impls/windows/imgui_impl_dx10.h | 2 +- ImGui/impls/windows/imgui_impl_dx11.cpp | 5 +++-- ImGui/impls/windows/imgui_impl_dx11.h | 2 +- ImGui/impls/windows/imgui_impl_dx12.cpp | 5 +++-- ImGui/impls/windows/imgui_impl_dx12.h | 2 +- ImGui/impls/windows/imgui_impl_dx9.cpp | 5 +++-- ImGui/impls/windows/imgui_impl_dx9.h | 2 +- overlay_experimental/windows/DX10_Hook.cpp | 3 +-- overlay_experimental/windows/DX11_Hook.cpp | 3 +-- overlay_experimental/windows/DX12_Hook.cpp | 3 +-- overlay_experimental/windows/DX9_Hook.cpp | 3 +-- overlay_experimental/windows/OpenGL_Hook.cpp | 3 +-- 15 files changed, 26 insertions(+), 25 deletions(-) diff --git a/ImGui/impls/imgui_impl_opengl3.cpp b/ImGui/impls/imgui_impl_opengl3.cpp index 77e1a60a..c0ff9e21 100644 --- a/ImGui/impls/imgui_impl_opengl3.cpp +++ b/ImGui/impls/imgui_impl_opengl3.cpp @@ -221,10 +221,11 @@ void ImGui_ImplOpenGL3_Shutdown() ImGui_ImplOpenGL3_DestroyDeviceObjects(); } -void ImGui_ImplOpenGL3_NewFrame() +bool ImGui_ImplOpenGL3_NewFrame() { if (!g_ShaderHandle) - ImGui_ImplOpenGL3_CreateDeviceObjects(); + return ImGui_ImplOpenGL3_CreateDeviceObjects(); + return true; } static void ImGui_ImplOpenGL3_SetupRenderState(ImDrawData* draw_data, int fb_width, int fb_height, GLuint vertex_array_object) diff --git a/ImGui/impls/imgui_impl_opengl3.h b/ImGui/impls/imgui_impl_opengl3.h index c4080c5e..6b5e9250 100644 --- a/ImGui/impls/imgui_impl_opengl3.h +++ b/ImGui/impls/imgui_impl_opengl3.h @@ -27,7 +27,7 @@ // Backend API IMGUI_IMPL_API bool ImGui_ImplOpenGL3_Init(const char* glsl_version = NULL); IMGUI_IMPL_API void ImGui_ImplOpenGL3_Shutdown(); -IMGUI_IMPL_API void ImGui_ImplOpenGL3_NewFrame(); +IMGUI_IMPL_API bool ImGui_ImplOpenGL3_NewFrame(); IMGUI_IMPL_API void ImGui_ImplOpenGL3_RenderDrawData(ImDrawData* draw_data); // (Optional) Called by Init/NewFrame/Shutdown diff --git a/ImGui/impls/windows/imgui_impl_dx10.cpp b/ImGui/impls/windows/imgui_impl_dx10.cpp index 3ab7c6d9..5b0e9bd1 100644 --- a/ImGui/impls/windows/imgui_impl_dx10.cpp +++ b/ImGui/impls/windows/imgui_impl_dx10.cpp @@ -467,8 +467,10 @@ void ImGui_ImplDX10_Shutdown() if (g_pd3dDevice) { g_pd3dDevice->Release(); g_pd3dDevice = NULL; } } -void ImGui_ImplDX10_NewFrame() +bool ImGui_ImplDX10_NewFrame() { if (!g_pFontSampler) - ImGui_ImplDX10_CreateDeviceObjects(); + return ImGui_ImplDX10_CreateDeviceObjects(); + + return true; } diff --git a/ImGui/impls/windows/imgui_impl_dx10.h b/ImGui/impls/windows/imgui_impl_dx10.h index 142fa8d9..007071a3 100644 --- a/ImGui/impls/windows/imgui_impl_dx10.h +++ b/ImGui/impls/windows/imgui_impl_dx10.h @@ -16,7 +16,7 @@ struct ID3D10Device; IMGUI_IMPL_API bool ImGui_ImplDX10_Init(ID3D10Device* device); IMGUI_IMPL_API void ImGui_ImplDX10_Shutdown(); -IMGUI_IMPL_API void ImGui_ImplDX10_NewFrame(); +IMGUI_IMPL_API bool ImGui_ImplDX10_NewFrame(); IMGUI_IMPL_API void ImGui_ImplDX10_RenderDrawData(ImDrawData* draw_data); // Use if you want to reset your rendering device without losing Dear ImGui state. diff --git a/ImGui/impls/windows/imgui_impl_dx11.cpp b/ImGui/impls/windows/imgui_impl_dx11.cpp index b37cb0fb..cff5a8b1 100644 --- a/ImGui/impls/windows/imgui_impl_dx11.cpp +++ b/ImGui/impls/windows/imgui_impl_dx11.cpp @@ -595,8 +595,9 @@ void ImGui_ImplDX11_Shutdown() if (g_pd3dDeviceContext) { g_pd3dDeviceContext->Release(); g_pd3dDeviceContext = NULL; } } -void ImGui_ImplDX11_NewFrame() +bool ImGui_ImplDX11_NewFrame() { if (!g_pFontSampler) - ImGui_ImplDX11_CreateDeviceObjects(); + return ImGui_ImplDX11_CreateDeviceObjects(); + return true; } diff --git a/ImGui/impls/windows/imgui_impl_dx11.h b/ImGui/impls/windows/imgui_impl_dx11.h index 509b8992..dcdefa35 100644 --- a/ImGui/impls/windows/imgui_impl_dx11.h +++ b/ImGui/impls/windows/imgui_impl_dx11.h @@ -17,7 +17,7 @@ struct ID3D11DeviceContext; IMGUI_IMPL_API bool ImGui_ImplDX11_Init(ID3D11Device* device, ID3D11DeviceContext* device_context); IMGUI_IMPL_API void ImGui_ImplDX11_Shutdown(); -IMGUI_IMPL_API void ImGui_ImplDX11_NewFrame(); +IMGUI_IMPL_API bool ImGui_ImplDX11_NewFrame(); IMGUI_IMPL_API void ImGui_ImplDX11_RenderDrawData(ImDrawData* draw_data); // Use if you want to reset your rendering device without losing Dear ImGui state. diff --git a/ImGui/impls/windows/imgui_impl_dx12.cpp b/ImGui/impls/windows/imgui_impl_dx12.cpp index c323f022..1eb43562 100644 --- a/ImGui/impls/windows/imgui_impl_dx12.cpp +++ b/ImGui/impls/windows/imgui_impl_dx12.cpp @@ -634,8 +634,9 @@ void ImGui_ImplDX12_Shutdown() g_frameIndex = UINT_MAX; } -void ImGui_ImplDX12_NewFrame() +bool ImGui_ImplDX12_NewFrame() { if (!g_pPipelineState) - ImGui_ImplDX12_CreateDeviceObjects(); + return ImGui_ImplDX12_CreateDeviceObjects(); + return true; } diff --git a/ImGui/impls/windows/imgui_impl_dx12.h b/ImGui/impls/windows/imgui_impl_dx12.h index 88c78dcd..d71ac7be 100644 --- a/ImGui/impls/windows/imgui_impl_dx12.h +++ b/ImGui/impls/windows/imgui_impl_dx12.h @@ -35,7 +35,7 @@ struct D3D12_GPU_DESCRIPTOR_HANDLE; IMGUI_IMPL_API bool ImGui_ImplDX12_Init(ID3D12Device* device, int num_frames_in_flight, DXGI_FORMAT rtv_format, ID3D12DescriptorHeap* cbv_srv_heap, D3D12_CPU_DESCRIPTOR_HANDLE font_srv_cpu_desc_handle, D3D12_GPU_DESCRIPTOR_HANDLE font_srv_gpu_desc_handle); IMGUI_IMPL_API void ImGui_ImplDX12_Shutdown(); -IMGUI_IMPL_API void ImGui_ImplDX12_NewFrame(); +IMGUI_IMPL_API bool ImGui_ImplDX12_NewFrame(); IMGUI_IMPL_API void ImGui_ImplDX12_RenderDrawData(ImDrawData* draw_data, ID3D12GraphicsCommandList* graphics_command_list); // Use if you want to reset your rendering device without losing Dear ImGui state. diff --git a/ImGui/impls/windows/imgui_impl_dx9.cpp b/ImGui/impls/windows/imgui_impl_dx9.cpp index 159c1462..dcb38a9c 100644 --- a/ImGui/impls/windows/imgui_impl_dx9.cpp +++ b/ImGui/impls/windows/imgui_impl_dx9.cpp @@ -277,8 +277,9 @@ void ImGui_ImplDX9_InvalidateDeviceObjects() if (g_FontTexture) { g_FontTexture->Release(); g_FontTexture = NULL; ImGui::GetIO().Fonts->TexID = NULL; } // We copied g_pFontTextureView to io.Fonts->TexID so let's clear that as well. } -void ImGui_ImplDX9_NewFrame() +bool ImGui_ImplDX9_NewFrame() { if (!g_FontTexture) - ImGui_ImplDX9_CreateDeviceObjects(); + return ImGui_ImplDX9_CreateDeviceObjects(); + return true; } diff --git a/ImGui/impls/windows/imgui_impl_dx9.h b/ImGui/impls/windows/imgui_impl_dx9.h index b622a64d..981f3bbc 100644 --- a/ImGui/impls/windows/imgui_impl_dx9.h +++ b/ImGui/impls/windows/imgui_impl_dx9.h @@ -16,7 +16,7 @@ struct IDirect3DDevice9; IMGUI_IMPL_API bool ImGui_ImplDX9_Init(IDirect3DDevice9* device); IMGUI_IMPL_API void ImGui_ImplDX9_Shutdown(); -IMGUI_IMPL_API void ImGui_ImplDX9_NewFrame(); +IMGUI_IMPL_API bool ImGui_ImplDX9_NewFrame(); IMGUI_IMPL_API void ImGui_ImplDX9_RenderDrawData(ImDrawData* draw_data); // Use if you want to reset your rendering device without losing Dear ImGui state. diff --git a/overlay_experimental/windows/DX10_Hook.cpp b/overlay_experimental/windows/DX10_Hook.cpp index 96b3f663..924cc4d2 100644 --- a/overlay_experimental/windows/DX10_Hook.cpp +++ b/overlay_experimental/windows/DX10_Hook.cpp @@ -80,8 +80,7 @@ void DX10_Hook::prepareForOverlay(IDXGISwapChain* pSwapChain) initialized = true; } - ImGui_ImplDX10_NewFrame(); - + if (ImGui_ImplDX10_NewFrame()) { Windows_Hook::Inst()->prepareForOverlay(desc.OutputWindow); diff --git a/overlay_experimental/windows/DX11_Hook.cpp b/overlay_experimental/windows/DX11_Hook.cpp index 88566e49..db9c6e58 100644 --- a/overlay_experimental/windows/DX11_Hook.cpp +++ b/overlay_experimental/windows/DX11_Hook.cpp @@ -121,8 +121,7 @@ void DX11_Hook::prepareForOverlay(IDXGISwapChain* pSwapChain) initialized = true; } - ImGui_ImplDX11_NewFrame(); - + if (ImGui_ImplDX11_NewFrame()) { Windows_Hook::Inst()->prepareForOverlay(desc.OutputWindow); diff --git a/overlay_experimental/windows/DX12_Hook.cpp b/overlay_experimental/windows/DX12_Hook.cpp index 65434660..80813317 100644 --- a/overlay_experimental/windows/DX12_Hook.cpp +++ b/overlay_experimental/windows/DX12_Hook.cpp @@ -176,8 +176,7 @@ void DX12_Hook::prepareForOverlay(IDXGISwapChain* pSwapChain) pDevice->Release(); } - ImGui_ImplDX12_NewFrame(); - + if (ImGui_ImplDX12_NewFrame()) { Windows_Hook::Inst()->prepareForOverlay(sc_desc.OutputWindow); diff --git a/overlay_experimental/windows/DX9_Hook.cpp b/overlay_experimental/windows/DX9_Hook.cpp index 213e1e27..a3a65f44 100644 --- a/overlay_experimental/windows/DX9_Hook.cpp +++ b/overlay_experimental/windows/DX9_Hook.cpp @@ -75,8 +75,7 @@ void DX9_Hook::prepareForOverlay(IDirect3DDevice9 *pDevice) initialized = true; } - ImGui_ImplDX9_NewFrame(); - + if (ImGui_ImplDX9_NewFrame()) { Windows_Hook::Inst()->prepareForOverlay(param.hFocusWindow); diff --git a/overlay_experimental/windows/OpenGL_Hook.cpp b/overlay_experimental/windows/OpenGL_Hook.cpp index a06fded4..0b8ac081 100644 --- a/overlay_experimental/windows/OpenGL_Hook.cpp +++ b/overlay_experimental/windows/OpenGL_Hook.cpp @@ -84,8 +84,7 @@ void OpenGL_Hook::prepareForOverlay(HDC hDC) initialized = true; } - ImGui_ImplOpenGL3_NewFrame(); - + if (ImGui_ImplOpenGL3_NewFrame()) { Windows_Hook::Inst()->prepareForOverlay(hWnd);