2 * Copyright © 2015 Intel Corporation
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
31 #include "anv_meta_clear.h"
32 #include "anv_private.h"
33 #include "anv_nir_builder.h"
35 struct anv_render_pass anv_meta_dummy_renderpass
= {0};
38 build_nir_vertex_shader(bool attr_flat
)
42 const struct glsl_type
*vertex_type
= glsl_vec4_type();
44 nir_builder_init_simple_shader(&b
, MESA_SHADER_VERTEX
);
46 nir_variable
*pos_in
= nir_variable_create(b
.shader
, nir_var_shader_in
,
47 vertex_type
, "a_pos");
48 pos_in
->data
.location
= VERT_ATTRIB_GENERIC0
;
49 nir_variable
*pos_out
= nir_variable_create(b
.shader
, nir_var_shader_out
,
50 vertex_type
, "gl_Position");
51 pos_in
->data
.location
= VARYING_SLOT_POS
;
52 nir_copy_var(&b
, pos_out
, pos_in
);
54 /* Add one more pass-through attribute. For clear shaders, this is used
55 * to store the color and for blit shaders it's the texture coordinate.
57 const struct glsl_type
*attr_type
= glsl_vec4_type();
58 nir_variable
*attr_in
= nir_variable_create(b
.shader
, nir_var_shader_in
,
60 attr_in
->data
.location
= VERT_ATTRIB_GENERIC1
;
61 nir_variable
*attr_out
= nir_variable_create(b
.shader
, nir_var_shader_out
,
63 attr_out
->data
.location
= VARYING_SLOT_VAR0
;
64 attr_out
->data
.interpolation
= attr_flat
? INTERP_QUALIFIER_FLAT
:
65 INTERP_QUALIFIER_SMOOTH
;
66 nir_copy_var(&b
, attr_out
, attr_in
);
72 build_nir_copy_fragment_shader(enum glsl_sampler_dim tex_dim
)
76 nir_builder_init_simple_shader(&b
, MESA_SHADER_FRAGMENT
);
78 const struct glsl_type
*color_type
= glsl_vec4_type();
80 nir_variable
*tex_pos_in
= nir_variable_create(b
.shader
, nir_var_shader_in
,
81 glsl_vec4_type(), "v_attr");
82 tex_pos_in
->data
.location
= VARYING_SLOT_VAR0
;
84 const struct glsl_type
*sampler_type
=
85 glsl_sampler_type(tex_dim
, false, false, glsl_get_base_type(color_type
));
86 nir_variable
*sampler
= nir_variable_create(b
.shader
, nir_var_uniform
,
87 sampler_type
, "s_tex");
88 sampler
->data
.descriptor_set
= 0;
89 sampler
->data
.binding
= 0;
91 nir_tex_instr
*tex
= nir_tex_instr_create(b
.shader
, 1);
92 tex
->sampler_dim
= tex_dim
;
93 tex
->op
= nir_texop_tex
;
94 tex
->src
[0].src_type
= nir_tex_src_coord
;
95 tex
->src
[0].src
= nir_src_for_ssa(nir_load_var(&b
, tex_pos_in
));
96 tex
->dest_type
= nir_type_float
; /* TODO */
99 case GLSL_SAMPLER_DIM_2D
:
100 tex
->coord_components
= 2;
102 case GLSL_SAMPLER_DIM_3D
:
103 tex
->coord_components
= 3;
106 assert(!"Unsupported texture dimension");
109 tex
->sampler
= nir_deref_var_create(tex
, sampler
);
111 nir_ssa_dest_init(&tex
->instr
, &tex
->dest
, 4, "tex");
112 nir_builder_instr_insert(&b
, &tex
->instr
);
114 nir_variable
*color_out
= nir_variable_create(b
.shader
, nir_var_shader_out
,
115 color_type
, "f_color");
116 color_out
->data
.location
= FRAG_RESULT_DATA0
;
117 nir_store_var(&b
, color_out
, &tex
->dest
.ssa
);
123 anv_meta_save(struct anv_meta_saved_state
*state
,
124 const struct anv_cmd_buffer
*cmd_buffer
,
125 uint32_t dynamic_mask
)
127 state
->old_pipeline
= cmd_buffer
->state
.pipeline
;
128 state
->old_descriptor_set0
= cmd_buffer
->state
.descriptors
[0];
129 memcpy(state
->old_vertex_bindings
, cmd_buffer
->state
.vertex_bindings
,
130 sizeof(state
->old_vertex_bindings
));
132 state
->dynamic_mask
= dynamic_mask
;
133 anv_dynamic_state_copy(&state
->dynamic
, &cmd_buffer
->state
.dynamic
,
138 anv_meta_restore(const struct anv_meta_saved_state
*state
,
139 struct anv_cmd_buffer
*cmd_buffer
)
141 cmd_buffer
->state
.pipeline
= state
->old_pipeline
;
142 cmd_buffer
->state
.descriptors
[0] = state
->old_descriptor_set0
;
143 memcpy(cmd_buffer
->state
.vertex_bindings
, state
->old_vertex_bindings
,
144 sizeof(state
->old_vertex_bindings
));
146 cmd_buffer
->state
.vb_dirty
|= (1 << ANV_META_VERTEX_BINDING_COUNT
) - 1;
147 cmd_buffer
->state
.dirty
|= ANV_CMD_DIRTY_PIPELINE
;
148 cmd_buffer
->state
.descriptors_dirty
|= VK_SHADER_STAGE_VERTEX_BIT
;
150 anv_dynamic_state_copy(&cmd_buffer
->state
.dynamic
, &state
->dynamic
,
151 state
->dynamic_mask
);
152 cmd_buffer
->state
.dirty
|= state
->dynamic_mask
;
155 static VkImageViewType
156 meta_blit_get_src_image_view_type(const struct anv_image
*src_image
)
158 switch (src_image
->type
) {
159 case VK_IMAGE_TYPE_1D
:
160 return VK_IMAGE_VIEW_TYPE_1D
;
161 case VK_IMAGE_TYPE_2D
:
162 return VK_IMAGE_VIEW_TYPE_2D
;
163 case VK_IMAGE_TYPE_3D
:
164 return VK_IMAGE_VIEW_TYPE_3D
;
166 assert(!"bad VkImageType");
172 meta_blit_get_dest_view_base_array_slice(const struct anv_image
*dest_image
,
173 const VkImageSubresourceCopy
*dest_subresource
,
174 const VkOffset3D
*dest_offset
)
176 switch (dest_image
->type
) {
177 case VK_IMAGE_TYPE_1D
:
178 case VK_IMAGE_TYPE_2D
:
179 return dest_subresource
->arrayLayer
;
180 case VK_IMAGE_TYPE_3D
:
181 /* HACK: Vulkan does not allow attaching a 3D image to a framebuffer,
182 * but meta does it anyway. When doing so, we translate the
183 * destination's z offset into an array offset.
185 return dest_offset
->z
;
187 assert(!"bad VkImageType");
193 anv_device_init_meta_blit_state(struct anv_device
*device
)
195 anv_CreateRenderPass(anv_device_to_handle(device
),
196 &(VkRenderPassCreateInfo
) {
197 .sType
= VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO
,
198 .attachmentCount
= 1,
199 .pAttachments
= &(VkAttachmentDescription
) {
200 .sType
= VK_STRUCTURE_TYPE_ATTACHMENT_DESCRIPTION
,
201 .format
= VK_FORMAT_UNDEFINED
, /* Our shaders don't care */
202 .loadOp
= VK_ATTACHMENT_LOAD_OP_LOAD
,
203 .storeOp
= VK_ATTACHMENT_STORE_OP_STORE
,
204 .initialLayout
= VK_IMAGE_LAYOUT_GENERAL
,
205 .finalLayout
= VK_IMAGE_LAYOUT_GENERAL
,
208 .pSubpasses
= &(VkSubpassDescription
) {
209 .sType
= VK_STRUCTURE_TYPE_SUBPASS_DESCRIPTION
,
210 .pipelineBindPoint
= VK_PIPELINE_BIND_POINT_GRAPHICS
,
213 .pColorAttachments
= &(VkAttachmentReference
) {
215 .layout
= VK_IMAGE_LAYOUT_GENERAL
,
217 .pResolveAttachments
= NULL
,
218 .depthStencilAttachment
= (VkAttachmentReference
) {
219 .attachment
= VK_ATTACHMENT_UNUSED
,
220 .layout
= VK_IMAGE_LAYOUT_GENERAL
,
223 .pPreserveAttachments
= &(VkAttachmentReference
) {
225 .layout
= VK_IMAGE_LAYOUT_GENERAL
,
228 .dependencyCount
= 0,
229 }, &device
->meta_state
.blit
.render_pass
);
231 /* We don't use a vertex shader for clearing, but instead build and pass
232 * the VUEs directly to the rasterization backend. However, we do need
233 * to provide GLSL source for the vertex shader so that the compiler
234 * does not dead-code our inputs.
236 struct anv_shader_module vsm
= {
237 .nir
= build_nir_vertex_shader(false),
240 struct anv_shader_module fsm_2d
= {
241 .nir
= build_nir_copy_fragment_shader(GLSL_SAMPLER_DIM_2D
),
244 struct anv_shader_module fsm_3d
= {
245 .nir
= build_nir_copy_fragment_shader(GLSL_SAMPLER_DIM_3D
),
249 anv_CreateShader(anv_device_to_handle(device
),
250 &(VkShaderCreateInfo
) {
251 .sType
= VK_STRUCTURE_TYPE_SHADER_CREATE_INFO
,
252 .module
= anv_shader_module_to_handle(&vsm
),
257 anv_CreateShader(anv_device_to_handle(device
),
258 &(VkShaderCreateInfo
) {
259 .sType
= VK_STRUCTURE_TYPE_SHADER_CREATE_INFO
,
260 .module
= anv_shader_module_to_handle(&fsm_2d
),
265 anv_CreateShader(anv_device_to_handle(device
),
266 &(VkShaderCreateInfo
) {
267 .sType
= VK_STRUCTURE_TYPE_SHADER_CREATE_INFO
,
268 .module
= anv_shader_module_to_handle(&fsm_3d
),
272 VkPipelineVertexInputStateCreateInfo vi_create_info
= {
273 .sType
= VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO
,
275 .pVertexBindingDescriptions
= (VkVertexInputBindingDescription
[]) {
279 .stepRate
= VK_VERTEX_INPUT_STEP_RATE_VERTEX
283 .strideInBytes
= 5 * sizeof(float),
284 .stepRate
= VK_VERTEX_INPUT_STEP_RATE_VERTEX
288 .pVertexAttributeDescriptions
= (VkVertexInputAttributeDescription
[]) {
293 .format
= VK_FORMAT_R32G32B32A32_UINT
,
300 .format
= VK_FORMAT_R32G32_SFLOAT
,
304 /* Texture Coordinate */
307 .format
= VK_FORMAT_R32G32B32_SFLOAT
,
313 VkDescriptorSetLayoutCreateInfo ds_layout_info
= {
314 .sType
= VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO
,
316 .pBinding
= (VkDescriptorSetLayoutBinding
[]) {
318 .descriptorType
= VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE
,
320 .stageFlags
= VK_SHADER_STAGE_FRAGMENT_BIT
,
321 .pImmutableSamplers
= NULL
325 anv_CreateDescriptorSetLayout(anv_device_to_handle(device
), &ds_layout_info
,
326 &device
->meta_state
.blit
.ds_layout
);
328 anv_CreatePipelineLayout(anv_device_to_handle(device
),
329 &(VkPipelineLayoutCreateInfo
) {
330 .sType
= VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO
,
331 .descriptorSetCount
= 1,
332 .pSetLayouts
= &device
->meta_state
.blit
.ds_layout
,
334 &device
->meta_state
.blit
.pipeline_layout
);
336 VkPipelineShaderStageCreateInfo pipeline_shader_stages
[] = {
338 .sType
= VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO
,
339 .stage
= VK_SHADER_STAGE_VERTEX
,
341 .pSpecializationInfo
= NULL
343 .sType
= VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO
,
344 .stage
= VK_SHADER_STAGE_FRAGMENT
,
345 .shader
= {0}, /* TEMPLATE VALUE! FILL ME IN! */
346 .pSpecializationInfo
= NULL
350 const VkGraphicsPipelineCreateInfo vk_pipeline_info
= {
351 .sType
= VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO
,
352 .stageCount
= ARRAY_SIZE(pipeline_shader_stages
),
353 .pStages
= pipeline_shader_stages
,
354 .pVertexInputState
= &vi_create_info
,
355 .pInputAssemblyState
= &(VkPipelineInputAssemblyStateCreateInfo
) {
356 .sType
= VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO
,
357 .topology
= VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP
,
358 .primitiveRestartEnable
= false,
360 .pViewportState
= &(VkPipelineViewportStateCreateInfo
) {
361 .sType
= VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO
,
365 .pRasterState
= &(VkPipelineRasterStateCreateInfo
) {
366 .sType
= VK_STRUCTURE_TYPE_PIPELINE_RASTER_STATE_CREATE_INFO
,
367 .depthClipEnable
= true,
368 .rasterizerDiscardEnable
= false,
369 .fillMode
= VK_FILL_MODE_SOLID
,
370 .cullMode
= VK_CULL_MODE_NONE
,
371 .frontFace
= VK_FRONT_FACE_CCW
373 .pMultisampleState
= &(VkPipelineMultisampleStateCreateInfo
) {
374 .sType
= VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO
,
376 .sampleShadingEnable
= false,
377 .pSampleMask
= (VkSampleMask
[]) { UINT32_MAX
},
379 .pColorBlendState
= &(VkPipelineColorBlendStateCreateInfo
) {
380 .sType
= VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO
,
381 .attachmentCount
= 1,
382 .pAttachments
= (VkPipelineColorBlendAttachmentState
[]) {
383 { .channelWriteMask
= VK_CHANNEL_A_BIT
|
384 VK_CHANNEL_R_BIT
| VK_CHANNEL_G_BIT
| VK_CHANNEL_B_BIT
},
387 .pDynamicState
= &(VkPipelineDynamicStateCreateInfo
) {
388 .sType
= VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO
,
389 .dynamicStateCount
= 9,
390 .pDynamicStates
= (VkDynamicState
[]) {
391 VK_DYNAMIC_STATE_VIEWPORT
,
392 VK_DYNAMIC_STATE_SCISSOR
,
393 VK_DYNAMIC_STATE_LINE_WIDTH
,
394 VK_DYNAMIC_STATE_DEPTH_BIAS
,
395 VK_DYNAMIC_STATE_BLEND_CONSTANTS
,
396 VK_DYNAMIC_STATE_DEPTH_BOUNDS
,
397 VK_DYNAMIC_STATE_STENCIL_COMPARE_MASK
,
398 VK_DYNAMIC_STATE_STENCIL_WRITE_MASK
,
399 VK_DYNAMIC_STATE_STENCIL_REFERENCE
,
403 .layout
= device
->meta_state
.blit
.pipeline_layout
,
404 .renderPass
= device
->meta_state
.blit
.render_pass
,
408 const struct anv_graphics_pipeline_create_info anv_pipeline_info
= {
409 .use_repclear
= false,
410 .disable_viewport
= true,
411 .disable_scissor
= true,
416 pipeline_shader_stages
[1].shader
= fs_2d
;
417 anv_graphics_pipeline_create(anv_device_to_handle(device
),
418 &vk_pipeline_info
, &anv_pipeline_info
,
419 &device
->meta_state
.blit
.pipeline_2d_src
);
421 pipeline_shader_stages
[1].shader
= fs_3d
;
422 anv_graphics_pipeline_create(anv_device_to_handle(device
),
423 &vk_pipeline_info
, &anv_pipeline_info
,
424 &device
->meta_state
.blit
.pipeline_3d_src
);
426 anv_DestroyShader(anv_device_to_handle(device
), vs
);
427 anv_DestroyShader(anv_device_to_handle(device
), fs_2d
);
428 anv_DestroyShader(anv_device_to_handle(device
), fs_3d
);
429 ralloc_free(vsm
.nir
);
430 ralloc_free(fsm_2d
.nir
);
431 ralloc_free(fsm_3d
.nir
);
435 meta_prepare_blit(struct anv_cmd_buffer
*cmd_buffer
,
436 struct anv_meta_saved_state
*saved_state
)
438 anv_meta_save(saved_state
, cmd_buffer
,
439 (1 << VK_DYNAMIC_STATE_VIEWPORT
));
443 VkOffset3D src_offset
;
444 VkExtent3D src_extent
;
445 VkOffset3D dest_offset
;
446 VkExtent3D dest_extent
;
450 meta_emit_blit(struct anv_cmd_buffer
*cmd_buffer
,
451 struct anv_image
*src_image
,
452 struct anv_image_view
*src_iview
,
453 VkOffset3D src_offset
,
454 VkExtent3D src_extent
,
455 struct anv_image
*dest_image
,
456 struct anv_image_view
*dest_iview
,
457 VkOffset3D dest_offset
,
458 VkExtent3D dest_extent
)
460 struct anv_device
*device
= cmd_buffer
->device
;
461 VkDescriptorPool dummy_desc_pool
= { .handle
= 1 };
463 struct blit_vb_data
{
468 unsigned vb_size
= sizeof(struct anv_vue_header
) + 3 * sizeof(*vb_data
);
470 struct anv_state vb_state
=
471 anv_cmd_buffer_alloc_dynamic_state(cmd_buffer
, vb_size
, 16);
472 memset(vb_state
.map
, 0, sizeof(struct anv_vue_header
));
473 vb_data
= vb_state
.map
+ sizeof(struct anv_vue_header
);
475 vb_data
[0] = (struct blit_vb_data
) {
477 dest_offset
.x
+ dest_extent
.width
,
478 dest_offset
.y
+ dest_extent
.height
,
481 (float)(src_offset
.x
+ src_extent
.width
) / (float)src_iview
->extent
.width
,
482 (float)(src_offset
.y
+ src_extent
.height
) / (float)src_iview
->extent
.height
,
483 (float)(src_offset
.z
+ src_extent
.depth
) / (float)src_iview
->extent
.depth
,
487 vb_data
[1] = (struct blit_vb_data
) {
490 dest_offset
.y
+ dest_extent
.height
,
493 (float)src_offset
.x
/ (float)src_iview
->extent
.width
,
494 (float)(src_offset
.y
+ src_extent
.height
) / (float)src_iview
->extent
.height
,
495 (float)(src_offset
.z
+ src_extent
.depth
) / (float)src_iview
->extent
.depth
,
499 vb_data
[2] = (struct blit_vb_data
) {
505 (float)src_offset
.x
/ (float)src_iview
->extent
.width
,
506 (float)src_offset
.y
/ (float)src_iview
->extent
.height
,
507 (float)src_offset
.z
/ (float)src_iview
->extent
.depth
,
511 struct anv_buffer vertex_buffer
= {
514 .bo
= &device
->dynamic_state_block_pool
.bo
,
515 .offset
= vb_state
.offset
,
518 anv_CmdBindVertexBuffers(anv_cmd_buffer_to_handle(cmd_buffer
), 0, 2,
520 anv_buffer_to_handle(&vertex_buffer
),
521 anv_buffer_to_handle(&vertex_buffer
)
525 sizeof(struct anv_vue_header
),
529 anv_AllocDescriptorSets(anv_device_to_handle(device
), dummy_desc_pool
,
530 VK_DESCRIPTOR_SET_USAGE_ONE_SHOT
,
531 1, &device
->meta_state
.blit
.ds_layout
, &set
);
532 anv_UpdateDescriptorSets(anv_device_to_handle(device
),
534 (VkWriteDescriptorSet
[]) {
536 .sType
= VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET
,
539 .destArrayElement
= 0,
541 .descriptorType
= VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE
,
542 .pDescriptors
= (VkDescriptorInfo
[]) {
544 .imageView
= anv_image_view_to_handle(src_iview
),
545 .imageLayout
= VK_IMAGE_LAYOUT_GENERAL
552 anv_CreateFramebuffer(anv_device_to_handle(device
),
553 &(VkFramebufferCreateInfo
) {
554 .sType
= VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO
,
555 .attachmentCount
= 1,
556 .pAttachments
= (VkImageView
[]) {
557 anv_image_view_to_handle(dest_iview
),
559 .width
= dest_iview
->extent
.width
,
560 .height
= dest_iview
->extent
.height
,
564 ANV_CALL(CmdBeginRenderPass
)(anv_cmd_buffer_to_handle(cmd_buffer
),
565 &(VkRenderPassBeginInfo
) {
566 .sType
= VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO
,
567 .renderPass
= device
->meta_state
.blit
.render_pass
,
570 .offset
= { dest_offset
.x
, dest_offset
.y
},
571 .extent
= { dest_extent
.width
, dest_extent
.height
},
573 .clearValueCount
= 0,
574 .pClearValues
= NULL
,
575 }, VK_RENDER_PASS_CONTENTS_INLINE
);
579 switch (src_image
->type
) {
580 case VK_IMAGE_TYPE_1D
:
581 anv_finishme("VK_IMAGE_TYPE_1D");
582 pipeline
= device
->meta_state
.blit
.pipeline_2d_src
;
584 case VK_IMAGE_TYPE_2D
:
585 pipeline
= device
->meta_state
.blit
.pipeline_2d_src
;
587 case VK_IMAGE_TYPE_3D
:
588 pipeline
= device
->meta_state
.blit
.pipeline_3d_src
;
591 unreachable(!"bad VkImageType");
594 if (cmd_buffer
->state
.pipeline
!= anv_pipeline_from_handle(pipeline
)) {
595 anv_CmdBindPipeline(anv_cmd_buffer_to_handle(cmd_buffer
),
596 VK_PIPELINE_BIND_POINT_GRAPHICS
, pipeline
);
599 anv_CmdSetViewport(anv_cmd_buffer_to_handle(cmd_buffer
), 1,
603 .width
= dest_iview
->extent
.width
,
604 .height
= dest_iview
->extent
.height
,
609 anv_CmdBindDescriptorSets(anv_cmd_buffer_to_handle(cmd_buffer
),
610 VK_PIPELINE_BIND_POINT_GRAPHICS
,
611 device
->meta_state
.blit
.pipeline_layout
, 0, 1,
614 ANV_CALL(CmdDraw
)(anv_cmd_buffer_to_handle(cmd_buffer
), 3, 1, 0, 0);
616 ANV_CALL(CmdEndRenderPass
)(anv_cmd_buffer_to_handle(cmd_buffer
));
618 /* At the point where we emit the draw call, all data from the
619 * descriptor sets, etc. has been used. We are free to delete it.
621 anv_descriptor_set_destroy(device
, anv_descriptor_set_from_handle(set
));
622 anv_DestroyFramebuffer(anv_device_to_handle(device
), fb
);
626 meta_finish_blit(struct anv_cmd_buffer
*cmd_buffer
,
627 const struct anv_meta_saved_state
*saved_state
)
629 anv_meta_restore(saved_state
, cmd_buffer
);
633 vk_format_for_cpp(int cpp
)
636 case 1: return VK_FORMAT_R8_UINT
;
637 case 2: return VK_FORMAT_R8G8_UINT
;
638 case 3: return VK_FORMAT_R8G8B8_UINT
;
639 case 4: return VK_FORMAT_R8G8B8A8_UINT
;
640 case 6: return VK_FORMAT_R16G16B16_UINT
;
641 case 8: return VK_FORMAT_R16G16B16A16_UINT
;
642 case 12: return VK_FORMAT_R32G32B32_UINT
;
643 case 16: return VK_FORMAT_R32G32B32A32_UINT
;
645 unreachable("Invalid format cpp");
650 do_buffer_copy(struct anv_cmd_buffer
*cmd_buffer
,
651 struct anv_bo
*src
, uint64_t src_offset
,
652 struct anv_bo
*dest
, uint64_t dest_offset
,
653 int width
, int height
, VkFormat copy_format
)
655 VkDevice vk_device
= anv_device_to_handle(cmd_buffer
->device
);
657 VkImageCreateInfo image_info
= {
658 .sType
= VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO
,
659 .imageType
= VK_IMAGE_TYPE_2D
,
660 .format
= copy_format
,
669 .tiling
= VK_IMAGE_TILING_LINEAR
,
675 image_info
.usage
= VK_IMAGE_USAGE_SAMPLED_BIT
;
676 anv_CreateImage(vk_device
, &image_info
, &src_image
);
679 image_info
.usage
= VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT
;
680 anv_CreateImage(vk_device
, &image_info
, &dest_image
);
682 /* We could use a vk call to bind memory, but that would require
683 * creating a dummy memory object etc. so there's really no point.
685 anv_image_from_handle(src_image
)->bo
= src
;
686 anv_image_from_handle(src_image
)->offset
= src_offset
;
687 anv_image_from_handle(dest_image
)->bo
= dest
;
688 anv_image_from_handle(dest_image
)->offset
= dest_offset
;
690 struct anv_image_view src_iview
;
691 anv_image_view_init(&src_iview
, cmd_buffer
->device
,
692 &(VkImageViewCreateInfo
) {
693 .sType
= VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO
,
695 .viewType
= VK_IMAGE_VIEW_TYPE_2D
,
696 .format
= copy_format
,
698 VK_CHANNEL_SWIZZLE_R
,
699 VK_CHANNEL_SWIZZLE_G
,
700 VK_CHANNEL_SWIZZLE_B
,
703 .subresourceRange
= {
704 .aspectMask
= VK_IMAGE_ASPECT_COLOR_BIT
,
713 struct anv_image_view dest_iview
;
714 anv_image_view_init(&dest_iview
, cmd_buffer
->device
,
715 &(VkImageViewCreateInfo
) {
716 .sType
= VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO
,
718 .viewType
= VK_IMAGE_VIEW_TYPE_2D
,
719 .format
= copy_format
,
721 .r
= VK_CHANNEL_SWIZZLE_R
,
722 .g
= VK_CHANNEL_SWIZZLE_G
,
723 .b
= VK_CHANNEL_SWIZZLE_B
,
724 .a
= VK_CHANNEL_SWIZZLE_A
,
726 .subresourceRange
= {
727 .aspectMask
= VK_IMAGE_ASPECT_COLOR_BIT
,
736 meta_emit_blit(cmd_buffer
,
737 anv_image_from_handle(src_image
),
739 (VkOffset3D
) { 0, 0, 0 },
740 (VkExtent3D
) { width
, height
, 1 },
741 anv_image_from_handle(dest_image
),
743 (VkOffset3D
) { 0, 0, 0 },
744 (VkExtent3D
) { width
, height
, 1 });
746 anv_DestroyImage(vk_device
, src_image
);
747 anv_DestroyImage(vk_device
, dest_image
);
750 void anv_CmdCopyBuffer(
751 VkCmdBuffer cmdBuffer
,
754 uint32_t regionCount
,
755 const VkBufferCopy
* pRegions
)
757 ANV_FROM_HANDLE(anv_cmd_buffer
, cmd_buffer
, cmdBuffer
);
758 ANV_FROM_HANDLE(anv_buffer
, src_buffer
, srcBuffer
);
759 ANV_FROM_HANDLE(anv_buffer
, dest_buffer
, destBuffer
);
761 struct anv_meta_saved_state saved_state
;
763 meta_prepare_blit(cmd_buffer
, &saved_state
);
765 for (unsigned r
= 0; r
< regionCount
; r
++) {
766 uint64_t src_offset
= src_buffer
->offset
+ pRegions
[r
].srcOffset
;
767 uint64_t dest_offset
= dest_buffer
->offset
+ pRegions
[r
].destOffset
;
768 uint64_t copy_size
= pRegions
[r
].copySize
;
770 /* First, we compute the biggest format that can be used with the
771 * given offsets and size.
775 int fs
= ffs(src_offset
) - 1;
777 cpp
= MIN2(cpp
, 1 << fs
);
778 assert(src_offset
% cpp
== 0);
780 fs
= ffs(dest_offset
) - 1;
782 cpp
= MIN2(cpp
, 1 << fs
);
783 assert(dest_offset
% cpp
== 0);
785 fs
= ffs(pRegions
[r
].copySize
) - 1;
787 cpp
= MIN2(cpp
, 1 << fs
);
788 assert(pRegions
[r
].copySize
% cpp
== 0);
790 VkFormat copy_format
= vk_format_for_cpp(cpp
);
792 /* This is maximum possible width/height our HW can handle */
793 uint64_t max_surface_dim
= 1 << 14;
795 /* First, we make a bunch of max-sized copies */
796 uint64_t max_copy_size
= max_surface_dim
* max_surface_dim
* cpp
;
797 while (copy_size
> max_copy_size
) {
798 do_buffer_copy(cmd_buffer
, src_buffer
->bo
, src_offset
,
799 dest_buffer
->bo
, dest_offset
,
800 max_surface_dim
, max_surface_dim
, copy_format
);
801 copy_size
-= max_copy_size
;
802 src_offset
+= max_copy_size
;
803 dest_offset
+= max_copy_size
;
806 uint64_t height
= copy_size
/ (max_surface_dim
* cpp
);
807 assert(height
< max_surface_dim
);
809 uint64_t rect_copy_size
= height
* max_surface_dim
* cpp
;
810 do_buffer_copy(cmd_buffer
, src_buffer
->bo
, src_offset
,
811 dest_buffer
->bo
, dest_offset
,
812 max_surface_dim
, height
, copy_format
);
813 copy_size
-= rect_copy_size
;
814 src_offset
+= rect_copy_size
;
815 dest_offset
+= rect_copy_size
;
818 if (copy_size
!= 0) {
819 do_buffer_copy(cmd_buffer
, src_buffer
->bo
, src_offset
,
820 dest_buffer
->bo
, dest_offset
,
821 copy_size
/ cpp
, 1, copy_format
);
825 meta_finish_blit(cmd_buffer
, &saved_state
);
828 void anv_CmdCopyImage(
829 VkCmdBuffer cmdBuffer
,
831 VkImageLayout srcImageLayout
,
833 VkImageLayout destImageLayout
,
834 uint32_t regionCount
,
835 const VkImageCopy
* pRegions
)
837 ANV_FROM_HANDLE(anv_cmd_buffer
, cmd_buffer
, cmdBuffer
);
838 ANV_FROM_HANDLE(anv_image
, src_image
, srcImage
);
839 ANV_FROM_HANDLE(anv_image
, dest_image
, destImage
);
841 const VkImageViewType src_iview_type
=
842 meta_blit_get_src_image_view_type(src_image
);
844 struct anv_meta_saved_state saved_state
;
846 meta_prepare_blit(cmd_buffer
, &saved_state
);
848 for (unsigned r
= 0; r
< regionCount
; r
++) {
849 struct anv_image_view src_iview
;
850 anv_image_view_init(&src_iview
, cmd_buffer
->device
,
851 &(VkImageViewCreateInfo
) {
852 .sType
= VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO
,
854 .viewType
= src_iview_type
,
855 .format
= src_image
->format
->vk_format
,
857 VK_CHANNEL_SWIZZLE_R
,
858 VK_CHANNEL_SWIZZLE_G
,
859 VK_CHANNEL_SWIZZLE_B
,
862 .subresourceRange
= {
863 .aspectMask
= 1 << pRegions
[r
].srcSubresource
.aspect
,
864 .baseMipLevel
= pRegions
[r
].srcSubresource
.mipLevel
,
866 .baseArrayLayer
= pRegions
[r
].srcSubresource
.arrayLayer
,
872 const VkOffset3D dest_offset
= {
873 .x
= pRegions
[r
].destOffset
.x
,
874 .y
= pRegions
[r
].destOffset
.y
,
878 const uint32_t dest_array_slice
=
879 meta_blit_get_dest_view_base_array_slice(dest_image
,
880 &pRegions
[r
].destSubresource
,
881 &pRegions
[r
].destOffset
);
883 if (pRegions
[r
].srcSubresource
.arraySize
> 1)
884 anv_finishme("FINISHME: copy multiple array layers");
886 if (pRegions
[r
].extent
.depth
> 1)
887 anv_finishme("FINISHME: copy multiple depth layers");
889 struct anv_image_view dest_iview
;
890 anv_image_view_init(&dest_iview
, cmd_buffer
->device
,
891 &(VkImageViewCreateInfo
) {
892 .sType
= VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO
,
894 .viewType
= VK_IMAGE_VIEW_TYPE_2D
,
895 .format
= dest_image
->format
->vk_format
,
897 VK_CHANNEL_SWIZZLE_R
,
898 VK_CHANNEL_SWIZZLE_G
,
899 VK_CHANNEL_SWIZZLE_B
,
902 .subresourceRange
= {
903 .aspectMask
= VK_IMAGE_ASPECT_COLOR_BIT
,
904 .baseMipLevel
= pRegions
[r
].destSubresource
.mipLevel
,
906 .baseArrayLayer
= dest_array_slice
,
912 meta_emit_blit(cmd_buffer
,
913 src_image
, &src_iview
,
914 pRegions
[r
].srcOffset
,
916 dest_image
, &dest_iview
,
921 meta_finish_blit(cmd_buffer
, &saved_state
);
924 void anv_CmdBlitImage(
925 VkCmdBuffer cmdBuffer
,
927 VkImageLayout srcImageLayout
,
929 VkImageLayout destImageLayout
,
930 uint32_t regionCount
,
931 const VkImageBlit
* pRegions
,
935 ANV_FROM_HANDLE(anv_cmd_buffer
, cmd_buffer
, cmdBuffer
);
936 ANV_FROM_HANDLE(anv_image
, src_image
, srcImage
);
937 ANV_FROM_HANDLE(anv_image
, dest_image
, destImage
);
939 const VkImageViewType src_iview_type
=
940 meta_blit_get_src_image_view_type(src_image
);
942 struct anv_meta_saved_state saved_state
;
944 anv_finishme("respect VkTexFilter");
946 meta_prepare_blit(cmd_buffer
, &saved_state
);
948 for (unsigned r
= 0; r
< regionCount
; r
++) {
949 struct anv_image_view src_iview
;
950 anv_image_view_init(&src_iview
, cmd_buffer
->device
,
951 &(VkImageViewCreateInfo
) {
952 .sType
= VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO
,
954 .viewType
= src_iview_type
,
955 .format
= src_image
->format
->vk_format
,
957 VK_CHANNEL_SWIZZLE_R
,
958 VK_CHANNEL_SWIZZLE_G
,
959 VK_CHANNEL_SWIZZLE_B
,
962 .subresourceRange
= {
963 .aspectMask
= 1 << pRegions
[r
].srcSubresource
.aspect
,
964 .baseMipLevel
= pRegions
[r
].srcSubresource
.mipLevel
,
966 .baseArrayLayer
= pRegions
[r
].srcSubresource
.arrayLayer
,
972 const VkOffset3D dest_offset
= {
973 .x
= pRegions
[r
].destOffset
.x
,
974 .y
= pRegions
[r
].destOffset
.y
,
978 const uint32_t dest_array_slice
=
979 meta_blit_get_dest_view_base_array_slice(dest_image
,
980 &pRegions
[r
].destSubresource
,
981 &pRegions
[r
].destOffset
);
983 if (pRegions
[r
].srcSubresource
.arraySize
> 1)
984 anv_finishme("FINISHME: copy multiple array layers");
986 if (pRegions
[r
].destExtent
.depth
> 1)
987 anv_finishme("FINISHME: copy multiple depth layers");
989 struct anv_image_view dest_iview
;
990 anv_image_view_init(&dest_iview
, cmd_buffer
->device
,
991 &(VkImageViewCreateInfo
) {
992 .sType
= VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO
,
994 .viewType
= VK_IMAGE_VIEW_TYPE_2D
,
995 .format
= dest_image
->format
->vk_format
,
997 VK_CHANNEL_SWIZZLE_R
,
998 VK_CHANNEL_SWIZZLE_G
,
999 VK_CHANNEL_SWIZZLE_B
,
1000 VK_CHANNEL_SWIZZLE_A
1002 .subresourceRange
= {
1003 .aspectMask
= VK_IMAGE_ASPECT_COLOR_BIT
,
1004 .baseMipLevel
= pRegions
[r
].destSubresource
.mipLevel
,
1006 .baseArrayLayer
= dest_array_slice
,
1012 meta_emit_blit(cmd_buffer
,
1013 src_image
, &src_iview
,
1014 pRegions
[r
].srcOffset
,
1015 pRegions
[r
].srcExtent
,
1016 dest_image
, &dest_iview
,
1018 pRegions
[r
].destExtent
);
1021 meta_finish_blit(cmd_buffer
, &saved_state
);
1025 make_image_for_buffer(VkDevice vk_device
, VkBuffer vk_buffer
, VkFormat format
,
1026 VkImageUsageFlags usage
,
1027 const VkBufferImageCopy
*copy
)
1029 ANV_FROM_HANDLE(anv_buffer
, buffer
, vk_buffer
);
1031 VkExtent3D extent
= copy
->imageExtent
;
1032 if (copy
->bufferRowLength
)
1033 extent
.width
= copy
->bufferRowLength
;
1034 if (copy
->bufferImageHeight
)
1035 extent
.height
= copy
->bufferImageHeight
;
1039 VkResult result
= anv_CreateImage(vk_device
,
1040 &(VkImageCreateInfo
) {
1041 .sType
= VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO
,
1042 .imageType
= VK_IMAGE_TYPE_2D
,
1048 .tiling
= VK_IMAGE_TILING_LINEAR
,
1052 assert(result
== VK_SUCCESS
);
1054 ANV_FROM_HANDLE(anv_image
, image
, vk_image
);
1056 /* We could use a vk call to bind memory, but that would require
1057 * creating a dummy memory object etc. so there's really no point.
1059 image
->bo
= buffer
->bo
;
1060 image
->offset
= buffer
->offset
+ copy
->bufferOffset
;
1062 return anv_image_to_handle(image
);
1065 void anv_CmdCopyBufferToImage(
1066 VkCmdBuffer cmdBuffer
,
1069 VkImageLayout destImageLayout
,
1070 uint32_t regionCount
,
1071 const VkBufferImageCopy
* pRegions
)
1073 ANV_FROM_HANDLE(anv_cmd_buffer
, cmd_buffer
, cmdBuffer
);
1074 ANV_FROM_HANDLE(anv_image
, dest_image
, destImage
);
1075 VkDevice vk_device
= anv_device_to_handle(cmd_buffer
->device
);
1076 const VkFormat orig_format
= dest_image
->format
->vk_format
;
1077 struct anv_meta_saved_state saved_state
;
1079 meta_prepare_blit(cmd_buffer
, &saved_state
);
1081 for (unsigned r
= 0; r
< regionCount
; r
++) {
1082 VkFormat proxy_format
= orig_format
;
1083 VkImageAspect proxy_aspect
= pRegions
[r
].imageSubresource
.aspect
;
1085 if (orig_format
== VK_FORMAT_S8_UINT
) {
1086 proxy_format
= VK_FORMAT_R8_UINT
;
1087 proxy_aspect
= VK_IMAGE_ASPECT_COLOR
;
1090 VkImage srcImage
= make_image_for_buffer(vk_device
, srcBuffer
,
1091 proxy_format
, VK_IMAGE_USAGE_SAMPLED_BIT
, &pRegions
[r
]);
1093 struct anv_image_view src_iview
;
1094 anv_image_view_init(&src_iview
, cmd_buffer
->device
,
1095 &(VkImageViewCreateInfo
) {
1096 .sType
= VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO
,
1098 .viewType
= VK_IMAGE_VIEW_TYPE_2D
,
1099 .format
= proxy_format
,
1101 VK_CHANNEL_SWIZZLE_R
,
1102 VK_CHANNEL_SWIZZLE_G
,
1103 VK_CHANNEL_SWIZZLE_B
,
1104 VK_CHANNEL_SWIZZLE_A
1106 .subresourceRange
= {
1107 .aspectMask
= 1 << proxy_aspect
,
1110 .baseArrayLayer
= 0,
1116 const VkOffset3D dest_offset
= {
1117 .x
= pRegions
[r
].imageOffset
.x
,
1118 .y
= pRegions
[r
].imageOffset
.y
,
1122 const uint32_t dest_array_slice
=
1123 meta_blit_get_dest_view_base_array_slice(dest_image
,
1124 &pRegions
[r
].imageSubresource
,
1125 &pRegions
[r
].imageOffset
);
1127 if (pRegions
[r
].imageExtent
.depth
> 1)
1128 anv_finishme("FINISHME: copy multiple depth layers");
1130 struct anv_image_view dest_iview
;
1131 anv_image_view_init(&dest_iview
, cmd_buffer
->device
,
1132 &(VkImageViewCreateInfo
) {
1133 .sType
= VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO
,
1134 .image
= anv_image_to_handle(dest_image
),
1135 .viewType
= VK_IMAGE_VIEW_TYPE_2D
,
1136 .format
= proxy_format
,
1138 VK_CHANNEL_SWIZZLE_R
,
1139 VK_CHANNEL_SWIZZLE_G
,
1140 VK_CHANNEL_SWIZZLE_B
,
1141 VK_CHANNEL_SWIZZLE_A
1143 .subresourceRange
= {
1144 .aspectMask
= VK_IMAGE_ASPECT_COLOR_BIT
,
1145 .baseMipLevel
= pRegions
[r
].imageSubresource
.mipLevel
,
1147 .baseArrayLayer
= dest_array_slice
,
1153 meta_emit_blit(cmd_buffer
,
1154 anv_image_from_handle(srcImage
),
1156 (VkOffset3D
) { 0, 0, 0 },
1157 pRegions
[r
].imageExtent
,
1161 pRegions
[r
].imageExtent
);
1163 anv_DestroyImage(vk_device
, srcImage
);
1166 meta_finish_blit(cmd_buffer
, &saved_state
);
1169 void anv_CmdCopyImageToBuffer(
1170 VkCmdBuffer cmdBuffer
,
1172 VkImageLayout srcImageLayout
,
1173 VkBuffer destBuffer
,
1174 uint32_t regionCount
,
1175 const VkBufferImageCopy
* pRegions
)
1177 ANV_FROM_HANDLE(anv_cmd_buffer
, cmd_buffer
, cmdBuffer
);
1178 ANV_FROM_HANDLE(anv_image
, src_image
, srcImage
);
1179 VkDevice vk_device
= anv_device_to_handle(cmd_buffer
->device
);
1180 struct anv_meta_saved_state saved_state
;
1182 const VkImageViewType src_iview_type
=
1183 meta_blit_get_src_image_view_type(src_image
);
1185 meta_prepare_blit(cmd_buffer
, &saved_state
);
1187 for (unsigned r
= 0; r
< regionCount
; r
++) {
1188 if (pRegions
[r
].imageSubresource
.arraySize
> 1)
1189 anv_finishme("FINISHME: copy multiple array layers");
1191 if (pRegions
[r
].imageExtent
.depth
> 1)
1192 anv_finishme("FINISHME: copy multiple depth layers");
1194 struct anv_image_view src_iview
;
1195 anv_image_view_init(&src_iview
, cmd_buffer
->device
,
1196 &(VkImageViewCreateInfo
) {
1197 .sType
= VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO
,
1199 .viewType
= src_iview_type
,
1200 .format
= src_image
->format
->vk_format
,
1202 VK_CHANNEL_SWIZZLE_R
,
1203 VK_CHANNEL_SWIZZLE_G
,
1204 VK_CHANNEL_SWIZZLE_B
,
1205 VK_CHANNEL_SWIZZLE_A
1207 .subresourceRange
= {
1208 .aspectMask
= 1 << pRegions
[r
].imageSubresource
.aspect
,
1209 .baseMipLevel
= pRegions
[r
].imageSubresource
.mipLevel
,
1211 .baseArrayLayer
= pRegions
[r
].imageSubresource
.arrayLayer
,
1217 VkFormat dest_format
= src_image
->format
->vk_format
;
1218 if (dest_format
== VK_FORMAT_S8_UINT
) {
1219 dest_format
= VK_FORMAT_R8_UINT
;
1222 VkImage destImage
= make_image_for_buffer(vk_device
, destBuffer
,
1223 dest_format
, VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT
, &pRegions
[r
]);
1225 struct anv_image_view dest_iview
;
1226 anv_image_view_init(&dest_iview
, cmd_buffer
->device
,
1227 &(VkImageViewCreateInfo
) {
1228 .sType
= VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO
,
1230 .viewType
= VK_IMAGE_VIEW_TYPE_2D
,
1231 .format
= dest_format
,
1233 VK_CHANNEL_SWIZZLE_R
,
1234 VK_CHANNEL_SWIZZLE_G
,
1235 VK_CHANNEL_SWIZZLE_B
,
1236 VK_CHANNEL_SWIZZLE_A
1238 .subresourceRange
= {
1239 .aspectMask
= VK_IMAGE_ASPECT_COLOR_BIT
,
1242 .baseArrayLayer
= 0,
1248 meta_emit_blit(cmd_buffer
,
1249 anv_image_from_handle(srcImage
),
1251 pRegions
[r
].imageOffset
,
1252 pRegions
[r
].imageExtent
,
1253 anv_image_from_handle(destImage
),
1255 (VkOffset3D
) { 0, 0, 0 },
1256 pRegions
[r
].imageExtent
);
1258 anv_DestroyImage(vk_device
, destImage
);
1261 meta_finish_blit(cmd_buffer
, &saved_state
);
1264 void anv_CmdUpdateBuffer(
1265 VkCmdBuffer cmdBuffer
,
1266 VkBuffer destBuffer
,
1267 VkDeviceSize destOffset
,
1268 VkDeviceSize dataSize
,
1269 const uint32_t* pData
)
1274 void anv_CmdFillBuffer(
1275 VkCmdBuffer cmdBuffer
,
1276 VkBuffer destBuffer
,
1277 VkDeviceSize destOffset
,
1278 VkDeviceSize fillSize
,
1284 void anv_CmdResolveImage(
1285 VkCmdBuffer cmdBuffer
,
1287 VkImageLayout srcImageLayout
,
1289 VkImageLayout destImageLayout
,
1290 uint32_t regionCount
,
1291 const VkImageResolve
* pRegions
)
1297 anv_device_init_meta(struct anv_device
*device
)
1299 anv_device_init_meta_clear_state(device
);
1300 anv_device_init_meta_blit_state(device
);
1304 anv_device_finish_meta(struct anv_device
*device
)
1306 anv_device_finish_meta_clear_state(device
);
1309 anv_DestroyRenderPass(anv_device_to_handle(device
),
1310 device
->meta_state
.blit
.render_pass
);
1311 anv_DestroyPipeline(anv_device_to_handle(device
),
1312 device
->meta_state
.blit
.pipeline_2d_src
);
1313 anv_DestroyPipeline(anv_device_to_handle(device
),
1314 device
->meta_state
.blit
.pipeline_3d_src
);
1315 anv_DestroyPipelineLayout(anv_device_to_handle(device
),
1316 device
->meta_state
.blit
.pipeline_layout
);
1317 anv_DestroyDescriptorSetLayout(anv_device_to_handle(device
),
1318 device
->meta_state
.blit
.ds_layout
);