mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-14 14:28:08 +02:00
panfrost: Fix variant selection
Fixes 1acffb ("panfrost: Unify...")
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
This commit is contained in:
parent
abe9a51d27
commit
9ab8d31f32
1 changed files with 10 additions and 4 deletions
|
|
@ -1796,11 +1796,16 @@ panfrost_bind_sampler_states(
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
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;
|
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 */
|
/* Make sure enable state is at least the same */
|
||||||
if (alpha->enabled != variant->alpha_state.enabled) {
|
if (alpha->enabled != variant->alpha_state.enabled) {
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -1830,6 +1835,7 @@ panfrost_bind_shader_state(
|
||||||
ctx->fs = hwcso;
|
ctx->fs = hwcso;
|
||||||
ctx->dirty |= PAN_DIRTY_FS;
|
ctx->dirty |= PAN_DIRTY_FS;
|
||||||
} else {
|
} else {
|
||||||
|
assert(type == PIPE_SHADER_VERTEX);
|
||||||
ctx->vs = hwcso;
|
ctx->vs = hwcso;
|
||||||
ctx->dirty |= PAN_DIRTY_VS;
|
ctx->dirty |= PAN_DIRTY_VS;
|
||||||
}
|
}
|
||||||
|
|
@ -1842,7 +1848,7 @@ panfrost_bind_shader_state(
|
||||||
struct panfrost_shader_variants *variants = (struct panfrost_shader_variants *) hwcso;
|
struct panfrost_shader_variants *variants = (struct panfrost_shader_variants *) hwcso;
|
||||||
|
|
||||||
for (unsigned i = 0; i < variants->variant_count; ++i) {
|
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;
|
variant = i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -1871,7 +1877,7 @@ panfrost_bind_shader_state(
|
||||||
variants->active_variant = variant;
|
variants->active_variant = variant;
|
||||||
|
|
||||||
struct panfrost_shader_state *shader_state = &variants->variants[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 */
|
/* We finally have a variant, so compile it */
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue