panfrost: Don't initialise the trampolines array

PIPE_MAX_SHADER_SAMPLER_VIEWS is 128, so we just end up initialising a
kilobyte of memory for no reason, when usually only a couple of
sampler views are used.

Fixes: 53ef20f08d ("panfrost: Handle NULL sampler views")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15366>
(cherry picked from commit 3e405afeb9)
This commit is contained in:
Icecream95 2021-10-14 16:38:38 +13:00 committed by Dylan Baker
parent 9c93c285ff
commit 1dc2900731
2 changed files with 5 additions and 3 deletions

View file

@ -13,7 +13,7 @@
"description": "panfrost: Don't initialise the trampolines array",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "53ef20f08d4340c1bad0b45a2501f4daba7fb479"
},

View file

@ -1387,13 +1387,15 @@ panfrost_emit_texture_descriptors(struct panfrost_batch *batch,
return T.gpu;
#else
uint64_t trampolines[PIPE_MAX_SHADER_SAMPLER_VIEWS] = { 0 };
uint64_t trampolines[PIPE_MAX_SHADER_SAMPLER_VIEWS];
for (int i = 0; i < ctx->sampler_view_count[stage]; ++i) {
struct panfrost_sampler_view *view = ctx->sampler_views[stage][i];
if (!view)
if (!view) {
trampolines[i] = 0;
continue;
}
panfrost_update_sampler_view(view, &ctx->base);