Gtk: Remove option to disable OpenGL.

OpenGL is the optimal display mode until Vulkan is in, and it's
mandatory on Wayland. Don't let it be disabled.
This commit is contained in:
BearOso 2022-04-19 17:22:42 -05:00
parent 1085ed6fad
commit 3c729a9763
8 changed files with 20 additions and 70 deletions

View File

@ -1,7 +1,6 @@
cmake_minimum_required(VERSION 3.20)
project(snes9x-gtk VERSION 1.61)
option(USE_OPENGL "Build support for OpenGL" ON)
option(USE_SLANG "Build support for slang-type shaders" ON)
option(USE_XV "Build support for XVideo output" ON)
option(USE_PORTAUDIO "Build PortAudio sound driver" ON)
@ -56,17 +55,14 @@ find_library(DL dl REQUIRED)
list(APPEND ARGS ${SDL2_CFLAGS} ${GTK_CFLAGS} ${XRANDR_CFLAGS})
list(APPEND LIBS ${X11} ${XEXT} ${DL} ${SDL2_LIBRARIES} ${GTK_LIBRARIES} ${XRANDR_LIBRARIES})
if(USE_OPENGL)
pkg_check_modules(EPOXY REQUIRED epoxy)
list(APPEND ARGS ${EPOXY_CFLAGS})
list(APPEND LIBS ${EPOXY_LIBRARIES})
list(APPEND SOURCES src/gtk_display_driver_opengl.cpp
src/gtk_glx_context.cpp
../shaders/glsl.cpp
../shaders/shader_helpers.cpp
src/gtk_shader_parameters.cpp)
list(APPEND DEFINES "USE_OPENGL")
endif()
pkg_check_modules(EPOXY REQUIRED epoxy)
list(APPEND ARGS ${EPOXY_CFLAGS})
list(APPEND LIBS ${EPOXY_LIBRARIES})
list(APPEND SOURCES src/gtk_display_driver_opengl.cpp
src/gtk_glx_context.cpp
../shaders/glsl.cpp
../shaders/shader_helpers.cpp
src/gtk_shader_parameters.cpp)
if(USE_SLANG)
list(APPEND SOURCES ../shaders/slang.cpp)

View File

