From 56dbf13045c551984c362fdeed42baf9d74517a6 Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Tue, 19 Jan 2016 15:01:10 -0800 Subject: [PATCH] anv: Add support for VK_WHOLE_SIZE several places --- src/vulkan/anv_descriptor_set.c | 3 ++- src/vulkan/anv_device.c | 3 +++ src/vulkan/anv_image.c | 7 ++++--- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/vulkan/anv_descriptor_set.c b/src/vulkan/anv_descriptor_set.c index c414c7c276d..8b3b5dfadbc 100644 --- a/src/vulkan/anv_descriptor_set.c +++ b/src/vulkan/anv_descriptor_set.c @@ -559,7 +559,8 @@ void anv_UpdateDescriptorSets( * range in the surface state and do the actual range-checking * in the shader. */ - if (bind_layout->dynamic_offset_index >= 0) + if (bind_layout->dynamic_offset_index >= 0 || + write->pBufferInfo[j].range == VK_WHOLE_SIZE) view->range = buffer->size - write->pBufferInfo[j].offset; else view->range = write->pBufferInfo[j].range; diff --git a/src/vulkan/anv_device.c b/src/vulkan/anv_device.c index ddf5f4bed29..9248f912c69 100644 --- a/src/vulkan/anv_device.c +++ b/src/vulkan/anv_device.c @@ -1101,6 +1101,9 @@ VkResult anv_MapMemory( return VK_SUCCESS; } + if (size == VK_WHOLE_SIZE) + size = mem->bo.size - offset; + /* FIXME: Is this supposed to be thread safe? Since vkUnmapMemory() only * takes a VkDeviceMemory pointer, it seems like only one map of the memory * at a time is valid. We could just mmap up front and return an offset diff --git a/src/vulkan/anv_image.c b/src/vulkan/anv_image.c index f79583eac04..3b7ea42aa63 100644 --- a/src/vulkan/anv_image.c +++ b/src/vulkan/anv_image.c @@ -537,7 +537,8 @@ anv_CreateBufferView(VkDevice _device, view->format = format->surface_format; view->bo = buffer->bo; view->offset = buffer->offset + pCreateInfo->offset; - view->range = pCreateInfo->range; + view->range = pCreateInfo->range == VK_WHOLE_SIZE ? + buffer->size - view->offset : pCreateInfo->range; if (buffer->usage & VK_BUFFER_USAGE_UNIFORM_TEXEL_BUFFER_BIT) { view->surface_state = @@ -545,7 +546,7 @@ anv_CreateBufferView(VkDevice _device, anv_fill_buffer_surface_state(device, view->surface_state.map, view->format, - view->offset, pCreateInfo->range, + view->offset, view->range, format->isl_layout->bs); } else { view->surface_state = (struct anv_state){ 0 }; @@ -560,7 +561,7 @@ anv_CreateBufferView(VkDevice _device, anv_fill_buffer_surface_state(device, view->storage_surface_state.map, storage_format, - view->offset, pCreateInfo->range, + view->offset, view->range, format->isl_layout->bs); } else { view->storage_surface_state = (struct anv_state){ 0 }; -- 2.30.2