Module: Mesa
Branch: main
Commit: 3e405afeb9c1cb1182f83e2a1fd6f0beb199df64
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=3e405afeb9c1cb1182f83e2a1fd6f0beb199df64

Author: Icecream95 <[email protected]>
Date:   Thu Oct 14 16:38:38 2021 +1300

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: 53ef20f08d4 ("panfrost: Handle NULL sampler views")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15366>

---

 src/gallium/drivers/panfrost/pan_cmdstream.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/panfrost/pan_cmdstream.c 
b/src/gallium/drivers/panfrost/pan_cmdstream.c
index 6471bd04a5b..80400404cda 100644
--- a/src/gallium/drivers/panfrost/pan_cmdstream.c
+++ b/src/gallium/drivers/panfrost/pan_cmdstream.c
@@ -1401,13 +1401,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);
 

Reply via email to