Permalink
Browse files

gsdx ogl: load GL_EXT_direct_state_access for sparse texture

They forgot to add is to the ARB extension...
  • Loading branch information...
gregory38 committed Feb 7, 2019
1 parent 2ea47a1 commit 86a10969f3c0d9fcbb0e2440edfa821150223765
@@ -26,6 +26,7 @@
#ifdef __unix__
PFNGLBLENDFUNCSEPARATEPROC glBlendFuncSeparate = NULL;
#endif
PFNGLTEXTUREPAGECOMMITMENTEXTPROC glTexturePageCommitmentEXT = NULL;

#include "PFN_GLLOADER_CPP.h"

@@ -382,15 +383,15 @@ namespace GLLoader {

static void check_sparse_compatibility()
{
if (!found_GL_ARB_sparse_texture) {
if (!GLExtension::Has("GL_ARB_sparse_texture") || !GLExtension::Has("GL_EXT_direct_state_access")) {
found_compatible_GL_ARB_sparse_texture2 = false;
found_compatible_sparse_depth = false;

return;
}

found_compatible_GL_ARB_sparse_texture2 = true;
if (!found_GL_ARB_sparse_texture2) {
if (!GLExtension::Has("GL_ARB_sparse_texture2")) {
// Only check format from GSTextureOGL
found_compatible_GL_ARB_sparse_texture2 &= is_sparse2_compatible("GL_R8", GL_R8, 256, 256);

@@ -33,6 +33,35 @@
// FIX compilation issue with Mesa 10
#include "glext_extra.h"

/*************************************************************
* Extra define not provided in glcorearb.h
* Currently they are included in the legacy glext.h but the plan
* is to move to core only OpenGL
************************************************************/

// Extension not in core profile. It will become irrelevant with sparse texture
#ifndef GL_TEXTURE_FREE_MEMORY_ATI
#define GL_TEXTURE_FREE_MEMORY_ATI 0x87FC
#endif
#ifndef GL_NVX_gpu_memory_info
#define GL_NVX_gpu_memory_info 1
#define GL_GPU_MEMORY_INFO_DEDICATED_VIDMEM_NVX 0x9047
#define GL_GPU_MEMORY_INFO_TOTAL_AVAILABLE_MEMORY_NVX 0x9048
#define GL_GPU_MEMORY_INFO_CURRENT_AVAILABLE_VIDMEM_NVX 0x9049
#define GL_GPU_MEMORY_INFO_EVICTION_COUNT_NVX 0x904A
#define GL_GPU_MEMORY_INFO_EVICTED_MEMORY_NVX 0x904B
#endif /* GL_NVX_gpu_memory_info */

// Added in GL4.6. Code should be updated but driver support...
#ifndef GL_TEXTURE_MAX_ANISOTROPY_EXT
#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE
#endif

// Believe me or not, they forgot to add the interaction with DSA...
#ifndef GL_EXT_direct_state_access
typedef void (APIENTRYP PFNGLTEXTUREPAGECOMMITMENTEXTPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLboolean commit);
#endif

// ********************** End of the extra header ******************* //

// #define ENABLE_GL_ARB_ES3_2_compatibility 1
@@ -53,7 +82,7 @@
// #define ENABLE_GL_ARB_sample_shading 1
// #define ENABLE_GL_ARB_shading_language_include 1
// #define ENABLE_GL_ARB_sparse_buffer 1
// #define ENABLE_GL_ARB_sparse_texture 1
#define ENABLE_GL_ARB_sparse_texture 1
// #define ENABLE_GL_ARB_texture_buffer_object 1
// #define ENABLE_GL_KHR_blend_equation_advanced 1
// #define ENABLE_GL_KHR_parallel_shader_compile 1
@@ -88,33 +117,10 @@
#ifdef __unix__
extern PFNGLBLENDFUNCSEPARATEPROC glBlendFuncSeparate;
#endif
extern PFNGLTEXTUREPAGECOMMITMENTEXTPROC glTexturePageCommitmentEXT;

#include "PFN_GLLOADER_HPP.h"

/*************************************************************
* Extra define not provided in glcorearb.h
* Currently they are included in the legacy glext.h but the plan
* is to move to core only OpenGL
************************************************************/

// Extension not in core profile. It will become irrelevant with sparse texture
#ifndef GL_TEXTURE_FREE_MEMORY_ATI
#define GL_TEXTURE_FREE_MEMORY_ATI 0x87FC
#endif
#ifndef GL_NVX_gpu_memory_info
#define GL_NVX_gpu_memory_info 1
#define GL_GPU_MEMORY_INFO_DEDICATED_VIDMEM_NVX 0x9047
#define GL_GPU_MEMORY_INFO_TOTAL_AVAILABLE_MEMORY_NVX 0x9048
#define GL_GPU_MEMORY_INFO_CURRENT_AVAILABLE_VIDMEM_NVX 0x9049
#define GL_GPU_MEMORY_INFO_EVICTION_COUNT_NVX 0x904A
#define GL_GPU_MEMORY_INFO_EVICTED_MEMORY_NVX 0x904B
#endif /* GL_NVX_gpu_memory_info */

// Added in GL4.6. Code should be updated but driver support...
#ifndef GL_TEXTURE_MAX_ANISOTROPY_EXT
#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE
#endif

namespace GLExtension {
extern bool Has(const std::string& ext);
extern void Set(const std::string& ext, bool v = true);
@@ -36,6 +36,7 @@ void GSWndGL::PopulateGlFunction()
#ifdef __unix__
GL_EXT_LOAD(glBlendFuncSeparate);
#endif
GL_EXT_LOAD(glTexturePageCommitmentEXT);

// Check openGL requirement as soon as possible so we can switch to another
// renderer/device

0 comments on commit 86a1096

Please sign in to comment.