From b50aaa0396256e68e784ae57eac4c408701719e3 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Tue, 14 Jun 2016 16:03:44 +1000 Subject: vrend: fix text in stellarium. This an alternate patch to the proposed ones from Marc-Andre. If we are blitting to a emulated dest alpha we take the explicit blit path and there we set the texture swizzle on the source --- src/vrend_blitter.c | 3 +++ src/vrend_renderer.c | 5 ++++- src/vrend_renderer.h | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/vrend_blitter.c b/src/vrend_blitter.c index 8783a4f..a5e3655 100644 --- a/src/vrend_blitter.c +++ b/src/vrend_blitter.c @@ -526,6 +526,9 @@ void vrend_renderer_blit_gl(struct vrend_context *ctx, glBindTexture(src_res->target, src_res->id); + if (vrend_format_is_emulated_alpha(info->dst.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); glTexParameteri(src_res->target, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE); diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c index cc0f8b8..cc758ea 100644 --- a/src/vrend_renderer.c +++ b/src/vrend_renderer.c @@ -439,7 +439,7 @@ bool vrend_is_ds_format(enum virgl_formats format) return vrend_format_is_ds(format); } -static inline bool vrend_format_is_emulated_alpha(enum virgl_formats format) +bool vrend_format_is_emulated_alpha(enum virgl_formats format) { if (!vrend_state.use_core_profile) return false; @@ -5498,6 +5498,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_format_is_emulated_alpha(info->dst.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 f769695..dde7d75 100644 --- a/src/vrend_renderer.h +++ b/src/vrend_renderer.h @@ -365,7 +365,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_format_is_emulated_alpha(enum virgl_formats format); /* blitter interface */ void vrend_renderer_blit_gl(struct vrend_context *ctx, struct vrend_resource *src_res, -- cgit v1.2.3