diff --git a/src/gallium/frontends/lavapipe/lvp_device.c b/src/gallium/frontends/lavapipe/lvp_device.c index 4747ed941c8..057020af5d8 100644 --- a/src/gallium/frontends/lavapipe/lvp_device.c +++ b/src/gallium/frontends/lavapipe/lvp_device.c @@ -1675,6 +1675,7 @@ VKAPI_ATTR VkResult VKAPI_CALL lvp_CreateDevice( return vk_error(instance, VK_ERROR_OUT_OF_HOST_MEMORY); device->queue.state = device + 1; + device->poison_mem = debug_get_bool_option("LVP_POISON_MEMORY", false); struct vk_device_dispatch_table dispatch_table; vk_device_dispatch_table_from_entrypoints(&dispatch_table, @@ -1988,6 +1989,9 @@ VKAPI_ATTR VkResult VKAPI_CALL lvp_AllocateMemory( if (!mem->pmem) { goto fail; } + if (device->poison_mem) + /* this is a value that will definitely break things */ + memset(mem->pmem, UINT8_MAX / 2 + 1, pAllocateInfo->allocationSize); } mem->type_index = pAllocateInfo->memoryTypeIndex; diff --git a/src/gallium/frontends/lavapipe/lvp_private.h b/src/gallium/frontends/lavapipe/lvp_private.h index 32de5840fa8..5e8c8a4fa45 100644 --- a/src/gallium/frontends/lavapipe/lvp_private.h +++ b/src/gallium/frontends/lavapipe/lvp_private.h @@ -211,6 +211,7 @@ struct lvp_device { struct lvp_instance * instance; struct lvp_physical_device *physical_device; struct pipe_screen *pscreen; + bool poison_mem; }; void lvp_device_get_cache_uuid(void *uuid);