diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c index f8acbbacfe4..0d1249b76b4 100644 --- a/src/intel/vulkan/anv_device.c +++ b/src/intel/vulkan/anv_device.c @@ -4222,108 +4222,6 @@ void anv_GetBufferMemoryRequirements2( } } -void anv_GetImageMemoryRequirements2( - VkDevice _device, - const VkImageMemoryRequirementsInfo2* pInfo, - VkMemoryRequirements2* pMemoryRequirements) -{ - ANV_FROM_HANDLE(anv_device, device, _device); - ANV_FROM_HANDLE(anv_image, image, pInfo->image); - - /* The Vulkan spec (git aaed022) says: - * - * memoryTypeBits is a bitfield and contains one bit set for every - * supported memory type for the resource. The bit `1<physical->memory.type_count) - 1; - - pMemoryRequirements->memoryRequirements.size = image->size; - pMemoryRequirements->memoryRequirements.alignment = image->alignment; - pMemoryRequirements->memoryRequirements.memoryTypeBits = memory_types; - - vk_foreach_struct_const(ext, pInfo->pNext) { - switch (ext->sType) { - case VK_STRUCTURE_TYPE_IMAGE_PLANE_MEMORY_REQUIREMENTS_INFO: { - const VkImagePlaneMemoryRequirementsInfo *plane_reqs = - (const VkImagePlaneMemoryRequirementsInfo *) ext; - uint32_t plane = anv_image_aspect_to_plane(image->aspects, - plane_reqs->planeAspect); - - assert(image->planes[plane].offset == 0); - - /* The Vulkan spec (git aaed022) says: - * - * memoryTypeBits is a bitfield and contains one bit set for every - * supported memory type for the resource. The bit `1<memoryRequirements.memoryTypeBits = - (1ull << device->physical->memory.type_count) - 1; - - pMemoryRequirements->memoryRequirements.size = image->planes[plane].size; - pMemoryRequirements->memoryRequirements.alignment = - image->planes[plane].alignment; - break; - } - - default: - anv_debug_ignored_stype(ext->sType); - break; - } - } - - vk_foreach_struct(ext, pMemoryRequirements->pNext) { - switch (ext->sType) { - case VK_STRUCTURE_TYPE_MEMORY_DEDICATED_REQUIREMENTS: { - VkMemoryDedicatedRequirements *requirements = (void *)ext; - if (image->needs_set_tiling || image->external_format) { - /* If we need to set the tiling for external consumers, we need a - * dedicated allocation. - * - * See also anv_AllocateMemory. - */ - requirements->prefersDedicatedAllocation = true; - requirements->requiresDedicatedAllocation = true; - } else { - requirements->prefersDedicatedAllocation = false; - requirements->requiresDedicatedAllocation = false; - } - break; - } - - default: - anv_debug_ignored_stype(ext->sType); - break; - } - } -} - -void anv_GetImageSparseMemoryRequirements( - VkDevice device, - VkImage image, - uint32_t* pSparseMemoryRequirementCount, - VkSparseImageMemoryRequirements* pSparseMemoryRequirements) -{ - *pSparseMemoryRequirementCount = 0; -} - -void anv_GetImageSparseMemoryRequirements2( - VkDevice device, - const VkImageSparseMemoryRequirementsInfo2* pInfo, - uint32_t* pSparseMemoryRequirementCount, - VkSparseImageMemoryRequirements2* pSparseMemoryRequirements) -{ - *pSparseMemoryRequirementCount = 0; -} - void anv_GetDeviceMemoryCommitment( VkDevice device, VkDeviceMemory memory, diff --git a/src/intel/vulkan/anv_image.c b/src/intel/vulkan/anv_image.c index f28729b95da..2a312f86980 100644 --- a/src/intel/vulkan/anv_image.c +++ b/src/intel/vulkan/anv_image.c @@ -1087,6 +1087,108 @@ resolve_ahw_image(struct anv_device *device, #endif } +void anv_GetImageMemoryRequirements2( + VkDevice _device, + const VkImageMemoryRequirementsInfo2* pInfo, + VkMemoryRequirements2* pMemoryRequirements) +{ + ANV_FROM_HANDLE(anv_device, device, _device); + ANV_FROM_HANDLE(anv_image, image, pInfo->image); + + /* The Vulkan spec (git aaed022) says: + * + * memoryTypeBits is a bitfield and contains one bit set for every + * supported memory type for the resource. The bit `1<physical->memory.type_count) - 1; + + pMemoryRequirements->memoryRequirements.size = image->size; + pMemoryRequirements->memoryRequirements.alignment = image->alignment; + pMemoryRequirements->memoryRequirements.memoryTypeBits = memory_types; + + vk_foreach_struct_const(ext, pInfo->pNext) { + switch (ext->sType) { + case VK_STRUCTURE_TYPE_IMAGE_PLANE_MEMORY_REQUIREMENTS_INFO: { + const VkImagePlaneMemoryRequirementsInfo *plane_reqs = + (const VkImagePlaneMemoryRequirementsInfo *) ext; + uint32_t plane = anv_image_aspect_to_plane(image->aspects, + plane_reqs->planeAspect); + + assert(image->planes[plane].offset == 0); + + /* The Vulkan spec (git aaed022) says: + * + * memoryTypeBits is a bitfield and contains one bit set for every + * supported memory type for the resource. The bit `1<memoryRequirements.memoryTypeBits = + (1ull << device->physical->memory.type_count) - 1; + + pMemoryRequirements->memoryRequirements.size = image->planes[plane].size; + pMemoryRequirements->memoryRequirements.alignment = + image->planes[plane].alignment; + break; + } + + default: + anv_debug_ignored_stype(ext->sType); + break; + } + } + + vk_foreach_struct(ext, pMemoryRequirements->pNext) { + switch (ext->sType) { + case VK_STRUCTURE_TYPE_MEMORY_DEDICATED_REQUIREMENTS: { + VkMemoryDedicatedRequirements *requirements = (void *)ext; + if (image->needs_set_tiling || image->external_format) { + /* If we need to set the tiling for external consumers, we need a + * dedicated allocation. + * + * See also anv_AllocateMemory. + */ + requirements->prefersDedicatedAllocation = true; + requirements->requiresDedicatedAllocation = true; + } else { + requirements->prefersDedicatedAllocation = false; + requirements->requiresDedicatedAllocation = false; + } + break; + } + + default: + anv_debug_ignored_stype(ext->sType); + break; + } + } +} + +void anv_GetImageSparseMemoryRequirements( + VkDevice device, + VkImage image, + uint32_t* pSparseMemoryRequirementCount, + VkSparseImageMemoryRequirements* pSparseMemoryRequirements) +{ + *pSparseMemoryRequirementCount = 0; +} + +void anv_GetImageSparseMemoryRequirements2( + VkDevice device, + const VkImageSparseMemoryRequirementsInfo2* pInfo, + uint32_t* pSparseMemoryRequirementCount, + VkSparseImageMemoryRequirements2* pSparseMemoryRequirements) +{ + *pSparseMemoryRequirementCount = 0; +} + VkResult anv_BindImageMemory2( VkDevice _device, uint32_t bindInfoCount,