From 6a4ef6d8a284d163236d99f30bc5e1480d009544 Mon Sep 17 00:00:00 2001 From: Erik Faye-Lund Date: Mon, 16 Jul 2018 11:56:45 +0200 Subject: [PATCH] renderer: swizzle sampler border color channel if we emulate alpha format (this got a bit mangled in patchwork, I undid that) Reviewed-by: Dave Airlie --- src/vrend_renderer.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c index 8aec994..2298a59 100644 --- a/src/vrend_renderer.c +++ b/src/vrend_renderer.c @@ -4241,8 +4241,18 @@ static void vrend_apply_sampler_state(struct vrend_context *ctx, } } - if (memcmp(&tex->state.border_color, &state->border_color, 16) || set_all) - glTexParameterIuiv(target, GL_TEXTURE_BORDER_COLOR, state->border_color.ui); + bool is_emulated_alpha = vrend_format_is_emulated_alpha(res->base.format); + if (memcmp(&tex->state.border_color, &state->border_color, 16) || set_all || + is_emulated_alpha) { + if (is_emulated_alpha) { + 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; + glTexParameterIuiv(target, GL_TEXTURE_BORDER_COLOR, border_color.ui); + } else + glTexParameterIuiv(target, GL_TEXTURE_BORDER_COLOR, state->border_color.ui); + } tex->state = *state; }