Frontend: Prevent drawing imgui into the vram texture

This commit is contained in:
Connor McLaughlin 2019-10-04 22:27:18 +10:00
parent 4fa79f1503
commit 004c22f031
6 changed files with 19 additions and 19 deletions

View File

@ -139,9 +139,9 @@ void GPU::ResetGraphicsAPIState() {}
void GPU::RestoreGraphicsAPIState() {}
void GPU::RenderStatistics() {}
void GPU::DrawStatistics() {}
void GPU::RenderDebugMenu()
void GPU::DrawDebugMenu()
{
ImGui::MenuItem("Show VRAM", nullptr, &m_debug_options.show_vram);
ImGui::MenuItem("Dump CPU to VRAM Copies", nullptr, &m_debug_options.dump_cpu_to_vram_copies);

View File

@ -40,10 +40,10 @@ public:
virtual void RestoreGraphicsAPIState();
// Render statistics debug window.
virtual void RenderStatistics();
virtual void DrawStatistics();
// Manipulating debug options.
virtual void RenderDebugMenu();
virtual void DrawDebugMenu();
// Called when settings change.
virtual void UpdateSettings();

View File

@ -68,9 +68,9 @@ void GPU_HW_OpenGL::RestoreGraphicsAPIState()
glBindVertexArray(m_vao_id);
}
void GPU_HW_OpenGL::RenderStatistics()
void GPU_HW_OpenGL::DrawStatistics()
{
GPU_HW::RenderStatistics();
GPU_HW::DrawStatistics();
ImGui::SetNextWindowSize(ImVec2(300.0f, 130.0f), ImGuiCond_Once);

View File

@ -19,7 +19,7 @@ public:
void ResetGraphicsAPIState() override;
void RestoreGraphicsAPIState() override;
void RenderStatistics() override;
void DrawStatistics() override;
void UpdateSettings() override;
protected:

View File

@ -388,6 +388,8 @@ bool SDLInterface::PassEventToImGui(const SDL_Event* event)
void SDLInterface::Render()
{
DrawImGui();
m_system->GetGPU()->ResetGraphicsAPIState();
glBindFramebuffer(GL_FRAMEBUFFER, 0);
@ -396,8 +398,6 @@ void SDLInterface::Render()
RenderDisplay();
RenderImGui();
ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData());
SDL_GL_SwapWindow(m_window);
@ -459,19 +459,19 @@ void SDLInterface::RenderDisplay()
glDrawArrays(GL_TRIANGLES, 0, 3);
}
void SDLInterface::RenderImGui()
void SDLInterface::DrawImGui()
{
RenderMainMenuBar();
DrawMainMenuBar();
if (m_show_gpu_statistics)
m_system->GetGPU()->RenderStatistics();
m_system->GetGPU()->DrawStatistics();
RenderOSDMessages();
DrawOSDMessages();
ImGui::Render();
}
void SDLInterface::RenderMainMenuBar()
void SDLInterface::DrawMainMenuBar()
{
if (!ImGui::BeginMainMenuBar())
return;
@ -555,7 +555,7 @@ void SDLInterface::RenderMainMenuBar()
ImGui::MenuItem("Show Statistics", nullptr, &m_show_gpu_statistics);
ImGui::Separator();
m_system->GetGPU()->RenderDebugMenu();
m_system->GetGPU()->DrawDebugMenu();
ImGui::EndMenu();
}
@ -603,7 +603,7 @@ void SDLInterface::SetDisplayTexture(GL::Texture* texture, u32 offset_x, u32 off
m_display_texture_changed = true;
}
void SDLInterface::RenderOSDMessages()
void SDLInterface::DrawOSDMessages()
{
constexpr ImGuiWindowFlags window_flags = ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoInputs |
ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoSavedSettings |

View File

@ -50,7 +50,7 @@ private:
// We only pass mouse input through if it's grabbed
bool IsWindowFullscreen() const;
void RenderImGui();
void DrawImGui();
void DoLoadState(u32 index);
void DoSaveState(u32 index);
@ -58,8 +58,8 @@ private:
bool PassEventToImGui(const SDL_Event* event);
void Render();
void RenderDisplay();
void RenderMainMenuBar();
void RenderOSDMessages();
void DrawMainMenuBar();
void DrawOSDMessages();
SDL_Window* m_window = nullptr;
SDL_GLContext m_gl_context = nullptr;