Change casing to comply with review

This commit is contained in:
Gess1t 2024-10-30 23:18:14 +01:00
parent d34aed7ccd
commit 4677d9f7ea
2 changed files with 21 additions and 21 deletions

View File

@ -41,9 +41,9 @@ void VideoSettingsDialog::setEnabled()
{ {
auto& cfg = emuInstance->getGlobalConfig(); auto& cfg = emuInstance->getGlobalConfig();
int renderer = cfg.GetInt("3D.Renderer"); int renderer = cfg.GetInt("3D.Renderer");
int ogldisplay = cfg.GetBool("Screen.UseGL"); int oglDisplay = cfg.GetBool("Screen.UseGL");
if (!compute_gl) if (!computeGl)
{ {
ui->rb3DCompute->setEnabled(false); ui->rb3DCompute->setEnabled(false);
if (renderer == renderer3D_OpenGLCompute) // fallback to software renderer if (renderer == renderer3D_OpenGLCompute) // fallback to software renderer
@ -53,10 +53,10 @@ void VideoSettingsDialog::setEnabled()
} }
} }
if (!base_gl) // fallback to software renderer if (!baseGl) // fallback to software renderer
{ {
renderer = renderer3D_Software; renderer = renderer3D_Software;
ogldisplay = false; oglDisplay = false;
ui->rb3DOpenGL->setEnabled(false); ui->rb3DOpenGL->setEnabled(false);
ui->cbGLDisplay->setChecked(false); ui->cbGLDisplay->setChecked(false);
@ -64,11 +64,11 @@ void VideoSettingsDialog::setEnabled()
} }
cfg.SetInt("3D.Renderer", renderer); cfg.SetInt("3D.Renderer", renderer);
cfg.SetBool("Screen.UseGL", ogldisplay); cfg.SetBool("Screen.UseGL", oglDisplay);
bool softwareRenderer = renderer == renderer3D_Software; bool softwareRenderer = renderer == renderer3D_Software;
ui->cbGLDisplay->setEnabled(softwareRenderer && base_gl); ui->cbGLDisplay->setEnabled(softwareRenderer && baseGl);
setVsyncControlEnable(ogldisplay || !softwareRenderer); setVsyncControlEnable(oglDisplay || !softwareRenderer);
ui->cbSoftwareThreaded->setEnabled(softwareRenderer); ui->cbSoftwareThreaded->setEnabled(softwareRenderer);
ui->cbxGLResolution->setEnabled(!softwareRenderer); ui->cbxGLResolution->setEnabled(!softwareRenderer);
ui->cbBetterPolygons->setEnabled(renderer == renderer3D_OpenGL); ui->cbBetterPolygons->setEnabled(renderer == renderer3D_OpenGL);
@ -77,32 +77,32 @@ void VideoSettingsDialog::setEnabled()
int VideoSettingsDialog::getsupportedRenderers() int VideoSettingsDialog::getsupportedRenderers()
{ {
ScreenPanelGL *glpanel = new ScreenPanelGL(this); ScreenPanelGL *glPanel = new ScreenPanelGL(this);
std::optional<WindowInfo> windowinfo = glpanel->getWindowInfo(); std::optional<WindowInfo> windowInfo = glPanel->getWindowInfo();
int renderer = renderer3D_Software; int renderer = renderer3D_Software;
if (windowinfo.has_value()) if (windowInfo.has_value())
{ {
std::array<GL::Context::Version, 2> versionsToTry = { std::array<GL::Context::Version, 2> versionsToTry = {
GL::Context::Version{GL::Context::Profile::Core, 4, 3}, GL::Context::Version{GL::Context::Profile::Core, 4, 3},
GL::Context::Version{GL::Context::Profile::Core, 3, 2} GL::Context::Version{GL::Context::Profile::Core, 3, 2}
}; };
std::unique_ptr<GL::Context> glContext = GL::Context::Create(*windowinfo, versionsToTry); std::unique_ptr<GL::Context> glContext = GL::Context::Create(*windowInfo, versionsToTry);
if (glContext) if (glContext)
{ {
const char* gl_version_str = reinterpret_cast<const char*>(glGetString(GL_VERSION)); const char* glVersionStr = reinterpret_cast<const char*>(glGetString(GL_VERSION));
if (gl_version_str) if (glVersionStr)
{ {
int gl_version = 0; int gl_version = 0;
// A proper version string or object isn't provided, so we have to parse it ourselves // A proper version string or object isn't provided, so we have to parse it ourselves
if (isdigit(gl_version_str[0]) && isdigit(gl_version_str[2])) if (isdigit(glVersionStr[0]) && isdigit(glVersionStr[2]))
gl_version = (gl_version_str[0] - '0') * 100 + gl_version = (glVersionStr[0] - '0') * 100 +
(gl_version_str[2] - '0') * 10; (glVersionStr[2] - '0') * 10;
// OpenGL 4.3 is required for Compute Shaders while 3.2 is the base requirement // OpenGL 4.3 is required for Compute Shaders while 3.2 is the base requirement
if (gl_version >= 430) if (gl_version >= 430)
@ -113,7 +113,7 @@ int VideoSettingsDialog::getsupportedRenderers()
} }
} }
delete glpanel; delete glPanel;
return renderer; return renderer;
} }
@ -126,8 +126,8 @@ VideoSettingsDialog::VideoSettingsDialog(QWidget* parent) : QDialog(parent), ui(
emuInstance = ((MainWindow*)parent)->getEmuInstance(); emuInstance = ((MainWindow*)parent)->getEmuInstance();
int supportedRenderers = getsupportedRenderers(); int supportedRenderers = getsupportedRenderers();
base_gl = supportedRenderers > renderer3D_Software; baseGl = supportedRenderers > renderer3D_Software;
compute_gl = supportedRenderers == renderer3D_OpenGLCompute; computeGl = supportedRenderers == renderer3D_OpenGLCompute;
auto& cfg = emuInstance->getGlobalConfig(); auto& cfg = emuInstance->getGlobalConfig();
oldRenderer = cfg.GetInt("3D.Renderer"); oldRenderer = cfg.GetInt("3D.Renderer");

View File

@ -78,8 +78,8 @@ private:
Ui::VideoSettingsDialog* ui; Ui::VideoSettingsDialog* ui;
EmuInstance* emuInstance; EmuInstance* emuInstance;
bool base_gl; bool baseGl;
bool compute_gl; bool computeGl;
QButtonGroup* grp3DRenderer; QButtonGroup* grp3DRenderer;