externals: Upgrade glad to latest version

* Also change some mentions to OpenGL 3.3 to 4.3
This commit is contained in:
emufan4568 2022-08-22 23:43:49 +03:00
parent 7bcf753a21
commit 12f84e18dc
9 changed files with 1682 additions and 24459 deletions

View File

@ -90,12 +90,20 @@
* int arg2) KHRONOS_APIATTRIBUTES; * int arg2) KHRONOS_APIATTRIBUTES;
*/ */
#if defined(__SCITECH_SNAP__) && !defined(KHRONOS_STATIC)
# define KHRONOS_STATIC 1
#endif
/*------------------------------------------------------------------------- /*-------------------------------------------------------------------------
* Definition of KHRONOS_APICALL * Definition of KHRONOS_APICALL
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
* This precedes the return type of the function in the function prototype. * This precedes the return type of the function in the function prototype.
*/ */
#if defined(_WIN32) && !defined(__SCITECH_SNAP__) #if defined(KHRONOS_STATIC)
/* If the preprocessor constant KHRONOS_STATIC is defined, make the
* header compatible with static linking. */
# define KHRONOS_APICALL
#elif defined(_WIN32)
# define KHRONOS_APICALL __declspec(dllimport) # define KHRONOS_APICALL __declspec(dllimport)
#elif defined (__SYMBIAN32__) #elif defined (__SYMBIAN32__)
# define KHRONOS_APICALL IMPORT_C # define KHRONOS_APICALL IMPORT_C
@ -145,6 +153,20 @@ typedef int64_t khronos_int64_t;
typedef uint64_t khronos_uint64_t; typedef uint64_t khronos_uint64_t;
#define KHRONOS_SUPPORT_INT64 1 #define KHRONOS_SUPPORT_INT64 1
#define KHRONOS_SUPPORT_FLOAT 1 #define KHRONOS_SUPPORT_FLOAT 1
/*
* To support platform where unsigned long cannot be used interchangeably with
* inptr_t (e.g. CHERI-extended ISAs), we can use the stdint.h intptr_t.
* Ideally, we could just use (u)intptr_t everywhere, but this could result in
* ABI breakage if khronos_uintptr_t is changed from unsigned long to
* unsigned long long or similar (this results in different C++ name mangling).
* To avoid changes for existing platforms, we restrict usage of intptr_t to
* platforms where the size of a pointer is larger than the size of long.
*/
#if defined(__SIZEOF_LONG__) && defined(__SIZEOF_POINTER__)
#if __SIZEOF_POINTER__ > __SIZEOF_LONG__
#define KHRONOS_USE_INTPTR_T
#endif
#endif
#elif defined(__VMS ) || defined(__sgi) #elif defined(__VMS ) || defined(__sgi)
@ -227,14 +249,21 @@ typedef unsigned short int khronos_uint16_t;
* pointers are 64 bits, but 'long' is still 32 bits. Win64 appears * pointers are 64 bits, but 'long' is still 32 bits. Win64 appears
* to be the only LLP64 architecture in current use. * to be the only LLP64 architecture in current use.
*/ */
#ifdef _WIN64 #ifdef KHRONOS_USE_INTPTR_T
typedef intptr_t khronos_intptr_t;
typedef uintptr_t khronos_uintptr_t;
#elif defined(_WIN64)
typedef signed long long int khronos_intptr_t; typedef signed long long int khronos_intptr_t;
typedef unsigned long long int khronos_uintptr_t; typedef unsigned long long int khronos_uintptr_t;
typedef signed long long int khronos_ssize_t;
typedef unsigned long long int khronos_usize_t;
#else #else
typedef signed long int khronos_intptr_t; typedef signed long int khronos_intptr_t;
typedef unsigned long int khronos_uintptr_t; typedef unsigned long int khronos_uintptr_t;
#endif
#if defined(_WIN64)
typedef signed long long int khronos_ssize_t;
typedef unsigned long long int khronos_usize_t;
#else
typedef signed long int khronos_ssize_t; typedef signed long int khronos_ssize_t;
typedef unsigned long int khronos_usize_t; typedef unsigned long int khronos_usize_t;
#endif #endif

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -11,7 +11,7 @@
#include <QFutureWatcher> #include <QFutureWatcher>
#include <QLabel> #include <QLabel>
#include <QMessageBox> #include <QMessageBox>
#include <QOpenGLFunctions_3_3_Core> #include <QOpenGLFunctions_4_3_Core>
#include <QSysInfo> #include <QSysInfo>
#include <QtConcurrent/QtConcurrentRun> #include <QtConcurrent/QtConcurrentRun>
#include <QtGui> #include <QtGui>
@ -916,11 +916,11 @@ bool GMainWindow::LoadROM(const QString& filename) {
Frontend::ScopeAcquireContext scope(*render_window); Frontend::ScopeAcquireContext scope(*render_window);
const QString below_gl33_title = tr("OpenGL 3.3 Unsupported"); const QString below_gl33_title = tr("OpenGL 4.3 Unsupported");
const QString below_gl33_message = tr("Your GPU may not support OpenGL 3.3, or you do not " const QString below_gl33_message = tr("Your GPU may not support OpenGL 4.3, or you do not "
"have the latest graphics driver."); "have the latest graphics driver.");
if (!QOpenGLContext::globalShareContext()->versionFunctions<QOpenGLFunctions_3_3_Core>()) { if (!QOpenGLContext::globalShareContext()->versionFunctions<QOpenGLFunctions_4_3_Core>()) {
QMessageBox::critical(this, below_gl33_title, below_gl33_message); QMessageBox::critical(this, below_gl33_title, below_gl33_message);
return false; return false;
} }

View File

@ -422,7 +422,7 @@ System::ResultStatus System::Init(Frontend::EmuWindow& emu_window, u32 system_mo
switch (result) { switch (result) {
case VideoCore::ResultStatus::ErrorGenericDrivers: case VideoCore::ResultStatus::ErrorGenericDrivers:
return ResultStatus::ErrorVideoCore_ErrorGenericDrivers; return ResultStatus::ErrorVideoCore_ErrorGenericDrivers;
case VideoCore::ResultStatus::ErrorBelowGL33: case VideoCore::ResultStatus::ErrorBelowGL43:
return ResultStatus::ErrorVideoCore_ErrorBelowGL33; return ResultStatus::ErrorVideoCore_ErrorBelowGL33;
default: default:
return ResultStatus::ErrorVideoCore; return ResultStatus::ErrorVideoCore;

View File

@ -462,12 +462,6 @@ void ShaderProgramManager::ApplyTo(OpenGLState& state) {
void ShaderProgramManager::LoadDiskCache(const std::atomic_bool& stop_loading, void ShaderProgramManager::LoadDiskCache(const std::atomic_bool& stop_loading,
const VideoCore::DiskResourceLoadCallback& callback) { const VideoCore::DiskResourceLoadCallback& callback) {
if (!GLAD_GL_ARB_get_program_binary && !GLES) {
LOG_ERROR(Render_OpenGL,
"Cannot load disk cache as ARB_get_program_binary is not supported!");
return;
}
auto& disk_cache = impl->disk_cache; auto& disk_cache = impl->disk_cache;
const auto transferable = disk_cache.LoadTransferable(); const auto transferable = disk_cache.LoadTransferable();
if (!transferable) { if (!transferable) {

View File

@ -1234,7 +1234,7 @@ static void APIENTRY DebugHandler(GLenum source, GLenum type, GLuint id, GLenum
VideoCore::ResultStatus RendererOpenGL::Init() { VideoCore::ResultStatus RendererOpenGL::Init() {
#ifndef ANDROID #ifndef ANDROID
if (!gladLoadGL()) { if (!gladLoadGL()) {
return VideoCore::ResultStatus::ErrorBelowGL33; return VideoCore::ResultStatus::ErrorBelowGL43;
} }
// Qualcomm has some spammy info messages that are marked as errors but not important // Qualcomm has some spammy info messages that are marked as errors but not important
@ -1245,9 +1245,9 @@ VideoCore::ResultStatus RendererOpenGL::Init() {
} }
#endif #endif
const char* gl_version{reinterpret_cast<char const*>(glGetString(GL_VERSION))}; const std::string_view gl_version{reinterpret_cast<char const*>(glGetString(GL_VERSION))};
const char* gpu_vendor{reinterpret_cast<char const*>(glGetString(GL_VENDOR))}; const std::string_view gpu_vendor{reinterpret_cast<char const*>(glGetString(GL_VENDOR))};
const char* gpu_model{reinterpret_cast<char const*>(glGetString(GL_RENDERER))}; const std::string_view gpu_model{reinterpret_cast<char const*>(glGetString(GL_RENDERER))};
LOG_INFO(Render_OpenGL, "GL_VERSION: {}", gl_version); LOG_INFO(Render_OpenGL, "GL_VERSION: {}", gl_version);
LOG_INFO(Render_OpenGL, "GL_VENDOR: {}", gpu_vendor); LOG_INFO(Render_OpenGL, "GL_VENDOR: {}", gpu_vendor);
@ -1259,12 +1259,12 @@ VideoCore::ResultStatus RendererOpenGL::Init() {
telemetry_session.AddField(user_system, "GPU_Model", std::string(gpu_model)); telemetry_session.AddField(user_system, "GPU_Model", std::string(gpu_model));
telemetry_session.AddField(user_system, "GPU_OpenGL_Version", std::string(gl_version)); telemetry_session.AddField(user_system, "GPU_OpenGL_Version", std::string(gl_version));
if (!strcmp(gpu_vendor, "GDI Generic")) { if (gpu_vendor == "GDI Generic") {
return VideoCore::ResultStatus::ErrorGenericDrivers; return VideoCore::ResultStatus::ErrorGenericDrivers;
} }
if (!(GLAD_GL_VERSION_3_3 || GLAD_GL_ES_VERSION_3_1)) { if (!(GLAD_GL_VERSION_4_3 || GLAD_GL_ES_VERSION_3_1)) {
return VideoCore::ResultStatus::ErrorBelowGL33; return VideoCore::ResultStatus::ErrorBelowGL43;
} }
InitOpenGLObjects(); InitOpenGLObjects();

View File

@ -90,15 +90,9 @@ void Anime4kUltrafast::Filter(const OGLTexture& src_tex, Common::Rectangle<u32>
state.Apply(); state.Apply();
glActiveTexture(GL_TEXTURE0); glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, texture.tex.handle); glBindTexture(GL_TEXTURE_2D, texture.tex.handle);
if (GL_ARB_texture_storage) { glTexStorage2D(GL_TEXTURE_2D, 1, internal_format,
glTexStorage2D(GL_TEXTURE_2D, 1, internal_format, src_rect.GetWidth() * internal_scale_factor,
src_rect.GetWidth() * internal_scale_factor, src_rect.GetHeight() * internal_scale_factor);
src_rect.GetHeight() * internal_scale_factor);
} else {
glTexImage2D(
GL_TEXTURE_2D, 0, internal_format, src_rect.GetWidth() * internal_scale_factor,
src_rect.GetHeight() * internal_scale_factor, 0, format, GL_HALF_FLOAT, nullptr);
}
glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D,
texture.tex.handle, 0); texture.tex.handle, 0);
return texture; return texture;

View File

@ -7,6 +7,7 @@
#include <atomic> #include <atomic>
#include <iostream> #include <iostream>
#include <memory> #include <memory>
#include <functional>
#include "core/frontend/emu_window.h" #include "core/frontend/emu_window.h"
namespace Frontend { namespace Frontend {
@ -49,7 +50,7 @@ extern Memory::MemorySystem* g_memory;
enum class ResultStatus { enum class ResultStatus {
Success, Success,
ErrorGenericDrivers, ErrorGenericDrivers,
ErrorBelowGL33, ErrorBelowGL43,
}; };
/// Initialize the video core /// Initialize the video core