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
,
202 .inputAttachmentCount
= 0,
203 .colorAttachmentCount
= 1,
204 .pColorAttachments
= &(VkAttachmentReference
) {
206 .layout
= VK_IMAGE_LAYOUT_GENERAL
,
208 .pResolveAttachments
= NULL
,
209 .pDepthStencilAttachment
= &(VkAttachmentReference
) {
210 .attachment
= VK_ATTACHMENT_UNUSED
,
211 .layout
= VK_IMAGE_LAYOUT_GENERAL
,
213 .preserveAttachmentCount
= 1,
214 .pPreserveAttachments
= &(VkAttachmentReference
) {
216 .layout
= VK_IMAGE_LAYOUT_GENERAL
,
219 .dependencyCount
= 0,
220 }, NULL
, &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 vs
= {
228 .nir
= build_nir_vertex_shader(false),
231 struct anv_shader_module fs_2d
= {
232 .nir
= build_nir_copy_fragment_shader(GLSL_SAMPLER_DIM_2D
),
235 struct anv_shader_module fs_3d
= {
236 .nir
= build_nir_copy_fragment_shader(GLSL_SAMPLER_DIM_3D
),
239 VkPipelineVertexInputStateCreateInfo vi_create_info
= {
240 .sType
= VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO
,
241 .vertexBindingDescriptionCount
= 2,
242 .pVertexBindingDescriptions
= (VkVertexInputBindingDescription
[]) {
246 .inputRate
= VK_VERTEX_INPUT_RATE_VERTEX
250 .stride
= 5 * sizeof(float),
251 .inputRate
= VK_VERTEX_INPUT_RATE_VERTEX
254 .vertexAttributeDescriptionCount
= 3,
255 .pVertexAttributeDescriptions
= (VkVertexInputAttributeDescription
[]) {
260 .format
= VK_FORMAT_R32G32B32A32_UINT
,
267 .format
= VK_FORMAT_R32G32_SFLOAT
,
271 /* Texture Coordinate */
274 .format
= VK_FORMAT_R32G32B32_SFLOAT
,
280 VkDescriptorSetLayoutCreateInfo ds_layout_info
= {
281 .sType
= VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO
,
283 .pBinding
= (VkDescriptorSetLayoutBinding
[]) {
286 .descriptorType
= VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER
,
287 .descriptorCount
= 1,
288 .stageFlags
= VK_SHADER_STAGE_FRAGMENT_BIT
,
289 .pImmutableSamplers
= NULL
293 anv_CreateDescriptorSetLayout(anv_device_to_handle(device
), &ds_layout_info
,
294 NULL
, &device
->meta_state
.blit
.ds_layout
);
296 anv_CreatePipelineLayout(anv_device_to_handle(device
),
297 &(VkPipelineLayoutCreateInfo
) {
298 .sType
= VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO
,
300 .pSetLayouts
= &device
->meta_state
.blit
.ds_layout
,
302 NULL
, &device
->meta_state
.blit
.pipeline_layout
);
304 VkPipelineShaderStageCreateInfo pipeline_shader_stages
[] = {
306 .sType
= VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO
,
307 .stage
= VK_SHADER_STAGE_VERTEX_BIT
,
308 .module
= anv_shader_module_to_handle(&vs
),
310 .pSpecializationInfo
= NULL
312 .sType
= VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO
,
313 .stage
= VK_SHADER_STAGE_FRAGMENT_BIT
,
314 .module
= VK_NULL_HANDLE
, /* TEMPLATE VALUE! FILL ME IN! */
316 .pSpecializationInfo
= NULL
320 const VkGraphicsPipelineCreateInfo vk_pipeline_info
= {
321 .sType
= VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO
,
322 .stageCount
= ARRAY_SIZE(pipeline_shader_stages
),
323 .pStages
= pipeline_shader_stages
,
324 .pVertexInputState
= &vi_create_info
,
325 .pInputAssemblyState
= &(VkPipelineInputAssemblyStateCreateInfo
) {
326 .sType
= VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO
,
327 .topology
= VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP
,
328 .primitiveRestartEnable
= false,
330 .pViewportState
= &(VkPipelineViewportStateCreateInfo
) {
331 .sType
= VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO
,
335 .pRasterizationState
= &(VkPipelineRasterizationStateCreateInfo
) {
336 .sType
= VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO
,
337 .rasterizerDiscardEnable
= false,
338 .polygonMode
= VK_POLYGON_MODE_FILL
,
339 .cullMode
= VK_CULL_MODE_NONE
,
340 .frontFace
= VK_FRONT_FACE_COUNTER_CLOCKWISE
342 .pMultisampleState
= &(VkPipelineMultisampleStateCreateInfo
) {
343 .sType
= VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO
,
344 .rasterizationSamples
= 1,
345 .sampleShadingEnable
= false,
346 .pSampleMask
= (VkSampleMask
[]) { UINT32_MAX
},
348 .pColorBlendState
= &(VkPipelineColorBlendStateCreateInfo
) {
349 .sType
= VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO
,
350 .attachmentCount
= 1,
351 .pAttachments
= (VkPipelineColorBlendAttachmentState
[]) {
353 VK_COLOR_COMPONENT_A_BIT
|
354 VK_COLOR_COMPONENT_R_BIT
|
355 VK_COLOR_COMPONENT_G_BIT
|
356 VK_COLOR_COMPONENT_B_BIT
},
359 .pDynamicState
= &(VkPipelineDynamicStateCreateInfo
) {
360 .sType
= VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO
,
361 .dynamicStateCount
= 9,
362 .pDynamicStates
= (VkDynamicState
[]) {
363 VK_DYNAMIC_STATE_VIEWPORT
,
364 VK_DYNAMIC_STATE_SCISSOR
,
365 VK_DYNAMIC_STATE_LINE_WIDTH
,
366 VK_DYNAMIC_STATE_DEPTH_BIAS
,
367 VK_DYNAMIC_STATE_BLEND_CONSTANTS
,
368 VK_DYNAMIC_STATE_DEPTH_BOUNDS
,
369 VK_DYNAMIC_STATE_STENCIL_COMPARE_MASK
,
370 VK_DYNAMIC_STATE_STENCIL_WRITE_MASK
,
371 VK_DYNAMIC_STATE_STENCIL_REFERENCE
,
375 .layout
= device
->meta_state
.blit
.pipeline_layout
,
376 .renderPass
= device
->meta_state
.blit
.render_pass
,
380 const struct anv_graphics_pipeline_create_info anv_pipeline_info
= {
381 .use_repclear
= false,
382 .disable_viewport
= true,
383 .disable_scissor
= true,
388 pipeline_shader_stages
[1].module
= anv_shader_module_to_handle(&fs_2d
);
389 anv_graphics_pipeline_create(anv_device_to_handle(device
),
390 &vk_pipeline_info
, &anv_pipeline_info
,
391 NULL
, &device
->meta_state
.blit
.pipeline_2d_src
);
393 pipeline_shader_stages
[1].module
= anv_shader_module_to_handle(&fs_3d
);
394 anv_graphics_pipeline_create(anv_device_to_handle(device
),
395 &vk_pipeline_info
, &anv_pipeline_info
,
396 NULL
, &device
->meta_state
.blit
.pipeline_3d_src
);
399 ralloc_free(fs_2d
.nir
);
400 ralloc_free(fs_3d
.nir
);
404 meta_prepare_blit(struct anv_cmd_buffer
*cmd_buffer
,
405 struct anv_meta_saved_state
*saved_state
)
407 anv_meta_save(saved_state
, cmd_buffer
,
408 (1 << VK_DYNAMIC_STATE_VIEWPORT
));
412 VkOffset3D src_offset
;
413 VkExtent3D src_extent
;
414 VkOffset3D dest_offset
;
415 VkExtent3D dest_extent
;
419 meta_emit_blit(struct anv_cmd_buffer
*cmd_buffer
,
420 struct anv_image
*src_image
,
421 struct anv_image_view
*src_iview
,
422 VkOffset3D src_offset
,
423 VkExtent3D src_extent
,
424 struct anv_image
*dest_image
,
425 struct anv_image_view
*dest_iview
,
426 VkOffset3D dest_offset
,
427 VkExtent3D dest_extent
,
428 VkFilter blit_filter
)
430 struct anv_device
*device
= cmd_buffer
->device
;
431 VkDescriptorPool dummy_desc_pool
= (VkDescriptorPool
)1;
433 struct blit_vb_data
{
438 unsigned vb_size
= sizeof(struct anv_vue_header
) + 3 * sizeof(*vb_data
);
440 struct anv_state vb_state
=
441 anv_cmd_buffer_alloc_dynamic_state(cmd_buffer
, vb_size
, 16);
442 memset(vb_state
.map
, 0, sizeof(struct anv_vue_header
));
443 vb_data
= vb_state
.map
+ sizeof(struct anv_vue_header
);
445 vb_data
[0] = (struct blit_vb_data
) {
447 dest_offset
.x
+ dest_extent
.width
,
448 dest_offset
.y
+ dest_extent
.height
,
451 (float)(src_offset
.x
+ src_extent
.width
) / (float)src_iview
->extent
.width
,
452 (float)(src_offset
.y
+ src_extent
.height
) / (float)src_iview
->extent
.height
,
453 (float)src_offset
.z
/ (float)src_iview
->extent
.depth
,
457 vb_data
[1] = (struct blit_vb_data
) {
460 dest_offset
.y
+ dest_extent
.height
,
463 (float)src_offset
.x
/ (float)src_iview
->extent
.width
,
464 (float)(src_offset
.y
+ src_extent
.height
) / (float)src_iview
->extent
.height
,
465 (float)src_offset
.z
/ (float)src_iview
->extent
.depth
,
469 vb_data
[2] = (struct blit_vb_data
) {
475 (float)src_offset
.x
/ (float)src_iview
->extent
.width
,
476 (float)src_offset
.y
/ (float)src_iview
->extent
.height
,
477 (float)src_offset
.z
/ (float)src_iview
->extent
.depth
,
481 struct anv_buffer vertex_buffer
= {
484 .bo
= &device
->dynamic_state_block_pool
.bo
,
485 .offset
= vb_state
.offset
,
488 anv_CmdBindVertexBuffers(anv_cmd_buffer_to_handle(cmd_buffer
), 0, 2,
490 anv_buffer_to_handle(&vertex_buffer
),
491 anv_buffer_to_handle(&vertex_buffer
)
495 sizeof(struct anv_vue_header
),
499 ANV_CALL(CreateSampler
)(anv_device_to_handle(device
),
500 &(VkSamplerCreateInfo
) {
501 .sType
= VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO
,
502 .magFilter
= blit_filter
,
503 .minFilter
= blit_filter
,
504 }, &cmd_buffer
->pool
->alloc
, &sampler
);
507 anv_AllocateDescriptorSets(anv_device_to_handle(device
),
508 &(VkDescriptorSetAllocateInfo
) {
509 .sType
= VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO
,
510 .descriptorPool
= dummy_desc_pool
,
512 .pSetLayouts
= &device
->meta_state
.blit
.ds_layout
514 anv_UpdateDescriptorSets(anv_device_to_handle(device
),
516 (VkWriteDescriptorSet
[]) {
518 .sType
= VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET
,
521 .dstArrayElement
= 0,
522 .descriptorCount
= 1,
523 .descriptorType
= VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER
,
524 .pImageInfo
= (VkDescriptorImageInfo
[]) {
527 .imageView
= anv_image_view_to_handle(src_iview
),
528 .imageLayout
= VK_IMAGE_LAYOUT_GENERAL
,
535 anv_CreateFramebuffer(anv_device_to_handle(device
),
536 &(VkFramebufferCreateInfo
) {
537 .sType
= VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO
,
538 .attachmentCount
= 1,
539 .pAttachments
= (VkImageView
[]) {
540 anv_image_view_to_handle(dest_iview
),
542 .width
= dest_iview
->extent
.width
,
543 .height
= dest_iview
->extent
.height
,
545 }, &cmd_buffer
->pool
->alloc
, &fb
);
547 ANV_CALL(CmdBeginRenderPass
)(anv_cmd_buffer_to_handle(cmd_buffer
),
548 &(VkRenderPassBeginInfo
) {
549 .sType
= VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO
,
550 .renderPass
= device
->meta_state
.blit
.render_pass
,
553 .offset
= { dest_offset
.x
, dest_offset
.y
},
554 .extent
= { dest_extent
.width
, dest_extent
.height
},
556 .clearValueCount
= 0,
557 .pClearValues
= NULL
,
558 }, VK_SUBPASS_CONTENTS_INLINE
);
562 switch (src_image
->type
) {
563 case VK_IMAGE_TYPE_1D
:
564 anv_finishme("VK_IMAGE_TYPE_1D");
565 pipeline
= device
->meta_state
.blit
.pipeline_2d_src
;
567 case VK_IMAGE_TYPE_2D
:
568 pipeline
= device
->meta_state
.blit
.pipeline_2d_src
;
570 case VK_IMAGE_TYPE_3D
:
571 pipeline
= device
->meta_state
.blit
.pipeline_3d_src
;
574 unreachable(!"bad VkImageType");
577 if (cmd_buffer
->state
.pipeline
!= anv_pipeline_from_handle(pipeline
)) {
578 anv_CmdBindPipeline(anv_cmd_buffer_to_handle(cmd_buffer
),
579 VK_PIPELINE_BIND_POINT_GRAPHICS
, pipeline
);
582 anv_CmdSetViewport(anv_cmd_buffer_to_handle(cmd_buffer
), 1,
586 .width
= dest_iview
->extent
.width
,
587 .height
= dest_iview
->extent
.height
,
592 anv_CmdBindDescriptorSets(anv_cmd_buffer_to_handle(cmd_buffer
),
593 VK_PIPELINE_BIND_POINT_GRAPHICS
,
594 device
->meta_state
.blit
.pipeline_layout
, 0, 1,
597 ANV_CALL(CmdDraw
)(anv_cmd_buffer_to_handle(cmd_buffer
), 3, 1, 0, 0);
599 ANV_CALL(CmdEndRenderPass
)(anv_cmd_buffer_to_handle(cmd_buffer
));
601 /* At the point where we emit the draw call, all data from the
602 * descriptor sets, etc. has been used. We are free to delete it.
604 anv_descriptor_set_destroy(device
, anv_descriptor_set_from_handle(set
));
605 anv_DestroySampler(anv_device_to_handle(device
), sampler
,
606 &cmd_buffer
->pool
->alloc
);
607 anv_DestroyFramebuffer(anv_device_to_handle(device
), fb
,
608 &cmd_buffer
->pool
->alloc
);
612 meta_finish_blit(struct anv_cmd_buffer
*cmd_buffer
,
613 const struct anv_meta_saved_state
*saved_state
)
615 anv_meta_restore(saved_state
, cmd_buffer
);
619 vk_format_for_size(int bs
)
622 case 1: return VK_FORMAT_R8_UINT
;
623 case 2: return VK_FORMAT_R8G8_UINT
;
624 case 3: return VK_FORMAT_R8G8B8_UINT
;
625 case 4: return VK_FORMAT_R8G8B8A8_UINT
;
626 case 6: return VK_FORMAT_R16G16B16_UINT
;
627 case 8: return VK_FORMAT_R16G16B16A16_UINT
;
628 case 12: return VK_FORMAT_R32G32B32_UINT
;
629 case 16: return VK_FORMAT_R32G32B32A32_UINT
;
631 unreachable("Invalid format block size");
636 do_buffer_copy(struct anv_cmd_buffer
*cmd_buffer
,
637 struct anv_bo
*src
, uint64_t src_offset
,
638 struct anv_bo
*dest
, uint64_t dest_offset
,
639 int width
, int height
, VkFormat copy_format
)
641 VkDevice vk_device
= anv_device_to_handle(cmd_buffer
->device
);
643 VkImageCreateInfo image_info
= {
644 .sType
= VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO
,
645 .imageType
= VK_IMAGE_TYPE_2D
,
646 .format
= copy_format
,
655 .tiling
= VK_IMAGE_TILING_LINEAR
,
661 image_info
.usage
= VK_IMAGE_USAGE_SAMPLED_BIT
;
662 anv_CreateImage(vk_device
, &image_info
,
663 &cmd_buffer
->pool
->alloc
, &src_image
);
666 image_info
.usage
= VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT
;
667 anv_CreateImage(vk_device
, &image_info
,
668 &cmd_buffer
->pool
->alloc
, &dest_image
);
670 /* We could use a vk call to bind memory, but that would require
671 * creating a dummy memory object etc. so there's really no point.
673 anv_image_from_handle(src_image
)->bo
= src
;
674 anv_image_from_handle(src_image
)->offset
= src_offset
;
675 anv_image_from_handle(dest_image
)->bo
= dest
;
676 anv_image_from_handle(dest_image
)->offset
= dest_offset
;
678 struct anv_image_view src_iview
;
679 anv_image_view_init(&src_iview
, cmd_buffer
->device
,
680 &(VkImageViewCreateInfo
) {
681 .sType
= VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO
,
683 .viewType
= VK_IMAGE_VIEW_TYPE_2D
,
684 .format
= copy_format
,
685 .subresourceRange
= {
686 .aspectMask
= VK_IMAGE_ASPECT_COLOR_BIT
,
695 struct anv_image_view dest_iview
;
696 anv_image_view_init(&dest_iview
, cmd_buffer
->device
,
697 &(VkImageViewCreateInfo
) {
698 .sType
= VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO
,
700 .viewType
= VK_IMAGE_VIEW_TYPE_2D
,
701 .format
= copy_format
,
702 .subresourceRange
= {
703 .aspectMask
= VK_IMAGE_ASPECT_COLOR_BIT
,
712 meta_emit_blit(cmd_buffer
,
713 anv_image_from_handle(src_image
),
715 (VkOffset3D
) { 0, 0, 0 },
716 (VkExtent3D
) { width
, height
, 1 },
717 anv_image_from_handle(dest_image
),
719 (VkOffset3D
) { 0, 0, 0 },
720 (VkExtent3D
) { width
, height
, 1 },
723 anv_DestroyImage(vk_device
, src_image
, &cmd_buffer
->pool
->alloc
);
724 anv_DestroyImage(vk_device
, dest_image
, &cmd_buffer
->pool
->alloc
);
727 void anv_CmdCopyBuffer(
728 VkCommandBuffer commandBuffer
,
731 uint32_t regionCount
,
732 const VkBufferCopy
* pRegions
)
734 ANV_FROM_HANDLE(anv_cmd_buffer
, cmd_buffer
, commandBuffer
);
735 ANV_FROM_HANDLE(anv_buffer
, src_buffer
, srcBuffer
);
736 ANV_FROM_HANDLE(anv_buffer
, dest_buffer
, destBuffer
);
738 struct anv_meta_saved_state saved_state
;
740 meta_prepare_blit(cmd_buffer
, &saved_state
);
742 for (unsigned r
= 0; r
< regionCount
; r
++) {
743 uint64_t src_offset
= src_buffer
->offset
+ pRegions
[r
].srcOffset
;
744 uint64_t dest_offset
= dest_buffer
->offset
+ pRegions
[r
].dstOffset
;
745 uint64_t copy_size
= pRegions
[r
].size
;
747 /* First, we compute the biggest format that can be used with the
748 * given offsets and size.
752 int fs
= ffs(src_offset
) - 1;
754 bs
= MIN2(bs
, 1 << fs
);
755 assert(src_offset
% bs
== 0);
757 fs
= ffs(dest_offset
) - 1;
759 bs
= MIN2(bs
, 1 << fs
);
760 assert(dest_offset
% bs
== 0);
762 fs
= ffs(pRegions
[r
].size
) - 1;
764 bs
= MIN2(bs
, 1 << fs
);
765 assert(pRegions
[r
].size
% bs
== 0);
767 VkFormat copy_format
= vk_format_for_size(bs
);
769 /* This is maximum possible width/height our HW can handle */
770 uint64_t max_surface_dim
= 1 << 14;
772 /* First, we make a bunch of max-sized copies */
773 uint64_t max_copy_size
= max_surface_dim
* max_surface_dim
* bs
;
774 while (copy_size
> max_copy_size
) {
775 do_buffer_copy(cmd_buffer
, src_buffer
->bo
, src_offset
,
776 dest_buffer
->bo
, dest_offset
,
777 max_surface_dim
, max_surface_dim
, copy_format
);
778 copy_size
-= max_copy_size
;
779 src_offset
+= max_copy_size
;
780 dest_offset
+= max_copy_size
;
783 uint64_t height
= copy_size
/ (max_surface_dim
* bs
);
784 assert(height
< max_surface_dim
);
786 uint64_t rect_copy_size
= height
* max_surface_dim
* bs
;
787 do_buffer_copy(cmd_buffer
, src_buffer
->bo
, src_offset
,
788 dest_buffer
->bo
, dest_offset
,
789 max_surface_dim
, height
, copy_format
);
790 copy_size
-= rect_copy_size
;
791 src_offset
+= rect_copy_size
;
792 dest_offset
+= rect_copy_size
;
795 if (copy_size
!= 0) {
796 do_buffer_copy(cmd_buffer
, src_buffer
->bo
, src_offset
,
797 dest_buffer
->bo
, dest_offset
,
798 copy_size
/ bs
, 1, copy_format
);
802 meta_finish_blit(cmd_buffer
, &saved_state
);
805 void anv_CmdCopyImage(
806 VkCommandBuffer commandBuffer
,
808 VkImageLayout srcImageLayout
,
810 VkImageLayout destImageLayout
,
811 uint32_t regionCount
,
812 const VkImageCopy
* pRegions
)
814 ANV_FROM_HANDLE(anv_cmd_buffer
, cmd_buffer
, commandBuffer
);
815 ANV_FROM_HANDLE(anv_image
, src_image
, srcImage
);
816 ANV_FROM_HANDLE(anv_image
, dest_image
, destImage
);
818 const VkImageViewType src_iview_type
=
819 meta_blit_get_src_image_view_type(src_image
);
821 struct anv_meta_saved_state saved_state
;
823 meta_prepare_blit(cmd_buffer
, &saved_state
);
825 for (unsigned r
= 0; r
< regionCount
; r
++) {
826 struct anv_image_view src_iview
;
827 anv_image_view_init(&src_iview
, cmd_buffer
->device
,
828 &(VkImageViewCreateInfo
) {
829 .sType
= VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO
,
831 .viewType
= src_iview_type
,
832 .format
= src_image
->format
->vk_format
,
833 .subresourceRange
= {
834 .aspectMask
= pRegions
[r
].srcSubresource
.aspectMask
,
835 .baseMipLevel
= pRegions
[r
].srcSubresource
.mipLevel
,
837 .baseArrayLayer
= pRegions
[r
].srcSubresource
.baseArrayLayer
,
838 .layerCount
= pRegions
[r
].dstSubresource
.layerCount
,
843 const VkOffset3D dest_offset
= {
844 .x
= pRegions
[r
].dstOffset
.x
,
845 .y
= pRegions
[r
].dstOffset
.y
,
850 if (src_image
->type
== VK_IMAGE_TYPE_3D
) {
851 assert(pRegions
[r
].srcSubresource
.layerCount
== 1 &&
852 pRegions
[r
].dstSubresource
.layerCount
== 1);
853 num_slices
= pRegions
[r
].extent
.depth
;
855 assert(pRegions
[r
].srcSubresource
.layerCount
==
856 pRegions
[r
].dstSubresource
.layerCount
);
857 assert(pRegions
[r
].extent
.depth
== 1);
858 num_slices
= pRegions
[r
].dstSubresource
.layerCount
;
861 const uint32_t dest_base_array_slice
=
862 meta_blit_get_dest_view_base_array_slice(dest_image
,
863 &pRegions
[r
].dstSubresource
,
864 &pRegions
[r
].dstOffset
);
866 for (unsigned slice
= 0; slice
< num_slices
; slice
++) {
867 VkOffset3D src_offset
= pRegions
[r
].srcOffset
;
868 src_offset
.z
+= slice
;
870 struct anv_image_view dest_iview
;
871 anv_image_view_init(&dest_iview
, cmd_buffer
->device
,
872 &(VkImageViewCreateInfo
) {
873 .sType
= VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO
,
875 .viewType
= VK_IMAGE_VIEW_TYPE_2D
,
876 .format
= dest_image
->format
->vk_format
,
877 .subresourceRange
= {
878 .aspectMask
= VK_IMAGE_ASPECT_COLOR_BIT
,
879 .baseMipLevel
= pRegions
[r
].dstSubresource
.mipLevel
,
881 .baseArrayLayer
= dest_base_array_slice
+ slice
,
887 meta_emit_blit(cmd_buffer
,
888 src_image
, &src_iview
,
891 dest_image
, &dest_iview
,
898 meta_finish_blit(cmd_buffer
, &saved_state
);
901 void anv_CmdBlitImage(
902 VkCommandBuffer commandBuffer
,
904 VkImageLayout srcImageLayout
,
906 VkImageLayout destImageLayout
,
907 uint32_t regionCount
,
908 const VkImageBlit
* pRegions
,
912 ANV_FROM_HANDLE(anv_cmd_buffer
, cmd_buffer
, commandBuffer
);
913 ANV_FROM_HANDLE(anv_image
, src_image
, srcImage
);
914 ANV_FROM_HANDLE(anv_image
, dest_image
, destImage
);
916 const VkImageViewType src_iview_type
=
917 meta_blit_get_src_image_view_type(src_image
);
919 struct anv_meta_saved_state saved_state
;
921 anv_finishme("respect VkFilter");
923 meta_prepare_blit(cmd_buffer
, &saved_state
);
925 for (unsigned r
= 0; r
< regionCount
; r
++) {
926 struct anv_image_view src_iview
;
927 anv_image_view_init(&src_iview
, cmd_buffer
->device
,
928 &(VkImageViewCreateInfo
) {
929 .sType
= VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO
,
931 .viewType
= src_iview_type
,
932 .format
= src_image
->format
->vk_format
,
933 .subresourceRange
= {
934 .aspectMask
= pRegions
[r
].srcSubresource
.aspectMask
,
935 .baseMipLevel
= pRegions
[r
].srcSubresource
.mipLevel
,
937 .baseArrayLayer
= pRegions
[r
].srcSubresource
.baseArrayLayer
,
943 const VkOffset3D dest_offset
= {
944 .x
= pRegions
[r
].dstOffset
.x
,
945 .y
= pRegions
[r
].dstOffset
.y
,
949 const uint32_t dest_array_slice
=
950 meta_blit_get_dest_view_base_array_slice(dest_image
,
951 &pRegions
[r
].dstSubresource
,
952 &pRegions
[r
].dstOffset
);
954 if (pRegions
[r
].srcSubresource
.layerCount
> 1)
955 anv_finishme("FINISHME: copy multiple array layers");
957 if (pRegions
[r
].dstExtent
.depth
> 1)
958 anv_finishme("FINISHME: copy multiple depth layers");
960 struct anv_image_view dest_iview
;
961 anv_image_view_init(&dest_iview
, cmd_buffer
->device
,
962 &(VkImageViewCreateInfo
) {
963 .sType
= VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO
,
965 .viewType
= VK_IMAGE_VIEW_TYPE_2D
,
966 .format
= dest_image
->format
->vk_format
,
967 .subresourceRange
= {
968 .aspectMask
= VK_IMAGE_ASPECT_COLOR_BIT
,
969 .baseMipLevel
= pRegions
[r
].dstSubresource
.mipLevel
,
971 .baseArrayLayer
= dest_array_slice
,
977 meta_emit_blit(cmd_buffer
,
978 src_image
, &src_iview
,
979 pRegions
[r
].srcOffset
,
980 pRegions
[r
].srcExtent
,
981 dest_image
, &dest_iview
,
983 pRegions
[r
].dstExtent
,
987 meta_finish_blit(cmd_buffer
, &saved_state
);
990 static struct anv_image
*
991 make_image_for_buffer(VkDevice vk_device
, VkBuffer vk_buffer
, VkFormat format
,
992 VkImageUsageFlags usage
,
993 VkImageType image_type
,
994 const VkAllocationCallbacks
*alloc
,
995 const VkBufferImageCopy
*copy
)
997 ANV_FROM_HANDLE(anv_buffer
, buffer
, vk_buffer
);
999 VkExtent3D extent
= copy
->imageExtent
;
1000 if (copy
->bufferRowLength
)
1001 extent
.width
= copy
->bufferRowLength
;
1002 if (copy
->bufferImageHeight
)
1003 extent
.height
= copy
->bufferImageHeight
;
1007 VkResult result
= anv_CreateImage(vk_device
,
1008 &(VkImageCreateInfo
) {
1009 .sType
= VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO
,
1010 .imageType
= VK_IMAGE_TYPE_2D
,
1016 .tiling
= VK_IMAGE_TILING_LINEAR
,
1019 }, alloc
, &vk_image
);
1020 assert(result
== VK_SUCCESS
);
1022 ANV_FROM_HANDLE(anv_image
, image
, vk_image
);
1024 /* We could use a vk call to bind memory, but that would require
1025 * creating a dummy memory object etc. so there's really no point.
1027 image
->bo
= buffer
->bo
;
1028 image
->offset
= buffer
->offset
+ copy
->bufferOffset
;
1033 void anv_CmdCopyBufferToImage(
1034 VkCommandBuffer commandBuffer
,
1037 VkImageLayout destImageLayout
,
1038 uint32_t regionCount
,
1039 const VkBufferImageCopy
* pRegions
)
1041 ANV_FROM_HANDLE(anv_cmd_buffer
, cmd_buffer
, commandBuffer
);
1042 ANV_FROM_HANDLE(anv_image
, dest_image
, destImage
);
1043 VkDevice vk_device
= anv_device_to_handle(cmd_buffer
->device
);
1044 const VkFormat orig_format
= dest_image
->format
->vk_format
;
1045 struct anv_meta_saved_state saved_state
;
1047 meta_prepare_blit(cmd_buffer
, &saved_state
);
1049 for (unsigned r
= 0; r
< regionCount
; r
++) {
1050 VkFormat proxy_format
= orig_format
;
1051 VkImageAspectFlags proxy_aspect
= pRegions
[r
].imageSubresource
.aspectMask
;
1053 if (orig_format
== VK_FORMAT_S8_UINT
) {
1054 proxy_format
= VK_FORMAT_R8_UINT
;
1055 proxy_aspect
= VK_IMAGE_ASPECT_COLOR_BIT
;
1058 struct anv_image
*src_image
=
1059 make_image_for_buffer(vk_device
, srcBuffer
, proxy_format
,
1060 VK_IMAGE_USAGE_SAMPLED_BIT
,
1061 dest_image
->type
, &cmd_buffer
->pool
->alloc
,
1064 const uint32_t dest_base_array_slice
=
1065 meta_blit_get_dest_view_base_array_slice(dest_image
,
1066 &pRegions
[r
].imageSubresource
,
1067 &pRegions
[r
].imageOffset
);
1069 unsigned num_slices
;
1070 if (dest_image
->type
== VK_IMAGE_TYPE_3D
) {
1071 assert(pRegions
[r
].imageSubresource
.layerCount
== 1);
1072 num_slices
= pRegions
[r
].imageExtent
.depth
;
1074 assert(pRegions
[r
].imageExtent
.depth
== 1);
1075 num_slices
= pRegions
[r
].imageSubresource
.layerCount
;
1078 for (unsigned slice
= 0; slice
< num_slices
; slice
++) {
1079 struct anv_image_view src_iview
;
1080 anv_image_view_init(&src_iview
, cmd_buffer
->device
,
1081 &(VkImageViewCreateInfo
) {
1082 .sType
= VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO
,
1083 .image
= anv_image_to_handle(src_image
),
1084 .viewType
= VK_IMAGE_VIEW_TYPE_2D
,
1085 .format
= proxy_format
,
1086 .subresourceRange
= {
1087 .aspectMask
= proxy_aspect
,
1090 .baseArrayLayer
= 0,
1096 struct anv_image_view dest_iview
;
1097 anv_image_view_init(&dest_iview
, cmd_buffer
->device
,
1098 &(VkImageViewCreateInfo
) {
1099 .sType
= VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO
,
1100 .image
= anv_image_to_handle(dest_image
),
1101 .viewType
= VK_IMAGE_VIEW_TYPE_2D
,
1102 .format
= proxy_format
,
1103 .subresourceRange
= {
1104 .aspectMask
= VK_IMAGE_ASPECT_COLOR_BIT
,
1105 .baseMipLevel
= pRegions
[r
].imageSubresource
.mipLevel
,
1107 .baseArrayLayer
= dest_base_array_slice
+ slice
,
1113 VkOffset3D src_offset
= { 0, 0, slice
};
1115 const VkOffset3D dest_offset
= {
1116 .x
= pRegions
[r
].imageOffset
.x
,
1117 .y
= pRegions
[r
].imageOffset
.y
,
1121 meta_emit_blit(cmd_buffer
,
1125 pRegions
[r
].imageExtent
,
1129 pRegions
[r
].imageExtent
,
1132 /* Once we've done the blit, all of the actual information about
1133 * the image is embedded in the command buffer so we can just
1134 * increment the offset directly in the image effectively
1135 * re-binding it to different backing memory.
1137 /* XXX: Insert a real CPP */
1138 src_image
->offset
+= src_image
->extent
.width
*
1139 src_image
->extent
.height
* 4;
1142 anv_DestroyImage(vk_device
, anv_image_to_handle(src_image
),
1143 &cmd_buffer
->pool
->alloc
);
1146 meta_finish_blit(cmd_buffer
, &saved_state
);
1149 void anv_CmdCopyImageToBuffer(
1150 VkCommandBuffer commandBuffer
,
1152 VkImageLayout srcImageLayout
,
1153 VkBuffer destBuffer
,
1154 uint32_t regionCount
,
1155 const VkBufferImageCopy
* pRegions
)
1157 ANV_FROM_HANDLE(anv_cmd_buffer
, cmd_buffer
, commandBuffer
);
1158 ANV_FROM_HANDLE(anv_image
, src_image
, srcImage
);
1159 VkDevice vk_device
= anv_device_to_handle(cmd_buffer
->device
);
1160 struct anv_meta_saved_state saved_state
;
1162 const VkImageViewType src_iview_type
=
1163 meta_blit_get_src_image_view_type(src_image
);
1165 meta_prepare_blit(cmd_buffer
, &saved_state
);
1167 for (unsigned r
= 0; r
< regionCount
; r
++) {
1168 struct anv_image_view src_iview
;
1169 anv_image_view_init(&src_iview
, cmd_buffer
->device
,
1170 &(VkImageViewCreateInfo
) {
1171 .sType
= VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO
,
1173 .viewType
= src_iview_type
,
1174 .format
= src_image
->format
->vk_format
,
1175 .subresourceRange
= {
1176 .aspectMask
= pRegions
[r
].imageSubresource
.aspectMask
,
1177 .baseMipLevel
= pRegions
[r
].imageSubresource
.mipLevel
,
1179 .baseArrayLayer
= pRegions
[r
].imageSubresource
.baseArrayLayer
,
1180 .layerCount
= pRegions
[r
].imageSubresource
.layerCount
,
1185 VkFormat dest_format
= src_image
->format
->vk_format
;
1186 if (dest_format
== VK_FORMAT_S8_UINT
) {
1187 dest_format
= VK_FORMAT_R8_UINT
;
1190 struct anv_image
*dest_image
=
1191 make_image_for_buffer(vk_device
, destBuffer
, dest_format
,
1192 VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT
,
1193 src_image
->type
, &cmd_buffer
->pool
->alloc
,
1196 unsigned num_slices
;
1197 if (src_image
->type
== VK_IMAGE_TYPE_3D
) {
1198 assert(pRegions
[r
].imageSubresource
.layerCount
== 1);
1199 num_slices
= pRegions
[r
].imageExtent
.depth
;
1201 assert(pRegions
[r
].imageExtent
.depth
== 1);
1202 num_slices
= pRegions
[r
].imageSubresource
.layerCount
;
1205 for (unsigned slice
= 0; slice
< num_slices
; slice
++) {
1206 VkOffset3D src_offset
= pRegions
[r
].imageOffset
;
1207 src_offset
.z
+= slice
;
1209 struct anv_image_view dest_iview
;
1210 anv_image_view_init(&dest_iview
, cmd_buffer
->device
,
1211 &(VkImageViewCreateInfo
) {
1212 .sType
= VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO
,
1213 .image
= anv_image_to_handle(dest_image
),
1214 .viewType
= VK_IMAGE_VIEW_TYPE_2D
,
1215 .format
= dest_format
,
1216 .subresourceRange
= {
1217 .aspectMask
= VK_IMAGE_ASPECT_COLOR_BIT
,
1220 .baseArrayLayer
= 0,
1226 meta_emit_blit(cmd_buffer
,
1227 anv_image_from_handle(srcImage
),
1230 pRegions
[r
].imageExtent
,
1233 (VkOffset3D
) { 0, 0, 0 },
1234 pRegions
[r
].imageExtent
,
1237 /* Once we've done the blit, all of the actual information about
1238 * the image is embedded in the command buffer so we can just
1239 * increment the offset directly in the image effectively
1240 * re-binding it to different backing memory.
1242 /* XXX: Insert a real CPP */
1243 dest_image
->offset
+= dest_image
->extent
.width
*
1244 dest_image
->extent
.height
* 4;
1247 anv_DestroyImage(vk_device
, anv_image_to_handle(dest_image
),
1248 &cmd_buffer
->pool
->alloc
);
1251 meta_finish_blit(cmd_buffer
, &saved_state
);
1254 void anv_CmdUpdateBuffer(
1255 VkCommandBuffer commandBuffer
,
1256 VkBuffer destBuffer
,
1257 VkDeviceSize destOffset
,
1258 VkDeviceSize dataSize
,
1259 const uint32_t* pData
)
1264 void anv_CmdFillBuffer(
1265 VkCommandBuffer commandBuffer
,
1266 VkBuffer destBuffer
,
1267 VkDeviceSize destOffset
,
1268 VkDeviceSize fillSize
,
1274 void anv_CmdResolveImage(
1275 VkCommandBuffer commandBuffer
,
1277 VkImageLayout srcImageLayout
,
1279 VkImageLayout destImageLayout
,
1280 uint32_t regionCount
,
1281 const VkImageResolve
* pRegions
)
1287 anv_device_init_meta(struct anv_device
*device
)
1289 anv_device_init_meta_clear_state(device
);
1290 anv_device_init_meta_blit_state(device
);
1294 anv_device_finish_meta(struct anv_device
*device
)
1296 anv_device_finish_meta_clear_state(device
);
1299 anv_DestroyRenderPass(anv_device_to_handle(device
),
1300 device
->meta_state
.blit
.render_pass
, NULL
);
1301 anv_DestroyPipeline(anv_device_to_handle(device
),
1302 device
->meta_state
.blit
.pipeline_2d_src
, NULL
);
1303 anv_DestroyPipeline(anv_device_to_handle(device
),
1304 device
->meta_state
.blit
.pipeline_3d_src
, NULL
);
1305 anv_DestroyPipelineLayout(anv_device_to_handle(device
),
1306 device
->meta_state
.blit
.pipeline_layout
, NULL
);
1307 anv_DestroyDescriptorSetLayout(anv_device_to_handle(device
),
1308 device
->meta_state
.blit
.ds_layout
, NULL
);