From 9ab8d31f32ba557ed33dd7c41b40dd565067b12c Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Fri, 14 Jun 2019 10:12:38 -0700 Subject: [PATCH] panfrost: Fix variant selection Fixes 1acffb ("panfrost: Unify...") Signed-off-by: Alyssa Rosenzweig --- src/gallium/drivers/panfrost/pan_context.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c index d178a0f1db2..2f7ab8d5316 100644 --- a/src/gallium/drivers/panfrost/pan_context.c +++ b/src/gallium/drivers/panfrost/pan_context.c @@ -1796,11 +1796,16 @@ panfrost_bind_sampler_states( } static bool -panfrost_variant_matches(struct panfrost_context *ctx, struct panfrost_shader_state *variant) +panfrost_variant_matches( + struct panfrost_context *ctx, + struct panfrost_shader_state *variant, + enum pipe_shader_type type) { struct pipe_alpha_state *alpha = &ctx->depth_stencil->alpha; - if (alpha->enabled || variant->alpha_state.enabled) { + bool is_fragment = (type == PIPE_SHADER_FRAGMENT); + + if (is_fragment && (alpha->enabled || variant->alpha_state.enabled)) { /* Make sure enable state is at least the same */ if (alpha->enabled != variant->alpha_state.enabled) { return false; @@ -1830,6 +1835,7 @@ panfrost_bind_shader_state( ctx->fs = hwcso; ctx->dirty |= PAN_DIRTY_FS; } else { + assert(type == PIPE_SHADER_VERTEX); ctx->vs = hwcso; ctx->dirty |= PAN_DIRTY_VS; } @@ -1842,7 +1848,7 @@ panfrost_bind_shader_state( struct panfrost_shader_variants *variants = (struct panfrost_shader_variants *) hwcso; for (unsigned i = 0; i < variants->variant_count; ++i) { - if (panfrost_variant_matches(ctx, &variants->variants[i])) { + if (panfrost_variant_matches(ctx, &variants->variants[i], type)) { variant = i; break; } @@ -1871,7 +1877,7 @@ panfrost_bind_shader_state( variants->active_variant = variant; struct panfrost_shader_state *shader_state = &variants->variants[variant]; - assert(panfrost_variant_matches(ctx, shader_state)); + assert(panfrost_variant_matches(ctx, shader_state, type)); /* We finally have a variant, so compile it */ -- 2.30.2