From cdaa52256f0ea1cd1b84d2c2990bd60e351d85a5 Mon Sep 17 00:00:00 2001 From: RSDuck Date: Wed, 12 Oct 2022 21:53:56 +0200 Subject: [PATCH] linux support --- CMakeLists.txt | 7 + cmake/ECMFindModuleHelpers.cmake | 297 ++++++++ cmake/ECMFindModuleHelpersStub.cmake | 1 + cmake/FindEGL.cmake | 172 +++++ src/CMakeLists.txt | 16 +- src/duckstation/duckstation_compat.h | 5 + src/duckstation/gl/context.cpp | 50 +- src/duckstation/gl/context_egl.cpp | 432 +++++++++++ src/duckstation/gl/context_egl.h | 48 ++ src/duckstation/gl/context_egl_wayland.cpp | 86 +++ src/duckstation/gl/context_egl_wayland.h | 33 + src/duckstation/gl/context_egl_x11.cpp | 69 ++ src/duckstation/gl/context_egl_x11.h | 28 + src/duckstation/gl/context_glx.cpp | 328 ++++++++ src/duckstation/gl/context_glx.h | 44 ++ src/duckstation/gl/x11_window.cpp | 101 +++ src/duckstation/gl/x11_window.h | 48 ++ src/frontend/qt_sdl/CMakeLists.txt | 5 + src/frontend/qt_sdl/main.cpp | 25 +- src/frontend/qt_sdl/main.h | 5 +- src/frontend/qt_sdl/main_shaders.h | 5 +- src/glad/glad_glx.c | 550 +++++++++++++- src/glad/glad_glx.h | 841 ++++++++++++++++++++- 23 files changed, 3130 insertions(+), 66 deletions(-) create mode 100644 cmake/ECMFindModuleHelpers.cmake create mode 100644 cmake/ECMFindModuleHelpersStub.cmake create mode 100644 cmake/FindEGL.cmake create mode 100644 src/duckstation/gl/context_egl.cpp create mode 100644 src/duckstation/gl/context_egl.h create mode 100644 src/duckstation/gl/context_egl_wayland.cpp create mode 100644 src/duckstation/gl/context_egl_wayland.h create mode 100644 src/duckstation/gl/context_egl_x11.cpp create mode 100644 src/duckstation/gl/context_egl_x11.h create mode 100644 src/duckstation/gl/context_glx.cpp create mode 100644 src/duckstation/gl/context_glx.h create mode 100644 src/duckstation/gl/x11_window.cpp create mode 100644 src/duckstation/gl/x11_window.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 297f71d1..0ca70ece 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -101,6 +101,13 @@ endif() option(BUILD_QT_SDL "Build Qt/SDL frontend" ON) +find_package(ECM REQUIRED NO_MODULE) +list(APPEND CMAKE_MODULE_PATH "${ECM_MODULE_PATH}") + +find_package(X11 REQUIRED) +find_package(EGL REQUIRED) +find_package(Wayland REQUIRED Client) + add_subdirectory(src) if (BUILD_QT_SDL) diff --git a/cmake/ECMFindModuleHelpers.cmake b/cmake/ECMFindModuleHelpers.cmake new file mode 100644 index 00000000..f2e32f95 --- /dev/null +++ b/cmake/ECMFindModuleHelpers.cmake @@ -0,0 +1,297 @@ +#.rst: +# ECMFindModuleHelpers +# -------------------- +# +# Helper macros for find modules: ecm_find_package_version_check(), +# ecm_find_package_parse_components() and +# ecm_find_package_handle_library_components(). +# +# :: +# +# ecm_find_package_version_check() +# +# Prints warnings if the CMake version or the project's required CMake version +# is older than that required by extra-cmake-modules. +# +# :: +# +# ecm_find_package_parse_components( +# RESULT_VAR +# KNOWN_COMPONENTS [ [...]] +# [SKIP_DEPENDENCY_HANDLING]) +# +# This macro will populate with a list of components found in +# _FIND_COMPONENTS, after checking that all those components are in the +# list of KNOWN_COMPONENTS; if there are any unknown components, it will print +# an error or warning (depending on the value of _FIND_REQUIRED) and call +# return(). +# +# The order of components in is guaranteed to match the order they +# are listed in the KNOWN_COMPONENTS argument. +# +# If SKIP_DEPENDENCY_HANDLING is not set, for each component the variable +# __component_deps will be checked for dependent components. +# If is listed in _FIND_COMPONENTS, then all its (transitive) +# dependencies will also be added to . +# +# :: +# +# ecm_find_package_handle_library_components( +# COMPONENTS [ [...]] +# [SKIP_DEPENDENCY_HANDLING]) +# [SKIP_PKG_CONFIG]) +# +# Creates an imported library target for each component. The operation of this +# macro depends on the presence of a number of CMake variables. +# +# The __lib variable should contain the name of this library, +# and __header variable should contain the name of a header +# file associated with it (whatever relative path is normally passed to +# '#include'). __header_subdir variable can be used to specify +# which subdirectory of the include path the headers will be found in. +# ecm_find_package_components() will then search for the library +# and include directory (creating appropriate cache variables) and create an +# imported library target named ::. +# +# Additional variables can be used to provide additional information: +# +# If SKIP_PKG_CONFIG, the __pkg_config variable is set, and +# pkg-config is found, the pkg-config module given by +# __pkg_config will be searched for and used to help locate the +# library and header file. It will also be used to set +# __VERSION. +# +# Note that if version information is found via pkg-config, +# __FIND_VERSION can be set to require a particular version +# for each component. +# +# If SKIP_DEPENDENCY_HANDLING is not set, the INTERFACE_LINK_LIBRARIES property +# of the imported target for will be set to contain the imported +# targets for the components listed in __component_deps. +# _FOUND will also be set to false if any of the compoments in +# __component_deps are not found. This requires the components +# in __component_deps to be listed before in the +# COMPONENTS argument. +# +# The following variables will be set: +# +# ``_TARGETS`` +# the imported targets +# ``_LIBRARIES`` +# the found libraries +# ``_INCLUDE_DIRS`` +# the combined required include directories for the components +# ``_DEFINITIONS`` +# the "other" CFLAGS provided by pkg-config, if any +# ``_VERSION`` +# the value of ``__VERSION`` for the first component that +# has this variable set (note that components are searched for in the order +# they are passed to the macro), although if it is already set, it will not +# be altered +# +# Note that these variables are never cleared, so if +# ecm_find_package_handle_library_components() is called multiple times with +# different components (typically because of multiple find_package() calls) then +# ``_TARGETS``, for example, will contain all the targets found in any +# call (although no duplicates). +# +# Since pre-1.0.0. + +#============================================================================= +# Copyright 2014 Alex Merry +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. The name of the author may not be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +include(CMakeParseArguments) + +macro(ecm_find_package_version_check module_name) + if(CMAKE_VERSION VERSION_LESS 2.8.12) + message(FATAL_ERROR "CMake 2.8.12 is required by Find${module_name}.cmake") + endif() + if(CMAKE_MINIMUM_REQUIRED_VERSION VERSION_LESS 2.8.12) + message(AUTHOR_WARNING "Your project should require at least CMake 2.8.12 to use Find${module_name}.cmake") + endif() +endmacro() + +macro(ecm_find_package_parse_components module_name) + set(ecm_fppc_options SKIP_DEPENDENCY_HANDLING) + set(ecm_fppc_oneValueArgs RESULT_VAR) + set(ecm_fppc_multiValueArgs KNOWN_COMPONENTS DEFAULT_COMPONENTS) + cmake_parse_arguments(ECM_FPPC "${ecm_fppc_options}" "${ecm_fppc_oneValueArgs}" "${ecm_fppc_multiValueArgs}" ${ARGN}) + + if(ECM_FPPC_UNPARSED_ARGUMENTS) + message(FATAL_ERROR "Unexpected arguments to ecm_find_package_parse_components: ${ECM_FPPC_UNPARSED_ARGUMENTS}") + endif() + if(NOT ECM_FPPC_RESULT_VAR) + message(FATAL_ERROR "Missing RESULT_VAR argument to ecm_find_package_parse_components") + endif() + if(NOT ECM_FPPC_KNOWN_COMPONENTS) + message(FATAL_ERROR "Missing KNOWN_COMPONENTS argument to ecm_find_package_parse_components") + endif() + if(NOT ECM_FPPC_DEFAULT_COMPONENTS) + set(ECM_FPPC_DEFAULT_COMPONENTS ${ECM_FPPC_KNOWN_COMPONENTS}) + endif() + + if(${module_name}_FIND_COMPONENTS) + set(ecm_fppc_requestedComps ${${module_name}_FIND_COMPONENTS}) + + if(NOT ECM_FPPC_SKIP_DEPENDENCY_HANDLING) + # Make sure deps are included + foreach(ecm_fppc_comp ${ecm_fppc_requestedComps}) + foreach(ecm_fppc_dep_comp ${${module_name}_${ecm_fppc_comp}_component_deps}) + list(FIND ecm_fppc_requestedComps "${ecm_fppc_dep_comp}" ecm_fppc_index) + if("${ecm_fppc_index}" STREQUAL "-1") + if(NOT ${module_name}_FIND_QUIETLY) + message(STATUS "${module_name}: ${ecm_fppc_comp} requires ${${module_name}_${ecm_fppc_comp}_component_deps}") + endif() + list(APPEND ecm_fppc_requestedComps "${ecm_fppc_dep_comp}") + endif() + endforeach() + endforeach() + else() + message(STATUS "Skipping dependency handling for ${module_name}") + endif() + list(REMOVE_DUPLICATES ecm_fppc_requestedComps) + + # This makes sure components are listed in the same order as + # KNOWN_COMPONENTS (potentially important for inter-dependencies) + set(${ECM_FPPC_RESULT_VAR}) + foreach(ecm_fppc_comp ${ECM_FPPC_KNOWN_COMPONENTS}) + list(FIND ecm_fppc_requestedComps "${ecm_fppc_comp}" ecm_fppc_index) + if(NOT "${ecm_fppc_index}" STREQUAL "-1") + list(APPEND ${ECM_FPPC_RESULT_VAR} "${ecm_fppc_comp}") + list(REMOVE_AT ecm_fppc_requestedComps ${ecm_fppc_index}) + endif() + endforeach() + # if there are any left, they are unknown components + if(ecm_fppc_requestedComps) + set(ecm_fppc_msgType STATUS) + if(${module_name}_FIND_REQUIRED) + set(ecm_fppc_msgType FATAL_ERROR) + endif() + if(NOT ${module_name}_FIND_QUIETLY) + message(${ecm_fppc_msgType} "${module_name}: requested unknown components ${ecm_fppc_requestedComps}") + endif() + return() + endif() + else() + set(${ECM_FPPC_RESULT_VAR} ${ECM_FPPC_DEFAULT_COMPONENTS}) + endif() +endmacro() + +macro(ecm_find_package_handle_library_components module_name) + set(ecm_fpwc_options SKIP_PKG_CONFIG SKIP_DEPENDENCY_HANDLING) + set(ecm_fpwc_oneValueArgs) + set(ecm_fpwc_multiValueArgs COMPONENTS) + cmake_parse_arguments(ECM_FPWC "${ecm_fpwc_options}" "${ecm_fpwc_oneValueArgs}" "${ecm_fpwc_multiValueArgs}" ${ARGN}) + + if(ECM_FPWC_UNPARSED_ARGUMENTS) + message(FATAL_ERROR "Unexpected arguments to ecm_find_package_handle_components: ${ECM_FPWC_UNPARSED_ARGUMENTS}") + endif() + if(NOT ECM_FPWC_COMPONENTS) + message(FATAL_ERROR "Missing COMPONENTS argument to ecm_find_package_handle_components") + endif() + + include(FindPackageHandleStandardArgs) + find_package(PkgConfig) + foreach(ecm_fpwc_comp ${ECM_FPWC_COMPONENTS}) + set(ecm_fpwc_dep_vars) + set(ecm_fpwc_dep_targets) + if(NOT SKIP_DEPENDENCY_HANDLING) + foreach(ecm_fpwc_dep ${${module_name}_${ecm_fpwc_comp}_component_deps}) + list(APPEND ecm_fpwc_dep_vars "${module_name}_${ecm_fpwc_dep}_FOUND") + list(APPEND ecm_fpwc_dep_targets "${module_name}::${ecm_fpwc_dep}") + endforeach() + endif() + + if(NOT ECM_FPWC_SKIP_PKG_CONFIG AND ${module_name}_${ecm_fpwc_comp}_pkg_config) + pkg_check_modules(PKG_${module_name}_${ecm_fpwc_comp} QUIET + ${${module_name}_${ecm_fpwc_comp}_pkg_config}) + endif() + + find_path(${module_name}_${ecm_fpwc_comp}_INCLUDE_DIR + NAMES ${${module_name}_${ecm_fpwc_comp}_header} + HINTS ${PKG_${module_name}_${ecm_fpwc_comp}_INCLUDE_DIRS} + PATH_SUFFIXES ${${module_name}_${ecm_fpwc_comp}_header_subdir} + ) + find_library(${module_name}_${ecm_fpwc_comp}_LIBRARY + NAMES ${${module_name}_${ecm_fpwc_comp}_lib} + HINTS ${PKG_${module_name}_${ecm_fpwc_comp}_LIBRARY_DIRS} + ) + + set(${module_name}_${ecm_fpwc_comp}_VERSION "${PKG_${module_name}_${ecm_fpwc_comp}_VERSION}") + if(NOT ${module_name}_VERSION) + set(${module_name}_VERSION ${${module_name}_${ecm_fpwc_comp}_VERSION}) + endif() + + find_package_handle_standard_args(${module_name}_${ecm_fpwc_comp} + FOUND_VAR + ${module_name}_${ecm_fpwc_comp}_FOUND + REQUIRED_VARS + ${module_name}_${ecm_fpwc_comp}_LIBRARY + ${module_name}_${ecm_fpwc_comp}_INCLUDE_DIR + ${ecm_fpwc_dep_vars} + VERSION_VAR + ${module_name}_${ecm_fpwc_comp}_VERSION + ) + + mark_as_advanced( + ${module_name}_${ecm_fpwc_comp}_LIBRARY + ${module_name}_${ecm_fpwc_comp}_INCLUDE_DIR + ) + + if(${module_name}_${ecm_fpwc_comp}_FOUND) + list(APPEND ${module_name}_LIBRARIES + "${${module_name}_${ecm_fpwc_comp}_LIBRARY}") + list(APPEND ${module_name}_INCLUDE_DIRS + "${${module_name}_${ecm_fpwc_comp}_INCLUDE_DIR}") + set(${module_name}_DEFINITIONS + ${${module_name}_DEFINITIONS} + ${PKG_${module_name}_${ecm_fpwc_comp}_DEFINITIONS}) + if(NOT TARGET ${module_name}::${ecm_fpwc_comp}) + add_library(${module_name}::${ecm_fpwc_comp} UNKNOWN IMPORTED) + set_target_properties(${module_name}::${ecm_fpwc_comp} PROPERTIES + IMPORTED_LOCATION "${${module_name}_${ecm_fpwc_comp}_LIBRARY}" + INTERFACE_COMPILE_OPTIONS "${PKG_${module_name}_${ecm_fpwc_comp}_DEFINITIONS}" + INTERFACE_INCLUDE_DIRECTORIES "${${module_name}_${ecm_fpwc_comp}_INCLUDE_DIR}" + INTERFACE_LINK_LIBRARIES "${ecm_fpwc_dep_targets}" + ) + endif() + list(APPEND ${module_name}_TARGETS + "${module_name}::${ecm_fpwc_comp}") + endif() + endforeach() + if(${module_name}_LIBRARIES) + list(REMOVE_DUPLICATES ${module_name}_LIBRARIES) + endif() + if(${module_name}_INCLUDE_DIRS) + list(REMOVE_DUPLICATES ${module_name}_INCLUDE_DIRS) + endif() + if(${module_name}_DEFINITIONS) + list(REMOVE_DUPLICATES ${module_name}_DEFINITIONS) + endif() + if(${module_name}_TARGETS) + list(REMOVE_DUPLICATES ${module_name}_TARGETS) + endif() +endmacro() diff --git a/cmake/ECMFindModuleHelpersStub.cmake b/cmake/ECMFindModuleHelpersStub.cmake new file mode 100644 index 00000000..acc8c804 --- /dev/null +++ b/cmake/ECMFindModuleHelpersStub.cmake @@ -0,0 +1 @@ +include(${CMAKE_CURRENT_LIST_DIR}/ECMFindModuleHelpers.cmake) diff --git a/cmake/FindEGL.cmake b/cmake/FindEGL.cmake new file mode 100644 index 00000000..48e51728 --- /dev/null +++ b/cmake/FindEGL.cmake @@ -0,0 +1,172 @@ +#.rst: +# FindEGL +# ------- +# +# Try to find EGL. +# +# This will define the following variables: +# +# ``EGL_FOUND`` +# True if (the requested version of) EGL is available +# ``EGL_VERSION`` +# The version of EGL; note that this is the API version defined in the +# headers, rather than the version of the implementation (eg: Mesa) +# ``EGL_LIBRARIES`` +# This can be passed to target_link_libraries() instead of the ``EGL::EGL`` +# target +# ``EGL_INCLUDE_DIRS`` +# This should be passed to target_include_directories() if the target is not +# used for linking +# ``EGL_DEFINITIONS`` +# This should be passed to target_compile_options() if the target is not +# used for linking +# +# If ``EGL_FOUND`` is TRUE, it will also define the following imported target: +# +# ``EGL::EGL`` +# The EGL library +# +# In general we recommend using the imported target, as it is easier to use. +# Bear in mind, however, that if the target is in the link interface of an +# exported library, it must be made available by the package config file. +# +# Since pre-1.0.0. + +#============================================================================= +# Copyright 2014 Alex Merry +# Copyright 2014 Martin Gräßlin +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. The name of the author may not be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#============================================================================= + +include(${CMAKE_CURRENT_LIST_DIR}/ECMFindModuleHelpersStub.cmake) +include(CheckCXXSourceCompiles) +include(CMakePushCheckState) + +ecm_find_package_version_check(EGL) + +# Use pkg-config to get the directories and then use these values +# in the FIND_PATH() and FIND_LIBRARY() calls +find_package(PkgConfig) +pkg_check_modules(PKG_EGL QUIET egl) + +set(EGL_DEFINITIONS ${PKG_EGL_CFLAGS_OTHER}) + +find_path(EGL_INCLUDE_DIR + NAMES + EGL/egl.h + HINTS + ${PKG_EGL_INCLUDE_DIRS} +) +find_library(EGL_LIBRARY + NAMES + EGL + HINTS + ${PKG_EGL_LIBRARY_DIRS} +) + +# NB: We do *not* use the version information from pkg-config, as that +# is the implementation version (eg: the Mesa version) +if(EGL_INCLUDE_DIR) + # egl.h has defines of the form EGL_VERSION_x_y for each supported + # version; so the header for EGL 1.1 will define EGL_VERSION_1_0 and + # EGL_VERSION_1_1. Finding the highest supported version involves + # finding all these defines and selecting the highest numbered. + file(READ "${EGL_INCLUDE_DIR}/EGL/egl.h" _EGL_header_contents) + string(REGEX MATCHALL + "[ \t]EGL_VERSION_[0-9_]+" + _EGL_version_lines + "${_EGL_header_contents}" + ) + unset(_EGL_header_contents) + foreach(_EGL_version_line ${_EGL_version_lines}) + string(REGEX REPLACE + "[ \t]EGL_VERSION_([0-9_]+)" + "\\1" + _version_candidate + "${_EGL_version_line}" + ) + string(REPLACE "_" "." _version_candidate "${_version_candidate}") + if(NOT DEFINED EGL_VERSION OR EGL_VERSION VERSION_LESS _version_candidate) + set(EGL_VERSION "${_version_candidate}") + endif() + endforeach() + unset(_EGL_version_lines) +endif() + +cmake_push_check_state(RESET) +list(APPEND CMAKE_REQUIRED_LIBRARIES "${EGL_LIBRARY}") +list(APPEND CMAKE_REQUIRED_INCLUDES "${EGL_INCLUDE_DIR}") + +check_cxx_source_compiles(" +#include + +int main(int argc, char *argv[]) { + EGLint x = 0; EGLDisplay dpy = 0; EGLContext ctx = 0; + eglDestroyContext(dpy, ctx); +}" HAVE_EGL) + +cmake_pop_check_state() + +set(required_vars EGL_INCLUDE_DIR HAVE_EGL) +if(NOT EMSCRIPTEN) + list(APPEND required_vars EGL_LIBRARY) +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(EGL + FOUND_VAR + EGL_FOUND + REQUIRED_VARS + ${required_vars} + VERSION_VAR + EGL_VERSION +) + +if(EGL_FOUND AND NOT TARGET EGL::EGL) + if (EMSCRIPTEN) + add_library(EGL::EGL INTERFACE IMPORTED) + # Nothing further to be done, system include paths have headers and linkage is implicit. + else() + add_library(EGL::EGL UNKNOWN IMPORTED) + set_target_properties(EGL::EGL PROPERTIES + IMPORTED_LOCATION "${EGL_LIBRARY}" + INTERFACE_COMPILE_OPTIONS "${EGL_DEFINITIONS}" + INTERFACE_INCLUDE_DIRECTORIES "${EGL_INCLUDE_DIR}" + ) + endif() +endif() + +mark_as_advanced(EGL_LIBRARY EGL_INCLUDE_DIR HAVE_EGL) + +# compatibility variables +set(EGL_LIBRARIES ${EGL_LIBRARY}) +set(EGL_INCLUDE_DIRS ${EGL_INCLUDE_DIR}) +set(EGL_VERSION_STRING ${EGL_VERSION}) + +include(FeatureSummary) +set_package_properties(EGL PROPERTIES + URL "https://www.khronos.org/egl/" + DESCRIPTION "A platform-agnostic mechanism for creating rendering surfaces for use with other graphics libraries, such as OpenGL|ES and OpenVG." +) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 7c333f7a..267a8e94 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -124,11 +124,25 @@ if (ENABLE_OGLRENDERER) target_link_libraries(core PUBLIC opengl32) target_sources(core PRIVATE + # the context stuff would probably be better in the frontend? duckstation/gl/context_wgl.cpp glad/glad_wgl.c) + else() + target_sources(core PRIVATE + duckstation/gl/context_egl.cpp + duckstation/gl/context_egl_x11.cpp + duckstation/gl/context_glx.cpp + duckstation/gl/context_egl_wayland.cpp + duckstation/gl/x11_window.cpp + + glad/glad_egl.c + glad/glad_glx.c) + message("${X11_FOUND}") + message("${X11_LIBRARIES}") + target_link_libraries(core PRIVATE "${X11_LIBRARIES}" "${EGL_LIBRARIES}") + target_include_directories(core PRIVATE "${X11_INCLUDE_DIR}") endif() - # TODO: figure this out for Linux target_compile_definitions(core PUBLIC OGLRENDERER_ENABLED) endif() diff --git a/src/duckstation/duckstation_compat.h b/src/duckstation/duckstation_compat.h index 53fee83c..a661e926 100644 --- a/src/duckstation/duckstation_compat.h +++ b/src/duckstation/duckstation_compat.h @@ -8,5 +8,10 @@ #define ALWAYS_INLINE __attribute__((always_inline)) inline #define AssertMsg(cond, msg) assert(cond && msg) +#define Assert(cond) assert(cond) + +#define Panic(msg) assert(false && msg) + +#define UnreachableCode() __builtin_unreachable #endif \ No newline at end of file diff --git a/src/duckstation/gl/context.cpp b/src/duckstation/gl/context.cpp index 67bafbe2..98e6bd19 100644 --- a/src/duckstation/gl/context.cpp +++ b/src/duckstation/gl/context.cpp @@ -2,6 +2,7 @@ #include "../log.h" #include "loader.h" #include +#include #ifdef __APPLE__ #include #else @@ -13,30 +14,9 @@ Log_SetChannel(GL::Context); #include "context_wgl.h" #elif defined(__APPLE__) #include "context_agl.h" -#endif - -#ifdef USE_EGL -#if defined(USE_WAYLAND) || defined(USE_GBM) || defined(USE_FBDEV) || defined(USE_X11) -#if defined(USE_WAYLAND) -#include "context_egl_wayland.h" -#endif -#if defined(USE_GBM) -#include "context_egl_gbm.h" -#endif -#if defined(USE_FBDEV) -#include "context_egl_fbdev.h" -#endif -#if defined(USE_X11) -#include "context_egl_x11.h" -#endif -#elif defined(ANDROID) -#include "context_egl_android.h" #else -#error Unknown EGL platform -#endif -#endif - -#ifdef USE_GLX +#include "context_egl_wayland.h" +#include "context_egl_x11.h" #include "context_glx.h" #endif @@ -90,42 +70,20 @@ std::unique_ptr Context::Create(const WindowInfo& wi, const Version context = ContextWGL::Create(wi, versions_to_try, num_versions_to_try); #elif defined(__APPLE__) context = ContextAGL::Create(wi, versions_to_try, num_versions_to_try); -#elif defined(ANDROID) -#ifdef USE_EGL - context = ContextEGLAndroid::Create(wi, versions_to_try, num_versions_to_try); -#endif -#endif - -#if defined(USE_X11) +#else if (wi.type == WindowInfo::Type::X11) { -#ifdef USE_EGL const char* use_egl_x11 = std::getenv("USE_EGL_X11"); if (use_egl_x11 && std::strcmp(use_egl_x11, "1") == 0) context = ContextEGLX11::Create(wi, versions_to_try, num_versions_to_try); else context = ContextGLX::Create(wi, versions_to_try, num_versions_to_try); -#else - context = ContextGLX::Create(wi, versions_to_try, num_versions_to_try); -#endif } -#endif -#if defined(USE_WAYLAND) if (wi.type == WindowInfo::Type::Wayland) context = ContextEGLWayland::Create(wi, versions_to_try, num_versions_to_try); #endif -#if defined(USE_GBM) - if (wi.type == WindowInfo::Type::Display) - context = ContextEGLGBM::Create(wi, versions_to_try, num_versions_to_try); -#endif - -#if defined(USE_FBDEV) - if (wi.type == WindowInfo::Type::Display) - context = ContextEGLFBDev::Create(wi, versions_to_try, num_versions_to_try); -#endif - if (!context) return nullptr; diff --git a/src/duckstation/gl/context_egl.cpp b/src/duckstation/gl/context_egl.cpp new file mode 100644 index 00000000..d251a39c --- /dev/null +++ b/src/duckstation/gl/context_egl.cpp @@ -0,0 +1,432 @@ +#include "context_egl.h" +#include "../log.h" +#include "../duckstation_compat.h" +#include +#include +#include +Log_SetChannel(GL::ContextEGL); + +namespace GL { +ContextEGL::ContextEGL(const WindowInfo& wi) : Context(wi) {} + +ContextEGL::~ContextEGL() +{ + DestroySurface(); + DestroyContext(); +} + +std::unique_ptr ContextEGL::Create(const WindowInfo& wi, const Version* versions_to_try, + size_t num_versions_to_try) +{ + std::unique_ptr context = std::make_unique(wi); + if (!context->Initialize(versions_to_try, num_versions_to_try)) + return nullptr; + + return context; +} + +bool ContextEGL::Initialize(const Version* versions_to_try, size_t num_versions_to_try) +{ + if (!gladLoadEGL()) + { + Log_ErrorPrintf("Loading GLAD EGL functions failed"); + return false; + } + + if (!SetDisplay()) + return false; + + int egl_major, egl_minor; + if (!eglInitialize(m_display, &egl_major, &egl_minor)) + { + Log_ErrorPrintf("eglInitialize() failed: %d", eglGetError()); + return false; + } + Log_InfoPrintf("EGL Version: %d.%d", egl_major, egl_minor); + + const char* extensions = eglQueryString(m_display, EGL_EXTENSIONS); + if (extensions) + { + Log_InfoPrintf("EGL Extensions: %s", extensions); + m_supports_surfaceless = std::strstr(extensions, "EGL_KHR_surfaceless_context") != nullptr; + } + if (!m_supports_surfaceless) + Log_WarningPrint("EGL implementation does not support surfaceless contexts, emulating with pbuffers"); + + for (size_t i = 0; i < num_versions_to_try; i++) + { + if (CreateContextAndSurface(versions_to_try[i], nullptr, true)) + return true; + } + + return false; +} + +bool ContextEGL::SetDisplay() +{ + m_display = eglGetDisplay(static_cast(m_wi.display_connection)); + if (!m_display) + { + Log_ErrorPrintf("eglGetDisplay() failed: %d", eglGetError()); + return false; + } + + return true; +} + +void* ContextEGL::GetProcAddress(const char* name) +{ + return reinterpret_cast(eglGetProcAddress(name)); +} + +bool ContextEGL::ChangeSurface(const WindowInfo& new_wi) +{ + const bool was_current = (eglGetCurrentContext() == m_context); + if (was_current) + eglMakeCurrent(m_display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); + + if (m_surface != EGL_NO_SURFACE) + { + eglDestroySurface(m_display, m_surface); + m_surface = EGL_NO_SURFACE; + } + + m_wi = new_wi; + if (!CreateSurface()) + return false; + + if (was_current && !eglMakeCurrent(m_display, m_surface, m_surface, m_context)) + { + Log_ErrorPrintf("Failed to make context current again after surface change"); + return false; + } + + return true; +} + +void ContextEGL::ResizeSurface(u32 new_surface_width /*= 0*/, u32 new_surface_height /*= 0*/) +{ + if (new_surface_width == 0 && new_surface_height == 0) + { + EGLint surface_width, surface_height; + if (eglQuerySurface(m_display, m_surface, EGL_WIDTH, &surface_width) && + eglQuerySurface(m_display, m_surface, EGL_HEIGHT, &surface_height)) + { + m_wi.surface_width = static_cast(surface_width); + m_wi.surface_height = static_cast(surface_height); + return; + } + else + { + Log_ErrorPrintf("eglQuerySurface() failed: %d", eglGetError()); + } + } + + m_wi.surface_width = new_surface_width; + m_wi.surface_height = new_surface_height; +} + +bool ContextEGL::SwapBuffers() +{ + return eglSwapBuffers(m_display, m_surface); +} + +bool ContextEGL::MakeCurrent() +{ + if (!eglMakeCurrent(m_display, m_surface, m_surface, m_context)) + { + Log_ErrorPrintf("eglMakeCurrent() failed: %d", eglGetError()); + return false; + } + + return true; +} + +bool ContextEGL::DoneCurrent() +{ + return eglMakeCurrent(m_display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); +} + +bool ContextEGL::SetSwapInterval(s32 interval) +{ + return eglSwapInterval(m_display, interval); +} + +std::unique_ptr ContextEGL::CreateSharedContext(const WindowInfo& wi) +{ + std::unique_ptr context = std::make_unique(wi); + context->m_display = m_display; + context->m_supports_surfaceless = m_supports_surfaceless; + + if (!context->CreateContextAndSurface(m_version, m_context, false)) + return nullptr; + + return context; +} + +EGLNativeWindowType ContextEGL::GetNativeWindow(EGLConfig config) +{ + return {}; +} + +bool ContextEGL::CreateSurface() +{ + if (m_wi.type == WindowInfo::Type::Surfaceless) + { + if (m_supports_surfaceless) + return true; + else + return CreatePBufferSurface(); + } + + EGLNativeWindowType native_window = GetNativeWindow(m_config); + m_surface = eglCreateWindowSurface(m_display, m_config, native_window, nullptr); + if (!m_surface) + { + Log_ErrorPrintf("eglCreateWindowSurface() failed: %d", eglGetError()); + return false; + } + + // Some implementations may require the size to be queried at runtime. + EGLint surface_width, surface_height; + if (eglQuerySurface(m_display, m_surface, EGL_WIDTH, &surface_width) && + eglQuerySurface(m_display, m_surface, EGL_HEIGHT, &surface_height)) + { + m_wi.surface_width = static_cast(surface_width); + m_wi.surface_height = static_cast(surface_height); + } + else + { + Log_ErrorPrintf("eglQuerySurface() failed: %d", eglGetError()); + } + + return true; +} + +bool ContextEGL::CreatePBufferSurface() +{ + const u32 width = std::max(m_wi.surface_width, 1); + const u32 height = std::max(m_wi.surface_height, 1); + + // TODO: Format + EGLint attrib_list[] = { + EGL_WIDTH, static_cast(width), EGL_HEIGHT, static_cast(height), EGL_NONE, + }; + + m_surface = eglCreatePbufferSurface(m_display, m_config, attrib_list); + if (!m_surface) + { + Log_ErrorPrintf("eglCreatePbufferSurface() failed: %d", eglGetError()); + return false; + } + + Log_DevPrintf("Created %ux%u pbuffer surface", width, height); + return true; +} + +bool ContextEGL::CheckConfigSurfaceFormat(EGLConfig config, WindowInfo::SurfaceFormat format) const +{ + int red_size, green_size, blue_size, alpha_size; + if (!eglGetConfigAttrib(m_display, config, EGL_RED_SIZE, &red_size) || + !eglGetConfigAttrib(m_display, config, EGL_GREEN_SIZE, &green_size) || + !eglGetConfigAttrib(m_display, config, EGL_BLUE_SIZE, &blue_size) || + !eglGetConfigAttrib(m_display, config, EGL_ALPHA_SIZE, &alpha_size)) + { + return false; + } + + switch (format) + { + case WindowInfo::SurfaceFormat::Auto: + return true; + + case WindowInfo::SurfaceFormat::RGB8: + return (red_size == 8 && green_size == 8 && blue_size == 8); + + case WindowInfo::SurfaceFormat::RGBA8: + return (red_size == 8 && green_size == 8 && blue_size == 8 && alpha_size == 8); + + case WindowInfo::SurfaceFormat::RGB565: + return (red_size == 5 && green_size == 6 && blue_size == 5); + + default: + return false; + } +} + +void ContextEGL::DestroyContext() +{ + if (eglGetCurrentContext() == m_context) + eglMakeCurrent(m_display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); + + if (m_context != EGL_NO_CONTEXT) + { + eglDestroyContext(m_display, m_context); + m_context = EGL_NO_CONTEXT; + } +} + +void ContextEGL::DestroySurface() +{ + if (eglGetCurrentSurface(EGL_DRAW) == m_surface) + eglMakeCurrent(m_display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); + + if (m_surface != EGL_NO_SURFACE) + { + eglDestroySurface(m_display, m_surface); + m_surface = EGL_NO_SURFACE; + } +} + +bool ContextEGL::CreateContext(const Version& version, EGLContext share_context) +{ + Log_DevPrintf( + "Trying version %u.%u (%s)", version.major_version, version.minor_version, + version.profile == Context::Profile::ES ? "ES" : (version.profile == Context::Profile::Core ? "Core" : "None")); + int surface_attribs[16] = { + EGL_RENDERABLE_TYPE, + (version.profile == Profile::ES) ? + ((version.major_version >= 3) ? EGL_OPENGL_ES3_BIT : + ((version.major_version == 2) ? EGL_OPENGL_ES2_BIT : EGL_OPENGL_ES_BIT)) : + EGL_OPENGL_BIT, + EGL_SURFACE_TYPE, + (m_wi.type != WindowInfo::Type::Surfaceless) ? EGL_WINDOW_BIT : 0, + }; + int nsurface_attribs = 4; + + switch (m_wi.surface_format) + { + case WindowInfo::SurfaceFormat::RGB8: + surface_attribs[nsurface_attribs++] = EGL_RED_SIZE; + surface_attribs[nsurface_attribs++] = 8; + surface_attribs[nsurface_attribs++] = EGL_GREEN_SIZE; + surface_attribs[nsurface_attribs++] = 8; + surface_attribs[nsurface_attribs++] = EGL_BLUE_SIZE; + surface_attribs[nsurface_attribs++] = 8; + break; + + case WindowInfo::SurfaceFormat::RGBA8: + surface_attribs[nsurface_attribs++] = EGL_RED_SIZE; + surface_attribs[nsurface_attribs++] = 8; + surface_attribs[nsurface_attribs++] = EGL_GREEN_SIZE; + surface_attribs[nsurface_attribs++] = 8; + surface_attribs[nsurface_attribs++] = EGL_BLUE_SIZE; + surface_attribs[nsurface_attribs++] = 8; + surface_attribs[nsurface_attribs++] = EGL_ALPHA_SIZE; + surface_attribs[nsurface_attribs++] = 8; + break; + + case WindowInfo::SurfaceFormat::RGB565: + surface_attribs[nsurface_attribs++] = EGL_RED_SIZE; + surface_attribs[nsurface_attribs++] = 5; + surface_attribs[nsurface_attribs++] = EGL_GREEN_SIZE; + surface_attribs[nsurface_attribs++] = 6; + surface_attribs[nsurface_attribs++] = EGL_BLUE_SIZE; + surface_attribs[nsurface_attribs++] = 5; + break; + + case WindowInfo::SurfaceFormat::Auto: + break; + + default: + UnreachableCode(); + break; + } + + surface_attribs[nsurface_attribs++] = EGL_NONE; + surface_attribs[nsurface_attribs++] = 0; + + EGLint num_configs; + if (!eglChooseConfig(m_display, surface_attribs, nullptr, 0, &num_configs) || num_configs == 0) + { + Log_ErrorPrintf("eglChooseConfig() failed: %d", eglGetError()); + return false; + } + + std::vector configs(static_cast(num_configs)); + if (!eglChooseConfig(m_display, surface_attribs, configs.data(), num_configs, &num_configs)) + { + Log_ErrorPrintf("eglChooseConfig() failed: %d", eglGetError()); + return false; + } + configs.resize(static_cast(num_configs)); + + std::optional config; + for (EGLConfig check_config : configs) + { + if (CheckConfigSurfaceFormat(check_config, m_wi.surface_format)) + { + config = check_config; + break; + } + } + + if (!config.has_value()) + { + Log_WarningPrintf("No EGL configs matched exactly, using first."); + config = configs.front(); + } + + int attribs[8]; + int nattribs = 0; + if (version.profile != Profile::NoProfile) + { + attribs[nattribs++] = EGL_CONTEXT_MAJOR_VERSION; + attribs[nattribs++] = version.major_version; + attribs[nattribs++] = EGL_CONTEXT_MINOR_VERSION; + attribs[nattribs++] = version.minor_version; + } + attribs[nattribs++] = EGL_NONE; + attribs[nattribs++] = 0; + + if (!eglBindAPI((version.profile == Profile::ES) ? EGL_OPENGL_ES_API : EGL_OPENGL_API)) + { + Log_ErrorPrintf("eglBindAPI(%s) failed", (version.profile == Profile::ES) ? "EGL_OPENGL_ES_API" : "EGL_OPENGL_API"); + return false; + } + + m_context = eglCreateContext(m_display, config.value(), share_context, attribs); + if (!m_context) + { + Log_ErrorPrintf("eglCreateContext() failed: %d", eglGetError()); + return false; + } + + Log_InfoPrintf( + "Got version %u.%u (%s)", version.major_version, version.minor_version, + version.profile == Context::Profile::ES ? "ES" : (version.profile == Context::Profile::Core ? "Core" : "None")); + + m_config = config.value(); + m_version = version; + return true; +} + +bool ContextEGL::CreateContextAndSurface(const Version& version, EGLContext share_context, bool make_current) +{ + if (!CreateContext(version, share_context)) + return false; + + if (!CreateSurface()) + { + Log_ErrorPrintf("Failed to create surface for context"); + eglDestroyContext(m_display, m_context); + m_context = EGL_NO_CONTEXT; + return false; + } + + if (make_current && !eglMakeCurrent(m_display, m_surface, m_surface, m_context)) + { + Log_ErrorPrintf("eglMakeCurrent() failed: %d", eglGetError()); + if (m_surface != EGL_NO_SURFACE) + { + eglDestroySurface(m_display, m_surface); + m_surface = EGL_NO_SURFACE; + } + eglDestroyContext(m_display, m_context); + m_context = EGL_NO_CONTEXT; + return false; + } + + return true; +} +} // namespace GL diff --git a/src/duckstation/gl/context_egl.h b/src/duckstation/gl/context_egl.h new file mode 100644 index 00000000..c5eff200 --- /dev/null +++ b/src/duckstation/gl/context_egl.h @@ -0,0 +1,48 @@ +#pragma once +#include "context.h" +#include "../../glad/glad_egl.h" + +namespace GL { + +class ContextEGL : public Context +{ +public: + ContextEGL(const WindowInfo& wi); + ~ContextEGL() override; + + static std::unique_ptr Create(const WindowInfo& wi, const Version* versions_to_try, + size_t num_versions_to_try); + + void* GetProcAddress(const char* name) override; + virtual bool ChangeSurface(const WindowInfo& new_wi) override; + virtual void ResizeSurface(u32 new_surface_width = 0, u32 new_surface_height = 0) override; + bool SwapBuffers() override; + bool MakeCurrent() override; + bool DoneCurrent() override; + bool SetSwapInterval(s32 interval) override; + virtual std::unique_ptr CreateSharedContext(const WindowInfo& wi) override; + +protected: + virtual bool SetDisplay(); + virtual EGLNativeWindowType GetNativeWindow(EGLConfig config); + + bool Initialize(const Version* versions_to_try, size_t num_versions_to_try); + bool CreateDisplay(); + bool CreateContext(const Version& version, EGLContext share_context); + bool CreateContextAndSurface(const Version& version, EGLContext share_context, bool make_current); + bool CreateSurface(); + bool CreatePBufferSurface(); + bool CheckConfigSurfaceFormat(EGLConfig config, WindowInfo::SurfaceFormat format) const; + void DestroyContext(); + void DestroySurface(); + + EGLDisplay m_display = EGL_NO_DISPLAY; + EGLSurface m_surface = EGL_NO_SURFACE; + EGLContext m_context = EGL_NO_CONTEXT; + + EGLConfig m_config = {}; + + bool m_supports_surfaceless = false; +}; + +} // namespace GL diff --git a/src/duckstation/gl/context_egl_wayland.cpp b/src/duckstation/gl/context_egl_wayland.cpp new file mode 100644 index 00000000..16532e8b --- /dev/null +++ b/src/duckstation/gl/context_egl_wayland.cpp @@ -0,0 +1,86 @@ +#include "context_egl_wayland.h" +#include "../log.h" +#include +Log_SetChannel(ContextEGLWayland); + +namespace GL { +static const char* WAYLAND_EGL_MODNAME = "libwayland-egl.so.1"; + +ContextEGLWayland::ContextEGLWayland(const WindowInfo& wi) : ContextEGL(wi) {} +ContextEGLWayland::~ContextEGLWayland() +{ + if (m_wl_window) + m_wl_egl_window_destroy(m_wl_window); + if (m_wl_module) + dlclose(m_wl_module); +} + +std::unique_ptr ContextEGLWayland::Create(const WindowInfo& wi, const Version* versions_to_try, + size_t num_versions_to_try) +{ + std::unique_ptr context = std::make_unique(wi); + if (!context->LoadModule() || !context->Initialize(versions_to_try, num_versions_to_try)) + return nullptr; + + return context; +} + +std::unique_ptr ContextEGLWayland::CreateSharedContext(const WindowInfo& wi) +{ + std::unique_ptr context = std::make_unique(wi); + context->m_display = m_display; + + if (!context->LoadModule() || !context->CreateContextAndSurface(m_version, m_context, false)) + return nullptr; + + return context; +} + +void ContextEGLWayland::ResizeSurface(u32 new_surface_width, u32 new_surface_height) +{ + if (m_wl_window) + m_wl_egl_window_resize(m_wl_window, new_surface_width, new_surface_height, 0, 0); + + ContextEGL::ResizeSurface(new_surface_width, new_surface_height); +} + +EGLNativeWindowType ContextEGLWayland::GetNativeWindow(EGLConfig config) +{ + if (m_wl_window) + { + m_wl_egl_window_destroy(m_wl_window); + m_wl_window = nullptr; + } + + m_wl_window = + m_wl_egl_window_create(static_cast(m_wi.window_handle), m_wi.surface_width, m_wi.surface_height); + if (!m_wl_window) + return {}; + + return reinterpret_cast(m_wl_window); +} + +bool ContextEGLWayland::LoadModule() +{ + m_wl_module = dlopen(WAYLAND_EGL_MODNAME, RTLD_NOW | RTLD_GLOBAL); + if (!m_wl_module) + { + Log_ErrorPrintf("Failed to load %s.", WAYLAND_EGL_MODNAME); + return false; + } + + m_wl_egl_window_create = + reinterpret_cast(dlsym(m_wl_module, "wl_egl_window_create")); + m_wl_egl_window_destroy = + reinterpret_cast(dlsym(m_wl_module, "wl_egl_window_destroy")); + m_wl_egl_window_resize = + reinterpret_cast(dlsym(m_wl_module, "wl_egl_window_resize")); + if (!m_wl_egl_window_create || !m_wl_egl_window_destroy || !m_wl_egl_window_resize) + { + Log_ErrorPrintf("Failed to load one or more functions from %s.", WAYLAND_EGL_MODNAME); + return false; + } + + return true; +} +} // namespace GL diff --git a/src/duckstation/gl/context_egl_wayland.h b/src/duckstation/gl/context_egl_wayland.h new file mode 100644 index 00000000..4682f424 --- /dev/null +++ b/src/duckstation/gl/context_egl_wayland.h @@ -0,0 +1,33 @@ +#pragma once +#include "context_egl.h" +#include + +namespace GL { + +class ContextEGLWayland final : public ContextEGL +{ +public: + ContextEGLWayland(const WindowInfo& wi); + ~ContextEGLWayland() override; + + static std::unique_ptr Create(const WindowInfo& wi, const Version* versions_to_try, + size_t num_versions_to_try); + + std::unique_ptr CreateSharedContext(const WindowInfo& wi) override; + void ResizeSurface(u32 new_surface_width = 0, u32 new_surface_height = 0) override; + +protected: + EGLNativeWindowType GetNativeWindow(EGLConfig config) override; + +private: + bool LoadModule(); + + wl_egl_window* m_wl_window = nullptr; + + void* m_wl_module = nullptr; + wl_egl_window* (*m_wl_egl_window_create)(struct wl_surface* surface, int width, int height); + void (*m_wl_egl_window_destroy)(struct wl_egl_window* egl_window); + void (*m_wl_egl_window_resize)(struct wl_egl_window* egl_window, int width, int height, int dx, int dy); +}; + +} // namespace GL diff --git a/src/duckstation/gl/context_egl_x11.cpp b/src/duckstation/gl/context_egl_x11.cpp new file mode 100644 index 00000000..c7310e31 --- /dev/null +++ b/src/duckstation/gl/context_egl_x11.cpp @@ -0,0 +1,69 @@ +#include "context_egl_x11.h" +#include "../log.h" +Log_SetChannel(GL::ContextEGLX11); + +namespace GL { +ContextEGLX11::ContextEGLX11(const WindowInfo& wi) : ContextEGL(wi) {} +ContextEGLX11::~ContextEGLX11() = default; + +std::unique_ptr ContextEGLX11::Create(const WindowInfo& wi, const Version* versions_to_try, + size_t num_versions_to_try) +{ + std::unique_ptr context = std::make_unique(wi); + if (!context->Initialize(versions_to_try, num_versions_to_try)) + return nullptr; + + return context; +} + +std::unique_ptr ContextEGLX11::CreateSharedContext(const WindowInfo& wi) +{ + std::unique_ptr context = std::make_unique(wi); + context->m_display = m_display; + + if (!context->CreateContextAndSurface(m_version, m_context, false)) + return nullptr; + + return context; +} + +void ContextEGLX11::ResizeSurface(u32 new_surface_width, u32 new_surface_height) +{ + m_window.Resize(); + ContextEGL::ResizeSurface(new_surface_width, new_surface_height); +} + +EGLNativeWindowType ContextEGLX11::GetNativeWindow(EGLConfig config) +{ + X11InhibitErrors ei; + + EGLint native_visual_id = 0; + if (!eglGetConfigAttrib(m_display, m_config, EGL_NATIVE_VISUAL_ID, &native_visual_id)) + { + Log_ErrorPrintf("Failed to get X11 visual ID"); + return false; + } + + XVisualInfo vi_query = {}; + vi_query.visualid = native_visual_id; + + int num_vis; + XVisualInfo* vi = XGetVisualInfo(static_cast(m_wi.display_connection), VisualIDMask, &vi_query, &num_vis); + if (num_vis <= 0 || !vi) + { + Log_ErrorPrintf("Failed to query visual from X11"); + return false; + } + + m_window.Destroy(); + if (!m_window.Create(GetDisplay(), static_cast(reinterpret_cast(m_wi.window_handle)), vi)) + { + Log_ErrorPrintf("Faild to create X11 child window"); + XFree(vi); + return false; + } + + XFree(vi); + return static_cast(m_window.GetWindow()); +} +} // namespace GL diff --git a/src/duckstation/gl/context_egl_x11.h b/src/duckstation/gl/context_egl_x11.h new file mode 100644 index 00000000..7def8bfb --- /dev/null +++ b/src/duckstation/gl/context_egl_x11.h @@ -0,0 +1,28 @@ +#pragma once +#include "context_egl.h" +#include "x11_window.h" + +namespace GL { + +class ContextEGLX11 final : public ContextEGL +{ +public: + ContextEGLX11(const WindowInfo& wi); + ~ContextEGLX11() override; + + static std::unique_ptr Create(const WindowInfo& wi, const Version* versions_to_try, + size_t num_versions_to_try); + + std::unique_ptr CreateSharedContext(const WindowInfo& wi) override; + void ResizeSurface(u32 new_surface_width = 0, u32 new_surface_height = 0) override; + +protected: + EGLNativeWindowType GetNativeWindow(EGLConfig config) override; + +private: + ALWAYS_INLINE Display* GetDisplay() const { return static_cast(m_wi.display_connection); } + + X11Window m_window; +}; + +} // namespace GL diff --git a/src/duckstation/gl/context_glx.cpp b/src/duckstation/gl/context_glx.cpp new file mode 100644 index 00000000..bd32039f --- /dev/null +++ b/src/duckstation/gl/context_glx.cpp @@ -0,0 +1,328 @@ +#include "context_glx.h" +#include "../duckstation_compat.h" +#include "../log.h" +#include +Log_SetChannel(GL::ContextGLX); + +namespace GL { +ContextGLX::ContextGLX(const WindowInfo& wi) : Context(wi) {} + +ContextGLX::~ContextGLX() +{ + if (glXGetCurrentContext() == m_context) + glXMakeCurrent(GetDisplay(), None, nullptr); + + if (m_context) + glXDestroyContext(GetDisplay(), m_context); + + if (m_vi) + XFree(m_vi); + + if (m_libGL_handle) + dlclose(m_libGL_handle); +} + +std::unique_ptr ContextGLX::Create(const WindowInfo& wi, const Version* versions_to_try, + size_t num_versions_to_try) +{ + std::unique_ptr context = std::make_unique(wi); + if (!context->Initialize(versions_to_try, num_versions_to_try)) + return nullptr; + + return context; +} + +bool ContextGLX::Initialize(const Version* versions_to_try, size_t num_versions_to_try) +{ + // We need libGL loaded, because GLAD loads its own, then releases it. + m_libGL_handle = dlopen("libGL.so.1", RTLD_NOW | RTLD_GLOBAL); + if (!m_libGL_handle) + { + m_libGL_handle = dlopen("libGL.so", RTLD_NOW | RTLD_GLOBAL); + if (!m_libGL_handle) + { + Log_ErrorPrintf("Failed to load libGL.so: %s", dlerror()); + return false; + } + } + + const int screen = DefaultScreen(GetDisplay()); + if (!gladLoadGLX(GetDisplay(), screen)) + { + Log_ErrorPrintf("Loading GLAD GLX functions failed"); + return false; + } + + if (m_wi.type == WindowInfo::Type::X11) + { + if (!CreateWindow(screen)) + return false; + } + else + { + Panic("Create pbuffer"); + } + + for (size_t i = 0; i < num_versions_to_try; i++) + { + const Version& cv = versions_to_try[i]; + if (cv.profile == Profile::NoProfile && CreateAnyContext(nullptr, true)) + { + m_version = cv; + return true; + } + else if (cv.profile != Profile::NoProfile && CreateVersionContext(cv, nullptr, true)) + { + m_version = cv; + return true; + } + } + + return false; +} + +void* ContextGLX::GetProcAddress(const char* name) +{ + return reinterpret_cast(glXGetProcAddress(reinterpret_cast(name))); +} + +bool ContextGLX::ChangeSurface(const WindowInfo& new_wi) +{ + const bool was_current = (glXGetCurrentContext() == m_context); + if (was_current) + glXMakeCurrent(GetDisplay(), None, nullptr); + + m_window.Destroy(); + m_wi = new_wi; + + if (new_wi.type == WindowInfo::Type::X11) + { + const int screen = DefaultScreen(GetDisplay()); + if (!CreateWindow(screen)) + return false; + } + + if (was_current && !glXMakeCurrent(GetDisplay(), GetDrawable(), m_context)) + { + Log_ErrorPrintf("Failed to make context current again after surface change"); + return false; + } + + return true; +} + +void ContextGLX::ResizeSurface(u32 new_surface_width /*= 0*/, u32 new_surface_height /*= 0*/) +{ + m_window.Resize(new_surface_width, new_surface_height); + m_wi.surface_width = m_window.GetWidth(); + m_wi.surface_height = m_window.GetHeight(); +} + +bool ContextGLX::SwapBuffers() +{ + glXSwapBuffers(GetDisplay(), GetDrawable()); + return true; +} + +bool ContextGLX::MakeCurrent() +{ + return (glXMakeCurrent(GetDisplay(), GetDrawable(), m_context) == True); +} + +bool ContextGLX::DoneCurrent() +{ + return (glXMakeCurrent(GetDisplay(), None, nullptr) == True); +} + +bool ContextGLX::SetSwapInterval(s32 interval) +{ + if (GLAD_GLX_EXT_swap_control) + { + glXSwapIntervalEXT(GetDisplay(), GetDrawable(), interval); + return true; + } + else if (GLAD_GLX_MESA_swap_control) + { + return (glXSwapIntervalMESA(static_cast(std::max(interval, 0))) != 0); + } + else if (GLAD_GLX_SGI_swap_control) + { + return (glXSwapIntervalSGI(interval) != 0); + } + else + { + return false; + } +} + +std::unique_ptr ContextGLX::CreateSharedContext(const WindowInfo& wi) +{ + std::unique_ptr context = std::make_unique(wi); + if (wi.type == WindowInfo::Type::X11) + { + const int screen = DefaultScreen(context->GetDisplay()); + if (!context->CreateWindow(screen)) + return nullptr; + } + else + { + Panic("Create pbuffer"); + } + + if (m_version.profile == Profile::NoProfile) + { + if (!context->CreateAnyContext(m_context, false)) + return nullptr; + } + else + { + if (!context->CreateVersionContext(m_version, m_context, false)) + return nullptr; + } + + context->m_version = m_version; + return context; +} + +bool ContextGLX::CreateWindow(int screen) +{ + int attribs[32] = {GLX_X_RENDERABLE, True, GLX_DRAWABLE_TYPE, GLX_WINDOW_BIT, + GLX_X_VISUAL_TYPE, GLX_TRUE_COLOR, GLX_DOUBLEBUFFER, True}; + int nattribs = 8; + + switch (m_wi.surface_format) + { + case WindowInfo::SurfaceFormat::RGB8: + attribs[nattribs++] = GLX_RED_SIZE; + attribs[nattribs++] = 8; + attribs[nattribs++] = GLX_GREEN_SIZE; + attribs[nattribs++] = 8; + attribs[nattribs++] = GLX_BLUE_SIZE; + attribs[nattribs++] = 8; + break; + + case WindowInfo::SurfaceFormat::RGBA8: + attribs[nattribs++] = GLX_RED_SIZE; + attribs[nattribs++] = 8; + attribs[nattribs++] = GLX_GREEN_SIZE; + attribs[nattribs++] = 8; + attribs[nattribs++] = GLX_BLUE_SIZE; + attribs[nattribs++] = 8; + attribs[nattribs++] = GLX_ALPHA_SIZE; + attribs[nattribs++] = 8; + break; + + case WindowInfo::SurfaceFormat::RGB565: + attribs[nattribs++] = GLX_RED_SIZE; + attribs[nattribs++] = 5; + attribs[nattribs++] = GLX_GREEN_SIZE; + attribs[nattribs++] = 6; + attribs[nattribs++] = GLX_BLUE_SIZE; + attribs[nattribs++] = 5; + break; + + case WindowInfo::SurfaceFormat::Auto: + break; + + default: + UnreachableCode(); + break; + } + + attribs[nattribs++] = None; + attribs[nattribs++] = 0; + + int fbcount = 0; + GLXFBConfig* fbc = glXChooseFBConfig(GetDisplay(), screen, attribs, &fbcount); + if (!fbc || !fbcount) + { + Log_ErrorPrintf("glXChooseFBConfig() failed"); + return false; + } + m_fb_config = *fbc; + XFree(fbc); + + if (!GLAD_GLX_VERSION_1_3) + { + Log_ErrorPrintf("GLX Version 1.3 is required"); + return false; + } + + m_vi = glXGetVisualFromFBConfig(GetDisplay(), m_fb_config); + if (!m_vi) + { + Log_ErrorPrintf("glXGetVisualFromFBConfig() failed"); + return false; + } + + return m_window.Create(GetDisplay(), static_cast(reinterpret_cast(m_wi.window_handle)), m_vi); +} + +bool ContextGLX::CreateAnyContext(GLXContext share_context, bool make_current) +{ + X11InhibitErrors ie; + + m_context = glXCreateContext(GetDisplay(), m_vi, share_context, True); + if (!m_context || ie.HadError()) + { + Log_ErrorPrintf("glxCreateContext() failed"); + return false; + } + + if (make_current) + { + if (!glXMakeCurrent(GetDisplay(), GetDrawable(), m_context)) + { + Log_ErrorPrintf("glXMakeCurrent() failed"); + return false; + } + } + + return true; +} + +bool ContextGLX::CreateVersionContext(const Version& version, GLXContext share_context, bool make_current) +{ + // we need create context attribs + if (!GLAD_GLX_VERSION_1_3) + { + Log_ErrorPrint("Missing GLX version 1.3."); + return false; + } + + int attribs[32]; + int nattribs = 0; + attribs[nattribs++] = GLX_CONTEXT_PROFILE_MASK_ARB; + attribs[nattribs++] = + ((version.profile == Profile::ES) ? + ((version.major_version >= 2) ? GLX_CONTEXT_ES2_PROFILE_BIT_EXT : GLX_CONTEXT_ES_PROFILE_BIT_EXT) : + GLX_CONTEXT_CORE_PROFILE_BIT_ARB); + attribs[nattribs++] = GLX_CONTEXT_MAJOR_VERSION_ARB; + attribs[nattribs++] = version.major_version; + attribs[nattribs++] = GLX_CONTEXT_MINOR_VERSION_ARB; + attribs[nattribs++] = version.minor_version; + attribs[nattribs++] = None; + attribs[nattribs++] = 0; + + X11InhibitErrors ie; + m_context = glXCreateContextAttribsARB(GetDisplay(), m_fb_config, share_context, True, attribs); + XSync(GetDisplay(), False); + if (ie.HadError()) + m_context = nullptr; + if (!m_context) + return false; + + if (make_current) + { + if (!glXMakeCurrent(GetDisplay(), GetDrawable(), m_context)) + { + Log_ErrorPrint("glXMakeCurrent() failed"); + glXDestroyContext(GetDisplay(), m_context); + m_context = nullptr; + return false; + } + } + + return true; +} +} // namespace GL diff --git a/src/duckstation/gl/context_glx.h b/src/duckstation/gl/context_glx.h new file mode 100644 index 00000000..c8416e57 --- /dev/null +++ b/src/duckstation/gl/context_glx.h @@ -0,0 +1,44 @@ +#pragma once +#include "context.h" +#include "../../glad/glad_glx.h" +#include "x11_window.h" + +namespace GL { + +class ContextGLX final : public Context +{ +public: + ContextGLX(const WindowInfo& wi); + ~ContextGLX() override; + + static std::unique_ptr Create(const WindowInfo& wi, const Version* versions_to_try, + size_t num_versions_to_try); + + void* GetProcAddress(const char* name) override; + bool ChangeSurface(const WindowInfo& new_wi) override; + void ResizeSurface(u32 new_surface_width = 0, u32 new_surface_height = 0) override; + bool SwapBuffers() override; + bool MakeCurrent() override; + bool DoneCurrent() override; + bool SetSwapInterval(s32 interval) override; + std::unique_ptr CreateSharedContext(const WindowInfo& wi) override; + +private: + ALWAYS_INLINE Display* GetDisplay() const { return static_cast(m_wi.display_connection); } + ALWAYS_INLINE GLXDrawable GetDrawable() const { return static_cast(m_window.GetWindow()); } + + bool Initialize(const Version* versions_to_try, size_t num_versions_to_try); + bool CreateWindow(int screen); + bool CreateAnyContext(GLXContext share_context, bool make_current); + bool CreateVersionContext(const Version& version, GLXContext share_context, bool make_current); + + GLXContext m_context = nullptr; + GLXFBConfig m_fb_config = {}; + XVisualInfo* m_vi = nullptr; + X11Window m_window; + + // GLAD releases its reference to libGL.so, so we need to maintain our own. + void* m_libGL_handle = nullptr; +}; + +} // namespace GL diff --git a/src/duckstation/gl/x11_window.cpp b/src/duckstation/gl/x11_window.cpp new file mode 100644 index 00000000..bf09fcc6 --- /dev/null +++ b/src/duckstation/gl/x11_window.cpp @@ -0,0 +1,101 @@ +#include "x11_window.h" +#include "../log.h" +#include "../duckstation_compat.h" +#include +Log_SetChannel(X11Window); + +namespace GL { +X11Window::X11Window() = default; + +X11Window::~X11Window() +{ + Destroy(); +} + +bool X11Window::Create(Display* display, Window parent_window, const XVisualInfo* vi) +{ + m_display = display; + m_parent_window = parent_window; + XSync(m_display, True); + + XWindowAttributes parent_wa = {}; + XGetWindowAttributes(m_display, m_parent_window, &parent_wa); + m_width = static_cast(parent_wa.width); + m_height = static_cast(parent_wa.height); + + // Failed X calls terminate the process so no need to check for errors. + // We could swap the error handler out here as well. + m_colormap = XCreateColormap(m_display, m_parent_window, vi->visual, AllocNone); + + XSetWindowAttributes wa = {}; + wa.colormap = m_colormap; + + m_window = XCreateWindow(m_display, m_parent_window, 0, 0, m_width, m_height, 0, vi->depth, InputOutput, vi->visual, + CWColormap, &wa); + XMapWindow(m_display, m_window); + XSync(m_display, True); + + return true; +} + +void X11Window::Destroy() +{ + if (m_window) + { + XUnmapWindow(m_display, m_window); + XDestroyWindow(m_display, m_window); + m_window = {}; + } + + if (m_colormap) + { + XFreeColormap(m_display, m_colormap); + m_colormap = {}; + } +} + +void X11Window::Resize(u32 width, u32 height) +{ + if (width != 0 && height != 0) + { + m_width = width; + m_height = height; + } + else + { + XWindowAttributes parent_wa = {}; + XGetWindowAttributes(m_display, m_parent_window, &parent_wa); + m_width = static_cast(parent_wa.width); + m_height = static_cast(parent_wa.height); + } + + XResizeWindow(m_display, m_window, m_width, m_height); +} + +static X11InhibitErrors* s_current_error_inhibiter; + +X11InhibitErrors::X11InhibitErrors() +{ + Assert(!s_current_error_inhibiter); + m_old_handler = XSetErrorHandler(ErrorHandler); + s_current_error_inhibiter = this; +} + +X11InhibitErrors::~X11InhibitErrors() +{ + Assert(s_current_error_inhibiter == this); + s_current_error_inhibiter = nullptr; + XSetErrorHandler(m_old_handler); +} + +int X11InhibitErrors::ErrorHandler(Display* display, XErrorEvent* ee) +{ + char error_string[256] = {}; + XGetErrorText(display, ee->error_code, error_string, sizeof(error_string)); + Log_WarningPrintf("X11 Error: %s (Error %u Minor %u Request %u)", error_string, ee->error_code, ee->minor_code, + ee->request_code); + + s_current_error_inhibiter->m_had_error = true; + return 0; +} +} // namespace GL diff --git a/src/duckstation/gl/x11_window.h b/src/duckstation/gl/x11_window.h new file mode 100644 index 00000000..aff38b7b --- /dev/null +++ b/src/duckstation/gl/x11_window.h @@ -0,0 +1,48 @@ +#pragma once +#include "../duckstation_compat.h" +#include +#include + +namespace GL { +class X11Window +{ +public: + X11Window(); + ~X11Window(); + + ALWAYS_INLINE Window GetWindow() const { return m_window; } + ALWAYS_INLINE u32 GetWidth() const { return m_width; } + ALWAYS_INLINE u32 GetHeight() const { return m_height; } + + bool Create(Display* display, Window parent_window, const XVisualInfo* vi); + void Destroy(); + + // Setting a width/height of 0 will use parent dimensions. + void Resize(u32 width = 0, u32 height = 0); + +private: + Display* m_display = nullptr; + Window m_parent_window = {}; + Window m_window = {}; + Colormap m_colormap = {}; + u32 m_width = 0; + u32 m_height = 0; +}; + +// Helper class for managing X errors +class X11InhibitErrors +{ +public: + X11InhibitErrors(); + ~X11InhibitErrors(); + + ALWAYS_INLINE bool HadError() const { return m_had_error; } + +private: + static int ErrorHandler(Display* display, XErrorEvent* ee); + + XErrorHandler m_old_handler = {}; + bool m_had_error = false; +}; + +} // namespace GL diff --git a/src/frontend/qt_sdl/CMakeLists.txt b/src/frontend/qt_sdl/CMakeLists.txt index 3089c32f..3342aae2 100644 --- a/src/frontend/qt_sdl/CMakeLists.txt +++ b/src/frontend/qt_sdl/CMakeLists.txt @@ -91,6 +91,11 @@ endif() target_include_directories(melonDS PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}") target_include_directories(melonDS PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/..") target_include_directories(melonDS PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/../..") +if (USE_QT6) + target_include_directories(melonDS PUBLIC ${Qt6Gui_PRIVATE_INCLUDE_DIRS}) +else() + target_include_directories(melonDS PUBLIC ${Qt5Gui_PRIVATE_INCLUDE_DIRS}) +endif() target_link_libraries(melonDS PRIVATE core) target_link_libraries(melonDS PRIVATE PkgConfig::SDL2 PkgConfig::Slirp PkgConfig::LibArchive) target_link_libraries(melonDS PRIVATE ${QT_LINK_LIBS} ${CMAKE_DL_LIBS}) diff --git a/src/frontend/qt_sdl/main.cpp b/src/frontend/qt_sdl/main.cpp index d2e00b9d..af1c4911 100644 --- a/src/frontend/qt_sdl/main.cpp +++ b/src/frontend/qt_sdl/main.cpp @@ -36,10 +36,14 @@ #include #include #ifndef _WIN32 +#include #include #include #include #include +#ifndef APPLE +#include +#endif #endif #include @@ -376,7 +380,6 @@ void EmuThread::initOpenGL() glUniform1i(glGetUniformLocation(pid, "ScreenTex"), 0); screenShaderScreenSizeULoc = glGetUniformLocation(pid, "uScreenSize"); - screenShaderScaleFactorULoc = glGetUniformLocation(pid, "uScaleFactor"); screenShaderTransformULoc = glGetUniformLocation(pid, "uTransform"); // to prevent bleeding between both parts of the screen @@ -526,6 +529,16 @@ void EmuThread::run() } } + screenSettingsLock.lock(); + if (lastScreenWidth != windowInfo.surface_width || lastScreenHeight != windowInfo.surface_height) + { + if (oglContext) + oglContext->ResizeSurface(windowInfo.surface_width, windowInfo.surface_height); + lastScreenWidth = windowInfo.surface_width; + lastScreenHeight = windowInfo.surface_height; + } + screenSettingsLock.unlock(); + if (EmuRunning == 1 || EmuRunning == 3) { EmuStatus = 1; @@ -836,11 +849,10 @@ void EmuThread::drawScreenGL() glDisable(GL_SCISSOR_TEST); glClear(GL_COLOR_BUFFER_BIT); - glViewport(0, 0, w*factor, h*factor); + glViewport(0, 0, w, h); glUseProgram(screenShaderProgram[2]); - glUniform2f(screenShaderScreenSizeULoc, w, h); - glUniform1f(screenShaderScaleFactorULoc, factor); + glUniform2f(screenShaderScreenSizeULoc, w / factor, h / factor); int frontbuf = FrontBuffer; glActiveTexture(GL_TEXTURE0); @@ -884,7 +896,7 @@ void EmuThread::drawScreenGL() screenSettingsLock.unlock(); OSD::Update(); - OSD::DrawGL(w*factor, h*factor); + OSD::DrawGL(w, h); oglContext->SwapBuffers(); } @@ -2942,7 +2954,6 @@ void MainWindow::onChangeShowOSD(bool checked) { Config::ShowOSD = checked?1:0; } - void MainWindow::onChangeLimitFramerate(bool checked) { Config::LimitFPS = checked?1:0; @@ -3072,6 +3083,8 @@ int main(int argc, char** argv) { srand(time(NULL)); + qputenv("QT_SCALE_FACTOR", "1"); + printf("melonDS " MELONDS_VERSION "\n"); printf(MELONDS_URL "\n"); diff --git a/src/frontend/qt_sdl/main.h b/src/frontend/qt_sdl/main.h index b97d8cc8..fb12199a 100644 --- a/src/frontend/qt_sdl/main.h +++ b/src/frontend/qt_sdl/main.h @@ -102,7 +102,7 @@ private: GLuint screenVertexBuffer, screenVertexArray; GLuint screenTexture; GLuint screenShaderProgram[3]; - GLuint screenShaderTransformULoc, screenShaderScreenSizeULoc, screenShaderScaleFactorULoc; + GLuint screenShaderTransformULoc, screenShaderScreenSizeULoc; QMutex screenSettingsLock; WindowInfo windowInfo; @@ -110,6 +110,9 @@ private: int screenKind[Frontend::MaxScreenTransforms]; int numScreens; bool filter; + + int lastScreenWidth = -1; + int lastScreenHeight = -1; }; diff --git a/src/frontend/qt_sdl/main_shaders.h b/src/frontend/qt_sdl/main_shaders.h index ca835c0a..37b964d5 100644 --- a/src/frontend/qt_sdl/main_shaders.h +++ b/src/frontend/qt_sdl/main_shaders.h @@ -23,7 +23,6 @@ const char* kScreenVS = R"(#version 140 uniform vec2 uScreenSize; uniform mat2x3 uTransform; -uniform float uScaleFactor; in vec2 vPosition; in vec2 vTexcoord; @@ -34,9 +33,9 @@ void main() { vec4 fpos; - fpos.xy = vec3(vPosition, 1.0) * uTransform * uScaleFactor; + fpos.xy = vec3(vPosition, 1.0) * uTransform; - fpos.xy = ((fpos.xy * 2.0) / (uScreenSize * uScaleFactor)) - 1.0; + fpos.xy = ((fpos.xy * 2.0) / uScreenSize) - 1.0; fpos.y *= -1; fpos.z = 0.0; fpos.w = 1.0; diff --git a/src/glad/glad_glx.c b/src/glad/glad_glx.c index 450efa0e..fe148904 100644 --- a/src/glad/glad_glx.c +++ b/src/glad/glad_glx.c @@ -1,22 +1,89 @@ /* - GLX loader generated by glad 0.1.36 on Thu Sep 15 11:07:33 2022. + GLX loader generated by glad 0.1.36 on Sat Oct 8 13:52:35 2022. Language/Generator: C/C++ Specification: glx APIs: glx=1.4 Profile: - Extensions: - + GLX_3DFX_multisample, + GLX_AMD_gpu_association, + GLX_ARB_context_flush_control, + GLX_ARB_create_context, + GLX_ARB_create_context_no_error, + GLX_ARB_create_context_profile, + GLX_ARB_create_context_robustness, + GLX_ARB_fbconfig_float, + GLX_ARB_framebuffer_sRGB, + GLX_ARB_get_proc_address, + GLX_ARB_multisample, + GLX_ARB_robustness_application_isolation, + GLX_ARB_robustness_share_group_isolation, + GLX_ARB_vertex_buffer_object, + GLX_EXT_buffer_age, + GLX_EXT_context_priority, + GLX_EXT_create_context_es2_profile, + GLX_EXT_create_context_es_profile, + GLX_EXT_fbconfig_packed_float, + GLX_EXT_framebuffer_sRGB, + GLX_EXT_get_drawable_type, + GLX_EXT_import_context, + GLX_EXT_libglvnd, + GLX_EXT_no_config_context, + GLX_EXT_stereo_tree, + GLX_EXT_swap_control, + GLX_EXT_swap_control_tear, + GLX_EXT_texture_from_pixmap, + GLX_EXT_visual_info, + GLX_EXT_visual_rating, + GLX_INTEL_swap_event, + GLX_MESA_agp_offset, + GLX_MESA_copy_sub_buffer, + GLX_MESA_pixmap_colormap, + GLX_MESA_query_renderer, + GLX_MESA_release_buffers, + GLX_MESA_set_3dfx_mode, + GLX_MESA_swap_control, + GLX_NV_copy_buffer, + GLX_NV_copy_image, + GLX_NV_delay_before_swap, + GLX_NV_float_buffer, + GLX_NV_multigpu_context, + GLX_NV_multisample_coverage, + GLX_NV_present_video, + GLX_NV_robustness_video_memory_purge, + GLX_NV_swap_group, + GLX_NV_video_capture, + GLX_NV_video_out, + GLX_OML_swap_method, + GLX_OML_sync_control, + GLX_SGIS_blended_overlay, + GLX_SGIS_multisample, + GLX_SGIS_shared_multisample, + GLX_SGIX_dmbuffer, + GLX_SGIX_fbconfig, + GLX_SGIX_hyperpipe, + GLX_SGIX_pbuffer, + GLX_SGIX_swap_barrier, + GLX_SGIX_swap_group, + GLX_SGIX_video_resize, + GLX_SGIX_video_source, + GLX_SGIX_visual_select_group, + GLX_SGI_cushion, + GLX_SGI_make_current_read, + GLX_SGI_swap_control, + GLX_SGI_video_sync, + GLX_SUN_get_transparent_index Loader: True Local files: True Omit khrplatform: False Reproducible: False Commandline: - --api="glx=1.4" --generator="c" --spec="glx" --local-files --extensions="" + --api="glx=1.4" --generator="c" --spec="glx" --local-files --extensions="GLX_3DFX_multisample,GLX_AMD_gpu_association,GLX_ARB_context_flush_control,GLX_ARB_create_context,GLX_ARB_create_context_no_error,GLX_ARB_create_context_profile,GLX_ARB_create_context_robustness,GLX_ARB_fbconfig_float,GLX_ARB_framebuffer_sRGB,GLX_ARB_get_proc_address,GLX_ARB_multisample,GLX_ARB_robustness_application_isolation,GLX_ARB_robustness_share_group_isolation,GLX_ARB_vertex_buffer_object,GLX_EXT_buffer_age,GLX_EXT_context_priority,GLX_EXT_create_context_es2_profile,GLX_EXT_create_context_es_profile,GLX_EXT_fbconfig_packed_float,GLX_EXT_framebuffer_sRGB,GLX_EXT_get_drawable_type,GLX_EXT_import_context,GLX_EXT_libglvnd,GLX_EXT_no_config_context,GLX_EXT_stereo_tree,GLX_EXT_swap_control,GLX_EXT_swap_control_tear,GLX_EXT_texture_from_pixmap,GLX_EXT_visual_info,GLX_EXT_visual_rating,GLX_INTEL_swap_event,GLX_MESA_agp_offset,GLX_MESA_copy_sub_buffer,GLX_MESA_pixmap_colormap,GLX_MESA_query_renderer,GLX_MESA_release_buffers,GLX_MESA_set_3dfx_mode,GLX_MESA_swap_control,GLX_NV_copy_buffer,GLX_NV_copy_image,GLX_NV_delay_before_swap,GLX_NV_float_buffer,GLX_NV_multigpu_context,GLX_NV_multisample_coverage,GLX_NV_present_video,GLX_NV_robustness_video_memory_purge,GLX_NV_swap_group,GLX_NV_video_capture,GLX_NV_video_out,GLX_OML_swap_method,GLX_OML_sync_control,GLX_SGIS_blended_overlay,GLX_SGIS_multisample,GLX_SGIS_shared_multisample,GLX_SGIX_dmbuffer,GLX_SGIX_fbconfig,GLX_SGIX_hyperpipe,GLX_SGIX_pbuffer,GLX_SGIX_swap_barrier,GLX_SGIX_swap_group,GLX_SGIX_video_resize,GLX_SGIX_video_source,GLX_SGIX_visual_select_group,GLX_SGI_cushion,GLX_SGI_make_current_read,GLX_SGI_swap_control,GLX_SGI_video_sync,GLX_SUN_get_transparent_index" Online: - https://glad.dav1d.de/#language=c&specification=glx&loader=on&api=glx%3D1.4 + Too many extensions */ #include @@ -244,6 +311,173 @@ PFNGLXSWAPBUFFERSPROC glad_glXSwapBuffers = NULL; PFNGLXUSEXFONTPROC glad_glXUseXFont = NULL; PFNGLXWAITGLPROC glad_glXWaitGL = NULL; PFNGLXWAITXPROC glad_glXWaitX = NULL; +int GLAD_GLX_3DFX_multisample = 0; +int GLAD_GLX_AMD_gpu_association = 0; +int GLAD_GLX_ARB_context_flush_control = 0; +int GLAD_GLX_ARB_create_context = 0; +int GLAD_GLX_ARB_create_context_no_error = 0; +int GLAD_GLX_ARB_create_context_profile = 0; +int GLAD_GLX_ARB_create_context_robustness = 0; +int GLAD_GLX_ARB_fbconfig_float = 0; +int GLAD_GLX_ARB_framebuffer_sRGB = 0; +int GLAD_GLX_ARB_get_proc_address = 0; +int GLAD_GLX_ARB_multisample = 0; +int GLAD_GLX_ARB_robustness_application_isolation = 0; +int GLAD_GLX_ARB_robustness_share_group_isolation = 0; +int GLAD_GLX_ARB_vertex_buffer_object = 0; +int GLAD_GLX_EXT_buffer_age = 0; +int GLAD_GLX_EXT_context_priority = 0; +int GLAD_GLX_EXT_create_context_es2_profile = 0; +int GLAD_GLX_EXT_create_context_es_profile = 0; +int GLAD_GLX_EXT_fbconfig_packed_float = 0; +int GLAD_GLX_EXT_framebuffer_sRGB = 0; +int GLAD_GLX_EXT_get_drawable_type = 0; +int GLAD_GLX_EXT_import_context = 0; +int GLAD_GLX_EXT_libglvnd = 0; +int GLAD_GLX_EXT_no_config_context = 0; +int GLAD_GLX_EXT_stereo_tree = 0; +int GLAD_GLX_EXT_swap_control = 0; +int GLAD_GLX_EXT_swap_control_tear = 0; +int GLAD_GLX_EXT_texture_from_pixmap = 0; +int GLAD_GLX_EXT_visual_info = 0; +int GLAD_GLX_EXT_visual_rating = 0; +int GLAD_GLX_INTEL_swap_event = 0; +int GLAD_GLX_MESA_agp_offset = 0; +int GLAD_GLX_MESA_copy_sub_buffer = 0; +int GLAD_GLX_MESA_pixmap_colormap = 0; +int GLAD_GLX_MESA_query_renderer = 0; +int GLAD_GLX_MESA_release_buffers = 0; +int GLAD_GLX_MESA_set_3dfx_mode = 0; +int GLAD_GLX_MESA_swap_control = 0; +int GLAD_GLX_NV_copy_buffer = 0; +int GLAD_GLX_NV_copy_image = 0; +int GLAD_GLX_NV_delay_before_swap = 0; +int GLAD_GLX_NV_float_buffer = 0; +int GLAD_GLX_NV_multigpu_context = 0; +int GLAD_GLX_NV_multisample_coverage = 0; +int GLAD_GLX_NV_present_video = 0; +int GLAD_GLX_NV_robustness_video_memory_purge = 0; +int GLAD_GLX_NV_swap_group = 0; +int GLAD_GLX_NV_video_capture = 0; +int GLAD_GLX_NV_video_out = 0; +int GLAD_GLX_OML_swap_method = 0; +int GLAD_GLX_OML_sync_control = 0; +int GLAD_GLX_SGIS_blended_overlay = 0; +int GLAD_GLX_SGIS_multisample = 0; +int GLAD_GLX_SGIS_shared_multisample = 0; +int GLAD_GLX_SGIX_dmbuffer = 0; +int GLAD_GLX_SGIX_fbconfig = 0; +int GLAD_GLX_SGIX_hyperpipe = 0; +int GLAD_GLX_SGIX_pbuffer = 0; +int GLAD_GLX_SGIX_swap_barrier = 0; +int GLAD_GLX_SGIX_swap_group = 0; +int GLAD_GLX_SGIX_video_resize = 0; +int GLAD_GLX_SGIX_video_source = 0; +int GLAD_GLX_SGIX_visual_select_group = 0; +int GLAD_GLX_SGI_cushion = 0; +int GLAD_GLX_SGI_make_current_read = 0; +int GLAD_GLX_SGI_swap_control = 0; +int GLAD_GLX_SGI_video_sync = 0; +int GLAD_GLX_SUN_get_transparent_index = 0; +PFNGLXGETGPUIDSAMDPROC glad_glXGetGPUIDsAMD = NULL; +PFNGLXGETGPUINFOAMDPROC glad_glXGetGPUInfoAMD = NULL; +PFNGLXGETCONTEXTGPUIDAMDPROC glad_glXGetContextGPUIDAMD = NULL; +PFNGLXCREATEASSOCIATEDCONTEXTAMDPROC glad_glXCreateAssociatedContextAMD = NULL; +PFNGLXCREATEASSOCIATEDCONTEXTATTRIBSAMDPROC glad_glXCreateAssociatedContextAttribsAMD = NULL; +PFNGLXDELETEASSOCIATEDCONTEXTAMDPROC glad_glXDeleteAssociatedContextAMD = NULL; +PFNGLXMAKEASSOCIATEDCONTEXTCURRENTAMDPROC glad_glXMakeAssociatedContextCurrentAMD = NULL; +PFNGLXGETCURRENTASSOCIATEDCONTEXTAMDPROC glad_glXGetCurrentAssociatedContextAMD = NULL; +PFNGLXBLITCONTEXTFRAMEBUFFERAMDPROC glad_glXBlitContextFramebufferAMD = NULL; +PFNGLXCREATECONTEXTATTRIBSARBPROC glad_glXCreateContextAttribsARB = NULL; +PFNGLXGETPROCADDRESSARBPROC glad_glXGetProcAddressARB = NULL; +PFNGLXGETCURRENTDISPLAYEXTPROC glad_glXGetCurrentDisplayEXT = NULL; +PFNGLXQUERYCONTEXTINFOEXTPROC glad_glXQueryContextInfoEXT = NULL; +PFNGLXGETCONTEXTIDEXTPROC glad_glXGetContextIDEXT = NULL; +PFNGLXIMPORTCONTEXTEXTPROC glad_glXImportContextEXT = NULL; +PFNGLXFREECONTEXTEXTPROC glad_glXFreeContextEXT = NULL; +PFNGLXSWAPINTERVALEXTPROC glad_glXSwapIntervalEXT = NULL; +PFNGLXBINDTEXIMAGEEXTPROC glad_glXBindTexImageEXT = NULL; +PFNGLXRELEASETEXIMAGEEXTPROC glad_glXReleaseTexImageEXT = NULL; +PFNGLXGETAGPOFFSETMESAPROC glad_glXGetAGPOffsetMESA = NULL; +PFNGLXCOPYSUBBUFFERMESAPROC glad_glXCopySubBufferMESA = NULL; +PFNGLXCREATEGLXPIXMAPMESAPROC glad_glXCreateGLXPixmapMESA = NULL; +PFNGLXQUERYCURRENTRENDERERINTEGERMESAPROC glad_glXQueryCurrentRendererIntegerMESA = NULL; +PFNGLXQUERYCURRENTRENDERERSTRINGMESAPROC glad_glXQueryCurrentRendererStringMESA = NULL; +PFNGLXQUERYRENDERERINTEGERMESAPROC glad_glXQueryRendererIntegerMESA = NULL; +PFNGLXQUERYRENDERERSTRINGMESAPROC glad_glXQueryRendererStringMESA = NULL; +PFNGLXRELEASEBUFFERSMESAPROC glad_glXReleaseBuffersMESA = NULL; +PFNGLXSET3DFXMODEMESAPROC glad_glXSet3DfxModeMESA = NULL; +PFNGLXGETSWAPINTERVALMESAPROC glad_glXGetSwapIntervalMESA = NULL; +PFNGLXSWAPINTERVALMESAPROC glad_glXSwapIntervalMESA = NULL; +PFNGLXCOPYBUFFERSUBDATANVPROC glad_glXCopyBufferSubDataNV = NULL; +PFNGLXNAMEDCOPYBUFFERSUBDATANVPROC glad_glXNamedCopyBufferSubDataNV = NULL; +PFNGLXCOPYIMAGESUBDATANVPROC glad_glXCopyImageSubDataNV = NULL; +PFNGLXDELAYBEFORESWAPNVPROC glad_glXDelayBeforeSwapNV = NULL; +PFNGLXENUMERATEVIDEODEVICESNVPROC glad_glXEnumerateVideoDevicesNV = NULL; +PFNGLXBINDVIDEODEVICENVPROC glad_glXBindVideoDeviceNV = NULL; +PFNGLXJOINSWAPGROUPNVPROC glad_glXJoinSwapGroupNV = NULL; +PFNGLXBINDSWAPBARRIERNVPROC glad_glXBindSwapBarrierNV = NULL; +PFNGLXQUERYSWAPGROUPNVPROC glad_glXQuerySwapGroupNV = NULL; +PFNGLXQUERYMAXSWAPGROUPSNVPROC glad_glXQueryMaxSwapGroupsNV = NULL; +PFNGLXQUERYFRAMECOUNTNVPROC glad_glXQueryFrameCountNV = NULL; +PFNGLXRESETFRAMECOUNTNVPROC glad_glXResetFrameCountNV = NULL; +PFNGLXBINDVIDEOCAPTUREDEVICENVPROC glad_glXBindVideoCaptureDeviceNV = NULL; +PFNGLXENUMERATEVIDEOCAPTUREDEVICESNVPROC glad_glXEnumerateVideoCaptureDevicesNV = NULL; +PFNGLXLOCKVIDEOCAPTUREDEVICENVPROC glad_glXLockVideoCaptureDeviceNV = NULL; +PFNGLXQUERYVIDEOCAPTUREDEVICENVPROC glad_glXQueryVideoCaptureDeviceNV = NULL; +PFNGLXRELEASEVIDEOCAPTUREDEVICENVPROC glad_glXReleaseVideoCaptureDeviceNV = NULL; +PFNGLXGETVIDEODEVICENVPROC glad_glXGetVideoDeviceNV = NULL; +PFNGLXRELEASEVIDEODEVICENVPROC glad_glXReleaseVideoDeviceNV = NULL; +PFNGLXBINDVIDEOIMAGENVPROC glad_glXBindVideoImageNV = NULL; +PFNGLXRELEASEVIDEOIMAGENVPROC glad_glXReleaseVideoImageNV = NULL; +PFNGLXSENDPBUFFERTOVIDEONVPROC glad_glXSendPbufferToVideoNV = NULL; +PFNGLXGETVIDEOINFONVPROC glad_glXGetVideoInfoNV = NULL; +PFNGLXGETSYNCVALUESOMLPROC glad_glXGetSyncValuesOML = NULL; +PFNGLXGETMSCRATEOMLPROC glad_glXGetMscRateOML = NULL; +PFNGLXSWAPBUFFERSMSCOMLPROC glad_glXSwapBuffersMscOML = NULL; +PFNGLXWAITFORMSCOMLPROC glad_glXWaitForMscOML = NULL; +PFNGLXWAITFORSBCOMLPROC glad_glXWaitForSbcOML = NULL; +#ifdef _DM_BUFFER_H_ +PFNGLXASSOCIATEDMPBUFFERSGIXPROC glad_glXAssociateDMPbufferSGIX = NULL; +#endif +PFNGLXGETFBCONFIGATTRIBSGIXPROC glad_glXGetFBConfigAttribSGIX = NULL; +PFNGLXCHOOSEFBCONFIGSGIXPROC glad_glXChooseFBConfigSGIX = NULL; +PFNGLXCREATEGLXPIXMAPWITHCONFIGSGIXPROC glad_glXCreateGLXPixmapWithConfigSGIX = NULL; +PFNGLXCREATECONTEXTWITHCONFIGSGIXPROC glad_glXCreateContextWithConfigSGIX = NULL; +PFNGLXGETVISUALFROMFBCONFIGSGIXPROC glad_glXGetVisualFromFBConfigSGIX = NULL; +PFNGLXGETFBCONFIGFROMVISUALSGIXPROC glad_glXGetFBConfigFromVisualSGIX = NULL; +PFNGLXQUERYHYPERPIPENETWORKSGIXPROC glad_glXQueryHyperpipeNetworkSGIX = NULL; +PFNGLXHYPERPIPECONFIGSGIXPROC glad_glXHyperpipeConfigSGIX = NULL; +PFNGLXQUERYHYPERPIPECONFIGSGIXPROC glad_glXQueryHyperpipeConfigSGIX = NULL; +PFNGLXDESTROYHYPERPIPECONFIGSGIXPROC glad_glXDestroyHyperpipeConfigSGIX = NULL; +PFNGLXBINDHYPERPIPESGIXPROC glad_glXBindHyperpipeSGIX = NULL; +PFNGLXQUERYHYPERPIPEBESTATTRIBSGIXPROC glad_glXQueryHyperpipeBestAttribSGIX = NULL; +PFNGLXHYPERPIPEATTRIBSGIXPROC glad_glXHyperpipeAttribSGIX = NULL; +PFNGLXQUERYHYPERPIPEATTRIBSGIXPROC glad_glXQueryHyperpipeAttribSGIX = NULL; +PFNGLXCREATEGLXPBUFFERSGIXPROC glad_glXCreateGLXPbufferSGIX = NULL; +PFNGLXDESTROYGLXPBUFFERSGIXPROC glad_glXDestroyGLXPbufferSGIX = NULL; +PFNGLXQUERYGLXPBUFFERSGIXPROC glad_glXQueryGLXPbufferSGIX = NULL; +PFNGLXSELECTEVENTSGIXPROC glad_glXSelectEventSGIX = NULL; +PFNGLXGETSELECTEDEVENTSGIXPROC glad_glXGetSelectedEventSGIX = NULL; +PFNGLXBINDSWAPBARRIERSGIXPROC glad_glXBindSwapBarrierSGIX = NULL; +PFNGLXQUERYMAXSWAPBARRIERSSGIXPROC glad_glXQueryMaxSwapBarriersSGIX = NULL; +PFNGLXJOINSWAPGROUPSGIXPROC glad_glXJoinSwapGroupSGIX = NULL; +PFNGLXBINDCHANNELTOWINDOWSGIXPROC glad_glXBindChannelToWindowSGIX = NULL; +PFNGLXCHANNELRECTSGIXPROC glad_glXChannelRectSGIX = NULL; +PFNGLXQUERYCHANNELRECTSGIXPROC glad_glXQueryChannelRectSGIX = NULL; +PFNGLXQUERYCHANNELDELTASSGIXPROC glad_glXQueryChannelDeltasSGIX = NULL; +PFNGLXCHANNELRECTSYNCSGIXPROC glad_glXChannelRectSyncSGIX = NULL; +#ifdef _VL_H_ +PFNGLXCREATEGLXVIDEOSOURCESGIXPROC glad_glXCreateGLXVideoSourceSGIX = NULL; +PFNGLXDESTROYGLXVIDEOSOURCESGIXPROC glad_glXDestroyGLXVideoSourceSGIX = NULL; +#endif +PFNGLXCUSHIONSGIPROC glad_glXCushionSGI = NULL; +PFNGLXMAKECURRENTREADSGIPROC glad_glXMakeCurrentReadSGI = NULL; +PFNGLXGETCURRENTREADDRAWABLESGIPROC glad_glXGetCurrentReadDrawableSGI = NULL; +PFNGLXSWAPINTERVALSGIPROC glad_glXSwapIntervalSGI = NULL; +PFNGLXGETVIDEOSYNCSGIPROC glad_glXGetVideoSyncSGI = NULL; +PFNGLXWAITVIDEOSYNCSGIPROC glad_glXWaitVideoSyncSGI = NULL; +PFNGLXGETTRANSPARENTINDEXSUNPROC glad_glXGetTransparentIndexSUN = NULL; static void load_GLX_VERSION_1_0(GLADloadproc load) { if(!GLAD_GLX_VERSION_1_0) return; glad_glXChooseVisual = (PFNGLXCHOOSEVISUALPROC)load("glXChooseVisual"); @@ -298,9 +532,281 @@ static void load_GLX_VERSION_1_4(GLADloadproc load) { if(!GLAD_GLX_VERSION_1_4) return; glad_glXGetProcAddress = (PFNGLXGETPROCADDRESSPROC)load("glXGetProcAddress"); } +static void load_GLX_AMD_gpu_association(GLADloadproc load) { + if(!GLAD_GLX_AMD_gpu_association) return; + glad_glXGetGPUIDsAMD = (PFNGLXGETGPUIDSAMDPROC)load("glXGetGPUIDsAMD"); + glad_glXGetGPUInfoAMD = (PFNGLXGETGPUINFOAMDPROC)load("glXGetGPUInfoAMD"); + glad_glXGetContextGPUIDAMD = (PFNGLXGETCONTEXTGPUIDAMDPROC)load("glXGetContextGPUIDAMD"); + glad_glXCreateAssociatedContextAMD = (PFNGLXCREATEASSOCIATEDCONTEXTAMDPROC)load("glXCreateAssociatedContextAMD"); + glad_glXCreateAssociatedContextAttribsAMD = (PFNGLXCREATEASSOCIATEDCONTEXTATTRIBSAMDPROC)load("glXCreateAssociatedContextAttribsAMD"); + glad_glXDeleteAssociatedContextAMD = (PFNGLXDELETEASSOCIATEDCONTEXTAMDPROC)load("glXDeleteAssociatedContextAMD"); + glad_glXMakeAssociatedContextCurrentAMD = (PFNGLXMAKEASSOCIATEDCONTEXTCURRENTAMDPROC)load("glXMakeAssociatedContextCurrentAMD"); + glad_glXGetCurrentAssociatedContextAMD = (PFNGLXGETCURRENTASSOCIATEDCONTEXTAMDPROC)load("glXGetCurrentAssociatedContextAMD"); + glad_glXBlitContextFramebufferAMD = (PFNGLXBLITCONTEXTFRAMEBUFFERAMDPROC)load("glXBlitContextFramebufferAMD"); +} +static void load_GLX_ARB_create_context(GLADloadproc load) { + if(!GLAD_GLX_ARB_create_context) return; + glad_glXCreateContextAttribsARB = (PFNGLXCREATECONTEXTATTRIBSARBPROC)load("glXCreateContextAttribsARB"); +} +static void load_GLX_ARB_get_proc_address(GLADloadproc load) { + if(!GLAD_GLX_ARB_get_proc_address) return; + glad_glXGetProcAddressARB = (PFNGLXGETPROCADDRESSARBPROC)load("glXGetProcAddressARB"); +} +static void load_GLX_EXT_import_context(GLADloadproc load) { + if(!GLAD_GLX_EXT_import_context) return; + glad_glXGetCurrentDisplayEXT = (PFNGLXGETCURRENTDISPLAYEXTPROC)load("glXGetCurrentDisplayEXT"); + glad_glXQueryContextInfoEXT = (PFNGLXQUERYCONTEXTINFOEXTPROC)load("glXQueryContextInfoEXT"); + glad_glXGetContextIDEXT = (PFNGLXGETCONTEXTIDEXTPROC)load("glXGetContextIDEXT"); + glad_glXImportContextEXT = (PFNGLXIMPORTCONTEXTEXTPROC)load("glXImportContextEXT"); + glad_glXFreeContextEXT = (PFNGLXFREECONTEXTEXTPROC)load("glXFreeContextEXT"); +} +static void load_GLX_EXT_swap_control(GLADloadproc load) { + if(!GLAD_GLX_EXT_swap_control) return; + glad_glXSwapIntervalEXT = (PFNGLXSWAPINTERVALEXTPROC)load("glXSwapIntervalEXT"); +} +static void load_GLX_EXT_texture_from_pixmap(GLADloadproc load) { + if(!GLAD_GLX_EXT_texture_from_pixmap) return; + glad_glXBindTexImageEXT = (PFNGLXBINDTEXIMAGEEXTPROC)load("glXBindTexImageEXT"); + glad_glXReleaseTexImageEXT = (PFNGLXRELEASETEXIMAGEEXTPROC)load("glXReleaseTexImageEXT"); +} +static void load_GLX_MESA_agp_offset(GLADloadproc load) { + if(!GLAD_GLX_MESA_agp_offset) return; + glad_glXGetAGPOffsetMESA = (PFNGLXGETAGPOFFSETMESAPROC)load("glXGetAGPOffsetMESA"); +} +static void load_GLX_MESA_copy_sub_buffer(GLADloadproc load) { + if(!GLAD_GLX_MESA_copy_sub_buffer) return; + glad_glXCopySubBufferMESA = (PFNGLXCOPYSUBBUFFERMESAPROC)load("glXCopySubBufferMESA"); +} +static void load_GLX_MESA_pixmap_colormap(GLADloadproc load) { + if(!GLAD_GLX_MESA_pixmap_colormap) return; + glad_glXCreateGLXPixmapMESA = (PFNGLXCREATEGLXPIXMAPMESAPROC)load("glXCreateGLXPixmapMESA"); +} +static void load_GLX_MESA_query_renderer(GLADloadproc load) { + if(!GLAD_GLX_MESA_query_renderer) return; + glad_glXQueryCurrentRendererIntegerMESA = (PFNGLXQUERYCURRENTRENDERERINTEGERMESAPROC)load("glXQueryCurrentRendererIntegerMESA"); + glad_glXQueryCurrentRendererStringMESA = (PFNGLXQUERYCURRENTRENDERERSTRINGMESAPROC)load("glXQueryCurrentRendererStringMESA"); + glad_glXQueryRendererIntegerMESA = (PFNGLXQUERYRENDERERINTEGERMESAPROC)load("glXQueryRendererIntegerMESA"); + glad_glXQueryRendererStringMESA = (PFNGLXQUERYRENDERERSTRINGMESAPROC)load("glXQueryRendererStringMESA"); +} +static void load_GLX_MESA_release_buffers(GLADloadproc load) { + if(!GLAD_GLX_MESA_release_buffers) return; + glad_glXReleaseBuffersMESA = (PFNGLXRELEASEBUFFERSMESAPROC)load("glXReleaseBuffersMESA"); +} +static void load_GLX_MESA_set_3dfx_mode(GLADloadproc load) { + if(!GLAD_GLX_MESA_set_3dfx_mode) return; + glad_glXSet3DfxModeMESA = (PFNGLXSET3DFXMODEMESAPROC)load("glXSet3DfxModeMESA"); +} +static void load_GLX_MESA_swap_control(GLADloadproc load) { + if(!GLAD_GLX_MESA_swap_control) return; + glad_glXGetSwapIntervalMESA = (PFNGLXGETSWAPINTERVALMESAPROC)load("glXGetSwapIntervalMESA"); + glad_glXSwapIntervalMESA = (PFNGLXSWAPINTERVALMESAPROC)load("glXSwapIntervalMESA"); +} +static void load_GLX_NV_copy_buffer(GLADloadproc load) { + if(!GLAD_GLX_NV_copy_buffer) return; + glad_glXCopyBufferSubDataNV = (PFNGLXCOPYBUFFERSUBDATANVPROC)load("glXCopyBufferSubDataNV"); + glad_glXNamedCopyBufferSubDataNV = (PFNGLXNAMEDCOPYBUFFERSUBDATANVPROC)load("glXNamedCopyBufferSubDataNV"); +} +static void load_GLX_NV_copy_image(GLADloadproc load) { + if(!GLAD_GLX_NV_copy_image) return; + glad_glXCopyImageSubDataNV = (PFNGLXCOPYIMAGESUBDATANVPROC)load("glXCopyImageSubDataNV"); +} +static void load_GLX_NV_delay_before_swap(GLADloadproc load) { + if(!GLAD_GLX_NV_delay_before_swap) return; + glad_glXDelayBeforeSwapNV = (PFNGLXDELAYBEFORESWAPNVPROC)load("glXDelayBeforeSwapNV"); +} +static void load_GLX_NV_present_video(GLADloadproc load) { + if(!GLAD_GLX_NV_present_video) return; + glad_glXEnumerateVideoDevicesNV = (PFNGLXENUMERATEVIDEODEVICESNVPROC)load("glXEnumerateVideoDevicesNV"); + glad_glXBindVideoDeviceNV = (PFNGLXBINDVIDEODEVICENVPROC)load("glXBindVideoDeviceNV"); +} +static void load_GLX_NV_swap_group(GLADloadproc load) { + if(!GLAD_GLX_NV_swap_group) return; + glad_glXJoinSwapGroupNV = (PFNGLXJOINSWAPGROUPNVPROC)load("glXJoinSwapGroupNV"); + glad_glXBindSwapBarrierNV = (PFNGLXBINDSWAPBARRIERNVPROC)load("glXBindSwapBarrierNV"); + glad_glXQuerySwapGroupNV = (PFNGLXQUERYSWAPGROUPNVPROC)load("glXQuerySwapGroupNV"); + glad_glXQueryMaxSwapGroupsNV = (PFNGLXQUERYMAXSWAPGROUPSNVPROC)load("glXQueryMaxSwapGroupsNV"); + glad_glXQueryFrameCountNV = (PFNGLXQUERYFRAMECOUNTNVPROC)load("glXQueryFrameCountNV"); + glad_glXResetFrameCountNV = (PFNGLXRESETFRAMECOUNTNVPROC)load("glXResetFrameCountNV"); +} +static void load_GLX_NV_video_capture(GLADloadproc load) { + if(!GLAD_GLX_NV_video_capture) return; + glad_glXBindVideoCaptureDeviceNV = (PFNGLXBINDVIDEOCAPTUREDEVICENVPROC)load("glXBindVideoCaptureDeviceNV"); + glad_glXEnumerateVideoCaptureDevicesNV = (PFNGLXENUMERATEVIDEOCAPTUREDEVICESNVPROC)load("glXEnumerateVideoCaptureDevicesNV"); + glad_glXLockVideoCaptureDeviceNV = (PFNGLXLOCKVIDEOCAPTUREDEVICENVPROC)load("glXLockVideoCaptureDeviceNV"); + glad_glXQueryVideoCaptureDeviceNV = (PFNGLXQUERYVIDEOCAPTUREDEVICENVPROC)load("glXQueryVideoCaptureDeviceNV"); + glad_glXReleaseVideoCaptureDeviceNV = (PFNGLXRELEASEVIDEOCAPTUREDEVICENVPROC)load("glXReleaseVideoCaptureDeviceNV"); +} +static void load_GLX_NV_video_out(GLADloadproc load) { + if(!GLAD_GLX_NV_video_out) return; + glad_glXGetVideoDeviceNV = (PFNGLXGETVIDEODEVICENVPROC)load("glXGetVideoDeviceNV"); + glad_glXReleaseVideoDeviceNV = (PFNGLXRELEASEVIDEODEVICENVPROC)load("glXReleaseVideoDeviceNV"); + glad_glXBindVideoImageNV = (PFNGLXBINDVIDEOIMAGENVPROC)load("glXBindVideoImageNV"); + glad_glXReleaseVideoImageNV = (PFNGLXRELEASEVIDEOIMAGENVPROC)load("glXReleaseVideoImageNV"); + glad_glXSendPbufferToVideoNV = (PFNGLXSENDPBUFFERTOVIDEONVPROC)load("glXSendPbufferToVideoNV"); + glad_glXGetVideoInfoNV = (PFNGLXGETVIDEOINFONVPROC)load("glXGetVideoInfoNV"); +} +static void load_GLX_OML_sync_control(GLADloadproc load) { + if(!GLAD_GLX_OML_sync_control) return; + glad_glXGetSyncValuesOML = (PFNGLXGETSYNCVALUESOMLPROC)load("glXGetSyncValuesOML"); + glad_glXGetMscRateOML = (PFNGLXGETMSCRATEOMLPROC)load("glXGetMscRateOML"); + glad_glXSwapBuffersMscOML = (PFNGLXSWAPBUFFERSMSCOMLPROC)load("glXSwapBuffersMscOML"); + glad_glXWaitForMscOML = (PFNGLXWAITFORMSCOMLPROC)load("glXWaitForMscOML"); + glad_glXWaitForSbcOML = (PFNGLXWAITFORSBCOMLPROC)load("glXWaitForSbcOML"); +} +static void load_GLX_SGIX_dmbuffer(GLADloadproc load) { + if(!GLAD_GLX_SGIX_dmbuffer) return; +#ifdef _DM_BUFFER_H_ + glad_glXAssociateDMPbufferSGIX = (PFNGLXASSOCIATEDMPBUFFERSGIXPROC)load("glXAssociateDMPbufferSGIX"); +#else + (void)load; +#endif +} +static void load_GLX_SGIX_fbconfig(GLADloadproc load) { + if(!GLAD_GLX_SGIX_fbconfig) return; + glad_glXGetFBConfigAttribSGIX = (PFNGLXGETFBCONFIGATTRIBSGIXPROC)load("glXGetFBConfigAttribSGIX"); + glad_glXChooseFBConfigSGIX = (PFNGLXCHOOSEFBCONFIGSGIXPROC)load("glXChooseFBConfigSGIX"); + glad_glXCreateGLXPixmapWithConfigSGIX = (PFNGLXCREATEGLXPIXMAPWITHCONFIGSGIXPROC)load("glXCreateGLXPixmapWithConfigSGIX"); + glad_glXCreateContextWithConfigSGIX = (PFNGLXCREATECONTEXTWITHCONFIGSGIXPROC)load("glXCreateContextWithConfigSGIX"); + glad_glXGetVisualFromFBConfigSGIX = (PFNGLXGETVISUALFROMFBCONFIGSGIXPROC)load("glXGetVisualFromFBConfigSGIX"); + glad_glXGetFBConfigFromVisualSGIX = (PFNGLXGETFBCONFIGFROMVISUALSGIXPROC)load("glXGetFBConfigFromVisualSGIX"); +} +static void load_GLX_SGIX_hyperpipe(GLADloadproc load) { + if(!GLAD_GLX_SGIX_hyperpipe) return; + glad_glXQueryHyperpipeNetworkSGIX = (PFNGLXQUERYHYPERPIPENETWORKSGIXPROC)load("glXQueryHyperpipeNetworkSGIX"); + glad_glXHyperpipeConfigSGIX = (PFNGLXHYPERPIPECONFIGSGIXPROC)load("glXHyperpipeConfigSGIX"); + glad_glXQueryHyperpipeConfigSGIX = (PFNGLXQUERYHYPERPIPECONFIGSGIXPROC)load("glXQueryHyperpipeConfigSGIX"); + glad_glXDestroyHyperpipeConfigSGIX = (PFNGLXDESTROYHYPERPIPECONFIGSGIXPROC)load("glXDestroyHyperpipeConfigSGIX"); + glad_glXBindHyperpipeSGIX = (PFNGLXBINDHYPERPIPESGIXPROC)load("glXBindHyperpipeSGIX"); + glad_glXQueryHyperpipeBestAttribSGIX = (PFNGLXQUERYHYPERPIPEBESTATTRIBSGIXPROC)load("glXQueryHyperpipeBestAttribSGIX"); + glad_glXHyperpipeAttribSGIX = (PFNGLXHYPERPIPEATTRIBSGIXPROC)load("glXHyperpipeAttribSGIX"); + glad_glXQueryHyperpipeAttribSGIX = (PFNGLXQUERYHYPERPIPEATTRIBSGIXPROC)load("glXQueryHyperpipeAttribSGIX"); +} +static void load_GLX_SGIX_pbuffer(GLADloadproc load) { + if(!GLAD_GLX_SGIX_pbuffer) return; + glad_glXCreateGLXPbufferSGIX = (PFNGLXCREATEGLXPBUFFERSGIXPROC)load("glXCreateGLXPbufferSGIX"); + glad_glXDestroyGLXPbufferSGIX = (PFNGLXDESTROYGLXPBUFFERSGIXPROC)load("glXDestroyGLXPbufferSGIX"); + glad_glXQueryGLXPbufferSGIX = (PFNGLXQUERYGLXPBUFFERSGIXPROC)load("glXQueryGLXPbufferSGIX"); + glad_glXSelectEventSGIX = (PFNGLXSELECTEVENTSGIXPROC)load("glXSelectEventSGIX"); + glad_glXGetSelectedEventSGIX = (PFNGLXGETSELECTEDEVENTSGIXPROC)load("glXGetSelectedEventSGIX"); +} +static void load_GLX_SGIX_swap_barrier(GLADloadproc load) { + if(!GLAD_GLX_SGIX_swap_barrier) return; + glad_glXBindSwapBarrierSGIX = (PFNGLXBINDSWAPBARRIERSGIXPROC)load("glXBindSwapBarrierSGIX"); + glad_glXQueryMaxSwapBarriersSGIX = (PFNGLXQUERYMAXSWAPBARRIERSSGIXPROC)load("glXQueryMaxSwapBarriersSGIX"); +} +static void load_GLX_SGIX_swap_group(GLADloadproc load) { + if(!GLAD_GLX_SGIX_swap_group) return; + glad_glXJoinSwapGroupSGIX = (PFNGLXJOINSWAPGROUPSGIXPROC)load("glXJoinSwapGroupSGIX"); +} +static void load_GLX_SGIX_video_resize(GLADloadproc load) { + if(!GLAD_GLX_SGIX_video_resize) return; + glad_glXBindChannelToWindowSGIX = (PFNGLXBINDCHANNELTOWINDOWSGIXPROC)load("glXBindChannelToWindowSGIX"); + glad_glXChannelRectSGIX = (PFNGLXCHANNELRECTSGIXPROC)load("glXChannelRectSGIX"); + glad_glXQueryChannelRectSGIX = (PFNGLXQUERYCHANNELRECTSGIXPROC)load("glXQueryChannelRectSGIX"); + glad_glXQueryChannelDeltasSGIX = (PFNGLXQUERYCHANNELDELTASSGIXPROC)load("glXQueryChannelDeltasSGIX"); + glad_glXChannelRectSyncSGIX = (PFNGLXCHANNELRECTSYNCSGIXPROC)load("glXChannelRectSyncSGIX"); +} +static void load_GLX_SGIX_video_source(GLADloadproc load) { + if(!GLAD_GLX_SGIX_video_source) return; +#ifdef _VL_H_ + glad_glXCreateGLXVideoSourceSGIX = (PFNGLXCREATEGLXVIDEOSOURCESGIXPROC)load("glXCreateGLXVideoSourceSGIX"); + glad_glXDestroyGLXVideoSourceSGIX = (PFNGLXDESTROYGLXVIDEOSOURCESGIXPROC)load("glXDestroyGLXVideoSourceSGIX"); +#else + (void)load; +#endif +} +static void load_GLX_SGI_cushion(GLADloadproc load) { + if(!GLAD_GLX_SGI_cushion) return; + glad_glXCushionSGI = (PFNGLXCUSHIONSGIPROC)load("glXCushionSGI"); +} +static void load_GLX_SGI_make_current_read(GLADloadproc load) { + if(!GLAD_GLX_SGI_make_current_read) return; + glad_glXMakeCurrentReadSGI = (PFNGLXMAKECURRENTREADSGIPROC)load("glXMakeCurrentReadSGI"); + glad_glXGetCurrentReadDrawableSGI = (PFNGLXGETCURRENTREADDRAWABLESGIPROC)load("glXGetCurrentReadDrawableSGI"); +} +static void load_GLX_SGI_swap_control(GLADloadproc load) { + if(!GLAD_GLX_SGI_swap_control) return; + glad_glXSwapIntervalSGI = (PFNGLXSWAPINTERVALSGIPROC)load("glXSwapIntervalSGI"); +} +static void load_GLX_SGI_video_sync(GLADloadproc load) { + if(!GLAD_GLX_SGI_video_sync) return; + glad_glXGetVideoSyncSGI = (PFNGLXGETVIDEOSYNCSGIPROC)load("glXGetVideoSyncSGI"); + glad_glXWaitVideoSyncSGI = (PFNGLXWAITVIDEOSYNCSGIPROC)load("glXWaitVideoSyncSGI"); +} +static void load_GLX_SUN_get_transparent_index(GLADloadproc load) { + if(!GLAD_GLX_SUN_get_transparent_index) return; + glad_glXGetTransparentIndexSUN = (PFNGLXGETTRANSPARENTINDEXSUNPROC)load("glXGetTransparentIndexSUN"); +} static int find_extensionsGLX(void) { if (!get_exts()) return 0; - (void)&has_ext; + GLAD_GLX_3DFX_multisample = has_ext("GLX_3DFX_multisample"); + GLAD_GLX_AMD_gpu_association = has_ext("GLX_AMD_gpu_association"); + GLAD_GLX_ARB_context_flush_control = has_ext("GLX_ARB_context_flush_control"); + GLAD_GLX_ARB_create_context = has_ext("GLX_ARB_create_context"); + GLAD_GLX_ARB_create_context_no_error = has_ext("GLX_ARB_create_context_no_error"); + GLAD_GLX_ARB_create_context_profile = has_ext("GLX_ARB_create_context_profile"); + GLAD_GLX_ARB_create_context_robustness = has_ext("GLX_ARB_create_context_robustness"); + GLAD_GLX_ARB_fbconfig_float = has_ext("GLX_ARB_fbconfig_float"); + GLAD_GLX_ARB_framebuffer_sRGB = has_ext("GLX_ARB_framebuffer_sRGB"); + GLAD_GLX_ARB_get_proc_address = has_ext("GLX_ARB_get_proc_address"); + GLAD_GLX_ARB_multisample = has_ext("GLX_ARB_multisample"); + GLAD_GLX_ARB_robustness_application_isolation = has_ext("GLX_ARB_robustness_application_isolation"); + GLAD_GLX_ARB_robustness_share_group_isolation = has_ext("GLX_ARB_robustness_share_group_isolation"); + GLAD_GLX_ARB_vertex_buffer_object = has_ext("GLX_ARB_vertex_buffer_object"); + GLAD_GLX_EXT_buffer_age = has_ext("GLX_EXT_buffer_age"); + GLAD_GLX_EXT_context_priority = has_ext("GLX_EXT_context_priority"); + GLAD_GLX_EXT_create_context_es2_profile = has_ext("GLX_EXT_create_context_es2_profile"); + GLAD_GLX_EXT_create_context_es_profile = has_ext("GLX_EXT_create_context_es_profile"); + GLAD_GLX_EXT_fbconfig_packed_float = has_ext("GLX_EXT_fbconfig_packed_float"); + GLAD_GLX_EXT_framebuffer_sRGB = has_ext("GLX_EXT_framebuffer_sRGB"); + GLAD_GLX_EXT_get_drawable_type = has_ext("GLX_EXT_get_drawable_type"); + GLAD_GLX_EXT_import_context = has_ext("GLX_EXT_import_context"); + GLAD_GLX_EXT_libglvnd = has_ext("GLX_EXT_libglvnd"); + GLAD_GLX_EXT_no_config_context = has_ext("GLX_EXT_no_config_context"); + GLAD_GLX_EXT_stereo_tree = has_ext("GLX_EXT_stereo_tree"); + GLAD_GLX_EXT_swap_control = has_ext("GLX_EXT_swap_control"); + GLAD_GLX_EXT_swap_control_tear = has_ext("GLX_EXT_swap_control_tear"); + GLAD_GLX_EXT_texture_from_pixmap = has_ext("GLX_EXT_texture_from_pixmap"); + GLAD_GLX_EXT_visual_info = has_ext("GLX_EXT_visual_info"); + GLAD_GLX_EXT_visual_rating = has_ext("GLX_EXT_visual_rating"); + GLAD_GLX_INTEL_swap_event = has_ext("GLX_INTEL_swap_event"); + GLAD_GLX_MESA_agp_offset = has_ext("GLX_MESA_agp_offset"); + GLAD_GLX_MESA_copy_sub_buffer = has_ext("GLX_MESA_copy_sub_buffer"); + GLAD_GLX_MESA_pixmap_colormap = has_ext("GLX_MESA_pixmap_colormap"); + GLAD_GLX_MESA_query_renderer = has_ext("GLX_MESA_query_renderer"); + GLAD_GLX_MESA_release_buffers = has_ext("GLX_MESA_release_buffers"); + GLAD_GLX_MESA_set_3dfx_mode = has_ext("GLX_MESA_set_3dfx_mode"); + GLAD_GLX_MESA_swap_control = has_ext("GLX_MESA_swap_control"); + GLAD_GLX_NV_copy_buffer = has_ext("GLX_NV_copy_buffer"); + GLAD_GLX_NV_copy_image = has_ext("GLX_NV_copy_image"); + GLAD_GLX_NV_delay_before_swap = has_ext("GLX_NV_delay_before_swap"); + GLAD_GLX_NV_float_buffer = has_ext("GLX_NV_float_buffer"); + GLAD_GLX_NV_multigpu_context = has_ext("GLX_NV_multigpu_context"); + GLAD_GLX_NV_multisample_coverage = has_ext("GLX_NV_multisample_coverage"); + GLAD_GLX_NV_present_video = has_ext("GLX_NV_present_video"); + GLAD_GLX_NV_robustness_video_memory_purge = has_ext("GLX_NV_robustness_video_memory_purge"); + GLAD_GLX_NV_swap_group = has_ext("GLX_NV_swap_group"); + GLAD_GLX_NV_video_capture = has_ext("GLX_NV_video_capture"); + GLAD_GLX_NV_video_out = has_ext("GLX_NV_video_out"); + GLAD_GLX_OML_swap_method = has_ext("GLX_OML_swap_method"); + GLAD_GLX_OML_sync_control = has_ext("GLX_OML_sync_control"); + GLAD_GLX_SGIS_blended_overlay = has_ext("GLX_SGIS_blended_overlay"); + GLAD_GLX_SGIS_multisample = has_ext("GLX_SGIS_multisample"); + GLAD_GLX_SGIS_shared_multisample = has_ext("GLX_SGIS_shared_multisample"); + GLAD_GLX_SGIX_dmbuffer = has_ext("GLX_SGIX_dmbuffer"); + GLAD_GLX_SGIX_fbconfig = has_ext("GLX_SGIX_fbconfig"); + GLAD_GLX_SGIX_hyperpipe = has_ext("GLX_SGIX_hyperpipe"); + GLAD_GLX_SGIX_pbuffer = has_ext("GLX_SGIX_pbuffer"); + GLAD_GLX_SGIX_swap_barrier = has_ext("GLX_SGIX_swap_barrier"); + GLAD_GLX_SGIX_swap_group = has_ext("GLX_SGIX_swap_group"); + GLAD_GLX_SGIX_video_resize = has_ext("GLX_SGIX_video_resize"); + GLAD_GLX_SGIX_video_source = has_ext("GLX_SGIX_video_source"); + GLAD_GLX_SGIX_visual_select_group = has_ext("GLX_SGIX_visual_select_group"); + GLAD_GLX_SGI_cushion = has_ext("GLX_SGI_cushion"); + GLAD_GLX_SGI_make_current_read = has_ext("GLX_SGI_make_current_read"); + GLAD_GLX_SGI_swap_control = has_ext("GLX_SGI_swap_control"); + GLAD_GLX_SGI_video_sync = has_ext("GLX_SGI_video_sync"); + GLAD_GLX_SUN_get_transparent_index = has_ext("GLX_SUN_get_transparent_index"); free_exts(); return 1; } @@ -335,6 +841,40 @@ int gladLoadGLXLoader(GLADloadproc load, Display *dpy, int screen) { load_GLX_VERSION_1_4(load); if (!find_extensionsGLX()) return 0; + load_GLX_AMD_gpu_association(load); + load_GLX_ARB_create_context(load); + load_GLX_ARB_get_proc_address(load); + load_GLX_EXT_import_context(load); + load_GLX_EXT_swap_control(load); + load_GLX_EXT_texture_from_pixmap(load); + load_GLX_MESA_agp_offset(load); + load_GLX_MESA_copy_sub_buffer(load); + load_GLX_MESA_pixmap_colormap(load); + load_GLX_MESA_query_renderer(load); + load_GLX_MESA_release_buffers(load); + load_GLX_MESA_set_3dfx_mode(load); + load_GLX_MESA_swap_control(load); + load_GLX_NV_copy_buffer(load); + load_GLX_NV_copy_image(load); + load_GLX_NV_delay_before_swap(load); + load_GLX_NV_present_video(load); + load_GLX_NV_swap_group(load); + load_GLX_NV_video_capture(load); + load_GLX_NV_video_out(load); + load_GLX_OML_sync_control(load); + load_GLX_SGIX_dmbuffer(load); + load_GLX_SGIX_fbconfig(load); + load_GLX_SGIX_hyperpipe(load); + load_GLX_SGIX_pbuffer(load); + load_GLX_SGIX_swap_barrier(load); + load_GLX_SGIX_swap_group(load); + load_GLX_SGIX_video_resize(load); + load_GLX_SGIX_video_source(load); + load_GLX_SGI_cushion(load); + load_GLX_SGI_make_current_read(load); + load_GLX_SGI_swap_control(load); + load_GLX_SGI_video_sync(load); + load_GLX_SUN_get_transparent_index(load); return 1; } diff --git a/src/glad/glad_glx.h b/src/glad/glad_glx.h index c7ab1b78..6a6022c8 100644 --- a/src/glad/glad_glx.h +++ b/src/glad/glad_glx.h @@ -1,22 +1,89 @@ /* - GLX loader generated by glad 0.1.36 on Thu Sep 15 11:07:33 2022. + GLX loader generated by glad 0.1.36 on Sat Oct 8 13:52:35 2022. Language/Generator: C/C++ Specification: glx APIs: glx=1.4 Profile: - Extensions: - + GLX_3DFX_multisample, + GLX_AMD_gpu_association, + GLX_ARB_context_flush_control, + GLX_ARB_create_context, + GLX_ARB_create_context_no_error, + GLX_ARB_create_context_profile, + GLX_ARB_create_context_robustness, + GLX_ARB_fbconfig_float, + GLX_ARB_framebuffer_sRGB, + GLX_ARB_get_proc_address, + GLX_ARB_multisample, + GLX_ARB_robustness_application_isolation, + GLX_ARB_robustness_share_group_isolation, + GLX_ARB_vertex_buffer_object, + GLX_EXT_buffer_age, + GLX_EXT_context_priority, + GLX_EXT_create_context_es2_profile, + GLX_EXT_create_context_es_profile, + GLX_EXT_fbconfig_packed_float, + GLX_EXT_framebuffer_sRGB, + GLX_EXT_get_drawable_type, + GLX_EXT_import_context, + GLX_EXT_libglvnd, + GLX_EXT_no_config_context, + GLX_EXT_stereo_tree, + GLX_EXT_swap_control, + GLX_EXT_swap_control_tear, + GLX_EXT_texture_from_pixmap, + GLX_EXT_visual_info, + GLX_EXT_visual_rating, + GLX_INTEL_swap_event, + GLX_MESA_agp_offset, + GLX_MESA_copy_sub_buffer, + GLX_MESA_pixmap_colormap, + GLX_MESA_query_renderer, + GLX_MESA_release_buffers, + GLX_MESA_set_3dfx_mode, + GLX_MESA_swap_control, + GLX_NV_copy_buffer, + GLX_NV_copy_image, + GLX_NV_delay_before_swap, + GLX_NV_float_buffer, + GLX_NV_multigpu_context, + GLX_NV_multisample_coverage, + GLX_NV_present_video, + GLX_NV_robustness_video_memory_purge, + GLX_NV_swap_group, + GLX_NV_video_capture, + GLX_NV_video_out, + GLX_OML_swap_method, + GLX_OML_sync_control, + GLX_SGIS_blended_overlay, + GLX_SGIS_multisample, + GLX_SGIS_shared_multisample, + GLX_SGIX_dmbuffer, + GLX_SGIX_fbconfig, + GLX_SGIX_hyperpipe, + GLX_SGIX_pbuffer, + GLX_SGIX_swap_barrier, + GLX_SGIX_swap_group, + GLX_SGIX_video_resize, + GLX_SGIX_video_source, + GLX_SGIX_visual_select_group, + GLX_SGI_cushion, + GLX_SGI_make_current_read, + GLX_SGI_swap_control, + GLX_SGI_video_sync, + GLX_SUN_get_transparent_index Loader: True Local files: True Omit khrplatform: False Reproducible: False Commandline: - --api="glx=1.4" --generator="c" --spec="glx" --local-files --extensions="" + --api="glx=1.4" --generator="c" --spec="glx" --local-files --extensions="GLX_3DFX_multisample,GLX_AMD_gpu_association,GLX_ARB_context_flush_control,GLX_ARB_create_context,GLX_ARB_create_context_no_error,GLX_ARB_create_context_profile,GLX_ARB_create_context_robustness,GLX_ARB_fbconfig_float,GLX_ARB_framebuffer_sRGB,GLX_ARB_get_proc_address,GLX_ARB_multisample,GLX_ARB_robustness_application_isolation,GLX_ARB_robustness_share_group_isolation,GLX_ARB_vertex_buffer_object,GLX_EXT_buffer_age,GLX_EXT_context_priority,GLX_EXT_create_context_es2_profile,GLX_EXT_create_context_es_profile,GLX_EXT_fbconfig_packed_float,GLX_EXT_framebuffer_sRGB,GLX_EXT_get_drawable_type,GLX_EXT_import_context,GLX_EXT_libglvnd,GLX_EXT_no_config_context,GLX_EXT_stereo_tree,GLX_EXT_swap_control,GLX_EXT_swap_control_tear,GLX_EXT_texture_from_pixmap,GLX_EXT_visual_info,GLX_EXT_visual_rating,GLX_INTEL_swap_event,GLX_MESA_agp_offset,GLX_MESA_copy_sub_buffer,GLX_MESA_pixmap_colormap,GLX_MESA_query_renderer,GLX_MESA_release_buffers,GLX_MESA_set_3dfx_mode,GLX_MESA_swap_control,GLX_NV_copy_buffer,GLX_NV_copy_image,GLX_NV_delay_before_swap,GLX_NV_float_buffer,GLX_NV_multigpu_context,GLX_NV_multisample_coverage,GLX_NV_present_video,GLX_NV_robustness_video_memory_purge,GLX_NV_swap_group,GLX_NV_video_capture,GLX_NV_video_out,GLX_OML_swap_method,GLX_OML_sync_control,GLX_SGIS_blended_overlay,GLX_SGIS_multisample,GLX_SGIS_shared_multisample,GLX_SGIX_dmbuffer,GLX_SGIX_fbconfig,GLX_SGIX_hyperpipe,GLX_SGIX_pbuffer,GLX_SGIX_swap_barrier,GLX_SGIX_swap_group,GLX_SGIX_video_resize,GLX_SGIX_video_source,GLX_SGIX_visual_select_group,GLX_SGI_cushion,GLX_SGI_make_current_read,GLX_SGI_swap_control,GLX_SGI_video_sync,GLX_SUN_get_transparent_index" Online: - https://glad.dav1d.de/#language=c&specification=glx&loader=on&api=glx%3D1.4 + Too many extensions */ @@ -427,6 +494,772 @@ typedef __GLXextFuncPtr (APIENTRYP PFNGLXGETPROCADDRESSPROC)(const GLubyte *proc GLAPI PFNGLXGETPROCADDRESSPROC glad_glXGetProcAddress; #define glXGetProcAddress glad_glXGetProcAddress #endif +#define GLX_SAMPLE_BUFFERS_3DFX 0x8050 +#define GLX_SAMPLES_3DFX 0x8051 +#define GLX_GPU_VENDOR_AMD 0x1F00 +#define GLX_GPU_RENDERER_STRING_AMD 0x1F01 +#define GLX_GPU_OPENGL_VERSION_STRING_AMD 0x1F02 +#define GLX_GPU_FASTEST_TARGET_GPUS_AMD 0x21A2 +#define GLX_GPU_RAM_AMD 0x21A3 +#define GLX_GPU_CLOCK_AMD 0x21A4 +#define GLX_GPU_NUM_PIPES_AMD 0x21A5 +#define GLX_GPU_NUM_SIMD_AMD 0x21A6 +#define GLX_GPU_NUM_RB_AMD 0x21A7 +#define GLX_GPU_NUM_SPI_AMD 0x21A8 +#define GLX_CONTEXT_RELEASE_BEHAVIOR_ARB 0x2097 +#define GLX_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB 0 +#define GLX_CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB 0x2098 +#define GLX_CONTEXT_DEBUG_BIT_ARB 0x00000001 +#define GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x00000002 +#define GLX_CONTEXT_MAJOR_VERSION_ARB 0x2091 +#define GLX_CONTEXT_MINOR_VERSION_ARB 0x2092 +#define GLX_CONTEXT_FLAGS_ARB 0x2094 +#define GLX_CONTEXT_OPENGL_NO_ERROR_ARB 0x31B3 +#define GLX_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001 +#define GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB 0x00000002 +#define GLX_CONTEXT_PROFILE_MASK_ARB 0x9126 +#define GLX_CONTEXT_ROBUST_ACCESS_BIT_ARB 0x00000004 +#define GLX_LOSE_CONTEXT_ON_RESET_ARB 0x8252 +#define GLX_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB 0x8256 +#define GLX_NO_RESET_NOTIFICATION_ARB 0x8261 +#define GLX_RGBA_FLOAT_TYPE_ARB 0x20B9 +#define GLX_RGBA_FLOAT_BIT_ARB 0x00000004 +#define GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB 0x20B2 +#define GLX_SAMPLE_BUFFERS_ARB 100000 +#define GLX_SAMPLES_ARB 100001 +#define GLX_CONTEXT_RESET_ISOLATION_BIT_ARB 0x00000008 +#define GLX_CONTEXT_ALLOW_BUFFER_BYTE_ORDER_MISMATCH_ARB 0x2095 +#define GLX_BACK_BUFFER_AGE_EXT 0x20F4 +#define GLX_CONTEXT_PRIORITY_LEVEL_EXT 0x3100 +#define GLX_CONTEXT_PRIORITY_HIGH_EXT 0x3101 +#define GLX_CONTEXT_PRIORITY_MEDIUM_EXT 0x3102 +#define GLX_CONTEXT_PRIORITY_LOW_EXT 0x3103 +#define GLX_CONTEXT_ES2_PROFILE_BIT_EXT 0x00000004 +#define GLX_CONTEXT_ES_PROFILE_BIT_EXT 0x00000004 +#define GLX_RGBA_UNSIGNED_FLOAT_TYPE_EXT 0x20B1 +#define GLX_RGBA_UNSIGNED_FLOAT_BIT_EXT 0x00000008 +#define GLX_FRAMEBUFFER_SRGB_CAPABLE_EXT 0x20B2 +#define GLX_SHARE_CONTEXT_EXT 0x800A +#define GLX_VISUAL_ID_EXT 0x800B +#define GLX_SCREEN_EXT 0x800C +#define GLX_VENDOR_NAMES_EXT 0x20F6 +#define GLX_STEREO_TREE_EXT 0x20F5 +#define GLX_STEREO_NOTIFY_MASK_EXT 0x00000001 +#define GLX_STEREO_NOTIFY_EXT 0x00000000 +#define GLX_SWAP_INTERVAL_EXT 0x20F1 +#define GLX_MAX_SWAP_INTERVAL_EXT 0x20F2 +#define GLX_LATE_SWAPS_TEAR_EXT 0x20F3 +#define GLX_TEXTURE_1D_BIT_EXT 0x00000001 +#define GLX_TEXTURE_2D_BIT_EXT 0x00000002 +#define GLX_TEXTURE_RECTANGLE_BIT_EXT 0x00000004 +#define GLX_BIND_TO_TEXTURE_RGB_EXT 0x20D0 +#define GLX_BIND_TO_TEXTURE_RGBA_EXT 0x20D1 +#define GLX_BIND_TO_MIPMAP_TEXTURE_EXT 0x20D2 +#define GLX_BIND_TO_TEXTURE_TARGETS_EXT 0x20D3 +#define GLX_Y_INVERTED_EXT 0x20D4 +#define GLX_TEXTURE_FORMAT_EXT 0x20D5 +#define GLX_TEXTURE_TARGET_EXT 0x20D6 +#define GLX_MIPMAP_TEXTURE_EXT 0x20D7 +#define GLX_TEXTURE_FORMAT_NONE_EXT 0x20D8 +#define GLX_TEXTURE_FORMAT_RGB_EXT 0x20D9 +#define GLX_TEXTURE_FORMAT_RGBA_EXT 0x20DA +#define GLX_TEXTURE_1D_EXT 0x20DB +#define GLX_TEXTURE_2D_EXT 0x20DC +#define GLX_TEXTURE_RECTANGLE_EXT 0x20DD +#define GLX_FRONT_LEFT_EXT 0x20DE +#define GLX_FRONT_RIGHT_EXT 0x20DF +#define GLX_BACK_LEFT_EXT 0x20E0 +#define GLX_BACK_RIGHT_EXT 0x20E1 +#define GLX_FRONT_EXT 0x20DE +#define GLX_BACK_EXT 0x20E0 +#define GLX_AUX0_EXT 0x20E2 +#define GLX_AUX1_EXT 0x20E3 +#define GLX_AUX2_EXT 0x20E4 +#define GLX_AUX3_EXT 0x20E5 +#define GLX_AUX4_EXT 0x20E6 +#define GLX_AUX5_EXT 0x20E7 +#define GLX_AUX6_EXT 0x20E8 +#define GLX_AUX7_EXT 0x20E9 +#define GLX_AUX8_EXT 0x20EA +#define GLX_AUX9_EXT 0x20EB +#define GLX_X_VISUAL_TYPE_EXT 0x22 +#define GLX_TRANSPARENT_TYPE_EXT 0x23 +#define GLX_TRANSPARENT_INDEX_VALUE_EXT 0x24 +#define GLX_TRANSPARENT_RED_VALUE_EXT 0x25 +#define GLX_TRANSPARENT_GREEN_VALUE_EXT 0x26 +#define GLX_TRANSPARENT_BLUE_VALUE_EXT 0x27 +#define GLX_TRANSPARENT_ALPHA_VALUE_EXT 0x28 +#define GLX_NONE_EXT 0x8000 +#define GLX_TRUE_COLOR_EXT 0x8002 +#define GLX_DIRECT_COLOR_EXT 0x8003 +#define GLX_PSEUDO_COLOR_EXT 0x8004 +#define GLX_STATIC_COLOR_EXT 0x8005 +#define GLX_GRAY_SCALE_EXT 0x8006 +#define GLX_STATIC_GRAY_EXT 0x8007 +#define GLX_TRANSPARENT_RGB_EXT 0x8008 +#define GLX_TRANSPARENT_INDEX_EXT 0x8009 +#define GLX_VISUAL_CAVEAT_EXT 0x20 +#define GLX_SLOW_VISUAL_EXT 0x8001 +#define GLX_NON_CONFORMANT_VISUAL_EXT 0x800D +#define GLX_BUFFER_SWAP_COMPLETE_INTEL_MASK 0x04000000 +#define GLX_EXCHANGE_COMPLETE_INTEL 0x8180 +#define GLX_COPY_COMPLETE_INTEL 0x8181 +#define GLX_FLIP_COMPLETE_INTEL 0x8182 +#define GLX_RENDERER_VENDOR_ID_MESA 0x8183 +#define GLX_RENDERER_DEVICE_ID_MESA 0x8184 +#define GLX_RENDERER_VERSION_MESA 0x8185 +#define GLX_RENDERER_ACCELERATED_MESA 0x8186 +#define GLX_RENDERER_VIDEO_MEMORY_MESA 0x8187 +#define GLX_RENDERER_UNIFIED_MEMORY_ARCHITECTURE_MESA 0x8188 +#define GLX_RENDERER_PREFERRED_PROFILE_MESA 0x8189 +#define GLX_RENDERER_OPENGL_CORE_PROFILE_VERSION_MESA 0x818A +#define GLX_RENDERER_OPENGL_COMPATIBILITY_PROFILE_VERSION_MESA 0x818B +#define GLX_RENDERER_OPENGL_ES_PROFILE_VERSION_MESA 0x818C +#define GLX_RENDERER_OPENGL_ES2_PROFILE_VERSION_MESA 0x818D +#define GLX_3DFX_WINDOW_MODE_MESA 0x1 +#define GLX_3DFX_FULLSCREEN_MODE_MESA 0x2 +#define GLX_FLOAT_COMPONENTS_NV 0x20B0 +#define GLX_CONTEXT_MULTIGPU_ATTRIB_NV 0x20AA +#define GLX_CONTEXT_MULTIGPU_ATTRIB_SINGLE_NV 0x20AB +#define GLX_CONTEXT_MULTIGPU_ATTRIB_AFR_NV 0x20AC +#define GLX_CONTEXT_MULTIGPU_ATTRIB_MULTICAST_NV 0x20AD +#define GLX_CONTEXT_MULTIGPU_ATTRIB_MULTI_DISPLAY_MULTICAST_NV 0x20AE +#define GLX_COVERAGE_SAMPLES_NV 100001 +#define GLX_COLOR_SAMPLES_NV 0x20B3 +#define GLX_NUM_VIDEO_SLOTS_NV 0x20F0 +#define GLX_GENERATE_RESET_ON_VIDEO_MEMORY_PURGE_NV 0x20F7 +#define GLX_DEVICE_ID_NV 0x20CD +#define GLX_UNIQUE_ID_NV 0x20CE +#define GLX_NUM_VIDEO_CAPTURE_SLOTS_NV 0x20CF +#define GLX_VIDEO_OUT_COLOR_NV 0x20C3 +#define GLX_VIDEO_OUT_ALPHA_NV 0x20C4 +#define GLX_VIDEO_OUT_DEPTH_NV 0x20C5 +#define GLX_VIDEO_OUT_COLOR_AND_ALPHA_NV 0x20C6 +#define GLX_VIDEO_OUT_COLOR_AND_DEPTH_NV 0x20C7 +#define GLX_VIDEO_OUT_FRAME_NV 0x20C8 +#define GLX_VIDEO_OUT_FIELD_1_NV 0x20C9 +#define GLX_VIDEO_OUT_FIELD_2_NV 0x20CA +#define GLX_VIDEO_OUT_STACKED_FIELDS_1_2_NV 0x20CB +#define GLX_VIDEO_OUT_STACKED_FIELDS_2_1_NV 0x20CC +#define GLX_SWAP_METHOD_OML 0x8060 +#define GLX_SWAP_EXCHANGE_OML 0x8061 +#define GLX_SWAP_COPY_OML 0x8062 +#define GLX_SWAP_UNDEFINED_OML 0x8063 +#define GLX_BLENDED_RGBA_SGIS 0x8025 +#define GLX_SAMPLE_BUFFERS_SGIS 100000 +#define GLX_SAMPLES_SGIS 100001 +#define GLX_MULTISAMPLE_SUB_RECT_WIDTH_SGIS 0x8026 +#define GLX_MULTISAMPLE_SUB_RECT_HEIGHT_SGIS 0x8027 +#define GLX_DIGITAL_MEDIA_PBUFFER_SGIX 0x8024 +#define GLX_WINDOW_BIT_SGIX 0x00000001 +#define GLX_PIXMAP_BIT_SGIX 0x00000002 +#define GLX_RGBA_BIT_SGIX 0x00000001 +#define GLX_COLOR_INDEX_BIT_SGIX 0x00000002 +#define GLX_DRAWABLE_TYPE_SGIX 0x8010 +#define GLX_RENDER_TYPE_SGIX 0x8011 +#define GLX_X_RENDERABLE_SGIX 0x8012 +#define GLX_FBCONFIG_ID_SGIX 0x8013 +#define GLX_RGBA_TYPE_SGIX 0x8014 +#define GLX_COLOR_INDEX_TYPE_SGIX 0x8015 +#define GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX 80 +#define GLX_BAD_HYPERPIPE_CONFIG_SGIX 91 +#define GLX_BAD_HYPERPIPE_SGIX 92 +#define GLX_HYPERPIPE_DISPLAY_PIPE_SGIX 0x00000001 +#define GLX_HYPERPIPE_RENDER_PIPE_SGIX 0x00000002 +#define GLX_PIPE_RECT_SGIX 0x00000001 +#define GLX_PIPE_RECT_LIMITS_SGIX 0x00000002 +#define GLX_HYPERPIPE_STEREO_SGIX 0x00000003 +#define GLX_HYPERPIPE_PIXEL_AVERAGE_SGIX 0x00000004 +#define GLX_HYPERPIPE_ID_SGIX 0x8030 +#define GLX_PBUFFER_BIT_SGIX 0x00000004 +#define GLX_BUFFER_CLOBBER_MASK_SGIX 0x08000000 +#define GLX_FRONT_LEFT_BUFFER_BIT_SGIX 0x00000001 +#define GLX_FRONT_RIGHT_BUFFER_BIT_SGIX 0x00000002 +#define GLX_BACK_LEFT_BUFFER_BIT_SGIX 0x00000004 +#define GLX_BACK_RIGHT_BUFFER_BIT_SGIX 0x00000008 +#define GLX_AUX_BUFFERS_BIT_SGIX 0x00000010 +#define GLX_DEPTH_BUFFER_BIT_SGIX 0x00000020 +#define GLX_STENCIL_BUFFER_BIT_SGIX 0x00000040 +#define GLX_ACCUM_BUFFER_BIT_SGIX 0x00000080 +#define GLX_SAMPLE_BUFFERS_BIT_SGIX 0x00000100 +#define GLX_MAX_PBUFFER_WIDTH_SGIX 0x8016 +#define GLX_MAX_PBUFFER_HEIGHT_SGIX 0x8017 +#define GLX_MAX_PBUFFER_PIXELS_SGIX 0x8018 +#define GLX_OPTIMAL_PBUFFER_WIDTH_SGIX 0x8019 +#define GLX_OPTIMAL_PBUFFER_HEIGHT_SGIX 0x801A +#define GLX_PRESERVED_CONTENTS_SGIX 0x801B +#define GLX_LARGEST_PBUFFER_SGIX 0x801C +#define GLX_WIDTH_SGIX 0x801D +#define GLX_HEIGHT_SGIX 0x801E +#define GLX_EVENT_MASK_SGIX 0x801F +#define GLX_DAMAGED_SGIX 0x8020 +#define GLX_SAVED_SGIX 0x8021 +#define GLX_WINDOW_SGIX 0x8022 +#define GLX_PBUFFER_SGIX 0x8023 +#define GLX_SYNC_FRAME_SGIX 0x00000000 +#define GLX_SYNC_SWAP_SGIX 0x00000001 +#define GLX_VISUAL_SELECT_GROUP_SGIX 0x8028 +#ifndef GLX_3DFX_multisample +#define GLX_3DFX_multisample 1 +GLAPI int GLAD_GLX_3DFX_multisample; +#endif +#ifndef GLX_AMD_gpu_association +#define GLX_AMD_gpu_association 1 +GLAPI int GLAD_GLX_AMD_gpu_association; +typedef unsigned int (APIENTRYP PFNGLXGETGPUIDSAMDPROC)(unsigned int maxCount, unsigned int *ids); +GLAPI PFNGLXGETGPUIDSAMDPROC glad_glXGetGPUIDsAMD; +#define glXGetGPUIDsAMD glad_glXGetGPUIDsAMD +typedef int (APIENTRYP PFNGLXGETGPUINFOAMDPROC)(unsigned int id, int property, GLenum dataType, unsigned int size, void *data); +GLAPI PFNGLXGETGPUINFOAMDPROC glad_glXGetGPUInfoAMD; +#define glXGetGPUInfoAMD glad_glXGetGPUInfoAMD +typedef unsigned int (APIENTRYP PFNGLXGETCONTEXTGPUIDAMDPROC)(GLXContext ctx); +GLAPI PFNGLXGETCONTEXTGPUIDAMDPROC glad_glXGetContextGPUIDAMD; +#define glXGetContextGPUIDAMD glad_glXGetContextGPUIDAMD +typedef GLXContext (APIENTRYP PFNGLXCREATEASSOCIATEDCONTEXTAMDPROC)(unsigned int id, GLXContext share_list); +GLAPI PFNGLXCREATEASSOCIATEDCONTEXTAMDPROC glad_glXCreateAssociatedContextAMD; +#define glXCreateAssociatedContextAMD glad_glXCreateAssociatedContextAMD +typedef GLXContext (APIENTRYP PFNGLXCREATEASSOCIATEDCONTEXTATTRIBSAMDPROC)(unsigned int id, GLXContext share_context, const int *attribList); +GLAPI PFNGLXCREATEASSOCIATEDCONTEXTATTRIBSAMDPROC glad_glXCreateAssociatedContextAttribsAMD; +#define glXCreateAssociatedContextAttribsAMD glad_glXCreateAssociatedContextAttribsAMD +typedef Bool (APIENTRYP PFNGLXDELETEASSOCIATEDCONTEXTAMDPROC)(GLXContext ctx); +GLAPI PFNGLXDELETEASSOCIATEDCONTEXTAMDPROC glad_glXDeleteAssociatedContextAMD; +#define glXDeleteAssociatedContextAMD glad_glXDeleteAssociatedContextAMD +typedef Bool (APIENTRYP PFNGLXMAKEASSOCIATEDCONTEXTCURRENTAMDPROC)(GLXContext ctx); +GLAPI PFNGLXMAKEASSOCIATEDCONTEXTCURRENTAMDPROC glad_glXMakeAssociatedContextCurrentAMD; +#define glXMakeAssociatedContextCurrentAMD glad_glXMakeAssociatedContextCurrentAMD +typedef GLXContext (APIENTRYP PFNGLXGETCURRENTASSOCIATEDCONTEXTAMDPROC)(void); +GLAPI PFNGLXGETCURRENTASSOCIATEDCONTEXTAMDPROC glad_glXGetCurrentAssociatedContextAMD; +#define glXGetCurrentAssociatedContextAMD glad_glXGetCurrentAssociatedContextAMD +typedef void (APIENTRYP PFNGLXBLITCONTEXTFRAMEBUFFERAMDPROC)(GLXContext dstCtx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); +GLAPI PFNGLXBLITCONTEXTFRAMEBUFFERAMDPROC glad_glXBlitContextFramebufferAMD; +#define glXBlitContextFramebufferAMD glad_glXBlitContextFramebufferAMD +#endif +#ifndef GLX_ARB_context_flush_control +#define GLX_ARB_context_flush_control 1 +GLAPI int GLAD_GLX_ARB_context_flush_control; +#endif +#ifndef GLX_ARB_create_context +#define GLX_ARB_create_context 1 +GLAPI int GLAD_GLX_ARB_create_context; +typedef GLXContext (APIENTRYP PFNGLXCREATECONTEXTATTRIBSARBPROC)(Display *dpy, GLXFBConfig config, GLXContext share_context, Bool direct, const int *attrib_list); +GLAPI PFNGLXCREATECONTEXTATTRIBSARBPROC glad_glXCreateContextAttribsARB; +#define glXCreateContextAttribsARB glad_glXCreateContextAttribsARB +#endif +#ifndef GLX_ARB_create_context_no_error +#define GLX_ARB_create_context_no_error 1 +GLAPI int GLAD_GLX_ARB_create_context_no_error; +#endif +#ifndef GLX_ARB_create_context_profile +#define GLX_ARB_create_context_profile 1 +GLAPI int GLAD_GLX_ARB_create_context_profile; +#endif +#ifndef GLX_ARB_create_context_robustness +#define GLX_ARB_create_context_robustness 1 +GLAPI int GLAD_GLX_ARB_create_context_robustness; +#endif +#ifndef GLX_ARB_fbconfig_float +#define GLX_ARB_fbconfig_float 1 +GLAPI int GLAD_GLX_ARB_fbconfig_float; +#endif +#ifndef GLX_ARB_framebuffer_sRGB +#define GLX_ARB_framebuffer_sRGB 1 +GLAPI int GLAD_GLX_ARB_framebuffer_sRGB; +#endif +#ifndef GLX_ARB_get_proc_address +#define GLX_ARB_get_proc_address 1 +GLAPI int GLAD_GLX_ARB_get_proc_address; +typedef __GLXextFuncPtr (APIENTRYP PFNGLXGETPROCADDRESSARBPROC)(const GLubyte *procName); +GLAPI PFNGLXGETPROCADDRESSARBPROC glad_glXGetProcAddressARB; +#define glXGetProcAddressARB glad_glXGetProcAddressARB +#endif +#ifndef GLX_ARB_multisample +#define GLX_ARB_multisample 1 +GLAPI int GLAD_GLX_ARB_multisample; +#endif +#ifndef GLX_ARB_robustness_application_isolation +#define GLX_ARB_robustness_application_isolation 1 +GLAPI int GLAD_GLX_ARB_robustness_application_isolation; +#endif +#ifndef GLX_ARB_robustness_share_group_isolation +#define GLX_ARB_robustness_share_group_isolation 1 +GLAPI int GLAD_GLX_ARB_robustness_share_group_isolation; +#endif +#ifndef GLX_ARB_vertex_buffer_object +#define GLX_ARB_vertex_buffer_object 1 +GLAPI int GLAD_GLX_ARB_vertex_buffer_object; +#endif +#ifndef GLX_EXT_buffer_age +#define GLX_EXT_buffer_age 1 +GLAPI int GLAD_GLX_EXT_buffer_age; +#endif +#ifndef GLX_EXT_context_priority +#define GLX_EXT_context_priority 1 +GLAPI int GLAD_GLX_EXT_context_priority; +#endif +#ifndef GLX_EXT_create_context_es2_profile +#define GLX_EXT_create_context_es2_profile 1 +GLAPI int GLAD_GLX_EXT_create_context_es2_profile; +#endif +#ifndef GLX_EXT_create_context_es_profile +#define GLX_EXT_create_context_es_profile 1 +GLAPI int GLAD_GLX_EXT_create_context_es_profile; +#endif +#ifndef GLX_EXT_fbconfig_packed_float +#define GLX_EXT_fbconfig_packed_float 1 +GLAPI int GLAD_GLX_EXT_fbconfig_packed_float; +#endif +#ifndef GLX_EXT_framebuffer_sRGB +#define GLX_EXT_framebuffer_sRGB 1 +GLAPI int GLAD_GLX_EXT_framebuffer_sRGB; +#endif +#ifndef GLX_EXT_get_drawable_type +#define GLX_EXT_get_drawable_type 1 +GLAPI int GLAD_GLX_EXT_get_drawable_type; +#endif +#ifndef GLX_EXT_import_context +#define GLX_EXT_import_context 1 +GLAPI int GLAD_GLX_EXT_import_context; +typedef Display * (APIENTRYP PFNGLXGETCURRENTDISPLAYEXTPROC)(void); +GLAPI PFNGLXGETCURRENTDISPLAYEXTPROC glad_glXGetCurrentDisplayEXT; +#define glXGetCurrentDisplayEXT glad_glXGetCurrentDisplayEXT +typedef int (APIENTRYP PFNGLXQUERYCONTEXTINFOEXTPROC)(Display *dpy, GLXContext context, int attribute, int *value); +GLAPI PFNGLXQUERYCONTEXTINFOEXTPROC glad_glXQueryContextInfoEXT; +#define glXQueryContextInfoEXT glad_glXQueryContextInfoEXT +typedef GLXContextID (APIENTRYP PFNGLXGETCONTEXTIDEXTPROC)(const GLXContext context); +GLAPI PFNGLXGETCONTEXTIDEXTPROC glad_glXGetContextIDEXT; +#define glXGetContextIDEXT glad_glXGetContextIDEXT +typedef GLXContext (APIENTRYP PFNGLXIMPORTCONTEXTEXTPROC)(Display *dpy, GLXContextID contextID); +GLAPI PFNGLXIMPORTCONTEXTEXTPROC glad_glXImportContextEXT; +#define glXImportContextEXT glad_glXImportContextEXT +typedef void (APIENTRYP PFNGLXFREECONTEXTEXTPROC)(Display *dpy, GLXContext context); +GLAPI PFNGLXFREECONTEXTEXTPROC glad_glXFreeContextEXT; +#define glXFreeContextEXT glad_glXFreeContextEXT +#endif +#ifndef GLX_EXT_libglvnd +#define GLX_EXT_libglvnd 1 +GLAPI int GLAD_GLX_EXT_libglvnd; +#endif +#ifndef GLX_EXT_no_config_context +#define GLX_EXT_no_config_context 1 +GLAPI int GLAD_GLX_EXT_no_config_context; +#endif +#ifndef GLX_EXT_stereo_tree +#define GLX_EXT_stereo_tree 1 +GLAPI int GLAD_GLX_EXT_stereo_tree; +#endif +#ifndef GLX_EXT_swap_control +#define GLX_EXT_swap_control 1 +GLAPI int GLAD_GLX_EXT_swap_control; +typedef void (APIENTRYP PFNGLXSWAPINTERVALEXTPROC)(Display *dpy, GLXDrawable drawable, int interval); +GLAPI PFNGLXSWAPINTERVALEXTPROC glad_glXSwapIntervalEXT; +#define glXSwapIntervalEXT glad_glXSwapIntervalEXT +#endif +#ifndef GLX_EXT_swap_control_tear +#define GLX_EXT_swap_control_tear 1 +GLAPI int GLAD_GLX_EXT_swap_control_tear; +#endif +#ifndef GLX_EXT_texture_from_pixmap +#define GLX_EXT_texture_from_pixmap 1 +GLAPI int GLAD_GLX_EXT_texture_from_pixmap; +typedef void (APIENTRYP PFNGLXBINDTEXIMAGEEXTPROC)(Display *dpy, GLXDrawable drawable, int buffer, const int *attrib_list); +GLAPI PFNGLXBINDTEXIMAGEEXTPROC glad_glXBindTexImageEXT; +#define glXBindTexImageEXT glad_glXBindTexImageEXT +typedef void (APIENTRYP PFNGLXRELEASETEXIMAGEEXTPROC)(Display *dpy, GLXDrawable drawable, int buffer); +GLAPI PFNGLXRELEASETEXIMAGEEXTPROC glad_glXReleaseTexImageEXT; +#define glXReleaseTexImageEXT glad_glXReleaseTexImageEXT +#endif +#ifndef GLX_EXT_visual_info +#define GLX_EXT_visual_info 1 +GLAPI int GLAD_GLX_EXT_visual_info; +#endif +#ifndef GLX_EXT_visual_rating +#define GLX_EXT_visual_rating 1 +GLAPI int GLAD_GLX_EXT_visual_rating; +#endif +#ifndef GLX_INTEL_swap_event +#define GLX_INTEL_swap_event 1 +GLAPI int GLAD_GLX_INTEL_swap_event; +#endif +#ifndef GLX_MESA_agp_offset +#define GLX_MESA_agp_offset 1 +GLAPI int GLAD_GLX_MESA_agp_offset; +typedef unsigned int (APIENTRYP PFNGLXGETAGPOFFSETMESAPROC)(const void *pointer); +GLAPI PFNGLXGETAGPOFFSETMESAPROC glad_glXGetAGPOffsetMESA; +#define glXGetAGPOffsetMESA glad_glXGetAGPOffsetMESA +#endif +#ifndef GLX_MESA_copy_sub_buffer +#define GLX_MESA_copy_sub_buffer 1 +GLAPI int GLAD_GLX_MESA_copy_sub_buffer; +typedef void (APIENTRYP PFNGLXCOPYSUBBUFFERMESAPROC)(Display *dpy, GLXDrawable drawable, int x, int y, int width, int height); +GLAPI PFNGLXCOPYSUBBUFFERMESAPROC glad_glXCopySubBufferMESA; +#define glXCopySubBufferMESA glad_glXCopySubBufferMESA +#endif +#ifndef GLX_MESA_pixmap_colormap +#define GLX_MESA_pixmap_colormap 1 +GLAPI int GLAD_GLX_MESA_pixmap_colormap; +typedef GLXPixmap (APIENTRYP PFNGLXCREATEGLXPIXMAPMESAPROC)(Display *dpy, XVisualInfo *visual, Pixmap pixmap, Colormap cmap); +GLAPI PFNGLXCREATEGLXPIXMAPMESAPROC glad_glXCreateGLXPixmapMESA; +#define glXCreateGLXPixmapMESA glad_glXCreateGLXPixmapMESA +#endif +#ifndef GLX_MESA_query_renderer +#define GLX_MESA_query_renderer 1 +GLAPI int GLAD_GLX_MESA_query_renderer; +typedef Bool (APIENTRYP PFNGLXQUERYCURRENTRENDERERINTEGERMESAPROC)(int attribute, unsigned int *value); +GLAPI PFNGLXQUERYCURRENTRENDERERINTEGERMESAPROC glad_glXQueryCurrentRendererIntegerMESA; +#define glXQueryCurrentRendererIntegerMESA glad_glXQueryCurrentRendererIntegerMESA +typedef const char * (APIENTRYP PFNGLXQUERYCURRENTRENDERERSTRINGMESAPROC)(int attribute); +GLAPI PFNGLXQUERYCURRENTRENDERERSTRINGMESAPROC glad_glXQueryCurrentRendererStringMESA; +#define glXQueryCurrentRendererStringMESA glad_glXQueryCurrentRendererStringMESA +typedef Bool (APIENTRYP PFNGLXQUERYRENDERERINTEGERMESAPROC)(Display *dpy, int screen, int renderer, int attribute, unsigned int *value); +GLAPI PFNGLXQUERYRENDERERINTEGERMESAPROC glad_glXQueryRendererIntegerMESA; +#define glXQueryRendererIntegerMESA glad_glXQueryRendererIntegerMESA +typedef const char * (APIENTRYP PFNGLXQUERYRENDERERSTRINGMESAPROC)(Display *dpy, int screen, int renderer, int attribute); +GLAPI PFNGLXQUERYRENDERERSTRINGMESAPROC glad_glXQueryRendererStringMESA; +#define glXQueryRendererStringMESA glad_glXQueryRendererStringMESA +#endif +#ifndef GLX_MESA_release_buffers +#define GLX_MESA_release_buffers 1 +GLAPI int GLAD_GLX_MESA_release_buffers; +typedef Bool (APIENTRYP PFNGLXRELEASEBUFFERSMESAPROC)(Display *dpy, GLXDrawable drawable); +GLAPI PFNGLXRELEASEBUFFERSMESAPROC glad_glXReleaseBuffersMESA; +#define glXReleaseBuffersMESA glad_glXReleaseBuffersMESA +#endif +#ifndef GLX_MESA_set_3dfx_mode +#define GLX_MESA_set_3dfx_mode 1 +GLAPI int GLAD_GLX_MESA_set_3dfx_mode; +typedef GLboolean (APIENTRYP PFNGLXSET3DFXMODEMESAPROC)(GLint mode); +GLAPI PFNGLXSET3DFXMODEMESAPROC glad_glXSet3DfxModeMESA; +#define glXSet3DfxModeMESA glad_glXSet3DfxModeMESA +#endif +#ifndef GLX_MESA_swap_control +#define GLX_MESA_swap_control 1 +GLAPI int GLAD_GLX_MESA_swap_control; +typedef int (APIENTRYP PFNGLXGETSWAPINTERVALMESAPROC)(void); +GLAPI PFNGLXGETSWAPINTERVALMESAPROC glad_glXGetSwapIntervalMESA; +#define glXGetSwapIntervalMESA glad_glXGetSwapIntervalMESA +typedef int (APIENTRYP PFNGLXSWAPINTERVALMESAPROC)(unsigned int interval); +GLAPI PFNGLXSWAPINTERVALMESAPROC glad_glXSwapIntervalMESA; +#define glXSwapIntervalMESA glad_glXSwapIntervalMESA +#endif +#ifndef GLX_NV_copy_buffer +#define GLX_NV_copy_buffer 1 +GLAPI int GLAD_GLX_NV_copy_buffer; +typedef void (APIENTRYP PFNGLXCOPYBUFFERSUBDATANVPROC)(Display *dpy, GLXContext readCtx, GLXContext writeCtx, GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); +GLAPI PFNGLXCOPYBUFFERSUBDATANVPROC glad_glXCopyBufferSubDataNV; +#define glXCopyBufferSubDataNV glad_glXCopyBufferSubDataNV +typedef void (APIENTRYP PFNGLXNAMEDCOPYBUFFERSUBDATANVPROC)(Display *dpy, GLXContext readCtx, GLXContext writeCtx, GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); +GLAPI PFNGLXNAMEDCOPYBUFFERSUBDATANVPROC glad_glXNamedCopyBufferSubDataNV; +#define glXNamedCopyBufferSubDataNV glad_glXNamedCopyBufferSubDataNV +#endif +#ifndef GLX_NV_copy_image +#define GLX_NV_copy_image 1 +GLAPI int GLAD_GLX_NV_copy_image; +typedef void (APIENTRYP PFNGLXCOPYIMAGESUBDATANVPROC)(Display *dpy, GLXContext srcCtx, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLXContext dstCtx, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth); +GLAPI PFNGLXCOPYIMAGESUBDATANVPROC glad_glXCopyImageSubDataNV; +#define glXCopyImageSubDataNV glad_glXCopyImageSubDataNV +#endif +#ifndef GLX_NV_delay_before_swap +#define GLX_NV_delay_before_swap 1 +GLAPI int GLAD_GLX_NV_delay_before_swap; +typedef Bool (APIENTRYP PFNGLXDELAYBEFORESWAPNVPROC)(Display *dpy, GLXDrawable drawable, GLfloat seconds); +GLAPI PFNGLXDELAYBEFORESWAPNVPROC glad_glXDelayBeforeSwapNV; +#define glXDelayBeforeSwapNV glad_glXDelayBeforeSwapNV +#endif +#ifndef GLX_NV_float_buffer +#define GLX_NV_float_buffer 1 +GLAPI int GLAD_GLX_NV_float_buffer; +#endif +#ifndef GLX_NV_multigpu_context +#define GLX_NV_multigpu_context 1 +GLAPI int GLAD_GLX_NV_multigpu_context; +#endif +#ifndef GLX_NV_multisample_coverage +#define GLX_NV_multisample_coverage 1 +GLAPI int GLAD_GLX_NV_multisample_coverage; +#endif +#ifndef GLX_NV_present_video +#define GLX_NV_present_video 1 +GLAPI int GLAD_GLX_NV_present_video; +typedef unsigned int * (APIENTRYP PFNGLXENUMERATEVIDEODEVICESNVPROC)(Display *dpy, int screen, int *nelements); +GLAPI PFNGLXENUMERATEVIDEODEVICESNVPROC glad_glXEnumerateVideoDevicesNV; +#define glXEnumerateVideoDevicesNV glad_glXEnumerateVideoDevicesNV +typedef int (APIENTRYP PFNGLXBINDVIDEODEVICENVPROC)(Display *dpy, unsigned int video_slot, unsigned int video_device, const int *attrib_list); +GLAPI PFNGLXBINDVIDEODEVICENVPROC glad_glXBindVideoDeviceNV; +#define glXBindVideoDeviceNV glad_glXBindVideoDeviceNV +#endif +#ifndef GLX_NV_robustness_video_memory_purge +#define GLX_NV_robustness_video_memory_purge 1 +GLAPI int GLAD_GLX_NV_robustness_video_memory_purge; +#endif +#ifndef GLX_NV_swap_group +#define GLX_NV_swap_group 1 +GLAPI int GLAD_GLX_NV_swap_group; +typedef Bool (APIENTRYP PFNGLXJOINSWAPGROUPNVPROC)(Display *dpy, GLXDrawable drawable, GLuint group); +GLAPI PFNGLXJOINSWAPGROUPNVPROC glad_glXJoinSwapGroupNV; +#define glXJoinSwapGroupNV glad_glXJoinSwapGroupNV +typedef Bool (APIENTRYP PFNGLXBINDSWAPBARRIERNVPROC)(Display *dpy, GLuint group, GLuint barrier); +GLAPI PFNGLXBINDSWAPBARRIERNVPROC glad_glXBindSwapBarrierNV; +#define glXBindSwapBarrierNV glad_glXBindSwapBarrierNV +typedef Bool (APIENTRYP PFNGLXQUERYSWAPGROUPNVPROC)(Display *dpy, GLXDrawable drawable, GLuint *group, GLuint *barrier); +GLAPI PFNGLXQUERYSWAPGROUPNVPROC glad_glXQuerySwapGroupNV; +#define glXQuerySwapGroupNV glad_glXQuerySwapGroupNV +typedef Bool (APIENTRYP PFNGLXQUERYMAXSWAPGROUPSNVPROC)(Display *dpy, int screen, GLuint *maxGroups, GLuint *maxBarriers); +GLAPI PFNGLXQUERYMAXSWAPGROUPSNVPROC glad_glXQueryMaxSwapGroupsNV; +#define glXQueryMaxSwapGroupsNV glad_glXQueryMaxSwapGroupsNV +typedef Bool (APIENTRYP PFNGLXQUERYFRAMECOUNTNVPROC)(Display *dpy, int screen, GLuint *count); +GLAPI PFNGLXQUERYFRAMECOUNTNVPROC glad_glXQueryFrameCountNV; +#define glXQueryFrameCountNV glad_glXQueryFrameCountNV +typedef Bool (APIENTRYP PFNGLXRESETFRAMECOUNTNVPROC)(Display *dpy, int screen); +GLAPI PFNGLXRESETFRAMECOUNTNVPROC glad_glXResetFrameCountNV; +#define glXResetFrameCountNV glad_glXResetFrameCountNV +#endif +#ifndef GLX_NV_video_capture +#define GLX_NV_video_capture 1 +GLAPI int GLAD_GLX_NV_video_capture; +typedef int (APIENTRYP PFNGLXBINDVIDEOCAPTUREDEVICENVPROC)(Display *dpy, unsigned int video_capture_slot, GLXVideoCaptureDeviceNV device); +GLAPI PFNGLXBINDVIDEOCAPTUREDEVICENVPROC glad_glXBindVideoCaptureDeviceNV; +#define glXBindVideoCaptureDeviceNV glad_glXBindVideoCaptureDeviceNV +typedef GLXVideoCaptureDeviceNV * (APIENTRYP PFNGLXENUMERATEVIDEOCAPTUREDEVICESNVPROC)(Display *dpy, int screen, int *nelements); +GLAPI PFNGLXENUMERATEVIDEOCAPTUREDEVICESNVPROC glad_glXEnumerateVideoCaptureDevicesNV; +#define glXEnumerateVideoCaptureDevicesNV glad_glXEnumerateVideoCaptureDevicesNV +typedef void (APIENTRYP PFNGLXLOCKVIDEOCAPTUREDEVICENVPROC)(Display *dpy, GLXVideoCaptureDeviceNV device); +GLAPI PFNGLXLOCKVIDEOCAPTUREDEVICENVPROC glad_glXLockVideoCaptureDeviceNV; +#define glXLockVideoCaptureDeviceNV glad_glXLockVideoCaptureDeviceNV +typedef int (APIENTRYP PFNGLXQUERYVIDEOCAPTUREDEVICENVPROC)(Display *dpy, GLXVideoCaptureDeviceNV device, int attribute, int *value); +GLAPI PFNGLXQUERYVIDEOCAPTUREDEVICENVPROC glad_glXQueryVideoCaptureDeviceNV; +#define glXQueryVideoCaptureDeviceNV glad_glXQueryVideoCaptureDeviceNV +typedef void (APIENTRYP PFNGLXRELEASEVIDEOCAPTUREDEVICENVPROC)(Display *dpy, GLXVideoCaptureDeviceNV device); +GLAPI PFNGLXRELEASEVIDEOCAPTUREDEVICENVPROC glad_glXReleaseVideoCaptureDeviceNV; +#define glXReleaseVideoCaptureDeviceNV glad_glXReleaseVideoCaptureDeviceNV +#endif +#ifndef GLX_NV_video_out +#define GLX_NV_video_out 1 +GLAPI int GLAD_GLX_NV_video_out; +typedef int (APIENTRYP PFNGLXGETVIDEODEVICENVPROC)(Display *dpy, int screen, int numVideoDevices, GLXVideoDeviceNV *pVideoDevice); +GLAPI PFNGLXGETVIDEODEVICENVPROC glad_glXGetVideoDeviceNV; +#define glXGetVideoDeviceNV glad_glXGetVideoDeviceNV +typedef int (APIENTRYP PFNGLXRELEASEVIDEODEVICENVPROC)(Display *dpy, int screen, GLXVideoDeviceNV VideoDevice); +GLAPI PFNGLXRELEASEVIDEODEVICENVPROC glad_glXReleaseVideoDeviceNV; +#define glXReleaseVideoDeviceNV glad_glXReleaseVideoDeviceNV +typedef int (APIENTRYP PFNGLXBINDVIDEOIMAGENVPROC)(Display *dpy, GLXVideoDeviceNV VideoDevice, GLXPbuffer pbuf, int iVideoBuffer); +GLAPI PFNGLXBINDVIDEOIMAGENVPROC glad_glXBindVideoImageNV; +#define glXBindVideoImageNV glad_glXBindVideoImageNV +typedef int (APIENTRYP PFNGLXRELEASEVIDEOIMAGENVPROC)(Display *dpy, GLXPbuffer pbuf); +GLAPI PFNGLXRELEASEVIDEOIMAGENVPROC glad_glXReleaseVideoImageNV; +#define glXReleaseVideoImageNV glad_glXReleaseVideoImageNV +typedef int (APIENTRYP PFNGLXSENDPBUFFERTOVIDEONVPROC)(Display *dpy, GLXPbuffer pbuf, int iBufferType, unsigned long *pulCounterPbuffer, GLboolean bBlock); +GLAPI PFNGLXSENDPBUFFERTOVIDEONVPROC glad_glXSendPbufferToVideoNV; +#define glXSendPbufferToVideoNV glad_glXSendPbufferToVideoNV +typedef int (APIENTRYP PFNGLXGETVIDEOINFONVPROC)(Display *dpy, int screen, GLXVideoDeviceNV VideoDevice, unsigned long *pulCounterOutputPbuffer, unsigned long *pulCounterOutputVideo); +GLAPI PFNGLXGETVIDEOINFONVPROC glad_glXGetVideoInfoNV; +#define glXGetVideoInfoNV glad_glXGetVideoInfoNV +#endif +#ifndef GLX_OML_swap_method +#define GLX_OML_swap_method 1 +GLAPI int GLAD_GLX_OML_swap_method; +#endif +#ifndef GLX_OML_sync_control +#define GLX_OML_sync_control 1 +GLAPI int GLAD_GLX_OML_sync_control; +typedef Bool (APIENTRYP PFNGLXGETSYNCVALUESOMLPROC)(Display *dpy, GLXDrawable drawable, int64_t *ust, int64_t *msc, int64_t *sbc); +GLAPI PFNGLXGETSYNCVALUESOMLPROC glad_glXGetSyncValuesOML; +#define glXGetSyncValuesOML glad_glXGetSyncValuesOML +typedef Bool (APIENTRYP PFNGLXGETMSCRATEOMLPROC)(Display *dpy, GLXDrawable drawable, int32_t *numerator, int32_t *denominator); +GLAPI PFNGLXGETMSCRATEOMLPROC glad_glXGetMscRateOML; +#define glXGetMscRateOML glad_glXGetMscRateOML +typedef int64_t (APIENTRYP PFNGLXSWAPBUFFERSMSCOMLPROC)(Display *dpy, GLXDrawable drawable, int64_t target_msc, int64_t divisor, int64_t remainder); +GLAPI PFNGLXSWAPBUFFERSMSCOMLPROC glad_glXSwapBuffersMscOML; +#define glXSwapBuffersMscOML glad_glXSwapBuffersMscOML +typedef Bool (APIENTRYP PFNGLXWAITFORMSCOMLPROC)(Display *dpy, GLXDrawable drawable, int64_t target_msc, int64_t divisor, int64_t remainder, int64_t *ust, int64_t *msc, int64_t *sbc); +GLAPI PFNGLXWAITFORMSCOMLPROC glad_glXWaitForMscOML; +#define glXWaitForMscOML glad_glXWaitForMscOML +typedef Bool (APIENTRYP PFNGLXWAITFORSBCOMLPROC)(Display *dpy, GLXDrawable drawable, int64_t target_sbc, int64_t *ust, int64_t *msc, int64_t *sbc); +GLAPI PFNGLXWAITFORSBCOMLPROC glad_glXWaitForSbcOML; +#define glXWaitForSbcOML glad_glXWaitForSbcOML +#endif +#ifndef GLX_SGIS_blended_overlay +#define GLX_SGIS_blended_overlay 1 +GLAPI int GLAD_GLX_SGIS_blended_overlay; +#endif +#ifndef GLX_SGIS_multisample +#define GLX_SGIS_multisample 1 +GLAPI int GLAD_GLX_SGIS_multisample; +#endif +#ifndef GLX_SGIS_shared_multisample +#define GLX_SGIS_shared_multisample 1 +GLAPI int GLAD_GLX_SGIS_shared_multisample; +#endif +#ifndef GLX_SGIX_dmbuffer +#define GLX_SGIX_dmbuffer 1 +GLAPI int GLAD_GLX_SGIX_dmbuffer; +#ifdef _DM_BUFFER_H_ +typedef Bool (APIENTRYP PFNGLXASSOCIATEDMPBUFFERSGIXPROC)(Display *dpy, GLXPbufferSGIX pbuffer, DMparams *params, DMbuffer dmbuffer); +GLAPI PFNGLXASSOCIATEDMPBUFFERSGIXPROC glad_glXAssociateDMPbufferSGIX; +#define glXAssociateDMPbufferSGIX glad_glXAssociateDMPbufferSGIX +#endif +#endif +#ifndef GLX_SGIX_fbconfig +#define GLX_SGIX_fbconfig 1 +GLAPI int GLAD_GLX_SGIX_fbconfig; +typedef int (APIENTRYP PFNGLXGETFBCONFIGATTRIBSGIXPROC)(Display *dpy, GLXFBConfigSGIX config, int attribute, int *value); +GLAPI PFNGLXGETFBCONFIGATTRIBSGIXPROC glad_glXGetFBConfigAttribSGIX; +#define glXGetFBConfigAttribSGIX glad_glXGetFBConfigAttribSGIX +typedef GLXFBConfigSGIX * (APIENTRYP PFNGLXCHOOSEFBCONFIGSGIXPROC)(Display *dpy, int screen, int *attrib_list, int *nelements); +GLAPI PFNGLXCHOOSEFBCONFIGSGIXPROC glad_glXChooseFBConfigSGIX; +#define glXChooseFBConfigSGIX glad_glXChooseFBConfigSGIX +typedef GLXPixmap (APIENTRYP PFNGLXCREATEGLXPIXMAPWITHCONFIGSGIXPROC)(Display *dpy, GLXFBConfigSGIX config, Pixmap pixmap); +GLAPI PFNGLXCREATEGLXPIXMAPWITHCONFIGSGIXPROC glad_glXCreateGLXPixmapWithConfigSGIX; +#define glXCreateGLXPixmapWithConfigSGIX glad_glXCreateGLXPixmapWithConfigSGIX +typedef GLXContext (APIENTRYP PFNGLXCREATECONTEXTWITHCONFIGSGIXPROC)(Display *dpy, GLXFBConfigSGIX config, int render_type, GLXContext share_list, Bool direct); +GLAPI PFNGLXCREATECONTEXTWITHCONFIGSGIXPROC glad_glXCreateContextWithConfigSGIX; +#define glXCreateContextWithConfigSGIX glad_glXCreateContextWithConfigSGIX +typedef XVisualInfo * (APIENTRYP PFNGLXGETVISUALFROMFBCONFIGSGIXPROC)(Display *dpy, GLXFBConfigSGIX config); +GLAPI PFNGLXGETVISUALFROMFBCONFIGSGIXPROC glad_glXGetVisualFromFBConfigSGIX; +#define glXGetVisualFromFBConfigSGIX glad_glXGetVisualFromFBConfigSGIX +typedef GLXFBConfigSGIX (APIENTRYP PFNGLXGETFBCONFIGFROMVISUALSGIXPROC)(Display *dpy, XVisualInfo *vis); +GLAPI PFNGLXGETFBCONFIGFROMVISUALSGIXPROC glad_glXGetFBConfigFromVisualSGIX; +#define glXGetFBConfigFromVisualSGIX glad_glXGetFBConfigFromVisualSGIX +#endif +#ifndef GLX_SGIX_hyperpipe +#define GLX_SGIX_hyperpipe 1 +GLAPI int GLAD_GLX_SGIX_hyperpipe; +typedef GLXHyperpipeNetworkSGIX * (APIENTRYP PFNGLXQUERYHYPERPIPENETWORKSGIXPROC)(Display *dpy, int *npipes); +GLAPI PFNGLXQUERYHYPERPIPENETWORKSGIXPROC glad_glXQueryHyperpipeNetworkSGIX; +#define glXQueryHyperpipeNetworkSGIX glad_glXQueryHyperpipeNetworkSGIX +typedef int (APIENTRYP PFNGLXHYPERPIPECONFIGSGIXPROC)(Display *dpy, int networkId, int npipes, GLXHyperpipeConfigSGIX *cfg, int *hpId); +GLAPI PFNGLXHYPERPIPECONFIGSGIXPROC glad_glXHyperpipeConfigSGIX; +#define glXHyperpipeConfigSGIX glad_glXHyperpipeConfigSGIX +typedef GLXHyperpipeConfigSGIX * (APIENTRYP PFNGLXQUERYHYPERPIPECONFIGSGIXPROC)(Display *dpy, int hpId, int *npipes); +GLAPI PFNGLXQUERYHYPERPIPECONFIGSGIXPROC glad_glXQueryHyperpipeConfigSGIX; +#define glXQueryHyperpipeConfigSGIX glad_glXQueryHyperpipeConfigSGIX +typedef int (APIENTRYP PFNGLXDESTROYHYPERPIPECONFIGSGIXPROC)(Display *dpy, int hpId); +GLAPI PFNGLXDESTROYHYPERPIPECONFIGSGIXPROC glad_glXDestroyHyperpipeConfigSGIX; +#define glXDestroyHyperpipeConfigSGIX glad_glXDestroyHyperpipeConfigSGIX +typedef int (APIENTRYP PFNGLXBINDHYPERPIPESGIXPROC)(Display *dpy, int hpId); +GLAPI PFNGLXBINDHYPERPIPESGIXPROC glad_glXBindHyperpipeSGIX; +#define glXBindHyperpipeSGIX glad_glXBindHyperpipeSGIX +typedef int (APIENTRYP PFNGLXQUERYHYPERPIPEBESTATTRIBSGIXPROC)(Display *dpy, int timeSlice, int attrib, int size, void *attribList, void *returnAttribList); +GLAPI PFNGLXQUERYHYPERPIPEBESTATTRIBSGIXPROC glad_glXQueryHyperpipeBestAttribSGIX; +#define glXQueryHyperpipeBestAttribSGIX glad_glXQueryHyperpipeBestAttribSGIX +typedef int (APIENTRYP PFNGLXHYPERPIPEATTRIBSGIXPROC)(Display *dpy, int timeSlice, int attrib, int size, void *attribList); +GLAPI PFNGLXHYPERPIPEATTRIBSGIXPROC glad_glXHyperpipeAttribSGIX; +#define glXHyperpipeAttribSGIX glad_glXHyperpipeAttribSGIX +typedef int (APIENTRYP PFNGLXQUERYHYPERPIPEATTRIBSGIXPROC)(Display *dpy, int timeSlice, int attrib, int size, void *returnAttribList); +GLAPI PFNGLXQUERYHYPERPIPEATTRIBSGIXPROC glad_glXQueryHyperpipeAttribSGIX; +#define glXQueryHyperpipeAttribSGIX glad_glXQueryHyperpipeAttribSGIX +#endif +#ifndef GLX_SGIX_pbuffer +#define GLX_SGIX_pbuffer 1 +GLAPI int GLAD_GLX_SGIX_pbuffer; +typedef GLXPbufferSGIX (APIENTRYP PFNGLXCREATEGLXPBUFFERSGIXPROC)(Display *dpy, GLXFBConfigSGIX config, unsigned int width, unsigned int height, int *attrib_list); +GLAPI PFNGLXCREATEGLXPBUFFERSGIXPROC glad_glXCreateGLXPbufferSGIX; +#define glXCreateGLXPbufferSGIX glad_glXCreateGLXPbufferSGIX +typedef void (APIENTRYP PFNGLXDESTROYGLXPBUFFERSGIXPROC)(Display *dpy, GLXPbufferSGIX pbuf); +GLAPI PFNGLXDESTROYGLXPBUFFERSGIXPROC glad_glXDestroyGLXPbufferSGIX; +#define glXDestroyGLXPbufferSGIX glad_glXDestroyGLXPbufferSGIX +typedef void (APIENTRYP PFNGLXQUERYGLXPBUFFERSGIXPROC)(Display *dpy, GLXPbufferSGIX pbuf, int attribute, unsigned int *value); +GLAPI PFNGLXQUERYGLXPBUFFERSGIXPROC glad_glXQueryGLXPbufferSGIX; +#define glXQueryGLXPbufferSGIX glad_glXQueryGLXPbufferSGIX +typedef void (APIENTRYP PFNGLXSELECTEVENTSGIXPROC)(Display *dpy, GLXDrawable drawable, unsigned long mask); +GLAPI PFNGLXSELECTEVENTSGIXPROC glad_glXSelectEventSGIX; +#define glXSelectEventSGIX glad_glXSelectEventSGIX +typedef void (APIENTRYP PFNGLXGETSELECTEDEVENTSGIXPROC)(Display *dpy, GLXDrawable drawable, unsigned long *mask); +GLAPI PFNGLXGETSELECTEDEVENTSGIXPROC glad_glXGetSelectedEventSGIX; +#define glXGetSelectedEventSGIX glad_glXGetSelectedEventSGIX +#endif +#ifndef GLX_SGIX_swap_barrier +#define GLX_SGIX_swap_barrier 1 +GLAPI int GLAD_GLX_SGIX_swap_barrier; +typedef void (APIENTRYP PFNGLXBINDSWAPBARRIERSGIXPROC)(Display *dpy, GLXDrawable drawable, int barrier); +GLAPI PFNGLXBINDSWAPBARRIERSGIXPROC glad_glXBindSwapBarrierSGIX; +#define glXBindSwapBarrierSGIX glad_glXBindSwapBarrierSGIX +typedef Bool (APIENTRYP PFNGLXQUERYMAXSWAPBARRIERSSGIXPROC)(Display *dpy, int screen, int *max); +GLAPI PFNGLXQUERYMAXSWAPBARRIERSSGIXPROC glad_glXQueryMaxSwapBarriersSGIX; +#define glXQueryMaxSwapBarriersSGIX glad_glXQueryMaxSwapBarriersSGIX +#endif +#ifndef GLX_SGIX_swap_group +#define GLX_SGIX_swap_group 1 +GLAPI int GLAD_GLX_SGIX_swap_group; +typedef void (APIENTRYP PFNGLXJOINSWAPGROUPSGIXPROC)(Display *dpy, GLXDrawable drawable, GLXDrawable member); +GLAPI PFNGLXJOINSWAPGROUPSGIXPROC glad_glXJoinSwapGroupSGIX; +#define glXJoinSwapGroupSGIX glad_glXJoinSwapGroupSGIX +#endif +#ifndef GLX_SGIX_video_resize +#define GLX_SGIX_video_resize 1 +GLAPI int GLAD_GLX_SGIX_video_resize; +typedef int (APIENTRYP PFNGLXBINDCHANNELTOWINDOWSGIXPROC)(Display *display, int screen, int channel, Window window); +GLAPI PFNGLXBINDCHANNELTOWINDOWSGIXPROC glad_glXBindChannelToWindowSGIX; +#define glXBindChannelToWindowSGIX glad_glXBindChannelToWindowSGIX +typedef int (APIENTRYP PFNGLXCHANNELRECTSGIXPROC)(Display *display, int screen, int channel, int x, int y, int w, int h); +GLAPI PFNGLXCHANNELRECTSGIXPROC glad_glXChannelRectSGIX; +#define glXChannelRectSGIX glad_glXChannelRectSGIX +typedef int (APIENTRYP PFNGLXQUERYCHANNELRECTSGIXPROC)(Display *display, int screen, int channel, int *dx, int *dy, int *dw, int *dh); +GLAPI PFNGLXQUERYCHANNELRECTSGIXPROC glad_glXQueryChannelRectSGIX; +#define glXQueryChannelRectSGIX glad_glXQueryChannelRectSGIX +typedef int (APIENTRYP PFNGLXQUERYCHANNELDELTASSGIXPROC)(Display *display, int screen, int channel, int *x, int *y, int *w, int *h); +GLAPI PFNGLXQUERYCHANNELDELTASSGIXPROC glad_glXQueryChannelDeltasSGIX; +#define glXQueryChannelDeltasSGIX glad_glXQueryChannelDeltasSGIX +typedef int (APIENTRYP PFNGLXCHANNELRECTSYNCSGIXPROC)(Display *display, int screen, int channel, GLenum synctype); +GLAPI PFNGLXCHANNELRECTSYNCSGIXPROC glad_glXChannelRectSyncSGIX; +#define glXChannelRectSyncSGIX glad_glXChannelRectSyncSGIX +#endif +#ifndef GLX_SGIX_video_source +#define GLX_SGIX_video_source 1 +GLAPI int GLAD_GLX_SGIX_video_source; +#ifdef _VL_H_ +typedef GLXVideoSourceSGIX (APIENTRYP PFNGLXCREATEGLXVIDEOSOURCESGIXPROC)(Display *display, int screen, VLServer server, VLPath path, int nodeClass, VLNode drainNode); +GLAPI PFNGLXCREATEGLXVIDEOSOURCESGIXPROC glad_glXCreateGLXVideoSourceSGIX; +#define glXCreateGLXVideoSourceSGIX glad_glXCreateGLXVideoSourceSGIX +typedef void (APIENTRYP PFNGLXDESTROYGLXVIDEOSOURCESGIXPROC)(Display *dpy, GLXVideoSourceSGIX glxvideosource); +GLAPI PFNGLXDESTROYGLXVIDEOSOURCESGIXPROC glad_glXDestroyGLXVideoSourceSGIX; +#define glXDestroyGLXVideoSourceSGIX glad_glXDestroyGLXVideoSourceSGIX +#endif +#endif +#ifndef GLX_SGIX_visual_select_group +#define GLX_SGIX_visual_select_group 1 +GLAPI int GLAD_GLX_SGIX_visual_select_group; +#endif +#ifndef GLX_SGI_cushion +#define GLX_SGI_cushion 1 +GLAPI int GLAD_GLX_SGI_cushion; +typedef void (APIENTRYP PFNGLXCUSHIONSGIPROC)(Display *dpy, Window window, float cushion); +GLAPI PFNGLXCUSHIONSGIPROC glad_glXCushionSGI; +#define glXCushionSGI glad_glXCushionSGI +#endif +#ifndef GLX_SGI_make_current_read +#define GLX_SGI_make_current_read 1 +GLAPI int GLAD_GLX_SGI_make_current_read; +typedef Bool (APIENTRYP PFNGLXMAKECURRENTREADSGIPROC)(Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx); +GLAPI PFNGLXMAKECURRENTREADSGIPROC glad_glXMakeCurrentReadSGI; +#define glXMakeCurrentReadSGI glad_glXMakeCurrentReadSGI +typedef GLXDrawable (APIENTRYP PFNGLXGETCURRENTREADDRAWABLESGIPROC)(void); +GLAPI PFNGLXGETCURRENTREADDRAWABLESGIPROC glad_glXGetCurrentReadDrawableSGI; +#define glXGetCurrentReadDrawableSGI glad_glXGetCurrentReadDrawableSGI +#endif +#ifndef GLX_SGI_swap_control +#define GLX_SGI_swap_control 1 +GLAPI int GLAD_GLX_SGI_swap_control; +typedef int (APIENTRYP PFNGLXSWAPINTERVALSGIPROC)(int interval); +GLAPI PFNGLXSWAPINTERVALSGIPROC glad_glXSwapIntervalSGI; +#define glXSwapIntervalSGI glad_glXSwapIntervalSGI +#endif +#ifndef GLX_SGI_video_sync +#define GLX_SGI_video_sync 1 +GLAPI int GLAD_GLX_SGI_video_sync; +typedef int (APIENTRYP PFNGLXGETVIDEOSYNCSGIPROC)(unsigned int *count); +GLAPI PFNGLXGETVIDEOSYNCSGIPROC glad_glXGetVideoSyncSGI; +#define glXGetVideoSyncSGI glad_glXGetVideoSyncSGI +typedef int (APIENTRYP PFNGLXWAITVIDEOSYNCSGIPROC)(int divisor, int remainder, unsigned int *count); +GLAPI PFNGLXWAITVIDEOSYNCSGIPROC glad_glXWaitVideoSyncSGI; +#define glXWaitVideoSyncSGI glad_glXWaitVideoSyncSGI +#endif +#ifndef GLX_SUN_get_transparent_index +#define GLX_SUN_get_transparent_index 1 +GLAPI int GLAD_GLX_SUN_get_transparent_index; +typedef Status (APIENTRYP PFNGLXGETTRANSPARENTINDEXSUNPROC)(Display *dpy, Window overlay, Window underlay, unsigned long *pTransparentIndex); +GLAPI PFNGLXGETTRANSPARENTINDEXSUNPROC glad_glXGetTransparentIndexSUN; +#define glXGetTransparentIndexSUN glad_glXGetTransparentIndexSUN +#endif #ifdef __cplusplus }