[Mesa-dev] [PATCH 07/15] anv: add support for VK_KHR_bind_memory2
Jason Ekstrand
jason at jlekstrand.net
Fri Sep 15 21:42:05 UTC 2017
So, yeah, I also sent an implementation of this one... I'm not sure which
is better. Mine just does a bit more refactoring to keep things clean. I
hadn't even though about the fact that of course you implemented it too.
--Jason
On Fri, Sep 15, 2017 at 7:10 AM, Lionel Landwerlin <
lionel.g.landwerlin at intel.com> wrote:
> Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
> ---
> src/intel/vulkan/anv_device.c | 32 ++++++++++++++++++++++++++++++++
> src/intel/vulkan/anv_extensions.py | 1 +
> src/intel/vulkan/anv_image.c | 33 +++++++++++++++++++++++++++++++++
> 3 files changed, 66 insertions(+)
>
> diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c
> index 8e2ed9eac45..4b30c0005fd 100644
> --- a/src/intel/vulkan/anv_device.c
> +++ b/src/intel/vulkan/anv_device.c
> @@ -1884,6 +1884,38 @@ VkResult anv_BindBufferMemory(
> return VK_SUCCESS;
> }
>
> +VkResult anv_BindBufferMemory2KHR(
> + VkDevice device,
> + uint32_t bindInfoCount,
> + const VkBindBufferMemoryInfoKHR* pBindInfos)
> +{
> + VkResult result = VK_SUCCESS;
> +
> + for (uint32_t i = 0; i < bindInfoCount; i++) {
> + const VkBindBufferMemoryInfoKHR *bind_info = &pBindInfos[i];
> +
> + if (bind_info->pNext == NULL) {
> + result = anv_BindBufferMemory(device, bind_info->buffer,
> + bind_info->memory,
> + bind_info->memoryOffset);
> + } else {
> + vk_foreach_struct_const(s, pBindInfos->pNext) {
> + switch (s->sType) {
> + default:
> + anv_debug_ignored_stype(s->sType);
> + break;
> + }
> + }
> + }
> +
> + /* Stop at the first error. */
> + if (result != VK_SUCCESS)
> + break;
> + }
> +
> + return result;
> +}
> +
> VkResult anv_QueueBindSparse(
> VkQueue _queue,
> uint32_t bindInfoCount,
> diff --git a/src/intel/vulkan/anv_extensions.py b/src/intel/vulkan/anv_
> extensions.py
> index acec785959b..cb0e36b7233 100644
> --- a/src/intel/vulkan/anv_extensions.py
> +++ b/src/intel/vulkan/anv_extensions.py
> @@ -45,6 +45,7 @@ class Extension:
> self.enable = enable;
>
> EXTENSIONS = [
> + Extension('VK_KHR_bind_memory2', 1, True),
> Extension('VK_KHR_dedicated_allocation', 1, True),
> Extension('VK_KHR_descriptor_update_template', 1, True),
> Extension('VK_KHR_external_fence', 1,
> diff --git a/src/intel/vulkan/anv_image.c b/src/intel/vulkan/anv_image.c
> index 492b341303a..2aa83154f82 100644
> --- a/src/intel/vulkan/anv_image.c
> +++ b/src/intel/vulkan/anv_image.c
> @@ -32,6 +32,7 @@
> #include "util/debug.h"
>
> #include "vk_format_info.h"
> +#include "vk_util.h"
>
> /**
> * Exactly one bit must be set in \a aspect.
> @@ -442,6 +443,38 @@ VkResult anv_BindImageMemory(
> return VK_SUCCESS;
> }
>
> +VkResult anv_BindImageMemory2KHR(
> + VkDevice device,
> + uint32_t bindInfoCount,
> + const VkBindImageMemoryInfoKHR* pBindInfos)
> +{
> + VkResult result = VK_SUCCESS;
> +
> + for (uint32_t i = 0; i < bindInfoCount; i++) {
> + const VkBindImageMemoryInfoKHR *bind_info = &pBindInfos[i];
> +
> + if (pBindInfos->pNext == NULL) {
> + result = anv_BindImageMemory(device, bind_info->image,
> + bind_info->memory,
> + bind_info->memoryOffset);
> + } else {
> + vk_foreach_struct_const(s, bind_info->pNext) {
> + switch (s->sType) {
> + default:
> + anv_debug_ignored_stype(s->sType);
> + break;
> + }
> + }
> + }
> +
> + /* Stop at the first error. */
> + if (result != VK_SUCCESS)
> + break;
> + }
> +
> + return result;
> +}
> +
> static void
> anv_surface_get_subresource_layout(struct anv_image *image,
> struct anv_surface *surface,
> --
> 2.14.1
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20170915/f14ebdeb/attachment-0001.html>
More information about the mesa-dev
mailing list