region->srcOffsets[1].x - region->srcOffsets[0].x;
const uint32_t src_height =
region->srcOffsets[1].y - region->srcOffsets[0].y;
- const uint32_t dst_width =
- region->dstOffsets[1].x - region->dstOffsets[0].x;
- const uint32_t dst_height =
- region->dstOffsets[1].y - region->dstOffsets[0].y;
+ uint32_t dst_width;
+ uint32_t dst_height;
float initial_depth_offset;
VkExtent3D src_extent;
VkExtent3D dst_extent;
+ VkOffset3D dst_offset = region->dstOffsets[0];
float z_slice_stride;
+ bool flip_x;
+ bool flip_y;
+
+ if (region->dstOffsets[1].x > region->dstOffsets[0].x) {
+ dst_width = region->dstOffsets[1].x - region->dstOffsets[0].x;
+ flip_x = false;
+ } else {
+ dst_width = region->dstOffsets[0].x - region->dstOffsets[1].x;
+ flip_x = true;
+ dst_offset.x = region->dstOffsets[1].x;
+ }
+
+ if (region->dstOffsets[1].y > region->dstOffsets[0].y) {
+ dst_height = region->dstOffsets[1].y - region->dstOffsets[0].y;
+ flip_y = false;
+ } else {
+ dst_height = region->dstOffsets[0].y - region->dstOffsets[1].y;
+ flip_y = true;
+ dst_offset.y = region->dstOffsets[1].y;
+ }
/* If any of the extent regions is zero, then reject the blit and
* continue.
dst,
region->dstSubresource.baseArrayLayer + j,
region->dstSubresource.mipLevel,
- ®ion->dstOffsets[0],
+ &dst_offset,
&dst_extent,
min_dst_z,
dst->vk.format,
transfer_cmd->sources[0].mappings[0].src_rect = src_rect;
transfer_cmd->sources[0].mappings[0].dst_rect = dst_rect;
+ transfer_cmd->sources[0].mappings[0].flip_x = flip_x;
+ transfer_cmd->sources[0].mappings[0].flip_y = flip_y;
transfer_cmd->sources[0].mapping_count++;
transfer_cmd->sources[0].surface = src_surface;
(src_rect->offset.y * dst_y1 !=
src_y1 * dst_rect->offset.y) ||
(src_rect->extent.width != dst_rect->extent.width) ||
- (src_rect->extent.height != dst_rect->extent.height)) {
+ (src_rect->extent.height != dst_rect->extent.height) ||
+ transfer_cmd->sources[0U].mappings[0U].flip_x ||
+ transfer_cmd->sources[0U].mappings[0U].flip_y) {
layer->layer_floats = PVR_INT_COORD_SET_FLOATS_4;
} else {
layer->layer_floats = PVR_INT_COORD_SET_FLOATS_0;
float offset = 0.0f;
float tmp;
- dst_x = dst_rect.extent.width;
- dst_y = dst_rect.extent.height;
+ dst_x = mapping->flip_x ? -(int32_t)dst_rect.extent.width
+ : dst_rect.extent.width;
+ dst_y = mapping->flip_y ? -(int32_t)dst_rect.extent.height
+ : dst_rect.extent.height;
src_x = src_rect.extent.width;
src_y = src_rect.extent.height;
nums[0U] = src_x;
denom[0U] = dst_x;
- consts[0U] = src_rect.offset.x * dst_x - src_x * dst_rect.offset.x;
+ consts[0U] =
+ mapping->flip_x
+ ? src_rect.offset.x * dst_x -
+ src_x * (dst_rect.offset.x + dst_rect.extent.width)
+ : src_rect.offset.x * dst_x - src_x * dst_rect.offset.x;
nums[1U] = src_y;
denom[1U] = dst_y;
- consts[1U] = src_rect.offset.y * dst_y - src_y * dst_rect.offset.y;
+ consts[1U] =
+ mapping->flip_y
+ ? src_rect.offset.y * dst_y -
+ src_y * (dst_rect.offset.y + dst_rect.extent.height)
+ : src_rect.offset.y * dst_y - src_y * dst_rect.offset.y;
for (uint32_t i = 0U; i < 2U; i++) {
tmp = (float)(nums[i]) / (float)(denom[i]);