Merge pull request #19565 from hrydgard/postshader-fixes
Some checks failed
Build / build-windows (ARM64) (push) Has been cancelled
Build / build-windows (x64) (push) Has been cancelled
Build / build-uwp (push) Has been cancelled
Build / build (./b.sh --headless --unittest --fat --no-png --no-sdl2, clang, clang++, test, macos, macos-latest) (push) Has been cancelled
Build / build (./b.sh --headless --unittest, clang, clang++, test, clang-normal, ubuntu-latest) (push) Has been cancelled
Build / build (./b.sh --headless --unittest, gcc, g++, gcc-normal, ubuntu-latest) (push) Has been cancelled
Build / build (./b.sh --ios, clang, clang++, ios, ios, macos-latest) (push) Has been cancelled
Build / build (./b.sh --libretro_android ppsspp_libretro, clang, clang++, android, android-libretro, ubuntu-latest) (push) Has been cancelled
Build / build (./b.sh --qt, gcc, g++, qt, qt, ubuntu-latest) (push) Has been cancelled
Build / build (cd android && ./ab.sh -j2 APP_ABI=arm64-v8a OPENXR=1, clang, clang++, android, android-vr, ubuntu-latest) (push) Has been cancelled
Build / build (cd android && ./ab.sh -j2 APP_ABI=arm64-v8a UNITTEST=1 HEADLESS=1, clang, clang++, android, android-arm64, ubuntu-latest) (push) Has been cancelled
Build / build (cd android && ./ab.sh -j2 APP_ABI=armeabi-v7a UNITTEST=1 HEADLESS=1, clang, clang++, android, android-arm32, ubuntu-latest) (push) Has been cancelled
Build / build (cd android && ./ab.sh -j2 APP_ABI=x86_64 UNITTEST=1 HEADLESS=1, clang, clang++, android, android-x86_64, ubuntu-latest) (push) Has been cancelled
Build / build (make -C libretro -f Makefile -j2, clang, clang++, libretro, clang-libretro, ubuntu-latest) (push) Has been cancelled
Build / build (make -C libretro -f Makefile -j2, gcc, g++, libretro, gcc-libretro, ubuntu-latest) (push) Has been cancelled
Build / build_test_headless_alpine (push) Has been cancelled
Generate Docker Layer / build (push) Has been cancelled
Build / test-windows (push) Has been cancelled
Build / test (macos-latest) (push) Has been cancelled
Build / test (ubuntu-latest) (push) Has been cancelled

Postshader fixes
This commit is contained in:
Henrik Rydgård 2024-10-29 16:36:43 +01:00 committed by GitHub
commit 528a26d2a6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 22 additions and 10 deletions

View File

@ -147,11 +147,7 @@ void DisplayLayoutScreen::dialogFinished(const Screen *dialog, DialogResult resu
RecreateViews();
}
UI::EventReturn DisplayLayoutScreen::OnPostProcShaderChange(UI::EventParams &e) {
// Remove the virtual "Off" entry. TODO: Get rid of it generally.
g_Config.vPostShaderNames.erase(std::remove(g_Config.vPostShaderNames.begin(), g_Config.vPostShaderNames.end(), "Off"), g_Config.vPostShaderNames.end());
FixPostShaderOrder(&g_Config.vPostShaderNames);
static void NotifyPostChanges() {
System_PostUIMessage(UIMessage::GPU_CONFIG_CHANGED);
System_PostUIMessage(UIMessage::GPU_RENDER_RESIZED); // To deal with shaders that can change render resolution like upscaling.
System_PostUIMessage(UIMessage::POSTSHADER_UPDATED);
@ -159,6 +155,13 @@ UI::EventReturn DisplayLayoutScreen::OnPostProcShaderChange(UI::EventParams &e)
if (gpu) {
gpu->NotifyConfigChanged();
}
}
UI::EventReturn DisplayLayoutScreen::OnPostProcShaderChange(UI::EventParams &e) {
// Remove the virtual "Off" entry. TODO: Get rid of it generally.
g_Config.vPostShaderNames.erase(std::remove(g_Config.vPostShaderNames.begin(), g_Config.vPostShaderNames.end(), "Off"), g_Config.vPostShaderNames.end());
FixPostShaderOrder(&g_Config.vPostShaderNames);
NotifyPostChanges();
return UI::EVENT_DONE;
}
@ -378,14 +381,23 @@ void DisplayLayoutScreen::CreateViews() {
auto removeButton = shaderRow->Add(new Choice(ImageID("I_TRASHCAN"), new LinearLayoutParams(0.0f)));
removeButton->OnClick.Add([=](EventParams &e) -> UI::EventReturn {
g_Config.vPostShaderNames.erase(g_Config.vPostShaderNames.begin() + i);
System_PostUIMessage(UIMessage::GPU_CONFIG_CHANGED);
RecreateViews();
// Protect against possible race conditions.
if (i < g_Config.vPostShaderNames.size()) {
g_Config.vPostShaderNames.erase(g_Config.vPostShaderNames.begin() + i);
FixPostShaderOrder(&g_Config.vPostShaderNames);
NotifyPostChanges();
RecreateViews();
}
return UI::EVENT_DONE;
});
auto moreButton = shaderRow->Add(new Choice(ImageID("I_THREE_DOTS"), new LinearLayoutParams(0.0f)));
moreButton->OnClick.Add([=](EventParams &e) -> UI::EventReturn {
if (i >= g_Config.vPostShaderNames.size()) {
// Protect against possible race conditions.
return UI::EVENT_DONE;
}
PopupContextMenuScreen *contextMenu = new UI::PopupContextMenuScreen(postShaderContextMenu, ARRAY_SIZE(postShaderContextMenu), I18NCat::DIALOG, moreButton);
screenManager()->push(contextMenu);
const ShaderInfo *info = GetPostShaderInfo(g_Config.vPostShaderNames[i]);
@ -407,7 +419,7 @@ void DisplayLayoutScreen::CreateViews() {
return UI::EVENT_DONE;
}
FixPostShaderOrder(&g_Config.vPostShaderNames);
System_PostUIMessage(UIMessage::GPU_CONFIG_CHANGED);
NotifyPostChanges();
RecreateViews();
return UI::EVENT_DONE;
});

View File

@ -50,7 +50,7 @@ private:
UI::ChoiceStrip *mode_ = nullptr;
UI::Choice *postProcChoice_ = nullptr;
std::string shaderNames_[256];
std::deque<bool> settingsVisible_; // vector<bool> is an insane bitpacked specialization!
std::deque<bool> settingsVisible_; // vector<bool> is an insane bitpacked specialization! Not to be used with checkboxes!
};
class PostProcScreen : public UI::ListPopupScreen {