* 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;
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
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 =
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 };
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 };