From 429620c48b47e7490ca5cd9ae87ff94478c3e82f Mon Sep 17 00:00:00 2001 From: Quantum Date: Wed, 18 Aug 2021 22:55:23 -0400 Subject: [PATCH] [client] egl: dynamically import glBufferStorageEXT On some implementations (e.g. llvmpipe), the function can only be queried via eglGetProcAddress. --- client/include/egl_dynprocs.h | 3 +++ client/renderers/EGL/texture_util.c | 3 ++- client/src/egl_dynprocs.c | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/client/include/egl_dynprocs.h b/client/include/egl_dynprocs.h index 9be08a3f..4d9bfd30 100644 --- a/client/include/egl_dynprocs.h +++ b/client/include/egl_dynprocs.h @@ -37,6 +37,8 @@ typedef void (*DEBUGPROC_t)(GLenum source, const GLchar *message, const void *userParam); typedef void (*glDebugMessageCallback_t)(DEBUGPROC_t callback, const void * userParam); +typedef void (*glBufferStorageEXT_t)(GLenum target, GLsizeiptr size, + const void * data, GLbitfield flags); struct EGLDynProcs { @@ -47,6 +49,7 @@ struct EGLDynProcs glEGLImageTargetTexture2DOES_t glEGLImageTargetTexture2DOES; glDebugMessageCallback_t glDebugMessageCallback; glDebugMessageCallback_t glDebugMessageCallbackKHR; + glBufferStorageEXT_t glBufferStorageEXT; }; extern struct EGLDynProcs g_egl_dynProcs; diff --git a/client/renderers/EGL/texture_util.c b/client/renderers/EGL/texture_util.c index b846caa5..9c72d28c 100644 --- a/client/renderers/EGL/texture_util.c +++ b/client/renderers/EGL/texture_util.c @@ -26,6 +26,7 @@ #include #include "egldebug.h" +#include "egl_dynprocs.h" /** * the following comes from drm_fourcc.h and is included here to avoid the @@ -108,7 +109,7 @@ bool egl_texUtilGenBuffers(const EGL_TexFormat * fmt, EGL_TexBuffer * buffers, buffer->size = fmt->bufferSize; glGenBuffers(1, &buffer->pbo); glBindBuffer(GL_PIXEL_UNPACK_BUFFER, buffer->pbo); - glBufferStorageEXT( + g_egl_dynProcs.glBufferStorageEXT( GL_PIXEL_UNPACK_BUFFER, fmt->bufferSize, NULL, diff --git a/client/src/egl_dynprocs.c b/client/src/egl_dynprocs.c index 4b200df3..3df6fbec 100644 --- a/client/src/egl_dynprocs.c +++ b/client/src/egl_dynprocs.c @@ -40,6 +40,8 @@ void egl_dynProcsInit(void) eglGetProcAddress("glDebugMessageCallback"); g_egl_dynProcs.glDebugMessageCallbackKHR = (glDebugMessageCallback_t) eglGetProcAddress("glDebugMessageCallbackKHR"); + g_egl_dynProcs.glBufferStorageEXT = (glBufferStorageEXT_t) + eglGetProcAddress("glBufferStorageEXT"); }; #endif