asahi: Skip LOD bias lowering for GLES

This reduces silliness in Dolphin ubershaders by eliminating the double
lowering. It also makes the GLES shader assembly nicer to read.

Dolphin ubershader performance at 4K on MMG improved by about 0.5%. Not massive,
but definitely noticeable and reduces the delta to macOS.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25052>
This commit is contained in:
Alyssa Rosenzweig
2023-09-04 09:44:08 -04:00
committed by Marge Bot
parent 2adb0f31fc
commit 07cb81f0fc
3 changed files with 11 additions and 4 deletions
+2
View File
@@ -1527,6 +1527,8 @@ agx_create_context(struct pipe_screen *screen, void *priv, unsigned flags)
/* By default all samples are enabled */
ctx->sample_mask = ~0;
ctx->support_lod_bias = !(flags & PIPE_CONTEXT_NO_LOD_BIAS);
return pctx;
}
+6 -4
View File
@@ -1718,7 +1718,7 @@ agx_get_shader_variant(struct agx_screen *screen,
static void
agx_shader_initialize(struct agx_device *dev, struct agx_uncompiled_shader *so,
nir_shader *nir)
nir_shader *nir, bool support_lod_bias)
{
if (nir->info.stage == MESA_SHADER_KERNEL)
nir->info.stage = MESA_SHADER_COMPUTE;
@@ -1756,7 +1756,7 @@ agx_shader_initialize(struct agx_device *dev, struct agx_uncompiled_shader *so,
}
bool allow_mediump = !(dev->debug & AGX_DBG_NO16);
agx_preprocess_nir(nir, true, allow_mediump, &so->info);
agx_preprocess_nir(nir, support_lod_bias, allow_mediump, &so->info);
blob_init(&so->serialized_nir);
nir_serialize(&so->serialized_nir, nir, true);
@@ -1770,6 +1770,7 @@ static void *
agx_create_shader_state(struct pipe_context *pctx,
const struct pipe_shader_state *cso)
{
struct agx_context *ctx = agx_context(pctx);
struct agx_uncompiled_shader *so =
rzalloc(NULL, struct agx_uncompiled_shader);
struct agx_device *dev = agx_device(pctx->screen);
@@ -1791,7 +1792,7 @@ agx_create_shader_state(struct pipe_context *pctx,
asahi_fs_shader_key_equal);
}
agx_shader_initialize(dev, so, nir);
agx_shader_initialize(dev, so, nir, ctx->support_lod_bias);
/* We're done with the NIR, throw it away */
ralloc_free(nir);
@@ -1847,6 +1848,7 @@ static void *
agx_create_compute_state(struct pipe_context *pctx,
const struct pipe_compute_state *cso)
{
struct agx_context *ctx = agx_context(pctx);
struct agx_device *dev = agx_device(pctx->screen);
struct agx_uncompiled_shader *so =
rzalloc(NULL, struct agx_uncompiled_shader);
@@ -1862,7 +1864,7 @@ agx_create_compute_state(struct pipe_context *pctx,
assert(cso->ir_type == PIPE_SHADER_IR_NIR && "TGSI kernels unsupported");
nir_shader *nir = (void *)cso->prog;
agx_shader_initialize(dev, so, nir);
agx_shader_initialize(dev, so, nir, ctx->support_lod_bias);
agx_get_shader_variant(agx_screen(pctx->screen), so, &pctx->debug, &key);
/* We're done with the NIR, throw it away */
+3
View File
@@ -393,6 +393,9 @@ struct agx_context {
struct agx_compiled_shader *vs, *fs;
uint32_t dirty;
/* Acts as a context-level shader key */
bool support_lod_bias;
/* Set of batches. When full, the LRU entry (the batch with the smallest
* seqnum) is flushed to free a slot.
*/