From: Brendan King <brendan.k...@imgtec.com> Don't assume the screen supports OpenGL when creating a new context, use an API that the screen supports.
Signed-off-by: Brendan King <brendan.k...@imgtec.com> Reviewed-by: Eric Engestrom <eric.engest...@imgtec.com> [Eric: rebased on current git HEAD] Signed-off-by: Eric Engestrom <eric.engest...@imgtec.com> --- src/mesa/drivers/dri/common/dri_util.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c index e6a7d2391a78c45d45a1..3f32b34132e75228e0e0 100644 --- a/src/mesa/drivers/dri/common/dri_util.c +++ b/src/mesa/drivers/dri/common/dri_util.c @@ -49,6 +49,7 @@ #include "main/debug_output.h" #include "main/errors.h" #include "main/macros.h" +#include "util/bitscan.h" const char __dri2ConfigOptions[] = DRI_CONF_BEGIN @@ -325,7 +326,11 @@ driCreateContextAttribs(__DRIscreen *screen, int api, mesa_api = API_OPENGLES; break; case __DRI_API_GLES2: + ctx_config.major_version = 2; + mesa_api = API_OPENGLES2; + break; case __DRI_API_GLES3: + ctx_config.major_version = 3; mesa_api = API_OPENGLES2; break; case __DRI_API_OPENGL_CORE: @@ -514,7 +519,14 @@ static __DRIcontext * driCreateNewContext(__DRIscreen *screen, const __DRIconfig *config, __DRIcontext *shared, void *data) { - return driCreateNewContextForAPI(screen, __DRI_API_OPENGL, + int apifs; + + apifs = ffs(screen->api_mask); + + if (!apifs) + return NULL; + + return driCreateNewContextForAPI(screen, apifs - 1, config, shared, data); } -- Cheers, Eric _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev