[virglrenderer-devel] [PATCH] renderer: swizzle sampler border color channel if we emulate alpha format

Gurchetan Singh gurchetansingh at chromium.org
Thu Jul 12 03:53:47 UTC 2018


On Wed, Jul 11, 2018 at 9:07 AM Elie Tournier <tournier.elie at gmail.com> wrote:
>
> Fixes:
> dEQP-GLES31.functional.texture.border_clamp.formats.alpha.nearest_size_pot
> dEQP-GLES31.functional.texture.border_clamp.formats.alpha.nearest_size_npot
> dEQP-GLES31.functional.texture.border_clamp.formats.alpha.linear_size_pot
> dEQP-GLES31.functional.texture.border_clamp.formats.alpha.linear_size_npot
> dEQP-GLES31.functional.texture.border_clamp.unused_channels.alpha
>
> Signed-off-by: Elie Tournier <elie.tournier at collabora.com>
> ---
>  src/vrend_renderer.c | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
>
> diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c
> index cc99087..f32e8fd 100644
> --- a/src/vrend_renderer.c
> +++ b/src/vrend_renderer.c
> @@ -4173,7 +4173,19 @@ static void vrend_apply_sampler_state(struct vrend_context *ctx,
>        return;
>     }
>
> +   /*
> +    * If we emulate alpha format with red, we need to tell
> +    * the sampler to use the red channel and not the alpha one
> +    * by swizzling the GL_TEXTURE_BORDER_COLOR parameter.
> +    */
>     if (vrend_state.have_samplers) {
> +      if (vrend_format_is_emulated_alpha(res->base.format)) {
> +         union pipe_color_union border_color;
> +         border_color = vstate->base.border_color;
> +         border_color.ui[0] = border_color.ui[3];
> +         border_color.ui[3] = 0;
> +         glSamplerParameterIuiv(vstate->id, GL_TEXTURE_BORDER_COLOR, border_color.ui);
> +      }
>        glBindSampler(sampler_id, vstate->id);
>        glSamplerParameteri(vstate->id, GL_TEXTURE_SRGB_DECODE_EXT,
>                            srgb_decode);
> --
> 2.18.0
>
> _______________________________________________
> virglrenderer-devel mailing list
> virglrenderer-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/virglrenderer-devel

Reviewed-by: Gurchetan Singh <gurchetansingh at chromium.org>


More information about the virglrenderer-devel mailing list