summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlyssa Rosenzweig <[email protected]>2019-06-14 10:12:38 -0700
committerAlyssa Rosenzweig <[email protected]>2019-06-14 10:35:07 -0700
commit9ab8d31f32ba557ed33dd7c41b40dd565067b12c (patch)
tree7ecc0b960f2b83e2ef98d5a82ee8f4b5b3dff1a9
parentabe9a51d27049971c77a0072693511caf9b793e2 (diff)
panfrost: Fix variant selection
Fixes 1acffb ("panfrost: Unify...") Signed-off-by: Alyssa Rosenzweig <[email protected]>
-rw-r--r--src/gallium/drivers/panfrost/pan_context.c14
1 files 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 */