@ -52,28 +52,18 @@ deps += dl_dep
xrandr_dep = dependency('xrandr')
deps += xrandr_dep
opengl = get_option('opengl')
if opengl
opengl_dep = dependency('epoxy', required: false)
if opengl_dep.found()
args += '-DUSE_OPENGL'
srcs += [ 'src/gtk_display_driver_opengl.cpp',
'src/gtk_display_driver_opengl.h',
'src/gtk_glx_context.cpp',
'src/gtk_glx_context.h',
'../shaders/glsl.cpp',
'../shaders/shader_helpers.cpp',
'src/gtk_shader_parameters.cpp' ]
deps += opengl_dep
else
opengl = false
warns += 'libepoxy not found. OpenGL will disabled.'
endif
endif
opengl_dep = dependency('epoxy', required: true)
srcs += [ 'src/gtk_display_driver_opengl.cpp',
'src/gtk_display_driver_opengl.h',
'src/gtk_glx_context.cpp',
'src/gtk_glx_context.h',
'../shaders/glsl.cpp',
'../shaders/shader_helpers.cpp',
'src/gtk_shader_parameters.cpp' ]
deps += opengl_dep
slang = get_option('slang')
if slang and opengl
if slang
cmake = import('cmake')
@ -397,8 +387,7 @@ summary = [
' localedir: ' + localedir,
'[Options] Build type: ' + get_option('buildtype'),
' Wayland: ' + wayland.to_string(),
' OpenGL: ' + opengl.to_string(),
' slang shaders: ' + slang.to_string(),
' slang shaders: ' + slang.to_string(),
' XVideo: ' + xv.to_string(),
' ALSA: ' + alsa.to_string(),
' Open Sound System: ' + oss.to_string(),

View File

@ -1,4 +1,3 @@
option('opengl', type: 'boolean', value: true, description: 'Build support for OpenGL')
option('slang', type: 'boolean', value: true, description: 'Build support for slang-type shaders')
option('xv', type: 'boolean', value: true, description: 'Build support for XV')
option('portaudio', type: 'boolean', value: true, description: 'Build PortAudio sound driver')

View File

@ -148,7 +148,6 @@ int Snes9xConfig::load_defaults()
rewind_buffer_size = 0;
Settings.Rewinding = false;
#ifdef USE_OPENGL
sync_to_vblank = true;
use_pbos = true;
pbo_format = 0;
@ -157,7 +156,6 @@ int Snes9xConfig::load_defaults()
shader_filename.clear();
use_glfinish = false;
use_sync_control = false;
#endif
/* Snes9x Variables */
Settings.MouseMaster = true;
@ -255,7 +253,6 @@ int Snes9xConfig::save_config_file()
outbool("MergeFields", ntsc_setup.merge_fields);
outint("ScanlineIntensity", ntsc_scanline_intensity);
#ifdef USE_OPENGL
section = "OpenGL";
outbool("VSync", sync_to_vblank);
outbool("glFinish", use_glfinish);
@ -265,7 +262,6 @@ int Snes9xConfig::save_config_file()
outbool("UsePixelBufferObjects", use_pbos);
outint("PixelBufferObjectBitDepth", pbo_format);
outstring("ShaderFile", shader_filename);
#endif
section = "Sound";
outbool("MuteSound", mute_sound);
@ -489,7 +485,6 @@ int Snes9xConfig::load_config_file()
inbool("MergeFields", ntsc_setup.merge_fields);
inint("ScanlineIntensity", ntsc_scanline_intensity);
#ifdef USE_OPENGL
section = "OpenGL";
inbool("VSync", sync_to_vblank);
inbool("glFinish", use_glfinish);
@ -499,7 +494,6 @@ int Snes9xConfig::load_config_file()
inbool("UseNonPowerOfTwoTextures", npot_textures);
inbool("EnableCustomShaders", use_shaders);
instr("ShaderFile", shader_filename);
#endif
section = "Sound";
inbool("MuteSound", mute_sound);
@ -663,10 +657,8 @@ int Snes9xConfig::load_config_file()
scale_method = 0;
#endif /* USE_XBRZ */
#ifdef USE_OPENGL
if (pbo_format != 32)
pbo_format = 16;
#endif
if (Settings.SkipFrames == THROTTLE_SOUND_SYNC)
Settings.SoundSync = true;

View File

@ -154,7 +154,6 @@ class Snes9xConfig
XRRScreenResources *xrr_screen_resources;
XRRCrtcInfo *xrr_crtc_info;
#ifdef USE_OPENGL
bool sync_to_vblank;
bool use_pbos;
int pbo_format;
@ -163,8 +162,6 @@ class Snes9xConfig
std::string shader_filename;
bool use_glfinish;
bool use_sync_control;
#endif
JoyDevices joysticks;
int joystick_threshold;

View File

@ -23,9 +23,7 @@
#include "gtk_display_driver_xv.h"
#endif
#ifdef USE_OPENGL
#include "gtk_display_driver_opengl.h"
#endif
static S9xDisplayDriver *driver;
static snes_ntsc_t snes_ntsc;
@ -1299,11 +1297,7 @@ void S9xQueryDrivers()
gui_config->allow_xv = S9xXVDisplayDriver::query_availability();
#endif
#ifdef USE_OPENGL
gui_config->allow_opengl = S9xOpenGLDisplayDriver::query_availability();
#else
gui_config->allow_opengl = false;
#endif
gui_config->allow_xrandr = false;
#ifdef GDK_WINDOWING_X11
@ -1414,11 +1408,9 @@ static void S9xInitDriver()
switch (gui_config->hw_accel)
{
#ifdef USE_OPENGL
case HWA_OPENGL:
driver = new S9xOpenGLDisplayDriver(top_level, gui_config);
break;
#endif
#if defined(USE_XV) && defined(GDK_WINDOWING_X11)
case HWA_XV:

View File

@ -333,7 +333,6 @@ bool Snes9xPreferences::key_pressed(GdkEventKey *event)
void Snes9xPreferences::shader_select()
{
#ifdef USE_OPENGL
auto entry = get_object<Gtk::Entry>("fragment_shader");
auto dialog = Gtk::FileChooserDialog(*window.get(), _("Select Shader File"));
@ -357,7 +356,6 @@ void Snes9xPreferences::shader_select()
if (!filename.empty())
entry->set_text(filename);
}
#endif
}
void Snes9xPreferences::load_ntsc_settings()
@ -467,7 +465,6 @@ void Snes9xPreferences::move_settings_to_dialog()
set_combo ("frameskip_combo", Settings.SkipFrames);
set_check ("bilinear_filter", Settings.BilinearFilter);
#ifdef USE_OPENGL
set_check ("sync_to_vblank", config->sync_to_vblank);
set_check ("use_glfinish", config->use_glfinish);
set_check ("use_sync_control", config->use_sync_control);
@ -476,7 +473,7 @@ void Snes9xPreferences::move_settings_to_dialog()
set_check ("npot_textures", config->npot_textures);
set_check ("use_shaders", config->use_shaders);
set_entry_text ("fragment_shader", config->shader_filename.c_str ());
#endif
set_spin ("joystick_threshold", config->joystick_threshold);
/* Control bindings */
@ -631,7 +628,6 @@ void Snes9xPreferences::get_settings_from_dialog()
Settings.InterpolationMethod = get_combo("sound_filter");
#endif
#ifdef USE_OPENGL
int pbo_format = get_combo("pixel_format") == 1 ? 32 : 16;
if (config->sync_to_vblank != get_check("sync_to_vblank") ||
@ -653,7 +649,6 @@ void Snes9xPreferences::get_settings_from_dialog()
config->use_sync_control = get_check("use_sync_control");
config->shader_filename = get_entry_text ("fragment_shader");
config->pbo_format = pbo_format;
#endif
std::string new_sram_directory = get_entry_text("sram_directory");
config->savestate_directory = get_entry_text("savestate_directory");

View File

@ -16,9 +16,7 @@
#include <X11/extensions/Xvlib.h>
#endif
#ifdef USE_OPENGL
#include "gtk_shader_parameters.h"
#endif
#include "gtk_s9x.h"
#include "gtk_preferences.h"
@ -99,13 +97,7 @@ Snes9xWindow::Snes9xWindow(Snes9xConfig *config)
gtk_widget_realize(GTK_WIDGET(window->gobj()));
gtk_widget_realize(GTK_WIDGET(drawing_area->gobj()));
#ifndef USE_OPENGL
get_object<Gtk::Widget>("shader_parameters_separator")->hide();
get_object<Gtk::Widget>("shader_parameters_item")->hide();
#else
enable_widget("shader_parameters_item", false);
#endif
connect_signals();
@ -180,11 +172,9 @@ void Snes9xWindow::connect_signals()
S9xReset();
});
#ifdef USE_OPENGL
get_object<Gtk::MenuItem>("shader_parameters_item")->signal_activate().connect([&] {
gtk_shader_parameters_dialog(get_window());
});
#endif
const std::vector<const char *> port_items = { "joypad1", "mouse1", "superscope1", "joypad2", "mouse2", "multitap2", "superscope2", "nothingpluggedin2" };
for (auto &name : port_items)