Skip to content

Commit

Permalink
Fix: Custom shader not work under d3d11
Browse files Browse the repository at this point in the history
  • Loading branch information
xfangfang committed Apr 21, 2024
1 parent a86ffb6 commit 05d8748
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions wiliwili/source/fragment/player_setting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,15 @@ void PlayerSetting::setupCustomShaders() {
ShaderHelper::instance().clearShader();
}

#ifdef BOREALIS_USE_D3D11
// 如果正在使用硬解,那么将硬解更新为 auto-copy,避免直接硬解因为不经过 cpu 处理导致滤镜无效
if (MPVCore::HARDWARE_DEC) {
std::string hwdec = value ? "auto-copy" : MPVCore::PLAYER_HWDEC_METHOD;
MPVCore::instance().command_async("set", "hwdec", hwdec);
brls::Logger::info("MPV hardware decode: {}", hwdec);
}
#endif

GA("player_setting", {{"shader", cell->title->getFullText()}});
return true;
});
Expand Down Expand Up @@ -275,13 +284,13 @@ void PlayerSetting::setupCommonSetting() {
GA("player_setting", {{"fullscreen", value ? "true" : "false"}});
});

btnAlwaysOnTop->init("wiliwili/setting/app/others/always_on_top"_i18n, conf.getBoolOption(SettingItem::ALWAYS_ON_TOP),
[](bool value) {
ProgramConfig::instance().setSettingItem(SettingItem::ALWAYS_ON_TOP, value);
// 设置当前状态
brls::Application::getPlatform()->setWindowAlwaysOnTop(value);
GA("player_setting", {{"always_on_top", value ? "true" : "false"}});
});
btnAlwaysOnTop->init("wiliwili/setting/app/others/always_on_top"_i18n,
conf.getBoolOption(SettingItem::ALWAYS_ON_TOP), [](bool value) {
ProgramConfig::instance().setSettingItem(SettingItem::ALWAYS_ON_TOP, value);
// 设置当前状态
brls::Application::getPlatform()->setWindowAlwaysOnTop(value);
GA("player_setting", {{"always_on_top", value ? "true" : "false"}});
});
#else
btnFullscreen->setVisibility(brls::Visibility::GONE);
btnAlwaysOnTop->setVisibility(brls::Visibility::GONE);
Expand Down

0 comments on commit 05d8748

Please sign in to comment.