[virglrenderer-devel] [PATCH v5] vrend: enable multisample on GLES host with GLES >= 3.0
Gert Wollny
gert.wollny at collabora.com
Thu Jun 7 13:34:04 UTC 2018
Ping
Am Dienstag, den 22.05.2018, 15:48 +0200 schrieb Gert Wollny:
> 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_c
> overage
> dEQP-
> GLES3.functional.multisample.fbo_max_samples.proportionality_sample_c
> overage_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
>
> Signed-off-by: Gert Wollny <gert.wollny at collabora.com>
> Reviewed-by: Gurchetan Singh <gurchetansingh at chromium.org> (v1)
> ---
> 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 862a873..2d1fce8 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,13 +3788,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);
> @@ -4216,7 +4224,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;
More information about the virglrenderer-devel
mailing list