From badcfc164d5f51754e501607fd227eaba98f25e5 Mon Sep 17 00:00:00 2001 From: Lionel Landwerlin Date: Sat, 6 Jul 2024 15:51:44 +0300 Subject: [PATCH] anv: handle preprocess buffer creation on <= Gfx12.0 Signed-off-by: Lionel Landwerlin Acked-by: Alyssa Rosenzweig Part-of: --- src/intel/vulkan/anv_buffer.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/intel/vulkan/anv_buffer.c b/src/intel/vulkan/anv_buffer.c index c84036a652e..7bb3ed3c8e3 100644 --- a/src/intel/vulkan/anv_buffer.c +++ b/src/intel/vulkan/anv_buffer.c @@ -72,14 +72,24 @@ anv_get_buffer_memory_requirements(struct anv_device *device, * only if the memory type `i` in the VkPhysicalDeviceMemoryProperties * structure for the physical device is supported. * - * We have special memory types for descriptor buffers. + * Descriptors buffers need to be in the dynamic visible heap (for the + * SAMPLER_STATE). + * + * Preprocess buffers containing INTERFACE_DESCRIPTOR_DATA structures also + * need to be there (those structures are indexed from the dynamic state + * heap). */ + bool need_dynamic_visible_buffer = + (usage & (VK_BUFFER_USAGE_2_RESOURCE_DESCRIPTOR_BUFFER_BIT_EXT | + VK_BUFFER_USAGE_2_SAMPLER_DESCRIPTOR_BUFFER_BIT_EXT | + VK_BUFFER_USAGE_2_DESCRIPTOR_HEAP_BIT_EXT)) || + (device->info->verx10 <= 120 && + (usage & VK_BUFFER_USAGE_2_PREPROCESS_BUFFER_BIT_EXT)); + uint32_t memory_types; if (flags & VK_BUFFER_CREATE_PROTECTED_BIT) memory_types = device->physical->memory.protected_mem_types; - else if (usage & (VK_BUFFER_USAGE_2_RESOURCE_DESCRIPTOR_BUFFER_BIT_EXT | - VK_BUFFER_USAGE_2_SAMPLER_DESCRIPTOR_BUFFER_BIT_EXT | - VK_BUFFER_USAGE_2_DESCRIPTOR_HEAP_BIT_EXT)) + else if (need_dynamic_visible_buffer) memory_types = device->physical->memory.dynamic_visible_mem_types; else if (device->physical->instance->enable_buffer_comp) memory_types = device->physical->memory.default_buffer_mem_types |