vrend: don't hardcode context version

Currently, we always try to create an OpenGL 3.1 context. Some
dEQP tests require an OpenGL 3.2 context (specifically, ones
that use glGetInteger64v). Let's try to create the highest
version context we can, and iterate to lower versions, i.e:

https://developer.android.com/guide/topics/graphics/opengl.html#version-check

The return code for (*create_gl_context) is a little unclear.
This patch assumes NULL is returned on failure. This should work
for GLX and EGL.

GLX:

"On failure glXCreateContextAttribsARB returns NULL and generates
an X error with extended error information"

https://www.khronos.org/registry/OpenGL/extensions/ARB/GLX_ARB_create_context.txt

EGL:

"#define EGL_NO_CONTEXT ((EGLContext)0)"

https://www.khronos.org/registry/EGL/api/1.1/EGL/egl.h

The semantics of rcbs->create_gl_context may be different, though.

Fixes:
   dEQP-GLES3.functional.state_query.integers.max_vertex_output_components_getinteger64
   dEQP-GLES3.functional.state_query.integers.max_vertex_output_components_getfloat
Signed-off-by: Dave Airlie <airlied@redhat.com>
macos/master
Gurchetan Singh 7 years ago committed by Dave Airlie
parent 488765c82e
commit fa835b0f88
  1. 11
      src/vrend_blitter.c
  2. 11
      src/vrend_renderer.c
  3. 10
      src/vrend_renderer.h

@ -363,9 +363,14 @@ static void vrend_renderer_init_blit_ctx(struct vrend_blitter_ctx *blit_ctx)
blit_ctx->initialised = true;
ctx_params.shared = true;
ctx_params.major_ver = VREND_GL_VER_MAJOR;
ctx_params.minor_ver = VREND_GL_VER_MINOR;
blit_ctx->gl_context = vrend_clicbs->create_gl_context(0, &ctx_params);
for (uint32_t i = 0; i < ARRAY_SIZE(gl_versions); i++) {
ctx_params.major_ver = gl_versions[i].major;
ctx_params.minor_ver = gl_versions[i].minor;
blit_ctx->gl_context = vrend_clicbs->create_gl_context(0, &ctx_params);
if (blit_ctx->gl_context)
break;
}
vrend_clicbs->make_current(0, blit_ctx->gl_context);
glGenVertexArrays(1, &blit_ctx->vaoid);

@ -3993,10 +3993,15 @@ int vrend_renderer_init(struct vrend_if_cbs *cbs, uint32_t flags)
}
ctx_params.shared = false;
ctx_params.major_ver = VREND_GL_VER_MAJOR;
ctx_params.minor_ver = VREND_GL_VER_MINOR;
for (uint32_t i = 0; i < ARRAY_SIZE(gl_versions); i++) {
ctx_params.major_ver = gl_versions[i].major;
ctx_params.minor_ver = gl_versions[i].minor;
gl_context = vrend_clicbs->create_gl_context(0, &ctx_params);
if (gl_context)
break;
}
gl_context = vrend_clicbs->create_gl_context(0, &ctx_params);
vrend_clicbs->make_current(0, gl_context);
gl_ver = epoxy_gl_version();

@ -376,8 +376,14 @@ void vrend_renderer_blit_gl(struct vrend_context *ctx,
void vrend_renderer_reset(void);
int vrend_renderer_get_poll_fd(void);
void vrend_decode_reset(bool ctx_0_only);
#define VREND_GL_VER_MAJOR 3
#define VREND_GL_VER_MINOR 1
struct gl_version {
uint32_t major;
uint32_t minor;
};
static const struct gl_version gl_versions[] = { {4,5}, {4,4}, {4,3}, {4,2}, {4,1}, {4,0},
{3,3}, {3,2}, {3,1}, {3,0} };
extern struct vrend_if_cbs *vrend_clicbs;
#endif

Loading…
Cancel
Save