[PATCH 4/8] glamor: Use GL_RED instead of GL_ALPHA if we have texture_swizzle
Eric Anholt
eric at anholt.net
Tue Jan 19 09:29:58 PST 2016
Dave Airlie <airlied at gmail.com> writes:
> From: Keith Packard <keithp at keithp.com>
>
> GL_RED is supported by core profiles while GL_ALPHA is not; use GL_RED
> for one channel objects (depth 1 to 8), and then swizzle them into the
> alpha channel when used as a mask.
>
> [airlied: updated to master, add swizzle to composited glyphs and xv paths]
>
> Signed-off-by: Keith Packard <keithp at keithp.com>
> Signed-off-by: Dave Airlie <airlied at redhat.com>
> ---
> glamor/glamor.c | 4 ++++
> glamor/glamor_composite_glyphs.c | 5 +++++
> glamor/glamor_fbo.c | 2 ++
> glamor/glamor_picture.c | 22 ++++++++++++++--------
> glamor/glamor_priv.h | 2 ++
> glamor/glamor_render.c | 9 +++++++++
> glamor/glamor_transfer.c | 2 +-
> glamor/glamor_utils.h | 4 +++-
> glamor/glamor_xv.c | 12 ++++++++++++
> 9 files changed, 52 insertions(+), 10 deletions(-)
>
> diff --git a/glamor/glamor.c b/glamor/glamor.c
> index 8828ad3..7fa3a46 100644
> --- a/glamor/glamor.c
> +++ b/glamor/glamor.c
> @@ -596,6 +596,10 @@ glamor_init(ScreenPtr screen, unsigned int flags)
> glamor_priv->max_fbo_size = MAX_FBO_SIZE;
> #endif
>
> + glamor_priv->one_channel_format = GL_ALPHA;
> + if (epoxy_has_gl_extension("GL_ARB_texture_rg") && epoxy_has_gl_extension("GL_ARB_texture_swizzle"))
> + glamor_priv->one_channel_format = GL_RED;
> +
> glamor_set_debug_level(&glamor_debug_level);
>
> glamor_priv->saved_procs.create_screen_resources =
> diff --git a/glamor/glamor_composite_glyphs.c b/glamor/glamor_composite_glyphs.c
> index fb31340..5f0fda5 100644
> --- a/glamor/glamor_composite_glyphs.c
> +++ b/glamor/glamor_composite_glyphs.c
> @@ -247,6 +247,11 @@ glamor_glyphs_flush(CARD8 op, PicturePtr src, PicturePtr dst,
> glActiveTexture(GL_TEXTURE1);
> glBindTexture(GL_TEXTURE_2D, atlas_fbo->tex);
>
> + if (glamor_priv->one_channel_format == GL_RED &&
> + atlas->atlas->drawable.depth <= 8)
> + {
> + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_A, GL_RED);
> + }
> for (;;) {
> if (!glamor_use_program_render(prog, op, src, dst))
> break;
Since these TexParameters are stored in the texture object, I think what
we really want is when we make an 8-bit FBO, at that point set SWIZZLE_A
to RED and SWIZZLE_RED to 0. (If we don't do RED to 0, I expect this
will cause Render regressions). Then we don't have to do these
expensive TexParameters at draw time.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 818 bytes
Desc: not available
URL: <http://lists.x.org/archives/xorg-devel/attachments/20160119/7b5fab15/attachment.sig>
More information about the xorg-devel
mailing list