vrend: Detect OpenGL ES being used

Detect OpenGL ES context being given to us. This is just the detection code,
it does not do any other fallback or work around. This is required for the
rest of the OpenGL ES code that follows. It is assumed that virgl will not
decide to use OpenGL ES and that is the hardware platform that forces this.

Signed-off-by: Jakob Bornecrantz <jakob.bornecrantz@collabora.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
macos/master
Jakob Bornecrantz 7 years ago committed by Dave Airlie
parent b37ab49b52
commit c14c74b059
  1. 13
      src/vrend_renderer.c

@ -98,6 +98,7 @@ struct global_renderer_state {
struct list_head waiting_query_list;
bool inited;
bool use_gles;
bool use_core_profile;
bool have_debug_cb;
@ -3830,6 +3831,7 @@ static void vrend_debug_cb(GLenum source, GLenum type, GLuint id,
int vrend_renderer_init(struct vrend_if_cbs *cbs, uint32_t flags)
{
bool gles;
int gl_ver;
virgl_gl_context gl_context;
struct virgl_gl_ctx_param ctx_params;
@ -3856,9 +3858,18 @@ int vrend_renderer_init(struct vrend_if_cbs *cbs, uint32_t flags)
vrend_state.have_debug_cb = true;
}
/* make sure you have the latest version of libepoxy */
gles = epoxy_is_desktop_gl() == 0;
vrend_state.gl_major_ver = gl_ver / 10;
vrend_state.gl_minor_ver = gl_ver % 10;
if (gl_ver > 30 && !epoxy_has_gl_extension("GL_ARB_compatibility")) {
if (gles) {
fprintf(stderr, "gl_version %d - es profile enabled\n", gl_ver);
vrend_state.use_gles = true;
/* for now, makes the rest of the code use the most GLES 3.x like path */
vrend_state.use_core_profile = 1;
} else if (gl_ver > 30 && !epoxy_has_gl_extension("GL_ARB_compatibility")) {
fprintf(stderr, "gl_version %d - core profile enabled\n", gl_ver);
vrend_state.use_core_profile = 1;
} else {

Loading…
Cancel
Save