mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-22 22:10:10 +01:00
vk/meta: Add an initial implementation of vkCmdBlitImage
Compile-tested only
This commit is contained in:
parent
fb27d80781
commit
08bd554cda
1 changed files with 55 additions and 1 deletions
|
|
@ -712,7 +712,61 @@ void anv_CmdBlitImage(
|
||||||
uint32_t regionCount,
|
uint32_t regionCount,
|
||||||
const VkImageBlit* pRegions)
|
const VkImageBlit* pRegions)
|
||||||
{
|
{
|
||||||
stub();
|
struct anv_cmd_buffer *cmd_buffer = (struct anv_cmd_buffer *)cmdBuffer;
|
||||||
|
VkDevice vk_device = (VkDevice) cmd_buffer->device;
|
||||||
|
struct anv_image *src_image = (struct anv_image *)srcImage;
|
||||||
|
struct anv_image *dest_image = (struct anv_image *)destImage;
|
||||||
|
struct anv_saved_state saved_state;
|
||||||
|
|
||||||
|
meta_prepare_blit(cmd_buffer, &saved_state);
|
||||||
|
|
||||||
|
for (unsigned r = 0; r < regionCount; r++) {
|
||||||
|
VkImageViewCreateInfo src_view_info = {
|
||||||
|
.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,
|
||||||
|
.image = srcImage,
|
||||||
|
.viewType = VK_IMAGE_VIEW_TYPE_2D,
|
||||||
|
.format = src_image->format,
|
||||||
|
.channels = {
|
||||||
|
VK_CHANNEL_SWIZZLE_R,
|
||||||
|
VK_CHANNEL_SWIZZLE_G,
|
||||||
|
VK_CHANNEL_SWIZZLE_B,
|
||||||
|
VK_CHANNEL_SWIZZLE_A
|
||||||
|
},
|
||||||
|
.subresourceRange = {
|
||||||
|
.aspect = pRegions[r].srcSubresource.aspect,
|
||||||
|
.baseMipLevel = pRegions[r].srcSubresource.mipLevel,
|
||||||
|
.mipLevels = 1,
|
||||||
|
.baseArraySlice = pRegions[r].srcSubresource.arraySlice,
|
||||||
|
.arraySize = 1
|
||||||
|
},
|
||||||
|
.minLod = 0
|
||||||
|
};
|
||||||
|
|
||||||
|
VkImageView src_view;
|
||||||
|
vkCreateImageView(vk_device, &src_view_info, &src_view);
|
||||||
|
|
||||||
|
VkColorAttachmentViewCreateInfo dest_view_info = {
|
||||||
|
.sType = VK_STRUCTURE_TYPE_COLOR_ATTACHMENT_VIEW_CREATE_INFO,
|
||||||
|
.image = destImage,
|
||||||
|
.format = dest_image->format,
|
||||||
|
.mipLevel = pRegions[r].destSubresource.mipLevel,
|
||||||
|
.baseArraySlice = pRegions[r].destSubresource.arraySlice,
|
||||||
|
.arraySize = 1,
|
||||||
|
};
|
||||||
|
|
||||||
|
VkColorAttachmentView dest_view;
|
||||||
|
vkCreateColorAttachmentView(vk_device, &dest_view_info, &dest_view);
|
||||||
|
|
||||||
|
meta_emit_blit(cmd_buffer,
|
||||||
|
(struct anv_surface_view *)src_view,
|
||||||
|
pRegions[r].srcOffset,
|
||||||
|
pRegions[r].srcExtent,
|
||||||
|
(struct anv_surface_view *)dest_view,
|
||||||
|
pRegions[r].destOffset,
|
||||||
|
pRegions[r].destExtent);
|
||||||
|
}
|
||||||
|
|
||||||
|
meta_finish_blit(cmd_buffer, &saved_state);
|
||||||
}
|
}
|
||||||
|
|
||||||
void anv_CmdCopyBufferToImage(
|
void anv_CmdCopyBufferToImage(
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue