ReactOS 0.4.17-dev-923-g4c9a150
context_vk.c
Go to the documentation of this file.
1/*
2 * Copyright 2002-2004 Jason Edmeades
3 * Copyright 2002-2004 Raphael Junqueira
4 * Copyright 2004 Christian Costa
5 * Copyright 2005 Oliver Stieber
6 * Copyright 2006, 2008 Henri Verbeet
7 * Copyright 2007-2011, 2013 Stefan Dösinger for CodeWeavers
8 * Copyright 2009-2020 Henri Verbeet for CodeWeavers
9 *
10 * This library is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Lesser General Public
12 * License as published by the Free Software Foundation; either
13 * version 2.1 of the License, or (at your option) any later version.
14 *
15 * This library is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public
21 * License along with this library; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
23 */
24
25#include "wined3d_private.h"
26#include "wined3d_vk.h"
27
29
31{
32 switch (op)
33 {
37 return VK_COMPARE_OP_LESS;
50 default:
51 if (!op)
52 WARN("Unhandled compare operation %#x.\n", op);
53 else
54 FIXME("Unhandled compare operation %#x.\n", op);
56 }
57}
58
60{
61 switch (shader_type)
62 {
75 default:
76 ERR("Unhandled shader type %s.\n", debug_shader_type(shader_type));
77 return 0;
78 }
79}
80
82 const struct wined3d_format *dst_format, bool alpha)
83{
84 switch (blend)
85 {
99 if (dst_format->alpha_size)
101 return VK_BLEND_FACTOR_ONE;
103 if (dst_format->alpha_size)
113 if (alpha)
117 if (alpha)
128 default:
129 FIXME("Unhandled blend %#x.\n", blend);
131 }
132}
133
135{
136 switch (op)
137 {
139 return VK_BLEND_OP_ADD;
145 return VK_BLEND_OP_MIN;
147 return VK_BLEND_OP_MAX;
148 default:
149 FIXME("Unhandled blend op %#x.\n", op);
150 return VK_BLEND_OP_ADD;
151 }
152}
153
155{
156 VkColorComponentFlags vk_mask = 0;
157
158 if (wined3d_mask & WINED3DCOLORWRITEENABLE_RED)
159 vk_mask |= VK_COLOR_COMPONENT_R_BIT;
160 if (wined3d_mask & WINED3DCOLORWRITEENABLE_GREEN)
161 vk_mask |= VK_COLOR_COMPONENT_G_BIT;
162 if (wined3d_mask & WINED3DCOLORWRITEENABLE_BLUE)
163 vk_mask |= VK_COLOR_COMPONENT_B_BIT;
164 if (wined3d_mask & WINED3DCOLORWRITEENABLE_ALPHA)
165 vk_mask |= VK_COLOR_COMPONENT_A_BIT;
166
167 return vk_mask;
168}
169
171{
172 switch (mode)
173 {
175 return VK_CULL_MODE_NONE;
180 default:
181 FIXME("Unhandled cull mode %#x.\n", mode);
182 return VK_CULL_MODE_NONE;
183 }
184}
185
187{
188 switch (t)
189 {
210 case WINED3D_PT_PATCH:
212 default:
213 FIXME("Unhandled primitive type %s.\n", debug_d3dprimitivetype(t));
215 return ~0u;
216 }
217}
218
220{
221 switch (t)
222 {
225
231
238
239 case WINED3D_PT_PATCH:
241
242 default:
243 FIXME("Unhandled primitive type %s.\n", debug_d3dprimitivetype(t));
245 return ~0u;
246 }
247}
248
250{
251 switch (op)
252 {
254 return VK_STENCIL_OP_KEEP;
256 return VK_STENCIL_OP_ZERO;
269 default:
270 if (!op)
271 WARN("Unhandled stencil operation %#x.\n", op);
272 else
273 FIXME("Unhandled stencil operation %#x.\n", op);
274 return VK_STENCIL_OP_KEEP;
275 }
276}
277
279{
280 uint32_t i;
281
282 for (i = 0; i < ARRAY_SIZE(state->streams); ++i)
283 {
284 if (!state->streams[i].buffer)
285 {
286 *index = i;
287 return true;
288 }
289 }
290
291 return false;
292}
293
295{
297}
298
300{
302}
303
305 struct wined3d_context_vk *context_vk)
306{
307 struct wined3d_device_vk *device_vk = wined3d_device_vk(context_vk->c.device);
308 const struct wined3d_vk_info *vk_info = context_vk->vk_info;
309 void *map_ptr;
310 VkResult vr;
311
312 TRACE("chunk %p, memory 0x%s, map_ptr %p.\n", chunk_vk,
313 wine_dbgstr_longlong(chunk_vk->vk_memory), chunk_vk->c.map_ptr);
314
316
317 if (!chunk_vk->c.map_ptr)
318 {
319 if ((vr = VK_CALL(vkMapMemory(device_vk->vk_device,
320 chunk_vk->vk_memory, 0, VK_WHOLE_SIZE, 0, &chunk_vk->c.map_ptr))) < 0)
321 {
322 ERR("Failed to map chunk memory, vr %s.\n", wined3d_debug_vkresult(vr));
324 return NULL;
325 }
326
328 }
329
330 ++chunk_vk->c.map_count;
331 map_ptr = chunk_vk->c.map_ptr;
332
334
335 return map_ptr;
336}
337
339 struct wined3d_context_vk *context_vk)
340{
341 struct wined3d_device_vk *device_vk = wined3d_device_vk(context_vk->c.device);
342 const struct wined3d_vk_info *vk_info = context_vk->vk_info;
343
344 TRACE("chunk_vk %p, context_vk %p.\n", chunk_vk, context_vk);
345
347
348 if (--chunk_vk->c.map_count)
349 {
351 return;
352 }
353
354 VK_CALL(vkUnmapMemory(device_vk->vk_device, chunk_vk->vk_memory));
355 chunk_vk->c.map_ptr = NULL;
356
358
360}
361
363 unsigned int pool, size_t size)
364{
365 struct wined3d_device_vk *device_vk = wined3d_device_vk(context_vk->c.device);
366 const struct wined3d_vk_info *vk_info = context_vk->vk_info;
367 VkMemoryAllocateInfo allocate_info;
368 VkDeviceMemory vk_memory;
369 VkResult vr;
370
372 allocate_info.pNext = NULL;
373 allocate_info.allocationSize = size;
374 allocate_info.memoryTypeIndex = pool;
375 if ((vr = VK_CALL(vkAllocateMemory(device_vk->vk_device, &allocate_info, NULL, &vk_memory))) < 0)
376 {
377 ERR("Failed to allocate memory, vr %s.\n", wined3d_debug_vkresult(vr));
378 return VK_NULL_HANDLE;
379 }
380
381 return vk_memory;
382}
383
385 unsigned int memory_type, VkDeviceSize size, VkDeviceMemory *vk_memory)
386{
387 struct wined3d_device_vk *device_vk = wined3d_device_vk(context_vk->c.device);
388 struct wined3d_allocator *allocator = &device_vk->allocator;
390
392
394 {
395 *vk_memory = wined3d_context_vk_allocate_vram_chunk_memory(context_vk, memory_type, size);
397 return NULL;
398 }
399
400 if (!(block = wined3d_allocator_allocate(allocator, &context_vk->c, memory_type, size)))
401 {
403 *vk_memory = VK_NULL_HANDLE;
404 return NULL;
405 }
406
407 *vk_memory = wined3d_allocator_chunk_vk(block->chunk)->vk_memory;
408
410 return block;
411}
412
414{
415 struct wined3d_device_vk *device_vk = wined3d_device_vk(context_vk->c.device);
416
417 assert(block->chunk->allocator == &device_vk->allocator);
421}
422
425{
426 const struct wined3d_adapter_vk *adapter_vk = wined3d_adapter_vk(context_vk->c.device->adapter);
427 struct wined3d_device_vk *device_vk = wined3d_device_vk(context_vk->c.device);
428 const VkPhysicalDeviceLimits *limits = &adapter_vk->device_limits;
430 struct wined3d_bo_slab_vk *slab;
431 struct wine_rb_entry *entry;
432 size_t object_size, idx;
433 size_t alignment;
434
436 return false;
437
440 && limits->minTexelBufferOffsetAlignment > alignment)
441 alignment = limits->minTexelBufferOffsetAlignment;
442 if ((usage & VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT) && limits->minUniformBufferOffsetAlignment)
443 alignment = limits->minUniformBufferOffsetAlignment;
444 if ((usage & VK_BUFFER_USAGE_STORAGE_BUFFER_BIT) && limits->minStorageBufferOffsetAlignment)
445 alignment = limits->minStorageBufferOffsetAlignment;
446
447 object_size = (size + (alignment - 1)) & ~(alignment - 1);
448 if (object_size < WINED3D_ALLOCATOR_MIN_BLOCK_SIZE / 32)
449 object_size = WINED3D_ALLOCATOR_MIN_BLOCK_SIZE / 32;
450 key.memory_type = memory_type;
451 key.usage = usage;
452 key.size = 32 * object_size;
453
455
456 if ((entry = wine_rb_get(&context_vk->bo_slab_available, &key)))
457 {
459 TRACE("Using existing bo slab %p.\n", slab);
460 }
461 else
462 {
463 if (!(slab = calloc(1, sizeof(*slab))))
464 {
466 ERR("Failed to allocate bo slab.\n");
467 return false;
468 }
469
470 if (wine_rb_put(&context_vk->bo_slab_available, &key, &slab->entry) < 0)
471 {
473 ERR("Failed to add slab to available tree.\n");
474 free(slab);
475 return false;
476 }
477
478 slab->requested_memory_type = memory_type;
479 if (!wined3d_context_vk_create_bo(context_vk, key.size, usage, memory_type, &slab->bo))
480 {
482 ERR("Failed to create slab bo.\n");
483 wine_rb_remove(&context_vk->bo_slab_available, &slab->entry);
484 free(slab);
485 return false;
486 }
487 slab->map = ~0u;
488
489 TRACE("Created new bo slab %p.\n", slab);
490 }
491
492 idx = wined3d_bit_scan(&slab->map);
493 if (!slab->map)
494 {
495 if (slab->next)
496 {
497 wine_rb_replace(&context_vk->bo_slab_available, &slab->entry, &slab->next->entry);
498 slab->next = NULL;
499 }
500 else
501 {
502 wine_rb_remove(&context_vk->bo_slab_available, &slab->entry);
503 }
504 }
505
507
508 *bo = slab->bo;
509 bo->memory = NULL;
510 bo->slab = slab;
511 bo->b.refcount = 1;
512 bo->b.client_map_count = 0;
513 bo->b.map_ptr = NULL;
514 bo->b.buffer_offset = idx * object_size;
515 bo->b.memory_offset = slab->bo.b.memory_offset + bo->b.buffer_offset;
516 bo->size = size;
517 list_init(&bo->b.users);
518 bo->command_buffer_id = 0;
519 bo->host_synced = false;
520
521 TRACE("Using buffer 0x%s, memory 0x%s, offset 0x%s for bo %p.\n",
523 wine_dbgstr_longlong(bo->b.buffer_offset), bo);
524
525 return true;
526}
527
530{
531 struct wined3d_device_vk *device_vk = wined3d_device_vk(context_vk->c.device);
532 const struct wined3d_vk_info *vk_info = context_vk->vk_info;
533 VkMemoryRequirements memory_requirements;
534 struct wined3d_adapter_vk *adapter_vk;
535 VkBufferCreateInfo create_info;
536 unsigned int memory_type_idx;
537 VkResult vr;
538
539 if (wined3d_context_vk_create_slab_bo(context_vk, size, usage, memory_type, bo))
540 return TRUE;
541
542 adapter_vk = wined3d_adapter_vk(device_vk->d.adapter);
543
545 create_info.pNext = NULL;
546 create_info.flags = 0;
547 create_info.size = size;
548 create_info.usage = usage;
550 create_info.queueFamilyIndexCount = 0;
551 create_info.pQueueFamilyIndices = NULL;
552
553 if ((vr = VK_CALL(vkCreateBuffer(device_vk->vk_device, &create_info, NULL, &bo->vk_buffer))) < 0)
554 {
555 ERR("Failed to create Vulkan buffer, vr %s.\n", wined3d_debug_vkresult(vr));
556 return FALSE;
557 }
558
559 VK_CALL(vkGetBufferMemoryRequirements(device_vk->vk_device, bo->vk_buffer, &memory_requirements));
560
561 memory_type_idx = wined3d_adapter_vk_get_memory_type_index(adapter_vk,
562 memory_requirements.memoryTypeBits, memory_type);
563 if (memory_type_idx == ~0u)
564 {
565 ERR("Failed to find suitable memory type.\n");
567 return FALSE;
568 }
570 memory_type_idx, memory_requirements.size, &bo->vk_memory);
571 if (!bo->vk_memory)
572 {
573 ERR("Failed to allocate buffer memory.\n");
575 return FALSE;
576 }
577 bo->b.memory_offset = bo->memory ? bo->memory->offset : 0;
578
579 if ((vr = VK_CALL(vkBindBufferMemory(device_vk->vk_device, bo->vk_buffer,
580 bo->vk_memory, bo->b.memory_offset))) < 0)
581 {
582 ERR("Failed to bind buffer memory, vr %s.\n", wined3d_debug_vkresult(vr));
583 if (bo->memory)
584 wined3d_context_vk_free_memory(context_vk, bo->memory);
585 else
586 VK_CALL(vkFreeMemory(device_vk->vk_device, bo->vk_memory, NULL));
588 return FALSE;
589 }
590
591 bo->b.refcount = 1;
592 bo->b.client_map_count = 0;
593 bo->b.map_ptr = NULL;
594 bo->b.buffer_offset = 0;
595 bo->size = size;
596 bo->usage = usage;
597 bo->memory_type = adapter_vk->memory_properties.memoryTypes[memory_type_idx].propertyFlags;
598 bo->b.coherent = !!(bo->memory_type & VK_MEMORY_PROPERTY_HOST_COHERENT_BIT);
599 list_init(&bo->b.users);
600 bo->command_buffer_id = 0;
601 bo->slab = NULL;
602 bo->host_synced = false;
603
604 TRACE("Created buffer 0x%s, memory 0x%s for bo %p.\n",
606
607 return TRUE;
608}
609
611 VkImageUsageFlags usage, VkFormat vk_format, unsigned int width, unsigned int height, unsigned int depth,
612 unsigned int sample_count, unsigned int mip_levels, unsigned int layer_count, unsigned int flags,
613 struct wined3d_image_vk *image)
614{
615 struct wined3d_adapter_vk *adapter_vk = wined3d_adapter_vk(context_vk->c.device->adapter);
616 struct wined3d_device_vk *device_vk = wined3d_device_vk(context_vk->c.device);
617 const struct wined3d_vk_info *vk_info = context_vk->vk_info;
618 VkMemoryRequirements memory_requirements;
619 VkImageCreateInfo create_info;
620 unsigned int memory_type_idx;
621 VkResult vr;
622
624 create_info.pNext = NULL;
625 create_info.flags = flags;
626 create_info.imageType = vk_image_type;
627 create_info.format = vk_format;
628 create_info.extent.width = width;
629 create_info.extent.height = height;
630 create_info.extent.depth = depth;
631 create_info.mipLevels = mip_levels;
632 create_info.arrayLayers = layer_count;
633 create_info.samples = sample_count;
634 create_info.tiling = VK_IMAGE_TILING_OPTIMAL;
635 create_info.usage = usage;
637 create_info.queueFamilyIndexCount = 0;
638 create_info.pQueueFamilyIndices = NULL;
640
641 image->command_buffer_id = 0;
642
643 vr = VK_CALL(vkCreateImage(device_vk->vk_device, &create_info, NULL, &image->vk_image));
644 if (vr != VK_SUCCESS)
645 {
646 ERR("Failed to create image, vr %s.\n", wined3d_debug_vkresult(vr));
647 image->vk_image = VK_NULL_HANDLE;
648 return FALSE;
649 }
650
652 &memory_requirements));
653
654 memory_type_idx = wined3d_adapter_vk_get_memory_type_index(adapter_vk,
656 if (memory_type_idx == ~0u)
657 {
658 ERR("Failed to find suitable image memory type.\n");
659 VK_CALL(vkDestroyImage(device_vk->vk_device, image->vk_image, NULL));
660 image->vk_image = VK_NULL_HANDLE;
661 return FALSE;
662 }
663
664 image->memory = wined3d_context_vk_allocate_memory(context_vk, memory_type_idx,
665 memory_requirements.size, &image->vk_memory);
666 if (!image->vk_memory)
667 {
668 ERR("Failed to allocate image memory.\n");
669 VK_CALL(vkDestroyImage(device_vk->vk_device, image->vk_image, NULL));
670 image->vk_image = VK_NULL_HANDLE;
671 return FALSE;
672 }
673
674 vr = VK_CALL(vkBindImageMemory(device_vk->vk_device, image->vk_image, image->vk_memory,
675 image->memory ? image->memory->offset : 0));
676 if (vr != VK_SUCCESS)
677 {
678 VK_CALL(vkDestroyImage(device_vk->vk_device, image->vk_image, NULL));
679 if (image->memory)
680 wined3d_context_vk_free_memory(context_vk, image->memory);
681 else
682 VK_CALL(vkFreeMemory(device_vk->vk_device, image->vk_memory, NULL));
683 ERR("Failed to bind image memory, vr %s.\n", wined3d_debug_vkresult(vr));
684 image->memory = NULL;
685 image->vk_memory = VK_NULL_HANDLE;
686 image->vk_image = VK_NULL_HANDLE;
687 return FALSE;
688 }
689
690 return TRUE;
691}
692
694{
695 struct wined3d_retired_objects_vk *retired = &context_vk->retired;
697
698 if (retired->free)
699 {
700 o = retired->free;
701 retired->free = o->u.next;
702 return o;
703 }
704
705 if (!wined3d_array_reserve((void **)&retired->objects, &retired->size,
706 retired->count + 1, sizeof(*retired->objects)))
707 return NULL;
708
709 return &retired->objects[retired->count++];
710}
711
714{
715 struct wined3d_device_vk *device_vk = wined3d_device_vk(context_vk->c.device);
716 const struct wined3d_vk_info *vk_info = context_vk->vk_info;
718
720 {
722 TRACE("Destroyed framebuffer 0x%s.\n", wine_dbgstr_longlong(vk_framebuffer));
723 return;
724 }
725
726 if (!(o = wined3d_context_vk_get_retired_object_vk(context_vk)))
727 {
728 ERR("Leaking framebuffer 0x%s.\n", wine_dbgstr_longlong(vk_framebuffer));
729 return;
730 }
731
735}
736
738 VkDescriptorPool vk_descriptor_pool)
739{
740 struct wined3d_device_vk *device_vk = wined3d_device_vk(context_vk->c.device);
741 const struct wined3d_vk_info *vk_info = context_vk->vk_info;
742
743 if (!wined3d_array_reserve((void **)&context_vk->vk_descriptor_pools, &context_vk->vk_descriptor_pools_size,
744 context_vk->vk_descriptor_pool_count + 1, sizeof(*context_vk->vk_descriptor_pools)))
745 {
746 VK_CALL(vkDestroyDescriptorPool(device_vk->vk_device, vk_descriptor_pool, NULL));
747 TRACE("Destroying descriptor pool 0x%s.\n", wine_dbgstr_longlong(vk_descriptor_pool));
748 return;
749 }
750
751 VK_CALL(vkResetDescriptorPool(device_vk->vk_device, vk_descriptor_pool, 0));
752 context_vk->vk_descriptor_pools[context_vk->vk_descriptor_pool_count++] = vk_descriptor_pool;
753}
754
756 VkDescriptorPool vk_descriptor_pool, uint64_t command_buffer_id)
757{
759
761 {
763 TRACE("Reset descriptor pool 0x%s.\n", wine_dbgstr_longlong(vk_descriptor_pool));
764 return;
765 }
766
767 if (!(o = wined3d_context_vk_get_retired_object_vk(context_vk)))
768 {
769 ERR("Leaking descriptor pool 0x%s.\n", wine_dbgstr_longlong(vk_descriptor_pool));
770 return;
771 }
772
776}
777
779 VkDeviceMemory vk_memory, uint64_t command_buffer_id)
780{
781 struct wined3d_device_vk *device_vk = wined3d_device_vk(context_vk->c.device);
782 const struct wined3d_vk_info *vk_info = context_vk->vk_info;
784
786 {
788 TRACE("Freed memory 0x%s.\n", wine_dbgstr_longlong(vk_memory));
789 return;
790 }
791
792 if (!(o = wined3d_context_vk_get_retired_object_vk(context_vk)))
793 {
794 ERR("Leaking memory 0x%s.\n", wine_dbgstr_longlong(vk_memory));
795 return;
796 }
797
799 o->u.vk_memory = vk_memory;
801}
802
805{
807
809 {
811 TRACE("Freed block %p.\n", block);
812 return;
813 }
814
815 if (!(o = wined3d_context_vk_get_retired_object_vk(context_vk)))
816 {
817 ERR("Leaking block %p.\n", block);
818 return;
819 }
820
822 o->u.block = block;
824}
825
827 SIZE_T idx, struct wined3d_context_vk *context_vk)
828{
829 struct wined3d_device_vk *device_vk = wined3d_device_vk(context_vk->c.device);
831 struct wine_rb_entry *entry;
832
833 TRACE("slab %p, idx %Iu, context_vk %p.\n", slab, idx, context_vk);
834
836
837 if (!slab->map)
838 {
839 key.memory_type = slab->requested_memory_type;
840 key.usage = slab->bo.usage;
841 key.size = slab->bo.size;
842
843 if ((entry = wine_rb_get(&context_vk->bo_slab_available, &key)))
844 {
846 wine_rb_replace(&context_vk->bo_slab_available, entry, &slab->entry);
847 }
848 else if (wine_rb_put(&context_vk->bo_slab_available, &key, &slab->entry) < 0)
849 {
850 ERR("Unable to return slab %p (map 0x%08x) to available tree.\n", slab, slab->map);
851 }
852 }
853 slab->map |= 1u << idx;
854
856}
857
859 struct wined3d_bo_slab_vk *slab, SIZE_T idx, uint64_t command_buffer_id)
860{
862
864 {
866 return;
867 }
868
869 if (!(o = wined3d_context_vk_get_retired_object_vk(context_vk)))
870 {
871 ERR("Leaking slab %p, slice %#Ix.\n", slab, idx);
872 return;
873 }
874
876 o->u.slice.slab = slab;
877 o->u.slice.idx = idx;
879}
880
883{
884 struct wined3d_device_vk *device_vk = wined3d_device_vk(context_vk->c.device);
885 const struct wined3d_vk_info *vk_info = context_vk->vk_info;
887
889 {
891 TRACE("Destroyed buffer 0x%s.\n", wine_dbgstr_longlong(vk_buffer));
892 return;
893 }
894
895 if (!(o = wined3d_context_vk_get_retired_object_vk(context_vk)))
896 {
897 ERR("Leaking buffer 0x%s.\n", wine_dbgstr_longlong(vk_buffer));
898 return;
899 }
900
902 o->u.vk_buffer = vk_buffer;
904}
905
908{
909 struct wined3d_device_vk *device_vk = wined3d_device_vk(context_vk->c.device);
910 const struct wined3d_vk_info *vk_info = context_vk->vk_info;
912
914 {
916 TRACE("Destroyed image 0x%s.\n", wine_dbgstr_longlong(vk_image));
917 return;
918 }
919
920 if (!(o = wined3d_context_vk_get_retired_object_vk(context_vk)))
921 {
922 ERR("Leaking image 0x%s.\n", wine_dbgstr_longlong(vk_image));
923 return;
924 }
925
927 o->u.vk_image = vk_image;
929}
930
932 VkBufferView vk_view, uint64_t command_buffer_id)
933{
934 struct wined3d_device_vk *device_vk = wined3d_device_vk(context_vk->c.device);
935 const struct wined3d_vk_info *vk_info = context_vk->vk_info;
937
939 {
940 VK_CALL(vkDestroyBufferView(device_vk->vk_device, vk_view, NULL));
941 TRACE("Destroyed buffer view 0x%s.\n", wine_dbgstr_longlong(vk_view));
942 return;
943 }
944
945 if (!(o = wined3d_context_vk_get_retired_object_vk(context_vk)))
946 {
947 ERR("Leaking buffer view 0x%s.\n", wine_dbgstr_longlong(vk_view));
948 return;
949 }
950
952 o->u.vk_buffer_view = vk_view;
954}
955
957 VkImageView vk_view, uint64_t command_buffer_id)
958{
959 struct wined3d_device_vk *device_vk = wined3d_device_vk(context_vk->c.device);
960 const struct wined3d_vk_info *vk_info = context_vk->vk_info;
962
964 {
965 VK_CALL(vkDestroyImageView(device_vk->vk_device, vk_view, NULL));
966 TRACE("Destroyed image view 0x%s.\n", wine_dbgstr_longlong(vk_view));
967 return;
968 }
969
970 if (!(o = wined3d_context_vk_get_retired_object_vk(context_vk)))
971 {
972 ERR("Leaking image view 0x%s.\n", wine_dbgstr_longlong(vk_view));
973 return;
974 }
975
977 o->u.vk_image_view = vk_view;
979}
980
983{
984 const struct wined3d_vk_info *vk_info = context_vk->vk_info;
986 struct wined3d_range range;
987 unsigned int start = 0;
988
989 for (;;)
990 {
992 break;
993
994 VK_CALL(vkCmdResetQueryPool(buffer->vk_command_buffer, pool_vk->vk_query_pool, range.offset, range.size));
995
996 if (!(o = wined3d_context_vk_get_retired_object_vk(context_vk)))
997 {
998 ERR("Freeing query range %u+%u in pool %p.\n", range.offset, range.size, pool_vk);
999 wined3d_query_pool_vk_mark_free(context_vk, pool_vk, range.offset, range.size);
1000 }
1001 else
1002 {
1004 o->u.queries.pool_vk = pool_vk;
1005 o->u.queries.start = range.offset;
1006 o->u.queries.count = range.size;
1007 o->command_buffer_id = buffer->id;
1008 }
1009
1010 start = range.offset + range.size;
1011 }
1012
1013 memset(pool_vk->completed, 0, sizeof(pool_vk->completed));
1014}
1015
1017 VkPipeline vk_pipeline, uint64_t command_buffer_id)
1018{
1019 struct wined3d_device_vk *device_vk = wined3d_device_vk(context_vk->c.device);
1020 const struct wined3d_vk_info *vk_info = context_vk->vk_info;
1021 struct wined3d_retired_object_vk *o;
1022
1024 {
1026 TRACE("Destroyed pipeline 0x%s.\n", wine_dbgstr_longlong(vk_pipeline));
1027 return;
1028 }
1029
1030 if (!(o = wined3d_context_vk_get_retired_object_vk(context_vk)))
1031 {
1032 ERR("Leaking pipeline 0x%s.\n", wine_dbgstr_longlong(vk_pipeline));
1033 return;
1034 }
1035
1039}
1040
1041
1044{
1045 struct wined3d_device_vk *device_vk = wined3d_device_vk(context_vk->c.device);
1046 const struct wined3d_vk_info *vk_info = context_vk->vk_info;
1047 struct wined3d_retired_object_vk *o;
1048
1050 {
1052 TRACE("Destroyed sampler 0x%s.\n", wine_dbgstr_longlong(vk_sampler));
1053 return;
1054 }
1055
1056 if (!(o = wined3d_context_vk_get_retired_object_vk(context_vk)))
1057 {
1058 ERR("Leaking sampler 0x%s.\n", wine_dbgstr_longlong(vk_sampler));
1059 return;
1060 }
1061
1063 o->u.vk_sampler = vk_sampler;
1065}
1066
1069{
1070 struct wined3d_device_vk *device_vk = wined3d_device_vk(context_vk->c.device);
1071 const struct wined3d_vk_info *vk_info = context_vk->vk_info;
1072 struct wined3d_retired_object_vk *o;
1073
1075 {
1077 TRACE("Destroyed event 0x%s.\n", wine_dbgstr_longlong(vk_event));
1078 return;
1079 }
1080
1081 if (!(o = wined3d_context_vk_get_retired_object_vk(context_vk)))
1082 {
1083 ERR("Leaking event 0x%s.\n", wine_dbgstr_longlong(vk_event));
1084 return;
1085 }
1086
1088 o->u.vk_event = vk_event;
1090}
1091
1093{
1094 wined3d_context_vk_destroy_vk_image(context_vk, image->vk_image, image->command_buffer_id);
1095 if (image->memory)
1097 image->command_buffer_id);
1098 else
1099 wined3d_context_vk_destroy_vk_memory(context_vk, image->vk_memory, image->command_buffer_id);
1100
1101 image->vk_image = VK_NULL_HANDLE;
1102 image->vk_memory = VK_NULL_HANDLE;
1103 image->memory = NULL;
1104}
1105
1106void wined3d_context_vk_destroy_bo(struct wined3d_context_vk *context_vk, const struct wined3d_bo_vk *bo)
1107{
1108 struct wined3d_device_vk *device_vk = wined3d_device_vk(context_vk->c.device);
1109 const struct wined3d_vk_info *vk_info = context_vk->vk_info;
1110 struct wined3d_bo_slab_vk *slab_vk;
1111 size_t object_size, idx;
1112
1113 TRACE("context_vk %p, bo %p.\n", context_vk, bo);
1114
1115 assert(list_empty(&bo->b.users));
1116
1117 if (bo->command_buffer_id == context_vk->current_command_buffer.id)
1118 context_vk->retired_bo_size += bo->size;
1119
1120 if ((slab_vk = bo->slab))
1121 {
1122 if (bo->b.map_ptr)
1123 wined3d_bo_slab_vk_unmap(slab_vk, context_vk);
1124 object_size = slab_vk->bo.size / 32;
1125 idx = bo->b.buffer_offset / object_size;
1126 wined3d_context_vk_destroy_bo_slab_slice(context_vk, slab_vk, idx, bo->command_buffer_id);
1127 return;
1128 }
1129
1130 wined3d_context_vk_destroy_vk_buffer(context_vk, bo->vk_buffer, bo->command_buffer_id);
1131 if (bo->memory)
1132 {
1133 if (bo->b.map_ptr)
1135 wined3d_context_vk_destroy_allocator_block(context_vk, bo->memory, bo->command_buffer_id);
1136 return;
1137 }
1138
1139 if (bo->b.map_ptr)
1140 {
1141 VK_CALL(vkUnmapMemory(device_vk->vk_device, bo->vk_memory));
1142 adapter_adjust_mapped_memory(device_vk->d.adapter, -bo->size);
1143 }
1144 wined3d_context_vk_destroy_vk_memory(context_vk, bo->vk_memory, bo->command_buffer_id);
1145}
1146
1148{
1149 struct wined3d_device_vk *device_vk = wined3d_device_vk(context_vk->c.device);
1150 const struct wined3d_vk_info *vk_info = context_vk->vk_info;
1151
1152 VK_CALL(vkDestroyFence(device_vk->vk_device, buffer->vk_fence, NULL));
1154 context_vk->vk_command_pool, 1, &buffer->vk_command_buffer));
1155}
1156
1158 unsigned int submit_index)
1159{
1160 struct wined3d_command_buffer_vk *buffer = &context_vk->submitted.buffers[submit_index];
1161
1162 if (buffer->id > context_vk->completed_command_buffer_id)
1163 context_vk->completed_command_buffer_id = buffer->id;
1164
1165 if (wined3d_array_reserve((void **)&context_vk->completed.buffers, &context_vk->completed.buffers_size,
1166 context_vk->completed.buffer_count + 1, sizeof(*context_vk->completed.buffers)))
1167 context_vk->completed.buffers[context_vk->completed.buffer_count++] = *buffer;
1168 else
1169 free_command_buffer(context_vk, buffer);
1170
1171 *buffer = context_vk->submitted.buffers[--context_vk->submitted.buffer_count];
1172}
1173
1175{
1176 struct wined3d_device_vk *device_vk = wined3d_device_vk(context_vk->c.device);
1177 struct wined3d_retired_objects_vk *retired = &context_vk->retired;
1178 const struct wined3d_vk_info *vk_info = context_vk->vk_info;
1180 struct wined3d_retired_object_vk *o;
1182 SIZE_T i = 0;
1183
1184 while (i < context_vk->submitted.buffer_count)
1185 {
1186 buffer = &context_vk->submitted.buffers[i];
1187 if (VK_CALL(vkGetFenceStatus(device_vk->vk_device, buffer->vk_fence)) == VK_NOT_READY)
1188 {
1189 ++i;
1190 continue;
1191 }
1192
1193 TRACE("Command buffer %p with id 0x%s has finished.\n",
1194 buffer->vk_command_buffer, wine_dbgstr_longlong(buffer->id));
1195 if (buffer->vk_fence == vk_fence)
1196 return;
1198 }
1199
1201
1202 retired->free = NULL;
1203 for (i = retired->count; i; --i)
1204 {
1205 o = &retired->objects[i - 1];
1206
1208 continue;
1209
1210 switch (o->type)
1211 {
1213 /* Nothing to do. */
1214 break;
1215
1218 TRACE("Destroyed framebuffer 0x%s.\n", wine_dbgstr_longlong(o->u.vk_framebuffer));
1219 break;
1220
1223 TRACE("Reset descriptor pool 0x%s.\n", wine_dbgstr_longlong(o->u.vk_descriptor_pool));
1224 break;
1225
1227 VK_CALL(vkFreeMemory(device_vk->vk_device, o->u.vk_memory, NULL));
1228 TRACE("Freed memory 0x%s.\n", wine_dbgstr_longlong(o->u.vk_memory));
1229 break;
1230
1232 TRACE("Destroying block %p.\n", o->u.block);
1233 wined3d_context_vk_free_memory(context_vk, o->u.block);
1234 break;
1235
1237 wined3d_bo_slab_vk_free_slice(o->u.slice.slab, o->u.slice.idx, context_vk);
1238 break;
1239
1241 VK_CALL(vkDestroyBuffer(device_vk->vk_device, o->u.vk_buffer, NULL));
1242 TRACE("Destroyed buffer 0x%s.\n", wine_dbgstr_longlong(o->u.vk_buffer));
1243 break;
1244
1246 VK_CALL(vkDestroyImage(device_vk->vk_device, o->u.vk_image, NULL));
1247 TRACE("Destroyed image 0x%s.\n", wine_dbgstr_longlong(o->u.vk_image));
1248 break;
1249
1252 TRACE("Destroyed buffer view 0x%s.\n", wine_dbgstr_longlong(o->u.vk_buffer_view));
1253 break;
1254
1257 TRACE("Destroyed image view 0x%s.\n", wine_dbgstr_longlong(o->u.vk_image_view));
1258 break;
1259
1262 TRACE("Destroyed sampler 0x%s.\n", wine_dbgstr_longlong(o->u.vk_sampler));
1263 break;
1264
1266 wined3d_query_pool_vk_mark_free(context_vk, o->u.queries.pool_vk, o->u.queries.start, o->u.queries.count);
1267 TRACE("Freed query range %u+%u in pool %p.\n", o->u.queries.start, o->u.queries.count, o->u.queries.pool_vk);
1268 break;
1269
1271 VK_CALL(vkDestroyEvent(device_vk->vk_device, o->u.vk_event, NULL));
1272 TRACE("Destroyed event 0x%s.\n", wine_dbgstr_longlong(o->u.vk_event));
1273 break;
1274
1277 TRACE("Destroyed pipeline 0x%s.\n", wine_dbgstr_longlong(o->u.vk_pipeline));
1278 break;
1279
1280 default:
1281 ERR("Unhandled object type %#x.\n", o->type);
1282 break;
1283 }
1284
1285 if (i == retired->count)
1286 {
1287 --retired->count;
1288 continue;
1289 }
1290
1292 o->u.next = retired->free;
1293 retired->free = o;
1294
1295 if (vk_fence && VK_CALL(vkGetFenceStatus(device_vk->vk_device, vk_fence)) != VK_NOT_READY)
1296 break;
1297 }
1298}
1299
1301{
1302 struct wined3d_context_vk *context_vk = ctx;
1303 struct wined3d_bo_slab_vk *slab, *next;
1304
1306 while (slab)
1307 {
1308 next = slab->next;
1309 wined3d_context_vk_destroy_bo(context_vk, &slab->bo);
1310 free(slab);
1311 slab = next;
1312 }
1313}
1314
1316{
1319 struct wined3d_context_vk *context_vk = ctx;
1320 const struct wined3d_vk_info *vk_info;
1321 struct wined3d_device_vk *device_vk;
1322
1323 vk_info = context_vk->vk_info;
1324 device_vk = wined3d_device_vk(context_vk->c.device);
1325
1326 VK_CALL(vkDestroyPipeline(device_vk->vk_device, pipeline_vk->vk_pipeline, NULL));
1327 free(pipeline_vk);
1328}
1329
1331{
1334 struct wined3d_context_vk *context_vk = ctx;
1335 const struct wined3d_vk_info *vk_info;
1336 struct wined3d_device_vk *device_vk;
1337
1338 vk_info = context_vk->vk_info;
1339 device_vk = wined3d_device_vk(context_vk->c.device);
1340
1343 free(layout->key.bindings);
1344 free(layout);
1345}
1346
1348 const struct wined3d_fb_state *fb, unsigned int rt_count, bool depth_stencil, uint32_t clear_flags)
1349{
1352 unsigned int i;
1354
1355 memset(key, 0, sizeof(*key));
1356
1357 for (i = 0; i < rt_count; ++i)
1358 {
1359 if (!(view = fb->render_targets[i]) || view->format->id == WINED3DFMT_NULL)
1360 continue;
1361
1362 a = &key->rt[i];
1363 a->vk_format = wined3d_format_vk(view->format)->vk_format;
1364 a->vk_samples = max(1, wined3d_resource_get_sample_count(view->resource));
1367
1368 if (clear_flags & WINED3DCLEAR_TARGET)
1374
1375 key->rt_mask |= 1u << i;
1376 }
1377
1378 if (depth_stencil && (view = fb->depth_stencil))
1379 {
1380 a = &key->ds;
1381 a->vk_format = wined3d_format_vk(view->format)->vk_format;
1382 a->vk_samples = max(1, wined3d_resource_get_sample_count(view->resource));
1385 key->rt_mask |= 1u << WINED3D_MAX_RENDER_TARGETS;
1386
1387 if (clear_flags & WINED3DCLEAR_STENCIL)
1389 if (clear_flags & WINED3DCLEAR_ZBUFFER)
1391
1392 if (!a->flags && (location & WINED3D_LOCATION_DISCARDED))
1396 }
1397}
1398
1400 struct wined3d_context_vk *context_vk)
1401{
1402 struct wined3d_device_vk *device_vk = wined3d_device_vk(context_vk->c.device);
1403 const struct wined3d_vk_info *vk_info = context_vk->vk_info;
1404
1405 VK_CALL(vkDestroyRenderPass(device_vk->vk_device, pass->vk_render_pass, NULL));
1406}
1407
1409 struct wined3d_context_vk *context_vk, const struct wined3d_render_pass_key_vk *key)
1410{
1411 struct wined3d_device_vk *device_vk = wined3d_device_vk(context_vk->c.device);
1414 const struct wined3d_vk_info *vk_info = context_vk->vk_info;
1416 VkAttachmentReference ds_attachment_reference;
1417 VkAttachmentReference *ds_reference = NULL;
1418 unsigned int attachment_count, rt_count, i;
1420 VkSubpassDescription sub_pass_desc;
1421 VkRenderPassCreateInfo pass_desc;
1422 uint32_t mask;
1423 VkResult vr;
1424
1425 rt_count = 0;
1426 attachment_count = 0;
1428 while (mask)
1429 {
1431 a = &key->rt[i];
1432
1433 attachment = &attachments[attachment_count];
1434 attachment->flags = 0;
1435 attachment->format = a->vk_format;
1436 attachment->samples = a->vk_samples;
1437
1440 else if (a->flags & WINED3D_FB_ATTACHMENT_FLAG_CLEAR_C)
1442 else
1444
1448 attachment->initialLayout = a->vk_layout;
1449 attachment->finalLayout = a->vk_layout;
1450
1451 attachment_references[i].attachment = attachment_count;
1452 attachment_references[i].layout = a->vk_layout;
1453
1454 ++attachment_count;
1455 rt_count = i + 1;
1456 }
1457
1458 mask = ~key->rt_mask & wined3d_mask_from_size(rt_count);
1459 while (mask)
1460 {
1462 attachment_references[i].attachment = VK_ATTACHMENT_UNUSED;
1463 attachment_references[i].layout = VK_IMAGE_LAYOUT_UNDEFINED;
1464 }
1465
1466 if (key->rt_mask & (1u << WINED3D_MAX_RENDER_TARGETS))
1467 {
1468 a = &key->ds;
1469
1470 attachment = &attachments[attachment_count];
1471 attachment->flags = 0;
1472 attachment->format = a->vk_format;
1473 attachment->samples = a->vk_samples;
1474
1477 else if (a->flags & WINED3D_FB_ATTACHMENT_FLAG_CLEAR_Z)
1479 else
1481
1484 else if (a->flags & WINED3D_FB_ATTACHMENT_FLAG_CLEAR_S)
1485 attachment->stencilLoadOp = VK_ATTACHMENT_LOAD_OP_CLEAR;
1486 else
1487 attachment->stencilLoadOp = VK_ATTACHMENT_LOAD_OP_LOAD;
1488
1490 attachment->stencilStoreOp = VK_ATTACHMENT_STORE_OP_STORE;
1491 attachment->initialLayout = a->vk_layout;
1492 attachment->finalLayout = a->vk_layout;
1493
1494 ds_reference = &ds_attachment_reference;
1495 ds_reference->attachment = attachment_count;
1496 ds_reference->layout = a->vk_layout;
1497
1498 ++attachment_count;
1499 }
1500
1501 sub_pass_desc.flags = 0;
1503 sub_pass_desc.inputAttachmentCount = 0;
1504 sub_pass_desc.pInputAttachments = NULL;
1505 sub_pass_desc.colorAttachmentCount = rt_count;
1506 sub_pass_desc.pColorAttachments = attachment_references;
1507 sub_pass_desc.pResolveAttachments = NULL;
1508 sub_pass_desc.pDepthStencilAttachment = ds_reference;
1509 sub_pass_desc.preserveAttachmentCount = 0;
1510 sub_pass_desc.pPreserveAttachments = NULL;
1511
1513 pass_desc.pNext = NULL;
1514 pass_desc.flags = 0;
1515 pass_desc.attachmentCount = attachment_count;
1516 pass_desc.pAttachments = attachments;
1517 pass_desc.subpassCount = 1;
1518 pass_desc.pSubpasses = &sub_pass_desc;
1519 pass_desc.dependencyCount = 0;
1520 pass_desc.pDependencies = NULL;
1521
1522 pass->key = *key;
1523 if ((vr = VK_CALL(vkCreateRenderPass(device_vk->vk_device,
1524 &pass_desc, NULL, &pass->vk_render_pass))) < 0)
1525 {
1526 WARN("Failed to create Vulkan render pass, vr %d.\n", vr);
1527 return false;
1528 }
1529
1530 return true;
1531}
1532
1534 const struct wined3d_fb_state *fb, unsigned int rt_count, bool depth_stencil, uint32_t clear_flags)
1535{
1538 struct wine_rb_entry *entry;
1539
1540 wined3d_render_pass_key_vk_init(&key, fb, rt_count, depth_stencil, clear_flags);
1541 if ((entry = wine_rb_get(&context_vk->render_passes, &key)))
1542 return WINE_RB_ENTRY_VALUE(entry, struct wined3d_render_pass_vk, entry)->vk_render_pass;
1543
1544 if (!(pass = malloc(sizeof(*pass))))
1545 return VK_NULL_HANDLE;
1546
1547 if (!wined3d_render_pass_vk_init(pass, context_vk, &key))
1548 {
1549 free(pass);
1550 return VK_NULL_HANDLE;
1551 }
1552
1553 if (wine_rb_put(&context_vk->render_passes, &pass->key, &pass->entry) == -1)
1554 {
1555 ERR("Failed to insert render pass.\n");
1557 free(pass);
1558 return VK_NULL_HANDLE;
1559 }
1560
1561 return pass->vk_render_pass;
1562}
1563
1565{
1566 VkCommandBuffer vk_command_buffer = context_vk->current_command_buffer.vk_command_buffer;
1567 const struct wined3d_vk_info *vk_info = context_vk->vk_info;
1568 struct wined3d_query_vk *query_vk;
1569
1570 if (context_vk->vk_render_pass)
1571 {
1572 LIST_FOR_EACH_ENTRY(query_vk, &context_vk->render_pass_queries, struct wined3d_query_vk, entry)
1573 wined3d_query_vk_suspend(query_vk, context_vk);
1574
1575 VK_CALL(vkCmdEndRenderPass(vk_command_buffer));
1576 context_vk->vk_render_pass = VK_NULL_HANDLE;
1579
1580 LIST_FOR_EACH_ENTRY(query_vk, &context_vk->render_pass_queries, struct wined3d_query_vk, entry)
1581 {
1582 if (!wined3d_context_vk_allocate_query(context_vk, query_vk->q.type, &query_vk->pool_idx))
1583 {
1584 ERR("Failed to allocate new query.\n");
1585 break;
1586 }
1587 }
1588 }
1589
1590 if (context_vk->vk_framebuffer)
1591 {
1593 context_vk->vk_framebuffer, context_vk->current_command_buffer.id);
1594 context_vk->vk_framebuffer = VK_NULL_HANDLE;
1595 }
1596}
1597
1599{
1602
1604 free(pass);
1605}
1606
1608{
1609 free(writes->writes);
1610}
1611
1612static void wined3d_context_vk_destroy_query_pools(struct wined3d_context_vk *context_vk, struct list *free_pools)
1613{
1614 struct wined3d_query_pool_vk *pool_vk, *entry;
1615
1616 LIST_FOR_EACH_ENTRY_SAFE(pool_vk, entry, free_pools, struct wined3d_query_pool_vk, entry)
1617 {
1618 wined3d_query_pool_vk_cleanup(pool_vk, context_vk);
1619 free(pool_vk);
1620 }
1621}
1622
1624 enum wined3d_query_type type, struct wined3d_query_pool_idx_vk *pool_idx)
1625{
1626 const struct wined3d_vk_info *vk_info = context_vk->vk_info;
1627 struct wined3d_query_pool_vk *pool_vk, *entry;
1628 struct wined3d_device_vk *device_vk;
1629 struct list *free_pools;
1630 VkResult vr;
1631 size_t idx;
1632
1633 switch (type)
1634 {
1636 free_pools = &context_vk->free_occlusion_query_pools;
1637 break;
1638
1640 free_pools = &context_vk->free_timestamp_query_pools;
1641 break;
1642
1644 free_pools = &context_vk->free_pipeline_statistics_query_pools;
1645 break;
1646
1652 free_pools = &context_vk->free_stream_output_statistics_query_pools;
1653 break;
1654
1655 default:
1656 FIXME("Unhandled query type %#x.\n", type);
1657 return false;
1658 }
1659
1660 LIST_FOR_EACH_ENTRY_SAFE(pool_vk, entry, free_pools, struct wined3d_query_pool_vk, entry)
1661 {
1663 goto done;
1664 list_remove(&pool_vk->entry);
1665 list_init(&pool_vk->entry);
1666 }
1667
1668 if (!(pool_vk = calloc(1, sizeof(*pool_vk))))
1669 return false;
1670 if (!wined3d_query_pool_vk_init(pool_vk, context_vk, type, free_pools))
1671 {
1672 free(pool_vk);
1673 return false;
1674 }
1675
1676 device_vk = wined3d_device_vk(context_vk->c.device);
1677
1679 {
1682 }
1683 else
1684 {
1685 VkEventCreateInfo event_create_info;
1686
1690
1691 event_create_info.sType = VK_STRUCTURE_TYPE_EVENT_CREATE_INFO;
1692 event_create_info.pNext = NULL;
1693 event_create_info.flags = 0;
1694
1695 /* We probably shouldn't call vkGetQueryPoolResults() without synchronizing with vkCmdResetQueryPool()
1696 * even if the query pool is freshly allocated. wined3d_query_vk_accumulate_data() will check this event
1697 * before returning results. */
1698 vr = VK_CALL(vkCreateEvent(device_vk->vk_device, &event_create_info, NULL, &pool_vk->vk_event));
1699 if (vr == VK_SUCCESS)
1700 {
1701 /* At which stage vkCmdResetQueryPool() executes? */
1704 }
1705 else
1706 {
1707 ERR("Failed to create event, vr %s.\n", wined3d_debug_vkresult(vr));
1708 }
1709 }
1710
1712 {
1713 wined3d_query_pool_vk_cleanup(pool_vk, context_vk);
1714 free(pool_vk);
1715 return false;
1716 }
1717
1718done:
1719 pool_idx->pool_vk = pool_vk;
1720 pool_idx->idx = idx;
1721
1722 return true;
1723}
1724
1726{
1728 struct wined3d_device_vk *device_vk = wined3d_device_vk(context_vk->c.device);
1729 const struct wined3d_vk_info *vk_info = context_vk->vk_info;
1730 unsigned int i;
1731
1732 if (buffer->vk_command_buffer)
1733 {
1734 free_command_buffer(context_vk, buffer);
1735 buffer->vk_command_buffer = VK_NULL_HANDLE;
1736 }
1737
1739 context_vk->completed_command_buffer_id = buffer->id;
1740 for (i = 0; i < context_vk->completed.buffer_count; ++i)
1741 free_command_buffer(context_vk, &context_vk->completed.buffers[i]);
1742
1743 free(context_vk->compute.bindings.bindings);
1744 free(context_vk->graphics.bindings.bindings);
1745 for (i = 0; i < context_vk->vk_descriptor_pool_count; ++i)
1747 free(context_vk->vk_descriptor_pools);
1748 if (context_vk->vk_framebuffer)
1749 VK_CALL(vkDestroyFramebuffer(device_vk->vk_device, context_vk->vk_framebuffer, NULL));
1750 if (context_vk->vk_so_counter_bo.vk_buffer)
1751 wined3d_context_vk_destroy_bo(context_vk, &context_vk->vk_so_counter_bo);
1753 /* Destroy the command pool after cleaning up resources. In particular,
1754 * this needs to happen after all command buffers are freed, because
1755 * vkFreeCommandBuffers() requires a valid pool handle. */
1756 VK_CALL(vkDestroyCommandPool(device_vk->vk_device, context_vk->vk_command_pool, NULL));
1762 free(context_vk->submitted.buffers);
1763 free(context_vk->completed.buffers);
1764 free(context_vk->retired.objects);
1765
1770
1771 wined3d_context_cleanup(&context_vk->c);
1772}
1773
1774/* In general we only submit when necessary or when a frame ends. However,
1775 * applications which do a lot of work per frame can end up with the GPU idle
1776 * for long periods of time while the CPU is building commands, and drivers may
1777 * choose to reclock the GPU to a lower power level if they detect it being idle
1778 * for that long.
1779 *
1780 * This may also help performance simply by virtue of allowing more parallelism
1781 * between the GPU and CPU, although no clear evidence of that has been seen
1782 * yet. */
1783
1784#define WINED3D_PERIODIC_SUBMIT_WORK_COUNT 512
1785#define WINED3D_PERIODIC_SUBMIT_MAX_BUFFERS 3
1786
1787static bool should_periodic_submit(struct wined3d_context_vk *context_vk)
1788{
1789 uint64_t busy_count;
1790
1792 return false;
1793
1794 /* The point of periodic submit is to keep the GPU busy, so if it's already
1795 * busy with 4 or more command buffers, don't submit another one now. */
1796 busy_count = context_vk->current_command_buffer.id - context_vk->completed_command_buffer_id - 1;
1797 if (busy_count > WINED3D_PERIODIC_SUBMIT_MAX_BUFFERS)
1798 return false;
1799
1800 TRACE("Periodically submitting command buffer, %u draw/dispatch commands since last buffer, %I64u currently busy.\n",
1801 context_vk->command_buffer_work_count, busy_count);
1802 return true;
1803}
1804
1806{
1807 struct wined3d_device_vk *device_vk = wined3d_device_vk(context_vk->c.device);
1808 const struct wined3d_vk_info *vk_info = context_vk->vk_info;
1810 VkCommandBufferBeginInfo begin_info;
1811 struct wined3d_query_vk *query_vk;
1812 VkResult vr;
1813
1814 TRACE("context_vk %p.\n", context_vk);
1815
1816 buffer = &context_vk->current_command_buffer;
1817 if (buffer->vk_command_buffer)
1818 {
1821 else
1822 {
1823 TRACE("Returning existing command buffer %p with id 0x%s.\n",
1824 buffer->vk_command_buffer, wine_dbgstr_longlong(buffer->id));
1825 return buffer->vk_command_buffer;
1826 }
1827 }
1828
1829 if (context_vk->completed.buffer_count)
1830 {
1831 const struct wined3d_command_buffer_vk *old_buffer;
1832
1833 old_buffer = &context_vk->completed.buffers[--context_vk->completed.buffer_count];
1834 buffer->vk_command_buffer = old_buffer->vk_command_buffer;
1835 buffer->vk_fence = old_buffer->vk_fence;
1836 }
1837 else
1838 {
1839 VkCommandBufferAllocateInfo command_buffer_info;
1840 VkFenceCreateInfo fence_desc;
1841
1843 fence_desc.pNext = NULL;
1844 fence_desc.flags = 0;
1845 if ((vr = VK_CALL(vkCreateFence(device_vk->vk_device, &fence_desc, NULL, &buffer->vk_fence))) < 0)
1846 {
1847 ERR("Failed to create fence, vr %s.\n", wined3d_debug_vkresult(vr));
1848 return VK_NULL_HANDLE;
1849 }
1850
1852 command_buffer_info.pNext = NULL;
1853 command_buffer_info.commandPool = context_vk->vk_command_pool;
1854 command_buffer_info.level = VK_COMMAND_BUFFER_LEVEL_PRIMARY;
1855 command_buffer_info.commandBufferCount = 1;
1856 if ((vr = VK_CALL(vkAllocateCommandBuffers(device_vk->vk_device,
1857 &command_buffer_info, &buffer->vk_command_buffer))) < 0)
1858 {
1859 WARN("Failed to allocate Vulkan command buffer, vr %s.\n", wined3d_debug_vkresult(vr));
1860 VK_CALL(vkDestroyFence(device_vk->vk_device, buffer->vk_fence, NULL));
1861 return VK_NULL_HANDLE;
1862 }
1863 }
1864
1866 begin_info.pNext = NULL;
1868 begin_info.pInheritanceInfo = NULL;
1869 if ((vr = VK_CALL(vkBeginCommandBuffer(buffer->vk_command_buffer, &begin_info))) < 0)
1870 {
1871 WARN("Failed to begin command buffer, vr %s.\n", wined3d_debug_vkresult(vr));
1872 VK_CALL(vkFreeCommandBuffers(device_vk->vk_device, context_vk->vk_command_pool,
1873 1, &buffer->vk_command_buffer));
1874 return buffer->vk_command_buffer = VK_NULL_HANDLE;
1875 }
1876
1877 LIST_FOR_EACH_ENTRY(query_vk, &context_vk->active_queries, struct wined3d_query_vk, entry)
1878 {
1879 if (!wined3d_context_vk_allocate_query(context_vk, query_vk->q.type, &query_vk->pool_idx))
1880 {
1881 ERR("Failed to allocate new query.\n");
1882 break;
1883 }
1884
1885 wined3d_query_vk_resume(query_vk, context_vk);
1886 }
1887
1888 context_vk->command_buffer_work_count = 0;
1889
1890 TRACE("Created new command buffer %p with id 0x%s.\n",
1891 buffer->vk_command_buffer, wine_dbgstr_longlong(buffer->id));
1892
1893 return buffer->vk_command_buffer;
1894}
1895
1897 unsigned int wait_semaphore_count, const VkSemaphore *wait_semaphores, const VkPipelineStageFlags *wait_stages,
1898 unsigned int signal_semaphore_count, const VkSemaphore *signal_semaphores)
1899{
1900 struct wined3d_device_vk *device_vk = wined3d_device_vk(context_vk->c.device);
1901 const struct wined3d_vk_info *vk_info = context_vk->vk_info;
1902 struct wined3d_query_pool_vk *pool_vk, *pool_vk_next;
1904 struct wined3d_query_vk *query_vk;
1905 VkSubmitInfo submit_info;
1906 VkResult vr;
1907
1908 TRACE("context_vk %p, wait_semaphore_count %u, wait_semaphores %p, wait_stages %p,"
1909 "signal_semaphore_count %u, signal_semaphores %p.\n",
1910 context_vk, wait_semaphore_count, wait_semaphores, wait_stages,
1911 signal_semaphore_count, signal_semaphores);
1912
1913 buffer = &context_vk->current_command_buffer;
1914 if (!buffer->vk_command_buffer)
1915 return;
1916
1917 TRACE("Submitting command buffer %p with id 0x%s.\n",
1918 buffer->vk_command_buffer, wine_dbgstr_longlong(buffer->id));
1919
1921
1922 LIST_FOR_EACH_ENTRY_SAFE(pool_vk, pool_vk_next, &context_vk->completed_query_pools,
1923 struct wined3d_query_pool_vk, completed_entry)
1924 {
1925 list_remove(&pool_vk->completed_entry);
1926 list_init(&pool_vk->completed_entry);
1927
1929 }
1930
1931 LIST_FOR_EACH_ENTRY(query_vk, &context_vk->active_queries, struct wined3d_query_vk, entry)
1932 wined3d_query_vk_suspend(query_vk, context_vk);
1933
1934 context_vk->graphics.vk_pipeline = VK_NULL_HANDLE;
1935 context_vk->update_compute_pipeline = 1;
1936 context_vk->update_stream_output = 1;
1937 context_vk->c.update_shader_resource_bindings = 1;
1938 context_vk->c.update_compute_shader_resource_bindings = 1;
1939 context_vk->c.update_unordered_access_view_bindings = 1;
1940 context_vk->c.update_compute_unordered_access_view_bindings = 1;
1941 context_vk->c.update_primitive_type = 1;
1942 context_vk->c.update_patch_vertex_count = 1;
1943 context_vk->c.update_multisample_state = 1;
1946 context_invalidate_state(&context_vk->c, STATE_BLEND);
1953
1954 VK_CALL(vkEndCommandBuffer(buffer->vk_command_buffer));
1955
1956 VK_CALL(vkResetFences(device_vk->vk_device, 1, &buffer->vk_fence));
1957
1959 submit_info.pNext = NULL;
1960 submit_info.waitSemaphoreCount = wait_semaphore_count;
1961 submit_info.pWaitSemaphores = wait_semaphores;
1962 submit_info.pWaitDstStageMask = wait_stages;
1963 submit_info.commandBufferCount = 1;
1964 submit_info.pCommandBuffers = &buffer->vk_command_buffer;
1965 submit_info.signalSemaphoreCount = signal_semaphore_count;
1966 submit_info.pSignalSemaphores = signal_semaphores;
1967
1968 if ((vr = VK_CALL(vkQueueSubmit(device_vk->vk_queue, 1, &submit_info, buffer->vk_fence))) < 0)
1969 ERR("Failed to submit command buffer %p, vr %s.\n",
1970 buffer->vk_command_buffer, wined3d_debug_vkresult(vr));
1971
1972 if (!wined3d_array_reserve((void **)&context_vk->submitted.buffers, &context_vk->submitted.buffers_size,
1973 context_vk->submitted.buffer_count + 1, sizeof(*context_vk->submitted.buffers)))
1974 ERR("Failed to grow submitted command buffer array.\n");
1975
1976 context_vk->submitted.buffers[context_vk->submitted.buffer_count++] = *buffer;
1977
1978 buffer->vk_command_buffer = VK_NULL_HANDLE;
1979 /* We don't expect this to ever happen, but handle it anyway. */
1980 if (!++buffer->id)
1981 {
1983 context_vk->completed_command_buffer_id = 0;
1984 buffer->id = 1;
1985 }
1986 context_vk->retired_bo_size = 0;
1988}
1989
1991{
1992 struct wined3d_device_vk *device_vk = wined3d_device_vk(context_vk->c.device);
1993 const struct wined3d_vk_info *vk_info = context_vk->vk_info;
1994 VkFence vk_fence;
1995 SIZE_T i;
1996
1997 if (id <= context_vk->completed_command_buffer_id
1998 || id > context_vk->current_command_buffer.id) /* In case the buffer ID wrapped. */
1999 return;
2000
2001 for (i = 0; i < context_vk->submitted.buffer_count; ++i)
2002 {
2003 if (context_vk->submitted.buffers[i].id != id)
2004 continue;
2005
2006 vk_fence = context_vk->submitted.buffers[i].vk_fence;
2007 wined3d_context_vk_cleanup_resources(context_vk, vk_fence);
2008 for (i = 0; i < context_vk->submitted.buffer_count; ++i)
2009 {
2010 if (context_vk->submitted.buffers[i].id != id)
2011 continue;
2012
2013 VK_CALL(vkWaitForFences(device_vk->vk_device, 1, &vk_fence, VK_TRUE, UINT64_MAX));
2015 return;
2016 }
2017 }
2018
2019 ERR("Failed to find fence for command buffer with id 0x%s.\n", wine_dbgstr_longlong(id));
2020}
2021
2023 VkCommandBuffer vk_command_buffer, VkPipelineStageFlags src_stage_mask, VkPipelineStageFlags dst_stage_mask,
2024 VkAccessFlags src_access_mask, VkAccessFlags dst_access_mask, VkImageLayout old_layout,
2025 VkImageLayout new_layout, VkImage image, const VkImageSubresourceRange *range)
2026{
2027 const struct wined3d_vk_info *vk_info = context_vk->vk_info;
2028 VkImageMemoryBarrier barrier;
2029
2031
2033 barrier.pNext = NULL;
2034 barrier.srcAccessMask = src_access_mask;
2035 barrier.dstAccessMask = dst_access_mask;
2036 barrier.oldLayout = old_layout;
2037 barrier.newLayout = new_layout;
2040 barrier.image = image;
2041 barrier.subresourceRange = *range;
2042
2043 VK_CALL(vkCmdPipelineBarrier(vk_command_buffer, src_stage_mask, dst_stage_mask, 0, 0, NULL, 0, NULL, 1, &barrier));
2044}
2045
2046static int wined3d_render_pass_vk_compare(const void *key, const struct wine_rb_entry *entry)
2047{
2048 const struct wined3d_render_pass_key_vk *k = key;
2050 const struct wined3d_render_pass_vk, entry);
2051
2052 return memcmp(k, &pass->key, sizeof(*k));
2053}
2054
2055static int wined3d_pipeline_layout_vk_compare(const void *key, const struct wine_rb_entry *entry)
2056{
2057 const struct wined3d_pipeline_layout_key_vk *a = key;
2059 const struct wined3d_pipeline_layout_vk, entry)->key;
2060 int ret;
2061
2062 if ((ret = wined3d_uint32_compare(a->binding_count, b->binding_count)))
2063 return ret;
2064 return memcmp(a->bindings, b->bindings, a->binding_count * sizeof(*a->bindings));
2065}
2066
2067static int wined3d_graphics_pipeline_vk_compare(const void *key, const struct wine_rb_entry *entry)
2068{
2069 const struct wined3d_graphics_pipeline_key_vk *a = key;
2071 const struct wined3d_graphics_pipeline_vk, entry)->key;
2072 unsigned int i;
2073 int ret;
2074
2075 if ((ret = wined3d_uint32_compare(a->pipeline_desc.stageCount, b->pipeline_desc.stageCount)))
2076 return ret;
2077 for (i = 0; i < a->pipeline_desc.stageCount; ++i)
2078 {
2079 if ((ret = wined3d_uint64_compare(a->stages[i].module, b->stages[i].module)))
2080 return ret;
2081 }
2082
2083 if ((ret = wined3d_uint32_compare(a->divisor_desc.vertexBindingDivisorCount,
2084 b->divisor_desc.vertexBindingDivisorCount)))
2085 return ret;
2086 if ((ret = memcmp(a->divisors, b->divisors,
2087 a->divisor_desc.vertexBindingDivisorCount * sizeof(*a->divisors))))
2088 return ret;
2089
2090 if ((ret = wined3d_uint32_compare(a->input_desc.vertexAttributeDescriptionCount,
2091 b->input_desc.vertexAttributeDescriptionCount)))
2092 return ret;
2093 if ((ret = memcmp(a->attributes, b->attributes,
2094 a->input_desc.vertexAttributeDescriptionCount * sizeof(*a->attributes))))
2095 return ret;
2096 if ((ret = wined3d_uint32_compare(a->input_desc.vertexBindingDescriptionCount,
2097 b->input_desc.vertexBindingDescriptionCount)))
2098 return ret;
2099 if ((ret = memcmp(a->bindings, b->bindings,
2100 a->input_desc.vertexBindingDescriptionCount * sizeof(*a->bindings))))
2101 return ret;
2102
2103 if ((ret = wined3d_uint32_compare(a->ia_desc.topology, b->ia_desc.topology)))
2104 return ret;
2105 if ((ret = wined3d_uint32_compare(a->ia_desc.primitiveRestartEnable, b->ia_desc.primitiveRestartEnable)))
2106 return ret;
2107
2108 if ((ret = wined3d_uint32_compare(a->ts_desc.patchControlPoints, b->ts_desc.patchControlPoints)))
2109 return ret;
2110
2111 if ((ret = memcmp(&a->rs_desc, &b->rs_desc, sizeof(a->rs_desc))))
2112 return ret;
2113
2114 if ((ret = wined3d_uint32_compare(a->ms_desc.rasterizationSamples, b->ms_desc.rasterizationSamples)))
2115 return ret;
2116 if ((ret = wined3d_uint32_compare(a->ms_desc.alphaToCoverageEnable, b->ms_desc.alphaToCoverageEnable)))
2117 return ret;
2118 if ((ret = wined3d_uint32_compare(a->sample_mask, b->sample_mask)))
2119 return ret;
2120
2121 if ((ret = memcmp(&a->ds_desc, &b->ds_desc, sizeof(a->ds_desc))))
2122 return ret;
2123
2124 if ((ret = wined3d_uint32_compare(a->blend_desc.attachmentCount, b->blend_desc.attachmentCount)))
2125 return ret;
2126 if ((ret = memcmp(a->blend_attachments, b->blend_attachments,
2127 a->blend_desc.attachmentCount * sizeof(*a->blend_attachments))))
2128 return ret;
2129
2130 if ((ret = wined3d_uint64_compare(a->pipeline_desc.layout, b->pipeline_desc.layout)))
2131 return ret;
2132
2133 if ((ret = wined3d_uint64_compare(a->pipeline_desc.renderPass, b->pipeline_desc.renderPass)))
2134 return ret;
2135
2136 return 0;
2137}
2138
2139static int wined3d_bo_slab_vk_compare(const void *key, const struct wine_rb_entry *entry)
2140{
2141 const struct wined3d_bo_slab_vk *slab = WINE_RB_ENTRY_VALUE(entry, const struct wined3d_bo_slab_vk, entry);
2142 const struct wined3d_bo_slab_vk_key *k = key;
2143 int ret;
2144
2145 if ((ret = wined3d_uint32_compare(k->memory_type, slab->requested_memory_type)))
2146 return ret;
2147 if ((ret = wined3d_uint32_compare(k->usage, slab->bo.usage)))
2148 return ret;
2149 return wined3d_uint64_compare(k->size, slab->bo.size);
2150}
2151
2153{
2154 const struct wined3d_vk_info *vk_info = context_vk->vk_info;
2155 VkDynamicState *dynamic_states = context_vk->dynamic_states;
2158 uint32_t dynamic_state_count = 0;
2159 unsigned int i;
2160
2161 dynamic_states[dynamic_state_count++] = VK_DYNAMIC_STATE_BLEND_CONSTANTS;
2162 dynamic_states[dynamic_state_count++] = VK_DYNAMIC_STATE_STENCIL_REFERENCE;
2163 dynamic_states[dynamic_state_count++] = VK_DYNAMIC_STATE_VIEWPORT;
2164 dynamic_states[dynamic_state_count++] = VK_DYNAMIC_STATE_SCISSOR;
2165
2167 {
2168 dynamic_states[dynamic_state_count++] = VK_DYNAMIC_STATE_DEPTH_TEST_ENABLE_EXT;
2169 dynamic_states[dynamic_state_count++] = VK_DYNAMIC_STATE_DEPTH_WRITE_ENABLE_EXT;
2170 dynamic_states[dynamic_state_count++] = VK_DYNAMIC_STATE_DEPTH_COMPARE_OP_EXT;
2171 dynamic_states[dynamic_state_count++] = VK_DYNAMIC_STATE_STENCIL_TEST_ENABLE_EXT;
2172 dynamic_states[dynamic_state_count++] = VK_DYNAMIC_STATE_STENCIL_OP_EXT;
2173 dynamic_states[dynamic_state_count++] = VK_DYNAMIC_STATE_STENCIL_COMPARE_MASK;
2174 dynamic_states[dynamic_state_count++] = VK_DYNAMIC_STATE_STENCIL_WRITE_MASK;
2175 }
2176 if (vk_info->dynamic_state2)
2177 {
2178 dynamic_states[dynamic_state_count++] = VK_DYNAMIC_STATE_PRIMITIVE_TOPOLOGY_EXT;
2179 if (!(context_vk->c.d3d_info->wined3d_creation_flags & WINED3D_NO_PRIMITIVE_RESTART))
2180 dynamic_states[dynamic_state_count++] = VK_DYNAMIC_STATE_PRIMITIVE_RESTART_ENABLE_EXT;
2181 }
2182 if (vk_info->dynamic_patch_vertex_count)
2183 dynamic_states[dynamic_state_count++] = VK_DYNAMIC_STATE_PATCH_CONTROL_POINTS_EXT;
2184 if (vk_info->dynamic_multisample_state)
2185 {
2186 dynamic_states[dynamic_state_count++] = VK_DYNAMIC_STATE_ALPHA_TO_COVERAGE_ENABLE_EXT;
2187 dynamic_states[dynamic_state_count++] = VK_DYNAMIC_STATE_RASTERIZATION_SAMPLES_EXT;
2188 dynamic_states[dynamic_state_count++] = VK_DYNAMIC_STATE_SAMPLE_MASK_EXT;
2189 }
2190 if (vk_info->dynamic_blend_state)
2191 {
2192 dynamic_states[dynamic_state_count++] = VK_DYNAMIC_STATE_COLOR_BLEND_ENABLE_EXT;
2193 dynamic_states[dynamic_state_count++] = VK_DYNAMIC_STATE_COLOR_BLEND_EQUATION_EXT;
2194 dynamic_states[dynamic_state_count++] = VK_DYNAMIC_STATE_COLOR_WRITE_MASK_EXT;
2195 }
2196 if (vk_info->dynamic_rasterizer_state)
2197 {
2198 dynamic_states[dynamic_state_count++] = VK_DYNAMIC_STATE_DEPTH_CLAMP_ENABLE_EXT;
2199 dynamic_states[dynamic_state_count++] = VK_DYNAMIC_STATE_RASTERIZER_DISCARD_ENABLE_EXT;
2200 dynamic_states[dynamic_state_count++] = VK_DYNAMIC_STATE_CULL_MODE_EXT;
2201 dynamic_states[dynamic_state_count++] = VK_DYNAMIC_STATE_FRONT_FACE_EXT;
2202 dynamic_states[dynamic_state_count++] = VK_DYNAMIC_STATE_DEPTH_BIAS_ENABLE_EXT;
2203 dynamic_states[dynamic_state_count++] = VK_DYNAMIC_STATE_DEPTH_BIAS;
2204 }
2205
2206 key = &context_vk->graphics.pipeline_key_vk;
2207 memset(key, 0, sizeof(*key));
2208
2209 for (i = 0; i < ARRAY_SIZE(context_vk->graphics.vk_modules); ++i)
2210 {
2211 stage = &key->stages[i];
2213 stage->pName = "main";
2214 }
2215
2217 key->input_desc.pVertexBindingDescriptions = key->bindings;
2218 key->input_desc.pVertexAttributeDescriptions = key->attributes;
2219
2221 key->divisor_desc.pVertexBindingDivisors = key->divisors;
2222
2224
2226
2228 key->vp_desc.viewportCount = (context_vk->vk_info->multiple_viewports ? WINED3D_MAX_VIEWPORTS : 1);
2229 key->vp_desc.scissorCount = key->vp_desc.viewportCount;
2230
2232 key->rs_desc.lineWidth = 1.0f;
2233
2235 key->ms_desc.pSampleMask = &key->sample_mask;
2236 /* This has to be initialized to a nonzero value even if it's dynamic. */
2237 key->ms_desc.rasterizationSamples = 1;
2238
2240 key->ds_desc.maxDepthBounds = 1.0f;
2241
2243 key->blend_desc.logicOp = VK_LOGIC_OP_COPY;
2244 key->blend_desc.pAttachments = key->blend_attachments;
2245 key->blend_desc.blendConstants[0] = 1.0f;
2246 key->blend_desc.blendConstants[1] = 1.0f;
2247 key->blend_desc.blendConstants[2] = 1.0f;
2248 key->blend_desc.blendConstants[3] = 1.0f;
2249
2251 key->dynamic_desc.dynamicStateCount = dynamic_state_count;
2252 key->dynamic_desc.pDynamicStates = dynamic_states;
2253
2255 key->pipeline_desc.pStages = key->stages;
2256 key->pipeline_desc.pVertexInputState = &key->input_desc;
2257 key->pipeline_desc.pInputAssemblyState = &key->ia_desc;
2258 key->pipeline_desc.pTessellationState = &key->ts_desc;
2259 key->pipeline_desc.pViewportState = &key->vp_desc;
2260 key->pipeline_desc.pRasterizationState = &key->rs_desc;
2261 key->pipeline_desc.pMultisampleState = &key->ms_desc;
2262 key->pipeline_desc.pDepthStencilState = &key->ds_desc;
2263 key->pipeline_desc.pColorBlendState = &key->blend_desc;
2264 key->pipeline_desc.pDynamicState = &key->dynamic_desc;
2265 key->pipeline_desc.basePipelineIndex = -1;
2266}
2267
2269 const struct wined3d_state *state, const struct wined3d_d3d_info *d3d_info)
2270{
2271 const struct wined3d_rasterizer_state_desc *r;
2272 float scale_bias;
2273 union
2274 {
2275 uint32_t u32;
2276 float f32;
2277 } const_bias;
2278
2279 if (!state->rasterizer_state)
2280 {
2281 desc->depthClampEnable = VK_FALSE;
2282 desc->rasterizerDiscardEnable = is_rasterization_disabled(state->shader[WINED3D_SHADER_TYPE_GEOMETRY]);
2283 desc->cullMode = VK_CULL_MODE_BACK_BIT;
2284 desc->frontFace = VK_FRONT_FACE_CLOCKWISE;
2285 desc->depthBiasEnable = VK_FALSE;
2286 desc->depthBiasConstantFactor = 0.0f;
2287 desc->depthBiasClamp = 0.0f;
2288 desc->depthBiasSlopeFactor = 0.0f;
2289
2290 return;
2291 }
2292
2293 r = &state->rasterizer_state->desc;
2294 desc->depthClampEnable = !r->depth_clip;
2295 desc->rasterizerDiscardEnable = is_rasterization_disabled(state->shader[WINED3D_SHADER_TYPE_GEOMETRY]);
2296 desc->cullMode = vk_cull_mode_from_wined3d(r->cull_mode);
2298
2299 scale_bias = r->scale_bias;
2300 const_bias.f32 = r->depth_bias;
2301 if (!scale_bias && !const_bias.f32)
2302 {
2303 desc->depthBiasEnable = VK_FALSE;
2304 desc->depthBiasConstantFactor = 0.0f;
2305 desc->depthBiasClamp = 0.0f;
2306 desc->depthBiasSlopeFactor = 0.0f;
2307
2308 return;
2309 }
2310
2311 desc->depthBiasEnable = VK_TRUE;
2313 {
2314 const struct wined3d_rendertarget_view *dsv;
2315
2316 if ((dsv = state->fb.depth_stencil))
2317 {
2318 desc->depthBiasConstantFactor = -(float)const_bias.u32 / dsv->format->depth_bias_scale;
2319 desc->depthBiasSlopeFactor = -(float)const_bias.u32;
2320 }
2321 else
2322 {
2323 desc->depthBiasConstantFactor = 0.0f;
2324 desc->depthBiasSlopeFactor = 0.0f;
2325 }
2326 }
2327 else
2328 {
2329 desc->depthBiasConstantFactor = const_bias.f32;
2330 desc->depthBiasSlopeFactor = scale_bias;
2331 }
2332 desc->depthBiasClamp = r->depth_bias_clamp;
2333}
2334
2336 VkCommandBuffer vk_command_buffer, const struct wined3d_vk_info *vk_info, const struct wined3d_state *state)
2337{
2339
2340 rasterizer_state_from_wined3d(&desc, state, context_vk->c.d3d_info);
2341
2342 VK_CALL(vkCmdSetRasterizerDiscardEnableEXT(vk_command_buffer, desc.rasterizerDiscardEnable));
2343 VK_CALL(vkCmdSetDepthClampEnableEXT(vk_command_buffer, desc.depthClampEnable));
2344 VK_CALL(vkCmdSetCullModeEXT(vk_command_buffer, desc.cullMode));
2345 VK_CALL(vkCmdSetFrontFaceEXT(vk_command_buffer, desc.frontFace));
2346 VK_CALL(vkCmdSetDepthBiasEnableEXT(vk_command_buffer, desc.depthBiasEnable));
2347
2348 if (desc.depthBiasEnable)
2349 VK_CALL(vkCmdSetDepthBias(vk_command_buffer, desc.depthBiasConstantFactor,
2350 desc.depthBiasClamp, desc.depthBiasSlopeFactor));
2351}
2352
2354 const struct wined3d_rendertarget_blend_state_desc *rt, const struct wined3d_rendertarget_view *rtv)
2355{
2356 enum wined3d_blend src_blend, dst_blend;
2357 const struct wined3d_format *rt_format;
2358
2359 if (rtv)
2360 rt_format = rtv->format;
2361 else
2362 rt_format = wined3d_get_format(context_vk->c.device->adapter, WINED3DFMT_NULL, 0);
2363
2364 src_blend = rt->src;
2365 dst_blend = rt->dst;
2366 if (src_blend == WINED3D_BLEND_BOTHSRCALPHA)
2367 {
2368 src_blend = WINED3D_BLEND_SRCALPHA;
2369 dst_blend = WINED3D_BLEND_INVSRCALPHA;
2370 }
2371 else if (src_blend == WINED3D_BLEND_BOTHINVSRCALPHA)
2372 {
2373 src_blend = WINED3D_BLEND_INVSRCALPHA;
2374 dst_blend = WINED3D_BLEND_SRCALPHA;
2375 }
2376 eq->srcColorBlendFactor = vk_blend_factor_from_wined3d(src_blend, rt_format, false);
2377 eq->dstColorBlendFactor = vk_blend_factor_from_wined3d(dst_blend, rt_format, false);
2378 eq->colorBlendOp = vk_blend_op_from_wined3d(rt->op);
2379
2380 src_blend = rt->src_alpha;
2381 dst_blend = rt->dst_alpha;
2382 eq->srcAlphaBlendFactor = vk_blend_factor_from_wined3d(src_blend, rt_format, true);
2383 eq->dstAlphaBlendFactor = vk_blend_factor_from_wined3d(dst_blend, rt_format, true);
2384 eq->alphaBlendOp = vk_blend_op_from_wined3d(rt->op_alpha);
2385}
2386
2389{
2391 const struct wined3d_blend_state_desc *b;
2392 unsigned int i;
2393
2394 desc->attachmentCount = context_vk->rt_count;
2395
2396 memset(key->blend_attachments, 0, sizeof(key->blend_attachments));
2397 if (!state->blend_state)
2398 {
2399 for (i = 0; i < context_vk->rt_count; ++i)
2400 {
2401 key->blend_attachments[i].colorWriteMask = VK_COLOR_COMPONENT_R_BIT
2405 }
2406
2407 return;
2408 }
2409
2410 b = &state->blend_state->desc;
2411 for (i = 0; i < context_vk->rt_count; ++i)
2412 {
2413 const struct wined3d_rendertarget_blend_state_desc *rt = &b->rt[b->independent ? i : 0];
2414 VkPipelineColorBlendAttachmentState *a = &key->blend_attachments[i];
2415
2416 a->colorWriteMask = vk_colour_write_mask_from_wined3d(rt->writemask);
2417 if (!rt->enable)
2418 continue;
2419
2420 a->blendEnable = VK_TRUE;
2421
2422 blend_equation_from_wined3d(context_vk,
2423 (VkColorBlendEquationEXT *)&a->srcColorBlendFactor, rt, state->fb.render_targets[i]);
2424 }
2425}
2426
2428 VkCommandBuffer vk_command_buffer, const struct wined3d_vk_info *vk_info, const struct wined3d_state *state)
2429{
2432 unsigned int rt_count = context_vk->rt_count;
2434 const struct wined3d_blend_state_desc *b;
2435
2436 if (!state->blend_state)
2437 {
2438 static const VkBool32 default_enable[WINED3D_MAX_RENDER_TARGETS];
2439#define X (VK_COLOR_COMPONENT_R_BIT | VK_COLOR_COMPONENT_G_BIT | VK_COLOR_COMPONENT_B_BIT | VK_COLOR_COMPONENT_A_BIT)
2440 static const VkColorComponentFlags default_write_mask[WINED3D_MAX_RENDER_TARGETS] = {X, X, X, X, X, X, X, X};
2441#undef X
2442
2443 VK_CALL(vkCmdSetColorBlendEnableEXT(vk_command_buffer, 0, rt_count, default_enable));
2444 VK_CALL(vkCmdSetColorWriteMaskEXT(vk_command_buffer, 0, rt_count, default_write_mask));
2445 return;
2446 }
2447
2448 b = &state->blend_state->desc;
2449 for (unsigned int i = 0; i < rt_count; ++i)
2450 {
2451 const struct wined3d_rendertarget_blend_state_desc *rt = &b->rt[b->independent ? i : 0];
2452
2453 write_mask[i] = vk_colour_write_mask_from_wined3d(rt->writemask);
2454 enable[i] = rt->enable;
2455
2456 if (!rt->enable)
2457 continue;
2458
2459 blend_equation_from_wined3d(context_vk, &equations[i], rt, state->fb.render_targets[i]);
2460 }
2461
2462 VK_CALL(vkCmdSetColorBlendEnableEXT(vk_command_buffer, 0, rt_count, enable));
2463 VK_CALL(vkCmdSetColorWriteMaskEXT(vk_command_buffer, 0, rt_count, write_mask));
2464 VK_CALL(vkCmdSetColorBlendEquationEXT(vk_command_buffer, 0, rt_count, equations));
2465}
2466
2468{
2469 switch (component_type)
2470 {
2471 case WINED3D_TYPE_UINT:
2473 case WINED3D_TYPE_INT:
2476 case WINED3D_TYPE_FLOAT:
2478 }
2479 return VK_FORMAT_UNDEFINED;
2480}
2481
2483 const struct wined3d_state *state, VkPipelineLayout vk_pipeline_layout, uint32_t *null_buffer_binding)
2484{
2485 unsigned int i, attribute_count, binding_count, divisor_count, stage_count;
2486 const struct wined3d_d3d_info *d3d_info = context_vk->c.d3d_info;
2487 const struct wined3d_vk_info *vk_info = context_vk->vk_info;
2491 struct wined3d_shader *vertex_shader;
2492 VkPrimitiveTopology vk_topology;
2493 VkShaderModule module;
2494 bool update = false;
2495 uint32_t mask;
2496
2497 *null_buffer_binding = ~0u;
2498 key = &context_vk->graphics.pipeline_key_vk;
2499
2500 if (context_vk->c.shader_update_mask & ~(1u << WINED3D_SHADER_TYPE_COMPUTE))
2501 {
2502 stage_count = 0;
2503 for (i = 0; i < ARRAY_SIZE(context_vk->graphics.vk_modules); ++i)
2504 {
2505 if (!(module = context_vk->graphics.vk_modules[i]))
2506 continue;
2507
2508 stage = &key->stages[stage_count++];
2510 stage->module = module;
2511 }
2512
2513 key->pipeline_desc.stageCount = stage_count;
2514
2515 update = true;
2516 }
2517
2521 {
2524
2526 divisor_count = 0;
2527 for (i = 0, mask = 0, attribute_count = 0, binding_count = 0; i < ARRAY_SIZE(stream_info.elements); ++i)
2528 {
2532
2533 if (!(stream_info.use_map & (1u << i)))
2534 continue;
2535
2536 a = &key->attributes[attribute_count++];
2537 e = &stream_info.elements[i];
2538 binding = e->stream_idx;
2539
2540 a->location = i;
2541 a->binding = binding;
2542 a->format = wined3d_format_vk(e->format)->vk_format;
2543 a->offset = (UINT_PTR)e->data.addr - state->streams[binding].offset;
2544
2545 if (mask & (1u << binding))
2546 continue;
2547 mask |= 1u << binding;
2548
2549 b = &key->bindings[binding_count++];
2550 b->binding = binding;
2551 b->stride = e->stride;
2553
2554 if (e->instanced)
2555 {
2556 d = &key->divisors[divisor_count++];
2557 d->binding = binding;
2558 d->divisor = e->divisor;
2559 }
2560 }
2561
2562 vertex_shader = state->shader[WINED3D_SHADER_TYPE_VERTEX];
2563 if (vertex_shader && (mask = ~stream_info.use_map & vertex_shader->reg_maps.input_registers))
2564 {
2567 uint32_t null_binding, location;
2568
2569 if (!wined3d_get_unused_stream_index(state, &null_binding))
2570 {
2571 ERR("No streams left for a null buffer binding.\n");
2572 }
2573 else
2574 {
2575 signature = &vertex_shader->input_signature;
2576 for (i = 0; i < signature->element_count; ++i)
2577 {
2578 element = &signature->elements[i];
2579 location = element->register_idx;
2580
2581 if (!(mask & (1u << location)) || element->sysval_semantic)
2582 continue;
2583 mask &= ~(1u << location);
2584
2585 a = &key->attributes[attribute_count++];
2586 a->location = location;
2587 a->binding = null_binding;
2588 a->format = vk_format_from_component_type(element->component_type);
2589 a->offset = 0;
2590 }
2591
2592 if (mask != (~stream_info.use_map & vertex_shader->reg_maps.input_registers))
2593 {
2594 b = &key->bindings[binding_count++];
2595 *null_buffer_binding = b->binding = null_binding;
2596 b->stride = 0;
2597 b->inputRate = VK_VERTEX_INPUT_RATE_VERTEX;
2598 }
2599 }
2600 }
2601
2602 key->input_desc.pNext = NULL;
2603 key->input_desc.vertexBindingDescriptionCount = binding_count;
2604 key->input_desc.vertexAttributeDescriptionCount = attribute_count;
2605
2606 if (divisor_count)
2607 {
2608 key->input_desc.pNext = &key->divisor_desc;
2609 key->divisor_desc.vertexBindingDivisorCount = divisor_count;
2610 }
2611
2612 update = true;
2613 }
2614
2615 if (vk_info->dynamic_state2)
2616 {
2617 vk_topology = vk_topology_class_from_wined3d(state->primitive_type);
2618 if (key->ia_desc.topology != vk_topology)
2619 {
2620 key->ia_desc.topology = vk_topology;
2621 update = true;
2622 }
2623 }
2624 else
2625 {
2626 vk_topology = vk_topology_from_wined3d(state->primitive_type);
2627 if (key->ia_desc.topology != vk_topology)
2628 {
2629 key->ia_desc.topology = vk_topology;
2630 key->ia_desc.primitiveRestartEnable = !(d3d_info->wined3d_creation_flags & WINED3D_NO_PRIMITIVE_RESTART)
2631 && !wined3d_primitive_type_is_list(state->primitive_type);
2632
2633 update = true;
2634 }
2635 }
2636
2637 if (!vk_info->dynamic_patch_vertex_count && key->ts_desc.patchControlPoints != state->patch_vertex_count)
2638 {
2639 key->ts_desc.patchControlPoints = state->patch_vertex_count;
2640
2641 update = true;
2642 }
2643
2646 {
2647 rasterizer_state_from_wined3d(&key->rs_desc, state, d3d_info);
2648
2649 update = true;
2650 }
2651
2652 if (!vk_info->dynamic_multisample_state
2653 && (key->ms_desc.rasterizationSamples != context_vk->sample_count
2654 || isStateDirty(&context_vk->c, STATE_BLEND) || isStateDirty(&context_vk->c, STATE_SAMPLE_MASK)))
2655 {
2656 key->ms_desc.rasterizationSamples = context_vk->sample_count;
2657 key->ms_desc.alphaToCoverageEnable = state->blend_state && state->blend_state->desc.alpha_to_coverage;
2658 key->sample_mask = state->sample_mask;
2659
2660 update = true;
2661 }
2662
2666 {
2667 const struct wined3d_depth_stencil_state *d = state->depth_stencil_state;
2668
2669 if (d)
2670 {
2671 key->ds_desc.depthTestEnable = d->desc.depth;
2672 key->ds_desc.depthWriteEnable = d->desc.depth_write;
2673 key->ds_desc.depthCompareOp = vk_compare_op_from_wined3d(d->desc.depth_func);
2674 key->ds_desc.stencilTestEnable = state->fb.depth_stencil && d->desc.stencil;
2675 if (key->ds_desc.stencilTestEnable)
2676 {
2677 key->ds_desc.front.failOp = vk_stencil_op_from_wined3d(d->desc.front.fail_op);
2678 key->ds_desc.front.passOp = vk_stencil_op_from_wined3d(d->desc.front.pass_op);
2679 key->ds_desc.front.depthFailOp = vk_stencil_op_from_wined3d(d->desc.front.depth_fail_op);
2680 key->ds_desc.front.compareOp = vk_compare_op_from_wined3d(d->desc.front.func);
2681 key->ds_desc.front.compareMask = d->desc.stencil_read_mask;
2682 key->ds_desc.front.writeMask = d->desc.stencil_write_mask;
2683
2684 key->ds_desc.back.failOp = vk_stencil_op_from_wined3d(d->desc.back.fail_op);
2685 key->ds_desc.back.passOp = vk_stencil_op_from_wined3d(d->desc.back.pass_op);
2686 key->ds_desc.back.depthFailOp = vk_stencil_op_from_wined3d(d->desc.back.depth_fail_op);
2687 key->ds_desc.back.compareOp = vk_compare_op_from_wined3d(d->desc.back.func);
2688 key->ds_desc.back.compareMask = d->desc.stencil_read_mask;
2689 key->ds_desc.back.writeMask = d->desc.stencil_write_mask;
2690 }
2691 else
2692 {
2693 memset(&key->ds_desc.front, 0, sizeof(key->ds_desc.front));
2694 memset(&key->ds_desc.back, 0, sizeof(key->ds_desc.back));
2695 }
2696 }
2697 else
2698 {
2699 key->ds_desc.depthTestEnable = VK_TRUE;
2700 key->ds_desc.depthWriteEnable = VK_TRUE;
2701 key->ds_desc.depthCompareOp = VK_COMPARE_OP_LESS;
2702 key->ds_desc.stencilTestEnable = VK_FALSE;
2703 }
2704
2705 update = true;
2706 }
2707
2708 if (!vk_info->dynamic_blend_state
2711 {
2713
2714 update = true;
2715 }
2716
2717 if (key->pipeline_desc.layout != vk_pipeline_layout)
2718 {
2719 key->pipeline_desc.layout = vk_pipeline_layout;
2720
2721 update = true;
2722 }
2723
2724 if (key->pipeline_desc.renderPass != context_vk->vk_render_pass)
2725 {
2726 key->pipeline_desc.renderPass = context_vk->vk_render_pass;
2727
2728 update = true;
2729 }
2730
2731 return update;
2732}
2733
2735 const struct wined3d_state *state, const struct wined3d_vk_info *vk_info)
2736{
2737 struct wined3d_device_vk *device_vk = wined3d_device_vk(context_vk->c.device);
2738 VkClearValue clear_values[WINED3D_MAX_RENDER_TARGETS + 1];
2739 VkImageView vk_views[WINED3D_MAX_RENDER_TARGETS + 1];
2740 unsigned int fb_width, fb_height, fb_layer_count;
2741 struct wined3d_rendertarget_view_vk *rtv_vk;
2743 const VkPhysicalDeviceLimits *limits;
2744 struct wined3d_query_vk *query_vk;
2745 VkCommandBuffer vk_command_buffer;
2746 VkRenderPassBeginInfo begin_info;
2747 unsigned int attachment_count, i;
2748 struct wined3d_texture *texture;
2750 VkResult vr;
2751
2752 if (context_vk->vk_render_pass)
2753 return true;
2754
2755 limits = &wined3d_adapter_vk(device_vk->d.adapter)->device_limits;
2756 fb_width = limits->maxFramebufferWidth;
2757 fb_height = limits->maxFramebufferHeight;
2758 fb_layer_count = limits->maxFramebufferLayers;
2759 attachment_count = 0;
2760
2761 context_vk->rt_count = 0;
2762 begin_info.clearValueCount = 0;
2763 for (i = 0; i < ARRAY_SIZE(state->fb.render_targets); ++i)
2764 {
2765 if (!(view = state->fb.render_targets[i]) || view->format->id == WINED3DFMT_NULL)
2766 continue;
2767
2769
2770 if (rtv_vk->v.resource->bind_count)
2771 {
2772 struct wined3d_texture_vk *texture_vk;
2773 texture_vk = wined3d_texture_vk(wined3d_texture_from_resource(rtv_vk->v.resource));
2774 wined3d_texture_vk_make_generic(texture_vk, context_vk);
2775 }
2776
2777 vk_views[attachment_count] = wined3d_rendertarget_view_vk_get_image_view(rtv_vk, context_vk);
2780
2781 if (view->width < fb_width)
2782 fb_width = view->width;
2783 if (view->height < fb_height)
2784 fb_height = view->height;
2785 if (view->layer_count < fb_layer_count)
2786 fb_layer_count = view->layer_count;
2787 context_vk->rt_count = i + 1;
2788
2790 {
2791 VkClearColorValue *c = &clear_values[attachment_count].color;
2792
2793 if (view->resource->type == WINED3D_RTYPE_BUFFER)
2794 {
2795 c->int32[0] = c->int32[1] = c->int32[2] = c->int32[3] = 0;
2796 }
2797 else
2798 {
2799 texture = texture_from_resource(view->resource);
2801 &texture->sub_resources[view->sub_resource_idx].clear_value.colour, c);
2802 }
2803
2804 begin_info.clearValueCount = attachment_count + 1;
2805 }
2806 ++attachment_count;
2807 }
2808
2809 if ((view = state->fb.depth_stencil))
2810 {
2812
2813 if (rtv_vk->v.resource->bind_count)
2814 {
2815 struct wined3d_texture_vk *texture_vk;
2816 texture_vk = wined3d_texture_vk(wined3d_texture_from_resource(rtv_vk->v.resource));
2817 wined3d_texture_vk_make_generic(texture_vk, context_vk);
2818 }
2819
2820 vk_views[attachment_count] = wined3d_rendertarget_view_vk_get_image_view(rtv_vk, context_vk);
2823
2824 if (view->width < fb_width)
2825 fb_width = view->width;
2826 if (view->height < fb_height)
2827 fb_height = view->height;
2828 if (view->layer_count < fb_layer_count)
2829 fb_layer_count = view->layer_count;
2830
2832 {
2833 VkClearDepthStencilValue *c = &clear_values[attachment_count].depthStencil;
2834
2835 if (view->resource->type == WINED3D_RTYPE_BUFFER)
2836 {
2837 c->depth = 0.0f;
2838 c->stencil = 0;
2839 }
2840 else
2841 {
2842 texture = texture_from_resource(view->resource);
2843 c->depth = texture->sub_resources[view->sub_resource_idx].clear_value.depth;
2844 c->stencil = texture->sub_resources[view->sub_resource_idx].clear_value.stencil;
2845 }
2846 begin_info.clearValueCount = attachment_count + 1;
2847 }
2848 ++attachment_count;
2849 }
2850
2851 if (!(vk_command_buffer = wined3d_context_vk_get_command_buffer(context_vk)))
2852 {
2853 ERR("Failed to get command buffer.\n");
2854 return false;
2855 }
2856
2857 if (!(context_vk->vk_render_pass = wined3d_context_vk_get_render_pass(context_vk, &state->fb,
2858 ARRAY_SIZE(state->fb.render_targets), !!state->fb.depth_stencil, 0)))
2859 {
2860 ERR("Failed to get render pass.\n");
2861 return false;
2862 }
2863
2865 fb_desc.pNext = NULL;
2866 fb_desc.flags = 0;
2867 fb_desc.renderPass = context_vk->vk_render_pass;
2868 fb_desc.attachmentCount = attachment_count;
2869 fb_desc.pAttachments = vk_views;
2870 fb_desc.width = fb_width;
2871 fb_desc.height = fb_height;
2872 fb_desc.layers = fb_layer_count;
2873
2874 if ((vr = VK_CALL(vkCreateFramebuffer(device_vk->vk_device, &fb_desc, NULL, &context_vk->vk_framebuffer))) < 0)
2875 {
2876 WARN("Failed to create Vulkan framebuffer, vr %s.\n", wined3d_debug_vkresult(vr));
2877 return false;
2878 }
2879
2881 begin_info.pNext = NULL;
2882 begin_info.renderPass = context_vk->vk_render_pass;
2883 begin_info.framebuffer = context_vk->vk_framebuffer;
2884 begin_info.renderArea.offset.x = 0;
2885 begin_info.renderArea.offset.y = 0;
2886 begin_info.renderArea.extent.width = fb_width;
2887 begin_info.renderArea.extent.height = fb_height;
2888 begin_info.pClearValues = clear_values;
2889 VK_CALL(vkCmdBeginRenderPass(vk_command_buffer, &begin_info, VK_SUBPASS_CONTENTS_INLINE));
2890
2891 LIST_FOR_EACH_ENTRY(query_vk, &context_vk->render_pass_queries, struct wined3d_query_vk, entry)
2892 wined3d_query_vk_resume(query_vk, context_vk);
2893 return true;
2894}
2895
2897 VkCommandBuffer vk_command_buffer, const struct wined3d_state *state, const struct wined3d_vk_info *vk_info)
2898{
2899 VkDeviceSize offsets[ARRAY_SIZE(state->streams)] = {0};
2900 VkBuffer buffers[ARRAY_SIZE(state->streams)];
2901 const struct wined3d_stream_state *stream;
2902 const VkDescriptorBufferInfo *buffer_info;
2903 struct wined3d_buffer_vk *buffer_vk;
2904 struct wined3d_buffer *buffer;
2905 unsigned int i, first, count;
2906
2907 first = 0;
2908 count = 0;
2909 for (i = 0; i < ARRAY_SIZE(state->streams); ++i)
2910 {
2911 stream = &state->streams[i];
2912
2913 if ((buffer = stream->buffer))
2914 {
2915 buffer_vk = wined3d_buffer_vk(buffer);
2916 buffer_info = wined3d_buffer_vk_get_buffer_info(buffer_vk);
2917 wined3d_context_vk_reference_bo(context_vk, wined3d_bo_vk(buffer->buffer_object));
2918 buffers[count] = buffer_info->buffer;
2919 offsets[count] = buffer_info->offset + stream->offset;
2920 ++count;
2921 continue;
2922 }
2923
2924 if (count)
2925 VK_CALL(vkCmdBindVertexBuffers(vk_command_buffer, first, count, buffers, offsets));
2926 first = i + 1;
2927 count = 0;
2928 }
2929
2930 if (count)
2931 VK_CALL(vkCmdBindVertexBuffers(vk_command_buffer, first, count, buffers, offsets));
2932}
2933
2935 VkCommandBuffer vk_command_buffer, const struct wined3d_state *state, const struct wined3d_vk_info *vk_info)
2936{
2937 VkDeviceSize offsets[ARRAY_SIZE(state->stream_output)];
2938 VkDeviceSize sizes[ARRAY_SIZE(state->stream_output)];
2939 VkBuffer buffers[ARRAY_SIZE(state->stream_output)];
2940 const struct wined3d_stream_output *stream;
2941 const VkDescriptorBufferInfo *buffer_info;
2942 struct wined3d_buffer_vk *buffer_vk;
2943 struct wined3d_buffer *buffer;
2944 unsigned int i, first, count;
2945
2946 if (!context_vk->vk_so_counter_bo.vk_buffer)
2947 {
2948 struct wined3d_bo_vk *bo = &context_vk->vk_so_counter_bo;
2949
2950 if (!wined3d_context_vk_create_bo(context_vk, ARRAY_SIZE(context_vk->vk_so_counters) * sizeof(uint32_t) * 2,
2952 ERR("Failed to create counter BO.\n");
2953
2954 for (i = 0; i < ARRAY_SIZE(context_vk->vk_so_counters); ++i)
2955 context_vk->vk_so_offsets[i] = bo->b.buffer_offset + i * sizeof(uint32_t) * 2;
2956 }
2957
2958 memset(context_vk->vk_so_counters, 0, sizeof(context_vk->vk_so_counters));
2959 first = 0;
2960 count = 0;
2961 for (i = 0; i < ARRAY_SIZE(state->stream_output); ++i)
2962 {
2963 stream = &state->stream_output[i];
2964
2965 if ((buffer = stream->buffer))
2966 {
2967 context_vk->vk_so_counters[i] = context_vk->vk_so_counter_bo.vk_buffer;
2968
2969 buffer_vk = wined3d_buffer_vk(buffer);
2970 buffer_info = wined3d_buffer_vk_get_buffer_info(buffer_vk);
2971 wined3d_context_vk_reference_bo(context_vk, wined3d_bo_vk(buffer->buffer_object));
2972 buffers[count] = buffer_info->buffer;
2973 if ((offsets[count] = stream->offset) == ~0u)
2974 {
2975 FIXME("Appending to stream output buffers not implemented.\n");
2976 offsets[count] = 0;
2977 }
2978 sizes[count] = buffer_info->range - offsets[count];
2979 offsets[count] += buffer_info->offset;
2980 ++count;
2981 continue;
2982 }
2983
2984 if (count)
2986 first = i + 1;
2987 count = 0;
2988 }
2989
2990 if (count)
2992}
2993
2995 const struct wined3d_vk_info *vk_info, VkDescriptorPool *vk_pool)
2996{
2997 struct VkDescriptorPoolCreateInfo pool_desc;
2998 VkResult vr;
2999
3000 static const VkDescriptorPoolSize pool_sizes[] =
3001 {
3008 };
3009
3011 pool_desc.pNext = NULL;
3012 pool_desc.flags = 0;
3013 pool_desc.maxSets = 512;
3014 pool_desc.poolSizeCount = ARRAY_SIZE(pool_sizes);
3015 pool_desc.pPoolSizes = pool_sizes;
3016
3017 if ((vr = VK_CALL(vkCreateDescriptorPool(device_vk->vk_device, &pool_desc, NULL, vk_pool))) < 0)
3018 ERR("Failed to create descriptor pool, vr %s.\n", wined3d_debug_vkresult(vr));
3019
3020 return vr;
3021}
3022
3024{
3025 VkResult vr;
3026
3027 if (context_vk->vk_descriptor_pool_count)
3028 return context_vk->vk_descriptor_pools[0];
3029
3030 if (!wined3d_array_reserve((void **)&context_vk->vk_descriptor_pools, &context_vk->vk_descriptor_pools_size,
3031 1, sizeof(*context_vk->vk_descriptor_pools)))
3032 {
3033 ERR("Failed to allocate array.\n");
3034 return VK_NULL_HANDLE;
3035 }
3036
3038 context_vk->vk_info, context_vk->vk_descriptor_pools)))
3039 {
3040 WARN("Failed to create descriptor pool, vr %s.\n", wined3d_debug_vkresult(vr));
3041 return VK_NULL_HANDLE;
3042 }
3043
3044 context_vk->vk_descriptor_pool_count = 1;
3045 return context_vk->vk_descriptor_pools[0];
3046}
3047
3049 VkDescriptorSetLayout vk_set_layout)
3050{
3051 struct wined3d_device_vk *device_vk = wined3d_device_vk(context_vk->c.device);
3052 const struct wined3d_vk_info *vk_info = context_vk->vk_info;
3053 struct VkDescriptorSetAllocateInfo set_desc;
3054 VkDescriptorPool vk_descriptor_pool;
3055 VkDescriptorSet vk_descriptor_set;
3056 VkResult vr;
3057
3058 if (!(vk_descriptor_pool = wined3d_context_vk_get_vk_descriptor_pool(context_vk)))
3059 return VK_NULL_HANDLE;
3060
3062 set_desc.pNext = NULL;
3063 set_desc.descriptorPool = vk_descriptor_pool;
3064 set_desc.descriptorSetCount = 1;
3065 set_desc.pSetLayouts = &vk_set_layout;
3066 if ((vr = VK_CALL(vkAllocateDescriptorSets(device_vk->vk_device, &set_desc, &vk_descriptor_set))) >= 0)
3067 return vk_descriptor_set;
3068
3070 {
3072 vk_descriptor_pool, context_vk->current_command_buffer.id);
3073 context_vk->vk_descriptor_pools[0] = context_vk->vk_descriptor_pools[--context_vk->vk_descriptor_pool_count];
3074 if (!(vk_descriptor_pool = wined3d_context_vk_get_vk_descriptor_pool(context_vk)))
3075 {
3076 WARN("Failed to create descriptor pool.\n");
3077 return VK_NULL_HANDLE;
3078 }
3079
3080 set_desc.descriptorPool = vk_descriptor_pool;
3081 if ((vr = VK_CALL(vkAllocateDescriptorSets(device_vk->vk_device, &set_desc, &vk_descriptor_set))) >= 0)
3082 return vk_descriptor_set;
3083 }
3084
3085 WARN("Failed to allocate descriptor set, vr %s.\n", wined3d_debug_vkresult(vr));
3086
3087 return VK_NULL_HANDLE;
3088}
3089
3091 VkDescriptorSet vk_descriptor_set, size_t binding_idx, VkDescriptorType type,
3092 const VkDescriptorBufferInfo *buffer_info, const VkDescriptorImageInfo *image_info,
3093 const VkBufferView *buffer_view)
3094{
3095 SIZE_T write_count = writes->count;
3097
3098 if (!wined3d_array_reserve((void **)&writes->writes, &writes->size,
3099 write_count + 1, sizeof(*writes->writes)))
3100 return false;
3101
3102 write = &writes->writes[write_count];
3104 write->pNext = NULL;
3105 write->dstSet = vk_descriptor_set;
3106 write->dstBinding = binding_idx;
3107 write->dstArrayElement = 0;
3108 write->descriptorCount = 1;
3109 write->descriptorType = type;
3110 write->pImageInfo = image_info;
3111 write->pBufferInfo = buffer_info;
3112 write->pTexelBufferView = buffer_view;
3113
3114 ++writes->count;
3115
3116 return true;
3117}
3118
3120 VkDescriptorSet vk_descriptor_set, size_t binding_idx, enum wined3d_shader_resource_type type,
3121 enum wined3d_data_type data_type, struct wined3d_context_vk *context_vk)
3122{
3123 const struct wined3d_null_views_vk *v = &wined3d_device_vk(context_vk->c.device)->null_views_vk;
3124
3125 switch (type)
3126 {
3129 return wined3d_shader_descriptor_writes_vk_add_write(writes, vk_descriptor_set, binding_idx,
3130 VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER, NULL, NULL, &v->vk_view_buffer_float);
3131 return wined3d_shader_descriptor_writes_vk_add_write(writes, vk_descriptor_set, binding_idx,
3132 VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER, NULL, NULL, &v->vk_view_buffer_uint);
3133
3135 return wined3d_shader_descriptor_writes_vk_add_write(writes, vk_descriptor_set,
3136 binding_idx, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, NULL, &v->vk_info_1d, NULL);
3137
3139 return wined3d_shader_descriptor_writes_vk_add_write(writes, vk_descriptor_set,
3140 binding_idx, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, NULL, &v->vk_info_2d, NULL);
3141
3143 return wined3d_shader_descriptor_writes_vk_add_write(writes, vk_descriptor_set,
3144 binding_idx, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, NULL, &v->vk_info_2dms, NULL);
3145
3147 return wined3d_shader_descriptor_writes_vk_add_write(writes, vk_descriptor_set,
3148 binding_idx, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, NULL, &v->vk_info_3d, NULL);
3149
3151 return wined3d_shader_descriptor_writes_vk_add_write(writes, vk_descriptor_set,
3152 binding_idx, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, NULL, &v->vk_info_cube, NULL);
3153
3155 return wined3d_shader_descriptor_writes_vk_add_write(writes, vk_descriptor_set,
3156 binding_idx, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, NULL, &v->vk_info_1d_array, NULL);
3157
3159 return wined3d_shader_descriptor_writes_vk_add_write(writes, vk_descriptor_set,
3160 binding_idx, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, NULL, &v->vk_info_2d_array, NULL);
3161
3163 return wined3d_shader_descriptor_writes_vk_add_write(writes, vk_descriptor_set,
3164 binding_idx, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, NULL, &v->vk_info_2dms_array, NULL);
3165
3167 return wined3d_shader_descriptor_writes_vk_add_write(writes, vk_descriptor_set,
3168 binding_idx, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, NULL, &v->vk_info_cube_array, NULL);
3169
3170 default:
3171 FIXME("Unhandled resource type %#x.\n", type);
3172 return false;
3173 }
3174}
3175
3177 struct wined3d_context_vk *context_vk, VkDescriptorSet vk_descriptor_set, const struct wined3d_state *state,
3179{
3180 const struct wined3d_constant_buffer_state *cb_state = &state->cb[binding->shader_type][binding->resource_idx];
3181 struct wined3d_device_vk *device_vk = wined3d_device_vk(context_vk->c.device);
3182 struct wined3d_buffer_vk *buffer_vk;
3183 struct wined3d_buffer *buffer;
3184
3185 if (!(buffer = cb_state->buffer))
3186 return wined3d_shader_descriptor_writes_vk_add_write(writes, vk_descriptor_set, binding->binding_idx,
3188
3189 buffer_vk = wined3d_buffer_vk(buffer);
3190 *buffer_info = *wined3d_buffer_vk_get_buffer_info(buffer_vk);
3191 buffer_info->offset += cb_state->offset;
3192 buffer_info->range = min(cb_state->size, buffer_info->range);
3193 if (!wined3d_shader_descriptor_writes_vk_add_write(writes, vk_descriptor_set,
3194 binding->binding_idx, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, buffer_info, NULL, NULL))
3195 return false;
3196 wined3d_context_vk_reference_bo(context_vk, wined3d_bo_vk(buffer->buffer_object));
3197 return true;
3198}
3199
3201 struct wined3d_context_vk *context_vk, VkDescriptorSet vk_descriptor_set, const struct wined3d_state *state,
3203{
3204 struct wined3d_shader_resource_view_vk *srv_vk;
3205 struct wined3d_shader_resource_view *srv;
3206 const VkDescriptorImageInfo *image_info;
3207 struct wined3d_resource *resource;
3208 struct wined3d_view_vk *view_vk;
3209 VkBufferView *buffer_view;
3211
3212 if (!(srv = state->shader_resource_view[binding->shader_type][binding->resource_idx]))
3213 return wined3d_shader_resource_bindings_add_null_srv_binding(writes, vk_descriptor_set,
3214 binding->binding_idx, binding->resource_type, binding->resource_data_type, context_vk);
3215
3216 resource = srv->resource;
3217 srv_vk = wined3d_shader_resource_view_vk(srv);
3218 view_vk = &srv_vk->view_vk;
3219 if (resource->type == WINED3D_RTYPE_BUFFER)
3220 {
3221 image_info = NULL;
3222 buffer_view = &view_vk->u.vk_buffer_view;
3224 }
3225 else
3226 {
3228
3229 if (view_vk->u.vk_image_info.imageView)
3230 {
3231 image_info = &view_vk->u.vk_image_info;
3232 if (image_info->imageLayout != texture_vk->layout)
3234 }
3235 else
3236 image_info = wined3d_texture_vk_get_default_image_info(texture_vk, context_vk);
3237 buffer_view = NULL;
3239 }
3240
3241 if (!wined3d_shader_descriptor_writes_vk_add_write(writes, vk_descriptor_set,
3242 binding->binding_idx, type, NULL, image_info, buffer_view))
3243 return false;
3245 return true;
3246}
3247
3249 struct wined3d_context_vk *context_vk, enum wined3d_pipeline pipeline, VkDescriptorSet vk_descriptor_set,
3250 const struct wined3d_state *state, const struct wined3d_shader_resource_binding *binding)
3251{
3252 struct wined3d_unordered_access_view_vk *uav_vk;
3254 const VkDescriptorImageInfo *image_info;
3255 struct wined3d_resource *resource;
3256 struct wined3d_view_vk *view_vk;
3257 VkBufferView *buffer_view;
3259
3260 if (!(uav = state->unordered_access_view[pipeline][binding->resource_idx]))
3261 {
3262 FIXME("NULL unordered access views not implemented.\n");
3263 return false;
3264 }
3265 resource = uav->resource;
3266
3268 view_vk = &uav_vk->view_vk;
3269 if (resource->type == WINED3D_RTYPE_BUFFER)
3270 {
3271 image_info = NULL;
3272 buffer_view = &view_vk->u.vk_buffer_view;
3274 }
3275 else
3276 {
3278
3279 if (view_vk->u.vk_image_info.imageView)
3280 image_info = &view_vk->u.vk_image_info;
3281 else
3282 image_info = wined3d_texture_vk_get_default_image_info(texture_vk, context_vk);
3283 buffer_view = NULL;
3285 }
3286
3287 if (!wined3d_shader_descriptor_writes_vk_add_write(writes, vk_descriptor_set,
3288 binding->binding_idx, type, NULL, image_info, buffer_view))
3289 return false;
3291 return true;
3292}
3293
3295 struct wined3d_shader_descriptor_writes_vk *writes, struct wined3d_context_vk *context_vk,
3296 enum wined3d_pipeline pipeline, VkDescriptorSet vk_descriptor_set,
3297 const struct wined3d_state *state, const struct wined3d_shader_resource_binding *binding)
3298{
3299 struct wined3d_unordered_access_view_vk *uav_vk;
3301
3302 if (!(uav = state->unordered_access_view[pipeline][binding->resource_idx]))
3303 {
3304 FIXME("NULL unordered access view counters not implemented.\n");
3305 return false;
3306 }
3307
3309 if (!uav_vk->vk_counter_view)
3310 return false;
3311
3312 return wined3d_shader_descriptor_writes_vk_add_write(writes, vk_descriptor_set, binding->binding_idx,
3314}
3315
3317 struct wined3d_context_vk *context_vk, VkDescriptorSet vk_descriptor_set, const struct wined3d_state *state,
3319{
3320 struct wined3d_sampler *sampler;
3321
3322 if (!(sampler = state->sampler[binding->shader_type][binding->resource_idx]))
3323 sampler = context_vk->c.device->null_sampler;
3324 if (!wined3d_shader_descriptor_writes_vk_add_write(writes, vk_descriptor_set, binding->binding_idx,
3326 return false;
3328 return true;
3329}
3330
3332 VkCommandBuffer vk_command_buffer, const struct wined3d_state *state, enum wined3d_pipeline pipeline)
3333{
3336 struct wined3d_device_vk *device_vk = wined3d_device_vk(context_vk->c.device);
3337 const struct wined3d_vk_info *vk_info = context_vk->vk_info;
3340 VkDescriptorSetLayout vk_set_layout;
3341 VkPipelineLayout vk_pipeline_layout;
3342 VkPipelineBindPoint vk_bind_point;
3343 VkDescriptorSet vk_descriptor_set;
3344 size_t i;
3345
3346 switch (pipeline)
3347 {
3349 bindings = &context_vk->graphics.bindings;
3350 vk_bind_point = VK_PIPELINE_BIND_POINT_GRAPHICS;
3351 vk_set_layout = context_vk->graphics.vk_set_layout;
3352 vk_pipeline_layout = context_vk->graphics.vk_pipeline_layout;
3353 break;
3354
3356 bindings = &context_vk->compute.bindings;
3357 vk_bind_point = VK_PIPELINE_BIND_POINT_COMPUTE;
3358 vk_set_layout = context_vk->compute.vk_set_layout;
3359 vk_pipeline_layout = context_vk->compute.vk_pipeline_layout;
3360 break;
3361
3362 default:
3363 ERR("Invalid pipeline %#x.\n", pipeline);
3364 return false;
3365 }
3366
3367 if (!(vk_descriptor_set = wined3d_context_vk_create_vk_descriptor_set(context_vk, vk_set_layout)))
3368 {
3369 WARN("Failed to create descriptor set.\n");
3370 return false;
3371 }
3372
3373 writes->count = 0;
3374 for (i = 0; i < bindings->count; ++i)
3375 {
3376 binding = &bindings->bindings[i];
3377
3378 switch (binding->shader_descriptor_type)
3379 {
3381 if (!wined3d_shader_descriptor_writes_vk_add_cbv_write(writes, context_vk, vk_descriptor_set,
3382 state, binding, &buffers[binding->shader_type][binding->resource_idx]))
3383 return false;
3384 break;
3385
3388 context_vk, vk_descriptor_set, state, binding))
3389 return false;
3390 break;
3391
3394 context_vk, pipeline, vk_descriptor_set, state, binding))
3395 return false;
3396 break;
3397
3400 context_vk, pipeline, vk_descriptor_set, state, binding))
3401 return false;
3402 break;
3403
3406 context_vk, vk_descriptor_set, state, binding))
3407 return false;
3408 break;
3409
3410 default:
3411 ERR("Invalid descriptor type %#x.\n", binding->shader_descriptor_type);
3412 return false;
3413 }
3414 }
3415
3416 VK_CALL(vkUpdateDescriptorSets(device_vk->vk_device, writes->count, writes->writes, 0, NULL));
3417 VK_CALL(vkCmdBindDescriptorSets(vk_command_buffer, vk_bind_point,
3418 vk_pipeline_layout, 0, 1, &vk_descriptor_set, 0, NULL));
3419
3420 return true;
3421}
3422
3424 const struct wined3d_vk_info *vk_info, const struct wined3d_pipeline_layout_key_vk *key,
3425 VkDescriptorSetLayout *vk_set_layout)
3426{
3428 VkResult vr;
3429
3431 layout_desc.pNext = NULL;
3432 layout_desc.flags = 0;
3433 layout_desc.bindingCount = key->binding_count;
3434 layout_desc.pBindings = key->bindings;
3435
3436 if ((vr = VK_CALL(vkCreateDescriptorSetLayout(device_vk->vk_device, &layout_desc, NULL, vk_set_layout))) < 0)
3437 WARN("Failed to create Vulkan descriptor set layout, vr %s.\n", wined3d_debug_vkresult(vr));
3438
3439 return vr;
3440}
3441
3443 struct wined3d_context_vk *context_vk, VkDescriptorSetLayoutBinding *bindings, SIZE_T binding_count)
3444{
3445 struct wined3d_device_vk *device_vk = wined3d_device_vk(context_vk->c.device);
3446 const struct wined3d_vk_info *vk_info = context_vk->vk_info;
3448 struct wined3d_pipeline_layout_vk *layout;
3449 VkPipelineLayoutCreateInfo layout_desc;
3450 struct wine_rb_entry *entry;
3451 VkResult vr;
3452
3453 key.bindings = bindings;
3454 key.binding_count = binding_count;
3455 if ((entry = wine_rb_get(&context_vk->pipeline_layouts, &key)))
3457
3458 if (!(layout = malloc(sizeof(*layout))))
3459 return NULL;
3460
3461 if (!(layout->key.bindings = malloc(sizeof(*layout->key.bindings) * key.binding_count)))
3462 {
3463 free(layout);
3464 return NULL;
3465 }
3466 memcpy(layout->key.bindings, key.bindings, sizeof(*layout->key.bindings) * key.binding_count);
3467 layout->key.binding_count = key.binding_count;
3468
3469 if ((vr = wined3d_context_vk_create_vk_descriptor_set_layout(device_vk, vk_info, &key, &layout->vk_set_layout)))
3470 {
3471 WARN("Failed to create descriptor set layout, vr %s.\n", wined3d_debug_vkresult(vr));
3472 goto fail;
3473 }
3474
3476 layout_desc.pNext = NULL;
3477 layout_desc.flags = 0;
3478 layout_desc.setLayoutCount = 1;
3479 layout_desc.pSetLayouts = &layout->vk_set_layout;
3480 layout_desc.pushConstantRangeCount = 0;
3481 layout_desc.pPushConstantRanges = NULL;
3482
3483 if ((vr = VK_CALL(vkCreatePipelineLayout(device_vk->vk_device,
3484 &layout_desc, NULL, &layout->vk_pipeline_layout))) < 0)
3485 {
3486 WARN("Failed to create Vulkan pipeline layout, vr %s.\n", wined3d_debug_vkresult(vr));
3488 goto fail;
3489 }
3490
3491 if (wine_rb_put(&context_vk->pipeline_layouts, &layout->key, &layout->entry) == -1)
3492 {
3493 ERR("Failed to insert pipeline layout.\n");
3496 goto fail;
3497 }
3498
3499 return layout;
3500
3501fail:
3502 free(layout->key.bindings);
3503 free(layout);
3504 return NULL;
3505}
3506
3508{
3509 struct wined3d_device_vk *device_vk = wined3d_device_vk(context_vk->c.device);
3510 const struct wined3d_vk_info *vk_info = context_vk->vk_info;
3511 struct wined3d_graphics_pipeline_vk *pipeline_vk;
3513 struct wine_rb_entry *entry;
3514 VkResult vr;
3515
3516 key = &context_vk->graphics.pipeline_key_vk;
3517 if ((entry = wine_rb_get(&context_vk->graphics_pipelines, key)))
3518 return WINE_RB_ENTRY_VALUE(entry, struct wined3d_graphics_pipeline_vk, entry)->vk_pipeline;
3519
3520 if (!(pipeline_vk = malloc(sizeof(*pipeline_vk))))
3521 return VK_NULL_HANDLE;
3522 pipeline_vk->key = *key;
3523
3524 if ((vr = VK_CALL(vkCreateGraphicsPipelines(device_vk->vk_device,
3525 VK_NULL_HANDLE, 1, &key->pipeline_desc, NULL, &pipeline_vk->vk_pipeline))) < 0)
3526 {
3527 WARN("Failed to create graphics pipeline, vr %s.\n", wined3d_debug_vkresult(vr));
3528 free(pipeline_vk);
3529 return VK_NULL_HANDLE;
3530 }
3531
3532 if (wine_rb_put(&context_vk->graphics_pipelines, &pipeline_vk->key, &pipeline_vk->entry) == -1)
3533 ERR("Failed to insert pipeline.\n");
3534
3535 return pipeline_vk->vk_pipeline;
3536}
3537
3539 const struct wined3d_state *state, struct wined3d_buffer_vk *indirect_vk, bool indexed)
3540{
3541 const struct wined3d_vk_info *vk_info = context_vk->vk_info;
3542 struct wined3d_buffer_vk *buffer_vk;
3543 struct wined3d_buffer *buffer;
3544 unsigned int i;
3545
3546 for (i = 0; i < ARRAY_SIZE(state->streams); ++i)
3547 {
3548 if (!(buffer = state->streams[i].buffer))
3549 continue;
3550
3551 buffer_vk = wined3d_buffer_vk(buffer);
3552 wined3d_buffer_load(&buffer_vk->b, &context_vk->c, state);
3554 if (!buffer_vk->b.bo_user.valid)
3556 }
3557
3559 {
3560 for (i = 0; i < ARRAY_SIZE(state->stream_output); ++i)
3561 {
3562 if (!(buffer = state->stream_output[i].buffer))
3563 continue;
3564
3566
3567 buffer_vk = wined3d_buffer_vk(buffer);
3568 wined3d_buffer_load(&buffer_vk->b, &context_vk->c, state);
3571 if (!buffer_vk->b.bo_user.valid)
3572 context_vk->update_stream_output = 1;
3573 }
3574 context_vk->c.transform_feedback_active = 1;
3575 }
3576
3577 if (indexed || (wined3d_context_is_graphics_state_dirty(&context_vk->c, STATE_INDEXBUFFER) && state->index_buffer))
3578 {
3579 buffer_vk = wined3d_buffer_vk(state->index_buffer);
3580 wined3d_buffer_load(&buffer_vk->b, &context_vk->c, state);
3582 if (!buffer_vk->b.bo_user.valid)
3584 }
3585
3586 if (indirect_vk)
3587 {
3588 wined3d_buffer_load(&indirect_vk->b, &context_vk->c, state);
3590 }
3591}
3592
3594 const struct wined3d_state *state, enum wined3d_pipeline pipeline)
3595{
3599 struct wined3d_unordered_access_view_vk *uav_vk;
3600 struct wined3d_shader_resource_view_vk *srv_vk;
3602 struct wined3d_shader_resource_view *srv;
3603 struct wined3d_buffer_vk *buffer_vk;
3604 struct wined3d_buffer *buffer;
3605 size_t i;
3606
3607 switch (pipeline)
3608 {
3610 bindings = &context_vk->graphics.bindings;
3611 break;
3612
3614 bindings = &context_vk->compute.bindings;
3615 break;
3616
3617 default:
3618 ERR("Invalid pipeline %#x.\n", pipeline);
3619 return;
3620 }
3621
3622 writes->count = 0;
3623 for (i = 0; i < bindings->count; ++i)
3624 {
3625 binding = &bindings->bindings[i];
3626
3627 switch (binding->shader_descriptor_type)
3628 {
3630 if (!(buffer = state->cb[binding->shader_type][binding->resource_idx].buffer))
3631 break;
3632
3633 buffer_vk = wined3d_buffer_vk(buffer);
3634 wined3d_buffer_load(buffer, &context_vk->c, state);
3635 if (!buffer_vk->b.bo_user.valid)
3636 {
3637 if (pipeline == WINED3D_PIPELINE_GRAPHICS)
3639 else
3641 }
3643 break;
3644
3646 if (!(srv = state->shader_resource_view[binding->shader_type][binding->resource_idx]))
3647 break;
3648
3649 srv_vk = wined3d_shader_resource_view_vk(srv);
3650 if (srv->resource->type == WINED3D_RTYPE_BUFFER)
3651 {
3652 if (!srv_vk->view_vk.bo_user.valid)
3653 {
3655 if (pipeline == WINED3D_PIPELINE_GRAPHICS)
3657 else
3659 }
3661 }
3662 else
3663 {
3665 }
3667 break;
3668
3670 if (!(uav = state->unordered_access_view[pipeline][binding->resource_idx]))
3671 break;
3672
3674 if (uav->resource->type == WINED3D_RTYPE_BUFFER)
3675 {
3677 if (!uav_vk->view_vk.bo_user.valid)
3678 {
3679 wined3d_unordered_access_view_vk_update(uav_vk, context_vk);
3680 if (pipeline == WINED3D_PIPELINE_GRAPHICS)
3682 else
3685 }
3688 }
3689 else
3690 {
3693 }
3695 break;
3696
3699 break;
3700
3701 default:
3702 ERR("Invalid descriptor type %#x.\n", binding->shader_descriptor_type);
3703 break;
3704 }
3705 }
3706}
3707
3709{
3711 {
3712 /* Need to restart render pass or the clear won't happen. */
3714 wined3d_rendertarget_view_prepare_location(rtv, &context_vk->c, rtv->resource->draw_binding);
3715 }
3716 else
3717 {
3718 wined3d_rendertarget_view_load_location(rtv, &context_vk->c, rtv->resource->draw_binding);
3719 }
3720}
3721
3723 const struct wined3d_state *state, struct wined3d_buffer_vk *indirect_vk, bool indexed)
3724{
3725 struct wined3d_device_vk *device_vk = wined3d_device_vk(context_vk->c.device);
3726 const struct wined3d_d3d_info *d3d_info = context_vk->c.d3d_info;
3727 const struct wined3d_vk_info *vk_info = context_vk->vk_info;
3728 const struct wined3d_blend_state *b = state->blend_state;
3729 VkSampleCountFlagBits prev_sample_count, sample_count;
3730 bool dual_source_blend = b && b->dual_source;
3731 struct wined3d_rendertarget_view *dsv;
3732 struct wined3d_rendertarget_view *rtv;
3733 struct wined3d_buffer_vk *buffer_vk;
3734 VkCommandBuffer vk_command_buffer;
3735 unsigned int i, invalidate_rt = 0;
3736 uint32_t null_buffer_binding;
3737 bool invalidate_ds = false;
3738
3741 || dual_source_blend != context_vk->c.last_was_dual_source_blend)
3742 {
3743 context_vk->c.shader_update_mask |= (1u << WINED3D_SHADER_TYPE_PIXEL);
3744 context_vk->c.last_was_dual_source_blend = dual_source_blend;
3745 }
3747 context_vk->c.shader_update_mask |= (1u << WINED3D_SHADER_TYPE_VERTEX);
3749 context_vk->c.shader_update_mask |= (1u << WINED3D_SHADER_TYPE_GEOMETRY);
3751 context_vk->c.shader_update_mask |= (1u << WINED3D_SHADER_TYPE_HULL) | (1u << WINED3D_SHADER_TYPE_DOMAIN);
3753 context_vk->c.shader_update_mask |= (1u << WINED3D_SHADER_TYPE_DOMAIN);
3754
3755 prev_sample_count = context_vk->sample_count;
3756 context_vk->sample_count = 0;
3757 for (i = 0; i < ARRAY_SIZE(state->fb.render_targets); ++i)
3758 {
3759 if (!(rtv = state->fb.render_targets[i]) || rtv->format->id == WINED3DFMT_NULL)
3760 continue;
3761
3762 if (wined3d_blend_state_get_writemask(state->blend_state, i))
3763 {
3764 /* We handle clears at the beginning of the render pass, no need for an explicit clear
3765 * first. */
3766 wined3d_context_vk_prepare_used_rtv(context_vk, rtv);
3767 invalidate_rt |= (1 << i);
3768 }
3769 else
3770 {
3771 wined3d_rendertarget_view_prepare_location(rtv, &context_vk->c, rtv->resource->draw_binding);
3772 }
3773
3774 sample_count = max(1, wined3d_resource_get_sample_count(rtv->resource));
3775 if (!context_vk->sample_count)
3776 context_vk->sample_count = sample_count;
3777 else if (context_vk->sample_count != sample_count)
3778 FIXME("Inconsistent sample counts (%u != %u).\n", context_vk->sample_count, sample_count);
3779 }
3780
3781 if ((dsv = state->fb.depth_stencil))
3782 {
3784 wined3d_context_vk_prepare_used_rtv(context_vk, dsv);
3785 else
3786 wined3d_rendertarget_view_prepare_location(dsv, &context_vk->c, dsv->resource->draw_binding);
3787
3788 if (!state->depth_stencil_state || state->depth_stencil_state->writes_ds)
3789 invalidate_ds = true;
3790
3791 sample_count = max(1, wined3d_resource_get_sample_count(dsv->resource));
3792 if (!context_vk->sample_count)
3793 context_vk->sample_count = sample_count;
3794 else if (context_vk->sample_count != sample_count)
3795 FIXME("Inconsistent sample counts (%u != %u).\n", context_vk->sample_count, sample_count);
3796 }
3797
3798 if (!context_vk->sample_count)
3799 context_vk->sample_count = VK_SAMPLE_COUNT_1_BIT;
3800
3801 if (context_vk->sample_count != prev_sample_count)
3802 context_vk->c.update_multisample_state = 1;
3803
3804 if (context_vk->c.shader_update_mask & ~(1u << WINED3D_SHADER_TYPE_COMPUTE))
3805 {
3806 device_vk->d.shader_backend->shader_apply_draw_state(device_vk->d.shader_priv, &context_vk->c, state);
3807 if (!context_vk->graphics.vk_pipeline_layout)
3808 {
3809 ERR("No pipeline layout set.\n");
3810 return VK_NULL_HANDLE;
3811 }
3812 context_vk->c.update_shader_resource_bindings = 1;
3813 context_vk->c.update_unordered_access_view_bindings = 1;
3814 }
3815
3817
3818 wined3d_context_vk_load_buffers(context_vk, state, indirect_vk, indexed);
3819
3822
3823 if (!wined3d_context_vk_begin_render_pass(context_vk, state, vk_info))
3824 {
3825 ERR("Failed to begin render pass.\n");
3826 return VK_NULL_HANDLE;
3827 }
3828 vk_command_buffer = context_vk->current_command_buffer.vk_command_buffer;
3829
3830 while (invalidate_rt)
3831 {
3832 i = wined3d_bit_scan(&invalidate_rt);
3833 rtv = state->fb.render_targets[i];
3836 }
3837
3838 if (invalidate_ds)
3839 {
3842 }
3843
3844 if (wined3d_context_vk_update_graphics_pipeline_key(context_vk, state, context_vk->graphics.vk_pipeline_layout,
3845 &null_buffer_binding) || !context_vk->graphics.vk_pipeline)
3846 {
3847 if (!(context_vk->graphics.vk_pipeline = wined3d_context_vk_get_graphics_pipeline(context_vk)))
3848 {
3849 ERR("Failed to get graphics pipeline.\n");
3850 return VK_NULL_HANDLE;
3851 }
3852
3853 VK_CALL(vkCmdBindPipeline(vk_command_buffer,
3854 VK_PIPELINE_BIND_POINT_GRAPHICS, context_vk->graphics.vk_pipeline));
3855 if (null_buffer_binding != ~0u)
3856 {
3857 VkDeviceSize offset = 0;
3858 VK_CALL(vkCmdBindVertexBuffers(vk_command_buffer, null_buffer_binding, 1,
3859 &device_vk->null_resources_vk.buffer_info.buffer, &offset));
3860 }
3861 }
3862
3864 {
3866 state->stencil_ref & wined3d_mask_from_size(dsv->format->stencil_size)));
3867 }
3868
3870 wined3d_context_vk_bind_vertex_buffers(context_vk, vk_command_buffer, state, vk_info);
3871
3873 {
3874 context_vk->update_stream_output = 1;
3875 context_vk->c.transform_feedback_paused = 0;
3876 }
3877 if (context_vk->c.transform_feedback_active && context_vk->update_stream_output)
3878 {
3879 wined3d_context_vk_bind_stream_output_buffers(context_vk, vk_command_buffer, state, vk_info);
3880 context_vk->update_stream_output = 0;
3881 }
3882
3883 if (wined3d_context_is_graphics_state_dirty(&context_vk->c, STATE_INDEXBUFFER) && state->index_buffer)
3884 {
3886 VkIndexType idx_type;
3887
3888 if (state->index_format == WINED3DFMT_R16_UINT)
3889 idx_type = VK_INDEX_TYPE_UINT16;
3890 else
3891 idx_type = VK_INDEX_TYPE_UINT32;
3892 buffer_vk = wined3d_buffer_vk(state->index_buffer);
3894 wined3d_context_vk_reference_bo(context_vk, wined3d_bo_vk(buffer_vk->b.buffer_object));
3895 VK_CALL(vkCmdBindIndexBuffer(vk_command_buffer, buffer_info->buffer,
3896 buffer_info->offset + state->index_offset, idx_type));
3897 }
3898
3909 context_vk->c.update_shader_resource_bindings = 1;
3911 context_vk->c.update_unordered_access_view_bindings = 1;
3912
3913 if (context_vk->c.update_shader_resource_bindings || context_vk->c.update_unordered_access_view_bindings)
3914 {
3915 if (!wined3d_context_vk_update_descriptors(context_vk, vk_command_buffer, state, WINED3D_PIPELINE_GRAPHICS))
3916 {
3917 ERR("Failed to update shader descriptors.\n");
3918 return VK_NULL_HANDLE;
3919 }
3920
3921 context_vk->c.update_shader_resource_bindings = 0;
3922 context_vk->c.update_unordered_access_view_bindings = 0;
3923 }
3924
3926 VK_CALL(vkCmdSetBlendConstants(vk_command_buffer, &state->blend_factor.r));
3927
3931 {
3932 unsigned int viewport_count = (context_vk->vk_info->multiple_viewports ? WINED3D_MAX_VIEWPORTS : 1);
3935 unsigned int i;
3936
3937 for (i = 0; i < viewport_count; ++i)
3938 {
3939 const struct wined3d_viewport *src_viewport = &state->viewports[i];
3940 VkViewport *viewport = &viewports[i];
3941 VkRect2D *scissor = &scissors[i];
3942
3943 if (i >= state->viewport_count)
3944 {
3945 viewport->x = 0.0f;
3946 viewport->y = 0.0f;
3947 viewport->width = 1.0f;
3948 viewport->height = 1.0f;
3949 viewport->minDepth = 0.0f;
3950 viewport->maxDepth = 0.0f;
3951 memset(scissor, 0, sizeof(*scissor));
3952 continue;
3953 }
3954
3955 viewport->x = src_viewport->x;
3956 viewport->y = src_viewport->y;
3957 viewport->width = src_viewport->width;
3958 viewport->height = src_viewport->height;
3959 viewport->minDepth = src_viewport->min_z;
3960 viewport->maxDepth = src_viewport->max_z;
3961
3962 if (state->rasterizer_state && state->rasterizer_state->desc.scissor)
3963 {
3964 const RECT *r = &state->scissor_rects[i];
3965
3966 if (i >= state->scissor_rect_count)
3967 {
3968 memset(scissor, 0, sizeof(*scissor));
3969 continue;
3970 }
3971
3972 scissor->offset.x = r->left;
3973 scissor->offset.y = r->top;
3974 scissor->extent.width = r->right - r->left;
3975 scissor->extent.height = r->bottom - r->top;
3976 }
3977 else
3978 {
3979 scissor->offset.x = src_viewport->x;
3980 scissor->offset.y = src_viewport->y;
3981 scissor->extent.width = src_viewport->width;
3982 scissor->extent.height = src_viewport->height;
3983 }
3984
3985 /* Scissor offsets need to be non-negative (VUID-VkPipelineViewportStateCreateInfo-x-02821) */
3986 if (scissor->offset.x < 0)
3987 scissor->offset.x = 0;
3988 if (scissor->offset.y < 0)
3989 scissor->offset.y = 0;
3990 viewport->y += viewport->height;
3991 viewport->height = -viewport->height;
3992 }
3993
3994 VK_CALL(vkCmdSetViewport(vk_command_buffer, 0, viewport_count, viewports));
3995 VK_CALL(vkCmdSetScissor(vk_command_buffer, 0, viewport_count, scissors));
3996 }
3997
3998 if (vk_info->dynamic_state2 && context_vk->c.update_primitive_type)
3999 {
4000 VK_CALL(vkCmdSetPrimitiveTopologyEXT(vk_command_buffer, vk_topology_from_wined3d(state->primitive_type)));
4003 !wined3d_primitive_type_is_list(state->primitive_type)));
4004 context_vk->c.update_primitive_type = 0;
4005 }
4006
4007 if (vk_info->dynamic_patch_vertex_count && context_vk->c.update_patch_vertex_count)
4008 {
4009 if (state->patch_vertex_count)
4010 VK_CALL(vkCmdSetPatchControlPointsEXT(vk_command_buffer, state->patch_vertex_count));
4011 context_vk->c.update_patch_vertex_count = 0;
4012 }
4013
4014 if (vk_info->dynamic_multisample_state && context_vk->c.update_multisample_state)
4015 {
4016 unsigned int sample_count = context_vk->sample_count;
4017
4018 VK_CALL(vkCmdSetAlphaToCoverageEnableEXT(vk_command_buffer,
4019 state->blend_state && state->blend_state->desc.alpha_to_coverage));
4020 VK_CALL(vkCmdSetRasterizationSamplesEXT(vk_command_buffer, sample_count));
4021 VK_CALL(vkCmdSetSampleMaskEXT(vk_command_buffer, sample_count, &state->sample_mask));
4022 context_vk->c.update_multisample_state = 0;
4023 }
4024
4027 wined3d_context_vk_set_dynamic_rasterizer_state(context_vk, vk_command_buffer, vk_info, state);
4028
4031 wined3d_context_vk_set_dynamic_blend_state(context_vk, vk_command_buffer, vk_info, state);
4032
4036 {
4037 const struct wined3d_depth_stencil_state *d = state->depth_stencil_state;
4038
4039 if (d)
4040 {
4041 VkBool32 stencil_enable = state->fb.depth_stencil && d->desc.stencil;
4042
4043 VK_CALL(vkCmdSetDepthTestEnableEXT(vk_command_buffer, d->desc.depth));
4044 VK_CALL(vkCmdSetDepthWriteEnableEXT(vk_command_buffer, d->desc.depth_write));
4045 VK_CALL(vkCmdSetDepthCompareOpEXT(vk_command_buffer, vk_compare_op_from_wined3d(d->desc.depth_func)));
4046 VK_CALL(vkCmdSetStencilTestEnableEXT(vk_command_buffer, stencil_enable));
4047 if (stencil_enable)
4048 {
4050 vk_stencil_op_from_wined3d(d->desc.front.fail_op),
4051 vk_stencil_op_from_wined3d(d->desc.front.pass_op),
4052 vk_stencil_op_from_wined3d(d->desc.front.depth_fail_op),
4053 vk_compare_op_from_wined3d(d->desc.front.func)));
4055 vk_stencil_op_from_wined3d(d->desc.back.fail_op),
4056 vk_stencil_op_from_wined3d(d->desc.back.pass_op),
4057 vk_stencil_op_from_wined3d(d->desc.back.depth_fail_op),
4058 vk_compare_op_from_wined3d(d->desc.back.func)));
4059 VK_CALL(vkCmdSetStencilCompareMask(vk_command_buffer,
4060 VK_STENCIL_FACE_FRONT_AND_BACK, d->desc.stencil_read_mask));
4061 VK_CALL(vkCmdSetStencilWriteMask(vk_command_buffer,
4062 VK_STENCIL_FACE_FRONT_AND_BACK, d->desc.stencil_write_mask));
4063 }
4064 }
4065 else
4066 {
4067 VK_CALL(vkCmdSetDepthTestEnableEXT(vk_command_buffer, VK_TRUE));
4068 VK_CALL(vkCmdSetDepthWriteEnableEXT(vk_command_buffer, VK_TRUE));
4070 VK_CALL(vkCmdSetStencilTestEnableEXT(vk_command_buffer, VK_FALSE));
4071 }
4072 }
4073
4074 memset(context_vk->c.dirty_graphics_states, 0, sizeof(context_vk->c.dirty_graphics_states));
4075 context_vk->c.shader_update_mask &= 1u << WINED3D_SHADER_TYPE_COMPUTE;
4076
4077 return vk_command_buffer;
4078}
4079
4081 const struct wined3d_state *state, struct wined3d_buffer_vk *indirect_vk)
4082{
4083 struct wined3d_device_vk *device_vk = wined3d_device_vk(context_vk->c.device);
4084 const struct wined3d_vk_info *vk_info = context_vk->vk_info;
4085 VkCommandBuffer vk_command_buffer;
4086
4088
4090 context_vk->c.shader_update_mask |= 1u << WINED3D_SHADER_TYPE_COMPUTE;
4091
4092 if (context_vk->c.shader_update_mask & (1u << WINED3D_SHADER_TYPE_COMPUTE))
4093 {
4094 device_vk->d.shader_backend->shader_apply_compute_state(device_vk->d.shader_priv, &context_vk->c, state);
4095 if (!context_vk->compute.vk_pipeline)
4096 {
4097 ERR("No compute pipeline set.\n");
4098 return VK_NULL_HANDLE;
4099 }
4100 context_vk->c.update_compute_shader_resource_bindings = 1;
4101 context_vk->c.update_compute_unordered_access_view_bindings = 1;
4102 context_vk->update_compute_pipeline = 1;
4103 }
4104
4106
4107 if (indirect_vk)
4108 {
4109 wined3d_buffer_load_location(&indirect_vk->b, &context_vk->c, WINED3D_LOCATION_BUFFER);
4111 }
4112
4113 if (!(vk_command_buffer = wined3d_context_vk_get_command_buffer(context_vk)))
4114 {
4115 ERR("Failed to get command buffer.\n");
4116 return VK_NULL_HANDLE;
4117 }
4118
4119 if (context_vk->update_compute_pipeline)
4120 {
4121 VK_CALL(vkCmdBindPipeline(vk_command_buffer,
4122 VK_PIPELINE_BIND_POINT_COMPUTE, context_vk->compute.vk_pipeline));
4123 context_vk->update_compute_pipeline = 0;
4124 }
4125
4128 context_vk->c.update_compute_shader_resource_bindings = 1;
4130 context_vk->c.update_compute_unordered_access_view_bindings = 1;
4131
4132 if (context_vk->c.update_compute_shader_resource_bindings
4133 || context_vk->c.update_compute_unordered_access_view_bindings)
4134 {
4135 if (!wined3d_context_vk_update_descriptors(context_vk, vk_command_buffer, state, WINED3D_PIPELINE_COMPUTE))
4136 {
4137 ERR("Failed to update shader descriptors.\n");
4138 return VK_NULL_HANDLE;
4139 }
4140
4141 context_vk->c.update_compute_shader_resource_bindings = 0;
4142 context_vk->c.update_compute_unordered_access_view_bindings = 0;
4143 }
4144
4145 memset(context_vk->c.dirty_compute_states, 0, sizeof(context_vk->c.dirty_compute_states));
4146 context_vk->c.shader_update_mask &= ~(1u << WINED3D_SHADER_TYPE_COMPUTE);
4147
4148 return vk_command_buffer;
4149}
4150
4152{
4153 VkCommandPoolCreateInfo command_pool_info;
4154 const struct wined3d_vk_info *vk_info;
4155 struct wined3d_adapter_vk *adapter_vk;
4156 struct wined3d_device_vk *device_vk;
4157 VkResult vr;
4158
4159 TRACE("context_vk %p, swapchain %p.\n", context_vk, swapchain);
4160
4161 memset(context_vk, 0, sizeof(*context_vk));
4162 wined3d_context_init(&context_vk->c, swapchain);
4163 device_vk = wined3d_device_vk(swapchain->device);
4164 adapter_vk = wined3d_adapter_vk(device_vk->d.adapter);
4165 context_vk->vk_info = vk_info = &adapter_vk->vk_info;
4166
4168 command_pool_info.pNext = NULL;
4170 command_pool_info.queueFamilyIndex = device_vk->vk_queue_family_index;
4171 if ((vr = VK_CALL(vkCreateCommandPool(device_vk->vk_device,
4172 &command_pool_info, NULL, &context_vk->vk_command_pool))) < 0)
4173 {
4174 ERR("Failed to create Vulkan command pool, vr %s.\n", wined3d_debug_vkresult(vr));
4176 return E_FAIL;
4177 }
4178 context_vk->current_command_buffer.id = 1;
4179
4181
4182 list_init(&context_vk->render_pass_queries);
4183 list_init(&context_vk->active_queries);
4184 list_init(&context_vk->completed_query_pools);
4185 list_init(&context_vk->free_occlusion_query_pools);
4186 list_init(&context_vk->free_timestamp_query_pools);
4187 list_init(&context_vk->free_pipeline_statistics_query_pools);
4188 list_init(&context_vk->free_stream_output_statistics_query_pools);
4189
4194
4195 return WINED3D_OK;
4196}
#define write
Definition: acwin.h:98
unsigned int wined3d_adapter_vk_get_memory_type_index(const struct wined3d_adapter_vk *adapter_vk, uint32_t memory_type_mask, VkMemoryPropertyFlags flags)
Definition: adapter_vk.c:1259
void wined3d_bo_slab_vk_unmap(struct wined3d_bo_slab_vk *slab_vk, struct wined3d_context_vk *context_vk)
Definition: adapter_vk.c:819
_Check_return_ _Ret_maybenull_ _In_ size_t alignment
Definition: align.cpp:48
static int state
Definition: maze.c:121
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
#define ARRAY_SIZE(A)
Definition: main.h:20
static void list_remove(struct list_entry *entry)
Definition: list.h:90
static int list_empty(struct list_entry *head)
Definition: list.h:58
static void list_init(struct list_entry *head)
Definition: list.h:51
#define FIXME(fmt,...)
Definition: precomp.h:53
#define WARN(fmt,...)
Definition: precomp.h:61
#define ERR(fmt,...)
Definition: precomp.h:57
Definition: list.h:39
static int wined3d_render_pass_vk_compare(const void *key, const struct wine_rb_entry *entry)
Definition: context_vk.c:2046
struct wined3d_pipeline_layout_vk * wined3d_context_vk_get_pipeline_layout(struct wined3d_context_vk *context_vk, VkDescriptorSetLayoutBinding *bindings, SIZE_T binding_count)
Definition: context_vk.c:3442
VkRenderPass wined3d_context_vk_get_render_pass(struct wined3d_context_vk *context_vk, const struct wined3d_fb_state *fb, unsigned int rt_count, bool depth_stencil, uint32_t clear_flags)
Definition: context_vk.c:1533
static bool wined3d_shader_descriptor_writes_vk_add_uav_counter_write(struct wined3d_shader_descriptor_writes_vk *writes, struct wined3d_context_vk *context_vk, enum wined3d_pipeline pipeline, VkDescriptorSet vk_descriptor_set, const struct wined3d_state *state, const struct wined3d_shader_resource_binding *binding)
Definition: context_vk.c:3294
static int wined3d_bo_slab_vk_compare(const void *key, const struct wine_rb_entry *entry)
Definition: context_vk.c:2139
void wined3d_context_vk_destroy_vk_memory(struct wined3d_context_vk *context_vk, VkDeviceMemory vk_memory, uint64_t command_buffer_id)
Definition: context_vk.c:778
static void wined3d_context_vk_load_shader_resources(struct wined3d_context_vk *context_vk, const struct wined3d_state *state, enum wined3d_pipeline pipeline)
Definition: context_vk.c:3593
static int wined3d_graphics_pipeline_vk_compare(const void *key, const struct wine_rb_entry *entry)
Definition: context_vk.c:2067
static void wined3d_context_vk_destroy_pipeline_layout(struct wine_rb_entry *entry, void *ctx)
Definition: context_vk.c:1330
static void wined3d_context_vk_destroy_graphics_pipeline(struct wine_rb_entry *entry, void *ctx)
Definition: context_vk.c:1315
static void free_command_buffer(struct wined3d_context_vk *context_vk, struct wined3d_command_buffer_vk *buffer)
Definition: context_vk.c:1147
static struct wined3d_allocator_block * wined3d_context_vk_allocate_memory(struct wined3d_context_vk *context_vk, unsigned int memory_type, VkDeviceSize size, VkDeviceMemory *vk_memory)
Definition: context_vk.c:384
static void wined3d_context_vk_reset_vk_descriptor_pool(struct wined3d_context_vk *context_vk, VkDescriptorPool vk_descriptor_pool, uint64_t command_buffer_id)
Definition: context_vk.c:755
static void rasterizer_state_from_wined3d(VkPipelineRasterizationStateCreateInfo *desc, const struct wined3d_state *state, const struct wined3d_d3d_info *d3d_info)
Definition: context_vk.c:2268
static VkPipeline wined3d_context_vk_get_graphics_pipeline(struct wined3d_context_vk *context_vk)
Definition: context_vk.c:3507
#define X
static void wined3d_context_vk_set_dynamic_blend_state(const struct wined3d_context_vk *context_vk, VkCommandBuffer vk_command_buffer, const struct wined3d_vk_info *vk_info, const struct wined3d_state *state)
Definition: context_vk.c:2427
static void wined3d_context_vk_bind_stream_output_buffers(struct wined3d_context_vk *context_vk, VkCommandBuffer vk_command_buffer, const struct wined3d_state *state, const struct wined3d_vk_info *vk_info)
Definition: context_vk.c:2934
static void wined3d_context_vk_update_blend_state(const struct wined3d_context_vk *context_vk, const struct wined3d_state *state, struct wined3d_graphics_pipeline_key_vk *key)
Definition: context_vk.c:2387
static VkPrimitiveTopology vk_topology_class_from_wined3d(enum wined3d_primitive_type t)
Definition: context_vk.c:219
static void wined3d_shader_descriptor_writes_vk_cleanup(struct wined3d_shader_descriptor_writes_vk *writes)
Definition: context_vk.c:1607
VkCommandBuffer wined3d_context_vk_apply_compute_state(struct wined3d_context_vk *context_vk, const struct wined3d_state *state, struct wined3d_buffer_vk *indirect_vk)
Definition: context_vk.c:4080
static void wined3d_context_vk_destroy_query_pools(struct wined3d_context_vk *context_vk, struct list *free_pools)
Definition: context_vk.c:1612
void wined3d_context_vk_destroy_vk_framebuffer(struct wined3d_context_vk *context_vk, VkFramebuffer vk_framebuffer, uint64_t command_buffer_id)
Definition: context_vk.c:712
static void wined3d_allocator_chunk_vk_unlock(struct wined3d_allocator_chunk_vk *chunk_vk)
Definition: context_vk.c:299
static bool wined3d_context_vk_begin_render_pass(struct wined3d_context_vk *context_vk, const struct wined3d_state *state, const struct wined3d_vk_info *vk_info)
Definition: context_vk.c:2734
static bool wined3d_shader_descriptor_writes_vk_add_sampler_write(struct wined3d_shader_descriptor_writes_vk *writes, struct wined3d_context_vk *context_vk, VkDescriptorSet vk_descriptor_set, const struct wined3d_state *state, const struct wined3d_shader_resource_binding *binding)
Definition: context_vk.c:3316
static VkColorComponentFlags vk_colour_write_mask_from_wined3d(uint32_t wined3d_mask)
Definition: context_vk.c:154
static bool wined3d_context_vk_create_slab_bo(struct wined3d_context_vk *context_vk, VkDeviceSize size, VkBufferUsageFlags usage, VkMemoryPropertyFlags memory_type, struct wined3d_bo_vk *bo)
Definition: context_vk.c:423
static void wined3d_context_vk_destroy_render_pass(struct wine_rb_entry *entry, void *ctx)
Definition: context_vk.c:1598
BOOL wined3d_context_vk_create_bo(struct wined3d_context_vk *context_vk, VkDeviceSize size, VkBufferUsageFlags usage, VkMemoryPropertyFlags memory_type, struct wined3d_bo_vk *bo)
Definition: context_vk.c:528
static void wined3d_render_pass_vk_cleanup(struct wined3d_render_pass_vk *pass, struct wined3d_context_vk *context_vk)
Definition: context_vk.c:1399
void wined3d_context_vk_destroy_vk_buffer_view(struct wined3d_context_vk *context_vk, VkBufferView vk_view, uint64_t command_buffer_id)
Definition: context_vk.c:931
static void wined3d_context_vk_destroy_bo_slab(struct wine_rb_entry *entry, void *ctx)
Definition: context_vk.c:1300
void wined3d_context_vk_end_current_render_pass(struct wined3d_context_vk *context_vk)
Definition: context_vk.c:1564
VkShaderStageFlagBits vk_shader_stage_from_wined3d(enum wined3d_shader_type shader_type)
Definition: context_vk.c:59
static int wined3d_pipeline_layout_vk_compare(const void *key, const struct wine_rb_entry *entry)
Definition: context_vk.c:2055
static bool wined3d_shader_descriptor_writes_vk_add_write(struct wined3d_shader_descriptor_writes_vk *writes, VkDescriptorSet vk_descriptor_set, size_t binding_idx, VkDescriptorType type, const VkDescriptorBufferInfo *buffer_info, const VkDescriptorImageInfo *image_info, const VkBufferView *buffer_view)
Definition: context_vk.c:3090
static void wined3d_context_vk_set_dynamic_rasterizer_state(const struct wined3d_context_vk *context_vk, VkCommandBuffer vk_command_buffer, const struct wined3d_vk_info *vk_info, const struct wined3d_state *state)
Definition: context_vk.c:2335
static void wined3d_allocator_chunk_vk_lock(struct wined3d_allocator_chunk_vk *chunk_vk)
Definition: context_vk.c:294
static void blend_equation_from_wined3d(const struct wined3d_context_vk *context_vk, VkColorBlendEquationEXT *eq, const struct wined3d_rendertarget_blend_state_desc *rt, const struct wined3d_rendertarget_view *rtv)
Definition: context_vk.c:2353
static VkBlendFactor vk_blend_factor_from_wined3d(enum wined3d_blend blend, const struct wined3d_format *dst_format, bool alpha)
Definition: context_vk.c:81
VkDescriptorSet wined3d_context_vk_create_vk_descriptor_set(struct wined3d_context_vk *context_vk, VkDescriptorSetLayout vk_set_layout)
Definition: context_vk.c:3048
static void wined3d_context_vk_init_graphics_pipeline_key(struct wined3d_context_vk *context_vk)
Definition: context_vk.c:2152
static VkResult wined3d_context_vk_create_vk_descriptor_set_layout(struct wined3d_device_vk *device_vk, const struct wined3d_vk_info *vk_info, const struct wined3d_pipeline_layout_key_vk *key, VkDescriptorSetLayout *vk_set_layout)
Definition: context_vk.c:3423
void wined3d_context_vk_destroy_vk_image_view(struct wined3d_context_vk *context_vk, VkImageView vk_view, uint64_t command_buffer_id)
Definition: context_vk.c:956
static void wined3d_context_vk_destroy_bo_slab_slice(struct wined3d_context_vk *context_vk, struct wined3d_bo_slab_vk *slab, SIZE_T idx, uint64_t command_buffer_id)
Definition: context_vk.c:858
#define WINED3D_PERIODIC_SUBMIT_MAX_BUFFERS
Definition: context_vk.c:1785
static bool wined3d_shader_descriptor_writes_vk_add_uav_write(struct wined3d_shader_descriptor_writes_vk *writes, struct wined3d_context_vk *context_vk, enum wined3d_pipeline pipeline, VkDescriptorSet vk_descriptor_set, const struct wined3d_state *state, const struct wined3d_shader_resource_binding *binding)
Definition: context_vk.c:3248
void wined3d_context_vk_destroy_vk_sampler(struct wined3d_context_vk *context_vk, VkSampler vk_sampler, uint64_t command_buffer_id)
Definition: context_vk.c:1042
static VkPrimitiveTopology vk_topology_from_wined3d(enum wined3d_primitive_type t)
Definition: context_vk.c:186
VkDeviceMemory wined3d_context_vk_allocate_vram_chunk_memory(struct wined3d_context_vk *context_vk, unsigned int pool, size_t size)
Definition: context_vk.c:362
static bool should_periodic_submit(struct wined3d_context_vk *context_vk)
Definition: context_vk.c:1787
void wined3d_context_vk_destroy_vk_image(struct wined3d_context_vk *context_vk, VkImage vk_image, uint64_t command_buffer_id)
Definition: context_vk.c:906
static void wined3d_context_vk_bind_vertex_buffers(struct wined3d_context_vk *context_vk, VkCommandBuffer vk_command_buffer, const struct wined3d_state *state, const struct wined3d_vk_info *vk_info)
Definition: context_vk.c:2896
void wined3d_context_vk_destroy_allocator_block(struct wined3d_context_vk *context_vk, struct wined3d_allocator_block *block, uint64_t command_buffer_id)
Definition: context_vk.c:803
void * wined3d_allocator_chunk_vk_map(struct wined3d_allocator_chunk_vk *chunk_vk, struct wined3d_context_vk *context_vk)
Definition: context_vk.c:304
static VkStencilOp vk_stencil_op_from_wined3d(enum wined3d_stencil_op op)
Definition: context_vk.c:249
VkCommandBuffer wined3d_context_vk_apply_draw_state(struct wined3d_context_vk *context_vk, const struct wined3d_state *state, struct wined3d_buffer_vk *indirect_vk, bool indexed)
Definition: context_vk.c:3722
static bool wined3d_get_unused_stream_index(const struct wined3d_state *state, uint32_t *index)
Definition: context_vk.c:278
void wined3d_context_vk_destroy_image(struct wined3d_context_vk *context_vk, struct wined3d_image_vk *image)
Definition: context_vk.c:1092
VkDescriptorPool wined3d_context_vk_get_vk_descriptor_pool(struct wined3d_context_vk *context_vk)
Definition: context_vk.c:3023
static bool wined3d_shader_descriptor_writes_vk_add_srv_write(struct wined3d_shader_descriptor_writes_vk *writes, struct wined3d_context_vk *context_vk, VkDescriptorSet vk_descriptor_set, const struct wined3d_state *state, const struct wined3d_shader_resource_binding *binding)
Definition: context_vk.c:3200
VkCommandBuffer wined3d_context_vk_get_command_buffer(struct wined3d_context_vk *context_vk)
Definition: context_vk.c:1805
static void wined3d_context_vk_cleanup_resources(struct wined3d_context_vk *context_vk, VkFence vk_fence)
Definition: context_vk.c:1174
static bool wined3d_render_pass_vk_init(struct wined3d_render_pass_vk *pass, struct wined3d_context_vk *context_vk, const struct wined3d_render_pass_key_vk *key)
Definition: context_vk.c:1408
static void wined3d_render_pass_key_vk_init(struct wined3d_render_pass_key_vk *key, const struct wined3d_fb_state *fb, unsigned int rt_count, bool depth_stencil, uint32_t clear_flags)
Definition: context_vk.c:1347
static void wined3d_context_vk_remove_command_buffer(struct wined3d_context_vk *context_vk, unsigned int submit_index)
Definition: context_vk.c:1157
static void wined3d_context_vk_free_memory(struct wined3d_context_vk *context_vk, struct wined3d_allocator_block *block)
Definition: context_vk.c:413
void wined3d_context_vk_destroy_bo(struct wined3d_context_vk *context_vk, const struct wined3d_bo_vk *bo)
Definition: context_vk.c:1106
static VkCullModeFlags vk_cull_mode_from_wined3d(enum wined3d_cull mode)
Definition: context_vk.c:170
static void wined3d_context_vk_load_buffers(struct wined3d_context_vk *context_vk, const struct wined3d_state *state, struct wined3d_buffer_vk *indirect_vk, bool indexed)
Definition: context_vk.c:3538
static bool wined3d_context_vk_update_graphics_pipeline_key(struct wined3d_context_vk *context_vk, const struct wined3d_state *state, VkPipelineLayout vk_pipeline_layout, uint32_t *null_buffer_binding)
Definition: context_vk.c:2482
static void wined3d_context_vk_reset_completed_queries(struct wined3d_context_vk *context_vk, struct wined3d_query_pool_vk *pool_vk, struct wined3d_command_buffer_vk *buffer)
Definition: context_vk.c:981
BOOL wined3d_context_vk_create_image(struct wined3d_context_vk *context_vk, VkImageType vk_image_type, VkImageUsageFlags usage, VkFormat vk_format, unsigned int width, unsigned int height, unsigned int depth, unsigned int sample_count, unsigned int mip_levels, unsigned int layer_count, unsigned int flags, struct wined3d_image_vk *image)
Definition: context_vk.c:610
void wined3d_context_vk_cleanup(struct wined3d_context_vk *context_vk)
Definition: context_vk.c:1725
static void wined3d_context_vk_prepare_used_rtv(struct wined3d_context_vk *context_vk, struct wined3d_rendertarget_view *rtv)
Definition: context_vk.c:3708
static bool wined3d_shader_descriptor_writes_vk_add_cbv_write(struct wined3d_shader_descriptor_writes_vk *writes, struct wined3d_context_vk *context_vk, VkDescriptorSet vk_descriptor_set, const struct wined3d_state *state, const struct wined3d_shader_resource_binding *binding, VkDescriptorBufferInfo *buffer_info)
Definition: context_vk.c:3176
void wined3d_context_vk_image_barrier(struct wined3d_context_vk *context_vk, VkCommandBuffer vk_command_buffer, VkPipelineStageFlags src_stage_mask, VkPipelineStageFlags dst_stage_mask, VkAccessFlags src_access_mask, VkAccessFlags dst_access_mask, VkImageLayout old_layout, VkImageLayout new_layout, VkImage image, const VkImageSubresourceRange *range)
Definition: context_vk.c:2022
static VkFormat vk_format_from_component_type(enum wined3d_component_type component_type)
Definition: context_vk.c:2467
VkCompareOp vk_compare_op_from_wined3d(enum wined3d_cmp_func op)
Definition: context_vk.c:30
static bool wined3d_context_vk_update_descriptors(struct wined3d_context_vk *context_vk, VkCommandBuffer vk_command_buffer, const struct wined3d_state *state, enum wined3d_pipeline pipeline)
Definition: context_vk.c:3331
static struct wined3d_retired_object_vk * wined3d_context_vk_get_retired_object_vk(struct wined3d_context_vk *context_vk)
Definition: context_vk.c:693
void wined3d_context_vk_submit_command_buffer(struct wined3d_context_vk *context_vk, unsigned int wait_semaphore_count, const VkSemaphore *wait_semaphores, const VkPipelineStageFlags *wait_stages, unsigned int signal_semaphore_count, const VkSemaphore *signal_semaphores)
Definition: context_vk.c:1896
void wined3d_context_vk_destroy_vk_event(struct wined3d_context_vk *context_vk, VkEvent vk_event, uint64_t command_buffer_id)
Definition: context_vk.c:1067
static VkResult wined3d_context_vk_create_vk_descriptor_pool(struct wined3d_device_vk *device_vk, const struct wined3d_vk_info *vk_info, VkDescriptorPool *vk_pool)
Definition: context_vk.c:2994
bool wined3d_context_vk_allocate_query(struct wined3d_context_vk *context_vk, enum wined3d_query_type type, struct wined3d_query_pool_idx_vk *pool_idx)
Definition: context_vk.c:1623
#define WINED3D_PERIODIC_SUBMIT_WORK_COUNT
Definition: context_vk.c:1784
static void wined3d_context_vk_destroy_vk_buffer(struct wined3d_context_vk *context_vk, VkBuffer vk_buffer, uint64_t command_buffer_id)
Definition: context_vk.c:881
static void wined3d_context_vk_return_vk_descriptor_pool(struct wined3d_context_vk *context_vk, VkDescriptorPool vk_descriptor_pool)
Definition: context_vk.c:737
void wined3d_allocator_chunk_vk_unmap(struct wined3d_allocator_chunk_vk *chunk_vk, struct wined3d_context_vk *context_vk)
Definition: context_vk.c:338
static void wined3d_bo_slab_vk_free_slice(struct wined3d_bo_slab_vk *slab, SIZE_T idx, struct wined3d_context_vk *context_vk)
Definition: context_vk.c:826
void wined3d_context_vk_wait_command_buffer(struct wined3d_context_vk *context_vk, uint64_t id)
Definition: context_vk.c:1990
static bool wined3d_shader_resource_bindings_add_null_srv_binding(struct wined3d_shader_descriptor_writes_vk *writes, VkDescriptorSet vk_descriptor_set, size_t binding_idx, enum wined3d_shader_resource_type type, enum wined3d_data_type data_type, struct wined3d_context_vk *context_vk)
Definition: context_vk.c:3119
void wined3d_context_vk_destroy_vk_pipeline(struct wined3d_context_vk *context_vk, VkPipeline vk_pipeline, uint64_t command_buffer_id)
Definition: context_vk.c:1016
static VkBlendOp vk_blend_op_from_wined3d(enum wined3d_blend_op op)
Definition: context_vk.c:134
HRESULT wined3d_context_vk_init(struct wined3d_context_vk *context_vk, struct wined3d_swapchain *swapchain)
Definition: context_vk.c:4151
component_type
range
Definition: d3dx9_private.h:58
#define E_FAIL
Definition: ddrawi.h:102
#define free
Definition: debug_ros.c:5
#define malloc
Definition: debug_ros.c:4
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
UINT32 uint32_t
Definition: types.h:75
UINT64 uint64_t
Definition: types.h:77
UINT op
Definition: effect.c:235
const VkDescriptorBufferInfo * wined3d_buffer_vk_get_buffer_info(struct wined3d_buffer_vk *buffer_vk)
Definition: buffer.c:1187
BOOL wined3d_buffer_load_location(struct wined3d_buffer *buffer, struct wined3d_context *context, uint32_t location)
Definition: buffer.c:269
void wined3d_buffer_load(struct wined3d_buffer *buffer, struct wined3d_context *context, const struct wined3d_state *state)
Definition: buffer.c:484
void wined3d_buffer_acquire_bo_for_write(struct wined3d_buffer *buffer, struct wined3d_context *context)
Definition: buffer.c:750
void wined3d_buffer_invalidate_location(struct wined3d_buffer *buffer, uint32_t location)
Definition: buffer.c:131
void wined3d_buffer_vk_barrier(struct wined3d_buffer_vk *buffer_vk, struct wined3d_context_vk *context_vk, uint32_t bind_mask)
Definition: buffer.c:1280
void context_invalidate_compute_state(struct wined3d_context *context, DWORD state_id)
Definition: context.c:66
void context_invalidate_state(struct wined3d_context *context, unsigned int state_id)
Definition: context.c:76
void wined3d_context_cleanup(struct wined3d_context *context)
Definition: context.c:48
void wined3d_context_init(struct wined3d_context *context, struct wined3d_swapchain *swapchain)
Definition: context.c:89
void wined3d_stream_info_from_declaration(struct wined3d_stream_info *stream_info, const struct wined3d_state *state, const struct wined3d_d3d_info *d3d_info)
Definition: context.c:160
void wined3d_query_vk_resume(struct wined3d_query_vk *query_vk, struct wined3d_context_vk *context_vk)
Definition: query.c:1579
bool wined3d_query_pool_vk_init(struct wined3d_query_pool_vk *pool_vk, struct wined3d_context_vk *context_vk, enum wined3d_query_type type, struct list *free_pools)
Definition: query.c:1390
void wined3d_query_vk_suspend(struct wined3d_query_vk *query_vk, struct wined3d_context_vk *context_vk)
Definition: query.c:1587
void wined3d_query_pool_vk_cleanup(struct wined3d_query_pool_vk *pool_vk, struct wined3d_context_vk *context_vk)
Definition: query.c:1378
void wined3d_query_pool_vk_mark_free(struct wined3d_context_vk *context_vk, struct wined3d_query_pool_vk *pool_vk, uint32_t start, uint32_t count)
Definition: query.c:1366
bool wined3d_query_pool_vk_allocate_query(struct wined3d_query_pool_vk *pool_vk, size_t *idx)
Definition: query.c:1357
unsigned int wined3d_resource_get_sample_count(const struct wined3d_resource *resource)
Definition: resource.c:456
struct wined3d_texture *__cdecl wined3d_texture_from_resource(struct wined3d_resource *resource)
Definition: texture.c:3343
const VkDescriptorImageInfo * wined3d_texture_vk_get_default_image_info(struct wined3d_texture_vk *texture_vk, struct wined3d_context_vk *context_vk)
Definition: texture.c:4601
void wined3d_texture_load(struct wined3d_texture *texture, struct wined3d_context *context, BOOL srgb)
Definition: texture.c:1657
void wined3d_texture_vk_make_generic(struct wined3d_texture_vk *texture_vk, struct wined3d_context_vk *context_vk)
Definition: texture.c:5581
struct wined3d_allocator_block * wined3d_allocator_allocate(struct wined3d_allocator *allocator, struct wined3d_context *context, unsigned int memory_type, size_t size)
Definition: utils.c:7234
unsigned int idx
Definition: utils.c:40
const char * debug_shader_type(enum wined3d_shader_type type)
Definition: utils.c:5313
const char * debug_d3dprimitivetype(enum wined3d_primitive_type primitive_type)
Definition: utils.c:5009
const char * wined3d_debug_vkresult(VkResult vr)
Definition: utils.c:5463
const struct wined3d_format * wined3d_get_format(const struct wined3d_adapter *adapter, enum wined3d_format_id format_id, unsigned int bind_flags)
Definition: utils.c:4428
BOOL wined3d_array_reserve(void **elements, SIZE_T *capacity, SIZE_T count, SIZE_T size)
Definition: utils.c:6740
void wined3d_allocator_block_free(struct wined3d_allocator_block *block)
Definition: utils.c:7087
void wined3d_format_colour_to_vk(const struct wined3d_format *format, const struct wined3d_color *c, VkClearColorValue *retval)
Definition: utils.c:5790
void wined3d_rendertarget_view_prepare_location(struct wined3d_rendertarget_view *view, struct wined3d_context *context, uint32_t location)
Definition: view.c:469
void wined3d_rendertarget_view_load_location(struct wined3d_rendertarget_view *view, struct wined3d_context *context, uint32_t location)
Definition: view.c:489
DWORD wined3d_rendertarget_view_get_locations(const struct wined3d_rendertarget_view *view)
Definition: view.c:520
void wined3d_rendertarget_view_validate_location(struct wined3d_rendertarget_view *view, uint32_t location)
Definition: view.c:495
void wined3d_unordered_access_view_invalidate_location(struct wined3d_unordered_access_view *view, uint32_t location)
Definition: view.c:1564
void wined3d_shader_resource_view_vk_update_layout(struct wined3d_shader_resource_view_vk *srv_vk, VkImageLayout layout)
Definition: view.c:1161
void wined3d_shader_resource_view_vk_update_buffer(struct wined3d_shader_resource_view_vk *srv_vk, struct wined3d_context_vk *context_vk)
Definition: view.c:1139
void wined3d_rendertarget_view_invalidate_location(struct wined3d_rendertarget_view *view, uint32_t location)
Definition: view.c:514
void wined3d_unordered_access_view_vk_update(struct wined3d_unordered_access_view_vk *uav_vk, struct wined3d_context_vk *context_vk)
Definition: view.c:2395
static __inline const char * wine_dbgstr_longlong(ULONGLONG ll)
Definition: compat.h:49
#define assert(_expr)
Definition: assert.h:32
_ACRTIMP int __cdecl memcmp(const void *, const void *, size_t)
Definition: string.c:2807
#define UINT64_MAX
Definition: stdint.h:86
return ret
Definition: mutex.c:147
static void blend(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
Definition: ffp_gl.c:337
static void scissor(const struct wined3d_rasterizer_state *r, const struct wined3d_gl_info *gl_info)
Definition: ffp_gl.c:873
static void depth_stencil(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
Definition: ffp_gl.c:766
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
static const FxOffsetAndName offsets[]
GLuint start
Definition: gl.h:1545
GLint GLint GLsizei GLsizei GLsizei depth
Definition: gl.h:1546
const GLdouble * v
Definition: gl.h:2040
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLclampf GLclampf GLclampf alpha
Definition: gl.h:1740
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLdouble GLdouble t
Definition: gl.h:2047
GLint GLint GLsizei width
Definition: gl.h:1546
GLenum GLuint texture
Definition: glext.h:6295
GLuint buffer
Definition: glext.h:5915
GLsizeiptr size
Definition: glext.h:5919
GLintptr offset
Definition: glext.h:5920
const GLubyte * c
Definition: glext.h:8905
GLuint sampler
Definition: glext.h:7283
GLuint index
Definition: glext.h:6031
GLenum GLint GLuint mask
Definition: glext.h:6028
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLenum mode
Definition: glext.h:6217
GLbitfield flags
Definition: glext.h:7161
const GLint * first
Definition: glext.h:5794
GLboolean enable
Definition: glext.h:11120
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
const GLuint * buffers
Definition: glext.h:5916
GLenum attachment
Definition: glext.h:6295
GLsizeiptr const GLvoid GLenum usage
Definition: glext.h:5919
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
Definition: glfuncs.h:240
enum wined3d_data_type data_type
Definition: glsl_shader.c:71
uint32_t entry
Definition: isohybrid.c:63
#define d
Definition: ke_i.h:81
#define e
Definition: ke_i.h:82
#define a
Definition: ke_i.h:78
#define b
Definition: ke_i.h:79
#define resource
Definition: kernel32.h:9
#define location(file, line)
Definition: kmtest.h:18
if(dx< 0)
Definition: linetemp.h:194
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
D3D11_SHADER_VARIABLE_DESC desc
Definition: reflection.c:1683
static const char * dst_format
Definition: dib.c:1339
#define eq(received, expected, label, type)
Definition: locale.c:179
static void stream_info(IStream *stream, HGLOBAL *hmem, int *size, int *pos)
static RPC_BINDING_HANDLE binding
Definition: server.c:166
static float(__cdecl *square_half_float)(float x
#define min(a, b)
Definition: monoChain.cc:55
static const struct @662 sizes[]
int k
Definition: mpi.c:3369
unsigned __int3264 UINT_PTR
Definition: mstsclib_h.h:274
static unsigned __int64 next
Definition: rand_nt.c:6
#define calloc
Definition: rosglue.h:14
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:236
#define LIST_FOR_EACH_ENTRY_SAFE(cursor, cursor2, list, type, field)
Definition: list.h:242
#define wine_rb_entry
Definition: rbtree.h:404
#define WINE_RB_ENTRY_VALUE
Definition: rbtree.h:414
#define wine_rb_put
Definition: rbtree.h:410
#define wine_rb_replace
Definition: rbtree.h:413
#define wine_rb_init
Definition: rbtree.h:406
#define wine_rb_destroy
Definition: rbtree.h:408
#define wine_rb_get
Definition: rbtree.h:409
#define wine_rb_remove
Definition: rbtree.h:411
#define u32
Definition: types.h:9
#define memset(x, y, z)
Definition: compat.h:39
#define TRACE(s)
Definition: solgame.cpp:4
Definition: dcommon.idl:28
VkAttachmentDescriptionFlags flags
Definition: vulkan.h:7352
uint32_t attachment
Definition: vulkan.h:7390
VkImageLayout layout
Definition: vulkan.h:7391
uint32_t queueFamilyIndexCount
Definition: vulkan.h:7608
const uint32_t * pQueueFamilyIndices
Definition: vulkan.h:7609
VkBufferCreateFlags flags
Definition: vulkan.h:7604
VkStructureType sType
Definition: vulkan.h:7602
const void * pNext
Definition: vulkan.h:7603
VkBufferUsageFlags usage
Definition: vulkan.h:7606
VkSharingMode sharingMode
Definition: vulkan.h:7607
VkStructureType sType
Definition: vulkan.h:7821
VkCommandBufferLevel level
Definition: vulkan.h:7824
const VkCommandBufferInheritanceInfo * pInheritanceInfo
Definition: vulkan.h:16042
VkStructureType sType
Definition: vulkan.h:16039
const void * pNext
Definition: vulkan.h:16040
VkCommandBufferUsageFlags flags
Definition: vulkan.h:16041
const void * pNext
Definition: vulkan.h:7873
VkStructureType sType
Definition: vulkan.h:7872
uint32_t queueFamilyIndex
Definition: vulkan.h:7875
VkCommandPoolCreateFlags flags
Definition: vulkan.h:7874
VkImageLayout imageLayout
Definition: vulkan.h:8266
VkStructureType sType
Definition: vulkan.h:16190
const VkDescriptorPoolSize * pPoolSizes
Definition: vulkan.h:16195
VkDescriptorPoolCreateFlags flags
Definition: vulkan.h:16192
VkStructureType sType
Definition: vulkan.h:8285
const VkDescriptorSetLayout * pSetLayouts
Definition: vulkan.h:8289
const VkDescriptorSetLayoutBinding * pBindings
Definition: vulkan.h:8324
VkDescriptorSetLayoutCreateFlags flags
Definition: vulkan.h:8322
const void * pNext
Definition: vulkan.h:8621
VkStructureType sType
Definition: vulkan.h:8620
VkEventCreateFlags flags
Definition: vulkan.h:8622
uint32_t width
Definition: vulkan.h:8666
uint32_t height
Definition: vulkan.h:8667
uint32_t depth
Definition: vulkan.h:8674
uint32_t height
Definition: vulkan.h:8673
uint32_t width
Definition: vulkan.h:8672
const void * pNext
Definition: vulkan.h:8731
VkFenceCreateFlags flags
Definition: vulkan.h:8732
VkStructureType sType
Definition: vulkan.h:8730
const VkImageView * pAttachments
Definition: vulkan.h:8821
VkStructureType sType
Definition: vulkan.h:8816
VkFramebufferCreateFlags flags
Definition: vulkan.h:8818
const void * pNext
Definition: vulkan.h:8817
uint32_t attachmentCount
Definition: vulkan.h:8820
VkImageCreateFlags flags
Definition: vulkan.h:8974
VkSharingMode sharingMode
Definition: vulkan.h:8983
VkImageLayout initialLayout
Definition: vulkan.h:8986
uint32_t mipLevels
Definition: vulkan.h:8978
const void * pNext
Definition: vulkan.h:8973
const uint32_t * pQueueFamilyIndices
Definition: vulkan.h:8985
uint32_t arrayLayers
Definition: vulkan.h:8979
VkSampleCountFlagBits samples
Definition: vulkan.h:8980
VkExtent3D extent
Definition: vulkan.h:8977
VkFormat format
Definition: vulkan.h:8976
uint32_t queueFamilyIndexCount
Definition: vulkan.h:8984
VkImageType imageType
Definition: vulkan.h:8975
VkImageTiling tiling
Definition: vulkan.h:8981
VkStructureType sType
Definition: vulkan.h:8972
VkImageUsageFlags usage
Definition: vulkan.h:8982
VkAccessFlags dstAccessMask
Definition: vulkan.h:16393
uint32_t dstQueueFamilyIndex
Definition: vulkan.h:16397
VkAccessFlags srcAccessMask
Definition: vulkan.h:16392
VkStructureType sType
Definition: vulkan.h:16390
VkImageLayout newLayout
Definition: vulkan.h:16395
const void * pNext
Definition: vulkan.h:16391
VkImageSubresourceRange subresourceRange
Definition: vulkan.h:16399
VkImageLayout oldLayout
Definition: vulkan.h:16394
uint32_t srcQueueFamilyIndex
Definition: vulkan.h:16396
VkStructureType sType
Definition: vulkan.h:9351
uint32_t memoryTypeIndex
Definition: vulkan.h:9354
const void * pNext
Definition: vulkan.h:9352
uint32_t memoryTypeBits
Definition: vulkan.h:9460
VkMemoryPropertyFlags propertyFlags
Definition: vulkan.h:9474
int32_t x
Definition: vulkan.h:9573
int32_t y
Definition: vulkan.h:9574
uint32_t maxFramebufferLayers
Definition: vulkan.h:11141
uint32_t maxFramebufferHeight
Definition: vulkan.h:11140
uint32_t maxFramebufferWidth
Definition: vulkan.h:11139
VkMemoryType memoryTypes[VK_MAX_MEMORY_TYPES]
Definition: vulkan.h:11320
VkPipelineLayoutCreateFlags flags
Definition: vulkan.h:16646
VkStructureType sType
Definition: vulkan.h:16644
uint32_t pushConstantRangeCount
Definition: vulkan.h:16649
const VkPushConstantRange * pPushConstantRanges
Definition: vulkan.h:16650
const VkDescriptorSetLayout * pSetLayouts
Definition: vulkan.h:16648
VkShaderStageFlagBits stage
Definition: vulkan.h:17329
VkExtent2D extent
Definition: vulkan.h:13605
VkOffset2D offset
Definition: vulkan.h:13604
const void * pNext
Definition: vulkan.h:13643
const VkClearValue * pClearValues
Definition: vulkan.h:13648
VkStructureType sType
Definition: vulkan.h:13642
uint32_t clearValueCount
Definition: vulkan.h:13647
uint32_t attachmentCount
Definition: vulkan.h:16759
VkStructureType sType
Definition: vulkan.h:16756
const VkSubpassDescription * pSubpasses
Definition: vulkan.h:16762
const void * pNext
Definition: vulkan.h:16757
const VkSubpassDependency * pDependencies
Definition: vulkan.h:16764
const VkAttachmentDescription * pAttachments
Definition: vulkan.h:16760
VkRenderPassCreateFlags flags
Definition: vulkan.h:16758
uint32_t dependencyCount
Definition: vulkan.h:16763
uint32_t waitSemaphoreCount
Definition: vulkan.h:14150
const VkPipelineStageFlags * pWaitDstStageMask
Definition: vulkan.h:14152
uint32_t commandBufferCount
Definition: vulkan.h:14153
const VkSemaphore * pWaitSemaphores
Definition: vulkan.h:14151
uint32_t signalSemaphoreCount
Definition: vulkan.h:14155
const VkCommandBuffer * pCommandBuffers
Definition: vulkan.h:14154
const void * pNext
Definition: vulkan.h:14149
const VkSemaphore * pSignalSemaphores
Definition: vulkan.h:14156
VkStructureType sType
Definition: vulkan.h:14148
const VkAttachmentReference * pDepthStencilAttachment
Definition: vulkan.h:14216
VkSubpassDescriptionFlags flags
Definition: vulkan.h:14209
uint32_t inputAttachmentCount
Definition: vulkan.h:14211
const VkAttachmentReference * pResolveAttachments
Definition: vulkan.h:14215
const uint32_t * pPreserveAttachments
Definition: vulkan.h:14218
const VkAttachmentReference * pInputAttachments
Definition: vulkan.h:14212
uint32_t colorAttachmentCount
Definition: vulkan.h:14213
const VkAttachmentReference * pColorAttachments
Definition: vulkan.h:14214
VkPipelineBindPoint pipelineBindPoint
Definition: vulkan.h:14210
uint32_t preserveAttachmentCount
Definition: vulkan.h:14217
float y
Definition: vulkan.h:15222
float maxDepth
Definition: vulkan.h:15226
float x
Definition: vulkan.h:15221
float width
Definition: vulkan.h:15223
float height
Definition: vulkan.h:15224
float minDepth
Definition: vulkan.h:15225
Definition: image.c:84
Definition: copy.c:22
Definition: parse.h:23
enum view_type type
VkPhysicalDeviceMemoryProperties memory_properties
Definition: wined3d_vk.h:734
struct wined3d_vk_info vk_info
Definition: wined3d_vk.h:728
VkPhysicalDeviceLimits device_limits
Definition: wined3d_vk.h:733
VkDeviceMemory vk_memory
Definition: wined3d_vk.h:780
struct wined3d_allocator_chunk c
Definition: wined3d_vk.h:779
struct wined3d_bo_slab_vk * next
Definition: wined3d_vk.h:341
VkMemoryPropertyFlags requested_memory_type
Definition: wined3d_vk.h:342
struct wine_rb_entry entry
Definition: wined3d_vk.h:340
struct wined3d_bo_vk bo
Definition: wined3d_vk.h:343
struct wined3d_allocator_block * memory
Definition: wined3d_vk.h:313
struct wined3d_bo b
Definition: wined3d_vk.h:310
VkBufferUsageFlags usage
Definition: wined3d_vk.h:319
VkBuffer vk_buffer
Definition: wined3d_vk.h:312
VkDeviceSize size
Definition: wined3d_vk.h:318
uint64_t command_buffer_id
Definition: wined3d_vk.h:322
bool host_synced
Definition: wined3d_vk.h:323
VkMemoryPropertyFlags memory_type
Definition: wined3d_vk.h:320
struct wined3d_bo_slab_vk * slab
Definition: wined3d_vk.h:314
VkDeviceMemory vk_memory
Definition: wined3d_vk.h:316
struct wined3d_buffer b
Definition: wined3d_vk.h:920
VkDescriptorBufferInfo buffer_info
Definition: wined3d_vk.h:922
VkCommandBuffer vk_command_buffer
Definition: wined3d_vk.h:422
struct wined3d_buffer * buffer
Definition: wined3d.h:2209
VkDescriptorPool * vk_descriptor_pools
Definition: wined3d_vk.h:638
struct list active_queries
Definition: wined3d_vk.h:648
VkDeviceSize retired_bo_size
Definition: wined3d_vk.h:619
struct list completed_query_pools
Definition: wined3d_vk.h:649
VkSampleCountFlagBits sample_count
Definition: wined3d_vk.h:640
VkDeviceSize vk_so_offsets[WINED3D_MAX_STREAM_OUTPUT_BUFFERS]
Definition: wined3d_vk.h:644
unsigned int rt_count
Definition: wined3d_vk.h:641
struct wined3d_command_buffer_vk current_command_buffer
Definition: wined3d_vk.h:617
struct wined3d_bo_vk vk_so_counter_bo
Definition: wined3d_vk.h:645
VkDynamicState dynamic_states[27]
Definition: wined3d_vk.h:592
uint64_t completed_command_buffer_id
Definition: wined3d_vk.h:618
struct wined3d_context_vk::@363 compute
struct list free_occlusion_query_pools
Definition: wined3d_vk.h:650
struct wined3d_retired_objects_vk retired
Definition: wined3d_vk.h:655
struct wine_rb_tree bo_slab_available
Definition: wined3d_vk.h:659
struct wined3d_context_vk::@362 graphics
struct wined3d_shader_descriptor_writes_vk descriptor_writes
Definition: wined3d_vk.h:631
const struct wined3d_vk_info * vk_info
Definition: wined3d_vk.h:590
SIZE_T vk_descriptor_pools_size
Definition: wined3d_vk.h:636
uint32_t update_compute_pipeline
Definition: wined3d_vk.h:594
struct list free_stream_output_statistics_query_pools
Definition: wined3d_vk.h:653
unsigned int command_buffer_work_count
Definition: wined3d_vk.h:622
struct wine_rb_tree pipeline_layouts
Definition: wined3d_vk.h:657
SIZE_T vk_descriptor_pool_count
Definition: wined3d_vk.h:637
struct list free_pipeline_statistics_query_pools
Definition: wined3d_vk.h:652
VkCommandPool vk_command_pool
Definition: wined3d_vk.h:616
VkBuffer vk_so_counters[WINED3D_MAX_STREAM_OUTPUT_BUFFERS]
Definition: wined3d_vk.h:643
VkRenderPass vk_render_pass
Definition: wined3d_vk.h:634
VkFramebuffer vk_framebuffer
Definition: wined3d_vk.h:633
struct wined3d_context_vk::@364 submitted
struct wine_rb_tree render_passes
Definition: wined3d_vk.h:656
struct wined3d_context_vk::@364 completed
uint32_t update_stream_output
Definition: wined3d_vk.h:595
struct list render_pass_queries
Definition: wined3d_vk.h:647
struct wine_rb_tree graphics_pipelines
Definition: wined3d_vk.h:658
struct wined3d_context c
Definition: wined3d_vk.h:588
struct list free_timestamp_query_pools
Definition: wined3d_vk.h:651
uint32_t wined3d_creation_flags
struct wined3d_device d
Definition: wined3d_vk.h:821
VkDevice vk_device
Definition: wined3d_vk.h:825
uint32_t vk_queue_family_index
Definition: wined3d_vk.h:827
struct wined3d_vk_info vk_info
Definition: wined3d_vk.h:830
struct wined3d_context_vk context_vk
Definition: wined3d_vk.h:823
struct wined3d_null_resources_vk null_resources_vk
Definition: wined3d_vk.h:832
struct wined3d_null_views_vk null_views_vk
Definition: wined3d_vk.h:833
struct wined3d_allocator allocator
Definition: wined3d_vk.h:836
struct wined3d_rendertarget_view * depth_stencil
struct wined3d_rendertarget_view * render_targets[WINED3D_MAX_RENDER_TARGETS]
VkFormat vk_format
Definition: wined3d_vk.h:1083
struct wined3d_graphics_pipeline_key_vk key
Definition: wined3d_vk.h:551
struct wine_rb_entry entry
Definition: wined3d_vk.h:550
VkDescriptorSetLayout vk_set_layout
Definition: wined3d_vk.h:522
VkPipelineLayout vk_pipeline_layout
Definition: wined3d_vk.h:521
struct wine_rb_entry entry
Definition: wined3d_vk.h:519
struct wined3d_pipeline_layout_key_vk key
Definition: wined3d_vk.h:520
struct wined3d_query_pool_vk * pool_vk
Definition: wined3d_vk.h:385
uint32_t completed[WINED3D_BITMAP_SIZE(WINED3D_QUERY_POOL_SIZE)]
Definition: wined3d_vk.h:372
struct list completed_entry
Definition: wined3d_vk.h:365
VkQueryPool vk_query_pool
Definition: wined3d_vk.h:368
struct wined3d_query_pool_idx_vk pool_idx
Definition: wined3d_vk.h:398
struct wined3d_query q
Definition: wined3d_vk.h:395
struct wined3d_rendertarget_view v
Definition: wined3d_vk.h:949
struct wined3d_resource * resource
const struct wined3d_format * format
struct wined3d_query_pool_vk * pool_vk
Definition: wined3d_vk.h:468
enum wined3d_retired_object_type_vk type
Definition: wined3d_vk.h:446
struct wined3d_retired_object_vk::@359::@360 slice
VkBufferView vk_buffer_view
Definition: wined3d_vk.h:461
VkFramebuffer vk_framebuffer
Definition: wined3d_vk.h:450
union wined3d_retired_object_vk::@359 u
VkDeviceMemory vk_memory
Definition: wined3d_vk.h:452
struct wined3d_allocator_block * block
Definition: wined3d_vk.h:453
struct wined3d_bo_slab_vk * slab
Definition: wined3d_vk.h:456
VkDescriptorPool vk_descriptor_pool
Definition: wined3d_vk.h:451
struct wined3d_retired_object_vk::@359::@361 queries
struct wined3d_retired_object_vk * next
Definition: wined3d_vk.h:449
struct wined3d_retired_object_vk * objects
Definition: wined3d_vk.h:478
struct wined3d_retired_object_vk * free
Definition: wined3d_vk.h:479
VkWriteDescriptorSet * writes
Definition: wined3d_vk.h:582
struct wined3d_shader_resource_binding * bindings
Definition: wined3d_vk.h:576
struct wined3d_view_vk view_vk
Definition: wined3d_vk.h:997
struct wined3d_resource * resource
struct wined3d_shader_signature input_signature
struct wined3d_shader_reg_maps reg_maps
struct wined3d_device * device
enum VkImageLayout layout
Definition: wined3d_vk.h:878
struct wined3d_view_vk view_vk
Definition: wined3d_vk.h:1025
struct wined3d_resource * resource
VkBufferView vk_buffer_view
Definition: wined3d_vk.h:988
VkDescriptorImageInfo vk_image_info
Definition: wined3d_vk.h:989
union wined3d_view_vk::@365 u
bool dynamic_blend_state
Definition: wined3d_vk.h:268
bool dynamic_patch_vertex_count
Definition: wined3d_vk.h:266
bool dynamic_multisample_state
Definition: wined3d_vk.h:267
BOOL supported[WINED3D_VK_EXT_COUNT]
Definition: wined3d_vk.h:261
bool dynamic_rasterizer_state
Definition: wined3d_vk.h:269
#define max(a, b)
Definition: svc.c:63
ULONG_PTR SIZE_T
Definition: typedefs.h:80
pass
Definition: typegen.h:25
int32_t int32[4]
Definition: vulkan.h:7719
VkClearColorValue color
Definition: vulkan.h:7731
VkClearDepthStencilValue depthStencil
Definition: vulkan.h:7732
void VKAPI_CALL vkFreeCommandBuffers(VkDevice device, VkCommandPool commandPool, uint32_t commandBufferCount, const VkCommandBuffer *pCommandBuffers)
void VKAPI_CALL vkCmdSetSampleMaskEXT(VkCommandBuffer commandBuffer, VkSampleCountFlagBits samples, const VkSampleMask *pSampleMask)
void VKAPI_CALL vkCmdSetDepthBiasEnableEXT(VkCommandBuffer commandBuffer, VkBool32 depthBiasEnable)
VkFlags VkMemoryPropertyFlags
Definition: vulkan.h:1063
VkFlags VkPipelineStageFlags
Definition: vulkan.h:1101
VkResult VKAPI_CALL vkBindImageMemory(VkDevice device, VkImage image, VkDeviceMemory memory, VkDeviceSize memoryOffset)
void VKAPI_CALL vkCmdSetPrimitiveRestartEnableEXT(VkCommandBuffer commandBuffer, VkBool32 primitiveRestartEnable)
VkImageLayout
Definition: vulkan.h:3450
@ VK_IMAGE_LAYOUT_UNDEFINED
Definition: vulkan.h:3451
void VKAPI_CALL vkCmdSetRasterizerDiscardEnableEXT(VkCommandBuffer commandBuffer, VkBool32 rasterizerDiscardEnable)
void VKAPI_CALL vkDestroyRenderPass(VkDevice device, VkRenderPass renderPass, const VkAllocationCallbacks *pAllocator)
@ VK_COMMAND_BUFFER_LEVEL_PRIMARY
Definition: vulkan.h:2140
VkIndexType
Definition: vulkan.h:3559
@ VK_INDEX_TYPE_UINT16
Definition: vulkan.h:3560
@ VK_INDEX_TYPE_UINT32
Definition: vulkan.h:3561
void VKAPI_CALL vkCmdSetDepthWriteEnableEXT(VkCommandBuffer commandBuffer, VkBool32 depthWriteEnable)
VkShaderStageFlagBits
Definition: vulkan.h:4873
@ VK_SHADER_STAGE_VERTEX_BIT
Definition: vulkan.h:4874
@ VK_SHADER_STAGE_COMPUTE_BIT
Definition: vulkan.h:4880
@ VK_SHADER_STAGE_GEOMETRY_BIT
Definition: vulkan.h:4877
@ VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT
Definition: vulkan.h:4875
@ VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT
Definition: vulkan.h:4876
@ VK_SHADER_STAGE_FRAGMENT_BIT
Definition: vulkan.h:4878
@ VK_SHARING_MODE_EXCLUSIVE
Definition: vulkan.h:4921
VkResult VKAPI_CALL vkCreateDescriptorSetLayout(VkDevice device, const VkDescriptorSetLayoutCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkDescriptorSetLayout *pSetLayout)
#define VK_TRUE
Definition: vulkan.h:55
@ VK_MEMORY_PROPERTY_HOST_COHERENT_BIT
Definition: vulkan.h:3772
@ VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT
Definition: vulkan.h:3770
@ VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT
Definition: vulkan.h:3771
VkResult VKAPI_CALL vkCreateBuffer(VkDevice device, const VkBufferCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkBuffer *pBuffer)
void VKAPI_CALL vkCmdBindDescriptorSets(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipelineLayout layout, uint32_t firstSet, uint32_t descriptorSetCount, const VkDescriptorSet *pDescriptorSets, uint32_t dynamicOffsetCount, const uint32_t *pDynamicOffsets)
VkFlags VkAccessFlags
Definition: vulkan.h:957
VkResult VKAPI_CALL vkQueueSubmit(VkQueue queue, uint32_t submitCount, const VkSubmitInfo *pSubmits, VkFence fence)
void VKAPI_CALL vkCmdSetViewport(VkCommandBuffer commandBuffer, uint32_t firstViewport, uint32_t viewportCount, const VkViewport *pViewports)
void VKAPI_CALL vkCmdBeginRenderPass(VkCommandBuffer commandBuffer, const VkRenderPassBeginInfo *pRenderPassBegin, VkSubpassContents contents)
VkDynamicState
Definition: vulkan.h:2605
@ VK_DYNAMIC_STATE_DEPTH_BIAS
Definition: vulkan.h:2609
@ VK_DYNAMIC_STATE_ALPHA_TO_COVERAGE_ENABLE_EXT
Definition: vulkan.h:2651
@ VK_DYNAMIC_STATE_DEPTH_CLAMP_ENABLE_EXT
Definition: vulkan.h:2647
@ VK_DYNAMIC_STATE_BLEND_CONSTANTS
Definition: vulkan.h:2610
@ VK_DYNAMIC_STATE_PATCH_CONTROL_POINTS_EXT
Definition: vulkan.h:2640
@ VK_DYNAMIC_STATE_DEPTH_WRITE_ENABLE_EXT
Definition: vulkan.h:2687
@ VK_DYNAMIC_STATE_DEPTH_BIAS_ENABLE_EXT
Definition: vulkan.h:2693
@ VK_DYNAMIC_STATE_PRIMITIVE_TOPOLOGY_EXT
Definition: vulkan.h:2682
@ VK_DYNAMIC_STATE_COLOR_BLEND_ENABLE_EXT
Definition: vulkan.h:2654
@ VK_DYNAMIC_STATE_RASTERIZATION_SAMPLES_EXT
Definition: vulkan.h:2649
@ VK_DYNAMIC_STATE_STENCIL_TEST_ENABLE_EXT
Definition: vulkan.h:2690
@ VK_DYNAMIC_STATE_DEPTH_COMPARE_OP_EXT
Definition: vulkan.h:2688
@ VK_DYNAMIC_STATE_STENCIL_WRITE_MASK
Definition: vulkan.h:2613
@ VK_DYNAMIC_STATE_FRONT_FACE_EXT
Definition: vulkan.h:2681
@ VK_DYNAMIC_STATE_RASTERIZER_DISCARD_ENABLE_EXT
Definition: vulkan.h:2692
@ VK_DYNAMIC_STATE_VIEWPORT
Definition: vulkan.h:2606
@ VK_DYNAMIC_STATE_PRIMITIVE_RESTART_ENABLE_EXT
Definition: vulkan.h:2694
@ VK_DYNAMIC_STATE_STENCIL_COMPARE_MASK
Definition: vulkan.h:2612
@ VK_DYNAMIC_STATE_STENCIL_REFERENCE
Definition: vulkan.h:2614
@ VK_DYNAMIC_STATE_CULL_MODE_EXT
Definition: vulkan.h:2680
@ VK_DYNAMIC_STATE_SAMPLE_MASK_EXT
Definition: vulkan.h:2650
@ VK_DYNAMIC_STATE_DEPTH_TEST_ENABLE_EXT
Definition: vulkan.h:2686
@ VK_DYNAMIC_STATE_STENCIL_OP_EXT
Definition: vulkan.h:2691
@ VK_DYNAMIC_STATE_COLOR_BLEND_EQUATION_EXT
Definition: vulkan.h:2655
@ VK_DYNAMIC_STATE_COLOR_WRITE_MASK_EXT
Definition: vulkan.h:2656
@ VK_DYNAMIC_STATE_SCISSOR
Definition: vulkan.h:2607
void VKAPI_CALL vkDestroyImageView(VkDevice device, VkImageView imageView, const VkAllocationCallbacks *pAllocator)
VkFlags VkImageUsageFlags
Definition: vulkan.h:1050
void VKAPI_CALL vkCmdSetColorWriteMaskEXT(VkCommandBuffer commandBuffer, uint32_t firstAttachment, uint32_t attachmentCount, const VkColorComponentFlags *pColorWriteMasks)
void VKAPI_CALL vkCmdSetCullModeEXT(VkCommandBuffer commandBuffer, VkCullModeFlags cullMode)
void VKAPI_CALL vkCmdSetStencilWriteMask(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, uint32_t writeMask)
void VKAPI_CALL vkCmdBindTransformFeedbackBuffersEXT(VkCommandBuffer commandBuffer, uint32_t firstBinding, uint32_t bindingCount, const VkBuffer *pBuffers, const VkDeviceSize *pOffsets, const VkDeviceSize *pSizes)
uint64_t VkDeviceSize
Definition: vulkan.h:948
void VKAPI_CALL vkCmdSetStencilCompareMask(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, uint32_t compareMask)
void VKAPI_CALL vkCmdSetBlendConstants(VkCommandBuffer commandBuffer, const float blendConstants[4])
VkResult VKAPI_CALL vkBeginCommandBuffer(VkCommandBuffer commandBuffer, const VkCommandBufferBeginInfo *pBeginInfo)
void VKAPI_CALL vkDestroyPipelineLayout(VkDevice device, VkPipelineLayout pipelineLayout, const VkAllocationCallbacks *pAllocator)
void VKAPI_CALL vkCmdSetRasterizationSamplesEXT(VkCommandBuffer commandBuffer, VkSampleCountFlagBits rasterizationSamples)
void VKAPI_CALL vkDestroyDescriptorSetLayout(VkDevice device, VkDescriptorSetLayout descriptorSetLayout, const VkAllocationCallbacks *pAllocator)
VkResult VKAPI_CALL vkCreatePipelineLayout(VkDevice device, const VkPipelineLayoutCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkPipelineLayout *pPipelineLayout)
@ VK_IMAGE_TILING_OPTIMAL
Definition: vulkan.h:3495
@ VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT
Definition: vulkan.h:2153
VkPipelineBindPoint
Definition: vulkan.h:4067
@ VK_PIPELINE_BIND_POINT_GRAPHICS
Definition: vulkan.h:4068
@ VK_PIPELINE_BIND_POINT_COMPUTE
Definition: vulkan.h:4069
void VKAPI_CALL vkGetBufferMemoryRequirements(VkDevice device, VkBuffer buffer, VkMemoryRequirements *pMemoryRequirements)
void VKAPI_CALL vkFreeMemory(VkDevice device, VkDeviceMemory memory, const VkAllocationCallbacks *pAllocator)
void VKAPI_CALL vkCmdResetQueryPool(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount)
void VKAPI_CALL vkDestroyBufferView(VkDevice device, VkBufferView bufferView, const VkAllocationCallbacks *pAllocator)
void VKAPI_CALL vkDestroyCommandPool(VkDevice device, VkCommandPool commandPool, const VkAllocationCallbacks *pAllocator)
VkStencilOp
Definition: vulkan.h:4950
@ VK_STENCIL_OP_INCREMENT_AND_CLAMP
Definition: vulkan.h:4954
@ VK_STENCIL_OP_DECREMENT_AND_CLAMP
Definition: vulkan.h:4955
@ VK_STENCIL_OP_INCREMENT_AND_WRAP
Definition: vulkan.h:4957
@ VK_STENCIL_OP_KEEP
Definition: vulkan.h:4951
@ VK_STENCIL_OP_REPLACE
Definition: vulkan.h:4953
@ VK_STENCIL_OP_ZERO
Definition: vulkan.h:4952
@ VK_STENCIL_OP_DECREMENT_AND_WRAP
Definition: vulkan.h:4958
@ VK_STENCIL_OP_INVERT
Definition: vulkan.h:4956
void VKAPI_CALL vkDestroyFence(VkDevice device, VkFence fence, const VkAllocationCallbacks *pAllocator)
void VKAPI_CALL vkDestroyBuffer(VkDevice device, VkBuffer buffer, const VkAllocationCallbacks *pAllocator)
void VKAPI_CALL vkResetQueryPoolEXT(VkDevice device, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount)
VkResult VKAPI_CALL vkGetFenceStatus(VkDevice device, VkFence fence)
void VKAPI_CALL vkCmdSetDepthBias(VkCommandBuffer commandBuffer, float depthBiasConstantFactor, float depthBiasClamp, float depthBiasSlopeFactor)
void VKAPI_CALL vkCmdSetDepthTestEnableEXT(VkCommandBuffer commandBuffer, VkBool32 depthTestEnable)
void VKAPI_CALL vkCmdEndRenderPass(VkCommandBuffer commandBuffer)
void VKAPI_CALL vkGetImageMemoryRequirements(VkDevice device, VkImage image, VkMemoryRequirements *pMemoryRequirements)
@ VK_CULL_MODE_FRONT_BIT
Definition: vulkan.h:2311
@ VK_CULL_MODE_NONE
Definition: vulkan.h:2310
@ VK_CULL_MODE_BACK_BIT
Definition: vulkan.h:2312
VkResult VKAPI_CALL vkAllocateCommandBuffers(VkDevice device, const VkCommandBufferAllocateInfo *pAllocateInfo, VkCommandBuffer *pCommandBuffers)
void VKAPI_CALL vkCmdSetAlphaToCoverageEnableEXT(VkCommandBuffer commandBuffer, VkBool32 alphaToCoverageEnable)
VkResult VKAPI_CALL vkEndCommandBuffer(VkCommandBuffer commandBuffer)
void VKAPI_CALL vkDestroyFramebuffer(VkDevice device, VkFramebuffer framebuffer, const VkAllocationCallbacks *pAllocator)
#define VK_ATTACHMENT_UNUSED
Definition: vulkan.h:54
VkSampleCountFlagBits
Definition: vulkan.h:4700
@ VK_SAMPLE_COUNT_1_BIT
Definition: vulkan.h:4701
VkResult VKAPI_CALL vkCreateFramebuffer(VkDevice device, const VkFramebufferCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkFramebuffer *pFramebuffer)
void VKAPI_CALL vkCmdSetStencilTestEnableEXT(VkCommandBuffer commandBuffer, VkBool32 stencilTestEnable)
VkResult VKAPI_CALL vkWaitForFences(VkDevice device, uint32_t fenceCount, const VkFence *pFences, VkBool32 waitAll, uint64_t timeout)
VkResult VKAPI_CALL vkCreateEvent(VkDevice device, const VkEventCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkEvent *pEvent)
void VKAPI_CALL vkCmdBindPipeline(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipeline pipeline)
VkResult VKAPI_CALL vkAllocateMemory(VkDevice device, const VkMemoryAllocateInfo *pAllocateInfo, const VkAllocationCallbacks *pAllocator, VkDeviceMemory *pMemory)
VkCompareOp
Definition: vulkan.h:2174
@ VK_COMPARE_OP_LESS_OR_EQUAL
Definition: vulkan.h:2178
@ VK_COMPARE_OP_LESS
Definition: vulkan.h:2176
@ VK_COMPARE_OP_NOT_EQUAL
Definition: vulkan.h:2180
@ VK_COMPARE_OP_NEVER
Definition: vulkan.h:2175
@ VK_COMPARE_OP_ALWAYS
Definition: vulkan.h:2182
@ VK_COMPARE_OP_EQUAL
Definition: vulkan.h:2177
@ VK_COMPARE_OP_GREATER_OR_EQUAL
Definition: vulkan.h:2181
@ VK_COMPARE_OP_GREATER
Definition: vulkan.h:2179
void VKAPI_CALL vkDestroyEvent(VkDevice device, VkEvent event, const VkAllocationCallbacks *pAllocator)
@ VK_LOGIC_OP_COPY
Definition: vulkan.h:3714
VkBlendOp
Definition: vulkan.h:1816
@ VK_BLEND_OP_ADD
Definition: vulkan.h:1817
@ VK_BLEND_OP_SUBTRACT
Definition: vulkan.h:1818
@ VK_BLEND_OP_MIN
Definition: vulkan.h:1820
@ VK_BLEND_OP_MAX
Definition: vulkan.h:1821
@ VK_BLEND_OP_REVERSE_SUBTRACT
Definition: vulkan.h:1819
void VKAPI_CALL vkCmdSetFrontFaceEXT(VkCommandBuffer commandBuffer, VkFrontFace frontFace)
void VKAPI_CALL vkCmdSetStencilReference(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, uint32_t reference)
void VKAPI_CALL vkDestroySampler(VkDevice device, VkSampler sampler, const VkAllocationCallbacks *pAllocator)
#define VK_FALSE
Definition: vulkan.h:56
void VKAPI_CALL vkCmdBindIndexBuffer(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, VkIndexType indexType)
@ VK_STENCIL_FACE_FRONT_AND_BACK
Definition: vulkan.h:4944
@ VK_STENCIL_FACE_FRONT_BIT
Definition: vulkan.h:4942
@ VK_STENCIL_FACE_BACK_BIT
Definition: vulkan.h:4943
VkImageType
Definition: vulkan.h:3501
void VKAPI_CALL vkCmdSetColorBlendEnableEXT(VkCommandBuffer commandBuffer, uint32_t firstAttachment, uint32_t attachmentCount, const VkBool32 *pColorBlendEnables)
VkResult VKAPI_CALL vkResetDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool, VkDescriptorPoolResetFlags flags)
void VKAPI_CALL vkCmdSetScissor(VkCommandBuffer commandBuffer, uint32_t firstScissor, uint32_t scissorCount, const VkRect2D *pScissors)
#define VK_WHOLE_SIZE
Definition: vulkan.h:53
void VKAPI_CALL vkCmdSetDepthCompareOpEXT(VkCommandBuffer commandBuffer, VkCompareOp depthCompareOp)
void VKAPI_CALL vkCmdSetStencilOpEXT(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, VkStencilOp failOp, VkStencilOp passOp, VkStencilOp depthFailOp, VkCompareOp compareOp)
VkFlags VkBufferUsageFlags
Definition: vulkan.h:965
@ VK_BUFFER_USAGE_STORAGE_TEXEL_BUFFER_BIT
Definition: vulkan.h:1918
@ VK_BUFFER_USAGE_UNIFORM_TEXEL_BUFFER_BIT
Definition: vulkan.h:1917
@ VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT
Definition: vulkan.h:1919
@ VK_BUFFER_USAGE_TRANSFORM_FEEDBACK_COUNTER_BUFFER_BIT_EXT
Definition: vulkan.h:1927
@ VK_BUFFER_USAGE_STORAGE_BUFFER_BIT
Definition: vulkan.h:1920
VkPrimitiveTopology
Definition: vulkan.h:4435
@ VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST
Definition: vulkan.h:4439
@ VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP
Definition: vulkan.h:4440
@ VK_PRIMITIVE_TOPOLOGY_PATCH_LIST
Definition: vulkan.h:4446
@ VK_PRIMITIVE_TOPOLOGY_TRIANGLE_FAN
Definition: vulkan.h:4441
@ VK_PRIMITIVE_TOPOLOGY_LINE_STRIP_WITH_ADJACENCY
Definition: vulkan.h:4443
@ VK_PRIMITIVE_TOPOLOGY_LINE_LIST_WITH_ADJACENCY
Definition: vulkan.h:4442
@ VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST_WITH_ADJACENCY
Definition: vulkan.h:4444
@ VK_PRIMITIVE_TOPOLOGY_POINT_LIST
Definition: vulkan.h:4436
@ VK_PRIMITIVE_TOPOLOGY_LINE_STRIP
Definition: vulkan.h:4438
@ VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP_WITH_ADJACENCY
Definition: vulkan.h:4445
@ VK_PRIMITIVE_TOPOLOGY_LINE_LIST
Definition: vulkan.h:4437
VkFlags VkCullModeFlags
Definition: vulkan.h:985
VkResult VKAPI_CALL vkCreateRenderPass(VkDevice device, const VkRenderPassCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkRenderPass *pRenderPass)
VkResult VKAPI_CALL vkMapMemory(VkDevice device, VkDeviceMemory memory, VkDeviceSize offset, VkDeviceSize size, VkMemoryMapFlags flags, void **ppData)
@ VK_FRONT_FACE_CLOCKWISE
Definition: vulkan.h:3301
@ VK_FRONT_FACE_COUNTER_CLOCKWISE
Definition: vulkan.h:3300
VkResult
Definition: vulkan.h:4639
@ VK_SUCCESS
Definition: vulkan.h:4672
@ VK_ERROR_FRAGMENTED_POOL
Definition: vulkan.h:4660
@ VK_NOT_READY
Definition: vulkan.h:4673
@ VK_ERROR_OUT_OF_POOL_MEMORY
Definition: vulkan.h:4647
VkDescriptorType
Definition: vulkan.h:2463
@ VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER
Definition: vulkan.h:2469
@ VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE
Definition: vulkan.h:2466
@ VK_DESCRIPTOR_TYPE_SAMPLER
Definition: vulkan.h:2464
@ VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER
Definition: vulkan.h:2470
@ VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER
Definition: vulkan.h:2468
@ VK_DESCRIPTOR_TYPE_STORAGE_IMAGE
Definition: vulkan.h:2467
void VKAPI_CALL vkCmdSetEvent(VkCommandBuffer commandBuffer, VkEvent event, VkPipelineStageFlags stageMask)
void VKAPI_CALL vkCmdSetDepthClampEnableEXT(VkCommandBuffer commandBuffer, VkBool32 depthClampEnable)
void VKAPI_CALL vkDestroyDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool, const VkAllocationCallbacks *pAllocator)
VkResult VKAPI_CALL vkResetFences(VkDevice device, uint32_t fenceCount, const VkFence *pFences)
VkResult VKAPI_CALL vkBindBufferMemory(VkDevice device, VkBuffer buffer, VkDeviceMemory memory, VkDeviceSize memoryOffset)
VkResult VKAPI_CALL vkCreateGraphicsPipelines(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount, const VkGraphicsPipelineCreateInfo *pCreateInfos, const VkAllocationCallbacks *pAllocator, VkPipeline *pPipelines)
#define VK_NULL_HANDLE
Definition: vulkan.h:861
@ VK_VERTEX_INPUT_RATE_VERTEX
Definition: vulkan.h:6260
@ VK_VERTEX_INPUT_RATE_INSTANCE
Definition: vulkan.h:6261
@ VK_COLOR_COMPONENT_R_BIT
Definition: vulkan.h:2109
@ VK_COLOR_COMPONENT_A_BIT
Definition: vulkan.h:2112
@ VK_COLOR_COMPONENT_B_BIT
Definition: vulkan.h:2111
@ VK_COLOR_COMPONENT_G_BIT
Definition: vulkan.h:2110
VkResult VKAPI_CALL vkCreateFence(VkDevice device, const VkFenceCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkFence *pFence)
VkFormat
Definition: vulkan.h:2815
@ VK_FORMAT_R32G32B32A32_SFLOAT
Definition: vulkan.h:2925
@ VK_FORMAT_R32G32B32A32_UINT
Definition: vulkan.h:2923
@ VK_FORMAT_UNDEFINED
Definition: vulkan.h:2816
@ VK_FORMAT_R32G32B32A32_SINT
Definition: vulkan.h:2924
@ VK_SUBPASS_CONTENTS_INLINE
Definition: vulkan.h:6094
VkBlendFactor
Definition: vulkan.h:1792
@ VK_BLEND_FACTOR_ONE
Definition: vulkan.h:1794
@ VK_BLEND_FACTOR_SRC1_ALPHA
Definition: vulkan.h:1810
@ VK_BLEND_FACTOR_ONE_MINUS_DST_ALPHA
Definition: vulkan.h:1802
@ VK_BLEND_FACTOR_ONE_MINUS_SRC1_COLOR
Definition: vulkan.h:1809
@ VK_BLEND_FACTOR_ONE_MINUS_SRC_COLOR
Definition: vulkan.h:1796
@ VK_BLEND_FACTOR_ONE_MINUS_CONSTANT_COLOR
Definition: vulkan.h:1804
@ VK_BLEND_FACTOR_SRC_COLOR
Definition: vulkan.h:1795
@ VK_BLEND_FACTOR_CONSTANT_COLOR
Definition: vulkan.h:1803
@ VK_BLEND_FACTOR_SRC_ALPHA
Definition: vulkan.h:1799
@ VK_BLEND_FACTOR_ONE_MINUS_CONSTANT_ALPHA
Definition: vulkan.h:1806
@ VK_BLEND_FACTOR_CONSTANT_ALPHA
Definition: vulkan.h:1805
@ VK_BLEND_FACTOR_DST_ALPHA
Definition: vulkan.h:1801
@ VK_BLEND_FACTOR_ONE_MINUS_SRC1_ALPHA
Definition: vulkan.h:1811
@ VK_BLEND_FACTOR_ZERO
Definition: vulkan.h:1793
@ VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA
Definition: vulkan.h:1800
@ VK_BLEND_FACTOR_DST_COLOR
Definition: vulkan.h:1797
@ VK_BLEND_FACTOR_SRC_ALPHA_SATURATE
Definition: vulkan.h:1807
@ VK_BLEND_FACTOR_SRC1_COLOR
Definition: vulkan.h:1808
@ VK_BLEND_FACTOR_ONE_MINUS_DST_COLOR
Definition: vulkan.h:1798
@ VK_ATTACHMENT_LOAD_OP_CLEAR
Definition: vulkan.h:1772
@ VK_ATTACHMENT_LOAD_OP_LOAD
Definition: vulkan.h:1771
@ VK_ATTACHMENT_LOAD_OP_DONT_CARE
Definition: vulkan.h:1773
VkResult VKAPI_CALL vkCreateDescriptorPool(VkDevice device, const VkDescriptorPoolCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkDescriptorPool *pDescriptorPool)
@ VK_ATTACHMENT_STORE_OP_DONT_CARE
Definition: vulkan.h:1783
@ VK_ATTACHMENT_STORE_OP_STORE
Definition: vulkan.h:1782
void VKAPI_CALL vkDestroyPipeline(VkDevice device, VkPipeline pipeline, const VkAllocationCallbacks *pAllocator)
@ VK_COMMAND_POOL_CREATE_TRANSIENT_BIT
Definition: vulkan.h:2161
@ VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT
Definition: vulkan.h:2162
VkResult VKAPI_CALL vkAllocateDescriptorSets(VkDevice device, const VkDescriptorSetAllocateInfo *pAllocateInfo, VkDescriptorSet *pDescriptorSets)
uint32_t VkBool32
Definition: vulkan.h:946
void VKAPI_CALL vkUpdateDescriptorSets(VkDevice device, uint32_t descriptorWriteCount, const VkWriteDescriptorSet *pDescriptorWrites, uint32_t descriptorCopyCount, const VkCopyDescriptorSet *pDescriptorCopies)
@ VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT
Definition: vulkan.h:4287
@ VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT
Definition: vulkan.h:4283
@ VK_PIPELINE_STAGE_ALL_COMMANDS_BIT
Definition: vulkan.h:4288
void VKAPI_CALL vkCmdPipelineBarrier(VkCommandBuffer commandBuffer, VkPipelineStageFlags srcStageMask, VkPipelineStageFlags dstStageMask, VkDependencyFlags dependencyFlags, uint32_t memoryBarrierCount, const VkMemoryBarrier *pMemoryBarriers, uint32_t bufferMemoryBarrierCount, const VkBufferMemoryBarrier *pBufferMemoryBarriers, uint32_t imageMemoryBarrierCount, const VkImageMemoryBarrier *pImageMemoryBarriers)
void VKAPI_CALL vkCmdSetColorBlendEquationEXT(VkCommandBuffer commandBuffer, uint32_t firstAttachment, uint32_t attachmentCount, const VkColorBlendEquationEXT *pColorBlendEquations)
void VKAPI_CALL vkCmdBindVertexBuffers(VkCommandBuffer commandBuffer, uint32_t firstBinding, uint32_t bindingCount, const VkBuffer *pBuffers, const VkDeviceSize *pOffsets)
VkResult VKAPI_CALL vkCreateCommandPool(VkDevice device, const VkCommandPoolCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkCommandPool *pCommandPool)
void VKAPI_CALL vkUnmapMemory(VkDevice device, VkDeviceMemory memory)
void VKAPI_CALL vkCmdSetPatchControlPointsEXT(VkCommandBuffer commandBuffer, uint32_t patchControlPoints)
VkResult VKAPI_CALL vkCreateImage(VkDevice device, const VkImageCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkImage *pImage)
#define VK_QUEUE_FAMILY_IGNORED
Definition: vulkan.h:57
void VKAPI_CALL vkDestroyImage(VkDevice device, VkImage image, const VkAllocationCallbacks *pAllocator)
void VKAPI_CALL vkCmdSetPrimitiveTopologyEXT(VkCommandBuffer commandBuffer, VkPrimitiveTopology primitiveTopology)
VkFlags VkColorComponentFlags
Definition: vulkan.h:976
@ VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO
Definition: vulkan.h:4991
@ VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO
Definition: vulkan.h:4990
@ VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO
Definition: vulkan.h:4984
@ VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO
Definition: vulkan.h:4994
@ VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO
Definition: vulkan.h:4988
@ VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO
Definition: vulkan.h:4987
@ VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO
Definition: vulkan.h:5001
@ VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO
Definition: vulkan.h:4976
@ VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO
Definition: vulkan.h:4996
@ VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO
Definition: vulkan.h:4978
@ VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO
Definition: vulkan.h:5004
@ VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET
Definition: vulkan.h:4999
@ VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO
Definition: vulkan.h:5006
@ VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO
Definition: vulkan.h:5002
@ VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO
Definition: vulkan.h:4998
@ VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO
Definition: vulkan.h:4982
@ VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO
Definition: vulkan.h:4992
@ VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO
Definition: vulkan.h:4969
@ VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_DIVISOR_STATE_CREATE_INFO_EXT
Definition: vulkan.h:5938
@ VK_STRUCTURE_TYPE_EVENT_CREATE_INFO
Definition: vulkan.h:4974
@ VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO
Definition: vulkan.h:4997
@ VK_STRUCTURE_TYPE_FENCE_CREATE_INFO
Definition: vulkan.h:4972
@ VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO
Definition: vulkan.h:5007
@ VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_STATE_CREATE_INFO
Definition: vulkan.h:4985
@ VK_STRUCTURE_TYPE_SUBMIT_INFO
Definition: vulkan.h:4968
@ VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO
Definition: vulkan.h:4986
@ VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO
Definition: vulkan.h:4983
@ VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO
Definition: vulkan.h:5003
@ VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER
Definition: vulkan.h:5009
@ VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO
Definition: vulkan.h:4989
ssize_t adapter_adjust_mapped_memory(struct wined3d_adapter *adapter, ssize_t size)
Definition: directx.c:167
wined3d_blend_op
Definition: wined3d.h:441
@ WINED3D_BLEND_OP_ADD
Definition: wined3d.h:442
@ WINED3D_BLEND_OP_MIN
Definition: wined3d.h:445
@ WINED3D_BLEND_OP_MAX
Definition: wined3d.h:446
@ WINED3D_BLEND_OP_SUBTRACT
Definition: wined3d.h:443
@ WINED3D_BLEND_OP_REVSUBTRACT
Definition: wined3d.h:444
#define WINED3DCLEAR_TARGET
Definition: wined3d.h:1008
wined3d_primitive_type
Definition: wined3d.h:74
@ WINED3D_PT_LINESTRIP_ADJ
Definition: wined3d.h:83
@ WINED3D_PT_LINELIST
Definition: wined3d.h:77
@ WINED3D_PT_UNDEFINED
Definition: wined3d.h:75
@ WINED3D_PT_PATCH
Definition: wined3d.h:86
@ WINED3D_PT_POINTLIST
Definition: wined3d.h:76
@ WINED3D_PT_TRIANGLELIST_ADJ
Definition: wined3d.h:84
@ WINED3D_PT_LINELIST_ADJ
Definition: wined3d.h:82
@ WINED3D_PT_TRIANGLESTRIP_ADJ
Definition: wined3d.h:85
@ WINED3D_PT_TRIANGLESTRIP
Definition: wined3d.h:80
@ WINED3D_PT_LINESTRIP
Definition: wined3d.h:78
@ WINED3D_PT_TRIANGLELIST
Definition: wined3d.h:79
@ WINED3D_PT_TRIANGLEFAN
Definition: wined3d.h:81
static int wined3d_bit_scan(unsigned int *x)
Definition: wined3d.h:2982
#define WINED3D_OK
Definition: wined3d.h:33
#define WINED3D_BIND_VERTEX_BUFFER
Definition: wined3d.h:909
#define WINED3DCOLORWRITEENABLE_RED
Definition: wined3d.h:866
#define WINED3DCOLORWRITEENABLE_BLUE
Definition: wined3d.h:868
@ WINED3D_RTYPE_BUFFER
Definition: wined3d.h:718
#define WINED3D_MAX_VIEWPORTS
Definition: wined3d.h:1590
#define WINED3D_MAX_RENDER_TARGETS
Definition: wined3d.h:1606
#define WINED3D_BIND_UNORDERED_ACCESS
Definition: wined3d.h:916
#define WINED3D_NO_PRIMITIVE_RESTART
Definition: wined3d.h:1332
wined3d_query_type
Definition: wined3d.h:725
@ WINED3D_QUERY_TYPE_SO_STATISTICS_STREAM2
Definition: wined3d.h:746
@ WINED3D_QUERY_TYPE_SO_STATISTICS
Definition: wined3d.h:742
@ WINED3D_QUERY_TYPE_PIPELINE_STATISTICS
Definition: wined3d.h:741
@ WINED3D_QUERY_TYPE_SO_STATISTICS_STREAM0
Definition: wined3d.h:744
@ WINED3D_QUERY_TYPE_SO_STATISTICS_STREAM1
Definition: wined3d.h:745
@ WINED3D_QUERY_TYPE_TIMESTAMP
Definition: wined3d.h:731
@ WINED3D_QUERY_TYPE_OCCLUSION
Definition: wined3d.h:730
@ WINED3D_QUERY_TYPE_SO_STATISTICS_STREAM3
Definition: wined3d.h:747
#define WINED3D_BIND_SHADER_RESOURCE
Definition: wined3d.h:912
@ WINED3DFMT_NULL
Definition: wined3d.h:276
@ WINED3DFMT_R16_UINT
Definition: wined3d.h:214
#define WINED3D_BIND_INDIRECT_BUFFER
Definition: wined3d.h:917
wined3d_pipeline
Definition: wined3d.h:854
@ WINED3D_PIPELINE_COMPUTE
Definition: wined3d.h:856
@ WINED3D_PIPELINE_GRAPHICS
Definition: wined3d.h:855
#define WINED3D_BIND_DEPTH_STENCIL
Definition: wined3d.h:915
#define WINED3DCLEAR_STENCIL
Definition: wined3d.h:1010
wined3d_cmp_func
Definition: wined3d.h:460
@ WINED3D_CMP_ALWAYS
Definition: wined3d.h:468
@ WINED3D_CMP_GREATER
Definition: wined3d.h:465
@ WINED3D_CMP_LESSEQUAL
Definition: wined3d.h:464
@ WINED3D_CMP_NOTEQUAL
Definition: wined3d.h:466
@ WINED3D_CMP_LESS
Definition: wined3d.h:462
@ WINED3D_CMP_EQUAL
Definition: wined3d.h:463
@ WINED3D_CMP_GREATEREQUAL
Definition: wined3d.h:467
@ WINED3D_CMP_NEVER
Definition: wined3d.h:461
wined3d_blend
Definition: wined3d.h:418
@ WINED3D_BLEND_ONE
Definition: wined3d.h:420
@ WINED3D_BLEND_INVDESTCOLOR
Definition: wined3d.h:428
@ WINED3D_BLEND_DESTCOLOR
Definition: wined3d.h:427
@ WINED3D_BLEND_INVSRCALPHA
Definition: wined3d.h:424
@ WINED3D_BLEND_INVSRCCOLOR
Definition: wined3d.h:422
@ WINED3D_BLEND_INVDESTALPHA
Definition: wined3d.h:426
@ WINED3D_BLEND_INVBLENDFACTOR
Definition: wined3d.h:433
@ WINED3D_BLEND_INVSRC1COLOR
Definition: wined3d.h:435
@ WINED3D_BLEND_SRC1ALPHA
Definition: wined3d.h:436
@ WINED3D_BLEND_ZERO
Definition: wined3d.h:419
@ WINED3D_BLEND_SRC1COLOR
Definition: wined3d.h:434
@ WINED3D_BLEND_BOTHINVSRCALPHA
Definition: wined3d.h:431
@ WINED3D_BLEND_BOTHSRCALPHA
Definition: wined3d.h:430
@ WINED3D_BLEND_SRCALPHA
Definition: wined3d.h:423
@ WINED3D_BLEND_SRCALPHASAT
Definition: wined3d.h:429
@ WINED3D_BLEND_BLENDFACTOR
Definition: wined3d.h:432
@ WINED3D_BLEND_INVSRC1ALPHA
Definition: wined3d.h:437
@ WINED3D_BLEND_SRCCOLOR
Definition: wined3d.h:421
@ WINED3D_BLEND_DESTALPHA
Definition: wined3d.h:425
#define WINED3DCLEAR_ZBUFFER
Definition: wined3d.h:1009
wined3d_shader_type
Definition: wined3d.h:840
@ WINED3D_SHADER_TYPE_HULL
Definition: wined3d.h:844
@ WINED3D_SHADER_TYPE_PIXEL
Definition: wined3d.h:841
@ WINED3D_SHADER_TYPE_GEOMETRY
Definition: wined3d.h:843
@ WINED3D_SHADER_TYPE_DOMAIN
Definition: wined3d.h:845
@ WINED3D_SHADER_TYPE_COMPUTE
Definition: wined3d.h:848
@ WINED3D_SHADER_TYPE_VERTEX
Definition: wined3d.h:842
@ WINED3D_SHADER_TYPE_COUNT
Definition: wined3d.h:849
#define WINED3D_LEGACY_DEPTH_BIAS
Definition: wined3d.h:1322
#define WINED3DCOLORWRITEENABLE_ALPHA
Definition: wined3d.h:869
#define WINED3D_BIND_RENDER_TARGET
Definition: wined3d.h:914
wined3d_stencil_op
Definition: wined3d.h:508
@ WINED3D_STENCIL_OP_INCR
Definition: wined3d.h:515
@ WINED3D_STENCIL_OP_KEEP
Definition: wined3d.h:509
@ WINED3D_STENCIL_OP_REPLACE
Definition: wined3d.h:511
@ WINED3D_STENCIL_OP_INVERT
Definition: wined3d.h:514
@ WINED3D_STENCIL_OP_DECR_SAT
Definition: wined3d.h:513
@ WINED3D_STENCIL_OP_DECR
Definition: wined3d.h:516
@ WINED3D_STENCIL_OP_ZERO
Definition: wined3d.h:510
@ WINED3D_STENCIL_OP_INCR_SAT
Definition: wined3d.h:512
wined3d_cull
Definition: wined3d.h:501
@ WINED3D_CULL_NONE
Definition: wined3d.h:502
@ WINED3D_CULL_FRONT
Definition: wined3d.h:503
@ WINED3D_CULL_BACK
Definition: wined3d.h:504
#define WINED3DCOLORWRITEENABLE_GREEN
Definition: wined3d.h:867
#define WINED3D_BIND_CONSTANT_BUFFER
Definition: wined3d.h:911
#define WINED3D_BIND_STREAM_OUTPUT
Definition: wined3d.h:913
#define WINED3D_BIND_INDEX_BUFFER
Definition: wined3d.h:910
wined3d_component_type
@ WINED3D_TYPE_UINT
@ WINED3D_TYPE_UNKNOWN
@ WINED3D_TYPE_FLOAT
@ WINED3D_TYPE_INT
#define STATE_DEPTH_STENCIL
static bool wined3d_context_is_graphics_state_dirty(const struct wined3d_context *context, unsigned int state_id)
static bool isStateDirty(const struct wined3d_context *context, unsigned int state_id)
#define STATE_STENCIL_REF
#define STATE_CONSTANT_BUFFER(a)
wined3d_data_type
@ WINED3D_DATA_FLOAT
static BOOL wined3d_bitmap_get_range(const uint32_t *bitmap, unsigned int bit_count, unsigned int start, struct wined3d_range *range)
static int wined3d_uint64_compare(uint64_t x, uint64_t y)
#define MAX_CONSTANT_BUFFERS
#define STATE_GRAPHICS_SHADER_RESOURCE_BINDING
#define WINED3D_SLAB_BO_MIN_OBJECT_ALIGN
static BOOL use_transform_feedback(const struct wined3d_state *state)
#define STATE_STREAM_OUTPUT
static bool wined3d_state_uses_depth_buffer(const struct wined3d_state *state)
#define WINED3D_QUERY_POOL_SIZE
#define STATE_SHADER(a)
#define WINED3D_ALLOCATOR_MIN_BLOCK_SIZE
#define WINED3D_LOCATION_BUFFER
#define STATE_COMPUTE_SHADER
static int wined3d_uint32_compare(uint32_t x, uint32_t y)
wined3d_shader_resource_type
@ WINED3D_SHADER_RESOURCE_BUFFER
@ WINED3D_SHADER_RESOURCE_TEXTURE_3D
@ WINED3D_SHADER_RESOURCE_TEXTURE_2D
@ WINED3D_SHADER_RESOURCE_TEXTURE_1DARRAY
@ WINED3D_SHADER_RESOURCE_TEXTURE_2DARRAY
@ WINED3D_SHADER_RESOURCE_TEXTURE_2DMSARRAY
@ WINED3D_SHADER_RESOURCE_TEXTURE_2DMS
@ WINED3D_SHADER_RESOURCE_TEXTURE_CUBEARRAY
@ WINED3D_SHADER_RESOURCE_TEXTURE_CUBE
@ WINED3D_SHADER_RESOURCE_TEXTURE_1D
#define STATE_COMPUTE_CONSTANT_BUFFER
#define STATE_BLEND_FACTOR
static uint32_t wined3d_mask_from_size(unsigned int size)
#define WINED3D_ALLOCATOR_CHUNK_SIZE
#define STATE_SAMPLE_MASK
#define STATE_SCISSORRECT
static bool wined3d_primitive_type_is_list(enum wined3d_primitive_type t)
static BOOL is_rasterization_disabled(const struct wined3d_shader *geometry_shader)
#define STATE_STREAMSRC
#define STATE_COMPUTE_SHADER_RESOURCE_BINDING
#define WINED3D_LOCATION_TEXTURE_RGB
#define STATE_COMPUTE_UNORDERED_ACCESS_VIEW_BINDING
#define STATE_RASTERIZER
#define WINED3D_LOCATION_CLEARED
#define WINED3D_LOCATION_DISCARDED
static bool wined3d_context_is_compute_state_dirty(const struct wined3d_context *context, unsigned int state_id)
#define STATE_GRAPHICS_CONSTANT_BUFFER(a)
#define WINED3D_RETIRED_BO_SIZE_THRESHOLD
#define STATE_INDEXBUFFER
#define STATE_VDECL
#define STATE_VIEWPORT
static unsigned int wined3d_blend_state_get_writemask(const struct wined3d_blend_state *state, unsigned int index)
#define STATE_FRAMEBUFFER
#define STATE_BLEND
#define STATE_GRAPHICS_UNORDERED_ACCESS_VIEW_BINDING
static struct wined3d_texture * texture_from_resource(struct wined3d_resource *resource)
static struct wined3d_buffer * buffer_from_resource(struct wined3d_resource *resource)
#define WINED3D_FB_ATTACHMENT_FLAG_CLEAR_Z
Definition: wined3d_vk.h:487
static void wined3d_context_vk_reference_sampler(const struct wined3d_context_vk *context_vk, struct wined3d_sampler_vk *sampler_vk)
Definition: wined3d_vk.h:1124
static void wined3d_unordered_access_view_vk_barrier(struct wined3d_unordered_access_view_vk *uav_vk, struct wined3d_context_vk *context_vk, uint32_t bind_mask)
Definition: wined3d_vk.h:1037
#define WINED3D_FB_ATTACHMENT_FLAG_CLEAR_C
Definition: wined3d_vk.h:485
static void wined3d_device_vk_allocator_unlock(struct wined3d_device_vk *device_vk)
Definition: wined3d_vk.h:856
static void wined3d_context_vk_reference_unordered_access_view(const struct wined3d_context_vk *context_vk, struct wined3d_unordered_access_view_vk *uav_vk)
Definition: wined3d_vk.h:1144
@ WINED3D_RETIRED_QUERY_POOL_VK
Definition: wined3d_vk.h:439
@ WINED3D_RETIRED_SAMPLER_VK
Definition: wined3d_vk.h:438
@ WINED3D_RETIRED_DESCRIPTOR_POOL_VK
Definition: wined3d_vk.h:430
@ WINED3D_RETIRED_ALLOCATOR_BLOCK_VK
Definition: wined3d_vk.h:432
@ WINED3D_RETIRED_EVENT_VK
Definition: wined3d_vk.h:440
@ WINED3D_RETIRED_BUFFER_VK
Definition: wined3d_vk.h:434
@ WINED3D_RETIRED_IMAGE_VIEW_VK
Definition: wined3d_vk.h:437
@ WINED3D_RETIRED_MEMORY_VK
Definition: wined3d_vk.h:431
@ WINED3D_RETIRED_FRAMEBUFFER_VK
Definition: wined3d_vk.h:429
@ WINED3D_RETIRED_IMAGE_VK
Definition: wined3d_vk.h:435
@ WINED3D_RETIRED_BUFFER_VIEW_VK
Definition: wined3d_vk.h:436
@ WINED3D_RETIRED_BO_SLAB_SLICE_VK
Definition: wined3d_vk.h:433
@ WINED3D_RETIRED_PIPELINE_VK
Definition: wined3d_vk.h:441
@ WINED3D_RETIRED_FREE_VK
Definition: wined3d_vk.h:428
@ WINED3D_SHADER_DESCRIPTOR_TYPE_UAV
Definition: wined3d_vk.h:559
@ WINED3D_SHADER_DESCRIPTOR_TYPE_SRV
Definition: wined3d_vk.h:558
@ WINED3D_SHADER_DESCRIPTOR_TYPE_UAV_COUNTER
Definition: wined3d_vk.h:560
@ WINED3D_SHADER_DESCRIPTOR_TYPE_CBV
Definition: wined3d_vk.h:557
@ WINED3D_SHADER_DESCRIPTOR_TYPE_SAMPLER
Definition: wined3d_vk.h:561
static void wined3d_context_vk_reference_shader_resource_view(const struct wined3d_context_vk *context_vk, struct wined3d_shader_resource_view_vk *srv_vk)
Definition: wined3d_vk.h:1137
static void wined3d_shader_resource_view_vk_barrier(struct wined3d_shader_resource_view_vk *srv_vk, struct wined3d_context_vk *context_vk, uint32_t bind_mask)
Definition: wined3d_vk.h:1006
static void wined3d_context_vk_reference_rendertarget_view(const struct wined3d_context_vk *context_vk, struct wined3d_rendertarget_view_vk *rtv_vk)
Definition: wined3d_vk.h:1130
#define VK_CALL(f)
Definition: wined3d_vk.h:272
static void wined3d_device_vk_allocator_lock(struct wined3d_device_vk *device_vk)
Definition: wined3d_vk.h:851
@ WINED3D_VK_EXT_EXTENDED_DYNAMIC_STATE
Definition: wined3d_vk.h:240
@ WINED3D_VK_EXT_HOST_QUERY_RESET
Definition: wined3d_vk.h:243
@ WINED3D_VK_EXT_TRANSFORM_FEEDBACK
Definition: wined3d_vk.h:245
static struct wined3d_device_vk * wined3d_device_vk_from_allocator(struct wined3d_allocator *allocator)
Definition: wined3d_vk.h:846
#define WINED3D_FB_ATTACHMENT_FLAG_CLEAR_S
Definition: wined3d_vk.h:486
static VkImageView wined3d_rendertarget_view_vk_get_image_view(struct wined3d_rendertarget_view_vk *rtv_vk, struct wined3d_context_vk *context_vk)
Definition: wined3d_vk.h:967
static void wined3d_context_vk_reference_bo(const struct wined3d_context_vk *context_vk, struct wined3d_bo_vk *bo)
Definition: wined3d_vk.h:1091
static void wined3d_rendertarget_view_vk_barrier(struct wined3d_rendertarget_view_vk *rtv_vk, struct wined3d_context_vk *context_vk, uint32_t bind_mask)
Definition: wined3d_vk.h:961
#define WINED3D_FB_ATTACHMENT_FLAG_DISCARDED
Definition: wined3d_vk.h:484
static unsigned int block
Definition: xmlmemory.c:101