Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Lpsd committed Oct 22, 2024
2 parents 288b8db + 792d9aa commit b30a4a2
Show file tree
Hide file tree
Showing 9 changed files with 215 additions and 262 deletions.
9 changes: 3 additions & 6 deletions Client/cefweb/CWebApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,10 @@ void CWebApp::OnBeforeCommandLineProcessing(const CefString& process_type, CefRe
{
CWebCore* pWebCore = static_cast<CWebCore*>(g_pCore->GetWebCore());

if (!pWebCore->GetGPUEnabled()) // if GPU is disabled...
{
command_line->AppendSwitch("disable-gpu-compositing");
if (!pWebCore->GetGPUEnabled())
command_line->AppendSwitch("disable-gpu");
}
else if (!pWebCore->GetGPUCompositingEnabled()) // if GPU is enabled, but compositing is disabled...
command_line->AppendSwitch("disable-gpu-compositing");

command_line->AppendSwitch("disable-gpu-compositing"); // always disable this, causes issues with official builds

// command_line->AppendSwitch("disable-d3d11");
command_line->AppendSwitch("enable-begin-frame-scheduling");
Expand Down
8 changes: 1 addition & 7 deletions Client/cefweb/CWebCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,12 @@ CWebCore::~CWebCore()
delete m_pXmlConfig;
}

bool CWebCore::Initialise(bool gpuEnabled, bool gpuCompositingEnabled)
bool CWebCore::Initialise(bool gpuEnabled)
{
CefMainArgs mainArgs;
void* sandboxInfo = nullptr;

m_bGPUEnabled = gpuEnabled;
m_bGPUCompositingEnabled = gpuCompositingEnabled;

CefRefPtr<CWebApp> app(new CWebApp);

Expand Down Expand Up @@ -878,8 +877,3 @@ bool CWebCore::GetGPUEnabled() const noexcept
{
return m_bGPUEnabled;
}

bool CWebCore::GetGPUCompositingEnabled() const noexcept
{
return m_bGPUCompositingEnabled;
}
4 changes: 1 addition & 3 deletions Client/cefweb/CWebCore.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class CWebCore : public CWebCoreInterface
public:
CWebCore();
~CWebCore();
bool Initialise(bool gpuEnabled, bool gpuCompositingEnabled) override;
bool Initialise(bool gpuEnabled) override;

CWebViewInterface* CreateWebView(unsigned int uiWidth, unsigned int uiHeight, bool bIsLocal, CWebBrowserItem* pWebBrowserRenderItem, bool bTransparent);
void DestroyWebView(CWebViewInterface* pWebViewInterface);
Expand Down Expand Up @@ -109,7 +109,6 @@ class CWebCore : public CWebCoreInterface
static void StaticFetchBlacklistFinished(const SHttpDownloadResult& result);

bool GetGPUEnabled() const noexcept;
bool GetGPUCompositingEnabled() const noexcept;

private:
typedef std::pair<bool, eWebFilterType> WebFilterPair;
Expand All @@ -135,5 +134,4 @@ class CWebCore : public CWebCoreInterface

// Shouldn't be changed after init
bool m_bGPUEnabled;
bool m_bGPUCompositingEnabled;
};
1 change: 0 additions & 1 deletion Client/core/CClientVariables.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,6 @@ void CClientVariables::LoadDefaults()
DEFAULT("discord_rpc_share_data_firsttime", false); // Display the user data sharing consent dialog box - for the first time
DEFAULT("_beta_qc_rightclick_command", _S("reconnect")); // Command to run when right clicking quick connect (beta - can be removed at any time)
DEFAULT("browser_enable_gpu", true); // Enable GPU in CEF? (allows stuff like WebGL to function)
DEFAULT("browser_enable_gpu_compositing", true); // Enable GPU compositing in CEF? (required GPU enabled)

if (!Exists("locale"))
{
Expand Down
4 changes: 1 addition & 3 deletions Client/core/CCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1156,13 +1156,11 @@ CWebCoreInterface* CCore::GetWebCore()
if (m_pWebCore == nullptr)
{
bool gpuEnabled;
bool gpuCompositingEnabled;
auto cvars = g_pCore->GetCVars();
cvars->Get("browser_enable_gpu", gpuEnabled);
cvars->Get("browser_enable_gpu_compositing", gpuCompositingEnabled);

m_pWebCore = CreateModule<CWebCoreInterface>(m_WebCoreModule, "CefWeb", "cefweb", "InitWebCoreInterface", this);
m_pWebCore->Initialise(gpuEnabled, gpuCompositingEnabled);
m_pWebCore->Initialise(gpuEnabled);
}
return m_pWebCore;
}
Expand Down
30 changes: 2 additions & 28 deletions Client/core/CSettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -918,14 +918,8 @@ void CSettings::CreateGUI()
m_pCheckBoxRemoteJavascript->AutoSize(NULL, 20.0f);

m_pCheckBoxBrowserGPUEnabled = reinterpret_cast<CGUICheckBox*>(pManager->CreateCheckBox(m_pTabBrowser, _("Enable GPU rendering"), true));
m_pCheckBoxBrowserGPUEnabled->SetPosition(CVector2D(vecTemp.fX + 300.0f, vecTemp.fY - 20.0f));
m_pCheckBoxBrowserGPUEnabled->SetPosition(CVector2D(vecTemp.fX + 300.0f, vecTemp.fY - 25.0f));
m_pCheckBoxBrowserGPUEnabled->AutoSize(NULL, 20.0f);
m_pCheckBoxBrowserGPUEnabled->SetClickHandler(GUI_CALLBACK(&CSettings::OnGPUSettingChanged, this));

m_pCheckBoxBrowserGPUCompositingEnabled =
reinterpret_cast<CGUICheckBox*>(pManager->CreateCheckBox(m_pTabBrowser, _("Enable GPU compositing"), true));
m_pCheckBoxBrowserGPUCompositingEnabled->SetPosition(CVector2D(vecTemp.fX + 300.0f, vecTemp.fY));
m_pCheckBoxBrowserGPUCompositingEnabled->AutoSize(NULL, 20.0f);

m_pLabelBrowserCustomBlacklist = reinterpret_cast<CGUILabel*>(pManager->CreateLabel(m_pTabBrowser, _("Custom blacklist")));
m_pLabelBrowserCustomBlacklist->SetPosition(CVector2D(vecTemp.fX, vecTemp.fY + 30.0f));
Expand Down Expand Up @@ -3300,12 +3294,6 @@ void CSettings::LoadData()
CVARS_GET("browser_enable_gpu", bVar);
m_pCheckBoxBrowserGPUEnabled->SetSelected(bVar);

if (!bVar)
m_pCheckBoxBrowserGPUCompositingEnabled->SetEnabled(false);

CVARS_GET("browser_enable_gpu_compositing", bVar);
m_pCheckBoxBrowserGPUCompositingEnabled->SetSelected(bVar);

ReloadBrowserLists();
}

