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 <gurchetansingh@chromium.org>
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>
macos/master
Gert Wollny 7 years ago committed by Jakob Bornecrantz
parent e518a64c75
commit 9a4bb20836
  1. 20
      src/vrend_renderer.c

@ -3374,11 +3374,13 @@ static void vrend_hw_emit_blend(struct vrend_context *ctx, struct pipe_blend_sta
else else
glDisable(GL_SAMPLE_ALPHA_TO_COVERAGE); glDisable(GL_SAMPLE_ALPHA_TO_COVERAGE);
if (!vrend_state.use_gles) {
if (state->alpha_to_one) if (state->alpha_to_one)
glEnable(GL_SAMPLE_ALPHA_TO_ONE); glEnable(GL_SAMPLE_ALPHA_TO_ONE);
else else
glDisable(GL_SAMPLE_ALPHA_TO_ONE); glDisable(GL_SAMPLE_ALPHA_TO_ONE);
} }
}
if (state->dither) if (state->dither)
glEnable(GL_DITHER); glEnable(GL_DITHER);
@ -3817,13 +3819,19 @@ static void vrend_hw_emit_rs(struct vrend_context *ctx)
} }
if (vrend_state.have_multisample) { if (vrend_state.have_multisample) {
if (state->multisample) { if (state->multisample)
glEnable(GL_MULTISAMPLE);
glEnable(GL_SAMPLE_MASK); glEnable(GL_SAMPLE_MASK);
} else { else
glDisable(GL_MULTISAMPLE);
glDisable(GL_SAMPLE_MASK); 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 (vrend_state.have_sample_shading) {
if (state->force_persample_interp) if (state->force_persample_interp)
glEnable(GL_SAMPLE_SHADING); 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")) if (epoxy_has_gl_extension("GL_ARB_stencil_texturing"))
vrend_state.have_stencil_texturing = true; 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; vrend_state.have_multisample = true;
if (epoxy_has_gl_extension("GL_EXT_framebuffer_multisample_blit_scaled")) if (epoxy_has_gl_extension("GL_EXT_framebuffer_multisample_blit_scaled"))
vrend_state.have_ms_scaled_blit = true; vrend_state.have_ms_scaled_blit = true;

Loading…
Cancel
Save