diff options
author | Jason Ekstrand <[email protected]> | 2016-07-14 21:11:14 -0700 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2016-07-15 15:48:21 -0700 |
commit | 593731ea3cc1aa9385e43ebc18c67574f181e1c3 (patch) | |
tree | ba86d823242e5c7e32390e1371b95480c76da3ea /src | |
parent | 827405f07259424ca716dcb217ef0a813ad67963 (diff) |
anv: Handle VK_WHOLE_SIZE properly for buffer views
The old calculation, which used view->offset, encorporated buffer->offset
into the size calculation where it doesn't belong. This meant that, if
buffer->offset > buffer->size, you would always get a negative size. This
fixes 170 dEQP-VK.renderpass.attachment.* Vulkan CTS tests on Haswell.
Signed-off-by: Jason Ekstrand <[email protected]>
Reviewed-by: Kenneth Graunke <[email protected]>
Reviewed-by: Nanley Chery <[email protected]>
Cc: "12.0" <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/intel/vulkan/anv_image.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/intel/vulkan/anv_image.c b/src/intel/vulkan/anv_image.c index c38f198f8d4..e467e87d229 100644 --- a/src/intel/vulkan/anv_image.c +++ b/src/intel/vulkan/anv_image.c @@ -635,18 +635,19 @@ void anv_buffer_view_init(struct anv_buffer_view *view, view->format = anv_get_isl_format(&device->info, pCreateInfo->format, VK_IMAGE_ASPECT_COLOR_BIT, VK_IMAGE_TILING_LINEAR); + const uint32_t format_bs = isl_format_get_layout(view->format)->bpb / 8; view->bo = buffer->bo; view->offset = buffer->offset + pCreateInfo->offset; view->range = pCreateInfo->range == VK_WHOLE_SIZE ? - buffer->size - view->offset : pCreateInfo->range; + buffer->size - pCreateInfo->offset : pCreateInfo->range; + view->range = align_down_npot_u32(view->range, format_bs); if (buffer->usage & VK_BUFFER_USAGE_UNIFORM_TEXEL_BUFFER_BIT) { view->surface_state = alloc_surface_state(device, cmd_buffer); anv_fill_buffer_surface_state(device, view->surface_state, view->format, - view->offset, view->range, - isl_format_get_layout(view->format)->bpb / 8); + view->offset, view->range, format_bs); } else { view->surface_state = (struct anv_state){ 0 }; } |