asahi: Move agx_preprocess_nir to CSO create

Now we preprocess shaders once at link time, rather than every time we spawn a
variant. This should reduce variant pain.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21104>
This commit is contained in:
Alyssa Rosenzweig
2022-12-17 23:08:48 -05:00
committed by Marge Bot
parent 4495f85b08
commit 2adea481f1
+2 -2
View File
@@ -1370,8 +1370,6 @@ agx_compile_variant(struct agx_device *dev, struct agx_uncompiled_shader *so,
nir_shader *nir = nir_shader_clone(NULL, so->nir);
agx_preprocess_nir(nir);
if (nir->info.stage == MESA_SHADER_VERTEX) {
struct asahi_vs_shader_key *key = &key_->vs;
@@ -1503,6 +1501,7 @@ agx_create_shader_state(struct pipe_context *pctx,
blob_finish(&blob);
so->nir = nir;
agx_preprocess_nir(nir);
/* For shader-db, precompile a shader with a default key. This could be
* improved but hopefully this is acceptable for now.
@@ -1564,6 +1563,7 @@ agx_create_compute_state(struct pipe_context *pctx,
blob_finish(&blob);
so->nir = nir;
agx_preprocess_nir(nir);
agx_get_shader_variant(agx_screen(pctx->screen), so, &pctx->debug, &key);
/* We're done with the NIR, throw it away */