vk/meta: Actually create the CB state for blits
[mesa.git] / src / vulkan / meta.c
1 /*
2 * Copyright © 2015 Intel Corporation
3 *
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:
10 *
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
13 * Software.
14 *
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
21 * IN THE SOFTWARE.
22 */
23
24 #include <assert.h>
25 #include <stdbool.h>
26 #include <string.h>
27 #include <unistd.h>
28 #include <fcntl.h>
29
30 #include "private.h"
31 #include "meta-spirv.h"
32
33 static void
34 anv_device_init_meta_clear_state(struct anv_device *device)
35 {
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
42 };
43
44 /* We don't use a vertex shader for clearing, but instead build and pass
45 * the VUEs directly to the rasterization backend.
46 */
47 VkShader fs = GLSL_VK_SHADER(device, FRAGMENT,
48 out vec4 f_color;
49 flat in vec4 v_color;
50 void main()
51 {
52 f_color = v_color;
53 }
54 );
55
56 VkPipelineShaderStageCreateInfo fs_create_info = {
57 .sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO,
58 .pNext = &ia_create_info,
59 .shader = {
60 .stage = VK_SHADER_STAGE_FRAGMENT,
61 .shader = fs,
62 .linkConstBufferCount = 0,
63 .pLinkConstBufferInfo = NULL,
64 .pSpecializationInfo = NULL
65 }
66 };
67
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).
73 */
74 VkPipelineVertexInputCreateInfo vi_create_info = {
75 .sType = VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_CREATE_INFO,
76 .pNext = &fs_create_info,
77 .bindingCount = 2,
78 .pVertexBindingDescriptions = (VkVertexInputBindingDescription[]) {
79 {
80 .binding = 0,
81 .strideInBytes = 8,
82 .stepRate = VK_VERTEX_INPUT_STEP_RATE_VERTEX
83 },
84 {
85 .binding = 1,
86 .strideInBytes = 32,
87 .stepRate = VK_VERTEX_INPUT_STEP_RATE_INSTANCE
88 },
89 },
90 .attributeCount = 3,
91 .pVertexAttributeDescriptions = (VkVertexInputAttributeDescription[]) {
92 {
93 /* VUE Header */
94 .location = 0,
95 .binding = 1,
96 .format = VK_FORMAT_R32G32B32A32_UINT,
97 .offsetInBytes = 0
98 },
99 {
100 /* Position */
101 .location = 1,
102 .binding = 0,
103 .format = VK_FORMAT_R32G32_SFLOAT,
104 .offsetInBytes = 0
105 },
106 {
107 /* Color */
108 .location = 2,
109 .binding = 1,
110 .format = VK_FORMAT_R32G32B32A32_SFLOAT,
111 .offsetInBytes = 16
112 }
113 }
114 };
115
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
124 };
125
126 VkPipelineCbStateCreateInfo cb_create_info = {
127 .sType = VK_STRUCTURE_TYPE_PIPELINE_CB_STATE_CREATE_INFO,
128 .pNext = &rs_create_info,
129 .attachmentCount = 1,
130 .pAttachments = (VkPipelineCbAttachmentState []) {
131 { .channelWriteMask = VK_CHANNEL_A_BIT |
132 VK_CHANNEL_R_BIT | VK_CHANNEL_G_BIT | VK_CHANNEL_B_BIT },
133 }
134 };
135
136 anv_pipeline_create((VkDevice) device,
137 &(VkGraphicsPipelineCreateInfo) {
138 .sType = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO,
139 .pNext = &cb_create_info,
140 .flags = 0,
141 .layout = 0
142 },
143 &(struct anv_pipeline_create_info) {
144 .use_repclear = true,
145 .disable_viewport = true,
146 .use_rectlist = true
147 },
148 &device->clear_state.pipeline);
149
150 anv_DestroyObject((VkDevice) device, VK_OBJECT_TYPE_SHADER, fs);
151
152 anv_CreateDynamicRasterState((VkDevice) device,
153 &(VkDynamicRsStateCreateInfo) {
154 .sType = VK_STRUCTURE_TYPE_DYNAMIC_RS_STATE_CREATE_INFO,
155 },
156 &device->clear_state.rs_state);
157
158 anv_CreateDynamicColorBlendState((VkDevice) device,
159 &(VkDynamicCbStateCreateInfo) {
160 .sType = VK_STRUCTURE_TYPE_DYNAMIC_CB_STATE_CREATE_INFO
161 },
162 &device->clear_state.cb_state);
163
164 }
165
166 #define NUM_VB_USED 2
167 struct anv_saved_state {
168 struct anv_bindings bindings;
169 struct anv_bindings *old_bindings;
170 struct anv_pipeline *old_pipeline;
171 VkDynamicCbState cb_state;
172 };
173
174 static void
175 anv_cmd_buffer_save(struct anv_cmd_buffer *cmd_buffer,
176 struct anv_saved_state *state)
177 {
178 state->old_bindings = cmd_buffer->bindings;
179 cmd_buffer->bindings = &state->bindings;
180 state->old_pipeline = cmd_buffer->pipeline;
181 }
182
183 static void
184 anv_cmd_buffer_restore(struct anv_cmd_buffer *cmd_buffer,
185 const struct anv_saved_state *state)
186 {
187 cmd_buffer->bindings = state->old_bindings;
188 cmd_buffer->pipeline = state->old_pipeline;
189
190 cmd_buffer->vb_dirty |= (1 << NUM_VB_USED) - 1;
191 cmd_buffer->dirty |= ANV_CMD_BUFFER_PIPELINE_DIRTY |
192 ANV_CMD_BUFFER_DESCRIPTOR_SET_DIRTY;
193 }
194
195 static void
196 anv_cmd_buffer_copy_render_targets(struct anv_cmd_buffer *cmd_buffer,
197 struct anv_saved_state *state)
198 {
199 struct anv_framebuffer *fb = cmd_buffer->framebuffer;
200 struct anv_bindings *old_bindings = state->old_bindings;
201 struct anv_bindings *bindings = cmd_buffer->bindings;
202
203 for (uint32_t i = 0; i < fb->color_attachment_count; i++) {
204 bindings->descriptors[VK_SHADER_STAGE_FRAGMENT].surfaces[i] =
205 old_bindings->descriptors[VK_SHADER_STAGE_FRAGMENT].surfaces[i];
206 }
207
208 cmd_buffer->dirty |= ANV_CMD_BUFFER_DESCRIPTOR_SET_DIRTY;
209 }
210
211 struct vue_header {
212 uint32_t Reserved;
213 uint32_t RTAIndex;
214 uint32_t ViewportIndex;
215 float PointWidth;
216 };
217
218 void
219 anv_cmd_buffer_clear(struct anv_cmd_buffer *cmd_buffer,
220 struct anv_render_pass *pass)
221 {
222 struct anv_device *device = cmd_buffer->device;
223 struct anv_framebuffer *fb = cmd_buffer->framebuffer;
224 struct anv_saved_state saved_state;
225 struct anv_state state;
226 uint32_t size;
227
228 struct instance_data {
229 struct vue_header vue_header;
230 float color[4];
231 } *instance_data;
232
233 if (pass->num_clear_layers == 0)
234 return;
235
236 const float vertex_data[] = {
237 /* Rect-list coordinates */
238 0.0, 0.0,
239 fb->width, 0.0,
240 fb->width, fb->height,
241
242 /* Align to 16 bytes */
243 0.0, 0.0,
244 };
245
246 size = sizeof(vertex_data) + pass->num_clear_layers * sizeof(instance_data[0]);
247 state = anv_state_stream_alloc(&cmd_buffer->surface_state_stream, size, 16);
248
249 memcpy(state.map, vertex_data, sizeof(vertex_data));
250 instance_data = state.map + sizeof(vertex_data);
251
252 for (uint32_t i = 0; i < pass->num_layers; i++) {
253 if (pass->layers[i].color_load_op == VK_ATTACHMENT_LOAD_OP_CLEAR) {
254 *instance_data++ = (struct instance_data) {
255 .vue_header = {
256 .RTAIndex = i,
257 .ViewportIndex = 0,
258 .PointWidth = 0.0
259 },
260 .color = {
261 pass->layers[i].clear_color.color.floatColor[0],
262 pass->layers[i].clear_color.color.floatColor[1],
263 pass->layers[i].clear_color.color.floatColor[2],
264 pass->layers[i].clear_color.color.floatColor[3],
265 }
266 };
267 }
268 }
269
270 struct anv_buffer vertex_buffer = {
271 .device = cmd_buffer->device,
272 .size = size,
273 .bo = &device->surface_state_block_pool.bo,
274 .offset = state.offset
275 };
276
277 anv_cmd_buffer_save(cmd_buffer, &saved_state);
278 anv_cmd_buffer_copy_render_targets(cmd_buffer, &saved_state);
279
280 anv_CmdBindVertexBuffers((VkCmdBuffer) cmd_buffer, 0, 2,
281 (VkBuffer[]) {
282 (VkBuffer) &vertex_buffer,
283 (VkBuffer) &vertex_buffer
284 },
285 (VkDeviceSize[]) {
286 0,
287 sizeof(vertex_data)
288 });
289
290 if ((VkPipeline) cmd_buffer->pipeline != device->clear_state.pipeline)
291 anv_CmdBindPipeline((VkCmdBuffer) cmd_buffer,
292 VK_PIPELINE_BIND_POINT_GRAPHICS, device->clear_state.pipeline);
293
294 /* We don't need anything here, only set if not already set. */
295 if (cmd_buffer->rs_state == NULL)
296 anv_CmdBindDynamicStateObject((VkCmdBuffer) cmd_buffer,
297 VK_STATE_BIND_POINT_RASTER,
298 device->clear_state.rs_state);
299
300 if (cmd_buffer->vp_state == NULL)
301 anv_CmdBindDynamicStateObject((VkCmdBuffer) cmd_buffer,
302 VK_STATE_BIND_POINT_VIEWPORT,
303 cmd_buffer->framebuffer->vp_state);
304
305 anv_CmdDraw((VkCmdBuffer) cmd_buffer, 0, 3, 0, pass->num_clear_layers);
306
307 /* Restore API state */
308 anv_cmd_buffer_restore(cmd_buffer, &saved_state);
309
310 }
311
312 static void
313 anv_device_init_meta_blit_state(struct anv_device *device)
314 {
315 VkPipelineIaStateCreateInfo ia_create_info = {
316 .sType = VK_STRUCTURE_TYPE_PIPELINE_IA_STATE_CREATE_INFO,
317 .topology = VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP,
318 .disableVertexReuse = false,
319 .primitiveRestartEnable = false,
320 .primitiveRestartIndex = 0
321 };
322
323 /* We don't use a vertex shader for clearing, but instead build and pass
324 * the VUEs directly to the rasterization backend. However, we do need
325 * to provide GLSL source for the vertex shader so that the compiler
326 * does not dead-code our inputs.
327 */
328 VkShader vs = GLSL_VK_SHADER(device, VERTEX,
329 in vec2 a_pos;
330 in vec2 a_tex_coord;
331 out vec4 v_tex_coord;
332 void main()
333 {
334 v_tex_coord = vec4(a_tex_coord, 0, 1);
335 gl_Position = vec4(a_pos, 0, 1);
336 }
337 );
338
339 VkShader fs = GLSL_VK_SHADER(device, FRAGMENT,
340 out vec4 f_color;
341 in vec4 v_tex_coord;
342 layout(set = 0, binding = 0) uniform sampler2D u_tex;
343 void main()
344 {
345 f_color = texture(u_tex, v_tex_coord.xy);
346 }
347 );
348
349 VkPipelineShaderStageCreateInfo vs_create_info = {
350 .sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO,
351 .pNext = &ia_create_info,
352 .shader = {
353 .stage = VK_SHADER_STAGE_VERTEX,
354 .shader = vs,
355 .linkConstBufferCount = 0,
356 .pLinkConstBufferInfo = NULL,
357 .pSpecializationInfo = NULL
358 }
359 };
360
361 VkPipelineShaderStageCreateInfo fs_create_info = {
362 .sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO,
363 .pNext = &vs_create_info,
364 .shader = {
365 .stage = VK_SHADER_STAGE_FRAGMENT,
366 .shader = fs,
367 .linkConstBufferCount = 0,
368 .pLinkConstBufferInfo = NULL,
369 .pSpecializationInfo = NULL
370 }
371 };
372
373 VkPipelineVertexInputCreateInfo vi_create_info = {
374 .sType = VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_CREATE_INFO,
375 .pNext = &fs_create_info,
376 .bindingCount = 2,
377 .pVertexBindingDescriptions = (VkVertexInputBindingDescription[]) {
378 {
379 .binding = 0,
380 .strideInBytes = 0,
381 .stepRate = VK_VERTEX_INPUT_STEP_RATE_VERTEX
382 },
383 {
384 .binding = 1,
385 .strideInBytes = 16,
386 .stepRate = VK_VERTEX_INPUT_STEP_RATE_VERTEX
387 },
388 },
389 .attributeCount = 3,
390 .pVertexAttributeDescriptions = (VkVertexInputAttributeDescription[]) {
391 {
392 /* VUE Header */
393 .location = 0,
394 .binding = 0,
395 .format = VK_FORMAT_R32G32B32A32_UINT,
396 .offsetInBytes = 0
397 },
398 {
399 /* Position */
400 .location = 1,
401 .binding = 1,
402 .format = VK_FORMAT_R32G32_SFLOAT,
403 .offsetInBytes = 0
404 },
405 {
406 /* Texture Coordinate */
407 .location = 2,
408 .binding = 1,
409 .format = VK_FORMAT_R32G32_SFLOAT,
410 .offsetInBytes = 8
411 }
412 }
413 };
414
415 VkDescriptorSetLayoutCreateInfo ds_layout_info = {
416 .sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO,
417 .count = 1,
418 .pBinding = (VkDescriptorSetLayoutBinding[]) {
419 {
420 .descriptorType = VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE,
421 .count = 1,
422 .stageFlags = VK_SHADER_STAGE_FRAGMENT_BIT,
423 .pImmutableSamplers = NULL
424 },
425 }
426 };
427 anv_CreateDescriptorSetLayout((VkDevice) device, &ds_layout_info,
428 &device->blit_state.ds_layout);
429
430 VkPipelineLayoutCreateInfo pipeline_layout_info = {
431 .sType = VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO,
432 .descriptorSetCount = 1,
433 .pSetLayouts = &device->blit_state.ds_layout,
434 };
435
436 VkPipelineLayout pipeline_layout;
437 anv_CreatePipelineLayout((VkDevice) device, &pipeline_layout_info,
438 &pipeline_layout);
439
440 VkPipelineRsStateCreateInfo rs_create_info = {
441 .sType = VK_STRUCTURE_TYPE_PIPELINE_RS_STATE_CREATE_INFO,
442 .pNext = &vi_create_info,
443 .depthClipEnable = true,
444 .rasterizerDiscardEnable = false,
445 .fillMode = VK_FILL_MODE_SOLID,
446 .cullMode = VK_CULL_MODE_NONE,
447 .frontFace = VK_FRONT_FACE_CCW
448 };
449
450 VkPipelineCbStateCreateInfo cb_create_info = {
451 .sType = VK_STRUCTURE_TYPE_PIPELINE_CB_STATE_CREATE_INFO,
452 .pNext = &rs_create_info,
453 .attachmentCount = 1,
454 .pAttachments = (VkPipelineCbAttachmentState []) {
455 { .channelWriteMask = VK_CHANNEL_A_BIT |
456 VK_CHANNEL_R_BIT | VK_CHANNEL_G_BIT | VK_CHANNEL_B_BIT },
457 }
458 };
459
460 VkGraphicsPipelineCreateInfo pipeline_info = {
461 .sType = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO,
462 .pNext = &cb_create_info,
463 .flags = 0,
464 .layout = pipeline_layout,
465 };
466
467 anv_pipeline_create((VkDevice) device, &pipeline_info,
468 &(struct anv_pipeline_create_info) {
469 .use_repclear = false,
470 .disable_viewport = true,
471 .disable_scissor = true,
472 .disable_vs = true,
473 .use_rectlist = true
474 },
475 &device->blit_state.pipeline);
476
477 anv_DestroyObject((VkDevice) device, VK_OBJECT_TYPE_SHADER, vs);
478 anv_DestroyObject((VkDevice) device, VK_OBJECT_TYPE_SHADER, fs);
479
480 anv_CreateDynamicRasterState((VkDevice) device,
481 &(VkDynamicRsStateCreateInfo) {
482 .sType = VK_STRUCTURE_TYPE_DYNAMIC_RS_STATE_CREATE_INFO,
483 },
484 &device->blit_state.rs_state);
485
486 anv_CreateDynamicColorBlendState((VkDevice) device,
487 &(VkDynamicCbStateCreateInfo) {
488 .sType = VK_STRUCTURE_TYPE_DYNAMIC_CB_STATE_CREATE_INFO
489 },
490 &device->blit_state.cb_state);
491 }
492
493 static void
494 meta_prepare_blit(struct anv_cmd_buffer *cmd_buffer,
495 struct anv_saved_state *saved_state)
496 {
497 struct anv_device *device = cmd_buffer->device;
498
499 anv_cmd_buffer_save(cmd_buffer, saved_state);
500
501 if ((VkPipeline) cmd_buffer->pipeline != device->blit_state.pipeline)
502 anv_CmdBindPipeline((VkCmdBuffer) cmd_buffer,
503 VK_PIPELINE_BIND_POINT_GRAPHICS,
504 device->blit_state.pipeline);
505
506 /* We don't need anything here, only set if not already set. */
507 if (cmd_buffer->rs_state == NULL)
508 anv_CmdBindDynamicStateObject((VkCmdBuffer) cmd_buffer,
509 VK_STATE_BIND_POINT_RASTER,
510 device->blit_state.rs_state);
511
512 saved_state->cb_state = (VkDynamicCbState) cmd_buffer->cb_state;
513 anv_CmdBindDynamicStateObject((VkCmdBuffer) cmd_buffer,
514 VK_STATE_BIND_POINT_COLOR_BLEND,
515 device->blit_state.cb_state);
516 }
517
518 struct blit_region {
519 VkOffset3D src_offset;
520 VkExtent3D src_extent;
521 VkOffset3D dest_offset;
522 VkExtent3D dest_extent;
523 };
524
525 static void
526 meta_emit_blit(struct anv_cmd_buffer *cmd_buffer,
527 struct anv_surface_view *src,
528 VkOffset3D src_offset,
529 VkExtent3D src_extent,
530 struct anv_surface_view *dest,
531 VkOffset3D dest_offset,
532 VkExtent3D dest_extent)
533 {
534 struct anv_device *device = cmd_buffer->device;
535
536 struct blit_vb_data {
537 float pos[2];
538 float tex_coord[2];
539 } *vb_data;
540
541 unsigned vb_size = sizeof(struct vue_header) + 3 * sizeof(*vb_data);
542
543 struct anv_state vb_state =
544 anv_state_stream_alloc(&cmd_buffer->surface_state_stream, vb_size, 16);
545 memset(vb_state.map, 0, sizeof(struct vue_header));
546 vb_data = vb_state.map + sizeof(struct vue_header);
547
548 vb_data[0] = (struct blit_vb_data) {
549 .pos = {
550 dest_offset.x + dest_extent.width,
551 dest_offset.y + dest_extent.height,
552 },
553 .tex_coord = {
554 (float)(src_offset.x + src_extent.width) / (float)src->extent.width,
555 (float)(src_offset.y + src_extent.height) / (float)src->extent.height,
556 },
557 };
558
559 vb_data[1] = (struct blit_vb_data) {
560 .pos = {
561 dest_offset.x,
562 dest_offset.y + dest_extent.height,
563 },
564 .tex_coord = {
565 (float)src_offset.x / (float)src->extent.width,
566 (float)(src_offset.y + src_extent.height) / (float)src->extent.height,
567 },
568 };
569
570 vb_data[2] = (struct blit_vb_data) {
571 .pos = {
572 dest_offset.x,
573 dest_offset.y,
574 },
575 .tex_coord = {
576 (float)src_offset.x / (float)src->extent.width,
577 (float)src_offset.y / (float)src->extent.height,
578 },
579 };
580
581 struct anv_buffer vertex_buffer = {
582 .device = device,
583 .size = vb_size,
584 .bo = &device->surface_state_block_pool.bo,
585 .offset = vb_state.offset,
586 };
587
588 anv_CmdBindVertexBuffers((VkCmdBuffer) cmd_buffer, 0, 2,
589 (VkBuffer[]) {
590 (VkBuffer) &vertex_buffer,
591 (VkBuffer) &vertex_buffer
592 },
593 (VkDeviceSize[]) {
594 0,
595 sizeof(struct vue_header),
596 });
597
598 uint32_t count;
599 VkDescriptorSet set;
600 anv_AllocDescriptorSets((VkDevice) device, 0 /* pool */,
601 VK_DESCRIPTOR_SET_USAGE_ONE_SHOT,
602 1, &device->blit_state.ds_layout, &set, &count);
603 anv_UpdateDescriptors((VkDevice) device, set, 1,
604 (const void * []) {
605 &(VkUpdateImages) {
606 .sType = VK_STRUCTURE_TYPE_UPDATE_IMAGES,
607 .descriptorType = VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE,
608 .binding = 0,
609 .count = 1,
610 .pImageViews = (VkImageViewAttachInfo[]) {
611 {
612 .sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_ATTACH_INFO,
613 .view = (VkImageView) src,
614 .layout = VK_IMAGE_LAYOUT_GENERAL,
615 }
616 }
617 }
618 });
619
620 struct anv_framebuffer *fb;
621 anv_CreateFramebuffer((VkDevice) device,
622 &(VkFramebufferCreateInfo) {
623 .sType = VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO,
624 .colorAttachmentCount = 1,
625 .pColorAttachments = (VkColorAttachmentBindInfo[]) {
626 {
627 .view = (VkColorAttachmentView) dest,
628 .layout = VK_IMAGE_LAYOUT_GENERAL
629 }
630 },
631 .pDepthStencilAttachment = NULL,
632 .sampleCount = 1,
633 .width = dest->extent.width,
634 .height = dest->extent.height,
635 .layers = 1
636 }, (VkFramebuffer *)&fb);
637
638
639 VkRenderPass pass;
640 anv_CreateRenderPass((VkDevice )device,
641 &(VkRenderPassCreateInfo) {
642 .sType = VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO,
643 .renderArea = { { 0, 0 }, { dest->extent.width, dest->extent.height } },
644 .colorAttachmentCount = 1,
645 .extent = { 0, },
646 .sampleCount = 1,
647 .layers = 1,
648 .pColorFormats = (VkFormat[]) { dest->format },
649 .pColorLayouts = (VkImageLayout[]) { VK_IMAGE_LAYOUT_GENERAL },
650 .pColorLoadOps = (VkAttachmentLoadOp[]) { VK_ATTACHMENT_LOAD_OP_LOAD },
651 .pColorStoreOps = (VkAttachmentStoreOp[]) { VK_ATTACHMENT_STORE_OP_STORE },
652 .pColorLoadClearValues = (VkClearColor[]) {
653 { .color = { .floatColor = { 1.0, 0.0, 0.0, 1.0 } }, .useRawValue = false }
654 },
655 .depthStencilFormat = VK_FORMAT_UNDEFINED,
656 }, &pass);
657
658 anv_CmdBeginRenderPass((VkCmdBuffer) cmd_buffer,
659 &(VkRenderPassBegin) {
660 .renderPass = pass,
661 .framebuffer = (VkFramebuffer) fb,
662 });
663
664 anv_CmdBindDynamicStateObject((VkCmdBuffer) cmd_buffer,
665 VK_STATE_BIND_POINT_VIEWPORT, fb->vp_state);
666
667 anv_CmdBindDescriptorSets((VkCmdBuffer) cmd_buffer,
668 VK_PIPELINE_BIND_POINT_GRAPHICS, 0, 1,
669 &set, 0, NULL);
670
671 anv_CmdDraw((VkCmdBuffer) cmd_buffer, 0, 3, 0, 1);
672
673 anv_CmdEndRenderPass((VkCmdBuffer) cmd_buffer, pass);
674 }
675
676 static void
677 meta_finish_blit(struct anv_cmd_buffer *cmd_buffer,
678 const struct anv_saved_state *saved_state)
679 {
680 anv_cmd_buffer_restore(cmd_buffer, saved_state);
681 anv_CmdBindDynamicStateObject((VkCmdBuffer) cmd_buffer,
682 VK_STATE_BIND_POINT_COLOR_BLEND,
683 saved_state->cb_state);
684 }
685
686 static VkFormat
687 vk_format_for_cpp(int cpp)
688 {
689 switch (cpp) {
690 case 1: return VK_FORMAT_R8_UINT;
691 case 2: return VK_FORMAT_R8G8_UINT;
692 case 3: return VK_FORMAT_R8G8B8_UINT;
693 case 4: return VK_FORMAT_R8G8B8A8_UINT;
694 case 6: return VK_FORMAT_R16G16B16_UINT;
695 case 8: return VK_FORMAT_R16G16B16A16_UINT;
696 case 12: return VK_FORMAT_R32G32B32_UINT;
697 case 16: return VK_FORMAT_R32G32B32A32_UINT;
698 default:
699 unreachable("Invalid format cpp");
700 }
701 }
702
703 static void
704 do_buffer_copy(struct anv_cmd_buffer *cmd_buffer,
705 struct anv_bo *src, uint64_t src_offset,
706 struct anv_bo *dest, uint64_t dest_offset,
707 int width, int height, VkFormat copy_format)
708 {
709 VkDevice vk_device = (VkDevice)cmd_buffer->device;
710
711 VkImageCreateInfo image_info = {
712 .sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO,
713 .imageType = VK_IMAGE_TYPE_2D,
714 .format = copy_format,
715 .extent = {
716 .width = width,
717 .height = height,
718 .depth = 1,
719 },
720 .mipLevels = 1,
721 .arraySize = 1,
722 .samples = 1,
723 .tiling = VK_IMAGE_TILING_LINEAR,
724 .usage = VK_IMAGE_USAGE_SAMPLED_BIT,
725 .flags = 0,
726 };
727
728 struct anv_image *src_image, *dest_image;
729 anv_CreateImage(vk_device, &image_info, (VkImage *)&src_image);
730 anv_CreateImage(vk_device, &image_info, (VkImage *)&dest_image);
731
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.
734 */
735 src_image->bo = src;
736 src_image->offset = src_offset;
737 dest_image->bo = dest;
738 dest_image->offset = dest_offset;
739
740 struct anv_surface_view src_view;
741 anv_image_view_init(&src_view, cmd_buffer->device,
742 &(VkImageViewCreateInfo) {
743 .sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,
744 .image = (VkImage)src_image,
745 .viewType = VK_IMAGE_VIEW_TYPE_2D,
746 .format = copy_format,
747 .channels = {
748 VK_CHANNEL_SWIZZLE_R,
749 VK_CHANNEL_SWIZZLE_G,
750 VK_CHANNEL_SWIZZLE_B,
751 VK_CHANNEL_SWIZZLE_A
752 },
753 .subresourceRange = {
754 .aspect = VK_IMAGE_ASPECT_COLOR,
755 .baseMipLevel = 0,
756 .mipLevels = 1,
757 .baseArraySlice = 0,
758 .arraySize = 1
759 },
760 .minLod = 0
761 },
762 cmd_buffer);
763
764 struct anv_surface_view dest_view;
765 anv_color_attachment_view_init(&dest_view, cmd_buffer->device,
766 &(VkColorAttachmentViewCreateInfo) {
767 .sType = VK_STRUCTURE_TYPE_COLOR_ATTACHMENT_VIEW_CREATE_INFO,
768 .image = (VkImage)dest_image,
769 .format = copy_format,
770 .mipLevel = 0,
771 .baseArraySlice = 0,
772 .arraySize = 1,
773 },
774 cmd_buffer);
775
776 meta_emit_blit(cmd_buffer,
777 &src_view,
778 (VkOffset3D) { 0, 0, 0 },
779 (VkExtent3D) { width, height, 1 },
780 &dest_view,
781 (VkOffset3D) { 0, 0, 0 },
782 (VkExtent3D) { width, height, 1 });
783 }
784
785 void anv_CmdCopyBuffer(
786 VkCmdBuffer cmdBuffer,
787 VkBuffer srcBuffer,
788 VkBuffer destBuffer,
789 uint32_t regionCount,
790 const VkBufferCopy* pRegions)
791 {
792 struct anv_cmd_buffer *cmd_buffer = (struct anv_cmd_buffer *)cmdBuffer;
793 struct anv_buffer *src_buffer = (struct anv_buffer *)srcBuffer;
794 struct anv_buffer *dest_buffer = (struct anv_buffer *)destBuffer;
795 struct anv_saved_state saved_state;
796
797 meta_prepare_blit(cmd_buffer, &saved_state);
798
799 for (unsigned r = 0; r < regionCount; r++) {
800 uint64_t src_offset = src_buffer->offset + pRegions[r].srcOffset;
801 uint64_t dest_offset = dest_buffer->offset + pRegions[r].destOffset;
802 uint64_t copy_size = pRegions[r].copySize;
803
804 /* First, we compute the biggest format that can be used with the
805 * given offsets and size.
806 */
807 int cpp = 16;
808
809 int fs = ffs(src_offset) - 1;
810 if (fs != -1)
811 cpp = MIN2(cpp, 1 << fs);
812 assert(src_offset % cpp == 0);
813
814 fs = ffs(dest_offset) - 1;
815 if (fs != -1)
816 cpp = MIN2(cpp, 1 << fs);
817 assert(dest_offset % cpp == 0);
818
819 fs = ffs(pRegions[r].copySize) - 1;
820 if (fs != -1)
821 cpp = MIN2(cpp, 1 << fs);
822 assert(pRegions[r].copySize % cpp == 0);
823
824 VkFormat copy_format = vk_format_for_cpp(cpp);
825
826 /* This is maximum possible width/height our HW can handle */
827 uint64_t max_surface_dim = 1 << 14;
828
829 /* First, we make a bunch of max-sized copies */
830 uint64_t max_copy_size = max_surface_dim * max_surface_dim * cpp;
831 while (copy_size > max_copy_size) {
832 do_buffer_copy(cmd_buffer, src_buffer->bo, src_offset,
833 dest_buffer->bo, dest_offset,
834 max_surface_dim, max_surface_dim, copy_format);
835 copy_size -= max_copy_size;
836 src_offset += max_copy_size;
837 dest_offset += max_copy_size;
838 }
839
840 uint64_t height = copy_size / (max_surface_dim * cpp);
841 assert(height < max_surface_dim);
842 if (height != 0) {
843 uint64_t rect_copy_size = height * max_surface_dim * cpp;
844 do_buffer_copy(cmd_buffer, src_buffer->bo, src_offset,
845 dest_buffer->bo, dest_offset,
846 max_surface_dim, height, copy_format);
847 copy_size -= rect_copy_size;
848 src_offset += rect_copy_size;
849 dest_offset += rect_copy_size;
850 }
851
852 if (copy_size != 0) {
853 do_buffer_copy(cmd_buffer, src_buffer->bo, src_offset,
854 dest_buffer->bo, dest_offset,
855 copy_size / cpp, 1, copy_format);
856 }
857 }
858
859 meta_finish_blit(cmd_buffer, &saved_state);
860 }
861
862 void anv_CmdCopyImage(
863 VkCmdBuffer cmdBuffer,
864 VkImage srcImage,
865 VkImageLayout srcImageLayout,
866 VkImage destImage,
867 VkImageLayout destImageLayout,
868 uint32_t regionCount,
869 const VkImageCopy* pRegions)
870 {
871 struct anv_cmd_buffer *cmd_buffer = (struct anv_cmd_buffer *)cmdBuffer;
872 struct anv_image *src_image = (struct anv_image *)srcImage;
873 struct anv_saved_state saved_state;
874
875 meta_prepare_blit(cmd_buffer, &saved_state);
876
877 for (unsigned r = 0; r < regionCount; r++) {
878 struct anv_surface_view src_view;
879 anv_image_view_init(&src_view, cmd_buffer->device,
880 &(VkImageViewCreateInfo) {
881 .sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,
882 .image = srcImage,
883 .viewType = VK_IMAGE_VIEW_TYPE_2D,
884 .format = src_image->format,
885 .channels = {
886 VK_CHANNEL_SWIZZLE_R,
887 VK_CHANNEL_SWIZZLE_G,
888 VK_CHANNEL_SWIZZLE_B,
889 VK_CHANNEL_SWIZZLE_A
890 },
891 .subresourceRange = {
892 .aspect = pRegions[r].srcSubresource.aspect,
893 .baseMipLevel = pRegions[r].srcSubresource.mipLevel,
894 .mipLevels = 1,
895 .baseArraySlice = pRegions[r].srcSubresource.arraySlice,
896 .arraySize = 1
897 },
898 .minLod = 0
899 },
900 cmd_buffer);
901
902 struct anv_surface_view dest_view;
903 anv_color_attachment_view_init(&dest_view, cmd_buffer->device,
904 &(VkColorAttachmentViewCreateInfo) {
905 .sType = VK_STRUCTURE_TYPE_COLOR_ATTACHMENT_VIEW_CREATE_INFO,
906 .image = destImage,
907 .format = src_image->format,
908 .mipLevel = pRegions[r].destSubresource.mipLevel,
909 .baseArraySlice = pRegions[r].destSubresource.arraySlice,
910 .arraySize = 1,
911 },
912 cmd_buffer);
913
914 meta_emit_blit(cmd_buffer,
915 &src_view,
916 pRegions[r].srcOffset,
917 pRegions[r].extent,
918 &dest_view,
919 pRegions[r].destOffset,
920 pRegions[r].extent);
921 }
922
923 meta_finish_blit(cmd_buffer, &saved_state);
924 }
925
926 void anv_CmdBlitImage(
927 VkCmdBuffer cmdBuffer,
928 VkImage srcImage,
929 VkImageLayout srcImageLayout,
930 VkImage destImage,
931 VkImageLayout destImageLayout,
932 uint32_t regionCount,
933 const VkImageBlit* pRegions)
934 {
935 struct anv_cmd_buffer *cmd_buffer = (struct anv_cmd_buffer *)cmdBuffer;
936 struct anv_image *src_image = (struct anv_image *)srcImage;
937 struct anv_image *dest_image = (struct anv_image *)destImage;
938 struct anv_saved_state saved_state;
939
940 meta_prepare_blit(cmd_buffer, &saved_state);
941
942 for (unsigned r = 0; r < regionCount; r++) {
943 struct anv_surface_view src_view;
944 anv_image_view_init(&src_view, cmd_buffer->device,
945 &(VkImageViewCreateInfo) {
946 .sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,
947 .image = srcImage,
948 .viewType = VK_IMAGE_VIEW_TYPE_2D,
949 .format = src_image->format,
950 .channels = {
951 VK_CHANNEL_SWIZZLE_R,
952 VK_CHANNEL_SWIZZLE_G,
953 VK_CHANNEL_SWIZZLE_B,
954 VK_CHANNEL_SWIZZLE_A
955 },
956 .subresourceRange = {
957 .aspect = pRegions[r].srcSubresource.aspect,
958 .baseMipLevel = pRegions[r].srcSubresource.mipLevel,
959 .mipLevels = 1,
960 .baseArraySlice = pRegions[r].srcSubresource.arraySlice,
961 .arraySize = 1
962 },
963 .minLod = 0
964 },
965 cmd_buffer);
966
967 struct anv_surface_view dest_view;
968 anv_color_attachment_view_init(&dest_view, cmd_buffer->device,
969 &(VkColorAttachmentViewCreateInfo) {
970 .sType = VK_STRUCTURE_TYPE_COLOR_ATTACHMENT_VIEW_CREATE_INFO,
971 .image = destImage,
972 .format = dest_image->format,
973 .mipLevel = pRegions[r].destSubresource.mipLevel,
974 .baseArraySlice = pRegions[r].destSubresource.arraySlice,
975 .arraySize = 1,
976 },
977 cmd_buffer);
978
979 meta_emit_blit(cmd_buffer,
980 &src_view,
981 pRegions[r].srcOffset,
982 pRegions[r].srcExtent,
983 &dest_view,
984 pRegions[r].destOffset,
985 pRegions[r].destExtent);
986 }
987
988 meta_finish_blit(cmd_buffer, &saved_state);
989 }
990
991 void anv_CmdCopyBufferToImage(
992 VkCmdBuffer cmdBuffer,
993 VkBuffer srcBuffer,
994 VkImage destImage,
995 VkImageLayout destImageLayout,
996 uint32_t regionCount,
997 const VkBufferImageCopy* pRegions)
998 {
999 struct anv_cmd_buffer *cmd_buffer = (struct anv_cmd_buffer *)cmdBuffer;
1000 VkDevice vk_device = (VkDevice) cmd_buffer->device;
1001 struct anv_buffer *src_buffer = (struct anv_buffer *)srcBuffer;
1002 struct anv_image *dest_image = (struct anv_image *)destImage;
1003 struct anv_saved_state saved_state;
1004
1005 meta_prepare_blit(cmd_buffer, &saved_state);
1006
1007 for (unsigned r = 0; r < regionCount; r++) {
1008 struct anv_image *src_image;
1009 anv_CreateImage(vk_device,
1010 &(VkImageCreateInfo) {
1011 .sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO,
1012 .imageType = VK_IMAGE_TYPE_2D,
1013 .format = dest_image->format,
1014 .extent = {
1015 .width = pRegions[r].imageExtent.width,
1016 .height = pRegions[r].imageExtent.height,
1017 .depth = 1,
1018 },
1019 .mipLevels = 1,
1020 .arraySize = 1,
1021 .samples = 1,
1022 .tiling = VK_IMAGE_TILING_LINEAR,
1023 .usage = VK_IMAGE_USAGE_SAMPLED_BIT,
1024 .flags = 0,
1025 }, (VkImage *)&src_image);
1026
1027 /* We could use a vk call to bind memory, but that would require
1028 * creating a dummy memory object etc. so there's really no point.
1029 */
1030 src_image->bo = src_buffer->bo;
1031 src_image->offset = src_buffer->offset + pRegions[r].bufferOffset;
1032
1033 struct anv_surface_view src_view;
1034 anv_image_view_init(&src_view, cmd_buffer->device,
1035 &(VkImageViewCreateInfo) {
1036 .sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,
1037 .image = (VkImage)src_image,
1038 .viewType = VK_IMAGE_VIEW_TYPE_2D,
1039 .format = dest_image->format,
1040 .channels = {
1041 VK_CHANNEL_SWIZZLE_R,
1042 VK_CHANNEL_SWIZZLE_G,
1043 VK_CHANNEL_SWIZZLE_B,
1044 VK_CHANNEL_SWIZZLE_A
1045 },
1046 .subresourceRange = {
1047 .aspect = pRegions[r].imageSubresource.aspect,
1048 .baseMipLevel = 0,
1049 .mipLevels = 1,
1050 .baseArraySlice = 0,
1051 .arraySize = 1
1052 },
1053 .minLod = 0
1054 },
1055 cmd_buffer);
1056
1057 struct anv_surface_view dest_view;
1058 anv_color_attachment_view_init(&dest_view, cmd_buffer->device,
1059 &(VkColorAttachmentViewCreateInfo) {
1060 .sType = VK_STRUCTURE_TYPE_COLOR_ATTACHMENT_VIEW_CREATE_INFO,
1061 .image = (VkImage)dest_image,
1062 .format = dest_image->format,
1063 .mipLevel = pRegions[r].imageSubresource.mipLevel,
1064 .baseArraySlice = pRegions[r].imageSubresource.arraySlice,
1065 .arraySize = 1,
1066 },
1067 cmd_buffer);
1068
1069 meta_emit_blit(cmd_buffer,
1070 &src_view,
1071 (VkOffset3D) { 0, 0, 0 },
1072 pRegions[r].imageExtent,
1073 &dest_view,
1074 pRegions[r].imageOffset,
1075 pRegions[r].imageExtent);
1076 }
1077
1078 meta_finish_blit(cmd_buffer, &saved_state);
1079 }
1080
1081 void anv_CmdCopyImageToBuffer(
1082 VkCmdBuffer cmdBuffer,
1083 VkImage srcImage,
1084 VkImageLayout srcImageLayout,
1085 VkBuffer destBuffer,
1086 uint32_t regionCount,
1087 const VkBufferImageCopy* pRegions)
1088 {
1089 struct anv_cmd_buffer *cmd_buffer = (struct anv_cmd_buffer *)cmdBuffer;
1090 VkDevice vk_device = (VkDevice) cmd_buffer->device;
1091 struct anv_image *src_image = (struct anv_image *)srcImage;
1092 struct anv_buffer *dest_buffer = (struct anv_buffer *)destBuffer;
1093 struct anv_saved_state saved_state;
1094
1095 meta_prepare_blit(cmd_buffer, &saved_state);
1096
1097 for (unsigned r = 0; r < regionCount; r++) {
1098 struct anv_surface_view src_view;
1099 anv_image_view_init(&src_view, cmd_buffer->device,
1100 &(VkImageViewCreateInfo) {
1101 .sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,
1102 .image = srcImage,
1103 .viewType = VK_IMAGE_VIEW_TYPE_2D,
1104 .format = src_image->format,
1105 .channels = {
1106 VK_CHANNEL_SWIZZLE_R,
1107 VK_CHANNEL_SWIZZLE_G,
1108 VK_CHANNEL_SWIZZLE_B,
1109 VK_CHANNEL_SWIZZLE_A
1110 },
1111 .subresourceRange = {
1112 .aspect = pRegions[r].imageSubresource.aspect,
1113 .baseMipLevel = pRegions[r].imageSubresource.mipLevel,
1114 .mipLevels = 1,
1115 .baseArraySlice = pRegions[r].imageSubresource.arraySlice,
1116 .arraySize = 1
1117 },
1118 .minLod = 0
1119 },
1120 cmd_buffer);
1121
1122 struct anv_image *dest_image;
1123 anv_CreateImage(vk_device,
1124 &(VkImageCreateInfo) {
1125 .sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO,
1126 .imageType = VK_IMAGE_TYPE_2D,
1127 .format = src_image->format,
1128 .extent = {
1129 .width = pRegions[r].imageExtent.width,
1130 .height = pRegions[r].imageExtent.height,
1131 .depth = 1,
1132 },
1133 .mipLevels = 1,
1134 .arraySize = 1,
1135 .samples = 1,
1136 .tiling = VK_IMAGE_TILING_LINEAR,
1137 .usage = VK_IMAGE_USAGE_SAMPLED_BIT,
1138 .flags = 0,
1139 }, (VkImage *)&dest_image);
1140
1141 /* We could use a vk call to bind memory, but that would require
1142 * creating a dummy memory object etc. so there's really no point.
1143 */
1144 dest_image->bo = dest_buffer->bo;
1145 dest_image->offset = dest_buffer->offset + pRegions[r].bufferOffset;
1146
1147 struct anv_surface_view dest_view;
1148 anv_color_attachment_view_init(&dest_view, cmd_buffer->device,
1149 &(VkColorAttachmentViewCreateInfo) {
1150 .sType = VK_STRUCTURE_TYPE_COLOR_ATTACHMENT_VIEW_CREATE_INFO,
1151 .image = (VkImage)dest_image,
1152 .format = src_image->format,
1153 .mipLevel = 0,
1154 .baseArraySlice = 0,
1155 .arraySize = 1,
1156 },
1157 cmd_buffer);
1158
1159 meta_emit_blit(cmd_buffer,
1160 &src_view,
1161 pRegions[r].imageOffset,
1162 pRegions[r].imageExtent,
1163 &dest_view,
1164 (VkOffset3D) { 0, 0, 0 },
1165 pRegions[r].imageExtent);
1166 }
1167
1168 meta_finish_blit(cmd_buffer, &saved_state);
1169 }
1170
1171 void anv_CmdCloneImageData(
1172 VkCmdBuffer cmdBuffer,
1173 VkImage srcImage,
1174 VkImageLayout srcImageLayout,
1175 VkImage destImage,
1176 VkImageLayout destImageLayout)
1177 {
1178 stub();
1179 }
1180
1181 void anv_CmdUpdateBuffer(
1182 VkCmdBuffer cmdBuffer,
1183 VkBuffer destBuffer,
1184 VkDeviceSize destOffset,
1185 VkDeviceSize dataSize,
1186 const uint32_t* pData)
1187 {
1188 stub();
1189 }
1190
1191 void anv_CmdFillBuffer(
1192 VkCmdBuffer cmdBuffer,
1193 VkBuffer destBuffer,
1194 VkDeviceSize destOffset,
1195 VkDeviceSize fillSize,
1196 uint32_t data)
1197 {
1198 stub();
1199 }
1200
1201 void anv_CmdClearColorImage(
1202 VkCmdBuffer cmdBuffer,
1203 VkImage image,
1204 VkImageLayout imageLayout,
1205 const VkClearColor* color,
1206 uint32_t rangeCount,
1207 const VkImageSubresourceRange* pRanges)
1208 {
1209 stub();
1210 }
1211
1212 void anv_CmdClearDepthStencil(
1213 VkCmdBuffer cmdBuffer,
1214 VkImage image,
1215 VkImageLayout imageLayout,
1216 float depth,
1217 uint32_t stencil,
1218 uint32_t rangeCount,
1219 const VkImageSubresourceRange* pRanges)
1220 {
1221 stub();
1222 }
1223
1224 void anv_CmdResolveImage(
1225 VkCmdBuffer cmdBuffer,
1226 VkImage srcImage,
1227 VkImageLayout srcImageLayout,
1228 VkImage destImage,
1229 VkImageLayout destImageLayout,
1230 uint32_t regionCount,
1231 const VkImageResolve* pRegions)
1232 {
1233 stub();
1234 }
1235
1236 void
1237 anv_device_init_meta(struct anv_device *device)
1238 {
1239 anv_device_init_meta_clear_state(device);
1240 anv_device_init_meta_blit_state(device);
1241 }