Expand Down Expand Up @@ -3736,13 +3724,6 @@ void CSettings::SaveData()
bool bBrowserGPUSettingChanged = (bBrowserGPUSetting != bBrowserGPUEnabled);
CVARS_SET("browser_enable_gpu", bBrowserGPUSetting);

bool bBrowserGPUCompositingEnabled = false;
CVARS_GET("browser_enable_gpu_compositing", bBrowserGPUCompositingEnabled);

bool bBrowserGPUCompositingSetting = m_pCheckBoxBrowserGPUCompositingEnabled->GetSelected();
bool bBrowserGPUCompositingSettingChanged = (bBrowserGPUCompositingSetting != bBrowserGPUCompositingEnabled);
CVARS_SET("browser_enable_gpu_compositing", bBrowserGPUCompositingSetting);

// Ensure CVARS ranges ok
CClientVariables::GetSingleton().ValidateValues();

Expand All @@ -3752,8 +3733,7 @@ void CSettings::SaveData()
gameSettings->Save();

// Ask to restart?
if (bIsVideoModeChanged || bIsAntiAliasingChanged || bIsCustomizedSAFilesChanged || processsDPIAwareChanged || bBrowserGPUSettingChanged ||
bBrowserGPUCompositingSettingChanged)
if (bIsVideoModeChanged || bIsAntiAliasingChanged || bIsCustomizedSAFilesChanged || processsDPIAwareChanged || bBrowserGPUSettingChanged)
ShowRestartQuestion();
else if (CModManager::GetSingleton().IsLoaded() && bBrowserSettingChanged)
ShowDisconnectQuestion();
Expand Down Expand Up @@ -4906,9 +4886,3 @@ bool CSettings::IsActive()
{
return m_pWindow->IsActive();
}

bool CSettings::OnGPUSettingChanged(CGUIElement* pElement)
{
m_pCheckBoxBrowserGPUCompositingEnabled->SetEnabled(m_pCheckBoxBrowserGPUEnabled->GetSelected());
return true;
}
2 changes: 0 additions & 2 deletions Client/core/CSettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,6 @@ class CSettings
CGUIGridList* m_pGridBrowserWhitelist;
CGUIButton* m_pButtonBrowserWhitelistRemove;
CGUICheckBox* m_pCheckBoxBrowserGPUEnabled;
CGUICheckBox* m_pCheckBoxBrowserGPUCompositingEnabled;
bool m_bBrowserListsChanged;
bool m_bBrowserListsLoadEnabled;

Expand Down Expand Up @@ -384,7 +383,6 @@ class CSettings
bool OnBrowserWhitelistRemove(CGUIElement* pElement);
bool OnBrowserWhitelistDomainAddFocused(CGUIElement* pElement);
bool OnBrowserWhitelistDomainAddDefocused(CGUIElement* pElement);
bool OnGPUSettingChanged(CGUIElement* pElement);

bool OnMouseDoubleClick(CGUIMouseEventArgs Args);

Expand Down
3 changes: 1 addition & 2 deletions Client/sdk/core/CWebCoreInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class CWebCoreInterface
{
public:
virtual ~CWebCoreInterface() {}
virtual bool Initialise(bool gpuEnabled, bool gpuCompositingEnabled) = 0;
virtual bool Initialise(bool gpuEnabled) = 0;

virtual CWebViewInterface* CreateWebView(unsigned int uiWidth, unsigned int uiHeight, bool bIsLocal, CWebBrowserItem* pWebBrowserRenderItem,
bool bTransparent) = 0;
Expand Down Expand Up @@ -92,5 +92,4 @@ class CWebCoreInterface
eWebFilterState state = eWebFilterState::WEBFILTER_ALL) = 0;

virtual bool GetGPUEnabled() const noexcept = 0;
virtual bool GetGPUCompositingEnabled() const noexcept = 0;
};
Loading

0 comments on commit b30a4a2

Please sign in to comment.