Mesa (master): anv: ensure prog params are initialized with 0s

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Jan 22 15:28:54 UTC 2020


Module: Mesa
Branch: master
Commit: 63461cb7e13fa544a081414b8a0a6e69e66e90d0
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=63461cb7e13fa544a081414b8a0a6e69e66e90d0

Author: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Date:   Wed Jan 22 15:49:25 2020 +0200

anv: ensure prog params are initialized with 0s

As a result of 9baa33cef01f our backend compiler leaves params pretty
much untouched. So in order to avoid storing uninitialized values in
the shader cache blobs, just 0 out this array.

I've considered not even allocating this array which works on gen8+
but the vec4 backend still makes a copy of this array and so it
crashes on memcpy on HSW.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Fixes: 9baa33cef01f ("anv: Rework push constant handling")
Reported-by: Tapani Pälli <tapani.palli at intel.com>
Acked-by: Jason Ekstrand <jason at jlekstrand.net>
Acked-by: Tapani Pälli <tapani.palli at intel.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3516>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3516>

---

 src/intel/vulkan/anv_nir_compute_push_layout.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/intel/vulkan/anv_nir_compute_push_layout.c b/src/intel/vulkan/anv_nir_compute_push_layout.c
index 3a6e393672d..1dbfb08a100 100644
--- a/src/intel/vulkan/anv_nir_compute_push_layout.c
+++ b/src/intel/vulkan/anv_nir_compute_push_layout.c
@@ -106,7 +106,7 @@ anv_nir_compute_push_layout(const struct anv_physical_device *pdevice,
       pdevice->compiler->scalar_stage[nir->info.stage] ? 4 : 16;
    nir->num_uniforms = ALIGN(push_end - push_start, align);
    prog_data->nr_params = nir->num_uniforms / 4;
-   prog_data->param = ralloc_array(mem_ctx, uint32_t, prog_data->nr_params);
+   prog_data->param = rzalloc_array(mem_ctx, uint32_t, prog_data->nr_params);
 
    struct anv_push_range push_constant_range = {
       .set = ANV_DESCRIPTOR_SET_PUSH_CONSTANTS,



More information about the mesa-commit mailing list