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 "glsl_helpers.h"
34 anv_device_init_meta_clear_state(struct anv_device
*device
)
36 VkPipelineIaStateCreateInfo ia_create_info
= {
37 .sType
= VK_STRUCTURE_TYPE_PIPELINE_IA_STATE_CREATE_INFO
,
38 .topology
= VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP
,
39 .disableVertexReuse
= false,
40 .primitiveRestartEnable
= false,
41 .primitiveRestartIndex
= 0
44 /* We don't use a vertex shader for clearing, but instead build and pass
45 * the VUEs directly to the rasterization backend.
47 VkShader fs
= GLSL_VK_SHADER(device
, FRAGMENT
,
56 VkPipelineShaderStageCreateInfo fs_create_info
= {
57 .sType
= VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO
,
58 .pNext
= &ia_create_info
,
60 .stage
= VK_SHADER_STAGE_FRAGMENT
,
62 .linkConstBufferCount
= 0,
63 .pLinkConstBufferInfo
= NULL
,
64 .pSpecializationInfo
= NULL
68 /* We use instanced rendering to clear multiple render targets. We have two
69 * vertex buffers: the first vertex buffer holds per-vertex data and
70 * provides the vertices for the clear rectangle. The second one holds
71 * per-instance data, which consists of the VUE header (which selects the
72 * layer) and the color (Vulkan supports per-RT clear colors).
74 VkPipelineVertexInputCreateInfo vi_create_info
= {
75 .sType
= VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_CREATE_INFO
,
76 .pNext
= &fs_create_info
,
78 .pVertexBindingDescriptions
= (VkVertexInputBindingDescription
[]) {
82 .stepRate
= VK_VERTEX_INPUT_STEP_RATE_VERTEX
87 .stepRate
= VK_VERTEX_INPUT_STEP_RATE_INSTANCE
91 .pVertexAttributeDescriptions
= (VkVertexInputAttributeDescription
[]) {
96 .format
= VK_FORMAT_R32G32B32A32_UINT
,
103 .format
= VK_FORMAT_R32G32_SFLOAT
,
110 .format
= VK_FORMAT_R32G32B32A32_SFLOAT
,
116 VkPipelineRsStateCreateInfo rs_create_info
= {
117 .sType
= VK_STRUCTURE_TYPE_PIPELINE_RS_STATE_CREATE_INFO
,
118 .pNext
= &vi_create_info
,
119 .depthClipEnable
= true,
120 .rasterizerDiscardEnable
= false,
121 .fillMode
= VK_FILL_MODE_SOLID
,
122 .cullMode
= VK_CULL_MODE_NONE
,
123 .frontFace
= VK_FRONT_FACE_CCW
126 anv_pipeline_create((VkDevice
) device
,
127 &(VkGraphicsPipelineCreateInfo
) {
128 .sType
= VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO
,
129 .pNext
= &rs_create_info
,
133 &(struct anv_pipeline_create_info
) {
134 .use_repclear
= true,
135 .disable_viewport
= true,
138 &device
->clear_state
.pipeline
);
140 vkDestroyObject((VkDevice
) device
, VK_OBJECT_TYPE_SHADER
, fs
);
142 vkCreateDynamicRasterState((VkDevice
) device
,
143 &(VkDynamicRsStateCreateInfo
) {
144 .sType
= VK_STRUCTURE_TYPE_DYNAMIC_RS_STATE_CREATE_INFO
,
146 &device
->clear_state
.rs_state
);
149 #define NUM_VB_USED 2
150 struct anv_saved_state
{
151 struct anv_bindings bindings
;
152 struct anv_pipeline
*pipeline
;
156 anv_cmd_buffer_save(struct anv_cmd_buffer
*cmd_buffer
,
157 struct anv_saved_state
*state
)
159 cmd_buffer
->bindings
= &state
->bindings
;
160 state
->pipeline
= cmd_buffer
->pipeline
;
162 /* Initialize render targets for the meta bindings. */
163 anv_cmd_buffer_fill_render_targets(cmd_buffer
);
167 anv_cmd_buffer_restore(struct anv_cmd_buffer
*cmd_buffer
,
168 const struct anv_saved_state
*state
)
170 cmd_buffer
->bindings
= &cmd_buffer
->default_bindings
;
171 cmd_buffer
->pipeline
= state
->pipeline
;
173 cmd_buffer
->vb_dirty
|= (1 << NUM_VB_USED
) - 1;
174 cmd_buffer
->dirty
|= ANV_CMD_BUFFER_PIPELINE_DIRTY
|
175 ANV_CMD_BUFFER_DESCRIPTOR_SET_DIRTY
;
181 uint32_t ViewportIndex
;
186 anv_cmd_buffer_clear(struct anv_cmd_buffer
*cmd_buffer
,
187 struct anv_render_pass
*pass
)
189 struct anv_device
*device
= cmd_buffer
->device
;
190 struct anv_framebuffer
*fb
= cmd_buffer
->framebuffer
;
191 struct anv_saved_state saved_state
;
192 struct anv_state state
;
195 struct instance_data
{
196 struct vue_header vue_header
;
200 const float vertex_data
[] = {
201 /* Rect-list coordinates */
204 fb
->width
, fb
->height
,
206 /* Align to 16 bytes */
210 size
= sizeof(vertex_data
) + pass
->num_clear_layers
* sizeof(instance_data
[0]);
211 state
= anv_state_stream_alloc(&cmd_buffer
->surface_state_stream
, size
, 16);
213 memcpy(state
.map
, vertex_data
, sizeof(vertex_data
));
214 instance_data
= state
.map
+ sizeof(vertex_data
);
216 for (uint32_t i
= 0; i
< pass
->num_layers
; i
++) {
217 if (pass
->layers
[i
].color_load_op
== VK_ATTACHMENT_LOAD_OP_CLEAR
) {
218 *instance_data
++ = (struct instance_data
) {
225 pass
->layers
[i
].clear_color
.color
.floatColor
[0],
226 pass
->layers
[i
].clear_color
.color
.floatColor
[1],
227 pass
->layers
[i
].clear_color
.color
.floatColor
[2],
228 pass
->layers
[i
].clear_color
.color
.floatColor
[3],
234 struct anv_buffer vertex_buffer
= {
235 .device
= cmd_buffer
->device
,
237 .bo
= &device
->surface_state_block_pool
.bo
,
238 .offset
= state
.offset
241 anv_cmd_buffer_save(cmd_buffer
, &saved_state
);
243 vkCmdBindVertexBuffers((VkCmdBuffer
) cmd_buffer
, 0, 2,
245 (VkBuffer
) &vertex_buffer
,
246 (VkBuffer
) &vertex_buffer
253 if ((VkPipeline
) cmd_buffer
->pipeline
!= device
->clear_state
.pipeline
)
254 vkCmdBindPipeline((VkCmdBuffer
) cmd_buffer
,
255 VK_PIPELINE_BIND_POINT_GRAPHICS
, device
->clear_state
.pipeline
);
257 /* We don't need anything here, only set if not already set. */
258 if (cmd_buffer
->rs_state
== NULL
)
259 vkCmdBindDynamicStateObject((VkCmdBuffer
) cmd_buffer
,
260 VK_STATE_BIND_POINT_RASTER
,
261 device
->clear_state
.rs_state
);
263 if (cmd_buffer
->vp_state
== NULL
)
264 vkCmdBindDynamicStateObject((VkCmdBuffer
) cmd_buffer
,
265 VK_STATE_BIND_POINT_VIEWPORT
,
266 cmd_buffer
->framebuffer
->vp_state
);
268 vkCmdDraw((VkCmdBuffer
) cmd_buffer
, 0, 3, 0, pass
->num_clear_layers
);
270 /* Restore API state */
271 anv_cmd_buffer_restore(cmd_buffer
, &saved_state
);
276 anv_device_init_meta_blit_state(struct anv_device
*device
)
278 VkPipelineIaStateCreateInfo ia_create_info
= {
279 .sType
= VK_STRUCTURE_TYPE_PIPELINE_IA_STATE_CREATE_INFO
,
280 .topology
= VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP
,
281 .disableVertexReuse
= false,
282 .primitiveRestartEnable
= false,
283 .primitiveRestartIndex
= 0
286 /* We don't use a vertex shader for clearing, but instead build and pass
287 * the VUEs directly to the rasterization backend. However, we do need
288 * to provide GLSL source for the vertex shader so that the compiler
289 * does not dead-code our inputs.
291 VkShader vs
= GLSL_VK_SHADER(device
, VERTEX
,
294 out vec4 v_tex_coord
;
297 v_tex_coord
= vec4(a_tex_coord
, 0, 1);
298 gl_Position
= vec4(a_pos
, 0, 1);
302 VkShader fs
= GLSL_VK_SHADER(device
, FRAGMENT
,
305 layout(set
= 0, index
= 0) uniform sampler2D u_tex
;
308 f_color
= texture2D(u_tex
, v_tex_coord
.xy
);
312 VkPipelineShaderStageCreateInfo vs_create_info
= {
313 .sType
= VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO
,
314 .pNext
= &ia_create_info
,
316 .stage
= VK_SHADER_STAGE_VERTEX
,
318 .linkConstBufferCount
= 0,
319 .pLinkConstBufferInfo
= NULL
,
320 .pSpecializationInfo
= NULL
324 VkPipelineShaderStageCreateInfo fs_create_info
= {
325 .sType
= VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO
,
326 .pNext
= &vs_create_info
,
328 .stage
= VK_SHADER_STAGE_FRAGMENT
,
330 .linkConstBufferCount
= 0,
331 .pLinkConstBufferInfo
= NULL
,
332 .pSpecializationInfo
= NULL
336 VkPipelineVertexInputCreateInfo vi_create_info
= {
337 .sType
= VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_CREATE_INFO
,
338 .pNext
= &fs_create_info
,
340 .pVertexBindingDescriptions
= (VkVertexInputBindingDescription
[]) {
344 .stepRate
= VK_VERTEX_INPUT_STEP_RATE_VERTEX
349 .stepRate
= VK_VERTEX_INPUT_STEP_RATE_VERTEX
353 .pVertexAttributeDescriptions
= (VkVertexInputAttributeDescription
[]) {
358 .format
= VK_FORMAT_R32G32B32A32_UINT
,
365 .format
= VK_FORMAT_R32G32_SFLOAT
,
369 /* Texture Coordinate */
372 .format
= VK_FORMAT_R32G32_SFLOAT
,
378 VkDescriptorSetLayoutCreateInfo ds_layout_info
= {
379 .sType
= VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO
,
381 .pBinding
= (VkDescriptorSetLayoutBinding
[]) {
383 .descriptorType
= VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE
,
385 .stageFlags
= VK_SHADER_STAGE_FRAGMENT_BIT
,
386 .pImmutableSamplers
= NULL
390 vkCreateDescriptorSetLayout((VkDevice
) device
, &ds_layout_info
,
391 &device
->blit_state
.ds_layout
);
393 VkPipelineLayoutCreateInfo pipeline_layout_info
= {
394 .sType
= VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO
,
395 .descriptorSetCount
= 1,
396 .pSetLayouts
= &device
->blit_state
.ds_layout
,
399 VkPipelineLayout pipeline_layout
;
400 vkCreatePipelineLayout((VkDevice
) device
, &pipeline_layout_info
,
403 VkPipelineRsStateCreateInfo rs_create_info
= {
404 .sType
= VK_STRUCTURE_TYPE_PIPELINE_RS_STATE_CREATE_INFO
,
405 .pNext
= &vi_create_info
,
406 .depthClipEnable
= true,
407 .rasterizerDiscardEnable
= false,
408 .fillMode
= VK_FILL_MODE_SOLID
,
409 .cullMode
= VK_CULL_MODE_NONE
,
410 .frontFace
= VK_FRONT_FACE_CCW
413 VkGraphicsPipelineCreateInfo pipeline_info
= {
414 .sType
= VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO
,
415 .pNext
= &rs_create_info
,
417 .layout
= pipeline_layout
,
420 anv_pipeline_create((VkDevice
) device
, &pipeline_info
,
421 &(struct anv_pipeline_create_info
) {
422 .use_repclear
= false,
423 .disable_viewport
= true,
424 .disable_scissor
= true,
428 &device
->blit_state
.pipeline
);
430 vkDestroyObject((VkDevice
) device
, VK_OBJECT_TYPE_SHADER
, vs
);
431 vkDestroyObject((VkDevice
) device
, VK_OBJECT_TYPE_SHADER
, fs
);
433 vkCreateDynamicRasterState((VkDevice
) device
,
434 &(VkDynamicRsStateCreateInfo
) {
435 .sType
= VK_STRUCTURE_TYPE_DYNAMIC_RS_STATE_CREATE_INFO
,
437 &device
->blit_state
.rs_state
);
441 meta_prepare_blit(struct anv_cmd_buffer
*cmd_buffer
,
442 struct anv_saved_state
*saved_state
)
444 struct anv_device
*device
= cmd_buffer
->device
;
446 anv_cmd_buffer_save(cmd_buffer
, saved_state
);
448 if ((VkPipeline
) cmd_buffer
->pipeline
!= device
->blit_state
.pipeline
)
449 vkCmdBindPipeline((VkCmdBuffer
) cmd_buffer
,
450 VK_PIPELINE_BIND_POINT_GRAPHICS
,
451 device
->blit_state
.pipeline
);
453 /* We don't need anything here, only set if not already set. */
454 if (cmd_buffer
->rs_state
== NULL
)
455 vkCmdBindDynamicStateObject((VkCmdBuffer
) cmd_buffer
,
456 VK_STATE_BIND_POINT_RASTER
,
457 device
->blit_state
.rs_state
);
461 VkOffset3D src_offset
;
462 VkExtent3D src_extent
;
463 VkOffset3D dest_offset
;
464 VkExtent3D dest_extent
;
468 meta_emit_blit(struct anv_cmd_buffer
*cmd_buffer
,
469 struct anv_surface_view
*src
,
470 VkOffset3D src_offset
,
471 VkExtent3D src_extent
,
472 struct anv_surface_view
*dest
,
473 VkOffset3D dest_offset
,
474 VkExtent3D dest_extent
)
476 struct anv_device
*device
= cmd_buffer
->device
;
478 struct blit_vb_data
{
483 unsigned vb_size
= sizeof(struct vue_header
) + 3 * sizeof(*vb_data
);
485 struct anv_state vb_state
=
486 anv_state_stream_alloc(&cmd_buffer
->surface_state_stream
, vb_size
, 16);
487 memset(vb_state
.map
, 0, sizeof(struct vue_header
));
488 vb_data
= vb_state
.map
+ sizeof(struct vue_header
);
490 vb_data
[0] = (struct blit_vb_data
) {
492 dest_offset
.x
+ dest_extent
.width
,
493 dest_offset
.y
+ dest_extent
.height
,
496 (float)(src_offset
.x
+ src_extent
.width
) / (float)src
->extent
.width
,
497 (float)(src_offset
.y
+ src_extent
.height
) / (float)src
->extent
.height
,
501 vb_data
[1] = (struct blit_vb_data
) {
504 dest_offset
.y
+ dest_extent
.height
,
507 (float)src_offset
.x
/ (float)src
->extent
.width
,
508 (float)(src_offset
.y
+ src_extent
.height
) / (float)src
->extent
.height
,
512 vb_data
[2] = (struct blit_vb_data
) {
518 (float)src_offset
.x
/ (float)src
->extent
.width
,
519 (float)src_offset
.y
/ (float)src
->extent
.height
,
523 struct anv_buffer vertex_buffer
= {
526 .bo
= &device
->surface_state_block_pool
.bo
,
527 .offset
= vb_state
.offset
,
530 vkCmdBindVertexBuffers((VkCmdBuffer
) cmd_buffer
, 0, 2,
532 (VkBuffer
) &vertex_buffer
,
533 (VkBuffer
) &vertex_buffer
537 sizeof(struct vue_header
),
542 vkAllocDescriptorSets((VkDevice
) device
, 0 /* pool */,
543 VK_DESCRIPTOR_SET_USAGE_ONE_SHOT
,
544 1, &device
->blit_state
.ds_layout
, &set
, &count
);
545 vkUpdateDescriptors((VkDevice
) device
, set
, 1,
548 .sType
= VK_STRUCTURE_TYPE_UPDATE_IMAGES
,
549 .descriptorType
= VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE
,
552 .pImageViews
= (VkImageViewAttachInfo
[]) {
554 .sType
= VK_STRUCTURE_TYPE_IMAGE_VIEW_ATTACH_INFO
,
555 .view
= (VkImageView
) src
,
556 .layout
= VK_IMAGE_LAYOUT_GENERAL
,
562 VkFramebufferCreateInfo fb_info
= {
563 .sType
= VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO
,
564 .colorAttachmentCount
= 1,
565 .pColorAttachments
= (VkColorAttachmentBindInfo
[]) {
567 .view
= (VkColorAttachmentView
) dest
,
568 .layout
= VK_IMAGE_LAYOUT_GENERAL
571 .pDepthStencilAttachment
= NULL
,
573 .width
= dest
->extent
.width
,
574 .height
= dest
->extent
.height
,
578 struct anv_framebuffer
*fb
;
579 vkCreateFramebuffer((VkDevice
) device
, &fb_info
, (VkFramebuffer
*)&fb
);
581 VkRenderPassCreateInfo pass_info
= {
582 .sType
= VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO
,
583 .renderArea
= { { 0, 0 }, { dest
->extent
.width
, dest
->extent
.height
} },
584 .colorAttachmentCount
= 1,
588 .pColorFormats
= (VkFormat
[]) { dest
->format
},
589 .pColorLayouts
= (VkImageLayout
[]) { VK_IMAGE_LAYOUT_GENERAL
},
590 .pColorLoadOps
= (VkAttachmentLoadOp
[]) { VK_ATTACHMENT_LOAD_OP_LOAD
},
591 .pColorStoreOps
= (VkAttachmentStoreOp
[]) { VK_ATTACHMENT_STORE_OP_STORE
},
592 .pColorLoadClearValues
= (VkClearColor
[]) {
593 { .color
= { .floatColor
= { 1.0, 0.0, 0.0, 1.0 } }, .useRawValue
= false }
595 .depthStencilFormat
= VK_FORMAT_UNDEFINED
,
599 vkCreateRenderPass((VkDevice
)device
, &pass_info
, &pass
);
601 vkCmdBeginRenderPass((VkCmdBuffer
) cmd_buffer
,
602 &(VkRenderPassBegin
) {
604 .framebuffer
= (VkFramebuffer
) fb
,
607 vkCmdBindDynamicStateObject((VkCmdBuffer
) cmd_buffer
,
608 VK_STATE_BIND_POINT_VIEWPORT
, fb
->vp_state
);
610 vkCmdBindDescriptorSets((VkCmdBuffer
) cmd_buffer
,
611 VK_PIPELINE_BIND_POINT_GRAPHICS
, 0, 1,
614 vkCmdDraw((VkCmdBuffer
) cmd_buffer
, 0, 3, 0, 1);
616 vkCmdEndRenderPass((VkCmdBuffer
) cmd_buffer
, pass
);
620 meta_finish_blit(struct anv_cmd_buffer
*cmd_buffer
,
621 const struct anv_saved_state
*saved_state
)
623 anv_cmd_buffer_restore(cmd_buffer
, saved_state
);
626 void VKAPI
vkCmdCopyBuffer(
627 VkCmdBuffer cmdBuffer
,
630 uint32_t regionCount
,
631 const VkBufferCopy
* pRegions
)
636 void VKAPI
vkCmdCopyImage(
637 VkCmdBuffer cmdBuffer
,
639 VkImageLayout srcImageLayout
,
641 VkImageLayout destImageLayout
,
642 uint32_t regionCount
,
643 const VkImageCopy
* pRegions
)
648 void VKAPI
vkCmdBlitImage(
649 VkCmdBuffer cmdBuffer
,
651 VkImageLayout srcImageLayout
,
653 VkImageLayout destImageLayout
,
654 uint32_t regionCount
,
655 const VkImageBlit
* pRegions
)
660 void VKAPI
vkCmdCopyBufferToImage(
661 VkCmdBuffer cmdBuffer
,
664 VkImageLayout destImageLayout
,
665 uint32_t regionCount
,
666 const VkBufferImageCopy
* pRegions
)
671 void VKAPI
vkCmdCopyImageToBuffer(
672 VkCmdBuffer cmdBuffer
,
674 VkImageLayout srcImageLayout
,
676 uint32_t regionCount
,
677 const VkBufferImageCopy
* pRegions
)
679 struct anv_cmd_buffer
*cmd_buffer
= (struct anv_cmd_buffer
*)cmdBuffer
;
680 VkDevice vk_device
= (VkDevice
) cmd_buffer
->device
;
681 struct anv_image
*src_image
= (struct anv_image
*)srcImage
;
682 struct anv_buffer
*dest_buffer
= (struct anv_buffer
*)destBuffer
;
683 struct anv_saved_state saved_state
;
685 meta_prepare_blit(cmd_buffer
, &saved_state
);
687 for (unsigned r
= 0; r
< regionCount
; r
++) {
688 VkImageViewCreateInfo src_view_info
= {
689 .sType
= VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO
,
691 .viewType
= VK_IMAGE_VIEW_TYPE_2D
,
692 .format
= src_image
->format
,
694 VK_CHANNEL_SWIZZLE_R
,
695 VK_CHANNEL_SWIZZLE_G
,
696 VK_CHANNEL_SWIZZLE_B
,
699 .subresourceRange
= {
700 .aspect
= pRegions
[r
].imageSubresource
.aspect
,
701 .baseMipLevel
= pRegions
[r
].imageSubresource
.mipLevel
,
703 .baseArraySlice
= pRegions
[r
].imageSubresource
.arraySlice
,
709 VkImageView src_view
;
710 vkCreateImageView(vk_device
, &src_view_info
, &src_view
);
712 VkImageCreateInfo dest_image_info
= {
713 .sType
= VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO
,
714 .imageType
= VK_IMAGE_TYPE_2D
,
715 .format
= src_image
->format
,
717 .width
= pRegions
[r
].imageExtent
.width
,
718 .height
= pRegions
[r
].imageExtent
.height
,
724 .tiling
= VK_IMAGE_TILING_LINEAR
,
725 .usage
= VK_IMAGE_USAGE_SAMPLED_BIT
,
729 struct anv_image
*dest_image
;
730 vkCreateImage(vk_device
, &dest_image_info
, (VkImage
*)&dest_image
);
732 /* We could use a vk call to bind memory, but that would require
733 * creating a dummy memory object etc. so there's really no point.
735 dest_image
->bo
= dest_buffer
->bo
;
736 dest_image
->offset
= dest_buffer
->offset
+ pRegions
[r
].bufferOffset
;
738 VkColorAttachmentViewCreateInfo dest_view_info
= {
739 .sType
= VK_STRUCTURE_TYPE_COLOR_ATTACHMENT_VIEW_CREATE_INFO
,
740 .image
= (VkImage
)dest_image
,
741 .format
= src_image
->format
,
747 VkColorAttachmentView dest_view
;
748 vkCreateColorAttachmentView(vk_device
, &dest_view_info
, &dest_view
);
750 meta_emit_blit(cmd_buffer
,
751 (struct anv_surface_view
*)src_view
,
752 pRegions
[r
].imageOffset
,
753 pRegions
[r
].imageExtent
,
754 (struct anv_surface_view
*)dest_view
,
755 (VkOffset3D
) { 0, 0, 0 },
756 pRegions
[r
].imageExtent
);
759 meta_finish_blit(cmd_buffer
, &saved_state
);
762 void VKAPI
vkCmdCloneImageData(
763 VkCmdBuffer cmdBuffer
,
765 VkImageLayout srcImageLayout
,
767 VkImageLayout destImageLayout
)
772 void VKAPI
vkCmdUpdateBuffer(
773 VkCmdBuffer cmdBuffer
,
775 VkDeviceSize destOffset
,
776 VkDeviceSize dataSize
,
777 const uint32_t* pData
)
782 void VKAPI
vkCmdFillBuffer(
783 VkCmdBuffer cmdBuffer
,
785 VkDeviceSize destOffset
,
786 VkDeviceSize fillSize
,
792 void VKAPI
vkCmdClearColorImage(
793 VkCmdBuffer cmdBuffer
,
795 VkImageLayout imageLayout
,
796 const VkClearColor
* color
,
798 const VkImageSubresourceRange
* pRanges
)
803 void VKAPI
vkCmdClearDepthStencil(
804 VkCmdBuffer cmdBuffer
,
806 VkImageLayout imageLayout
,
810 const VkImageSubresourceRange
* pRanges
)
815 void VKAPI
vkCmdResolveImage(
816 VkCmdBuffer cmdBuffer
,
818 VkImageLayout srcImageLayout
,
820 VkImageLayout destImageLayout
,
821 uint32_t regionCount
,
822 const VkImageResolve
* pRegions
)
828 anv_device_init_meta(struct anv_device
*device
)
830 anv_device_init_meta_clear_state(device
);
831 anv_device_init_meta_blit_state(device
);