diff --git a/src/amd/vulkan/layers/radv_rra_layer.c b/src/amd/vulkan/layers/radv_rra_layer.c index 7ceaaa62a8c..22ca36e3a9d 100644 --- a/src/amd/vulkan/layers/radv_rra_layer.c +++ b/src/amd/vulkan/layers/radv_rra_layer.c @@ -112,19 +112,6 @@ rra_QueuePresentKHR(VkQueue _queue, const VkPresentInfoKHR *pPresentInfo) return VK_SUCCESS; } -static uint32_t -find_memory_index(VkDevice _device, VkMemoryPropertyFlags flags) -{ - RADV_FROM_HANDLE(radv_device, device, _device); - VkPhysicalDeviceMemoryProperties *mem_properties = &device->physical_device->memory_properties; - for (uint32_t i = 0; i < mem_properties->memoryTypeCount; ++i) { - if (mem_properties->memoryTypes[i].propertyFlags == flags) { - return i; - } - } - unreachable("invalid memory properties"); -} - static VkResult rra_init_accel_struct_data_buffer(VkDevice vk_device, struct radv_rra_accel_struct_data *data) { @@ -150,9 +137,10 @@ rra_init_accel_struct_data_buffer(VkDevice vk_device, struct radv_rra_accel_stru .sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO, .pNext = &flags_info, .allocationSize = requirements.size, - .memoryTypeIndex = find_memory_index(vk_device, VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | - VK_MEMORY_PROPERTY_HOST_COHERENT_BIT | - VK_MEMORY_PROPERTY_HOST_CACHED_BIT), + .memoryTypeIndex = + radv_find_memory_index(device->physical_device, VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | + VK_MEMORY_PROPERTY_HOST_COHERENT_BIT | + VK_MEMORY_PROPERTY_HOST_CACHED_BIT), }; result = radv_alloc_memory(device, &alloc_info, NULL, &data->memory, true); if (result != VK_SUCCESS) diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c index 21fa5200ca1..d2bd2c7ae7a 100644 --- a/src/amd/vulkan/radv_device.c +++ b/src/amd/vulkan/radv_device.c @@ -338,6 +338,18 @@ radv_physical_device_init_mem_types(struct radv_physical_device *device) } } +uint32_t +radv_find_memory_index(struct radv_physical_device *pdevice, VkMemoryPropertyFlags flags) +{ + VkPhysicalDeviceMemoryProperties *mem_properties = &pdevice->memory_properties; + for (uint32_t i = 0; i < mem_properties->memoryTypeCount; ++i) { + if (mem_properties->memoryTypes[i].propertyFlags == flags) { + return i; + } + } + unreachable("invalid memory properties"); +} + static const char * radv_get_compiler_string(struct radv_physical_device *pdevice) { diff --git a/src/amd/vulkan/radv_private.h b/src/amd/vulkan/radv_private.h index c04384d6b20..3a44d9456fc 100644 --- a/src/amd/vulkan/radv_private.h +++ b/src/amd/vulkan/radv_private.h @@ -347,6 +347,8 @@ struct radv_physical_device { struct radv_perfcounter_desc *perfcounters; }; +uint32_t radv_find_memory_index(struct radv_physical_device *pdevice, VkMemoryPropertyFlags flags); + struct radv_instance { struct vk_instance vk;