Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
mock_vulkan.cc
Go to the documentation of this file.
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
6
7#include <cstdint>
8#include <cstring>
9#include <utility>
10#include <vector>
11
13#include "impeller/renderer/backend/vulkan/vk.h" // IWYU pragma: keep.
14#include "third_party/swiftshader/include/vulkan/vulkan_core.h"
15#include "vulkan/vulkan.hpp"
16#include "vulkan/vulkan_core.h"
17
18namespace impeller {
19namespace testing {
20
21namespace {
22
23struct MockCommandBuffer {
24 explicit MockCommandBuffer(
25 std::shared_ptr<std::vector<std::string>> called_functions)
26 : called_functions_(std::move(called_functions)) {}
27 std::shared_ptr<std::vector<std::string>> called_functions_;
28};
29
30struct MockQueryPool {};
31
32struct MockCommandPool {};
33
34struct MockDescriptorPool {};
35
36struct MockSurfaceKHR {};
37
38struct MockImage {};
39
40struct MockSwapchainKHR {
41 std::array<MockImage, 3> images;
42 size_t current_image = 0;
43};
44
45struct MockSemaphore {};
46
47struct MockFramebuffer {};
48
49static ISize currentImageSize = ISize{1, 1};
50
51class MockDevice final {
52 public:
53 explicit MockDevice() : called_functions_(new std::vector<std::string>()) {}
54
55 MockCommandBuffer* NewCommandBuffer() {
56 auto buffer = std::make_unique<MockCommandBuffer>(called_functions_);
57 MockCommandBuffer* result = buffer.get();
58 Lock lock(command_buffers_mutex_);
59 command_buffers_.emplace_back(std::move(buffer));
60 return result;
61 }
62
63 MockCommandPool* NewCommandPool() {
64 auto pool = std::make_unique<MockCommandPool>();
65 MockCommandPool* result = pool.get();
66 Lock lock(commmand_pools_mutex_);
67 command_pools_.emplace_back(std::move(pool));
68 return result;
69 }
70
71 void DeleteCommandPool(MockCommandPool* pool) {
72 Lock lock(commmand_pools_mutex_);
73 auto it = std::find_if(command_pools_.begin(), command_pools_.end(),
74 [pool](const std::unique_ptr<MockCommandPool>& p) {
75 return p.get() == pool;
76 });
77 if (it != command_pools_.end()) {
78 command_pools_.erase(it);
79 }
80 }
81
82 const std::shared_ptr<std::vector<std::string>>& GetCalledFunctions() {
83 return called_functions_;
84 }
85
86 void AddCalledFunction(const std::string& function) {
87 Lock lock(called_functions_mutex_);
88 called_functions_->push_back(function);
89 }
90
91 private:
92 MockDevice(const MockDevice&) = delete;
93
94 MockDevice& operator=(const MockDevice&) = delete;
95
96 Mutex called_functions_mutex_;
97 std::shared_ptr<std::vector<std::string>> called_functions_ IPLR_GUARDED_BY(
98 called_functions_mutex_);
99
100 Mutex command_buffers_mutex_;
101 std::vector<std::unique_ptr<MockCommandBuffer>> command_buffers_
102 IPLR_GUARDED_BY(command_buffers_mutex_);
103
104 Mutex commmand_pools_mutex_;
105 std::vector<std::unique_ptr<MockCommandPool>> command_pools_ IPLR_GUARDED_BY(
106 commmand_pools_mutex_);
107};
108
109void noop() {}
110
111static thread_local std::vector<std::string> g_instance_extensions;
112
114 const char* pLayerName,
115 uint32_t* pPropertyCount,
116 VkExtensionProperties* pProperties) {
117 if (!pProperties) {
118 *pPropertyCount = g_instance_extensions.size();
119 } else {
120 uint32_t count = 0;
121 for (const std::string& ext : g_instance_extensions) {
122 strncpy(pProperties[count].extensionName, ext.c_str(),
124 pProperties[count].specVersion = 0;
125 count++;
126 }
127 }
128 return VK_SUCCESS;
129}
130
131static thread_local std::vector<std::string> g_instance_layers;
132
133VkResult vkEnumerateInstanceLayerProperties(uint32_t* pPropertyCount,
134 VkLayerProperties* pProperties) {
135 if (!pProperties) {
136 *pPropertyCount = g_instance_layers.size();
137 } else {
138 uint32_t count = 0;
139 for (const std::string& layer : g_instance_layers) {
140 strncpy(pProperties[count].layerName, layer.c_str(),
142 pProperties[count].specVersion = 0;
143 count++;
144 }
145 }
146 return VK_SUCCESS;
147}
148
150 uint32_t* pPhysicalDeviceCount,
151 VkPhysicalDevice* pPhysicalDevices) {
152 if (!pPhysicalDevices) {
153 *pPhysicalDeviceCount = 1;
154 } else {
155 pPhysicalDevices[0] = reinterpret_cast<VkPhysicalDevice>(0xfeedface);
156 }
157 return VK_SUCCESS;
158}
159
160static thread_local std::function<void(VkPhysicalDevice physicalDevice,
162 VkFormatProperties* pFormatProperties)>
163 g_format_properties_callback;
164
166 VkPhysicalDevice physicalDevice,
168 VkFormatProperties* pFormatProperties) {
169 g_format_properties_callback(physicalDevice, format, pFormatProperties);
170}
171
172void vkGetPhysicalDeviceProperties(VkPhysicalDevice physicalDevice,
173 VkPhysicalDeviceProperties* pProperties) {
177 pProperties->limits.maxImageDimension2D = 4096;
178 pProperties->limits.timestampPeriod = 1;
179}
180
182 VkPhysicalDevice physicalDevice,
183 uint32_t* pQueueFamilyPropertyCount,
184 VkQueueFamilyProperties* pQueueFamilyProperties) {
185 if (!pQueueFamilyProperties) {
186 *pQueueFamilyPropertyCount = 1;
187 } else {
188 pQueueFamilyProperties[0].queueCount = 3;
189 pQueueFamilyProperties[0].queueFlags = static_cast<VkQueueFlags>(
191 }
192}
193
195 VkPhysicalDevice physicalDevice,
196 const char* pLayerName,
197 uint32_t* pPropertyCount,
198 VkExtensionProperties* pProperties) {
199 if (!pProperties) {
200 *pPropertyCount = 1;
201 } else {
202 strcpy(pProperties[0].extensionName, "VK_KHR_swapchain");
203 pProperties[0].specVersion = 0;
204 }
205 return VK_SUCCESS;
206}
207
208VkResult vkCreateDevice(VkPhysicalDevice physicalDevice,
209 const VkDeviceCreateInfo* pCreateInfo,
210 const VkAllocationCallbacks* pAllocator,
211 VkDevice* pDevice) {
212 *pDevice = reinterpret_cast<VkDevice>(new MockDevice());
213 return VK_SUCCESS;
214}
215
217 const VkAllocationCallbacks* pAllocator,
218 VkInstance* pInstance) {
219 *pInstance = reinterpret_cast<VkInstance>(0xbaadf00d);
220 return VK_SUCCESS;
221}
222
224 VkPhysicalDevice physicalDevice,
225 VkPhysicalDeviceMemoryProperties* pMemoryProperties) {
226 pMemoryProperties->memoryTypeCount = 2;
227 pMemoryProperties->memoryHeapCount = 2;
228 pMemoryProperties->memoryTypes[0].heapIndex = 0;
229 pMemoryProperties->memoryTypes[0].propertyFlags =
233 pMemoryProperties->memoryTypes[1].heapIndex = 1;
234 pMemoryProperties->memoryTypes[1].propertyFlags =
236 pMemoryProperties->memoryHeaps[0].size = 1024 * 1024 * 1024;
237 pMemoryProperties->memoryHeaps[0].flags = VK_MEMORY_HEAP_DEVICE_LOCAL_BIT;
238 pMemoryProperties->memoryHeaps[1].size = 1024 * 1024 * 1024;
239 pMemoryProperties->memoryHeaps[1].flags = VK_MEMORY_HEAP_DEVICE_LOCAL_BIT;
240}
241
243 const VkPipelineCacheCreateInfo* pCreateInfo,
244 const VkAllocationCallbacks* pAllocator,
245 VkPipelineCache* pPipelineCache) {
246 MockDevice* mock_device = reinterpret_cast<MockDevice*>(device);
247 mock_device->AddCalledFunction("vkCreatePipelineCache");
248 *pPipelineCache = reinterpret_cast<VkPipelineCache>(0xb000dead);
249 return VK_SUCCESS;
250}
251
253 const VkCommandPoolCreateInfo* pCreateInfo,
254 const VkAllocationCallbacks* pAllocator,
255 VkCommandPool* pCommandPool) {
256 MockDevice* mock_device = reinterpret_cast<MockDevice*>(device);
257 mock_device->AddCalledFunction("vkCreateCommandPool");
258 *pCommandPool =
259 reinterpret_cast<VkCommandPool>(mock_device->NewCommandPool());
260 return VK_SUCCESS;
261}
262
264 VkCommandPool commandPool,
266 return VK_SUCCESS;
267}
268
270 VkDevice device,
271 const VkCommandBufferAllocateInfo* pAllocateInfo,
272 VkCommandBuffer* pCommandBuffers) {
273 MockDevice* mock_device = reinterpret_cast<MockDevice*>(device);
274 mock_device->AddCalledFunction("vkAllocateCommandBuffers");
275 *pCommandBuffers =
276 reinterpret_cast<VkCommandBuffer>(mock_device->NewCommandBuffer());
277 return VK_SUCCESS;
278}
279
280VkResult vkBeginCommandBuffer(VkCommandBuffer commandBuffer,
281 const VkCommandBufferBeginInfo* pBeginInfo) {
282 return VK_SUCCESS;
283}
284
286 const VkImageCreateInfo* pCreateInfo,
287 const VkAllocationCallbacks* pAllocator,
288 VkImage* pImage) {
289 *pImage = reinterpret_cast<VkImage>(0xD0D0CACA);
290 return VK_SUCCESS;
291}
292
294 VkDevice device,
296 VkMemoryRequirements2* pMemoryRequirements) {
297 pMemoryRequirements->memoryRequirements.size = 1024;
298 pMemoryRequirements->memoryRequirements.memoryTypeBits = 1;
299}
300
302 const VkMemoryAllocateInfo* pAllocateInfo,
303 const VkAllocationCallbacks* pAllocator,
304 VkDeviceMemory* pMemory) {
305 *pMemory = reinterpret_cast<VkDeviceMemory>(0xCAFEB0BA);
306 return VK_SUCCESS;
307}
308
310 VkImage image,
311 VkDeviceMemory memory,
312 VkDeviceSize memoryOffset) {
313 return VK_SUCCESS;
314}
315
317 const VkImageViewCreateInfo* pCreateInfo,
318 const VkAllocationCallbacks* pAllocator,
319 VkImageView* pView) {
320 *pView = reinterpret_cast<VkImageView>(0xFEE1DEAD);
321 return VK_SUCCESS;
322}
323
325 const VkBufferCreateInfo* pCreateInfo,
326 const VkAllocationCallbacks* pAllocator,
327 VkBuffer* pBuffer) {
328 *pBuffer = reinterpret_cast<VkBuffer>(0xDEADDEAD);
329 return VK_SUCCESS;
330}
331
333 VkDevice device,
335 VkMemoryRequirements2* pMemoryRequirements) {
336 pMemoryRequirements->memoryRequirements.size = 1024;
337 pMemoryRequirements->memoryRequirements.memoryTypeBits = 1;
338}
339
341 VkBuffer buffer,
342 VkDeviceMemory memory,
343 VkDeviceSize memoryOffset) {
344 return VK_SUCCESS;
345}
346
348 const VkRenderPassCreateInfo* pCreateInfo,
349 const VkAllocationCallbacks* pAllocator,
350 VkRenderPass* pRenderPass) {
351 *pRenderPass = reinterpret_cast<VkRenderPass>(0x12341234);
352 MockDevice* mock_device = reinterpret_cast<MockDevice*>(device);
353 mock_device->AddCalledFunction("vkCreateRenderPass");
354 return VK_SUCCESS;
355}
356
358 VkDevice device,
359 const VkDescriptorSetLayoutCreateInfo* pCreateInfo,
360 const VkAllocationCallbacks* pAllocator,
361 VkDescriptorSetLayout* pSetLayout) {
362 *pSetLayout = reinterpret_cast<VkDescriptorSetLayout>(0x77777777);
363 return VK_SUCCESS;
364}
365
367 const VkPipelineLayoutCreateInfo* pCreateInfo,
368 const VkAllocationCallbacks* pAllocator,
369 VkPipelineLayout* pPipelineLayout) {
370 *pPipelineLayout = reinterpret_cast<VkPipelineLayout>(0x88888888);
371 return VK_SUCCESS;
372}
373
375 VkDevice device,
376 VkPipelineCache pipelineCache,
377 uint32_t createInfoCount,
378 const VkGraphicsPipelineCreateInfo* pCreateInfos,
379 const VkAllocationCallbacks* pAllocator,
380 VkPipeline* pPipelines) {
381 MockDevice* mock_device = reinterpret_cast<MockDevice*>(device);
382 mock_device->AddCalledFunction("vkCreateGraphicsPipelines");
383 *pPipelines = reinterpret_cast<VkPipeline>(0x99999999);
384 return VK_SUCCESS;
385}
386
387void vkDestroyDevice(VkDevice device, const VkAllocationCallbacks* pAllocator) {
388 MockDevice* mock_device = reinterpret_cast<MockDevice*>(device);
389 mock_device->AddCalledFunction("vkDestroyDevice");
390 delete reinterpret_cast<MockDevice*>(device);
391}
392
393void vkDestroyPipeline(VkDevice device,
394 VkPipeline pipeline,
395 const VkAllocationCallbacks* pAllocator) {
396 MockDevice* mock_device = reinterpret_cast<MockDevice*>(device);
397 mock_device->AddCalledFunction("vkDestroyPipeline");
398}
399
401 const VkShaderModuleCreateInfo* pCreateInfo,
402 const VkAllocationCallbacks* pAllocator,
403 VkShaderModule* pShaderModule) {
404 MockDevice* mock_device = reinterpret_cast<MockDevice*>(device);
405 mock_device->AddCalledFunction("vkCreateShaderModule");
406 *pShaderModule = reinterpret_cast<VkShaderModule>(0x11111111);
407 return VK_SUCCESS;
408}
409
410void vkDestroyShaderModule(VkDevice device,
411 VkShaderModule shaderModule,
412 const VkAllocationCallbacks* pAllocator) {
413 MockDevice* mock_device = reinterpret_cast<MockDevice*>(device);
414 mock_device->AddCalledFunction("vkDestroyShaderModule");
415}
416
417void vkDestroyPipelineCache(VkDevice device,
418 VkPipelineCache pipelineCache,
419 const VkAllocationCallbacks* pAllocator) {
420 MockDevice* mock_device = reinterpret_cast<MockDevice*>(device);
421 mock_device->AddCalledFunction("vkDestroyPipelineCache");
422}
423
424void vkDestroySurfaceKHR(VkInstance instance,
425 VkSurfaceKHR surface,
426 const VkAllocationCallbacks* pAllocator) {
427 return;
428}
429
430void vkCmdBindPipeline(VkCommandBuffer commandBuffer,
431 VkPipelineBindPoint pipelineBindPoint,
432 VkPipeline pipeline) {
433 MockCommandBuffer* mock_command_buffer =
434 reinterpret_cast<MockCommandBuffer*>(commandBuffer);
435 mock_command_buffer->called_functions_->push_back("vkCmdBindPipeline");
436}
437
438void vkCmdSetStencilReference(VkCommandBuffer commandBuffer,
439 VkStencilFaceFlags faceMask,
440 uint32_t reference) {
441 MockCommandBuffer* mock_command_buffer =
442 reinterpret_cast<MockCommandBuffer*>(commandBuffer);
443 mock_command_buffer->called_functions_->push_back("vkCmdSetStencilReference");
444}
445
446void vkCmdSetScissor(VkCommandBuffer commandBuffer,
447 uint32_t firstScissor,
448 uint32_t scissorCount,
449 const VkRect2D* pScissors) {
450 MockCommandBuffer* mock_command_buffer =
451 reinterpret_cast<MockCommandBuffer*>(commandBuffer);
452 mock_command_buffer->called_functions_->push_back("vkCmdSetScissor");
453}
454
455void vkCmdSetViewport(VkCommandBuffer commandBuffer,
456 uint32_t firstViewport,
457 uint32_t viewportCount,
458 const VkViewport* pViewports) {
459 MockCommandBuffer* mock_command_buffer =
460 reinterpret_cast<MockCommandBuffer*>(commandBuffer);
461 mock_command_buffer->called_functions_->push_back("vkCmdSetViewport");
462}
463
464void vkFreeCommandBuffers(VkDevice device,
465 VkCommandPool commandPool,
466 uint32_t commandBufferCount,
467 const VkCommandBuffer* pCommandBuffers) {
468 MockDevice* mock_device = reinterpret_cast<MockDevice*>(device);
469 mock_device->AddCalledFunction("vkFreeCommandBuffers");
470}
471
472void vkDestroyCommandPool(VkDevice device,
473 VkCommandPool commandPool,
474 const VkAllocationCallbacks* pAllocator) {
475 MockDevice* mock_device = reinterpret_cast<MockDevice*>(device);
476 mock_device->DeleteCommandPool(
477 reinterpret_cast<MockCommandPool*>(commandPool));
478 mock_device->AddCalledFunction("vkDestroyCommandPool");
479}
480
481VkResult vkEndCommandBuffer(VkCommandBuffer commandBuffer) {
482 return VK_SUCCESS;
483}
484
486 const VkFenceCreateInfo* pCreateInfo,
487 const VkAllocationCallbacks* pAllocator,
488 VkFence* pFence) {
489 MockDevice* mock_device = reinterpret_cast<MockDevice*>(device);
490 *pFence = reinterpret_cast<VkFence>(new MockFence());
491 return VK_SUCCESS;
492}
493
495 VkFence fence,
496 const VkAllocationCallbacks* pAllocator) {
497 delete reinterpret_cast<MockFence*>(fence);
498 return VK_SUCCESS;
499}
500
501VkResult vkQueueSubmit(VkQueue queue,
502 uint32_t submitCount,
503 const VkSubmitInfo* pSubmits,
504 VkFence fence) {
505 return VK_SUCCESS;
506}
507
509 uint32_t fenceCount,
510 const VkFence* pFences,
511 VkBool32 waitAll,
512 uint64_t timeout) {
513 return VK_SUCCESS;
514}
515
516VkResult vkGetFenceStatus(VkDevice device, VkFence fence) {
517 MockDevice* mock_device = reinterpret_cast<MockDevice*>(device);
518 MockFence* mock_fence = reinterpret_cast<MockFence*>(fence);
519 return mock_fence->GetStatus();
520}
521
523 uint32_t fenceCount,
524 const VkFence* fences) {
525 return VK_SUCCESS;
526}
527
529 VkInstance instance,
530 const VkDebugUtilsMessengerCreateInfoEXT* pCreateInfo,
531 const VkAllocationCallbacks* pAllocator,
532 VkDebugUtilsMessengerEXT* pMessenger) {
533 return VK_SUCCESS;
534}
535
537 VkDevice device,
538 const VkDebugUtilsObjectNameInfoEXT* pNameInfo) {
539 return VK_SUCCESS;
540}
541
543 const VkQueryPoolCreateInfo* pCreateInfo,
544 const VkAllocationCallbacks* pAllocator,
545 VkQueryPool* pQueryPool) {
546 *pQueryPool = reinterpret_cast<VkQueryPool>(new MockQueryPool());
547 MockDevice* mock_device = reinterpret_cast<MockDevice*>(device);
548 mock_device->AddCalledFunction("vkCreateQueryPool");
549 return VK_SUCCESS;
550}
551
552void vkDestroyQueryPool(VkDevice device,
553 VkQueryPool queryPool,
554 const VkAllocationCallbacks* pAllocator) {
555 MockDevice* mock_device = reinterpret_cast<MockDevice*>(device);
556 mock_device->AddCalledFunction("vkDestroyQueryPool");
557 delete reinterpret_cast<MockQueryPool*>(queryPool);
558}
559
561 VkQueryPool queryPool,
562 uint32_t firstQuery,
563 uint32_t queryCount,
564 size_t dataSize,
565 void* pData,
566 VkDeviceSize stride,
568 MockDevice* mock_device = reinterpret_cast<MockDevice*>(device);
569 if (dataSize == sizeof(uint32_t)) {
570 uint32_t* data = static_cast<uint32_t*>(pData);
571 for (auto i = firstQuery; i < queryCount; i++) {
572 data[0] = i;
573 }
574 } else if (dataSize == sizeof(int64_t)) {
575 uint64_t* data = static_cast<uint64_t*>(pData);
576 for (auto i = firstQuery; i < queryCount; i++) {
577 data[0] = i;
578 }
579 }
580 mock_device->AddCalledFunction("vkGetQueryPoolResults");
581 return VK_SUCCESS;
582}
583
585 const VkDescriptorPoolCreateInfo* pCreateInfo,
586 const VkAllocationCallbacks* pAllocator,
587 VkDescriptorPool* pDescriptorPool) {
588 MockDevice* mock_device = reinterpret_cast<MockDevice*>(device);
589 *pDescriptorPool =
590 reinterpret_cast<VkDescriptorPool>(new MockDescriptorPool());
591 mock_device->AddCalledFunction("vkCreateDescriptorPool");
592 return VK_SUCCESS;
593}
594
595void vkDestroyDescriptorPool(VkDevice device,
596 VkDescriptorPool descriptorPool,
597 const VkAllocationCallbacks* pAllocator) {
598 MockDevice* mock_device = reinterpret_cast<MockDevice*>(device);
599 mock_device->AddCalledFunction("vkDestroyDescriptorPool");
600 delete reinterpret_cast<MockDescriptorPool*>(descriptorPool);
601}
602
604 VkDescriptorPool descriptorPool,
606 MockDevice* mock_device = reinterpret_cast<MockDevice*>(device);
607 mock_device->AddCalledFunction("vkResetDescriptorPool");
608 return VK_SUCCESS;
609}
610
612 VkDevice device,
613 const VkDescriptorSetAllocateInfo* pAllocateInfo,
614 VkDescriptorSet* pDescriptorSets) {
615 MockDevice* mock_device = reinterpret_cast<MockDevice*>(device);
616 mock_device->AddCalledFunction("vkAllocateDescriptorSets");
617 return VK_SUCCESS;
618}
619
621 VkPhysicalDevice physicalDevice,
622 VkSurfaceKHR surface,
623 uint32_t* pSurfaceFormatCount,
624 VkSurfaceFormatKHR* pSurfaceFormats) {
625 *pSurfaceFormatCount = 1u;
626 if (pSurfaceFormats != nullptr) {
627 pSurfaceFormats[0] =
630 }
631 return VK_SUCCESS;
632}
633
635 VkPhysicalDevice physicalDevice,
636 VkSurfaceKHR surface,
637 VkSurfaceCapabilitiesKHR* pSurfaceCapabilities) {
638 *pSurfaceCapabilities = VkSurfaceCapabilitiesKHR{
639 .minImageCount = 3,
640 .maxImageCount = 6,
641 .currentExtent =
643 .width = static_cast<uint32_t>(currentImageSize.width),
644 .height = static_cast<uint32_t>(currentImageSize.height),
645 },
646 .minImageExtent =
648 .width = 0,
649 .height = 0,
650 },
651 .maxImageExtent =
653 .width = static_cast<uint32_t>(currentImageSize.width),
654 .height = static_cast<uint32_t>(currentImageSize.height),
655 },
656 .maxImageArrayLayers = 1,
657 .supportedTransforms =
658 VkSurfaceTransformFlagBitsKHR::VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR,
659 .currentTransform =
660 VkSurfaceTransformFlagBitsKHR::VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR,
661 .supportedCompositeAlpha = VkCompositeAlphaFlagBitsKHR::
662 VK_COMPOSITE_ALPHA_PRE_MULTIPLIED_BIT_KHR,
663 .supportedUsageFlags =
664 VkImageUsageFlagBits::VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT};
665 return VK_SUCCESS;
666}
667
668VkResult vkGetPhysicalDeviceSurfaceSupportKHR(VkPhysicalDevice physicalDevice,
669 uint32_t queueFamilyIndex,
670 VkSurfaceKHR surface,
671 VkBool32* pSupported) {
672 *pSupported = VK_TRUE;
673 return VK_SUCCESS;
674}
675
677 const VkSwapchainCreateInfoKHR* pCreateInfo,
678 const VkAllocationCallbacks* pAllocator,
679 VkSwapchainKHR* pSwapchain) {
680 *pSwapchain = reinterpret_cast<VkSwapchainKHR>(new MockSwapchainKHR());
681 return VK_SUCCESS;
682}
683
684void vkDestroySwapchainKHR(VkDevice device,
685 VkSwapchainKHR swapchain,
686 const VkAllocationCallbacks* pAllocator) {
687 delete reinterpret_cast<MockSwapchainKHR*>(swapchain);
688}
689
691 VkSwapchainKHR swapchain,
692 uint32_t* pSwapchainImageCount,
693 VkImage* pSwapchainImages) {
694 MockSwapchainKHR* mock_swapchain =
695 reinterpret_cast<MockSwapchainKHR*>(swapchain);
696 auto& images = mock_swapchain->images;
697 *pSwapchainImageCount = images.size();
698 if (pSwapchainImages != nullptr) {
699 for (size_t i = 0; i < images.size(); i++) {
700 pSwapchainImages[i] = reinterpret_cast<VkImage>(&images[i]);
701 }
702 }
703 return VK_SUCCESS;
704}
705
707 const VkSemaphoreCreateInfo* pCreateInfo,
708 const VkAllocationCallbacks* pAllocator,
709 VkSemaphore* pSemaphore) {
710 *pSemaphore = reinterpret_cast<VkSemaphore>(new MockSemaphore());
711 return VK_SUCCESS;
712}
713
714void vkDestroySemaphore(VkDevice device,
715 VkSemaphore semaphore,
716 const VkAllocationCallbacks* pAllocator) {
717 delete reinterpret_cast<MockSemaphore*>(semaphore);
718}
719
721 VkSwapchainKHR swapchain,
722 uint64_t timeout,
723 VkSemaphore semaphore,
724 VkFence fence,
725 uint32_t* pImageIndex) {
726 auto current_index =
727 reinterpret_cast<MockSwapchainKHR*>(swapchain)->current_image++;
728 *pImageIndex = (current_index + 1) % 3u;
729 return VK_SUCCESS;
730}
731
733 const VkFramebufferCreateInfo* pCreateInfo,
734 const VkAllocationCallbacks* pAllocator,
735 VkFramebuffer* pFramebuffer) {
736 *pFramebuffer = reinterpret_cast<VkFramebuffer>(new MockFramebuffer());
737 return VK_SUCCESS;
738}
739
740void vkDestroyFramebuffer(VkDevice device,
741 VkFramebuffer framebuffer,
742 const VkAllocationCallbacks* pAllocator) {
743 delete reinterpret_cast<MockFramebuffer*>(framebuffer);
744}
745
746PFN_vkVoidFunction GetMockVulkanProcAddress(VkInstance instance,
747 const char* pName) {
748 if (strcmp("vkEnumerateInstanceExtensionProperties", pName) == 0) {
750 } else if (strcmp("vkEnumerateInstanceLayerProperties", pName) == 0) {
752 } else if (strcmp("vkEnumeratePhysicalDevices", pName) == 0) {
754 } else if (strcmp("vkGetPhysicalDeviceFormatProperties", pName) == 0) {
756 } else if (strcmp("vkGetPhysicalDeviceProperties", pName) == 0) {
758 } else if (strcmp("vkGetPhysicalDeviceQueueFamilyProperties", pName) == 0) {
760 } else if (strcmp("vkEnumerateDeviceExtensionProperties", pName) == 0) {
762 } else if (strcmp("vkCreateDevice", pName) == 0) {
764 } else if (strcmp("vkCreateInstance", pName) == 0) {
766 } else if (strcmp("vkGetPhysicalDeviceMemoryProperties", pName) == 0) {
768 } else if (strcmp("vkCreatePipelineCache", pName) == 0) {
770 } else if (strcmp("vkCreateCommandPool", pName) == 0) {
772 } else if (strcmp("vkResetCommandPool", pName) == 0) {
774 } else if (strcmp("vkAllocateCommandBuffers", pName) == 0) {
776 } else if (strcmp("vkBeginCommandBuffer", pName) == 0) {
778 } else if (strcmp("vkCreateImage", pName) == 0) {
780 } else if (strcmp("vkGetInstanceProcAddr", pName) == 0) {
781 return (PFN_vkVoidFunction)GetMockVulkanProcAddress;
782 } else if (strcmp("vkGetDeviceProcAddr", pName) == 0) {
783 return (PFN_vkVoidFunction)GetMockVulkanProcAddress;
784 } else if (strcmp("vkGetImageMemoryRequirements2KHR", pName) == 0 ||
785 strcmp("vkGetImageMemoryRequirements2", pName) == 0) {
787 } else if (strcmp("vkAllocateMemory", pName) == 0) {
789 } else if (strcmp("vkBindImageMemory", pName) == 0) {
791 } else if (strcmp("vkCreateImageView", pName) == 0) {
793 } else if (strcmp("vkCreateBuffer", pName) == 0) {
795 } else if (strcmp("vkGetBufferMemoryRequirements2KHR", pName) == 0 ||
796 strcmp("vkGetBufferMemoryRequirements2", pName) == 0) {
798 } else if (strcmp("vkBindBufferMemory", pName) == 0) {
800 } else if (strcmp("vkCreateRenderPass", pName) == 0) {
802 } else if (strcmp("vkCreateDescriptorSetLayout", pName) == 0) {
804 } else if (strcmp("vkCreatePipelineLayout", pName) == 0) {
806 } else if (strcmp("vkCreateGraphicsPipelines", pName) == 0) {
808 } else if (strcmp("vkDestroyDevice", pName) == 0) {
810 } else if (strcmp("vkDestroyPipeline", pName) == 0) {
812 } else if (strcmp("vkCreateShaderModule", pName) == 0) {
814 } else if (strcmp("vkDestroyShaderModule", pName) == 0) {
816 } else if (strcmp("vkDestroyPipelineCache", pName) == 0) {
818 } else if (strcmp("vkCmdBindPipeline", pName) == 0) {
820 } else if (strcmp("vkCmdSetStencilReference", pName) == 0) {
822 } else if (strcmp("vkCmdSetScissor", pName) == 0) {
824 } else if (strcmp("vkCmdSetViewport", pName) == 0) {
826 } else if (strcmp("vkDestroyCommandPool", pName) == 0) {
828 } else if (strcmp("vkFreeCommandBuffers", pName) == 0) {
830 } else if (strcmp("vkEndCommandBuffer", pName) == 0) {
832 } else if (strcmp("vkCreateFence", pName) == 0) {
834 } else if (strcmp("vkDestroyFence", pName) == 0) {
836 } else if (strcmp("vkQueueSubmit", pName) == 0) {
838 } else if (strcmp("vkWaitForFences", pName) == 0) {
840 } else if (strcmp("vkGetFenceStatus", pName) == 0) {
842 } else if (strcmp("vkResetFences", pName) == 0) {
844 } else if (strcmp("vkCreateDebugUtilsMessengerEXT", pName) == 0) {
846 } else if (strcmp("vkSetDebugUtilsObjectNameEXT", pName) == 0) {
848 } else if (strcmp("vkCreateQueryPool", pName) == 0) {
850 } else if (strcmp("vkDestroyQueryPool", pName) == 0) {
852 } else if (strcmp("vkGetQueryPoolResults", pName) == 0) {
854 } else if (strcmp("vkCreateDescriptorPool", pName) == 0) {
856 } else if (strcmp("vkDestroyDescriptorPool", pName) == 0) {
858 } else if (strcmp("vkResetDescriptorPool", pName) == 0) {
860 } else if (strcmp("vkAllocateDescriptorSets", pName) == 0) {
862 } else if (strcmp("vkGetPhysicalDeviceSurfaceFormatsKHR", pName) == 0) {
864 } else if (strcmp("vkGetPhysicalDeviceSurfaceCapabilitiesKHR", pName) == 0) {
866 } else if (strcmp("vkGetPhysicalDeviceSurfaceSupportKHR", pName) == 0) {
868 } else if (strcmp("vkCreateSwapchainKHR", pName) == 0) {
870 } else if (strcmp("vkDestroySwapchainKHR", pName) == 0) {
872 } else if (strcmp("vkGetSwapchainImagesKHR", pName) == 0) {
874 } else if (strcmp("vkCreateSemaphore", pName) == 0) {
876 } else if (strcmp("vkDestroySemaphore", pName) == 0) {
878 } else if (strcmp("vkDestroySurfaceKHR", pName) == 0) {
880 } else if (strcmp("vkAcquireNextImageKHR", pName) == 0) {
882 } else if (strcmp("vkCreateFramebuffer", pName) == 0) {
884 } else if (strcmp("vkDestroyFramebuffer", pName) == 0) {
886 }
887 return noop;
888}
889
890} // namespace
891
893 : instance_extensions_({"VK_KHR_surface", "VK_MVK_macos_surface"}),
894 format_properties_callback_([](VkPhysicalDevice physicalDevice,
896 VkFormatProperties* pFormatProperties) {
898 pFormatProperties->optimalTilingFeatures =
899 static_cast<VkFormatFeatureFlags>(
900 vk::FormatFeatureFlagBits::eColorAttachment);
901 } else if (format == VK_FORMAT_D32_SFLOAT_S8_UINT) {
902 pFormatProperties->optimalTilingFeatures =
903 static_cast<VkFormatFeatureFlags>(
904 vk::FormatFeatureFlagBits::eDepthStencilAttachment);
905 } else if (format == VK_FORMAT_S8_UINT) {
906 pFormatProperties->optimalTilingFeatures =
907 static_cast<VkFormatFeatureFlags>(
908 vk::FormatFeatureFlagBits::eDepthStencilAttachment);
909 }
910 }) {}
911
912std::shared_ptr<ContextVK> MockVulkanContextBuilder::Build() {
913 auto message_loop = fml::ConcurrentMessageLoop::Create();
914 ContextVK::Settings settings;
915 settings.proc_address_callback = GetMockVulkanProcAddress;
916 if (settings_callback_) {
917 settings_callback_(settings);
918 }
919 g_instance_extensions = instance_extensions_;
920 g_instance_layers = instance_layers_;
921 g_format_properties_callback = format_properties_callback_;
922 std::shared_ptr<ContextVK> result = ContextVK::Create(std::move(settings));
923 return result;
924}
925
926std::shared_ptr<std::vector<std::string>> GetMockVulkanFunctions(
927 VkDevice device) {
928 MockDevice* mock_device = reinterpret_cast<MockDevice*>(device);
929 return mock_device->GetCalledFunctions();
930}
931
933 currentImageSize = size;
934}
935
936} // namespace testing
937} // namespace impeller
AutoreleasePool pool
int count
static std::shared_ptr< ConcurrentMessageLoop > Create(size_t worker_count=std::thread::hardware_concurrency())
static std::shared_ptr< ContextVK > Create(Settings settings)
MockCommandBuffer(std::weak_ptr< const Context > context)
Definition mocks.h:109
std::shared_ptr< ContextVK > Build()
Create a Vulkan context with Vulkan functions mocked. The caller is given a chance to tinker on the s...
VkSwapchainKHR swapchain
Definition main.cc:64
VkDevice device
Definition main.cc:53
VkInstance instance
Definition main.cc:48
VkSurfaceKHR surface
Definition main.cc:49
sk_sp< SkImage > image
Definition examples.cpp:29
FlutterSemanticsFlag flags
static const uint8_t buffer[]
GAsyncResult * result
uint32_t uint32_t * format
Dart_NativeFunction function
Definition fuchsia.cc:51
size_t current_image
std::shared_ptr< std::vector< std::string > > called_functions_
std::array< MockImage, 3 > images
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot data
Definition switches.h:41
std::shared_ptr< std::vector< std::string > > GetMockVulkanFunctions(VkDevice device)
void SetSwapchainImageSize(ISize size)
Override the image size returned by all swapchain images.
TSize< int64_t > ISize
Definition size.h:138
Definition ref_ptr.h:256
noop(*args, **kwargs)
int32_t height
char extensionName[VK_MAX_EXTENSION_NAME_SIZE]
uint32_t width
VkFormatFeatureFlags optimalTilingFeatures
char layerName[VK_MAX_EXTENSION_NAME_SIZE]
VkMemoryHeapFlags flags
VkDeviceSize size
VkMemoryRequirements memoryRequirements
uint32_t heapIndex
VkMemoryPropertyFlags propertyFlags
VkSampleCountFlags framebufferColorSampleCounts
VkMemoryHeap memoryHeaps[VK_MAX_MEMORY_HEAPS]
VkMemoryType memoryTypes[VK_MAX_MEMORY_TYPES]
VkPhysicalDeviceLimits limits
#define IPLR_GUARDED_BY(x)
VKAPI_ATTR VkResult VKAPI_CALL vkBindBufferMemory(VkDevice device, VkBuffer buffer, VkDeviceMemory memory, VkDeviceSize memoryOffset)
VKAPI_ATTR VkResult VKAPI_CALL vkCreateSwapchainKHR(VkDevice device, const VkSwapchainCreateInfoKHR *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkSwapchainKHR *pSwapchain)
VKAPI_ATTR void VKAPI_CALL vkDestroyDevice(VkDevice device, const VkAllocationCallbacks *pAllocator)
VkFlags VkSampleCountFlags
VKAPI_ATTR VkResult VKAPI_CALL vkAllocateMemory(VkDevice device, const VkMemoryAllocateInfo *pAllocateInfo, const VkAllocationCallbacks *pAllocator, VkDeviceMemory *pMemory)
VKAPI_ATTR VkResult VKAPI_CALL vkCreateFence(VkDevice device, const VkFenceCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkFence *pFence)
VKAPI_ATTR VkResult VKAPI_CALL vkResetFences(VkDevice device, uint32_t fenceCount, const VkFence *pFences)
VKAPI_ATTR VkResult VKAPI_CALL vkCreateSemaphore(VkDevice device, const VkSemaphoreCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkSemaphore *pSemaphore)
VKAPI_ATTR void VKAPI_CALL vkDestroyShaderModule(VkDevice device, VkShaderModule shaderModule, const VkAllocationCallbacks *pAllocator)
#define VK_TRUE
@ VK_MEMORY_PROPERTY_HOST_COHERENT_BIT
@ VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT
@ VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT
VKAPI_ATTR void VKAPI_CALL vkDestroyFence(VkDevice device, VkFence fence, const VkAllocationCallbacks *pAllocator)
VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateInstanceExtensionProperties(const char *pLayerName, uint32_t *pPropertyCount, VkExtensionProperties *pProperties)
VKAPI_ATTR void VKAPI_CALL vkFreeCommandBuffers(VkDevice device, VkCommandPool commandPool, uint32_t commandBufferCount, const VkCommandBuffer *pCommandBuffers)
VkFlags VkQueueFlags
VKAPI_ATTR VkResult VKAPI_CALL vkAcquireNextImageKHR(VkDevice device, VkSwapchainKHR swapchain, uint64_t timeout, VkSemaphore semaphore, VkFence fence, uint32_t *pImageIndex)
VKAPI_ATTR VkResult VKAPI_CALL vkCreateGraphicsPipelines(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount, const VkGraphicsPipelineCreateInfo *pCreateInfos, const VkAllocationCallbacks *pAllocator, VkPipeline *pPipelines)
VKAPI_ATTR void VKAPI_CALL vkDestroySwapchainKHR(VkDevice device, VkSwapchainKHR swapchain, const VkAllocationCallbacks *pAllocator)
VKAPI_ATTR VkResult VKAPI_CALL vkCreateInstance(const VkInstanceCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkInstance *pInstance)
VKAPI_ATTR void VKAPI_CALL vkCmdBindPipeline(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipeline pipeline)
VKAPI_ATTR VkResult VKAPI_CALL vkCreateDescriptorPool(VkDevice device, const VkDescriptorPoolCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkDescriptorPool *pDescriptorPool)
VKAPI_ATTR VkResult VKAPI_CALL vkAllocateDescriptorSets(VkDevice device, const VkDescriptorSetAllocateInfo *pAllocateInfo, VkDescriptorSet *pDescriptorSets)
VKAPI_ATTR VkResult VKAPI_CALL vkSetDebugUtilsObjectNameEXT(VkDevice device, const VkDebugUtilsObjectNameInfoEXT *pNameInfo)
uint64_t VkDeviceSize
Definition vulkan_core.h:96
VKAPI_ATTR VkResult VKAPI_CALL vkCreateImage(VkDevice device, const VkImageCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkImage *pImage)
VKAPI_ATTR VkResult VKAPI_CALL vkResetDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool, VkDescriptorPoolResetFlags flags)
VKAPI_ATTR VkResult VKAPI_CALL vkCreateDescriptorSetLayout(VkDevice device, const VkDescriptorSetLayoutCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkDescriptorSetLayout *pSetLayout)
VkFlags VkStencilFaceFlags
VKAPI_ATTR void VKAPI_CALL vkGetBufferMemoryRequirements2KHR(VkDevice device, const VkBufferMemoryRequirementsInfo2 *pInfo, VkMemoryRequirements2 *pMemoryRequirements)
VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, VkFormatProperties *pFormatProperties)
VkPipelineBindPoint
VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceProperties(VkPhysicalDevice physicalDevice, VkPhysicalDeviceProperties *pProperties)
VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceMemoryProperties(VkPhysicalDevice physicalDevice, VkPhysicalDeviceMemoryProperties *pMemoryProperties)
VKAPI_ATTR VkResult VKAPI_CALL vkResetCommandPool(VkDevice device, VkCommandPool commandPool, VkCommandPoolResetFlags flags)
@ VK_MEMORY_HEAP_DEVICE_LOCAL_BIT
@ VK_SAMPLE_COUNT_1_BIT
@ VK_SAMPLE_COUNT_4_BIT
VKAPI_ATTR VkResult VKAPI_CALL vkCreateQueryPool(VkDevice device, const VkQueryPoolCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkQueryPool *pQueryPool)
VKAPI_ATTR VkResult VKAPI_CALL vkCreatePipelineCache(VkDevice device, const VkPipelineCacheCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkPipelineCache *pPipelineCache)
VKAPI_ATTR void VKAPI_CALL vkDestroyCommandPool(VkDevice device, VkCommandPool commandPool, const VkAllocationCallbacks *pAllocator)
VKAPI_ATTR void VKAPI_CALL vkCmdSetStencilReference(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, uint32_t reference)
VKAPI_ATTR void VKAPI_CALL vkDestroyQueryPool(VkDevice device, VkQueryPool queryPool, const VkAllocationCallbacks *pAllocator)
VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateDeviceExtensionProperties(VkPhysicalDevice physicalDevice, const char *pLayerName, uint32_t *pPropertyCount, VkExtensionProperties *pProperties)
VkFlags VkCommandPoolResetFlags
VkFlags VkFormatFeatureFlags
VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfaceSupportKHR(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, VkSurfaceKHR surface, VkBool32 *pSupported)
VKAPI_ATTR VkResult VKAPI_CALL vkWaitForFences(VkDevice device, uint32_t fenceCount, const VkFence *pFences, VkBool32 waitAll, uint64_t timeout)
VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfaceCapabilitiesKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, VkSurfaceCapabilitiesKHR *pSurfaceCapabilities)
VKAPI_ATTR VkResult VKAPI_CALL vkCreateCommandPool(VkDevice device, const VkCommandPoolCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkCommandPool *pCommandPool)
VKAPI_ATTR void VKAPI_CALL vkDestroyPipeline(VkDevice device, VkPipeline pipeline, const VkAllocationCallbacks *pAllocator)
VKAPI_ATTR VkResult VKAPI_CALL vkCreateBuffer(VkDevice device, const VkBufferCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkBuffer *pBuffer)
VKAPI_ATTR VkResult VKAPI_CALL vkCreateDebugUtilsMessengerEXT(VkInstance instance, const VkDebugUtilsMessengerCreateInfoEXT *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkDebugUtilsMessengerEXT *pMessenger)
VKAPI_ATTR VkResult VKAPI_CALL vkCreateRenderPass(VkDevice device, const VkRenderPassCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkRenderPass *pRenderPass)
VKAPI_ATTR VkResult VKAPI_CALL vkQueueSubmit(VkQueue queue, uint32_t submitCount, const VkSubmitInfo *pSubmits, VkFence fence)
VKAPI_ATTR void VKAPI_CALL vkGetImageMemoryRequirements2KHR(VkDevice device, const VkImageMemoryRequirementsInfo2 *pInfo, VkMemoryRequirements2 *pMemoryRequirements)
VKAPI_ATTR VkResult VKAPI_CALL vkEnumeratePhysicalDevices(VkInstance instance, uint32_t *pPhysicalDeviceCount, VkPhysicalDevice *pPhysicalDevices)
VKAPI_ATTR VkResult VKAPI_CALL vkCreateImageView(VkDevice device, const VkImageViewCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkImageView *pView)
VKAPI_ATTR VkResult VKAPI_CALL vkCreateFramebuffer(VkDevice device, const VkFramebufferCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkFramebuffer *pFramebuffer)
@ VK_QUEUE_COMPUTE_BIT
@ VK_QUEUE_TRANSFER_BIT
@ VK_QUEUE_GRAPHICS_BIT
VkFlags VkQueryResultFlags
VKAPI_ATTR VkResult VKAPI_CALL vkAllocateCommandBuffers(VkDevice device, const VkCommandBufferAllocateInfo *pAllocateInfo, VkCommandBuffer *pCommandBuffers)
VkResult
@ VK_SUCCESS
VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfaceFormatsKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, uint32_t *pSurfaceFormatCount, VkSurfaceFormatKHR *pSurfaceFormats)
void(VKAPI_PTR * PFN_vkVoidFunction)(void)
VKAPI_ATTR void VKAPI_CALL vkCmdSetScissor(VkCommandBuffer commandBuffer, uint32_t firstScissor, uint32_t scissorCount, const VkRect2D *pScissors)
VKAPI_ATTR void VKAPI_CALL vkDestroyFramebuffer(VkDevice device, VkFramebuffer framebuffer, const VkAllocationCallbacks *pAllocator)
VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateInstanceLayerProperties(uint32_t *pPropertyCount, VkLayerProperties *pProperties)
VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceQueueFamilyProperties(VkPhysicalDevice physicalDevice, uint32_t *pQueueFamilyPropertyCount, VkQueueFamilyProperties *pQueueFamilyProperties)
VKAPI_ATTR VkResult VKAPI_CALL vkGetQueryPoolResults(VkDevice device, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount, size_t dataSize, void *pData, VkDeviceSize stride, VkQueryResultFlags flags)
VkFormat
@ VK_FORMAT_S8_UINT
@ VK_FORMAT_R8G8B8A8_UNORM
@ VK_FORMAT_D32_SFLOAT_S8_UINT
VKAPI_ATTR VkResult VKAPI_CALL vkCreateShaderModule(VkDevice device, const VkShaderModuleCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkShaderModule *pShaderModule)
VKAPI_ATTR void VKAPI_CALL vkDestroyPipelineCache(VkDevice device, VkPipelineCache pipelineCache, const VkAllocationCallbacks *pAllocator)
VkFlags VkDescriptorPoolResetFlags
@ VK_COLOR_SPACE_SRGB_NONLINEAR_KHR
VKAPI_ATTR void VKAPI_CALL vkCmdSetViewport(VkCommandBuffer commandBuffer, uint32_t firstViewport, uint32_t viewportCount, const VkViewport *pViewports)
VKAPI_ATTR VkResult VKAPI_CALL vkEndCommandBuffer(VkCommandBuffer commandBuffer)
uint32_t VkBool32
Definition vulkan_core.h:94
VKAPI_ATTR VkResult VKAPI_CALL vkGetSwapchainImagesKHR(VkDevice device, VkSwapchainKHR swapchain, uint32_t *pSwapchainImageCount, VkImage *pSwapchainImages)
VKAPI_ATTR void VKAPI_CALL vkDestroyDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool, const VkAllocationCallbacks *pAllocator)
VKAPI_ATTR void VKAPI_CALL vkDestroySemaphore(VkDevice device, VkSemaphore semaphore, const VkAllocationCallbacks *pAllocator)
VKAPI_ATTR VkResult VKAPI_CALL vkBindImageMemory(VkDevice device, VkImage image, VkDeviceMemory memory, VkDeviceSize memoryOffset)
VKAPI_ATTR VkResult VKAPI_CALL vkCreatePipelineLayout(VkDevice device, const VkPipelineLayoutCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkPipelineLayout *pPipelineLayout)
VKAPI_ATTR VkResult VKAPI_CALL vkGetFenceStatus(VkDevice device, VkFence fence)
VKAPI_ATTR VkResult VKAPI_CALL vkCreateDevice(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkDevice *pDevice)
VKAPI_ATTR void VKAPI_CALL vkDestroySurfaceKHR(VkInstance instance, VkSurfaceKHR surface, const VkAllocationCallbacks *pAllocator)
VKAPI_ATTR VkResult VKAPI_CALL vkBeginCommandBuffer(VkCommandBuffer commandBuffer, const VkCommandBufferBeginInfo *pBeginInfo)