From 9a4bb208364bf4a3245e22fbe1115cc04f6f8e85 Mon Sep 17 00:00:00 2001 From: Gert Wollny Date: Tue, 22 May 2018 15:48:19 +0200 Subject: [PATCH] vrend: enable multisample on GLES host with GLES >= 3.0 Multisample fragment operations are part of the OpenGL ES 3.0 spec and enabling them doesn't required the extensions to be listed explicitly. Fixes: dEQP-GLES3.functional.multisample.fbo_max_samples.proportionality_alpha_to_coverage dEQP-GLES3.functional.multisample.fbo_max_samples.proportionality_sample_coverage dEQP-GLES3.functional.multisample.fbo_max_samples.proportionality_sample_coverage_inverted dEQP-GLES3.functional.multisample.fbo_max_samples.sample_coverage_invert on an GLES host with GLES >= 3.0. v2: - Do not set GL_SAMPLE_ALPHA_TO_ONE state when on gles host, because it is not supported there. This silences a number of according warnings on the host. v3: - Properly place if statement to not send GL_SAMPLE_ALPHA_TO_ONE. - Do not set GL_MULTISAMPLE state when on gles host (same as above). v4: - fix nitpicks in commit message v5: - seperate setting of GL_MULTISAMPLE (not available on GLES) and GL_SAMPLES_TEST Reviewed-by: Gurchetan Singh Signed-off-by: Gert Wollny Signed-off-by: Jakob Bornecrantz --- src/vrend_renderer.c | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c index 5ef3555..b44ebe4 100644 --- a/src/vrend_renderer.c +++ b/src/vrend_renderer.c @@ -3374,10 +3374,12 @@ static void vrend_hw_emit_blend(struct vrend_context *ctx, struct pipe_blend_sta else glDisable(GL_SAMPLE_ALPHA_TO_COVERAGE); - if (state->alpha_to_one) - glEnable(GL_SAMPLE_ALPHA_TO_ONE); - else - glDisable(GL_SAMPLE_ALPHA_TO_ONE); + if (!vrend_state.use_gles) { + if (state->alpha_to_one) + glEnable(GL_SAMPLE_ALPHA_TO_ONE); + else + glDisable(GL_SAMPLE_ALPHA_TO_ONE); + } } if (state->dither) @@ -3817,13 +3819,19 @@ static void vrend_hw_emit_rs(struct vrend_context *ctx) } if (vrend_state.have_multisample) { - if (state->multisample) { - glEnable(GL_MULTISAMPLE); + if (state->multisample) glEnable(GL_SAMPLE_MASK); - } else { - glDisable(GL_MULTISAMPLE); + else glDisable(GL_SAMPLE_MASK); + + /* GLES doesn't have GL_MULTISAMPLE */ + if (!vrend_state.use_gles) { + if (state->multisample) + glEnable(GL_MULTISAMPLE); + else + glDisable(GL_MULTISAMPLE); } + if (vrend_state.have_sample_shading) { if (state->force_persample_interp) glEnable(GL_SAMPLE_SHADING); @@ -4248,7 +4256,9 @@ int vrend_renderer_init(struct vrend_if_cbs *cbs, uint32_t flags) if (epoxy_has_gl_extension("GL_ARB_stencil_texturing")) vrend_state.have_stencil_texturing = true; - if (epoxy_has_gl_extension("GL_EXT_framebuffer_multisample") && epoxy_has_gl_extension("GL_ARB_texture_multisample")) { + if ((gles && gl_ver >= 30) || + (epoxy_has_gl_extension("GL_EXT_framebuffer_multisample") && + epoxy_has_gl_extension("GL_ARB_texture_multisample"))) { vrend_state.have_multisample = true; if (epoxy_has_gl_extension("GL_EXT_framebuffer_multisample_blit_scaled")) vrend_state.have_ms_scaled_blit = true;