mirror of
https://gitlab.com/Mr_Goldberg/goldberg_emulator.git
synced 2024-11-14 10:50:13 +01:00
Add a return parameter to ImGui_Impl...._NewFrame()
Why does CreateDeviceObjects return a bool if the NewFrame doesn't ? Added the return parameter cause CreateDeviceObjects can fail. It did fail on DX11 with feature level to 9.
This commit is contained in:
parent
20c03cda75
commit
548f21c2f0
10 changed files with 26 additions and 16 deletions
|
@ -63,7 +63,7 @@
|
||||||
#define _CRT_SECURE_NO_WARNINGS
|
#define _CRT_SECURE_NO_WARNINGS
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "imgui.h"
|
#include "../imgui.h"
|
||||||
#include "imgui_impl_opengl3.h"
|
#include "imgui_impl_opengl3.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#if defined(_MSC_VER) && _MSC_VER <= 1500 // MSVC 2008 or earlier
|
#if defined(_MSC_VER) && _MSC_VER <= 1500 // MSVC 2008 or earlier
|
||||||
|
@ -162,10 +162,12 @@ void ImGui_ImplOpenGL3_Shutdown()
|
||||||
ImGui_ImplOpenGL3_DestroyDeviceObjects();
|
ImGui_ImplOpenGL3_DestroyDeviceObjects();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImGui_ImplOpenGL3_NewFrame()
|
bool ImGui_ImplOpenGL3_NewFrame()
|
||||||
{
|
{
|
||||||
if (!g_FontTexture)
|
if (!g_FontTexture)
|
||||||
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)
|
static void ImGui_ImplOpenGL3_SetupRenderState(ImDrawData* draw_data, int fb_width, int fb_height, GLuint vertex_array_object)
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
|
|
||||||
IMGUI_IMPL_API bool ImGui_ImplOpenGL3_Init(const char* glsl_version = NULL);
|
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_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);
|
IMGUI_IMPL_API void ImGui_ImplOpenGL3_RenderDrawData(ImDrawData* draw_data);
|
||||||
|
|
||||||
// Called by Init/NewFrame/Shutdown
|
// Called by Init/NewFrame/Shutdown
|
||||||
|
|
|
@ -548,8 +548,10 @@ void ImGui_ImplDX10_Shutdown()
|
||||||
if (g_pd3dDevice) { g_pd3dDevice->Release(); g_pd3dDevice = NULL; }
|
if (g_pd3dDevice) { g_pd3dDevice->Release(); g_pd3dDevice = NULL; }
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImGui_ImplDX10_NewFrame()
|
bool ImGui_ImplDX10_NewFrame()
|
||||||
{
|
{
|
||||||
if (!g_pFontSampler)
|
if (!g_pFontSampler)
|
||||||
ImGui_ImplDX10_CreateDeviceObjects();
|
return ImGui_ImplDX10_CreateDeviceObjects();
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ struct ID3D10Device;
|
||||||
|
|
||||||
IMGUI_IMPL_API bool ImGui_ImplDX10_Init(ID3D10Device* device);
|
IMGUI_IMPL_API bool ImGui_ImplDX10_Init(ID3D10Device* device);
|
||||||
IMGUI_IMPL_API void ImGui_ImplDX10_Shutdown();
|
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);
|
IMGUI_IMPL_API void ImGui_ImplDX10_RenderDrawData(ImDrawData* draw_data);
|
||||||
|
|
||||||
// Use if you want to reset your rendering device without losing ImGui state.
|
// Use if you want to reset your rendering device without losing ImGui state.
|
||||||
|
|
|
@ -556,8 +556,10 @@ void ImGui_ImplDX11_Shutdown()
|
||||||
if (g_pd3dDeviceContext) { g_pd3dDeviceContext->Release(); g_pd3dDeviceContext = NULL; }
|
if (g_pd3dDeviceContext) { g_pd3dDeviceContext->Release(); g_pd3dDeviceContext = NULL; }
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImGui_ImplDX11_NewFrame()
|
bool ImGui_ImplDX11_NewFrame()
|
||||||
{
|
{
|
||||||
if (!g_pFontSampler)
|
if (!g_pFontSampler)
|
||||||
ImGui_ImplDX11_CreateDeviceObjects();
|
return ImGui_ImplDX11_CreateDeviceObjects();
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ struct ID3D11DeviceContext;
|
||||||
|
|
||||||
IMGUI_IMPL_API bool ImGui_ImplDX11_Init(ID3D11Device* device, ID3D11DeviceContext* device_context);
|
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_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);
|
IMGUI_IMPL_API void ImGui_ImplDX11_RenderDrawData(ImDrawData* draw_data);
|
||||||
|
|
||||||
// Use if you want to reset your rendering device without losing ImGui state.
|
// Use if you want to reset your rendering device without losing ImGui state.
|
||||||
|
|
|
@ -668,8 +668,10 @@ void ImGui_ImplDX12_Shutdown()
|
||||||
g_frameIndex = UINT_MAX;
|
g_frameIndex = UINT_MAX;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImGui_ImplDX12_NewFrame()
|
bool ImGui_ImplDX12_NewFrame()
|
||||||
{
|
{
|
||||||
if (!g_pPipelineState)
|
if (!g_pPipelineState)
|
||||||
ImGui_ImplDX12_CreateDeviceObjects();
|
return ImGui_ImplDX12_CreateDeviceObjects();
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@ struct D3D12_GPU_DESCRIPTOR_HANDLE;
|
||||||
IMGUI_IMPL_API bool ImGui_ImplDX12_Init(ID3D12Device* device, int num_frames_in_flight, DXGI_FORMAT rtv_format,
|
IMGUI_IMPL_API bool ImGui_ImplDX12_Init(ID3D12Device* device, int num_frames_in_flight, DXGI_FORMAT rtv_format,
|
||||||
D3D12_CPU_DESCRIPTOR_HANDLE font_srv_cpu_desc_handle, D3D12_GPU_DESCRIPTOR_HANDLE font_srv_gpu_desc_handle);
|
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_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);
|
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 ImGui state.
|
// Use if you want to reset your rendering device without losing ImGui state.
|
||||||
|
|
|
@ -277,8 +277,10 @@ 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.
|
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)
|
if (!g_FontTexture)
|
||||||
ImGui_ImplDX9_CreateDeviceObjects();
|
return ImGui_ImplDX9_CreateDeviceObjects();
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ struct IDirect3DDevice9;
|
||||||
|
|
||||||
IMGUI_IMPL_API bool ImGui_ImplDX9_Init(IDirect3DDevice9* device);
|
IMGUI_IMPL_API bool ImGui_ImplDX9_Init(IDirect3DDevice9* device);
|
||||||
IMGUI_IMPL_API void ImGui_ImplDX9_Shutdown();
|
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);
|
IMGUI_IMPL_API void ImGui_ImplDX9_RenderDrawData(ImDrawData* draw_data);
|
||||||
|
|
||||||
// Use if you want to reset your rendering device without losing ImGui state.
|
// Use if you want to reset your rendering device without losing ImGui state.
|
||||||
|
|
Loading…
Reference in a new issue