NV_pixel_buffer_object extension can be available in a GLES2 context but the associated glGet constants don't work
After creating a GLES2 context on Intel gen4 hardware (8086:2e12
, Mesa DRI Intel(R) Q45/Q43 (ELK)
), I see the GL_NV_pixel_buffer_object
in the list of GL extensions, but attempting to call glGetIntegerv(GL_PIXEL_UNPACK_BUFFER_BINDING_NV, ...)
fails with GL_INVALID_ENUM
.
Tested on current mesa main (341278f0).
I believe the fix is to move where the constants are listed in src/mesa/main/get_hash_params.py
, but I'm not 100% sure which section is the correct one. I will put up an MR with what seems likely correct to me.
Here's my test program:
#include <EGL/egl.h>
#include <EGL/eglext.h>
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
#include <fcntl.h>
#include <cassert>
#include <cstdio>
#include <cstring>
int main(int argc, char* argv[]) {
// Initialize EGL.
EGLDisplay egl_dpy =
eglGetPlatformDisplay(EGL_PLATFORM_SURFACELESS_MESA, nullptr, nullptr);
assert(egl_dpy != nullptr);
auto res = eglInitialize(egl_dpy, nullptr, nullptr);
assert(res);
// Check that a context can be created without a config.
const auto* egl_ext = eglQueryString(egl_dpy, EGL_EXTENSIONS);
assert(strstr(egl_ext, "EGL_KHR_no_config_context") != nullptr);
// Create an ES 2 context.
static const EGLint attribs[] = {EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE};
auto ctx = eglCreateContext(egl_dpy, nullptr, EGL_NO_CONTEXT, attribs);
assert(ctx != EGL_NO_CONTEXT);
res = eglMakeCurrent(egl_dpy, EGL_NO_SURFACE, EGL_NO_SURFACE, ctx);
assert(res);
// Check that GL_NV_pixel_buffer_object is present.
const char* gl_ext = (const char*)glGetString(GL_EXTENSIONS);
assert(strstr(gl_ext, "GL_NV_pixel_buffer_object") != nullptr);
GLint binding = 0;
glGetIntegerv(GL_PIXEL_UNPACK_BUFFER_BINDING_NV, &binding);
const auto error = glGetError();
if (error == GL_NO_ERROR) {
printf("success\n");
} else if (error == GL_INVALID_ENUM) {
printf("error: GL_INVALID_ENUM\n");
} else {
printf("error: %d\n", error);
}
}