panfrost: Make fixed_varying_mask a fragment-only key
This makes it clear that there are no VS variants. Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19363>
This commit is contained in:

committed by
Marge Bot

parent
6d6f25e97e
commit
b290ac960b
@@ -3424,7 +3424,7 @@ panfrost_emit_malloc_vertex(struct panfrost_batch *batch,
|
|||||||
unsigned v = vs->info.varyings.output_count;
|
unsigned v = vs->info.varyings.output_count;
|
||||||
unsigned f = fs->info.varyings.input_count;
|
unsigned f = fs->info.varyings.input_count;
|
||||||
unsigned slots = MAX2(v, f);
|
unsigned slots = MAX2(v, f);
|
||||||
slots += util_bitcount(fs->key.fixed_varying_mask);
|
slots += util_bitcount(fs->key.fs.fixed_varying_mask);
|
||||||
unsigned size = slots * 16;
|
unsigned size = slots * 16;
|
||||||
|
|
||||||
/* Assumes 16 byte slots. We could do better. */
|
/* Assumes 16 byte slots. We could do better. */
|
||||||
|
@@ -263,6 +263,9 @@ struct panfrost_fs_key {
|
|||||||
/* Number of colour buffers */
|
/* Number of colour buffers */
|
||||||
unsigned nr_cbufs;
|
unsigned nr_cbufs;
|
||||||
|
|
||||||
|
/* On Valhall, fixed_varying_mask of the linked vertex shader */
|
||||||
|
uint32_t fixed_varying_mask;
|
||||||
|
|
||||||
/* Midgard shaders that read the tilebuffer must be keyed for
|
/* Midgard shaders that read the tilebuffer must be keyed for
|
||||||
* non-blendable formats
|
* non-blendable formats
|
||||||
*/
|
*/
|
||||||
@@ -276,9 +279,6 @@ struct panfrost_fs_key {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct panfrost_shader_key {
|
struct panfrost_shader_key {
|
||||||
/* Valhall needs special handling for desktop GL varyings */
|
|
||||||
uint32_t fixed_varying_mask;
|
|
||||||
|
|
||||||
/* If we need vertex shader keys, union it in */
|
/* If we need vertex shader keys, union it in */
|
||||||
struct panfrost_fs_key fs;
|
struct panfrost_fs_key fs;
|
||||||
};
|
};
|
||||||
|
@@ -60,7 +60,8 @@ panfrost_shader_compile(struct pipe_screen *pscreen,
|
|||||||
const nir_shader *ir,
|
const nir_shader *ir,
|
||||||
struct util_debug_callback *dbg,
|
struct util_debug_callback *dbg,
|
||||||
struct panfrost_compiled_shader *state,
|
struct panfrost_compiled_shader *state,
|
||||||
unsigned req_local_mem)
|
unsigned req_local_mem,
|
||||||
|
unsigned fixed_varying_mask)
|
||||||
{
|
{
|
||||||
struct panfrost_screen *screen = pan_screen(pscreen);
|
struct panfrost_screen *screen = pan_screen(pscreen);
|
||||||
struct panfrost_device *dev = pan_device(pscreen);
|
struct panfrost_device *dev = pan_device(pscreen);
|
||||||
@@ -74,14 +75,22 @@ panfrost_shader_compile(struct pipe_screen *pscreen,
|
|||||||
xfb->info.internal = true;
|
xfb->info.internal = true;
|
||||||
|
|
||||||
state->xfb = calloc(1, sizeof(struct panfrost_compiled_shader));
|
state->xfb = calloc(1, sizeof(struct panfrost_compiled_shader));
|
||||||
panfrost_shader_compile(pscreen, shader_pool, desc_pool, xfb, dbg, state->xfb, 0);
|
panfrost_shader_compile(pscreen, shader_pool, desc_pool, xfb, dbg, state->xfb, 0, fixed_varying_mask);
|
||||||
|
|
||||||
/* Main shader no longer uses XFB */
|
/* Main shader no longer uses XFB */
|
||||||
s->info.has_transform_feedback_varyings = false;
|
s->info.has_transform_feedback_varyings = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct panfrost_compile_inputs inputs = {
|
||||||
|
.debug = dbg,
|
||||||
|
.gpu_id = dev->gpu_id,
|
||||||
|
.fixed_sysval_ubo = -1,
|
||||||
|
};
|
||||||
|
|
||||||
/* Lower this early so the backends don't have to worry about it */
|
/* Lower this early so the backends don't have to worry about it */
|
||||||
if (s->info.stage == MESA_SHADER_FRAGMENT) {
|
if (s->info.stage == MESA_SHADER_FRAGMENT) {
|
||||||
|
inputs.fixed_varying_mask = state->key.fs.fixed_varying_mask;
|
||||||
|
|
||||||
NIR_PASS_V(s, nir_lower_fragcolor, state->key.fs.nr_cbufs);
|
NIR_PASS_V(s, nir_lower_fragcolor, state->key.fs.nr_cbufs);
|
||||||
|
|
||||||
if (state->key.fs.sprite_coord_enable) {
|
if (state->key.fs.sprite_coord_enable) {
|
||||||
@@ -96,22 +105,15 @@ panfrost_shader_compile(struct pipe_screen *pscreen,
|
|||||||
state->key.fs.clip_plane_enable,
|
state->key.fs.clip_plane_enable,
|
||||||
false);
|
false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
memcpy(inputs.rt_formats, state->key.fs.rt_formats, sizeof(inputs.rt_formats));
|
||||||
|
} else if (s->info.stage == MESA_SHADER_VERTEX) {
|
||||||
|
inputs.fixed_varying_mask = fixed_varying_mask;
|
||||||
|
|
||||||
|
/* No IDVS for internal XFB shaders */
|
||||||
|
inputs.no_idvs = s->info.has_transform_feedback_varyings;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Call out to Midgard compiler given the above NIR */
|
|
||||||
struct panfrost_compile_inputs inputs = {
|
|
||||||
.debug = dbg,
|
|
||||||
.gpu_id = dev->gpu_id,
|
|
||||||
.fixed_sysval_ubo = -1,
|
|
||||||
.fixed_varying_mask = state->key.fixed_varying_mask
|
|
||||||
};
|
|
||||||
|
|
||||||
/* No IDVS for internal XFB shaders */
|
|
||||||
if (s->info.stage == MESA_SHADER_VERTEX && s->info.has_transform_feedback_varyings)
|
|
||||||
inputs.no_idvs = true;
|
|
||||||
|
|
||||||
memcpy(inputs.rt_formats, state->key.fs.rt_formats, sizeof(inputs.rt_formats));
|
|
||||||
|
|
||||||
struct util_dynarray binary;
|
struct util_dynarray binary;
|
||||||
|
|
||||||
util_dynarray_init(&binary, NULL);
|
util_dynarray_init(&binary, NULL);
|
||||||
@@ -186,7 +188,7 @@ panfrost_build_key(struct panfrost_context *ctx,
|
|||||||
/* Funny desktop GL varying lowering on Valhall */
|
/* Funny desktop GL varying lowering on Valhall */
|
||||||
if (dev->arch >= 9) {
|
if (dev->arch >= 9) {
|
||||||
assert(vs != NULL && "too early");
|
assert(vs != NULL && "too early");
|
||||||
key->fixed_varying_mask = vs->fixed_varying_mask;
|
key->fs.fixed_varying_mask = vs->fixed_varying_mask;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -243,8 +245,9 @@ panfrost_new_variant_locked(
|
|||||||
};
|
};
|
||||||
|
|
||||||
panfrost_shader_compile(ctx->base.screen,
|
panfrost_shader_compile(ctx->base.screen,
|
||||||
&ctx->shaders, &ctx->descs,
|
&ctx->shaders, &ctx->descs, uncompiled->nir,
|
||||||
uncompiled->nir, &ctx->base.debug, prog, 0);
|
&ctx->base.debug, prog, 0,
|
||||||
|
uncompiled->fixed_varying_mask);
|
||||||
|
|
||||||
/* Fixup the stream out information */
|
/* Fixup the stream out information */
|
||||||
prog->so_mask =
|
prog->so_mask =
|
||||||
@@ -295,10 +298,7 @@ panfrost_update_shader_variant(struct panfrost_context *ctx,
|
|||||||
|
|
||||||
simple_mtx_lock(&uncompiled->lock);
|
simple_mtx_lock(&uncompiled->lock);
|
||||||
|
|
||||||
struct panfrost_shader_key key = {
|
struct panfrost_shader_key key = { 0 };
|
||||||
.fixed_varying_mask = uncompiled->fixed_varying_mask
|
|
||||||
};
|
|
||||||
|
|
||||||
panfrost_build_key(ctx, &key, uncompiled->nir);
|
panfrost_build_key(ctx, &key, uncompiled->nir);
|
||||||
|
|
||||||
util_dynarray_foreach(&uncompiled->variants, struct panfrost_compiled_shader, so) {
|
util_dynarray_foreach(&uncompiled->variants, struct panfrost_compiled_shader, so) {
|
||||||
@@ -365,7 +365,8 @@ panfrost_create_shader_state(
|
|||||||
|
|
||||||
panfrost_shader_compile(pctx->screen,
|
panfrost_shader_compile(pctx->screen,
|
||||||
&ctx->shaders, &ctx->descs,
|
&ctx->shaders, &ctx->descs,
|
||||||
so->nir, &ctx->base.debug, &state, 0);
|
so->nir, &ctx->base.debug, &state, 0,
|
||||||
|
so->fixed_varying_mask);
|
||||||
}
|
}
|
||||||
|
|
||||||
return so;
|
return so;
|
||||||
@@ -417,7 +418,7 @@ panfrost_create_compute_state(
|
|||||||
|
|
||||||
panfrost_shader_compile(pctx->screen, &ctx->shaders, &ctx->descs,
|
panfrost_shader_compile(pctx->screen, &ctx->shaders, &ctx->descs,
|
||||||
cso->prog, &ctx->base.debug, v,
|
cso->prog, &ctx->base.debug, v,
|
||||||
cso->req_local_mem);
|
cso->req_local_mem, 0);
|
||||||
|
|
||||||
return so;
|
return so;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user