Core: Use readable names for failed backends.

This commit is contained in:
Unknown W. Brackets 2019-06-22 11:20:01 -07:00
parent 3cb1c33fd9
commit df6c5f38dc
4 changed files with 32 additions and 4 deletions

View file

@ -550,7 +550,7 @@ int Config::NextValidBackend() {
SplitString(sFailedGPUBackends, ',', split);
for (const auto &str : split) {
if (!str.empty() && str != "ALL") {
failed.insert(atoi(str.c_str()));
failed.insert((int)GPUBackendFromString(str));
}
}

View file

@ -18,6 +18,7 @@
#pragma once
#include <cstdint>
#include <string>
const int PSP_MODEL_FAT = 0;
const int PSP_MODEL_SLIM = 1;
@ -53,6 +54,33 @@ enum class GPUBackend {
VULKAN = 3,
};
inline std::string GPUBackendToString(GPUBackend backend) {
switch (backend) {
case GPUBackend::OPENGL:
return "OPENGL";
case GPUBackend::DIRECT3D9:
return "DIRECT3D9";
case GPUBackend::DIRECT3D11:
return "DIRECT3D11";
case GPUBackend::VULKAN:
return "VULKAN";
}
// Intentionally not a default so we get a warning.
return "INVALID";
}
inline GPUBackend GPUBackendFromString(const std::string &backend) {
if (backend == "OPENGL" || backend == "0")
return GPUBackend::OPENGL;
if (backend == "DIRECT3D9" || backend == "1")
return GPUBackend::DIRECT3D9;
if (backend == "DIRECT3D11" || backend == "2")
return GPUBackend::DIRECT3D11;
if (backend == "VULKAN" || backend == "3")
return GPUBackend::VULKAN;
return GPUBackend::OPENGL;
}
enum AudioBackendType {
AUDIO_BACKEND_AUTO,
AUDIO_BACKEND_DSOUND,

View file

@ -822,7 +822,7 @@ void NotifyDisplay(u32 framebuf, int stride, int fmt) {
int linesize, pixelFormat;
};
DisplayBufData disp{ framebuf, stride, fmt };
DisplayBufData disp{ { framebuf }, stride, fmt };
FlushRegisters();
u32 ptr = (u32)pushbuf.size();

View file

@ -392,9 +392,9 @@ static void CheckFailedGPUBackends() {
WARN_LOG(LOADER, "Failed graphics backend switched from %d to %d", lastBackend, g_Config.iGPUBackend);
// And then let's - for now - add the current to the failed list.
if (g_Config.sFailedGPUBackends.empty()) {
g_Config.sFailedGPUBackends = StringFromFormat("%d", g_Config.iGPUBackend);
g_Config.sFailedGPUBackends = GPUBackendToString((GPUBackend)g_Config.iGPUBackend);
} else if (g_Config.sFailedGPUBackends.find("ALL") == std::string::npos) {
g_Config.sFailedGPUBackends += StringFromFormat(",%d", g_Config.iGPUBackend);
g_Config.sFailedGPUBackends += "," + GPUBackendToString((GPUBackend)g_Config.iGPUBackend);
}
if (System_GetPropertyBool(SYSPROP_SUPPORTS_PERMISSIONS)) {