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 */
98 if (tex_dim
== GLSL_SAMPLER_DIM_2D
)
100 tex
->coord_components
= 3;
102 tex
->sampler
= nir_deref_var_create(tex
, sampler
);
104 nir_ssa_dest_init(&tex
->instr
, &tex
->dest
, 4, "tex");
105 nir_builder_instr_insert(&b
, &tex
->instr
);
107 nir_variable
*color_out
= nir_variable_create(b
.shader
, nir_var_shader_out
,
108 color_type
, "f_color");
109 color_out
->data
.location
= FRAG_RESULT_DATA0
;
110 nir_store_var(&b
, color_out
, &tex
->dest
.ssa
);
116 anv_meta_save(struct anv_meta_saved_state
*state
,
117 const struct anv_cmd_buffer
*cmd_buffer
,
118 uint32_t dynamic_mask
)
120 state
->old_pipeline
= cmd_buffer
->state
.pipeline
;
121 state
->old_descriptor_set0
= cmd_buffer
->state
.descriptors
[0];
122 memcpy(state
->old_vertex_bindings
, cmd_buffer
->state
.vertex_bindings
,
123 sizeof(state
->old_vertex_bindings
));
125 state
->dynamic_mask
= dynamic_mask
;
126 anv_dynamic_state_copy(&state
->dynamic
, &cmd_buffer
->state
.dynamic
,
131 anv_meta_restore(const struct anv_meta_saved_state
*state
,
132 struct anv_cmd_buffer
*cmd_buffer
)
134 cmd_buffer
->state
.pipeline
= state
->old_pipeline
;
135 cmd_buffer
->state
.descriptors
[0] = state
->old_descriptor_set0
;
136 memcpy(cmd_buffer
->state
.vertex_bindings
, state
->old_vertex_bindings
,
137 sizeof(state
->old_vertex_bindings
));
139 cmd_buffer
->state
.vb_dirty
|= (1 << ANV_META_VERTEX_BINDING_COUNT
) - 1;
140 cmd_buffer
->state
.dirty
|= ANV_CMD_DIRTY_PIPELINE
;
141 cmd_buffer
->state
.descriptors_dirty
|= VK_SHADER_STAGE_VERTEX_BIT
;
143 anv_dynamic_state_copy(&cmd_buffer
->state
.dynamic
, &state
->dynamic
,
144 state
->dynamic_mask
);
145 cmd_buffer
->state
.dirty
|= state
->dynamic_mask
;
148 static VkImageViewType
149 meta_blit_get_src_image_view_type(const struct anv_image
*src_image
)
151 switch (src_image
->type
) {
152 case VK_IMAGE_TYPE_1D
:
153 return VK_IMAGE_VIEW_TYPE_1D
;
154 case VK_IMAGE_TYPE_2D
:
155 return VK_IMAGE_VIEW_TYPE_2D
;
156 case VK_IMAGE_TYPE_3D
:
157 return VK_IMAGE_VIEW_TYPE_3D
;
159 assert(!"bad VkImageType");
165 meta_blit_get_dest_view_base_array_slice(const struct anv_image
*dest_image
,
166 const VkImageSubresourceLayers
*dest_subresource
,
167 const VkOffset3D
*dest_offset
)
169 switch (dest_image
->type
) {
170 case VK_IMAGE_TYPE_1D
:
171 case VK_IMAGE_TYPE_2D
:
172 return dest_subresource
->baseArrayLayer
;
173 case VK_IMAGE_TYPE_3D
:
174 /* HACK: Vulkan does not allow attaching a 3D image to a framebuffer,
175 * but meta does it anyway. When doing so, we translate the
176 * destination's z offset into an array offset.
178 return dest_offset
->z
;
180 assert(!"bad VkImageType");
186 anv_device_init_meta_blit_state(struct anv_device
*device
)
188 anv_CreateRenderPass(anv_device_to_handle(device
),
189 &(VkRenderPassCreateInfo
) {
190 .sType
= VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO
,
191 .attachmentCount
= 1,
192 .pAttachments
= &(VkAttachmentDescription
) {
193 .format
= VK_FORMAT_UNDEFINED
, /* Our shaders don't care */
194 .loadOp
= VK_ATTACHMENT_LOAD_OP_LOAD
,
195 .storeOp
= VK_ATTACHMENT_STORE_OP_STORE
,
196 .initialLayout
= VK_IMAGE_LAYOUT_GENERAL
,
197 .finalLayout
= VK_IMAGE_LAYOUT_GENERAL
,
200 .pSubpasses
= &(VkSubpassDescription
) {
201 .pipelineBindPoint
= VK_PIPELINE_BIND_POINT_GRAPHICS
,
204 .pColorAttachments
= &(VkAttachmentReference
) {
206 .layout
= VK_IMAGE_LAYOUT_GENERAL
,
208 .pResolveAttachments
= NULL
,
209 .depthStencilAttachment
= (VkAttachmentReference
) {
210 .attachment
= VK_ATTACHMENT_UNUSED
,
211 .layout
= VK_IMAGE_LAYOUT_GENERAL
,
214 .pPreserveAttachments
= &(VkAttachmentReference
) {
216 .layout
= VK_IMAGE_LAYOUT_GENERAL
,
219 .dependencyCount
= 0,
220 }, &device
->meta_state
.blit
.render_pass
);
222 /* We don't use a vertex shader for clearing, but instead build and pass
223 * the VUEs directly to the rasterization backend. However, we do need
224 * to provide GLSL source for the vertex shader so that the compiler
225 * does not dead-code our inputs.
227 struct anv_shader_module vsm
= {
228 .nir
= build_nir_vertex_shader(false),
231 struct anv_shader_module fsm_2d
= {
232 .nir
= build_nir_copy_fragment_shader(GLSL_SAMPLER_DIM_2D
),
235 struct anv_shader_module fsm_3d
= {
236 .nir
= build_nir_copy_fragment_shader(GLSL_SAMPLER_DIM_3D
),
240 anv_CreateShader(anv_device_to_handle(device
),
241 &(VkShaderCreateInfo
) {
242 .sType
= VK_STRUCTURE_TYPE_SHADER_CREATE_INFO
,
243 .module
= anv_shader_module_to_handle(&vsm
),
248 anv_CreateShader(anv_device_to_handle(device
),
249 &(VkShaderCreateInfo
) {
250 .sType
= VK_STRUCTURE_TYPE_SHADER_CREATE_INFO
,
251 .module
= anv_shader_module_to_handle(&fsm_2d
),
256 anv_CreateShader(anv_device_to_handle(device
),
257 &(VkShaderCreateInfo
) {
258 .sType
= VK_STRUCTURE_TYPE_SHADER_CREATE_INFO
,
259 .module
= anv_shader_module_to_handle(&fsm_3d
),
263 VkPipelineVertexInputStateCreateInfo vi_create_info
= {
264 .sType
= VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO
,
265 .vertexBindingDescriptionCount
= 2,
266 .pVertexBindingDescriptions
= (VkVertexInputBindingDescription
[]) {
270 .inputRate
= VK_VERTEX_INPUT_RATE_VERTEX
274 .stride
= 5 * sizeof(float),
275 .inputRate
= VK_VERTEX_INPUT_RATE_VERTEX
278 .vertexAttributeDescriptionCount
= 3,
279 .pVertexAttributeDescriptions
= (VkVertexInputAttributeDescription
[]) {
284 .format
= VK_FORMAT_R32G32B32A32_UINT
,
291 .format
= VK_FORMAT_R32G32_SFLOAT
,
295 /* Texture Coordinate */
298 .format
= VK_FORMAT_R32G32B32_SFLOAT
,
304 VkDescriptorSetLayoutCreateInfo ds_layout_info
= {
305 .sType
= VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO
,
307 .pBinding
= (VkDescriptorSetLayoutBinding
[]) {
309 .descriptorType
= VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER
,
311 .stageFlags
= VK_SHADER_STAGE_FRAGMENT_BIT
,
312 .pImmutableSamplers
= NULL
316 anv_CreateDescriptorSetLayout(anv_device_to_handle(device
), &ds_layout_info
,
317 &device
->meta_state
.blit
.ds_layout
);
319 anv_CreatePipelineLayout(anv_device_to_handle(device
),
320 &(VkPipelineLayoutCreateInfo
) {
321 .sType
= VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO
,
322 .descriptorSetCount
= 1,
323 .pSetLayouts
= &device
->meta_state
.blit
.ds_layout
,
325 &device
->meta_state
.blit
.pipeline_layout
);
327 VkPipelineShaderStageCreateInfo pipeline_shader_stages
[] = {
329 .sType
= VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO
,
330 .stage
= VK_SHADER_STAGE_VERTEX
,
332 .pSpecializationInfo
= NULL
334 .sType
= VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO
,
335 .stage
= VK_SHADER_STAGE_FRAGMENT
,
336 .shader
= VK_NULL_HANDLE
, /* TEMPLATE VALUE! FILL ME IN! */
337 .pSpecializationInfo
= NULL
341 const VkGraphicsPipelineCreateInfo vk_pipeline_info
= {
342 .sType
= VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO
,
343 .stageCount
= ARRAY_SIZE(pipeline_shader_stages
),
344 .pStages
= pipeline_shader_stages
,
345 .pVertexInputState
= &vi_create_info
,
346 .pInputAssemblyState
= &(VkPipelineInputAssemblyStateCreateInfo
) {
347 .sType
= VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO
,
348 .topology
= VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP
,
349 .primitiveRestartEnable
= false,
351 .pViewportState
= &(VkPipelineViewportStateCreateInfo
) {
352 .sType
= VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO
,
356 .pRasterizationState
= &(VkPipelineRasterizationStateCreateInfo
) {
357 .sType
= VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO
,
358 .depthClipEnable
= true,
359 .rasterizerDiscardEnable
= false,
360 .polygonMode
= VK_POLYGON_MODE_FILL
,
361 .cullMode
= VK_CULL_MODE_NONE
,
362 .frontFace
= VK_FRONT_FACE_COUNTER_CLOCKWISE
364 .pMultisampleState
= &(VkPipelineMultisampleStateCreateInfo
) {
365 .sType
= VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO
,
366 .rasterizationSamples
= 1,
367 .sampleShadingEnable
= false,
368 .pSampleMask
= (VkSampleMask
[]) { UINT32_MAX
},
370 .pColorBlendState
= &(VkPipelineColorBlendStateCreateInfo
) {
371 .sType
= VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO
,
372 .attachmentCount
= 1,
373 .pAttachments
= (VkPipelineColorBlendAttachmentState
[]) {
374 { .channelWriteMask
= VK_CHANNEL_A_BIT
|
375 VK_CHANNEL_R_BIT
| VK_CHANNEL_G_BIT
| VK_CHANNEL_B_BIT
},
378 .pDynamicState
= &(VkPipelineDynamicStateCreateInfo
) {
379 .sType
= VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO
,
380 .dynamicStateCount
= 9,
381 .pDynamicStates
= (VkDynamicState
[]) {
382 VK_DYNAMIC_STATE_VIEWPORT
,
383 VK_DYNAMIC_STATE_SCISSOR
,
384 VK_DYNAMIC_STATE_LINE_WIDTH
,
385 VK_DYNAMIC_STATE_DEPTH_BIAS
,
386 VK_DYNAMIC_STATE_BLEND_CONSTANTS
,
387 VK_DYNAMIC_STATE_DEPTH_BOUNDS
,
388 VK_DYNAMIC_STATE_STENCIL_COMPARE_MASK
,
389 VK_DYNAMIC_STATE_STENCIL_WRITE_MASK
,
390 VK_DYNAMIC_STATE_STENCIL_REFERENCE
,
394 .layout
= device
->meta_state
.blit
.pipeline_layout
,
395 .renderPass
= device
->meta_state
.blit
.render_pass
,
399 const struct anv_graphics_pipeline_create_info anv_pipeline_info
= {
400 .use_repclear
= false,
401 .disable_viewport
= true,
402 .disable_scissor
= true,
407 pipeline_shader_stages
[1].shader
= fs_2d
;
408 anv_graphics_pipeline_create(anv_device_to_handle(device
),
409 &vk_pipeline_info
, &anv_pipeline_info
,
410 &device
->meta_state
.blit
.pipeline_2d_src
);
412 pipeline_shader_stages
[1].shader
= fs_3d
;
413 anv_graphics_pipeline_create(anv_device_to_handle(device
),
414 &vk_pipeline_info
, &anv_pipeline_info
,
415 &device
->meta_state
.blit
.pipeline_3d_src
);
417 anv_DestroyShader(anv_device_to_handle(device
), vs
);
418 anv_DestroyShader(anv_device_to_handle(device
), fs_2d
);
419 anv_DestroyShader(anv_device_to_handle(device
), fs_3d
);
420 ralloc_free(vsm
.nir
);
421 ralloc_free(fsm_2d
.nir
);
422 ralloc_free(fsm_3d
.nir
);
426 meta_prepare_blit(struct anv_cmd_buffer
*cmd_buffer
,
427 struct anv_meta_saved_state
*saved_state
)
429 anv_meta_save(saved_state
, cmd_buffer
,
430 (1 << VK_DYNAMIC_STATE_VIEWPORT
));
434 VkOffset3D src_offset
;
435 VkExtent3D src_extent
;
436 VkOffset3D dest_offset
;
437 VkExtent3D dest_extent
;
441 meta_emit_blit(struct anv_cmd_buffer
*cmd_buffer
,
442 struct anv_image
*src_image
,
443 struct anv_image_view
*src_iview
,
444 VkOffset3D src_offset
,
445 VkExtent3D src_extent
,
446 struct anv_image
*dest_image
,
447 struct anv_image_view
*dest_iview
,
448 VkOffset3D dest_offset
,
449 VkExtent3D dest_extent
,
450 VkFilter blit_filter
)
452 struct anv_device
*device
= cmd_buffer
->device
;
453 VkDescriptorPool dummy_desc_pool
= (VkDescriptorPool
)1;
455 struct blit_vb_data
{
460 unsigned vb_size
= sizeof(struct anv_vue_header
) + 3 * sizeof(*vb_data
);
462 struct anv_state vb_state
=
463 anv_cmd_buffer_alloc_dynamic_state(cmd_buffer
, vb_size
, 16);
464 memset(vb_state
.map
, 0, sizeof(struct anv_vue_header
));
465 vb_data
= vb_state
.map
+ sizeof(struct anv_vue_header
);
467 vb_data
[0] = (struct blit_vb_data
) {
469 dest_offset
.x
+ dest_extent
.width
,
470 dest_offset
.y
+ dest_extent
.height
,
473 (float)(src_offset
.x
+ src_extent
.width
) / (float)src_iview
->extent
.width
,
474 (float)(src_offset
.y
+ src_extent
.height
) / (float)src_iview
->extent
.height
,
475 (float)src_offset
.z
/ (float)src_iview
->extent
.depth
,
479 vb_data
[1] = (struct blit_vb_data
) {
482 dest_offset
.y
+ dest_extent
.height
,
485 (float)src_offset
.x
/ (float)src_iview
->extent
.width
,
486 (float)(src_offset
.y
+ src_extent
.height
) / (float)src_iview
->extent
.height
,
487 (float)src_offset
.z
/ (float)src_iview
->extent
.depth
,
491 vb_data
[2] = (struct blit_vb_data
) {
497 (float)src_offset
.x
/ (float)src_iview
->extent
.width
,
498 (float)src_offset
.y
/ (float)src_iview
->extent
.height
,
499 (float)src_offset
.z
/ (float)src_iview
->extent
.depth
,
503 struct anv_buffer vertex_buffer
= {
506 .bo
= &device
->dynamic_state_block_pool
.bo
,
507 .offset
= vb_state
.offset
,
510 anv_CmdBindVertexBuffers(anv_cmd_buffer_to_handle(cmd_buffer
), 0, 2,
512 anv_buffer_to_handle(&vertex_buffer
),
513 anv_buffer_to_handle(&vertex_buffer
)
517 sizeof(struct anv_vue_header
),
521 ANV_CALL(CreateSampler
)(anv_device_to_handle(device
),
522 &(VkSamplerCreateInfo
) {
523 .sType
= VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO
,
524 .magFilter
= blit_filter
,
525 .minFilter
= blit_filter
,
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_COMBINED_IMAGE_SAMPLER
,
542 .pDescriptors
= (VkDescriptorInfo
[]) {
544 .imageView
= anv_image_view_to_handle(src_iview
),
545 .imageLayout
= VK_IMAGE_LAYOUT_GENERAL
,
553 anv_CreateFramebuffer(anv_device_to_handle(device
),
554 &(VkFramebufferCreateInfo
) {
555 .sType
= VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO
,
556 .attachmentCount
= 1,
557 .pAttachments
= (VkImageView
[]) {
558 anv_image_view_to_handle(dest_iview
),
560 .width
= dest_iview
->extent
.width
,
561 .height
= dest_iview
->extent
.height
,
565 ANV_CALL(CmdBeginRenderPass
)(anv_cmd_buffer_to_handle(cmd_buffer
),
566 &(VkRenderPassBeginInfo
) {
567 .sType
= VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO
,
568 .renderPass
= device
->meta_state
.blit
.render_pass
,
571 .offset
= { dest_offset
.x
, dest_offset
.y
},
572 .extent
= { dest_extent
.width
, dest_extent
.height
},
574 .clearValueCount
= 0,
575 .pClearValues
= NULL
,
576 }, VK_SUBPASS_CONTENTS_INLINE
);
580 switch (src_image
->type
) {
581 case VK_IMAGE_TYPE_1D
:
582 anv_finishme("VK_IMAGE_TYPE_1D");
583 pipeline
= device
->meta_state
.blit
.pipeline_2d_src
;
585 case VK_IMAGE_TYPE_2D
:
586 pipeline
= device
->meta_state
.blit
.pipeline_2d_src
;
588 case VK_IMAGE_TYPE_3D
:
589 pipeline
= device
->meta_state
.blit
.pipeline_3d_src
;
592 unreachable(!"bad VkImageType");
595 if (cmd_buffer
->state
.pipeline
!= anv_pipeline_from_handle(pipeline
)) {
596 anv_CmdBindPipeline(anv_cmd_buffer_to_handle(cmd_buffer
),
597 VK_PIPELINE_BIND_POINT_GRAPHICS
, pipeline
);
600 anv_CmdSetViewport(anv_cmd_buffer_to_handle(cmd_buffer
), 1,
604 .width
= dest_iview
->extent
.width
,
605 .height
= dest_iview
->extent
.height
,
610 anv_CmdBindDescriptorSets(anv_cmd_buffer_to_handle(cmd_buffer
),
611 VK_PIPELINE_BIND_POINT_GRAPHICS
,
612 device
->meta_state
.blit
.pipeline_layout
, 0, 1,
615 ANV_CALL(CmdDraw
)(anv_cmd_buffer_to_handle(cmd_buffer
), 3, 1, 0, 0);
617 ANV_CALL(CmdEndRenderPass
)(anv_cmd_buffer_to_handle(cmd_buffer
));
619 /* At the point where we emit the draw call, all data from the
620 * descriptor sets, etc. has been used. We are free to delete it.
622 anv_descriptor_set_destroy(device
, anv_descriptor_set_from_handle(set
));
623 anv_DestroySampler(anv_device_to_handle(device
), sampler
);
624 anv_DestroyFramebuffer(anv_device_to_handle(device
), fb
);
628 meta_finish_blit(struct anv_cmd_buffer
*cmd_buffer
,
629 const struct anv_meta_saved_state
*saved_state
)
631 anv_meta_restore(saved_state
, cmd_buffer
);
635 vk_format_for_size(int bs
)
638 case 1: return VK_FORMAT_R8_UINT
;
639 case 2: return VK_FORMAT_R8G8_UINT
;
640 case 3: return VK_FORMAT_R8G8B8_UINT
;
641 case 4: return VK_FORMAT_R8G8B8A8_UINT
;
642 case 6: return VK_FORMAT_R16G16B16_UINT
;
643 case 8: return VK_FORMAT_R16G16B16A16_UINT
;
644 case 12: return VK_FORMAT_R32G32B32_UINT
;
645 case 16: return VK_FORMAT_R32G32B32A32_UINT
;
647 unreachable("Invalid format block size");
652 do_buffer_copy(struct anv_cmd_buffer
*cmd_buffer
,
653 struct anv_bo
*src
, uint64_t src_offset
,
654 struct anv_bo
*dest
, uint64_t dest_offset
,
655 int width
, int height
, VkFormat copy_format
)
657 VkDevice vk_device
= anv_device_to_handle(cmd_buffer
->device
);
659 VkImageCreateInfo image_info
= {
660 .sType
= VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO
,
661 .imageType
= VK_IMAGE_TYPE_2D
,
662 .format
= copy_format
,
671 .tiling
= VK_IMAGE_TILING_LINEAR
,
677 image_info
.usage
= VK_IMAGE_USAGE_SAMPLED_BIT
;
678 anv_CreateImage(vk_device
, &image_info
, &src_image
);
681 image_info
.usage
= VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT
;
682 anv_CreateImage(vk_device
, &image_info
, &dest_image
);
684 /* We could use a vk call to bind memory, but that would require
685 * creating a dummy memory object etc. so there's really no point.
687 anv_image_from_handle(src_image
)->bo
= src
;
688 anv_image_from_handle(src_image
)->offset
= src_offset
;
689 anv_image_from_handle(dest_image
)->bo
= dest
;
690 anv_image_from_handle(dest_image
)->offset
= dest_offset
;
692 struct anv_image_view src_iview
;
693 anv_image_view_init(&src_iview
, cmd_buffer
->device
,
694 &(VkImageViewCreateInfo
) {
695 .sType
= VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO
,
697 .viewType
= VK_IMAGE_VIEW_TYPE_2D
,
698 .format
= copy_format
,
699 .subresourceRange
= {
700 .aspectMask
= VK_IMAGE_ASPECT_COLOR_BIT
,
709 struct anv_image_view dest_iview
;
710 anv_image_view_init(&dest_iview
, cmd_buffer
->device
,
711 &(VkImageViewCreateInfo
) {
712 .sType
= VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO
,
714 .viewType
= VK_IMAGE_VIEW_TYPE_2D
,
715 .format
= copy_format
,
716 .subresourceRange
= {
717 .aspectMask
= VK_IMAGE_ASPECT_COLOR_BIT
,
726 meta_emit_blit(cmd_buffer
,
727 anv_image_from_handle(src_image
),
729 (VkOffset3D
) { 0, 0, 0 },
730 (VkExtent3D
) { width
, height
, 1 },
731 anv_image_from_handle(dest_image
),
733 (VkOffset3D
) { 0, 0, 0 },
734 (VkExtent3D
) { width
, height
, 1 },
737 anv_DestroyImage(vk_device
, src_image
);
738 anv_DestroyImage(vk_device
, dest_image
);
741 void anv_CmdCopyBuffer(
742 VkCommandBuffer commandBuffer
,
745 uint32_t regionCount
,
746 const VkBufferCopy
* pRegions
)
748 ANV_FROM_HANDLE(anv_cmd_buffer
, cmd_buffer
, commandBuffer
);
749 ANV_FROM_HANDLE(anv_buffer
, src_buffer
, srcBuffer
);
750 ANV_FROM_HANDLE(anv_buffer
, dest_buffer
, destBuffer
);
752 struct anv_meta_saved_state saved_state
;
754 meta_prepare_blit(cmd_buffer
, &saved_state
);
756 for (unsigned r
= 0; r
< regionCount
; r
++) {
757 uint64_t src_offset
= src_buffer
->offset
+ pRegions
[r
].srcOffset
;
758 uint64_t dest_offset
= dest_buffer
->offset
+ pRegions
[r
].dstOffset
;
759 uint64_t copy_size
= pRegions
[r
].size
;
761 /* First, we compute the biggest format that can be used with the
762 * given offsets and size.
766 int fs
= ffs(src_offset
) - 1;
768 bs
= MIN2(bs
, 1 << fs
);
769 assert(src_offset
% bs
== 0);
771 fs
= ffs(dest_offset
) - 1;
773 bs
= MIN2(bs
, 1 << fs
);
774 assert(dest_offset
% bs
== 0);
776 fs
= ffs(pRegions
[r
].size
) - 1;
778 bs
= MIN2(bs
, 1 << fs
);
779 assert(pRegions
[r
].size
% bs
== 0);
781 VkFormat copy_format
= vk_format_for_size(bs
);
783 /* This is maximum possible width/height our HW can handle */
784 uint64_t max_surface_dim
= 1 << 14;
786 /* First, we make a bunch of max-sized copies */
787 uint64_t max_copy_size
= max_surface_dim
* max_surface_dim
* bs
;
788 while (copy_size
> max_copy_size
) {
789 do_buffer_copy(cmd_buffer
, src_buffer
->bo
, src_offset
,
790 dest_buffer
->bo
, dest_offset
,
791 max_surface_dim
, max_surface_dim
, copy_format
);
792 copy_size
-= max_copy_size
;
793 src_offset
+= max_copy_size
;
794 dest_offset
+= max_copy_size
;
797 uint64_t height
= copy_size
/ (max_surface_dim
* bs
);
798 assert(height
< max_surface_dim
);
800 uint64_t rect_copy_size
= height
* max_surface_dim
* bs
;
801 do_buffer_copy(cmd_buffer
, src_buffer
->bo
, src_offset
,
802 dest_buffer
->bo
, dest_offset
,
803 max_surface_dim
, height
, copy_format
);
804 copy_size
-= rect_copy_size
;
805 src_offset
+= rect_copy_size
;
806 dest_offset
+= rect_copy_size
;
809 if (copy_size
!= 0) {
810 do_buffer_copy(cmd_buffer
, src_buffer
->bo
, src_offset
,
811 dest_buffer
->bo
, dest_offset
,
812 copy_size
/ bs
, 1, copy_format
);
816 meta_finish_blit(cmd_buffer
, &saved_state
);
819 void anv_CmdCopyImage(
820 VkCommandBuffer commandBuffer
,
822 VkImageLayout srcImageLayout
,
824 VkImageLayout destImageLayout
,
825 uint32_t regionCount
,
826 const VkImageCopy
* pRegions
)
828 ANV_FROM_HANDLE(anv_cmd_buffer
, cmd_buffer
, commandBuffer
);
829 ANV_FROM_HANDLE(anv_image
, src_image
, srcImage
);
830 ANV_FROM_HANDLE(anv_image
, dest_image
, destImage
);
832 const VkImageViewType src_iview_type
=
833 meta_blit_get_src_image_view_type(src_image
);
835 struct anv_meta_saved_state saved_state
;
837 meta_prepare_blit(cmd_buffer
, &saved_state
);
839 for (unsigned r
= 0; r
< regionCount
; r
++) {
840 struct anv_image_view src_iview
;
841 anv_image_view_init(&src_iview
, cmd_buffer
->device
,
842 &(VkImageViewCreateInfo
) {
843 .sType
= VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO
,
845 .viewType
= src_iview_type
,
846 .format
= src_image
->format
->vk_format
,
847 .subresourceRange
= {
848 .aspectMask
= pRegions
[r
].srcSubresource
.aspectMask
,
849 .baseMipLevel
= pRegions
[r
].srcSubresource
.mipLevel
,
851 .baseArrayLayer
= pRegions
[r
].srcSubresource
.baseArrayLayer
,
852 .arraySize
= pRegions
[r
].dstSubresource
.layerCount
,
857 const VkOffset3D dest_offset
= {
858 .x
= pRegions
[r
].dstOffset
.x
,
859 .y
= pRegions
[r
].dstOffset
.y
,
864 if (src_image
->type
== VK_IMAGE_TYPE_3D
) {
865 assert(pRegions
[r
].srcSubresource
.layerCount
== 1 &&
866 pRegions
[r
].dstSubresource
.layerCount
== 1);
867 num_slices
= pRegions
[r
].extent
.depth
;
869 assert(pRegions
[r
].srcSubresource
.layerCount
==
870 pRegions
[r
].dstSubresource
.layerCount
);
871 assert(pRegions
[r
].extent
.depth
== 1);
872 num_slices
= pRegions
[r
].dstSubresource
.layerCount
;
875 const uint32_t dest_base_array_slice
=
876 meta_blit_get_dest_view_base_array_slice(dest_image
,
877 &pRegions
[r
].dstSubresource
,
878 &pRegions
[r
].dstOffset
);
880 for (unsigned slice
= 0; slice
< num_slices
; slice
++) {
881 VkOffset3D src_offset
= pRegions
[r
].srcOffset
;
882 src_offset
.z
+= slice
;
884 struct anv_image_view dest_iview
;
885 anv_image_view_init(&dest_iview
, cmd_buffer
->device
,
886 &(VkImageViewCreateInfo
) {
887 .sType
= VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO
,
889 .viewType
= VK_IMAGE_VIEW_TYPE_2D
,
890 .format
= dest_image
->format
->vk_format
,
891 .subresourceRange
= {
892 .aspectMask
= VK_IMAGE_ASPECT_COLOR_BIT
,
893 .baseMipLevel
= pRegions
[r
].dstSubresource
.mipLevel
,
895 .baseArrayLayer
= dest_base_array_slice
+ slice
,
901 meta_emit_blit(cmd_buffer
,
902 src_image
, &src_iview
,
905 dest_image
, &dest_iview
,
912 meta_finish_blit(cmd_buffer
, &saved_state
);
915 void anv_CmdBlitImage(
916 VkCommandBuffer commandBuffer
,
918 VkImageLayout srcImageLayout
,
920 VkImageLayout destImageLayout
,
921 uint32_t regionCount
,
922 const VkImageBlit
* pRegions
,
926 ANV_FROM_HANDLE(anv_cmd_buffer
, cmd_buffer
, commandBuffer
);
927 ANV_FROM_HANDLE(anv_image
, src_image
, srcImage
);
928 ANV_FROM_HANDLE(anv_image
, dest_image
, destImage
);
930 const VkImageViewType src_iview_type
=
931 meta_blit_get_src_image_view_type(src_image
);
933 struct anv_meta_saved_state saved_state
;
935 anv_finishme("respect VkFilter");
937 meta_prepare_blit(cmd_buffer
, &saved_state
);
939 for (unsigned r
= 0; r
< regionCount
; r
++) {
940 struct anv_image_view src_iview
;
941 anv_image_view_init(&src_iview
, cmd_buffer
->device
,
942 &(VkImageViewCreateInfo
) {
943 .sType
= VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO
,
945 .viewType
= src_iview_type
,
946 .format
= src_image
->format
->vk_format
,
947 .subresourceRange
= {
948 .aspectMask
= pRegions
[r
].srcSubresource
.aspectMask
,
949 .baseMipLevel
= pRegions
[r
].srcSubresource
.mipLevel
,
951 .baseArrayLayer
= pRegions
[r
].srcSubresource
.baseArrayLayer
,
957 const VkOffset3D dest_offset
= {
958 .x
= pRegions
[r
].dstOffset
.x
,
959 .y
= pRegions
[r
].dstOffset
.y
,
963 const uint32_t dest_array_slice
=
964 meta_blit_get_dest_view_base_array_slice(dest_image
,
965 &pRegions
[r
].dstSubresource
,
966 &pRegions
[r
].dstOffset
);
968 if (pRegions
[r
].srcSubresource
.layerCount
> 1)
969 anv_finishme("FINISHME: copy multiple array layers");
971 if (pRegions
[r
].dstExtent
.depth
> 1)
972 anv_finishme("FINISHME: copy multiple depth layers");
974 struct anv_image_view dest_iview
;
975 anv_image_view_init(&dest_iview
, cmd_buffer
->device
,
976 &(VkImageViewCreateInfo
) {
977 .sType
= VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO
,
979 .viewType
= VK_IMAGE_VIEW_TYPE_2D
,
980 .format
= dest_image
->format
->vk_format
,
981 .subresourceRange
= {
982 .aspectMask
= VK_IMAGE_ASPECT_COLOR_BIT
,
983 .baseMipLevel
= pRegions
[r
].dstSubresource
.mipLevel
,
985 .baseArrayLayer
= dest_array_slice
,
991 meta_emit_blit(cmd_buffer
,
992 src_image
, &src_iview
,
993 pRegions
[r
].srcOffset
,
994 pRegions
[r
].srcExtent
,
995 dest_image
, &dest_iview
,
997 pRegions
[r
].dstExtent
,
1001 meta_finish_blit(cmd_buffer
, &saved_state
);
1004 static struct anv_image
*
1005 make_image_for_buffer(VkDevice vk_device
, VkBuffer vk_buffer
, VkFormat format
,
1006 VkImageUsageFlags usage
,
1007 VkImageType image_type
,
1008 const VkBufferImageCopy
*copy
)
1010 ANV_FROM_HANDLE(anv_buffer
, buffer
, vk_buffer
);
1012 VkExtent3D extent
= copy
->imageExtent
;
1013 if (copy
->bufferRowLength
)
1014 extent
.width
= copy
->bufferRowLength
;
1015 if (copy
->bufferImageHeight
)
1016 extent
.height
= copy
->bufferImageHeight
;
1020 VkResult result
= anv_CreateImage(vk_device
,
1021 &(VkImageCreateInfo
) {
1022 .sType
= VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO
,
1023 .imageType
= VK_IMAGE_TYPE_2D
,
1029 .tiling
= VK_IMAGE_TILING_LINEAR
,
1033 assert(result
== VK_SUCCESS
);
1035 ANV_FROM_HANDLE(anv_image
, image
, vk_image
);
1037 /* We could use a vk call to bind memory, but that would require
1038 * creating a dummy memory object etc. so there's really no point.
1040 image
->bo
= buffer
->bo
;
1041 image
->offset
= buffer
->offset
+ copy
->bufferOffset
;
1046 void anv_CmdCopyBufferToImage(
1047 VkCommandBuffer commandBuffer
,
1050 VkImageLayout destImageLayout
,
1051 uint32_t regionCount
,
1052 const VkBufferImageCopy
* pRegions
)
1054 ANV_FROM_HANDLE(anv_cmd_buffer
, cmd_buffer
, commandBuffer
);
1055 ANV_FROM_HANDLE(anv_image
, dest_image
, destImage
);
1056 VkDevice vk_device
= anv_device_to_handle(cmd_buffer
->device
);
1057 const VkFormat orig_format
= dest_image
->format
->vk_format
;
1058 struct anv_meta_saved_state saved_state
;
1060 meta_prepare_blit(cmd_buffer
, &saved_state
);
1062 for (unsigned r
= 0; r
< regionCount
; r
++) {
1063 VkFormat proxy_format
= orig_format
;
1064 VkImageAspectFlags proxy_aspect
= pRegions
[r
].imageSubresource
.aspectMask
;
1066 if (orig_format
== VK_FORMAT_S8_UINT
) {
1067 proxy_format
= VK_FORMAT_R8_UINT
;
1068 proxy_aspect
= VK_IMAGE_ASPECT_COLOR_BIT
;
1071 struct anv_image
*src_image
=
1072 make_image_for_buffer(vk_device
, srcBuffer
, proxy_format
,
1073 VK_IMAGE_USAGE_SAMPLED_BIT
,
1074 dest_image
->type
, &pRegions
[r
]);
1076 const uint32_t dest_base_array_slice
=
1077 meta_blit_get_dest_view_base_array_slice(dest_image
,
1078 &pRegions
[r
].imageSubresource
,
1079 &pRegions
[r
].imageOffset
);
1081 unsigned num_slices
;
1082 if (dest_image
->type
== VK_IMAGE_TYPE_3D
) {
1083 assert(pRegions
[r
].imageSubresource
.layerCount
== 1);
1084 num_slices
= pRegions
[r
].imageExtent
.depth
;
1086 assert(pRegions
[r
].imageExtent
.depth
== 1);
1087 num_slices
= pRegions
[r
].imageSubresource
.layerCount
;
1090 for (unsigned slice
= 0; slice
< num_slices
; slice
++) {
1091 struct anv_image_view src_iview
;
1092 anv_image_view_init(&src_iview
, cmd_buffer
->device
,
1093 &(VkImageViewCreateInfo
) {
1094 .sType
= VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO
,
1095 .image
= anv_image_to_handle(src_image
),
1096 .viewType
= VK_IMAGE_VIEW_TYPE_2D
,
1097 .format
= proxy_format
,
1098 .subresourceRange
= {
1099 .aspectMask
= proxy_aspect
,
1102 .baseArrayLayer
= 0,
1108 struct anv_image_view dest_iview
;
1109 anv_image_view_init(&dest_iview
, cmd_buffer
->device
,
1110 &(VkImageViewCreateInfo
) {
1111 .sType
= VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO
,
1112 .image
= anv_image_to_handle(dest_image
),
1113 .viewType
= VK_IMAGE_VIEW_TYPE_2D
,
1114 .format
= proxy_format
,
1115 .subresourceRange
= {
1116 .aspectMask
= VK_IMAGE_ASPECT_COLOR_BIT
,
1117 .baseMipLevel
= pRegions
[r
].imageSubresource
.mipLevel
,
1119 .baseArrayLayer
= dest_base_array_slice
+ slice
,
1125 VkOffset3D src_offset
= { 0, 0, slice
};
1127 const VkOffset3D dest_offset
= {
1128 .x
= pRegions
[r
].imageOffset
.x
,
1129 .y
= pRegions
[r
].imageOffset
.y
,
1133 meta_emit_blit(cmd_buffer
,
1137 pRegions
[r
].imageExtent
,
1141 pRegions
[r
].imageExtent
,
1144 /* Once we've done the blit, all of the actual information about
1145 * the image is embedded in the command buffer so we can just
1146 * increment the offset directly in the image effectively
1147 * re-binding it to different backing memory.
1149 /* XXX: Insert a real CPP */
1150 src_image
->offset
+= src_image
->extent
.width
*
1151 src_image
->extent
.height
* 4;
1154 anv_DestroyImage(vk_device
, anv_image_to_handle(src_image
));
1157 meta_finish_blit(cmd_buffer
, &saved_state
);
1160 void anv_CmdCopyImageToBuffer(
1161 VkCommandBuffer commandBuffer
,
1163 VkImageLayout srcImageLayout
,
1164 VkBuffer destBuffer
,
1165 uint32_t regionCount
,
1166 const VkBufferImageCopy
* pRegions
)
1168 ANV_FROM_HANDLE(anv_cmd_buffer
, cmd_buffer
, commandBuffer
);
1169 ANV_FROM_HANDLE(anv_image
, src_image
, srcImage
);
1170 VkDevice vk_device
= anv_device_to_handle(cmd_buffer
->device
);
1171 struct anv_meta_saved_state saved_state
;
1173 const VkImageViewType src_iview_type
=
1174 meta_blit_get_src_image_view_type(src_image
);
1176 meta_prepare_blit(cmd_buffer
, &saved_state
);
1178 for (unsigned r
= 0; r
< regionCount
; r
++) {
1179 struct anv_image_view src_iview
;
1180 anv_image_view_init(&src_iview
, cmd_buffer
->device
,
1181 &(VkImageViewCreateInfo
) {
1182 .sType
= VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO
,
1184 .viewType
= src_iview_type
,
1185 .format
= src_image
->format
->vk_format
,
1186 .subresourceRange
= {
1187 .aspectMask
= pRegions
[r
].imageSubresource
.aspectMask
,
1188 .baseMipLevel
= pRegions
[r
].imageSubresource
.mipLevel
,
1190 .baseArrayLayer
= pRegions
[r
].imageSubresource
.baseArrayLayer
,
1191 .arraySize
= pRegions
[r
].imageSubresource
.layerCount
,
1196 VkFormat dest_format
= src_image
->format
->vk_format
;
1197 if (dest_format
== VK_FORMAT_S8_UINT
) {
1198 dest_format
= VK_FORMAT_R8_UINT
;
1201 struct anv_image
*dest_image
=
1202 make_image_for_buffer(vk_device
, destBuffer
, dest_format
,
1203 VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT
,
1204 src_image
->type
, &pRegions
[r
]);
1206 unsigned num_slices
;
1207 if (src_image
->type
== VK_IMAGE_TYPE_3D
) {
1208 assert(pRegions
[r
].imageSubresource
.layerCount
== 1);
1209 num_slices
= pRegions
[r
].imageExtent
.depth
;
1211 assert(pRegions
[r
].imageExtent
.depth
== 1);
1212 num_slices
= pRegions
[r
].imageSubresource
.layerCount
;
1215 for (unsigned slice
= 0; slice
< num_slices
; slice
++) {
1216 VkOffset3D src_offset
= pRegions
[r
].imageOffset
;
1217 src_offset
.z
+= slice
;
1219 struct anv_image_view dest_iview
;
1220 anv_image_view_init(&dest_iview
, cmd_buffer
->device
,
1221 &(VkImageViewCreateInfo
) {
1222 .sType
= VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO
,
1223 .image
= anv_image_to_handle(dest_image
),
1224 .viewType
= VK_IMAGE_VIEW_TYPE_2D
,
1225 .format
= dest_format
,
1226 .subresourceRange
= {
1227 .aspectMask
= VK_IMAGE_ASPECT_COLOR_BIT
,
1230 .baseArrayLayer
= 0,
1236 meta_emit_blit(cmd_buffer
,
1237 anv_image_from_handle(srcImage
),
1240 pRegions
[r
].imageExtent
,
1243 (VkOffset3D
) { 0, 0, 0 },
1244 pRegions
[r
].imageExtent
,
1247 /* Once we've done the blit, all of the actual information about
1248 * the image is embedded in the command buffer so we can just
1249 * increment the offset directly in the image effectively
1250 * re-binding it to different backing memory.
1252 /* XXX: Insert a real CPP */
1253 dest_image
->offset
+= dest_image
->extent
.width
*
1254 dest_image
->extent
.height
* 4;
1257 anv_DestroyImage(vk_device
, anv_image_to_handle(dest_image
));
1260 meta_finish_blit(cmd_buffer
, &saved_state
);
1263 void anv_CmdUpdateBuffer(
1264 VkCommandBuffer commandBuffer
,
1265 VkBuffer destBuffer
,
1266 VkDeviceSize destOffset
,
1267 VkDeviceSize dataSize
,
1268 const uint32_t* pData
)
1273 void anv_CmdFillBuffer(
1274 VkCommandBuffer commandBuffer
,
1275 VkBuffer destBuffer
,
1276 VkDeviceSize destOffset
,
1277 VkDeviceSize fillSize
,
1283 void anv_CmdResolveImage(
1284 VkCommandBuffer commandBuffer
,
1286 VkImageLayout srcImageLayout
,
1288 VkImageLayout destImageLayout
,
1289 uint32_t regionCount
,
1290 const VkImageResolve
* pRegions
)
1296 anv_device_init_meta(struct anv_device
*device
)
1298 anv_device_init_meta_clear_state(device
);
1299 anv_device_init_meta_blit_state(device
);
1303 anv_device_finish_meta(struct anv_device
*device
)
1305 anv_device_finish_meta_clear_state(device
);
1308 anv_DestroyRenderPass(anv_device_to_handle(device
),
1309 device
->meta_state
.blit
.render_pass
);
1310 anv_DestroyPipeline(anv_device_to_handle(device
),
1311 device
->meta_state
.blit
.pipeline_2d_src
);
1312 anv_DestroyPipeline(anv_device_to_handle(device
),
1313 device
->meta_state
.blit
.pipeline_3d_src
);
1314 anv_DestroyPipelineLayout(anv_device_to_handle(device
),
1315 device
->meta_state
.blit
.pipeline_layout
);
1316 anv_DestroyDescriptorSetLayout(anv_device_to_handle(device
),
1317 device
->meta_state
.blit
.ds_layout
);