diff --git a/Source/Core/VideoBackends/OGL/GLExtensions/ARB_buffer_storage.h b/Source/Core/VideoBackends/OGL/GLExtensions/ARB_buffer_storage.h new file mode 100644 index 0000000000..ef224a5af7 --- /dev/null +++ b/Source/Core/VideoBackends/OGL/GLExtensions/ARB_buffer_storage.h @@ -0,0 +1,27 @@ +// Copyright 2013 Dolphin Emulator Project +// Licensed under GPLv2 +// Refer to the license.txt file included. + +#include "gl_common.h" + +#ifndef GL_ARB_buffer_storage +#define GL_ARB_buffer_storage 1 + +#define GL_MAP_READ_BIT 0x0001 +#define GL_MAP_WRITE_BIT 0x0002 +#define GL_MAP_PERSISTENT_BIT 0x00000040 +#define GL_MAP_COHERENT_BIT 0x00000080 +#define GL_DYNAMIC_STORAGE_BIT 0x0100 +#define GL_CLIENT_STORAGE_BIT 0x0200 +#define GL_CLIENT_MAPPED_BUFFER_BARRIER_BIT 0x00004000 +#define GL_BUFFER_IMMUTABLE_STORAGE 0x821F +#define GL_BUFFER_STORAGE_FLAGS 0x8220 + +typedef void (GLAPIENTRY * PFNGLBUFFERSTORAGEPROC) (GLenum target, GLsizeiptr size, const GLvoid* data, GLbitfield flags); +typedef void (GLAPIENTRY * PFNGLNAMEDBUFFERSTORAGEEXTPROC) (GLuint buffer, GLsizeiptr size, const GLvoid* data, GLbitfield flags); + +#endif + +extern PFNGLBUFFERSTORAGEPROC glBufferStorage; +extern PFNGLNAMEDBUFFERSTORAGEEXTPROC glNamedBufferStorageEXT; + diff --git a/Source/Core/VideoBackends/OGL/GLExtensions/GLExtensions.cpp b/Source/Core/VideoBackends/OGL/GLExtensions/GLExtensions.cpp index 2299e08801..7b6c9458c2 100644 --- a/Source/Core/VideoBackends/OGL/GLExtensions/GLExtensions.cpp +++ b/Source/Core/VideoBackends/OGL/GLExtensions/GLExtensions.cpp @@ -427,6 +427,10 @@ PFNGLOBJECTPTRLABELKHRPROC glObjectPtrLabelKHR; PFNGLGETOBJECTPTRLABELKHRPROC glGetObjectPtrLabelKHR; PFNGLGETPOINTERVKHRPROC glGetPoitnervKHR; +// ARB_buffer_storage +PFNGLBUFFERSTORAGEPROC glBufferStorage; +PFNGLNAMEDBUFFERSTORAGEEXTPROC glNamedBufferStorageEXT; + namespace GLExtensions { // Private members and functions @@ -459,6 +463,7 @@ namespace GLExtensions bool init_arb_sample_shading(); bool init_arb_debug_output(); bool init_khr_debug(); + bool init_arb_buffer_storage(); void InitExtensionList() { @@ -561,6 +566,7 @@ namespace GLExtensions if (success && !init_arb_debug_output()) success = false; if (success && !init_nv_framebuffer_multisample_coverage()) success = false; if (success && !init_khr_debug()) success = false; + if (success && !init_arb_buffer_storage()) success = false; #if defined(__linux__) dlclose(_dlsym); @@ -1115,4 +1121,13 @@ namespace GLExtensions GrabFunction(glGetPoitnervKHR) return true; } + + bool init_arb_buffer_storage() + { + if (!Supports("GL_ARB_buffer_storage")) + return true; + GrabFunction(glBufferStorage) + GrabFunction(glNamedBufferStorageEXT) + return true; + } } diff --git a/Source/Core/VideoBackends/OGL/GLExtensions/GLExtensions.h b/Source/Core/VideoBackends/OGL/GLExtensions/GLExtensions.h index 58304cc158..37852c4f84 100644 --- a/Source/Core/VideoBackends/OGL/GLExtensions/GLExtensions.h +++ b/Source/Core/VideoBackends/OGL/GLExtensions/GLExtensions.h @@ -29,6 +29,7 @@ #include "ARB_sample_shading.h" #include "ARB_debug_output.h" #include "KHR_debug.h" +#include "ARB_buffer_storage.h" namespace GLExtensions {