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 77e1a60..c0ff9e2 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 c4080c5..6b5e925 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 3ab7c6d..5b0e9bd 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 142fa8d..007071a 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 b37cb0f..cff5a8b 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 509b899..dcdefa3 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 c323f02..1eb4356 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 88c78dc..d71ac7b 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 159c146..dcb38a9 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 b622a64..981f3bb 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 96b3f66..924cc4d 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 88566e4..db9c6e5 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 6543466..8081331 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 213e1e2..a3a65f4 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 a06fded..0b8ac08 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);