mirror of
https://github.com/libretro/ppsspp.git
synced 2024-11-27 10:20:49 +00:00
GPU: Reset GPUBackend on graphics init.
This way, when using a port that doesn't support Vulkan, it doesn't just silently use upside down GL, etc.
This commit is contained in:
parent
d6da758ed3
commit
766b40aad8
@ -33,9 +33,9 @@ QTM_USE_NAMESPACE
|
||||
#include "base/NKCodeFromQt.h"
|
||||
|
||||
#include "Common/GraphicsContext.h"
|
||||
#include "Core/System.h"
|
||||
#include "Core/Core.h"
|
||||
#include "Core/Config.h"
|
||||
#include "Core/System.h"
|
||||
|
||||
// Input
|
||||
void SimulateGamepad();
|
||||
@ -44,6 +44,7 @@ class QtDummyGraphicsContext : public DummyGraphicsContext {
|
||||
public:
|
||||
QtDummyGraphicsContext() {
|
||||
draw_ = Draw::T3DCreateGLContext();
|
||||
SetGPUBackend(GPUBackend::OPENGL);
|
||||
bool success = draw_->CreatePresets();
|
||||
assert(success);
|
||||
}
|
||||
|
@ -340,6 +340,7 @@ int SDLGLGraphicsContext::Init(SDL_Window *&window, int x, int y, int mode, std:
|
||||
// Finally we can do the regular initialization.
|
||||
CheckGLExtensions();
|
||||
draw_ = Draw::T3DCreateGLContext();
|
||||
SetGPUBackend(GPUBackend::OPENGL);
|
||||
bool success = draw_->CreatePresets();
|
||||
assert(success);
|
||||
window_ = window;
|
||||
@ -468,6 +469,7 @@ bool SDLVulkanGraphicsContext::Init(SDL_Window *&window, int x, int y, int mode,
|
||||
}
|
||||
|
||||
draw_ = Draw::T3DCreateVulkanContext(vulkan_, false);
|
||||
SetGPUBackend(GPUBackend::VULKAN);
|
||||
bool success = draw_->CreatePresets();
|
||||
assert(success);
|
||||
draw_->HandleEvent(Draw::Event::GOT_BACKBUFFER, vulkan_->GetBackbufferWidth(), vulkan_->GetBackbufferHeight());
|
||||
|
@ -10,6 +10,7 @@
|
||||
|
||||
#include "Core/Config.h"
|
||||
#include "Core/Reporting.h"
|
||||
#include "Core/System.h"
|
||||
#include "Windows/GPU/D3D11Context.h"
|
||||
#include "Windows/W32Util/Misc.h"
|
||||
#include "thin3d/thin3d.h"
|
||||
@ -140,6 +141,7 @@ bool D3D11Context::Init(HINSTANCE hInst, HWND wnd, std::string *error_message) {
|
||||
#endif
|
||||
|
||||
draw_ = Draw::T3DCreateD3D11Context(device_, context_, device1_, context1_, featureLevel_, hWnd_);
|
||||
SetGPUBackend(GPUBackend::DIRECT3D11);
|
||||
bool success = draw_->CreatePresets(); // If we can run D3D11, there's a compiler installed. I think.
|
||||
assert(success);
|
||||
|
||||
|
@ -9,6 +9,7 @@
|
||||
|
||||
#include "Core/Config.h"
|
||||
#include "Core/Reporting.h"
|
||||
#include "Core/System.h"
|
||||
#include "Common/OSVersion.h"
|
||||
#include "Windows/GPU/D3D9Context.h"
|
||||
#include "Windows/W32Util/Misc.h"
|
||||
@ -165,6 +166,7 @@ bool D3D9Context::Init(HINSTANCE hInst, HWND wnd, std::string *error_message) {
|
||||
//deviceEx->SetMaximumFrameLatency(1);
|
||||
}
|
||||
draw_ = Draw::T3DCreateDX9Context(d3d_, d3dEx_, adapterId_, device_, deviceEx_);
|
||||
SetGPUBackend(GPUBackend::DIRECT3D9);
|
||||
if (!draw_->CreatePresets()) {
|
||||
// Shader compiler not installed? Return an error so we can fall back to GL.
|
||||
device_->Release();
|
||||
|
@ -362,6 +362,7 @@ bool WindowsGLContext::Init(HINSTANCE hInst, HWND window, std::string *error_mes
|
||||
|
||||
CheckGLExtensions();
|
||||
draw_ = Draw::T3DCreateGLContext();
|
||||
SetGPUBackend(GPUBackend::OPENGL);
|
||||
bool success = draw_->CreatePresets(); // if we get this far, there will always be a GLSL compiler capable of compiling these.
|
||||
assert(success);
|
||||
CHECK_GL_ERROR_IF_DEBUG();
|
||||
|
@ -51,6 +51,7 @@
|
||||
#include <sstream>
|
||||
|
||||
#include "Core/Config.h"
|
||||
#include "Core/System.h"
|
||||
#include "Common/Vulkan/VulkanLoader.h"
|
||||
#include "Common/Vulkan/VulkanContext.h"
|
||||
#include "Common/Vulkan/VulkanDebug.h"
|
||||
@ -131,6 +132,7 @@ bool WindowsVulkanContext::Init(HINSTANCE hInst, HWND hWnd, std::string *error_m
|
||||
bool splitSubmit = g_Config.bGfxDebugSplitSubmit;
|
||||
|
||||
draw_ = Draw::T3DCreateVulkanContext(g_Vulkan, splitSubmit);
|
||||
SetGPUBackend(GPUBackend::VULKAN);
|
||||
bool success = draw_->CreatePresets();
|
||||
assert(success); // Doesn't fail, we include the compiler.
|
||||
draw_->HandleEvent(Draw::Event::GOT_BACKBUFFER, g_Vulkan->GetBackbufferWidth(), g_Vulkan->GetBackbufferHeight());
|
||||
|
@ -135,6 +135,7 @@ bool AndroidEGLGraphicsContext::Init(ANativeWindow *wnd, int backbufferWidth, in
|
||||
gl->MakeCurrent();
|
||||
CheckGLExtensions();
|
||||
draw_ = Draw::T3DCreateGLContext();
|
||||
SetGPUBackend(GPUBackend::OPENGL);
|
||||
bool success = draw_->CreatePresets(); // There will always be a GLSL compiler capable of compiling these.
|
||||
assert(success);
|
||||
return true;
|
||||
@ -161,6 +162,7 @@ public:
|
||||
AndroidJavaEGLGraphicsContext() {
|
||||
CheckGLExtensions();
|
||||
draw_ = Draw::T3DCreateGLContext();
|
||||
SetGPUBackend(GPUBackend::OPENGL);
|
||||
bool success = draw_->CreatePresets();
|
||||
assert(success);
|
||||
}
|
||||
@ -339,6 +341,7 @@ bool AndroidVulkanContext::Init(ANativeWindow *wnd, int desiredBackbufferSizeX,
|
||||
bool success = true;
|
||||
if (g_Vulkan->InitObjects()) {
|
||||
draw_ = Draw::T3DCreateVulkanContext(g_Vulkan, g_Config.bGfxDebugSplitSubmit);
|
||||
SetGPUBackend(GPUBackend::VULKAN);
|
||||
success = draw_->CreatePresets(); // Doesn't fail, we ship the compiler.
|
||||
assert(success);
|
||||
draw_->HandleEvent(Draw::Event::GOT_BACKBUFFER, g_Vulkan->GetBackbufferWidth(), g_Vulkan->GetBackbufferHeight());
|
||||
|
@ -54,6 +54,7 @@ public:
|
||||
GLDummyGraphicsContext() {
|
||||
CheckGLExtensions();
|
||||
draw_ = Draw::T3DCreateGLContext();
|
||||
SetGPUBackend(GPUBackend::OPENGL);
|
||||
bool success = draw_->CreatePresets();
|
||||
assert(success);
|
||||
}
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "gfx_es2/gpu_features.h"
|
||||
|
||||
#include "Core/Config.h"
|
||||
#include "Core/System.h"
|
||||
#include "Common/GraphicsContext.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -39,6 +40,7 @@ public:
|
||||
IOSDummyGraphicsContext() {
|
||||
CheckGLExtensions();
|
||||
draw_ = Draw::T3DCreateGLContext();
|
||||
SetGPUBackend(GPUBackend::OPENGL);
|
||||
bool success = draw_->CreatePresets();
|
||||
assert(success);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user