}
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;
ctx->fs = hwcso;
ctx->dirty |= PAN_DIRTY_FS;
} else {
+ assert(type == PIPE_SHADER_VERTEX);
ctx->vs = hwcso;
ctx->dirty |= PAN_DIRTY_VS;
}
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;
}
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 */