Avoid needless repetition

We end up evaluating vrend_format_is_emulated_alpha once in either
case, so let's just lift the logic up so we only have one call-site
in this function.

Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
macos/master
Erik Faye-Lund 6 years ago committed by Dave Airlie
parent 2c0d0963a1
commit e898b8fb0e
  1. 4
      src/vrend_renderer.c

@ -4284,8 +4284,9 @@ static void vrend_apply_sampler_state(struct vrend_context *ctx,
* the sampler to use the red channel and not the alpha one * the sampler to use the red channel and not the alpha one
* by swizzling the GL_TEXTURE_BORDER_COLOR parameter. * by swizzling the GL_TEXTURE_BORDER_COLOR parameter.
*/ */
bool is_emulated_alpha = vrend_format_is_emulated_alpha(res->base.format);
if (has_feature(feat_samplers)) { if (has_feature(feat_samplers)) {
if (vrend_format_is_emulated_alpha(res->base.format)) { if (is_emulated_alpha) {
union pipe_color_union border_color; union pipe_color_union border_color;
border_color = state->border_color; border_color = state->border_color;
border_color.ui[0] = border_color.ui[3]; border_color.ui[0] = border_color.ui[3];
@ -4347,7 +4348,6 @@ static void vrend_apply_sampler_state(struct vrend_context *ctx,
} }
} }
bool is_emulated_alpha = vrend_format_is_emulated_alpha(res->base.format);
if (memcmp(&tex->state.border_color, &state->border_color, 16) || set_all || if (memcmp(&tex->state.border_color, &state->border_color, 16) || set_all ||
is_emulated_alpha) { is_emulated_alpha) {
if (is_emulated_alpha) { if (is_emulated_alpha) {

Loading…
Cancel
Save