[virglrenderer-devel] [PATCH 4/4] blit: fix blitting to red-alpha texture
marcandre.lureau at redhat.com
marcandre.lureau at redhat.com
Fri Jun 10 17:25:03 UTC 2016
From: Marc-André Lureau <marcandre.lureau at redhat.com>
glBlitFramebuffer() doesn't take swizzling into account, so use
blit_gl() fallback in this case with a alpha->red swizzle.
This fixes text rendering with Qt
QGLTextureGlyphCache::resizeTextureData(), as can be reproduced with
stellarium or qt5/examples/widgets/graphicsview/chip/chip.
Signed-off-by: Marc-André Lureau <marcandre.lureau at redhat.com>
---
src/vrend_blitter.c | 2 ++
src/vrend_renderer.c | 8 ++++++++
src/vrend_renderer.h | 1 +
3 files changed, 11 insertions(+)
diff --git a/src/vrend_blitter.c b/src/vrend_blitter.c
index 8783a4f..cacf28b 100644
--- a/src/vrend_blitter.c
+++ b/src/vrend_blitter.c
@@ -525,6 +525,8 @@ void vrend_renderer_blit_gl(struct vrend_context *ctx,
glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT);
glBindTexture(src_res->target, src_res->id);
+ if (vrend_is_red_alpha_format(dst_res->base.format))
+ glTexParameteri(src_res->target, GL_TEXTURE_SWIZZLE_R, GL_ALPHA);
glTexParameteri(src_res->target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(src_res->target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c
index c3605b3..5b9d5f6 100644
--- a/src/vrend_renderer.c
+++ b/src/vrend_renderer.c
@@ -434,6 +434,11 @@ static inline bool vrend_format_is_ds(enum virgl_formats format)
return tex_conv_table[format].bindings & VREND_BIND_DEPTHSTENCIL;
}
+bool vrend_is_red_alpha_format(enum virgl_formats format)
+{
+ return tex_conv_table[format].bindings & VREND_BIND_RED_ALPHA;
+}
+
bool vrend_is_ds_format(enum virgl_formats format)
{
return vrend_format_is_ds(format);
@@ -5491,6 +5496,9 @@ static void vrend_renderer_blit_int(struct vrend_context *ctx,
if (info->src.box.depth != info->dst.box.depth)
use_gl = true;
+ if (vrend_is_red_alpha_format(dst_res->base.format))
+ use_gl = true;
+
if (use_gl) {
vrend_renderer_blit_gl(ctx, src_res, dst_res, info);
vrend_clicbs->make_current(0, ctx->sub->gl_context);
diff --git a/src/vrend_renderer.h b/src/vrend_renderer.h
index bc96497..0d4e3be 100644
--- a/src/vrend_renderer.h
+++ b/src/vrend_renderer.h
@@ -364,6 +364,7 @@ void vrend_fb_bind_texture(struct vrend_resource *res,
int idx,
uint32_t level, uint32_t layer);
bool vrend_is_ds_format(enum virgl_formats format);
+bool vrend_is_red_alpha_format(enum virgl_formats format);
/* blitter interface */
void vrend_renderer_blit_gl(struct vrend_context *ctx,
--
2.7.4
More information about the virglrenderer-devel
mailing list