From c14c74b059a058d33351ec953591be60d358480a Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Fri, 22 Dec 2017 18:57:45 +0000 Subject: [PATCH] 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 Signed-off-by: Dave Airlie --- src/vrend_renderer.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c index e741434..7df9389 100644 --- a/src/vrend_renderer.c +++ b/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 {