Skip to content

Commit 06424e5

Browse files
committed
Make OpenGL error reporting opt-in
1 parent 6d4409a commit 06424e5

3 files changed

Lines changed: 35 additions & 15 deletions

File tree

src/core/psxemulator.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,11 +184,13 @@ class Emulator {
184184
typedef Setting<bool, TYPESTRING("8Megs"), false> Setting8MB;
185185
typedef Setting<int, TYPESTRING("GUITheme"), 0> SettingGUITheme;
186186
typedef Setting<int, TYPESTRING("Dither"), 2> SettingDither;
187+
typedef Setting<bool, TYPESTRING("ReportGLErrors"), false> SettingGLErrorReporting;
187188

188189
Settings<SettingStdout, SettingLogfile, SettingMcd1, SettingMcd2, SettingBios, SettingPpfDir, SettingPsxExe,
189190
SettingXa, SettingSpuIrq, SettingBnWMdec, SettingScaler, SettingAutoVideo, SettingVideo, SettingCDDA,
190191
SettingFastBoot, SettingDebugSettings, SettingRCntFix, SettingIsoPath, SettingLocale, SettingMcd1Inserted,
191-
SettingMcd2Inserted, SettingBiosOverlay, SettingDynarec, Setting8MB, SettingGUITheme, SettingDither>
192+
SettingMcd2Inserted, SettingBiosOverlay, SettingDynarec, Setting8MB, SettingGUITheme, SettingDither,
193+
SettingGLErrorReporting>
192194
settings;
193195
class PcsxConfig {
194196
public:

src/gui/gui.cc

Lines changed: 30 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ end)(jit.status()))
333333

334334
setFullscreen(m_fullscreen);
335335
const auto currentTheme =
336-
g_emulator->settings.get<Emulator::SettingGUITheme>().value; // On boot: reload GUI theme
336+
emuSettings.get<Emulator::SettingGUITheme>().value; // On boot: reload GUI theme
337337
applyTheme(currentTheme);
338338

339339
if (emuSettings.get<Emulator::SettingMcd1>().empty()) {
@@ -397,8 +397,10 @@ end)(jit.status()))
397397
glfwSetKeyCallback(m_window, glfwKeyCallbackTrampoline);
398398
glfwSetJoystickCallback([](int jid, int event) { PCSX::g_emulator->m_pads->scanGamepads(); });
399399
ImGui_ImplOpenGL3_Init(GL_SHADER_VERSION);
400-
glEnable(GL_DEBUG_OUTPUT);
401-
if (glDebugMessageCallback) {
400+
401+
if (glDebugMessageCallback && g_emulator->settings.get<Emulator::SettingGLErrorReporting>()) {
402+
m_reportGLErrors = true;
403+
glEnable(GL_DEBUG_OUTPUT);
402404
glDebugMessageCallback(
403405
[](GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar* message,
404406
GLvoid* userParam) {
@@ -1064,7 +1066,7 @@ void PCSX::GUI::endFrame() {
10641066
m_breakpoints.draw(_("Breakpoints"));
10651067
}
10661068

1067-
about();
1069+
changed |= about();
10681070
interruptsScaler();
10691071

10701072
if (m_dwarf.m_show) {
@@ -1508,8 +1510,10 @@ bool PCSX::GUI::showThemes() {
15081510
return changed;
15091511
}
15101512

1511-
void PCSX::GUI::about() {
1512-
if (!m_showAbout) return;
1513+
bool PCSX::GUI::about() {
1514+
if (!m_showAbout) return false;
1515+
bool changed = false;
1516+
15131517
ImGui::SetNextWindowPos(ImVec2(200, 100), ImGuiCond_FirstUseEver);
15141518
ImGui::SetNextWindowSize(ImVec2(880, 600), ImGuiCond_FirstUseEver);
15151519
if (ImGui::Begin(_("About"), &m_showAbout)) {
@@ -1529,16 +1533,28 @@ void PCSX::GUI::about() {
15291533
ImGui::EndTabItem();
15301534
}
15311535
if (ImGui::BeginTabItem(_("OpenGL information"))) {
1532-
if (glDebugMessageCallback) {
1536+
if (m_reportGLErrors) {
15331537
ImGui::TextUnformatted(_("OpenGL error reporting: enabled"));
15341538
} else {
15351539
ImGui::TextUnformatted(_("OpenGL error reporting: disabled"));
1536-
ShowHelpMarker(
1537-
_("OpenGL error reporting has been disabled because your OpenGL driver is too old. Error "
1538-
"reporting requires at least OpenGL 4.3. Please update your graphics drivers, or contact "
1539-
"your GPU vendor for correct OpenGL drivers. Disabled OpenGL error reporting won't have a "
1540-
"negative impact on the performances of this software, but user code such as the shader "
1541-
"editor won't be able to properly report problems accurately."));
1540+
if (!glDebugMessageCallback) {
1541+
ShowHelpMarker(_(
1542+
"OpenGL error reporting has been disabled because your OpenGL driver is too old. Error "
1543+
"reporting requires at least OpenGL 4.3. Please update your graphics drivers, or contact "
1544+
"your GPU vendor for correct OpenGL drivers. Disabled OpenGL error reporting won't have a "
1545+
"negative impact on the performances of this software, but user code such as the shader "
1546+
"editor won't be able to properly report problems accurately."));
1547+
}
1548+
}
1549+
1550+
if (glDebugMessageCallback) {
1551+
changed |= ImGui::Checkbox(_("Enable OpenGL error reporting"),
1552+
&g_emulator->settings.get<Emulator::SettingGLErrorReporting>().value);
1553+
1554+
ShowHelpMarker(_(
1555+
"OpenGL error reporting is necessary for properly reporting OpenGL problems. "
1556+
"However it requires OpenGL 4.3+ and might have performance repercussions on "
1557+
"some PCs. (Requires reboot)"));
15421558
}
15431559
ImGui::Text(_("Core profile: %s"), m_hasCoreProfile ? "yes" : "no");
15441560
someString(_("Vendor"), GL_VENDOR);
@@ -1560,6 +1576,7 @@ void PCSX::GUI::about() {
15601576
}
15611577
}
15621578
ImGui::End();
1579+
return changed;
15631580
}
15641581

15651582
void PCSX::GUI::update(bool vsync) {

src/gui/gui.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ class GUI final {
161161

162162
bool configure();
163163
bool showThemes(); // Theme window : Allows for custom imgui themes
164-
void about();
164+
bool about();
165165
void interruptsScaler();
166166

167167
public:
@@ -294,6 +294,7 @@ class GUI final {
294294
Widgets::LuaInspector m_luaInspector = {settings.get<ShowLuaInspector>().value};
295295

296296
bool m_gotImguiUserError = false;
297+
bool m_reportGLErrors = false;
297298
std::string m_imguiUserError;
298299

299300
ImFont *m_mainFont;

0 commit comments

Comments
 (0)