tex->src[0].src = nir_src_for_ssa(nir_load_var(&b, tex_pos_in));
tex->dest_type = nir_type_float; /* TODO */
- switch (tex_dim) {
- case GLSL_SAMPLER_DIM_2D:
- tex->coord_components = 2;
- break;
- case GLSL_SAMPLER_DIM_3D:
- tex->coord_components = 3;
- break;
- default:
- assert(!"Unsupported texture dimension");
- }
+ if (tex_dim == GLSL_SAMPLER_DIM_2D)
+ tex->is_array = true;
+ tex->coord_components = 3;
tex->sampler = nir_deref_var_create(tex, sampler);
void
anv_meta_save(struct anv_meta_saved_state *state,
const struct anv_cmd_buffer *cmd_buffer,
- uint32_t dynamic_state)
+ uint32_t dynamic_mask)
{
state->old_pipeline = cmd_buffer->state.pipeline;
state->old_descriptor_set0 = cmd_buffer->state.descriptors[0];
memcpy(state->old_vertex_bindings, cmd_buffer->state.vertex_bindings,
sizeof(state->old_vertex_bindings));
- state->dynamic_flags = dynamic_state;
+
+ state->dynamic_mask = dynamic_mask;
anv_dynamic_state_copy(&state->dynamic, &cmd_buffer->state.dynamic,
- dynamic_state);
+ dynamic_mask);
}
void
cmd_buffer->state.descriptors_dirty |= VK_SHADER_STAGE_VERTEX_BIT;
anv_dynamic_state_copy(&cmd_buffer->state.dynamic, &state->dynamic,
- state->dynamic_flags);
- cmd_buffer->state.dirty |= state->dynamic_flags;
+ state->dynamic_mask);
+ cmd_buffer->state.dirty |= state->dynamic_mask;
}
-static VkImageViewType
-meta_blit_get_src_image_view_type(const struct anv_image *src_image)
+VkImageViewType
+anv_meta_get_view_type(const struct anv_image *image)
{
- switch (src_image->type) {
- case VK_IMAGE_TYPE_1D:
- return VK_IMAGE_VIEW_TYPE_1D;
- case VK_IMAGE_TYPE_2D:
- return VK_IMAGE_VIEW_TYPE_2D;
- case VK_IMAGE_TYPE_3D:
- return VK_IMAGE_VIEW_TYPE_3D;
+ switch (image->type) {
+ case VK_IMAGE_TYPE_1D: return VK_IMAGE_VIEW_TYPE_1D;
+ case VK_IMAGE_TYPE_2D: return VK_IMAGE_VIEW_TYPE_2D;
+ case VK_IMAGE_TYPE_3D: return VK_IMAGE_VIEW_TYPE_3D;
default:
- assert(!"bad VkImageType");
- return 0;
+ unreachable("bad VkImageViewType");
}
}
static uint32_t
meta_blit_get_dest_view_base_array_slice(const struct anv_image *dest_image,
- const VkImageSubresourceCopy *dest_subresource,
+ const VkImageSubresourceLayers *dest_subresource,
const VkOffset3D *dest_offset)
{
switch (dest_image->type) {
case VK_IMAGE_TYPE_1D:
case VK_IMAGE_TYPE_2D:
- return dest_subresource->arrayLayer;
+ return dest_subresource->baseArrayLayer;
case VK_IMAGE_TYPE_3D:
/* HACK: Vulkan does not allow attaching a 3D image to a framebuffer,
* but meta does it anyway. When doing so, we translate the
.sType = VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO,
.attachmentCount = 1,
.pAttachments = &(VkAttachmentDescription) {
- .sType = VK_STRUCTURE_TYPE_ATTACHMENT_DESCRIPTION,
.format = VK_FORMAT_UNDEFINED, /* Our shaders don't care */
.loadOp = VK_ATTACHMENT_LOAD_OP_LOAD,
.storeOp = VK_ATTACHMENT_STORE_OP_STORE,
},
.subpassCount = 1,
.pSubpasses = &(VkSubpassDescription) {
- .sType = VK_STRUCTURE_TYPE_SUBPASS_DESCRIPTION,
.pipelineBindPoint = VK_PIPELINE_BIND_POINT_GRAPHICS,
- .inputCount = 0,
- .colorCount = 1,
+ .inputAttachmentCount = 0,
+ .colorAttachmentCount = 1,
.pColorAttachments = &(VkAttachmentReference) {
.attachment = 0,
.layout = VK_IMAGE_LAYOUT_GENERAL,
},
.pResolveAttachments = NULL,
- .depthStencilAttachment = (VkAttachmentReference) {
+ .pDepthStencilAttachment = &(VkAttachmentReference) {
.attachment = VK_ATTACHMENT_UNUSED,
.layout = VK_IMAGE_LAYOUT_GENERAL,
},
- .preserveCount = 1,
+ .preserveAttachmentCount = 1,
.pPreserveAttachments = &(VkAttachmentReference) {
.attachment = 0,
.layout = VK_IMAGE_LAYOUT_GENERAL,
},
},
.dependencyCount = 0,
- }, &device->meta_state.blit.render_pass);
+ }, NULL, &device->meta_state.blit.render_pass);
/* We don't use a vertex shader for clearing, but instead build and pass
* the VUEs directly to the rasterization backend. However, we do need
* to provide GLSL source for the vertex shader so that the compiler
* does not dead-code our inputs.
*/
- struct anv_shader_module vsm = {
+ struct anv_shader_module vs = {
.nir = build_nir_vertex_shader(false),
};
- struct anv_shader_module fsm_2d = {
+ struct anv_shader_module fs_2d = {
.nir = build_nir_copy_fragment_shader(GLSL_SAMPLER_DIM_2D),
};
- struct anv_shader_module fsm_3d = {
+ struct anv_shader_module fs_3d = {
.nir = build_nir_copy_fragment_shader(GLSL_SAMPLER_DIM_3D),
};
- VkShader vs;
- anv_CreateShader(anv_device_to_handle(device),
- &(VkShaderCreateInfo) {
- .sType = VK_STRUCTURE_TYPE_SHADER_CREATE_INFO,
- .module = anv_shader_module_to_handle(&vsm),
- .pName = "main",
- }, &vs);
-
- VkShader fs_2d;
- anv_CreateShader(anv_device_to_handle(device),
- &(VkShaderCreateInfo) {
- .sType = VK_STRUCTURE_TYPE_SHADER_CREATE_INFO,
- .module = anv_shader_module_to_handle(&fsm_2d),
- .pName = "main",
- }, &fs_2d);
-
- VkShader fs_3d;
- anv_CreateShader(anv_device_to_handle(device),
- &(VkShaderCreateInfo) {
- .sType = VK_STRUCTURE_TYPE_SHADER_CREATE_INFO,
- .module = anv_shader_module_to_handle(&fsm_3d),
- .pName = "main",
- }, &fs_3d);
-
VkPipelineVertexInputStateCreateInfo vi_create_info = {
.sType = VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO,
- .bindingCount = 2,
+ .vertexBindingDescriptionCount = 2,
.pVertexBindingDescriptions = (VkVertexInputBindingDescription[]) {
{
.binding = 0,
- .strideInBytes = 0,
- .stepRate = VK_VERTEX_INPUT_STEP_RATE_VERTEX
+ .stride = 0,
+ .inputRate = VK_VERTEX_INPUT_RATE_VERTEX
},
{
.binding = 1,
- .strideInBytes = 5 * sizeof(float),
- .stepRate = VK_VERTEX_INPUT_STEP_RATE_VERTEX
+ .stride = 5 * sizeof(float),
+ .inputRate = VK_VERTEX_INPUT_RATE_VERTEX
},
},
- .attributeCount = 3,
+ .vertexAttributeDescriptionCount = 3,
.pVertexAttributeDescriptions = (VkVertexInputAttributeDescription[]) {
{
/* VUE Header */
.location = 0,
.binding = 0,
.format = VK_FORMAT_R32G32B32A32_UINT,
- .offsetInBytes = 0
+ .offset = 0
},
{
/* Position */
.location = 1,
.binding = 1,
.format = VK_FORMAT_R32G32_SFLOAT,
- .offsetInBytes = 0
+ .offset = 0
},
{
/* Texture Coordinate */
.location = 2,
.binding = 1,
.format = VK_FORMAT_R32G32B32_SFLOAT,
- .offsetInBytes = 8
+ .offset = 8
}
}
};
VkDescriptorSetLayoutCreateInfo ds_layout_info = {
.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO,
- .count = 1,
+ .bindingCount = 1,
.pBinding = (VkDescriptorSetLayoutBinding[]) {
{
- .descriptorType = VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE,
- .arraySize = 1,
+ .binding = 0,
+ .descriptorType = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER,
+ .descriptorCount = 1,
.stageFlags = VK_SHADER_STAGE_FRAGMENT_BIT,
.pImmutableSamplers = NULL
},
}
};
anv_CreateDescriptorSetLayout(anv_device_to_handle(device), &ds_layout_info,
- &device->meta_state.blit.ds_layout);
+ NULL, &device->meta_state.blit.ds_layout);
anv_CreatePipelineLayout(anv_device_to_handle(device),
&(VkPipelineLayoutCreateInfo) {
.sType = VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO,
- .descriptorSetCount = 1,
+ .setLayoutCount = 1,
.pSetLayouts = &device->meta_state.blit.ds_layout,
},
- &device->meta_state.blit.pipeline_layout);
+ NULL, &device->meta_state.blit.pipeline_layout);
VkPipelineShaderStageCreateInfo pipeline_shader_stages[] = {
{
.sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO,
- .stage = VK_SHADER_STAGE_VERTEX,
- .shader = vs,
+ .stage = VK_SHADER_STAGE_VERTEX_BIT,
+ .module = anv_shader_module_to_handle(&vs),
+ .pName = "main",
.pSpecializationInfo = NULL
}, {
.sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO,
- .stage = VK_SHADER_STAGE_FRAGMENT,
- .shader = {0}, /* TEMPLATE VALUE! FILL ME IN! */
+ .stage = VK_SHADER_STAGE_FRAGMENT_BIT,
+ .module = VK_NULL_HANDLE, /* TEMPLATE VALUE! FILL ME IN! */
+ .pName = "main",
.pSpecializationInfo = NULL
},
};
.viewportCount = 1,
.scissorCount = 1,
},
- .pRasterState = &(VkPipelineRasterStateCreateInfo) {
- .sType = VK_STRUCTURE_TYPE_PIPELINE_RASTER_STATE_CREATE_INFO,
- .depthClipEnable = true,
+ .pRasterizationState = &(VkPipelineRasterizationStateCreateInfo) {
+ .sType = VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO,
.rasterizerDiscardEnable = false,
- .fillMode = VK_FILL_MODE_SOLID,
+ .polygonMode = VK_POLYGON_MODE_FILL,
.cullMode = VK_CULL_MODE_NONE,
- .frontFace = VK_FRONT_FACE_CCW
+ .frontFace = VK_FRONT_FACE_COUNTER_CLOCKWISE
},
.pMultisampleState = &(VkPipelineMultisampleStateCreateInfo) {
.sType = VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO,
- .rasterSamples = 1,
+ .rasterizationSamples = 1,
.sampleShadingEnable = false,
.pSampleMask = (VkSampleMask[]) { UINT32_MAX },
},
.sType = VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO,
.attachmentCount = 1,
.pAttachments = (VkPipelineColorBlendAttachmentState []) {
- { .channelWriteMask = VK_CHANNEL_A_BIT |
- VK_CHANNEL_R_BIT | VK_CHANNEL_G_BIT | VK_CHANNEL_B_BIT },
+ { .colorWriteMask =
+ VK_COLOR_COMPONENT_A_BIT |
+ VK_COLOR_COMPONENT_R_BIT |
+ VK_COLOR_COMPONENT_G_BIT |
+ VK_COLOR_COMPONENT_B_BIT },
}
},
.pDynamicState = &(VkPipelineDynamicStateCreateInfo) {
.use_rectlist = true
};
- pipeline_shader_stages[1].shader = fs_2d;
+ pipeline_shader_stages[1].module = anv_shader_module_to_handle(&fs_2d);
anv_graphics_pipeline_create(anv_device_to_handle(device),
&vk_pipeline_info, &anv_pipeline_info,
- &device->meta_state.blit.pipeline_2d_src);
+ NULL, &device->meta_state.blit.pipeline_2d_src);
- pipeline_shader_stages[1].shader = fs_3d;
+ pipeline_shader_stages[1].module = anv_shader_module_to_handle(&fs_3d);
anv_graphics_pipeline_create(anv_device_to_handle(device),
&vk_pipeline_info, &anv_pipeline_info,
- &device->meta_state.blit.pipeline_3d_src);
-
- anv_DestroyShader(anv_device_to_handle(device), vs);
- anv_DestroyShader(anv_device_to_handle(device), fs_2d);
- anv_DestroyShader(anv_device_to_handle(device), fs_3d);
- ralloc_free(vsm.nir);
- ralloc_free(fsm_2d.nir);
- ralloc_free(fsm_3d.nir);
+ NULL, &device->meta_state.blit.pipeline_3d_src);
+
+ ralloc_free(vs.nir);
+ ralloc_free(fs_2d.nir);
+ ralloc_free(fs_3d.nir);
}
static void
struct anv_image *dest_image,
struct anv_image_view *dest_iview,
VkOffset3D dest_offset,
- VkExtent3D dest_extent)
+ VkExtent3D dest_extent,
+ VkFilter blit_filter)
{
struct anv_device *device = cmd_buffer->device;
- VkDescriptorPool dummy_desc_pool = { .handle = 1 };
+ VkDescriptorPool dummy_desc_pool = (VkDescriptorPool)1;
struct blit_vb_data {
float pos[2];
.tex_coord = {
(float)(src_offset.x + src_extent.width) / (float)src_iview->extent.width,
(float)(src_offset.y + src_extent.height) / (float)src_iview->extent.height,
- (float)(src_offset.z + src_extent.depth) / (float)src_iview->extent.depth,
+ (float)src_offset.z / (float)src_iview->extent.depth,
},
};
.tex_coord = {
(float)src_offset.x / (float)src_iview->extent.width,
(float)(src_offset.y + src_extent.height) / (float)src_iview->extent.height,
- (float)(src_offset.z + src_extent.depth) / (float)src_iview->extent.depth,
+ (float)src_offset.z / (float)src_iview->extent.depth,
},
};
},
};
+ anv_state_clflush(vb_state);
+
struct anv_buffer vertex_buffer = {
.device = device,
.size = vb_size,
sizeof(struct anv_vue_header),
});
+ VkSampler sampler;
+ ANV_CALL(CreateSampler)(anv_device_to_handle(device),
+ &(VkSamplerCreateInfo) {
+ .sType = VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO,
+ .magFilter = blit_filter,
+ .minFilter = blit_filter,
+ }, &cmd_buffer->pool->alloc, &sampler);
+
VkDescriptorSet set;
- anv_AllocDescriptorSets(anv_device_to_handle(device), dummy_desc_pool,
- VK_DESCRIPTOR_SET_USAGE_ONE_SHOT,
- 1, &device->meta_state.blit.ds_layout, &set);
+ anv_AllocateDescriptorSets(anv_device_to_handle(device),
+ &(VkDescriptorSetAllocateInfo) {
+ .sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO,
+ .descriptorPool = dummy_desc_pool,
+ .setLayoutCount = 1,
+ .pSetLayouts = &device->meta_state.blit.ds_layout
+ }, &set);
anv_UpdateDescriptorSets(anv_device_to_handle(device),
1, /* writeCount */
(VkWriteDescriptorSet[]) {
{
.sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET,
- .destSet = set,
- .destBinding = 0,
- .destArrayElement = 0,
- .count = 1,
- .descriptorType = VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE,
- .pDescriptors = (VkDescriptorInfo[]) {
+ .dstSet = set,
+ .dstBinding = 0,
+ .dstArrayElement = 0,
+ .descriptorCount = 1,
+ .descriptorType = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER,
+ .pImageInfo = (VkDescriptorImageInfo[]) {
{
+ .sampler = sampler,
.imageView = anv_image_view_to_handle(src_iview),
- .imageLayout = VK_IMAGE_LAYOUT_GENERAL
+ .imageLayout = VK_IMAGE_LAYOUT_GENERAL,
},
}
}
.width = dest_iview->extent.width,
.height = dest_iview->extent.height,
.layers = 1
- }, &fb);
+ }, &cmd_buffer->pool->alloc, &fb);
ANV_CALL(CmdBeginRenderPass)(anv_cmd_buffer_to_handle(cmd_buffer),
&(VkRenderPassBeginInfo) {
},
.clearValueCount = 0,
.pClearValues = NULL,
- }, VK_RENDER_PASS_CONTENTS_INLINE);
+ }, VK_SUBPASS_CONTENTS_INLINE);
VkPipeline pipeline;
anv_CmdSetViewport(anv_cmd_buffer_to_handle(cmd_buffer), 1,
&(VkViewport) {
- .originX = 0.0f,
- .originY = 0.0f,
+ .x = 0.0f,
+ .y = 0.0f,
.width = dest_iview->extent.width,
.height = dest_iview->extent.height,
.minDepth = 0.0f,
* descriptor sets, etc. has been used. We are free to delete it.
*/
anv_descriptor_set_destroy(device, anv_descriptor_set_from_handle(set));
- anv_DestroyFramebuffer(anv_device_to_handle(device), fb);
+ anv_DestroySampler(anv_device_to_handle(device), sampler,
+ &cmd_buffer->pool->alloc);
+ anv_DestroyFramebuffer(anv_device_to_handle(device), fb,
+ &cmd_buffer->pool->alloc);
}
static void
}
static VkFormat
-vk_format_for_cpp(int cpp)
+vk_format_for_size(int bs)
{
- switch (cpp) {
+ switch (bs) {
case 1: return VK_FORMAT_R8_UINT;
case 2: return VK_FORMAT_R8G8_UINT;
case 3: return VK_FORMAT_R8G8B8_UINT;
case 12: return VK_FORMAT_R32G32B32_UINT;
case 16: return VK_FORMAT_R32G32B32A32_UINT;
default:
- unreachable("Invalid format cpp");
+ unreachable("Invalid format block size");
}
}
.depth = 1,
},
.mipLevels = 1,
- .arraySize = 1,
+ .arrayLayers = 1,
.samples = 1,
.tiling = VK_IMAGE_TILING_LINEAR,
.usage = 0,
VkImage src_image;
image_info.usage = VK_IMAGE_USAGE_SAMPLED_BIT;
- anv_CreateImage(vk_device, &image_info, &src_image);
+ anv_CreateImage(vk_device, &image_info,
+ &cmd_buffer->pool->alloc, &src_image);
VkImage dest_image;
image_info.usage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT;
- anv_CreateImage(vk_device, &image_info, &dest_image);
+ anv_CreateImage(vk_device, &image_info,
+ &cmd_buffer->pool->alloc, &dest_image);
/* We could use a vk call to bind memory, but that would require
* creating a dummy memory object etc. so there's really no point.
.image = src_image,
.viewType = VK_IMAGE_VIEW_TYPE_2D,
.format = copy_format,
- .channels = {
- VK_CHANNEL_SWIZZLE_R,
- VK_CHANNEL_SWIZZLE_G,
- VK_CHANNEL_SWIZZLE_B,
- VK_CHANNEL_SWIZZLE_A
- },
.subresourceRange = {
.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
.baseMipLevel = 0,
- .mipLevels = 1,
+ .levelCount = 1,
.baseArrayLayer = 0,
- .arraySize = 1
+ .layerCount = 1
},
},
cmd_buffer);
.image = dest_image,
.viewType = VK_IMAGE_VIEW_TYPE_2D,
.format = copy_format,
- .channels = {
- .r = VK_CHANNEL_SWIZZLE_R,
- .g = VK_CHANNEL_SWIZZLE_G,
- .b = VK_CHANNEL_SWIZZLE_B,
- .a = VK_CHANNEL_SWIZZLE_A,
- },
.subresourceRange = {
.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
.baseMipLevel = 0,
- .mipLevels = 1,
+ .levelCount = 1,
.baseArrayLayer = 0,
- .arraySize = 1,
+ .layerCount = 1,
},
},
cmd_buffer);
anv_image_from_handle(dest_image),
&dest_iview,
(VkOffset3D) { 0, 0, 0 },
- (VkExtent3D) { width, height, 1 });
+ (VkExtent3D) { width, height, 1 },
+ VK_FILTER_NEAREST);
- anv_DestroyImage(vk_device, src_image);
- anv_DestroyImage(vk_device, dest_image);
+ anv_DestroyImage(vk_device, src_image, &cmd_buffer->pool->alloc);
+ anv_DestroyImage(vk_device, dest_image, &cmd_buffer->pool->alloc);
}
void anv_CmdCopyBuffer(
- VkCmdBuffer cmdBuffer,
+ VkCommandBuffer commandBuffer,
VkBuffer srcBuffer,
VkBuffer destBuffer,
uint32_t regionCount,
const VkBufferCopy* pRegions)
{
- ANV_FROM_HANDLE(anv_cmd_buffer, cmd_buffer, cmdBuffer);
+ ANV_FROM_HANDLE(anv_cmd_buffer, cmd_buffer, commandBuffer);
ANV_FROM_HANDLE(anv_buffer, src_buffer, srcBuffer);
ANV_FROM_HANDLE(anv_buffer, dest_buffer, destBuffer);
for (unsigned r = 0; r < regionCount; r++) {
uint64_t src_offset = src_buffer->offset + pRegions[r].srcOffset;
- uint64_t dest_offset = dest_buffer->offset + pRegions[r].destOffset;
- uint64_t copy_size = pRegions[r].copySize;
+ uint64_t dest_offset = dest_buffer->offset + pRegions[r].dstOffset;
+ uint64_t copy_size = pRegions[r].size;
/* First, we compute the biggest format that can be used with the
* given offsets and size.
*/
- int cpp = 16;
+ int bs = 16;
int fs = ffs(src_offset) - 1;
if (fs != -1)
- cpp = MIN2(cpp, 1 << fs);
- assert(src_offset % cpp == 0);
+ bs = MIN2(bs, 1 << fs);
+ assert(src_offset % bs == 0);
fs = ffs(dest_offset) - 1;
if (fs != -1)
- cpp = MIN2(cpp, 1 << fs);
- assert(dest_offset % cpp == 0);
+ bs = MIN2(bs, 1 << fs);
+ assert(dest_offset % bs == 0);
- fs = ffs(pRegions[r].copySize) - 1;
+ fs = ffs(pRegions[r].size) - 1;
if (fs != -1)
- cpp = MIN2(cpp, 1 << fs);
- assert(pRegions[r].copySize % cpp == 0);
+ bs = MIN2(bs, 1 << fs);
+ assert(pRegions[r].size % bs == 0);
- VkFormat copy_format = vk_format_for_cpp(cpp);
+ VkFormat copy_format = vk_format_for_size(bs);
/* This is maximum possible width/height our HW can handle */
uint64_t max_surface_dim = 1 << 14;
/* First, we make a bunch of max-sized copies */
- uint64_t max_copy_size = max_surface_dim * max_surface_dim * cpp;
+ uint64_t max_copy_size = max_surface_dim * max_surface_dim * bs;
while (copy_size > max_copy_size) {
do_buffer_copy(cmd_buffer, src_buffer->bo, src_offset,
dest_buffer->bo, dest_offset,
dest_offset += max_copy_size;
}
- uint64_t height = copy_size / (max_surface_dim * cpp);
+ uint64_t height = copy_size / (max_surface_dim * bs);
assert(height < max_surface_dim);
if (height != 0) {
- uint64_t rect_copy_size = height * max_surface_dim * cpp;
+ uint64_t rect_copy_size = height * max_surface_dim * bs;
do_buffer_copy(cmd_buffer, src_buffer->bo, src_offset,
dest_buffer->bo, dest_offset,
max_surface_dim, height, copy_format);
if (copy_size != 0) {
do_buffer_copy(cmd_buffer, src_buffer->bo, src_offset,
dest_buffer->bo, dest_offset,
- copy_size / cpp, 1, copy_format);
+ copy_size / bs, 1, copy_format);
}
}
}
void anv_CmdCopyImage(
- VkCmdBuffer cmdBuffer,
+ VkCommandBuffer commandBuffer,
VkImage srcImage,
VkImageLayout srcImageLayout,
VkImage destImage,
uint32_t regionCount,
const VkImageCopy* pRegions)
{
- ANV_FROM_HANDLE(anv_cmd_buffer, cmd_buffer, cmdBuffer);
+ ANV_FROM_HANDLE(anv_cmd_buffer, cmd_buffer, commandBuffer);
ANV_FROM_HANDLE(anv_image, src_image, srcImage);
ANV_FROM_HANDLE(anv_image, dest_image, destImage);
- const VkImageViewType src_iview_type =
- meta_blit_get_src_image_view_type(src_image);
-
struct anv_meta_saved_state saved_state;
meta_prepare_blit(cmd_buffer, &saved_state);
&(VkImageViewCreateInfo) {
.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,
.image = srcImage,
- .viewType = src_iview_type,
+ .viewType = anv_meta_get_view_type(src_image),
.format = src_image->format->vk_format,
- .channels = {
- VK_CHANNEL_SWIZZLE_R,
- VK_CHANNEL_SWIZZLE_G,
- VK_CHANNEL_SWIZZLE_B,
- VK_CHANNEL_SWIZZLE_A
- },
.subresourceRange = {
- .aspectMask = 1 << pRegions[r].srcSubresource.aspect,
+ .aspectMask = pRegions[r].srcSubresource.aspectMask,
.baseMipLevel = pRegions[r].srcSubresource.mipLevel,
- .mipLevels = 1,
- .baseArrayLayer = pRegions[r].srcSubresource.arrayLayer,
- .arraySize = 1
+ .levelCount = 1,
+ .baseArrayLayer = pRegions[r].srcSubresource.baseArrayLayer,
+ .layerCount = pRegions[r].dstSubresource.layerCount,
},
},
cmd_buffer);
const VkOffset3D dest_offset = {
- .x = pRegions[r].destOffset.x,
- .y = pRegions[r].destOffset.y,
+ .x = pRegions[r].dstOffset.x,
+ .y = pRegions[r].dstOffset.y,
.z = 0,
};
- const uint32_t dest_array_slice =
- meta_blit_get_dest_view_base_array_slice(dest_image,
- &pRegions[r].destSubresource,
- &pRegions[r].destOffset);
-
- if (pRegions[r].srcSubresource.arraySize > 1)
- anv_finishme("FINISHME: copy multiple array layers");
-
- if (pRegions[r].extent.depth > 1)
- anv_finishme("FINISHME: copy multiple depth layers");
+ unsigned num_slices;
+ if (src_image->type == VK_IMAGE_TYPE_3D) {
+ assert(pRegions[r].srcSubresource.layerCount == 1 &&
+ pRegions[r].dstSubresource.layerCount == 1);
+ num_slices = pRegions[r].extent.depth;
+ } else {
+ assert(pRegions[r].srcSubresource.layerCount ==
+ pRegions[r].dstSubresource.layerCount);
+ assert(pRegions[r].extent.depth == 1);
+ num_slices = pRegions[r].dstSubresource.layerCount;
+ }
- struct anv_image_view dest_iview;
- anv_image_view_init(&dest_iview, cmd_buffer->device,
- &(VkImageViewCreateInfo) {
- .sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,
- .image = destImage,
- .viewType = VK_IMAGE_VIEW_TYPE_2D,
- .format = dest_image->format->vk_format,
- .channels = {
- VK_CHANNEL_SWIZZLE_R,
- VK_CHANNEL_SWIZZLE_G,
- VK_CHANNEL_SWIZZLE_B,
- VK_CHANNEL_SWIZZLE_A
- },
- .subresourceRange = {
- .aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
- .baseMipLevel = pRegions[r].destSubresource.mipLevel,
- .mipLevels = 1,
- .baseArrayLayer = dest_array_slice,
- .arraySize = 1
+ const uint32_t dest_base_array_slice =
+ meta_blit_get_dest_view_base_array_slice(dest_image,
+ &pRegions[r].dstSubresource,
+ &pRegions[r].dstOffset);
+
+ for (unsigned slice = 0; slice < num_slices; slice++) {
+ VkOffset3D src_offset = pRegions[r].srcOffset;
+ src_offset.z += slice;
+
+ struct anv_image_view dest_iview;
+ anv_image_view_init(&dest_iview, cmd_buffer->device,
+ &(VkImageViewCreateInfo) {
+ .sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,
+ .image = destImage,
+ .viewType = anv_meta_get_view_type(dest_image),
+ .format = dest_image->format->vk_format,
+ .subresourceRange = {
+ .aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
+ .baseMipLevel = pRegions[r].dstSubresource.mipLevel,
+ .levelCount = 1,
+ .baseArrayLayer = dest_base_array_slice + slice,
+ .layerCount = 1
+ },
},
- },
- cmd_buffer);
-
- meta_emit_blit(cmd_buffer,
- src_image, &src_iview,
- pRegions[r].srcOffset,
- pRegions[r].extent,
- dest_image, &dest_iview,
- dest_offset,
- pRegions[r].extent);
+ cmd_buffer);
+
+ meta_emit_blit(cmd_buffer,
+ src_image, &src_iview,
+ src_offset,
+ pRegions[r].extent,
+ dest_image, &dest_iview,
+ dest_offset,
+ pRegions[r].extent,
+ VK_FILTER_NEAREST);
+ }
}
meta_finish_blit(cmd_buffer, &saved_state);
}
void anv_CmdBlitImage(
- VkCmdBuffer cmdBuffer,
+ VkCommandBuffer commandBuffer,
VkImage srcImage,
VkImageLayout srcImageLayout,
VkImage destImage,
VkImageLayout destImageLayout,
uint32_t regionCount,
const VkImageBlit* pRegions,
- VkTexFilter filter)
+ VkFilter filter)
{
- ANV_FROM_HANDLE(anv_cmd_buffer, cmd_buffer, cmdBuffer);
+ ANV_FROM_HANDLE(anv_cmd_buffer, cmd_buffer, commandBuffer);
ANV_FROM_HANDLE(anv_image, src_image, srcImage);
ANV_FROM_HANDLE(anv_image, dest_image, destImage);
- const VkImageViewType src_iview_type =
- meta_blit_get_src_image_view_type(src_image);
-
struct anv_meta_saved_state saved_state;
- anv_finishme("respect VkTexFilter");
+ anv_finishme("respect VkFilter");
meta_prepare_blit(cmd_buffer, &saved_state);
&(VkImageViewCreateInfo) {
.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,
.image = srcImage,
- .viewType = src_iview_type,
+ .viewType = anv_meta_get_view_type(src_image),
.format = src_image->format->vk_format,
- .channels = {
- VK_CHANNEL_SWIZZLE_R,
- VK_CHANNEL_SWIZZLE_G,
- VK_CHANNEL_SWIZZLE_B,
- VK_CHANNEL_SWIZZLE_A
- },
.subresourceRange = {
- .aspectMask = 1 << pRegions[r].srcSubresource.aspect,
+ .aspectMask = pRegions[r].srcSubresource.aspectMask,
.baseMipLevel = pRegions[r].srcSubresource.mipLevel,
- .mipLevels = 1,
- .baseArrayLayer = pRegions[r].srcSubresource.arrayLayer,
- .arraySize = 1
+ .levelCount = 1,
+ .baseArrayLayer = pRegions[r].srcSubresource.baseArrayLayer,
+ .layerCount = 1
},
},
cmd_buffer);
const VkOffset3D dest_offset = {
- .x = pRegions[r].destOffset.x,
- .y = pRegions[r].destOffset.y,
+ .x = pRegions[r].dstOffset.x,
+ .y = pRegions[r].dstOffset.y,
.z = 0,
};
const uint32_t dest_array_slice =
meta_blit_get_dest_view_base_array_slice(dest_image,
- &pRegions[r].destSubresource,
- &pRegions[r].destOffset);
+ &pRegions[r].dstSubresource,
+ &pRegions[r].dstOffset);
- if (pRegions[r].srcSubresource.arraySize > 1)
+ if (pRegions[r].srcSubresource.layerCount > 1)
anv_finishme("FINISHME: copy multiple array layers");
- if (pRegions[r].destExtent.depth > 1)
+ if (pRegions[r].dstExtent.depth > 1)
anv_finishme("FINISHME: copy multiple depth layers");
struct anv_image_view dest_iview;
&(VkImageViewCreateInfo) {
.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,
.image = destImage,
- .viewType = VK_IMAGE_VIEW_TYPE_2D,
+ .viewType = anv_meta_get_view_type(dest_image),
.format = dest_image->format->vk_format,
- .channels = {
- VK_CHANNEL_SWIZZLE_R,
- VK_CHANNEL_SWIZZLE_G,
- VK_CHANNEL_SWIZZLE_B,
- VK_CHANNEL_SWIZZLE_A
- },
.subresourceRange = {
.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
- .baseMipLevel = pRegions[r].destSubresource.mipLevel,
- .mipLevels = 1,
+ .baseMipLevel = pRegions[r].dstSubresource.mipLevel,
+ .levelCount = 1,
.baseArrayLayer = dest_array_slice,
- .arraySize = 1
+ .layerCount = 1
},
},
cmd_buffer);
pRegions[r].srcExtent,
dest_image, &dest_iview,
dest_offset,
- pRegions[r].destExtent);
+ pRegions[r].dstExtent,
+ filter);
}
meta_finish_blit(cmd_buffer, &saved_state);
}
-static VkImage
+static struct anv_image *
make_image_for_buffer(VkDevice vk_device, VkBuffer vk_buffer, VkFormat format,
VkImageUsageFlags usage,
+ VkImageType image_type,
+ const VkAllocationCallbacks *alloc,
const VkBufferImageCopy *copy)
{
ANV_FROM_HANDLE(anv_buffer, buffer, vk_buffer);
.format = format,
.extent = extent,
.mipLevels = 1,
- .arraySize = 1,
+ .arrayLayers = 1,
.samples = 1,
.tiling = VK_IMAGE_TILING_LINEAR,
.usage = usage,
.flags = 0,
- }, &vk_image);
+ }, alloc, &vk_image);
assert(result == VK_SUCCESS);
ANV_FROM_HANDLE(anv_image, image, vk_image);
image->bo = buffer->bo;
image->offset = buffer->offset + copy->bufferOffset;
- return anv_image_to_handle(image);
+ return image;
}
void anv_CmdCopyBufferToImage(
- VkCmdBuffer cmdBuffer,
+ VkCommandBuffer commandBuffer,
VkBuffer srcBuffer,
VkImage destImage,
VkImageLayout destImageLayout,
uint32_t regionCount,
const VkBufferImageCopy* pRegions)
{
- ANV_FROM_HANDLE(anv_cmd_buffer, cmd_buffer, cmdBuffer);
+ ANV_FROM_HANDLE(anv_cmd_buffer, cmd_buffer, commandBuffer);
ANV_FROM_HANDLE(anv_image, dest_image, destImage);
VkDevice vk_device = anv_device_to_handle(cmd_buffer->device);
const VkFormat orig_format = dest_image->format->vk_format;
for (unsigned r = 0; r < regionCount; r++) {
VkFormat proxy_format = orig_format;
- VkImageAspect proxy_aspect = pRegions[r].imageSubresource.aspect;
+ VkImageAspectFlags proxy_aspect = pRegions[r].imageSubresource.aspectMask;
if (orig_format == VK_FORMAT_S8_UINT) {
proxy_format = VK_FORMAT_R8_UINT;
- proxy_aspect = VK_IMAGE_ASPECT_COLOR;
+ proxy_aspect = VK_IMAGE_ASPECT_COLOR_BIT;
}
- VkImage srcImage = make_image_for_buffer(vk_device, srcBuffer,
- proxy_format, VK_IMAGE_USAGE_SAMPLED_BIT, &pRegions[r]);
+ struct anv_image *src_image =
+ make_image_for_buffer(vk_device, srcBuffer, proxy_format,
+ VK_IMAGE_USAGE_SAMPLED_BIT,
+ dest_image->type, &cmd_buffer->pool->alloc,
+ &pRegions[r]);
- struct anv_image_view src_iview;
- anv_image_view_init(&src_iview, cmd_buffer->device,
- &(VkImageViewCreateInfo) {
- .sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,
- .image = srcImage,
- .viewType = VK_IMAGE_VIEW_TYPE_2D,
- .format = proxy_format,
- .channels = {
- VK_CHANNEL_SWIZZLE_R,
- VK_CHANNEL_SWIZZLE_G,
- VK_CHANNEL_SWIZZLE_B,
- VK_CHANNEL_SWIZZLE_A
- },
- .subresourceRange = {
- .aspectMask = 1 << proxy_aspect,
- .baseMipLevel = 0,
- .mipLevels = 1,
- .baseArrayLayer = 0,
- .arraySize = 1
- },
- },
- cmd_buffer);
-
- const VkOffset3D dest_offset = {
- .x = pRegions[r].imageOffset.x,
- .y = pRegions[r].imageOffset.y,
- .z = 0,
- };
-
- const uint32_t dest_array_slice =
+ const uint32_t dest_base_array_slice =
meta_blit_get_dest_view_base_array_slice(dest_image,
&pRegions[r].imageSubresource,
&pRegions[r].imageOffset);
- if (pRegions[r].imageExtent.depth > 1)
- anv_finishme("FINISHME: copy multiple depth layers");
+ unsigned num_slices;
+ if (dest_image->type == VK_IMAGE_TYPE_3D) {
+ assert(pRegions[r].imageSubresource.layerCount == 1);
+ num_slices = pRegions[r].imageExtent.depth;
+ } else {
+ assert(pRegions[r].imageExtent.depth == 1);
+ num_slices = pRegions[r].imageSubresource.layerCount;
+ }
- struct anv_image_view dest_iview;
- anv_image_view_init(&dest_iview, cmd_buffer->device,
- &(VkImageViewCreateInfo) {
- .sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,
- .image = anv_image_to_handle(dest_image),
- .viewType = VK_IMAGE_VIEW_TYPE_2D,
- .format = proxy_format,
- .channels = {
- VK_CHANNEL_SWIZZLE_R,
- VK_CHANNEL_SWIZZLE_G,
- VK_CHANNEL_SWIZZLE_B,
- VK_CHANNEL_SWIZZLE_A
+ for (unsigned slice = 0; slice < num_slices; slice++) {
+ struct anv_image_view src_iview;
+ anv_image_view_init(&src_iview, cmd_buffer->device,
+ &(VkImageViewCreateInfo) {
+ .sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,
+ .image = anv_image_to_handle(src_image),
+ .viewType = VK_IMAGE_VIEW_TYPE_2D,
+ .format = proxy_format,
+ .subresourceRange = {
+ .aspectMask = proxy_aspect,
+ .baseMipLevel = 0,
+ .levelCount = 1,
+ .baseArrayLayer = 0,
+ .layerCount = 1,
+ },
},
- .subresourceRange = {
- .aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
- .baseMipLevel = pRegions[r].imageSubresource.mipLevel,
- .mipLevels = 1,
- .baseArrayLayer = dest_array_slice,
- .arraySize = 1
+ cmd_buffer);
+
+ struct anv_image_view dest_iview;
+ anv_image_view_init(&dest_iview, cmd_buffer->device,
+ &(VkImageViewCreateInfo) {
+ .sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,
+ .image = anv_image_to_handle(dest_image),
+ .viewType = anv_meta_get_view_type(dest_image),
+ .format = proxy_format,
+ .subresourceRange = {
+ .aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
+ .baseMipLevel = pRegions[r].imageSubresource.mipLevel,
+ .levelCount = 1,
+ .baseArrayLayer = dest_base_array_slice + slice,
+ .layerCount = 1
+ },
},
- },
- cmd_buffer);
-
- meta_emit_blit(cmd_buffer,
- anv_image_from_handle(srcImage),
- &src_iview,
- (VkOffset3D) { 0, 0, 0 },
- pRegions[r].imageExtent,
- dest_image,
- &dest_iview,
- dest_offset,
- pRegions[r].imageExtent);
+ cmd_buffer);
+
+ VkOffset3D src_offset = { 0, 0, slice };
+
+ const VkOffset3D dest_offset = {
+ .x = pRegions[r].imageOffset.x,
+ .y = pRegions[r].imageOffset.y,
+ .z = 0,
+ };
+
+ meta_emit_blit(cmd_buffer,
+ src_image,
+ &src_iview,
+ src_offset,
+ pRegions[r].imageExtent,
+ dest_image,
+ &dest_iview,
+ dest_offset,
+ pRegions[r].imageExtent,
+ VK_FILTER_NEAREST);
+
+ /* Once we've done the blit, all of the actual information about
+ * the image is embedded in the command buffer so we can just
+ * increment the offset directly in the image effectively
+ * re-binding it to different backing memory.
+ */
+ /* XXX: Insert a real CPP */
+ src_image->offset += src_image->extent.width *
+ src_image->extent.height * 4;
+ }
- anv_DestroyImage(vk_device, srcImage);
+ anv_DestroyImage(vk_device, anv_image_to_handle(src_image),
+ &cmd_buffer->pool->alloc);
}
meta_finish_blit(cmd_buffer, &saved_state);
}
void anv_CmdCopyImageToBuffer(
- VkCmdBuffer cmdBuffer,
+ VkCommandBuffer commandBuffer,
VkImage srcImage,
VkImageLayout srcImageLayout,
VkBuffer destBuffer,
uint32_t regionCount,
const VkBufferImageCopy* pRegions)
{
- ANV_FROM_HANDLE(anv_cmd_buffer, cmd_buffer, cmdBuffer);
+ ANV_FROM_HANDLE(anv_cmd_buffer, cmd_buffer, commandBuffer);
ANV_FROM_HANDLE(anv_image, src_image, srcImage);
VkDevice vk_device = anv_device_to_handle(cmd_buffer->device);
struct anv_meta_saved_state saved_state;
- const VkImageViewType src_iview_type =
- meta_blit_get_src_image_view_type(src_image);
-
meta_prepare_blit(cmd_buffer, &saved_state);
for (unsigned r = 0; r < regionCount; r++) {
- if (pRegions[r].imageSubresource.arraySize > 1)
- anv_finishme("FINISHME: copy multiple array layers");
-
- if (pRegions[r].imageExtent.depth > 1)
- anv_finishme("FINISHME: copy multiple depth layers");
-
struct anv_image_view src_iview;
anv_image_view_init(&src_iview, cmd_buffer->device,
&(VkImageViewCreateInfo) {
.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,
.image = srcImage,
- .viewType = src_iview_type,
+ .viewType = anv_meta_get_view_type(src_image),
.format = src_image->format->vk_format,
- .channels = {
- VK_CHANNEL_SWIZZLE_R,
- VK_CHANNEL_SWIZZLE_G,
- VK_CHANNEL_SWIZZLE_B,
- VK_CHANNEL_SWIZZLE_A
- },
.subresourceRange = {
- .aspectMask = 1 << pRegions[r].imageSubresource.aspect,
+ .aspectMask = pRegions[r].imageSubresource.aspectMask,
.baseMipLevel = pRegions[r].imageSubresource.mipLevel,
- .mipLevels = 1,
- .baseArrayLayer = pRegions[r].imageSubresource.arrayLayer,
- .arraySize = 1
+ .levelCount = 1,
+ .baseArrayLayer = pRegions[r].imageSubresource.baseArrayLayer,
+ .layerCount = pRegions[r].imageSubresource.layerCount,
},
},
cmd_buffer);
dest_format = VK_FORMAT_R8_UINT;
}
- VkImage destImage = make_image_for_buffer(vk_device, destBuffer,
- dest_format, VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT, &pRegions[r]);
+ struct anv_image *dest_image =
+ make_image_for_buffer(vk_device, destBuffer, dest_format,
+ VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT,
+ src_image->type, &cmd_buffer->pool->alloc,
+ &pRegions[r]);
+
+ unsigned num_slices;
+ if (src_image->type == VK_IMAGE_TYPE_3D) {
+ assert(pRegions[r].imageSubresource.layerCount == 1);
+ num_slices = pRegions[r].imageExtent.depth;
+ } else {
+ assert(pRegions[r].imageExtent.depth == 1);
+ num_slices = pRegions[r].imageSubresource.layerCount;
+ }
- struct anv_image_view dest_iview;
- anv_image_view_init(&dest_iview, cmd_buffer->device,
- &(VkImageViewCreateInfo) {
- .sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,
- .image = destImage,
- .viewType = VK_IMAGE_VIEW_TYPE_2D,
- .format = dest_format,
- .channels = {
- VK_CHANNEL_SWIZZLE_R,
- VK_CHANNEL_SWIZZLE_G,
- VK_CHANNEL_SWIZZLE_B,
- VK_CHANNEL_SWIZZLE_A
- },
- .subresourceRange = {
- .aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
- .baseMipLevel = 0,
- .mipLevels = 1,
- .baseArrayLayer = 0,
- .arraySize = 1
+ for (unsigned slice = 0; slice < num_slices; slice++) {
+ VkOffset3D src_offset = pRegions[r].imageOffset;
+ src_offset.z += slice;
+
+ struct anv_image_view dest_iview;
+ anv_image_view_init(&dest_iview, cmd_buffer->device,
+ &(VkImageViewCreateInfo) {
+ .sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,
+ .image = anv_image_to_handle(dest_image),
+ .viewType = VK_IMAGE_VIEW_TYPE_2D,
+ .format = dest_format,
+ .subresourceRange = {
+ .aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
+ .baseMipLevel = 0,
+ .levelCount = 1,
+ .baseArrayLayer = 0,
+ .layerCount = 1
+ },
},
- },
- cmd_buffer);
+ cmd_buffer);
+
+ meta_emit_blit(cmd_buffer,
+ anv_image_from_handle(srcImage),
+ &src_iview,
+ src_offset,
+ pRegions[r].imageExtent,
+ dest_image,
+ &dest_iview,
+ (VkOffset3D) { 0, 0, 0 },
+ pRegions[r].imageExtent,
+ VK_FILTER_NEAREST);
+
+ /* Once we've done the blit, all of the actual information about
+ * the image is embedded in the command buffer so we can just
+ * increment the offset directly in the image effectively
+ * re-binding it to different backing memory.
+ */
+ /* XXX: Insert a real CPP */
+ dest_image->offset += dest_image->extent.width *
+ dest_image->extent.height * 4;
+ }
- meta_emit_blit(cmd_buffer,
- anv_image_from_handle(srcImage),
- &src_iview,
- pRegions[r].imageOffset,
- pRegions[r].imageExtent,
- anv_image_from_handle(destImage),
- &dest_iview,
- (VkOffset3D) { 0, 0, 0 },
- pRegions[r].imageExtent);
-
- anv_DestroyImage(vk_device, destImage);
+ anv_DestroyImage(vk_device, anv_image_to_handle(dest_image),
+ &cmd_buffer->pool->alloc);
}
meta_finish_blit(cmd_buffer, &saved_state);
}
void anv_CmdUpdateBuffer(
- VkCmdBuffer cmdBuffer,
+ VkCommandBuffer commandBuffer,
VkBuffer destBuffer,
VkDeviceSize destOffset,
VkDeviceSize dataSize,
}
void anv_CmdFillBuffer(
- VkCmdBuffer cmdBuffer,
+ VkCommandBuffer commandBuffer,
VkBuffer destBuffer,
VkDeviceSize destOffset,
VkDeviceSize fillSize,
}
void anv_CmdResolveImage(
- VkCmdBuffer cmdBuffer,
+ VkCommandBuffer commandBuffer,
VkImage srcImage,
VkImageLayout srcImageLayout,
VkImage destImage,
void
anv_device_finish_meta(struct anv_device *device)
{
- /* Clear */
- anv_DestroyPipeline(anv_device_to_handle(device),
- device->meta_state.clear.pipeline);
+ anv_device_finish_meta_clear_state(device);
/* Blit */
anv_DestroyRenderPass(anv_device_to_handle(device),
- device->meta_state.blit.render_pass);
+ device->meta_state.blit.render_pass, NULL);
anv_DestroyPipeline(anv_device_to_handle(device),
- device->meta_state.blit.pipeline_2d_src);
+ device->meta_state.blit.pipeline_2d_src, NULL);
anv_DestroyPipeline(anv_device_to_handle(device),
- device->meta_state.blit.pipeline_3d_src);
+ device->meta_state.blit.pipeline_3d_src, NULL);
anv_DestroyPipelineLayout(anv_device_to_handle(device),
- device->meta_state.blit.pipeline_layout);
+ device->meta_state.blit.pipeline_layout, NULL);
anv_DestroyDescriptorSetLayout(anv_device_to_handle(device),
- device->meta_state.blit.ds_layout);
+ device->meta_state.blit.ds_layout, NULL);
}