anv: Add support for VK_WHOLE_SIZE several places
authorJason Ekstrand <jason.ekstrand@intel.com>
Tue, 19 Jan 2016 23:01:10 +0000 (15:01 -0800)
committerJason Ekstrand <jason.ekstrand@intel.com>
Wed, 20 Jan 2016 00:53:35 +0000 (16:53 -0800)
src/vulkan/anv_descriptor_set.c
src/vulkan/anv_device.c
src/vulkan/anv_image.c

index c414c7c276de528ba48b1d6aef35d36099a57099..8b3b5dfadbc4f1b4b22daabb32858c66ffad133f 100644 (file)
@@ -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;
index ddf5f4bed2998d6db9c9cfa1e1db9548b53575ed..9248f912c69bda9ec937bd871f46b9e0ebf3ddd7 100644 (file)
@@ -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
index f79583eac040742b37f56ad3756041f3c7075e14..3b7ea42aa639aa30b3b00a09781444d72eb5d89b 100644 (file)
@@ -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 };