summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2016-06-14 16:03:44 +1000
committerDave Airlie <airlied@redhat.com>2016-06-14 16:03:44 +1000
commitb50aaa0396256e68e784ae57eac4c408701719e3 (patch)
treeaa97ae4922f102d340a0b65021ca87400f47ef3a
parent27e5078eb802ff47f2e9e12ccd5bb5e5719016e0 (diff)
vrend: fix text in stellarium.fix-red-blit
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
-rw-r--r--src/vrend_blitter.c3
-rw-r--r--src/vrend_renderer.c5
-rw-r--r--src/vrend_renderer.h2
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,