Merge pull request #11827 from hrydgard/vulkan-linux-cherry-picks

Vulkan linux cherry picks
This commit is contained in:
Unknown W. Brackets 2019-02-23 12:09:26 +00:00 committed by GitHub
commit 73d44c49bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 41 additions and 36 deletions

1
.gitignore vendored
View File

@ -39,6 +39,7 @@ assets/flash0
UWP/icph
UWP/.vs
.vs
.vscode
# For Mac
.DS_Store

View File

@ -1109,7 +1109,7 @@ void Config::Load(const char *iniFileName, const char *controllerIniFilename) {
}
}
void Config::Save() {
void Config::Save(const char *saveReason) {
if (jitForcedOff) {
// if JIT has been forced off, we don't want to screw up the user's ppsspp.ini
g_Config.iCpuCore = (int)CPUCore::JIT;
@ -1162,11 +1162,11 @@ void Config::Save() {
LogManager::GetInstance()->SaveConfig(log);
if (!iniFile.Save(iniFilename_.c_str())) {
ERROR_LOG(LOADER, "Error saving config - can't write ini '%s'", iniFilename_.c_str());
ERROR_LOG(LOADER, "Error saving config (%s)- can't write ini '%s'", saveReason, iniFilename_.c_str());
System_SendMessage("toast", "Failed to save settings!\nCheck permissions, or try to restart the device.");
return;
}
INFO_LOG(LOADER, "Config saved: '%s'", iniFilename_.c_str());
INFO_LOG(LOADER, "Config saved (%s): '%s'", saveReason, iniFilename_.c_str());
if (!bGameSpecific) //otherwise we already did this in saveGameConfig()
{
@ -1353,7 +1353,7 @@ bool Config::hasGameConfig(const std::string &pGameId) {
}
void Config::changeGameSpecific(const std::string &pGameId) {
Save();
Save("changeGameSpecific");
gameId_ = pGameId;
bGameSpecific = !pGameId.empty();
}

View File

@ -410,7 +410,7 @@ public:
std::string dismissedVersion;
void Load(const char *iniFileName = nullptr, const char *controllerIniFilename = nullptr);
void Save();
void Save(const char *saveReason);
void RestoreDefaults();
//per game config managment, should maybe be in it's own class

View File

@ -119,6 +119,9 @@ void System_SendMessage(const char *command, const char *parameter) {
QCoreApplication::postEvent(emugl, new QEvent((QEvent::Type)browseFileEvent));
} else if (!strcmp(command, "browse_folder")) {
QCoreApplication::postEvent(emugl, new QEvent((QEvent::Type)browseFolderEvent));
} else if (!strcmp(command, "graphics_restart")) {
// Should find a way to properly restart the app.
qApp->exit(0);
}
}
@ -402,7 +405,7 @@ bool MainUI::event(QEvent *e) {
if (QFile::exists(fileName)) {
QDir newPath;
g_Config.currentDirectory = newPath.filePath(fileName).toStdString();
g_Config.Save();
g_Config.Save("browseFileEvent");
NativeMessageReceived("boot", fileName.toStdString().c_str());
}

View File

@ -116,6 +116,9 @@ void System_SendMessage(const char *command, const char *parameter) {
} else if (!strcmp(command, "finish")) {
// Do a clean exit
g_QuitRequested = true;
} else if (!strcmp(command, "graphics_restart")) {
// Not sure how we best do this, but do a clean exit, better than being stuck in a bad state.
g_QuitRequested = true;
}
}

View File

@ -44,7 +44,7 @@ void Combo_keyScreen::CreateViews() {
static const int comboKeyImages[5] = {
I_1, I_2, I_3, I_4, I_5,
};
comboselect = new ChoiceStrip(ORIENT_VERTICAL, new AnchorLayoutParams(10, 10, NONE, NONE));
comboselect->SetSpacing(10);
for (int i = 0; i < 5; i++) {
@ -169,7 +169,7 @@ void Combo_keyScreen::onFinish(DialogResult result) {
g_Config.iCombokey4 = arrayToInt(array);
break;
}
g_Config.Save();
g_Config.Save("Combo_keyScreen::onFInish");
}
UI::EventReturn Combo_keyScreen::ChoiceEventHandler::onChoiceClick(UI::EventParams &e){

View File

@ -431,8 +431,8 @@ class JoystickHistoryView : public UI::InertView {
public:
JoystickHistoryView(int xAxis, int xDevice, int xDir, int yAxis, int yDevice, int yDir, UI::LayoutParams *layoutParams = nullptr)
: UI::InertView(layoutParams),
xAxis_(xAxis), xDevice_(xDevice), xDir_(xDir),
yAxis_(yAxis), yDevice_(yDevice), yDir_(yDir),
xAxis_(xAxis), xDir_(xDir),
yAxis_(yAxis), yDir_(yDir),
curX_(0.0f), curY_(0.0f),
maxCount_(500) {}
void Draw(UIContext &dc) override;
@ -455,10 +455,8 @@ private:
};
int xAxis_;
int xDevice_;
int xDir_;
int yAxis_;
int yDevice_;
int yDir_;
float curX_;

View File

@ -173,7 +173,7 @@ void DisplayLayoutScreen::resized() {
}
void DisplayLayoutScreen::onFinish(DialogResult reason) {
g_Config.Save();
g_Config.Save("DisplayLayoutScreen::onFinish");
}
UI::EventReturn DisplayLayoutScreen::OnCenter(UI::EventParams &e) {

View File

@ -1065,7 +1065,7 @@ void GameSettingsScreen::onFinish(DialogResult result) {
Reporting::Enable(enableReports_, "report.ppsspp.org");
Reporting::UpdateConfig();
g_Config.Save();
g_Config.Save("GameSettingsScreen::onFinish");
if (editThenRestore_) {
g_Config.unloadGameConfig();
}
@ -1137,7 +1137,7 @@ void GameSettingsScreen::CallbackMemstickFolder(bool yes) {
writeDataToFile(true, pendingMemstickFolder_.c_str(), pendingMemstickFolder_.size(), memstickDirFile.c_str());
// Save so the settings, at least, are transferred.
g_Config.memStickDirectory = pendingMemstickFolder_ + "/";
g_Config.Save();
g_Config.Save("MemstickPathChanged");
screenManager()->RecreateAllViews();
}
}
@ -1149,7 +1149,7 @@ void GameSettingsScreen::CallbackRenderingBackend(bool yes) {
if (yes) {
// Extra save here to make sure the choice really gets saved even if there are shutdown bugs in
// the GPU backend code.
g_Config.Save();
g_Config.Save("GameSettingsScreen::RenderingBackendYes");
System_SendMessage("graphics_restart", "");
} else {
g_Config.iGPUBackend = (int)GetGPUBackend();
@ -1162,7 +1162,7 @@ void GameSettingsScreen::CallbackRenderingDevice(bool yes) {
if (yes) {
// Extra save here to make sure the choice really gets saved even if there are shutdown bugs in
// the GPU backend code.
g_Config.Save();
g_Config.Save("GameSettingsScreen::RenderingDeviceYes");
System_SendMessage("graphics_restart", "");
} else {
std::string *deviceNameSetting = GPUDeviceNameSetting();
@ -1397,7 +1397,7 @@ void DeveloperToolsScreen::CreateViews() {
}
void DeveloperToolsScreen::onFinish(DialogResult result) {
g_Config.Save();
g_Config.Save("DeveloperToolsScreen::onFinish");
}
void GameSettingsScreen::CallbackRestoreDefaults(bool yes) {

View File

@ -1199,7 +1199,7 @@ UI::EventReturn MainScreen::OnExit(UI::EventParams &e) {
System_SendMessage("finish", "");
// However, let's make sure the config was saved, since it may not have been.
g_Config.Save();
g_Config.Save("MainScreen::OnExit");
#ifdef __ANDROID__
#ifdef ANDROID_NDK_PROFILER

View File

@ -507,7 +507,7 @@ void LogoScreen::render() {
int ppsspp_org_y = yres / 2 + 130;
dc.DrawText("www.ppsspp.org", bounds.centerX(), ppsspp_org_y, textColor, ALIGN_CENTER);
#if (defined(_WIN32) && !PPSSPP_PLATFORM(UWP)) || PPSSPP_PLATFORM(ANDROID)
#if (defined(_WIN32) && !PPSSPP_PLATFORM(UWP)) || PPSSPP_PLATFORM(ANDROID) || PPSSPP_PLATFORM(LINUX)
// Draw the graphics API, except on UWP where it's always D3D11
std::string apiName = screenManager()->getDrawContext()->GetInfoString(InfoField::APINAME);
dc.DrawText(gr->T(apiName), bounds.centerX(), ppsspp_org_y + 50, textColor, ALIGN_CENTER);

View File

@ -401,7 +401,7 @@ static void CheckFailedGPUBackends() {
writeStringToFile(true, g_Config.sFailedGPUBackends, cache.c_str());
} else {
// Just save immediately, since we have storage.
g_Config.Save();
g_Config.Save("got storage permission");
}
}
@ -415,7 +415,7 @@ static void ClearFailedGPUBackends() {
if (System_GetPropertyBool(SYSPROP_SUPPORTS_PERMISSIONS)) {
File::Delete(GetSysDirectory(DIRECTORY_APP_CACHE) + "/FailedGraphicsBackends.txt");
} else {
g_Config.Save();
g_Config.Save("clearFailedGPUBackends");
}
}
@ -1292,7 +1292,7 @@ void NativeShutdown() {
delete host;
host = nullptr;
#endif
g_Config.Save();
g_Config.Save("NativeShutdown");
// Avoid shutting this down when restarting core.
if (!restarting)

View File

@ -330,7 +330,7 @@ EventReturn ReportScreen::HandleSubmit(EventParams &e) {
if (Reporting::Enable(enableReporting_, "report.ppsspp.org")) {
Reporting::UpdateConfig();
g_Config.Save();
g_Config.Save("ReportScreen::HandleSubmit");
}
std::string filename = includeScreenshot_ ? screenshotFilename_ : "";

View File

@ -286,7 +286,7 @@ void TouchControlLayoutScreen::resized() {
}
void TouchControlLayoutScreen::onFinish(DialogResult reason) {
g_Config.Save();
g_Config.Save("TouchControlLayoutScreen::onFinish");
}
UI::EventReturn TouchControlLayoutScreen::OnVisibility(UI::EventParams &e) {

View File

@ -106,14 +106,14 @@ void TouchControlVisibilityScreen::CreateViews() {
}
choice->SetCentered(true);
row->Add(choice);
grid->Add(row);
}
}
void TouchControlVisibilityScreen::onFinish(DialogResult result) {
g_Config.Save();
g_Config.Save("TouchControlVisibilityScreen::onFinish");
}
UI::EventReturn TouchControlVisibilityScreen::OnToggleAll(UI::EventParams &e) {

View File

@ -159,7 +159,7 @@ void MainThreadFunc() {
if (performingRestart) {
// Okay, switching graphics didn't work out. Probably a driver bug - fallback to restart.
// This happens on NVIDIA when switching OpenGL -> Vulkan.
g_Config.Save();
g_Config.Save("switch_graphics_failed");
W32Util::ExitAndRestart();
}
@ -196,7 +196,7 @@ void MainThreadFunc() {
g_Config.iGPUBackend = (int)nextBackend;
// Clear this to ensure we try their selection.
g_Config.sFailedGPUBackends.clear();
g_Config.Save();
g_Config.Save("save_graphics_fallback");
W32Util::ExitAndRestart();
} else {

View File

@ -145,10 +145,10 @@ bool D3D11Context::Init(HINSTANCE hInst, HWND wnd, std::string *error_message) {
std::wstring title = ConvertUTF8ToWString(err->T("D3D11InitializationError", "Direct3D 11 initialization error"));
bool yes = IDYES == MessageBox(hWnd_, error.c_str(), title.c_str(), MB_ICONERROR | MB_YESNO);
if (yes) {
// Change the config to D3D and restart.
// Change the config to D3D9 and restart.
g_Config.iGPUBackend = (int)GPUBackend::DIRECT3D9;
g_Config.sFailedGPUBackends.clear();
g_Config.Save();
g_Config.Save("save_d3d9_fallback");
W32Util::ExitAndRestart();
}

View File

@ -271,7 +271,7 @@ bool WindowsGLContext::InitFromRenderThread(std::string *error_message) {
bool d3d9 = IDYES == MessageBox(hWnd_, whichD3D9.c_str(), title.c_str(), MB_YESNO);
g_Config.iGPUBackend = d3d9 ? (int)GPUBackend::DIRECT3D9 : (int)GPUBackend::DIRECT3D11;
g_Config.sFailedGPUBackends.clear();
g_Config.Save();
g_Config.Save("save_d3d11_fallback");
W32Util::ExitAndRestart();
}

View File

@ -759,25 +759,25 @@ namespace MainWindow {
case ID_OPTIONS_DIRECT3D9:
g_Config.iGPUBackend = (int)GPUBackend::DIRECT3D9;
g_Config.Save();
g_Config.Save("gpu_choice");
RestartApp();
break;
case ID_OPTIONS_DIRECT3D11:
g_Config.iGPUBackend = (int)GPUBackend::DIRECT3D11;
g_Config.Save();
g_Config.Save("gpu_choice");
RestartApp();
break;
case ID_OPTIONS_OPENGL:
g_Config.iGPUBackend = (int)GPUBackend::OPENGL;
g_Config.Save();
g_Config.Save("gpu_choice");
RestartApp();
break;
case ID_OPTIONS_VULKAN:
g_Config.iGPUBackend = (int)GPUBackend::VULKAN;
g_Config.Save();
g_Config.Save("gpu_choice");
RestartApp();
break;