diff options
author | Nanley Chery <[email protected]> | 2016-03-22 10:53:37 -0700 |
---|---|---|
committer | Nanley Chery <[email protected]> | 2016-03-24 16:15:00 -0700 |
commit | a5dc3c0f02aa523d1d3d123b62b9a187821079fe (patch) | |
tree | 36c486b5d659ebdbbaa96694ecabecf21770ff8c /src/intel/vulkan/anv_meta_resolve.c | |
parent | 20417b2cb05ff0f710eb6b6fbd9299ba915f8fc1 (diff) |
anv: Sanitize Image extents and offsets
Prepare Image extents and offsets for internal consumption by assigning
the default values implicitly defned by the spec. Fixes textures on
several Vulkan demos in which the VkImageCopy depth is set to zero when
copying a 2D image.
v2 (Jason Ekstrand):
Replace "prep" with "sanitize"
Make function static inline
Pass structs instead of pointers
Reviewed-by: Jason Ekstrand <[email protected]>
Signed-off-by: Nanley Chery <[email protected]>
Diffstat (limited to 'src/intel/vulkan/anv_meta_resolve.c')
-rw-r--r-- | src/intel/vulkan/anv_meta_resolve.c | 41 |
1 files changed, 31 insertions, 10 deletions
diff --git a/src/intel/vulkan/anv_meta_resolve.c b/src/intel/vulkan/anv_meta_resolve.c index 19fb3ad3003..f50af52ece5 100644 --- a/src/intel/vulkan/anv_meta_resolve.c +++ b/src/intel/vulkan/anv_meta_resolve.c @@ -719,6 +719,27 @@ void anv_CmdResolveImage( anv_meta_get_iview_layer(dest_image, ®ion->dstSubresource, ®ion->dstOffset); + /** + * From Vulkan 1.0.6 spec: 18.6 Resolving Multisample Images + * + * extent is the size in texels of the source image to resolve in width, + * height and depth. 1D images use only x and width. 2D images use x, y, + * width and height. 3D images use x, y, z, width, height and depth. + * + * srcOffset and dstOffset select the initial x, y, and z offsets in + * texels of the sub-regions of the source and destination image data. + * extent is the size in texels of the source image to resolve in width, + * height and depth. 1D images use only x and width. 2D images use x, y, + * width and height. 3D images use x, y, z, width, height and depth. + */ + const struct VkExtent3D extent = + anv_sanitize_image_extent(src_image->type, region->extent); + const struct VkOffset3D srcOffset = + anv_sanitize_image_offset(src_image->type, region->srcOffset); + const struct VkOffset3D dstOffset = + anv_sanitize_image_offset(dest_image->type, region->dstOffset); + + for (uint32_t layer = 0; layer < region->srcSubresource.layerCount; ++layer) { @@ -780,12 +801,12 @@ void anv_CmdResolveImage( .framebuffer = fb_h, .renderArea = { .offset = { - region->dstOffset.x, - region->dstOffset.y, + dstOffset.x, + dstOffset.y, }, .extent = { - region->extent.width, - region->extent.height, + extent.width, + extent.height, } }, .clearValueCount = 0, @@ -796,17 +817,17 @@ void anv_CmdResolveImage( emit_resolve(cmd_buffer, &src_iview, &(VkOffset2D) { - .x = region->srcOffset.x, - .y = region->srcOffset.y, + .x = srcOffset.x, + .y = srcOffset.y, }, &dest_iview, &(VkOffset2D) { - .x = region->dstOffset.x, - .y = region->dstOffset.y, + .x = dstOffset.x, + .y = dstOffset.y, }, &(VkExtent2D) { - .width = region->extent.width, - .height = region->extent.height, + .width = extent.width, + .height = extent.height, }); ANV_CALL(CmdEndRenderPass)(cmd_buffer_h); |