From 6dcad8a13b31bc8c28bdbee1e761fdb84c3b510b Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 3 Oct 2022 15:18:31 -0600 Subject: [PATCH] lavapipe: zero-init sampler objects The cso code hashes these as a block of bytes. This silences some Valgrind uninitialized memory warnings and possibly avoids creating some redundant sampler instances. Signed-off-by: Brian Paul Reviewed-by: Roland Scheidegger Part-of: --- src/gallium/frontends/lavapipe/lvp_device.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gallium/frontends/lavapipe/lvp_device.c b/src/gallium/frontends/lavapipe/lvp_device.c index 8feec139a02..94d88abcec6 100644 --- a/src/gallium/frontends/lavapipe/lvp_device.c +++ b/src/gallium/frontends/lavapipe/lvp_device.c @@ -2223,8 +2223,8 @@ VKAPI_ATTR VkResult VKAPI_CALL lvp_CreateSampler( assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO); - sampler = vk_alloc2(&device->vk.alloc, pAllocator, sizeof(*sampler), 8, - VK_SYSTEM_ALLOCATION_SCOPE_OBJECT); + sampler = vk_zalloc2(&device->vk.alloc, pAllocator, sizeof(*sampler), 8, + VK_SYSTEM_ALLOCATION_SCOPE_OBJECT); if (!sampler) return vk_error(device, VK_ERROR_OUT_OF_HOST_MEMORY);