diff --git a/plugins/GSdx/Renderers/OpenGL/GLLoader.cpp b/plugins/GSdx/Renderers/OpenGL/GLLoader.cpp index 2283e29452..d979b005db 100644 --- a/plugins/GSdx/Renderers/OpenGL/GLLoader.cpp +++ b/plugins/GSdx/Renderers/OpenGL/GLLoader.cpp @@ -26,6 +26,7 @@ #ifdef __unix__ PFNGLBLENDFUNCSEPARATEPROC glBlendFuncSeparate = NULL; #endif +PFNGLTEXTUREPAGECOMMITMENTEXTPROC glTexturePageCommitmentEXT = NULL; #include "PFN_GLLOADER_CPP.h" @@ -382,7 +383,7 @@ 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; @@ -390,7 +391,7 @@ namespace GLLoader { } 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); diff --git a/plugins/GSdx/Renderers/OpenGL/GLLoader.h b/plugins/GSdx/Renderers/OpenGL/GLLoader.h index 743a3e7bbe..d16c5db74e 100644 --- a/plugins/GSdx/Renderers/OpenGL/GLLoader.h +++ b/plugins/GSdx/Renderers/OpenGL/GLLoader.h @@ -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); diff --git a/plugins/GSdx/Window/GSWnd.cpp b/plugins/GSdx/Window/GSWnd.cpp index 82ad34d875..5cbeff6a2f 100644 --- a/plugins/GSdx/Window/GSWnd.cpp +++ b/plugins/GSdx/Window/GSWnd.cpp @@ -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