From: Ian Romanick Date: Mon, 6 Feb 2023 17:41:36 +0000 (-0800) Subject: lavapipe: Fix bad array index scale factor in lvp_inline_uniforms pass X-Git-Tag: upstream/22.3.5~13 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c52859394049e286293ef09df00cfccef5f569ee;p=platform%2Fupstream%2Fmesa.git lavapipe: Fix bad array index scale factor in lvp_inline_uniforms pass A few lines earlier uni_offsets is accessed with ubo scaled by PIPE_MAX_CONSTANT_BUFFERS: if (uni_offsets[ubo * PIPE_MAX_CONSTANT_BUFFERS + i] == offset) Found by inspection. Looking at the before and after NIR code for dEQP-VK.graphicsfuzz.cov-int-initialize-from-multiple-large-arrays, using the correct indexing appears to enable the pass to inline an additional uniform. My guess is that when a uniform is used more than once, the first loop wouldn't find the offset recored in the table because it was recorded at the wrong location. Fixes: d23a9380dd6 ("lavapipe: implement extreme uniform inlining") Reviewed-By: Mike Blumenkrantz Part-of: (cherry picked from commit a7696a4d98bcf4cdfae1c56a21c4deb3a9ce004f) --- diff --git a/.pick_status.json b/.pick_status.json index 3d30194..80ed521 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -706,7 +706,7 @@ "description": "lavapipe: Fix bad array index scale factor in lvp_inline_uniforms pass", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "d23a9380dd601be65ba97192d8101c9c9bb13cd4" }, diff --git a/src/gallium/frontends/lavapipe/lvp_inline_uniforms.c b/src/gallium/frontends/lavapipe/lvp_inline_uniforms.c index 76c0b51..1afb29b 100644 --- a/src/gallium/frontends/lavapipe/lvp_inline_uniforms.c +++ b/src/gallium/frontends/lavapipe/lvp_inline_uniforms.c @@ -101,7 +101,7 @@ src_only_uses_uniforms(const nir_src *src, int component, /* Record the uniform offset. */ if (uni_offsets) - uni_offsets[ubo * MAX_INLINABLE_UNIFORMS + num_offsets[ubo]++] = offset; + uni_offsets[ubo * PIPE_MAX_CONSTANT_BUFFERS + num_offsets[ubo]++] = offset; return true; } return false;