[virglrenderer-devel] [PATCH v4] vrend: enable multisample on GLES host with GLES >= 3.0

Gert Wollny gert.wollny at collabora.com
Mon May 21 13:11:06 UTC 2018


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 

Signed-off-by: Gert Wollny <gert.wollny at collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh at chromium.org> (v1)
---
PS: I don't have commit rights

 src/vrend_renderer.c | 28 +++++++++++++++++-----------
 1 file changed, 17 insertions(+), 11 deletions(-)

diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c
index 862a873..8cd9109 100644
--- a/src/vrend_renderer.c
+++ b/src/vrend_renderer.c
@@ -3347,10 +3347,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)
@@ -3786,12 +3788,14 @@ static void vrend_hw_emit_rs(struct vrend_context *ctx)
    }
 
    if (vrend_state.have_multisample) {
-      if (state->multisample) {
-         glEnable(GL_MULTISAMPLE);
-         glEnable(GL_SAMPLE_MASK);
-      } else {
-         glDisable(GL_MULTISAMPLE);
-         glDisable(GL_SAMPLE_MASK);
+      if (!vrend_state.use_gles) {
+         if (state->multisample) {
+            glEnable(GL_MULTISAMPLE);
+            glEnable(GL_SAMPLE_MASK);
+         } else {
+            glDisable(GL_MULTISAMPLE);
+            glDisable(GL_SAMPLE_MASK);
+         }
       }
       if (vrend_state.have_sample_shading) {
          if (state->force_persample_interp)
@@ -4216,7 +4220,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;
-- 
2.17.0



More information about the virglrenderer-devel mailing list