mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
GPU: Remove duplicate BACKEND constants.
This commit is contained in:
parent
4657397b57
commit
d6da758ed3
15 changed files with 55 additions and 60 deletions
|
@ -484,20 +484,20 @@ static int DefaultGPUBackend() {
|
||||||
#if PPSSPP_PLATFORM(WINDOWS) || PPSSPP_PLATFORM(ANDROID)
|
#if PPSSPP_PLATFORM(WINDOWS) || PPSSPP_PLATFORM(ANDROID)
|
||||||
// Where supported, let's use Vulkan.
|
// Where supported, let's use Vulkan.
|
||||||
if (VulkanMayBeAvailable()) {
|
if (VulkanMayBeAvailable()) {
|
||||||
return GPU_BACKEND_VULKAN;
|
return (int)GPUBackend::VULKAN;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if PPSSPP_PLATFORM(WINDOWS)
|
#if PPSSPP_PLATFORM(WINDOWS)
|
||||||
// If no Vulkan, use Direct3D 11 on Windows 8+ (most importantly 10.)
|
// If no Vulkan, use Direct3D 11 on Windows 8+ (most importantly 10.)
|
||||||
if (DoesVersionMatchWindows(6, 2, 0, 0, true)) {
|
if (DoesVersionMatchWindows(6, 2, 0, 0, true)) {
|
||||||
return GPU_BACKEND_DIRECT3D11;
|
return (int)GPUBackend::DIRECT3D11;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return GPU_BACKEND_OPENGL;
|
return (int)GPUBackend::OPENGL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool DefaultVertexCache() {
|
static bool DefaultVertexCache() {
|
||||||
return DefaultGPUBackend() == GPU_BACKEND_OPENGL;
|
return DefaultGPUBackend() == (int)GPUBackend::OPENGL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ConfigSetting graphicsSettings[] = {
|
static ConfigSetting graphicsSettings[] = {
|
||||||
|
|
|
@ -57,12 +57,6 @@ enum class GPUBackend {
|
||||||
DIRECT3D11 = 2,
|
DIRECT3D11 = 2,
|
||||||
VULKAN = 3,
|
VULKAN = 3,
|
||||||
};
|
};
|
||||||
enum {
|
|
||||||
GPU_BACKEND_OPENGL = (int)GPUBackend::OPENGL,
|
|
||||||
GPU_BACKEND_DIRECT3D9 = (int)GPUBackend::DIRECT3D9,
|
|
||||||
GPU_BACKEND_DIRECT3D11 = (int)GPUBackend::DIRECT3D11,
|
|
||||||
GPU_BACKEND_VULKAN = (int)GPUBackend::VULKAN,
|
|
||||||
};
|
|
||||||
|
|
||||||
enum AudioBackendType {
|
enum AudioBackendType {
|
||||||
AUDIO_BACKEND_AUTO,
|
AUDIO_BACKEND_AUTO,
|
||||||
|
|
|
@ -1928,7 +1928,7 @@ bool FramebufferManagerCommon::GetFramebuffer(u32 fb_address, int fb_stride, GEB
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Maybe should handle flipY inside CopyFramebufferToMemorySync somehow?
|
// TODO: Maybe should handle flipY inside CopyFramebufferToMemorySync somehow?
|
||||||
bool flipY = (g_Config.iGPUBackend == GPU_BACKEND_OPENGL && !useBufferedRendering_) ? true : false;
|
bool flipY = (GetGPUBackend() == GPUBackend::OPENGL && !useBufferedRendering_) ? true : false;
|
||||||
buffer.Allocate(w, h, GE_FORMAT_8888, flipY, true);
|
buffer.Allocate(w, h, GE_FORMAT_8888, flipY, true);
|
||||||
bool retval = draw_->CopyFramebufferToMemorySync(bound, Draw::FB_COLOR_BIT, 0, 0, w, h, Draw::DataFormat::R8G8B8A8_UNORM, buffer.GetData(), w);
|
bool retval = draw_->CopyFramebufferToMemorySync(bound, Draw::FB_COLOR_BIT, 0, 0, w, h, Draw::DataFormat::R8G8B8A8_UNORM, buffer.GetData(), w);
|
||||||
gpuStats.numReadbacks++;
|
gpuStats.numReadbacks++;
|
||||||
|
@ -1960,7 +1960,7 @@ bool FramebufferManagerCommon::GetDepthbuffer(u32 fb_address, int fb_stride, u32
|
||||||
h = std::min(h, PSP_CoreParameter().pixelHeight);
|
h = std::min(h, PSP_CoreParameter().pixelHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool flipY = (g_Config.iGPUBackend == GPU_BACKEND_OPENGL && !useBufferedRendering_) ? true : false;
|
bool flipY = (GetGPUBackend() == GPUBackend::OPENGL && !useBufferedRendering_) ? true : false;
|
||||||
if (gstate_c.Supports(GPU_SCALE_DEPTH_FROM_24BIT_TO_16BIT)) {
|
if (gstate_c.Supports(GPU_SCALE_DEPTH_FROM_24BIT_TO_16BIT)) {
|
||||||
buffer.Allocate(w, h, GPU_DBG_FORMAT_FLOAT_DIV_256, flipY);
|
buffer.Allocate(w, h, GPU_DBG_FORMAT_FLOAT_DIV_256, flipY);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1994,7 +1994,7 @@ bool FramebufferManagerCommon::GetStencilbuffer(u32 fb_address, int fb_stride, G
|
||||||
h = std::min(h, PSP_CoreParameter().pixelHeight);
|
h = std::min(h, PSP_CoreParameter().pixelHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool flipY = (g_Config.iGPUBackend == GPU_BACKEND_OPENGL && !useBufferedRendering_) ? true : false;
|
bool flipY = (GetGPUBackend() == GPUBackend::OPENGL && !useBufferedRendering_) ? true : false;
|
||||||
// No need to free on failure, the caller/destructor will do that. Usually this is a reused buffer, anyway.
|
// No need to free on failure, the caller/destructor will do that. Usually this is a reused buffer, anyway.
|
||||||
buffer.Allocate(w, h, GPU_DBG_FORMAT_8BIT, flipY);
|
buffer.Allocate(w, h, GPU_DBG_FORMAT_8BIT, flipY);
|
||||||
bool retval = draw_->CopyFramebufferToMemorySync(vfb->fbo, Draw::FB_STENCIL_BIT, 0, 0, w,h, Draw::DataFormat::S8, buffer.GetData(), w);
|
bool retval = draw_->CopyFramebufferToMemorySync(vfb->fbo, Draw::FB_STENCIL_BIT, 0, 0, w,h, Draw::DataFormat::S8, buffer.GetData(), w);
|
||||||
|
|
|
@ -783,7 +783,7 @@ bool TextureCacheD3D11::GetCurrentTextureDebug(GPUDebugBuffer &buffer, int level
|
||||||
// TODO: Centralize.
|
// TODO: Centralize.
|
||||||
if (nextTexture_->framebuffer) {
|
if (nextTexture_->framebuffer) {
|
||||||
VirtualFramebuffer *vfb = nextTexture_->framebuffer;
|
VirtualFramebuffer *vfb = nextTexture_->framebuffer;
|
||||||
bool flipY = g_Config.iGPUBackend == GPU_BACKEND_OPENGL && g_Config.iRenderingMode != FB_NON_BUFFERED_MODE;
|
bool flipY = GetGPUBackend() == GPUBackend::OPENGL && g_Config.iRenderingMode != FB_NON_BUFFERED_MODE;
|
||||||
buffer.Allocate(vfb->bufferWidth, vfb->bufferHeight, GPU_DBG_FORMAT_8888, flipY);
|
buffer.Allocate(vfb->bufferWidth, vfb->bufferHeight, GPU_DBG_FORMAT_8888, flipY);
|
||||||
bool retval = draw_->CopyFramebufferToMemorySync(vfb->fbo, Draw::FB_COLOR_BIT, 0, 0, vfb->bufferWidth, vfb->bufferHeight, Draw::DataFormat::R8G8B8A8_UNORM, buffer.GetData(), vfb->bufferWidth);
|
bool retval = draw_->CopyFramebufferToMemorySync(vfb->fbo, Draw::FB_COLOR_BIT, 0, 0, vfb->bufferWidth, vfb->bufferHeight, Draw::DataFormat::R8G8B8A8_UNORM, buffer.GetData(), vfb->bufferWidth);
|
||||||
// Vulkan requires us to re-apply all dynamic state for each command buffer, and the above will cause us to start a new cmdbuf.
|
// Vulkan requires us to re-apply all dynamic state for each command buffer, and the above will cause us to start a new cmdbuf.
|
||||||
|
|
|
@ -792,7 +792,7 @@ bool TextureCacheVulkan::GetCurrentTextureDebug(GPUDebugBuffer &buffer, int leve
|
||||||
// TODO: Centralize?
|
// TODO: Centralize?
|
||||||
if (nextTexture_->framebuffer) {
|
if (nextTexture_->framebuffer) {
|
||||||
VirtualFramebuffer *vfb = nextTexture_->framebuffer;
|
VirtualFramebuffer *vfb = nextTexture_->framebuffer;
|
||||||
bool flipY = g_Config.iGPUBackend == GPU_BACKEND_OPENGL && g_Config.iRenderingMode != FB_NON_BUFFERED_MODE;
|
bool flipY = GetGPUBackend() == GPUBackend::OPENGL && g_Config.iRenderingMode != FB_NON_BUFFERED_MODE;
|
||||||
buffer.Allocate(vfb->bufferWidth, vfb->bufferHeight, GPU_DBG_FORMAT_8888, flipY);
|
buffer.Allocate(vfb->bufferWidth, vfb->bufferHeight, GPU_DBG_FORMAT_8888, flipY);
|
||||||
bool retval = draw_->CopyFramebufferToMemorySync(vfb->fbo, Draw::FB_COLOR_BIT, 0, 0, vfb->bufferWidth, vfb->bufferHeight, Draw::DataFormat::R8G8B8A8_UNORM, buffer.GetData(), vfb->bufferWidth);
|
bool retval = draw_->CopyFramebufferToMemorySync(vfb->fbo, Draw::FB_COLOR_BIT, 0, 0, vfb->bufferWidth, vfb->bufferHeight, Draw::DataFormat::R8G8B8A8_UNORM, buffer.GetData(), vfb->bufferWidth);
|
||||||
// Vulkan requires us to re-apply all dynamic state for each command buffer, and the above will cause us to start a new cmdbuf.
|
// Vulkan requires us to re-apply all dynamic state for each command buffer, and the above will cause us to start a new cmdbuf.
|
||||||
|
|
|
@ -865,17 +865,18 @@ int main(int argc, char *argv[]) {
|
||||||
GraphicsContext *graphicsContext = nullptr;
|
GraphicsContext *graphicsContext = nullptr;
|
||||||
SDL_Window *window = nullptr;
|
SDL_Window *window = nullptr;
|
||||||
std::string error_message;
|
std::string error_message;
|
||||||
if (g_Config.iGPUBackend == GPU_BACKEND_OPENGL) {
|
if (g_Config.iGPUBackend == (int)GPUBackend::OPENGL) {
|
||||||
SDLGLGraphicsContext *ctx = new SDLGLGraphicsContext();
|
SDLGLGraphicsContext *ctx = new SDLGLGraphicsContext();
|
||||||
if (ctx->Init(window, x, y, mode, &error_message) != 0) {
|
if (ctx->Init(window, x, y, mode, &error_message) != 0) {
|
||||||
printf("GL init error '%s'\n", error_message.c_str());
|
printf("GL init error '%s'\n", error_message.c_str());
|
||||||
}
|
}
|
||||||
graphicsContext = ctx;
|
graphicsContext = ctx;
|
||||||
} else if (g_Config.iGPUBackend == GPU_BACKEND_VULKAN) {
|
} else if (g_Config.iGPUBackend == (int)GPUBackend::VULKAN) {
|
||||||
SDLVulkanGraphicsContext *ctx = new SDLVulkanGraphicsContext();
|
SDLVulkanGraphicsContext *ctx = new SDLVulkanGraphicsContext();
|
||||||
if (!ctx->Init(window, x, y, mode, &error_message)) {
|
if (!ctx->Init(window, x, y, mode, &error_message)) {
|
||||||
printf("Vulkan init error '%s' - falling back to GL\n", error_message.c_str());
|
printf("Vulkan init error '%s' - falling back to GL\n", error_message.c_str());
|
||||||
g_Config.iGPUBackend = GPU_BACKEND_OPENGL;
|
g_Config.iGPUBackend = (int)GPUBackend::OPENGL;
|
||||||
|
SetGPUBackend((GPUBackend)g_Config.iGPUBackend);
|
||||||
delete ctx;
|
delete ctx;
|
||||||
SDLGLGraphicsContext *glctx = new SDLGLGraphicsContext();
|
SDLGLGraphicsContext *glctx = new SDLGLGraphicsContext();
|
||||||
glctx->Init(window, x, y, mode, &error_message);
|
glctx->Init(window, x, y, mode, &error_message);
|
||||||
|
|
|
@ -391,7 +391,7 @@ void SystemInfoScreen::CreateViews() {
|
||||||
deviceSpecs->Add(new InfoItem(si->T("Vendor (detected)"), vendor));
|
deviceSpecs->Add(new InfoItem(si->T("Vendor (detected)"), vendor));
|
||||||
deviceSpecs->Add(new InfoItem(si->T("Driver Version"), draw->GetInfoString(InfoField::DRIVER)));
|
deviceSpecs->Add(new InfoItem(si->T("Driver Version"), draw->GetInfoString(InfoField::DRIVER)));
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
if (g_Config.iGPUBackend != GPU_BACKEND_VULKAN)
|
if (GetGPUBackend() != GPUBackend::VULKAN)
|
||||||
deviceSpecs->Add(new InfoItem(si->T("Driver Version"), System_GetProperty(SYSPROP_GPUDRIVER_VERSION)));
|
deviceSpecs->Add(new InfoItem(si->T("Driver Version"), System_GetProperty(SYSPROP_GPUDRIVER_VERSION)));
|
||||||
#if !PPSSPP_PLATFORM(UWP)
|
#if !PPSSPP_PLATFORM(UWP)
|
||||||
if (GetGPUBackend() == GPUBackend::DIRECT3D9) {
|
if (GetGPUBackend() == GPUBackend::DIRECT3D9) {
|
||||||
|
@ -399,7 +399,7 @@ void SystemInfoScreen::CreateViews() {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
if (g_Config.iGPUBackend == GPU_BACKEND_OPENGL) {
|
if (GetGPUBackend() == GPUBackend::OPENGL) {
|
||||||
deviceSpecs->Add(new InfoItem(si->T("Core Context"), gl_extensions.IsCoreContext ? si->T("Yes") : si->T("No")));
|
deviceSpecs->Add(new InfoItem(si->T("Core Context"), gl_extensions.IsCoreContext ? si->T("Yes") : si->T("No")));
|
||||||
}
|
}
|
||||||
deviceSpecs->Add(new ItemHeader(si->T("OS Information")));
|
deviceSpecs->Add(new ItemHeader(si->T("OS Information")));
|
||||||
|
@ -510,7 +510,7 @@ void SystemInfoScreen::CreateViews() {
|
||||||
gpuExtensions->SetSpacing(0);
|
gpuExtensions->SetSpacing(0);
|
||||||
gpuExtensionsScroll->Add(gpuExtensions);
|
gpuExtensionsScroll->Add(gpuExtensions);
|
||||||
|
|
||||||
if (g_Config.iGPUBackend == GPU_BACKEND_OPENGL) {
|
if (GetGPUBackend() == GPUBackend::OPENGL) {
|
||||||
tabHolder->AddTab(si->T("OGL Extensions"), gpuExtensionsScroll);
|
tabHolder->AddTab(si->T("OGL Extensions"), gpuExtensionsScroll);
|
||||||
|
|
||||||
if (!gl_extensions.IsGLES) {
|
if (!gl_extensions.IsGLES) {
|
||||||
|
@ -547,7 +547,7 @@ void SystemInfoScreen::CreateViews() {
|
||||||
eglExtensions->Add(new TextView(extension, new LayoutParams(FILL_PARENT, WRAP_CONTENT)))->SetFocusable(true);
|
eglExtensions->Add(new TextView(extension, new LayoutParams(FILL_PARENT, WRAP_CONTENT)))->SetFocusable(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (g_Config.iGPUBackend == GPU_BACKEND_VULKAN) {
|
} else if (GetGPUBackend() == GPUBackend::VULKAN) {
|
||||||
tabHolder->AddTab(si->T("Vulkan Features"), gpuExtensionsScroll);
|
tabHolder->AddTab(si->T("Vulkan Features"), gpuExtensionsScroll);
|
||||||
|
|
||||||
gpuExtensions->Add(new ItemHeader(si->T("Vulkan Features")));
|
gpuExtensions->Add(new ItemHeader(si->T("Vulkan Features")));
|
||||||
|
|
|
@ -106,11 +106,11 @@ bool CheckSupportInstancedTessellationGLES() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsBackendSupportHWTess() {
|
bool IsBackendSupportHWTess() {
|
||||||
switch (g_Config.iGPUBackend) {
|
switch (GetGPUBackend()) {
|
||||||
case GPU_BACKEND_OPENGL:
|
case GPUBackend::OPENGL:
|
||||||
return CheckSupportInstancedTessellationGLES();
|
return CheckSupportInstancedTessellationGLES();
|
||||||
case GPU_BACKEND_VULKAN:
|
case GPUBackend::VULKAN:
|
||||||
case GPU_BACKEND_DIRECT3D11:
|
case GPUBackend::DIRECT3D11:
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -180,7 +180,7 @@ void GameSettingsScreen::CreateViews() {
|
||||||
|
|
||||||
graphicsSettings->Add(new ItemHeader(gr->T("Rendering Mode")));
|
graphicsSettings->Add(new ItemHeader(gr->T("Rendering Mode")));
|
||||||
static const char *renderingBackend[] = { "OpenGL", "Direct3D 9", "Direct3D 11", "Vulkan" };
|
static const char *renderingBackend[] = { "OpenGL", "Direct3D 9", "Direct3D 11", "Vulkan" };
|
||||||
PopupMultiChoice *renderingBackendChoice = graphicsSettings->Add(new PopupMultiChoice(&g_Config.iGPUBackend, gr->T("Backend"), renderingBackend, GPU_BACKEND_OPENGL, ARRAY_SIZE(renderingBackend), gr->GetName(), screenManager()));
|
PopupMultiChoice *renderingBackendChoice = graphicsSettings->Add(new PopupMultiChoice(&g_Config.iGPUBackend, gr->T("Backend"), renderingBackend, (int)GPUBackend::OPENGL, ARRAY_SIZE(renderingBackend), gr->GetName(), screenManager()));
|
||||||
renderingBackendChoice->OnChoice.Handle(this, &GameSettingsScreen::OnRenderingBackend);
|
renderingBackendChoice->OnChoice.Handle(this, &GameSettingsScreen::OnRenderingBackend);
|
||||||
#if !PPSSPP_PLATFORM(WINDOWS)
|
#if !PPSSPP_PLATFORM(WINDOWS)
|
||||||
renderingBackendChoice->HideChoice(1); // D3D9
|
renderingBackendChoice->HideChoice(1); // D3D9
|
||||||
|
@ -252,7 +252,7 @@ void GameSettingsScreen::CreateViews() {
|
||||||
|
|
||||||
graphicsSettings->Add(new ItemHeader(gr->T("Features")));
|
graphicsSettings->Add(new ItemHeader(gr->T("Features")));
|
||||||
// Hide postprocess option on unsupported backends to avoid confusion.
|
// Hide postprocess option on unsupported backends to avoid confusion.
|
||||||
if (g_Config.iGPUBackend != GPU_BACKEND_DIRECT3D9) {
|
if (GetGPUBackend() != GPUBackend::DIRECT3D9) {
|
||||||
I18NCategory *ps = GetI18NCategory("PostShaders");
|
I18NCategory *ps = GetI18NCategory("PostShaders");
|
||||||
postProcChoice_ = graphicsSettings->Add(new ChoiceWithValueDisplay(&g_Config.sPostShaderName, gr->T("Postprocessing Shader"), ps->GetName()));
|
postProcChoice_ = graphicsSettings->Add(new ChoiceWithValueDisplay(&g_Config.sPostShaderName, gr->T("Postprocessing Shader"), ps->GetName()));
|
||||||
postProcChoice_->OnClick.Handle(this, &GameSettingsScreen::OnPostProcShader);
|
postProcChoice_->OnClick.Handle(this, &GameSettingsScreen::OnPostProcShader);
|
||||||
|
|
|
@ -106,19 +106,19 @@ void EmuThreadFunc() {
|
||||||
const char *defaultErrorOpenGL = "Failed initializing graphics. Try upgrading your graphics drivers.\n\nWould you like to try switching to DirectX 9?\n\nError message:";
|
const char *defaultErrorOpenGL = "Failed initializing graphics. Try upgrading your graphics drivers.\n\nWould you like to try switching to DirectX 9?\n\nError message:";
|
||||||
const char *defaultErrorDirect3D9 = "Failed initializing graphics. Try upgrading your graphics drivers and directx 9 runtime.\n\nWould you like to try switching to OpenGL?\n\nError message:";
|
const char *defaultErrorDirect3D9 = "Failed initializing graphics. Try upgrading your graphics drivers and directx 9 runtime.\n\nWould you like to try switching to OpenGL?\n\nError message:";
|
||||||
const char *genericError;
|
const char *genericError;
|
||||||
int nextBackend = GPU_BACKEND_DIRECT3D9;
|
GPUBackend nextBackend = GPUBackend::DIRECT3D9;
|
||||||
switch (g_Config.iGPUBackend) {
|
switch (g_Config.iGPUBackend) {
|
||||||
case GPU_BACKEND_DIRECT3D9:
|
case (int)GPUBackend::DIRECT3D9:
|
||||||
nextBackend = GPU_BACKEND_OPENGL;
|
nextBackend = GPUBackend::OPENGL;
|
||||||
genericError = err->T("GenericDirect3D9Error", defaultErrorDirect3D9);
|
genericError = err->T("GenericDirect3D9Error", defaultErrorDirect3D9);
|
||||||
break;
|
break;
|
||||||
case GPU_BACKEND_VULKAN:
|
case (int)GPUBackend::VULKAN:
|
||||||
nextBackend = GPU_BACKEND_OPENGL;
|
nextBackend = GPUBackend::OPENGL;
|
||||||
genericError = err->T("GenericVulkanError", defaultErrorVulkan);
|
genericError = err->T("GenericVulkanError", defaultErrorVulkan);
|
||||||
break;
|
break;
|
||||||
case GPU_BACKEND_OPENGL:
|
case (int)GPUBackend::OPENGL:
|
||||||
default:
|
default:
|
||||||
nextBackend = GPU_BACKEND_DIRECT3D9;
|
nextBackend = GPUBackend::DIRECT3D9;
|
||||||
genericError = err->T("GenericOpenGLError", defaultErrorOpenGL);
|
genericError = err->T("GenericOpenGLError", defaultErrorOpenGL);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -129,7 +129,7 @@ void EmuThreadFunc() {
|
||||||
|
|
||||||
if (yes) {
|
if (yes) {
|
||||||
// Change the config to the alternative and restart.
|
// Change the config to the alternative and restart.
|
||||||
g_Config.iGPUBackend = nextBackend;
|
g_Config.iGPUBackend = (int)nextBackend;
|
||||||
g_Config.Save();
|
g_Config.Save();
|
||||||
|
|
||||||
W32Util::ExitAndRestart();
|
W32Util::ExitAndRestart();
|
||||||
|
|
|
@ -113,7 +113,7 @@ bool D3D11Context::Init(HINSTANCE hInst, HWND wnd, std::string *error_message) {
|
||||||
bool yes = IDYES == MessageBox(hWnd_, error.c_str(), title.c_str(), MB_ICONERROR | MB_YESNO);
|
bool yes = IDYES == MessageBox(hWnd_, error.c_str(), title.c_str(), MB_ICONERROR | MB_YESNO);
|
||||||
if (yes) {
|
if (yes) {
|
||||||
// Change the config to D3D and restart.
|
// Change the config to D3D and restart.
|
||||||
g_Config.iGPUBackend = GPU_BACKEND_DIRECT3D9;
|
g_Config.iGPUBackend = (int)GPUBackend::DIRECT3D9;
|
||||||
g_Config.Save();
|
g_Config.Save();
|
||||||
|
|
||||||
W32Util::ExitAndRestart();
|
W32Util::ExitAndRestart();
|
||||||
|
|
|
@ -243,7 +243,7 @@ bool WindowsGLContext::Init(HINSTANCE hInst, HWND window, std::string *error_mes
|
||||||
|
|
||||||
if (yes) {
|
if (yes) {
|
||||||
// Change the config to D3D and restart.
|
// Change the config to D3D and restart.
|
||||||
g_Config.iGPUBackend = GPU_BACKEND_DIRECT3D9;
|
g_Config.iGPUBackend = (int)GPUBackend::DIRECT3D9;
|
||||||
g_Config.Save();
|
g_Config.Save();
|
||||||
|
|
||||||
W32Util::ExitAndRestart();
|
W32Util::ExitAndRestart();
|
||||||
|
|
|
@ -195,7 +195,7 @@ namespace MainWindow {
|
||||||
const char *translatedShaderName = nullptr;
|
const char *translatedShaderName = nullptr;
|
||||||
|
|
||||||
availableShaders.clear();
|
availableShaders.clear();
|
||||||
if (g_Config.iGPUBackend == GPU_BACKEND_DIRECT3D9) {
|
if (GetGPUBackend() == GPUBackend::DIRECT3D9) {
|
||||||
translatedShaderName = ps->T("Not available in Direct3D9 backend");
|
translatedShaderName = ps->T("Not available in Direct3D9 backend");
|
||||||
AppendMenu(shaderMenu, MF_STRING | MF_BYPOSITION | MF_GRAYED, item++, ConvertUTF8ToWString(translatedShaderName).c_str());
|
AppendMenu(shaderMenu, MF_STRING | MF_BYPOSITION | MF_GRAYED, item++, ConvertUTF8ToWString(translatedShaderName).c_str());
|
||||||
} else {
|
} else {
|
||||||
|
@ -767,22 +767,22 @@ namespace MainWindow {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_OPTIONS_DIRECT3D9:
|
case ID_OPTIONS_DIRECT3D9:
|
||||||
g_Config.iGPUBackend = GPU_BACKEND_DIRECT3D9;
|
g_Config.iGPUBackend = (int)GPUBackend::DIRECT3D9;
|
||||||
RestartApp();
|
RestartApp();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_OPTIONS_DIRECT3D11:
|
case ID_OPTIONS_DIRECT3D11:
|
||||||
g_Config.iGPUBackend = GPU_BACKEND_DIRECT3D11;
|
g_Config.iGPUBackend = (int)GPUBackend::DIRECT3D11;
|
||||||
RestartApp();
|
RestartApp();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_OPTIONS_OPENGL:
|
case ID_OPTIONS_OPENGL:
|
||||||
g_Config.iGPUBackend = GPU_BACKEND_OPENGL;
|
g_Config.iGPUBackend = (int)GPUBackend::OPENGL;
|
||||||
RestartApp();
|
RestartApp();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_OPTIONS_VULKAN:
|
case ID_OPTIONS_VULKAN:
|
||||||
g_Config.iGPUBackend = GPU_BACKEND_VULKAN;
|
g_Config.iGPUBackend = (int)GPUBackend::VULKAN;
|
||||||
RestartApp();
|
RestartApp();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1244,8 +1244,8 @@ namespace MainWindow {
|
||||||
CheckMenuItem(menu, savestateSlot[i], MF_BYCOMMAND | ((i == g_Config.iCurrentStateSlot) ? MF_CHECKED : MF_UNCHECKED));
|
CheckMenuItem(menu, savestateSlot[i], MF_BYCOMMAND | ((i == g_Config.iCurrentStateSlot) ? MF_CHECKED : MF_UNCHECKED));
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (g_Config.iGPUBackend) {
|
switch (GetGPUBackend()) {
|
||||||
case GPU_BACKEND_DIRECT3D9:
|
case GPUBackend::DIRECT3D9:
|
||||||
EnableMenuItem(menu, ID_OPTIONS_DIRECT3D9, MF_GRAYED);
|
EnableMenuItem(menu, ID_OPTIONS_DIRECT3D9, MF_GRAYED);
|
||||||
EnableMenuItem(menu, ID_OPTIONS_DIRECT3D11, MF_ENABLED);
|
EnableMenuItem(menu, ID_OPTIONS_DIRECT3D11, MF_ENABLED);
|
||||||
EnableMenuItem(menu, ID_OPTIONS_OPENGL, MF_ENABLED);
|
EnableMenuItem(menu, ID_OPTIONS_OPENGL, MF_ENABLED);
|
||||||
|
@ -1255,7 +1255,7 @@ namespace MainWindow {
|
||||||
CheckMenuItem(menu, ID_OPTIONS_OPENGL, MF_UNCHECKED);
|
CheckMenuItem(menu, ID_OPTIONS_OPENGL, MF_UNCHECKED);
|
||||||
CheckMenuItem(menu, ID_OPTIONS_VULKAN, MF_UNCHECKED);
|
CheckMenuItem(menu, ID_OPTIONS_VULKAN, MF_UNCHECKED);
|
||||||
break;
|
break;
|
||||||
case GPU_BACKEND_OPENGL:
|
case GPUBackend::OPENGL:
|
||||||
EnableMenuItem(menu, ID_OPTIONS_DIRECT3D9, MF_ENABLED);
|
EnableMenuItem(menu, ID_OPTIONS_DIRECT3D9, MF_ENABLED);
|
||||||
EnableMenuItem(menu, ID_OPTIONS_DIRECT3D11, MF_ENABLED);
|
EnableMenuItem(menu, ID_OPTIONS_DIRECT3D11, MF_ENABLED);
|
||||||
EnableMenuItem(menu, ID_OPTIONS_OPENGL, MF_GRAYED);
|
EnableMenuItem(menu, ID_OPTIONS_OPENGL, MF_GRAYED);
|
||||||
|
@ -1265,7 +1265,7 @@ namespace MainWindow {
|
||||||
CheckMenuItem(menu, ID_OPTIONS_OPENGL, MF_CHECKED);
|
CheckMenuItem(menu, ID_OPTIONS_OPENGL, MF_CHECKED);
|
||||||
CheckMenuItem(menu, ID_OPTIONS_VULKAN, MF_UNCHECKED);
|
CheckMenuItem(menu, ID_OPTIONS_VULKAN, MF_UNCHECKED);
|
||||||
break;
|
break;
|
||||||
case GPU_BACKEND_VULKAN:
|
case GPUBackend::VULKAN:
|
||||||
EnableMenuItem(menu, ID_OPTIONS_DIRECT3D9, MF_ENABLED);
|
EnableMenuItem(menu, ID_OPTIONS_DIRECT3D9, MF_ENABLED);
|
||||||
EnableMenuItem(menu, ID_OPTIONS_DIRECT3D11, MF_ENABLED);
|
EnableMenuItem(menu, ID_OPTIONS_DIRECT3D11, MF_ENABLED);
|
||||||
EnableMenuItem(menu, ID_OPTIONS_OPENGL, MF_ENABLED);
|
EnableMenuItem(menu, ID_OPTIONS_OPENGL, MF_ENABLED);
|
||||||
|
@ -1275,7 +1275,7 @@ namespace MainWindow {
|
||||||
CheckMenuItem(menu, ID_OPTIONS_OPENGL, MF_UNCHECKED);
|
CheckMenuItem(menu, ID_OPTIONS_OPENGL, MF_UNCHECKED);
|
||||||
CheckMenuItem(menu, ID_OPTIONS_VULKAN, MF_CHECKED);
|
CheckMenuItem(menu, ID_OPTIONS_VULKAN, MF_CHECKED);
|
||||||
break;
|
break;
|
||||||
case GPU_BACKEND_DIRECT3D11:
|
case GPUBackend::DIRECT3D11:
|
||||||
EnableMenuItem(menu, ID_OPTIONS_DIRECT3D9, MF_ENABLED);
|
EnableMenuItem(menu, ID_OPTIONS_DIRECT3D9, MF_ENABLED);
|
||||||
EnableMenuItem(menu, ID_OPTIONS_DIRECT3D11, MF_GRAYED);
|
EnableMenuItem(menu, ID_OPTIONS_DIRECT3D11, MF_GRAYED);
|
||||||
EnableMenuItem(menu, ID_OPTIONS_OPENGL, MF_ENABLED);
|
EnableMenuItem(menu, ID_OPTIONS_OPENGL, MF_ENABLED);
|
||||||
|
|
|
@ -114,16 +114,16 @@ void WindowsHost::UpdateConsolePosition() {
|
||||||
bool WindowsHost::InitGraphics(std::string *error_message, GraphicsContext **ctx) {
|
bool WindowsHost::InitGraphics(std::string *error_message, GraphicsContext **ctx) {
|
||||||
WindowsGraphicsContext *graphicsContext = nullptr;
|
WindowsGraphicsContext *graphicsContext = nullptr;
|
||||||
switch (g_Config.iGPUBackend) {
|
switch (g_Config.iGPUBackend) {
|
||||||
case GPU_BACKEND_OPENGL:
|
case (int)GPUBackend::OPENGL:
|
||||||
graphicsContext = new WindowsGLContext();
|
graphicsContext = new WindowsGLContext();
|
||||||
break;
|
break;
|
||||||
case GPU_BACKEND_DIRECT3D9:
|
case (int)GPUBackend::DIRECT3D9:
|
||||||
graphicsContext = new D3D9Context();
|
graphicsContext = new D3D9Context();
|
||||||
break;
|
break;
|
||||||
case GPU_BACKEND_DIRECT3D11:
|
case (int)GPUBackend::DIRECT3D11:
|
||||||
graphicsContext = new D3D11Context();
|
graphicsContext = new D3D11Context();
|
||||||
break;
|
break;
|
||||||
case GPU_BACKEND_VULKAN:
|
case (int)GPUBackend::VULKAN:
|
||||||
graphicsContext = new WindowsVulkanContext();
|
graphicsContext = new WindowsVulkanContext();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -466,19 +466,19 @@ int WINAPI WinMain(HINSTANCE _hInstance, HINSTANCE hPrevInstance, LPSTR szCmdLin
|
||||||
// such as "software-gles", "software-d3d9", and "software-d3d11", or something similar.
|
// such as "software-gles", "software-d3d9", and "software-d3d11", or something similar.
|
||||||
// For now, software rendering force-activates OpenGL.
|
// For now, software rendering force-activates OpenGL.
|
||||||
if (restOfOption == L"directx9") {
|
if (restOfOption == L"directx9") {
|
||||||
g_Config.iGPUBackend = GPU_BACKEND_DIRECT3D9;
|
g_Config.iGPUBackend = (int)GPUBackend::DIRECT3D9;
|
||||||
g_Config.bSoftwareRendering = false;
|
g_Config.bSoftwareRendering = false;
|
||||||
} else if (restOfOption == L"directx11") {
|
} else if (restOfOption == L"directx11") {
|
||||||
g_Config.iGPUBackend = GPU_BACKEND_DIRECT3D11;
|
g_Config.iGPUBackend = (int)GPUBackend::DIRECT3D11;
|
||||||
g_Config.bSoftwareRendering = false;
|
g_Config.bSoftwareRendering = false;
|
||||||
} else if (restOfOption == L"gles") {
|
} else if (restOfOption == L"gles") {
|
||||||
g_Config.iGPUBackend = GPU_BACKEND_OPENGL;
|
g_Config.iGPUBackend = (int)GPUBackend::OPENGL;
|
||||||
g_Config.bSoftwareRendering = false;
|
g_Config.bSoftwareRendering = false;
|
||||||
} else if (restOfOption == L"vulkan") {
|
} else if (restOfOption == L"vulkan") {
|
||||||
g_Config.iGPUBackend = GPU_BACKEND_VULKAN;
|
g_Config.iGPUBackend = (int)GPUBackend::VULKAN;
|
||||||
g_Config.bSoftwareRendering = false;
|
g_Config.bSoftwareRendering = false;
|
||||||
} else if (restOfOption == L"software") {
|
} else if (restOfOption == L"software") {
|
||||||
g_Config.iGPUBackend = GPU_BACKEND_OPENGL;
|
g_Config.iGPUBackend = (int)GPUBackend::OPENGL;
|
||||||
g_Config.bSoftwareRendering = true;
|
g_Config.bSoftwareRendering = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1125,7 +1125,7 @@ extern "C" bool JNICALL Java_org_ppsspp_ppsspp_NativeActivity_runEGLRenderLoop(J
|
||||||
|
|
||||||
retry:
|
retry:
|
||||||
|
|
||||||
bool vulkan = g_Config.iGPUBackend == GPU_BACKEND_VULKAN;
|
bool vulkan = g_Config.iGPUBackend == (int)GPUBackend::VULKAN;
|
||||||
|
|
||||||
int tries = 0;
|
int tries = 0;
|
||||||
AndroidGraphicsContext *graphicsContext;
|
AndroidGraphicsContext *graphicsContext;
|
||||||
|
@ -1140,8 +1140,8 @@ retry:
|
||||||
|
|
||||||
if (!exitRenderLoop && (vulkan && tries < 2)) {
|
if (!exitRenderLoop && (vulkan && tries < 2)) {
|
||||||
ILOG("Trying again, this time with OpenGL.");
|
ILOG("Trying again, this time with OpenGL.");
|
||||||
g_Config.iGPUBackend = GPU_BACKEND_OPENGL;
|
g_Config.iGPUBackend = (int)GPUBackend::OPENGL;
|
||||||
SetGPUBackend((GPUBackend)g_Config.iGPUBackend); // Wait, why do we need a separate enum here?
|
SetGPUBackend((GPUBackend)g_Config.iGPUBackend);
|
||||||
tries++;
|
tries++;
|
||||||
goto retry;
|
goto retry;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue