15#include "third_party/swiftshader/include/vulkan/vulkan_core.h"
16#include "vulkan/vulkan.hpp"
23struct MockCommandBuffer {
25 std::shared_ptr<std::vector<std::string>> called_functions)
32struct MockQueryPool {};
34struct MockCommandPool {};
36struct MockDescriptorPool {};
38struct MockSurfaceKHR {};
42struct MockSwapchainKHR {
47struct MockSemaphore {};
49struct MockFramebuffer {};
53class MockDevice final {
57 MockCommandBuffer* NewCommandBuffer() {
59 MockCommandBuffer* result =
buffer.get();
60 Lock lock(command_buffers_mutex_);
61 command_buffers_.emplace_back(std::move(buffer));
65 MockCommandPool* NewCommandPool() {
66 auto pool = std::make_unique<MockCommandPool>();
67 MockCommandPool* result = pool.get();
68 Lock lock(commmand_pools_mutex_);
69 command_pools_.emplace_back(std::move(pool));
73 void DeleteCommandPool(MockCommandPool* pool) {
74 Lock lock(commmand_pools_mutex_);
75 auto it = std::find_if(command_pools_.begin(), command_pools_.end(),
76 [pool](
const std::unique_ptr<MockCommandPool>& p) {
77 return p.get() == pool;
79 if (it != command_pools_.end()) {
80 command_pools_.erase(it);
84 const std::shared_ptr<std::vector<std::string>>& GetCalledFunctions() {
88 void AddCalledFunction(
const std::string& function) {
89 Lock lock(called_functions_mutex_);
94 MockDevice(
const MockDevice&) =
delete;
96 MockDevice& operator=(
const MockDevice&) =
delete;
98 Mutex called_functions_mutex_;
102 Mutex command_buffers_mutex_;
103 std::vector<std::unique_ptr<MockCommandBuffer>> command_buffers_
106 Mutex commmand_pools_mutex_;
107 std::vector<std::unique_ptr<MockCommandPool>> command_pools_
111struct MockVulkanState {
115 std::function<void(VkPhysicalDevice physicalDevice,
117 VkFormatProperties* pFormatProperties)>
119 std::function<void(VkPhysicalDevice physicalDevice,
120 VkPhysicalDeviceProperties* pProperties)>
122 std::function<std::remove_pointer_t<PFN_vkWaitForFences>>
124 std::function<std::remove_pointer_t<PFN_vkAcquireNextImageKHR>>
128class MockVulkanStatePtr {
130 MockVulkanStatePtr() =
default;
132 ~MockVulkanStatePtr() {
134 <<
"MockVulkanState was not null upon thread exit. Leak detected!";
137 void reset(MockVulkanState* ptr =
nullptr) {
144 MockVulkanStatePtr(
const MockVulkanStatePtr&) =
delete;
145 MockVulkanStatePtr& operator=(
const MockVulkanStatePtr&) =
delete;
146 MockVulkanState* get()
const {
return ptr_; }
147 MockVulkanState&
operator*()
const {
return *ptr_; }
148 MockVulkanState* operator->()
const {
return ptr_; }
149 explicit operator bool()
const {
return ptr_ !=
nullptr; }
152 MockVulkanState* ptr_ =
nullptr;
155static thread_local MockVulkanStatePtr g_mock_vulkan_state;
157static MockVulkanState& GetMockVulkanState() {
158 FML_CHECK(g_mock_vulkan_state) <<
"MockVulkanState must be initialized.";
159 return *g_mock_vulkan_state;
164VkResult vkEnumerateInstanceExtensionProperties(
165 const char* pLayerName,
166 uint32_t* pPropertyCount,
167 VkExtensionProperties* pProperties) {
169 *pPropertyCount = GetMockVulkanState().instance_extensions.size();
173 VkResult result = VK_SUCCESS;
175 if (count >= *pPropertyCount) {
176 result = VK_INCOMPLETE;
179 snprintf(pProperties[count].extensionName,
180 sizeof(pProperties[count].extensionName),
"%s", ext.c_str());
181 pProperties[count].specVersion = 0;
184 *pPropertyCount = count;
189VkResult vkEnumerateInstanceLayerProperties(uint32_t* pPropertyCount,
190 VkLayerProperties* pProperties) {
192 *pPropertyCount = GetMockVulkanState().instance_layers.size();
196 VkResult result = VK_SUCCESS;
198 if (count >= *pPropertyCount) {
199 result = VK_INCOMPLETE;
202 snprintf(pProperties[count].layerName,
203 sizeof(pProperties[count].layerName),
"%s", ext.c_str());
204 pProperties[count].specVersion = 0;
207 *pPropertyCount = count;
212VkResult vkEnumeratePhysicalDevices(VkInstance
instance,
213 uint32_t* pPhysicalDeviceCount,
214 VkPhysicalDevice* pPhysicalDevices) {
215 if (!pPhysicalDevices) {
216 *pPhysicalDeviceCount = 1;
218 pPhysicalDevices[0] =
reinterpret_cast<VkPhysicalDevice
>(0xfeedface);
223void vkGetPhysicalDeviceFormatProperties(
224 VkPhysicalDevice physicalDevice,
226 VkFormatProperties* pFormatProperties) {
228 GetMockVulkanState().format_properties_callback(physicalDevice, format,
233void vkGetPhysicalDeviceProperties(VkPhysicalDevice physicalDevice,
234 VkPhysicalDeviceProperties* pProperties) {
235 pProperties->limits.framebufferColorSampleCounts =
236 static_cast<VkSampleCountFlags
>(VK_SAMPLE_COUNT_1_BIT |
237 VK_SAMPLE_COUNT_4_BIT);
238 pProperties->limits.maxImageDimension2D = 4096;
239 pProperties->limits.timestampPeriod = 1;
240 if (GetMockVulkanState().physical_device_properties_callback) {
241 GetMockVulkanState().physical_device_properties_callback(physicalDevice,
246void vkGetPhysicalDeviceQueueFamilyProperties(
247 VkPhysicalDevice physicalDevice,
248 uint32_t* pQueueFamilyPropertyCount,
249 VkQueueFamilyProperties* pQueueFamilyProperties) {
250 if (!pQueueFamilyProperties) {
251 *pQueueFamilyPropertyCount = 1;
253 pQueueFamilyProperties[0].queueCount = 3;
254 pQueueFamilyProperties[0].queueFlags =
static_cast<VkQueueFlags
>(
255 VK_QUEUE_TRANSFER_BIT | VK_QUEUE_COMPUTE_BIT | VK_QUEUE_GRAPHICS_BIT);
259VkResult vkEnumerateDeviceExtensionProperties(
260 VkPhysicalDevice physicalDevice,
261 const char* pLayerName,
262 uint32_t* pPropertyCount,
263 VkExtensionProperties* pProperties) {
265 *pPropertyCount = GetMockVulkanState().device_extensions.size();
269 VkResult result = VK_SUCCESS;
271 if (count >= *pPropertyCount) {
272 result = VK_INCOMPLETE;
275 snprintf(pProperties[count].extensionName,
276 sizeof(pProperties[count].extensionName),
"%s", ext.c_str());
277 pProperties[count].specVersion = 0;
280 *pPropertyCount = count;
285VkResult vkCreateDevice(VkPhysicalDevice physicalDevice,
286 const VkDeviceCreateInfo* pCreateInfo,
287 const VkAllocationCallbacks* pAllocator,
289 *pDevice =
reinterpret_cast<VkDevice
>(
new MockDevice());
293VkResult vkCreateInstance(
const VkInstanceCreateInfo* pCreateInfo,
294 const VkAllocationCallbacks* pAllocator,
295 VkInstance* pInstance) {
296 *pInstance =
reinterpret_cast<VkInstance
>(0xbaadf00d);
300void vkGetPhysicalDeviceMemoryProperties(
301 VkPhysicalDevice physicalDevice,
302 VkPhysicalDeviceMemoryProperties* pMemoryProperties) {
303 pMemoryProperties->memoryTypeCount = 2;
304 pMemoryProperties->memoryHeapCount = 2;
305 pMemoryProperties->memoryTypes[0].heapIndex = 0;
306 pMemoryProperties->memoryTypes[0].propertyFlags =
307 VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT |
308 VK_MEMORY_PROPERTY_HOST_COHERENT_BIT |
309 VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT;
310 pMemoryProperties->memoryTypes[1].heapIndex = 1;
311 pMemoryProperties->memoryTypes[1].propertyFlags =
312 VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT;
313 pMemoryProperties->memoryHeaps[0].size = 1024 * 1024 * 1024;
314 pMemoryProperties->memoryHeaps[0].flags = VK_MEMORY_HEAP_DEVICE_LOCAL_BIT;
315 pMemoryProperties->memoryHeaps[1].size = 1024 * 1024 * 1024;
316 pMemoryProperties->memoryHeaps[1].flags = VK_MEMORY_HEAP_DEVICE_LOCAL_BIT;
319VkResult vkCreatePipelineCache(VkDevice
device,
320 const VkPipelineCacheCreateInfo* pCreateInfo,
321 const VkAllocationCallbacks* pAllocator,
322 VkPipelineCache* pPipelineCache) {
323 MockDevice* mock_device =
reinterpret_cast<MockDevice*
>(
device);
324 mock_device->AddCalledFunction(
"vkCreatePipelineCache");
325 *pPipelineCache =
reinterpret_cast<VkPipelineCache
>(0xb000dead);
329VkResult vkCreateCommandPool(VkDevice
device,
330 const VkCommandPoolCreateInfo* pCreateInfo,
331 const VkAllocationCallbacks* pAllocator,
332 VkCommandPool* pCommandPool) {
333 MockDevice* mock_device =
reinterpret_cast<MockDevice*
>(
device);
334 mock_device->AddCalledFunction(
"vkCreateCommandPool");
336 reinterpret_cast<VkCommandPool
>(mock_device->NewCommandPool());
340VkResult vkResetCommandPool(VkDevice
device,
341 VkCommandPool commandPool,
342 VkCommandPoolResetFlags flags) {
343 MockDevice* mock_device =
reinterpret_cast<MockDevice*
>(
device);
344 if (flags & VK_COMMAND_POOL_RESET_RELEASE_RESOURCES_BIT) {
345 mock_device->AddCalledFunction(
"vkResetCommandPoolReleaseResources");
347 mock_device->AddCalledFunction(
"vkResetCommandPool");
352VkResult vkAllocateCommandBuffers(
354 const VkCommandBufferAllocateInfo* pAllocateInfo,
355 VkCommandBuffer* pCommandBuffers) {
356 MockDevice* mock_device =
reinterpret_cast<MockDevice*
>(
device);
357 mock_device->AddCalledFunction(
"vkAllocateCommandBuffers");
359 reinterpret_cast<VkCommandBuffer
>(mock_device->NewCommandBuffer());
363VkResult vkBeginCommandBuffer(VkCommandBuffer commandBuffer,
364 const VkCommandBufferBeginInfo* pBeginInfo) {
368VkResult vkCreateImage(VkDevice
device,
369 const VkImageCreateInfo* pCreateInfo,
370 const VkAllocationCallbacks* pAllocator,
372 *pImage =
reinterpret_cast<VkImage
>(0xD0D0CACA);
376void vkGetImageMemoryRequirements2KHR(
378 const VkImageMemoryRequirementsInfo2* pInfo,
379 VkMemoryRequirements2* pMemoryRequirements) {
380 pMemoryRequirements->memoryRequirements.size = 1024;
381 pMemoryRequirements->memoryRequirements.memoryTypeBits = 1;
384VkResult vkAllocateMemory(VkDevice
device,
385 const VkMemoryAllocateInfo* pAllocateInfo,
386 const VkAllocationCallbacks* pAllocator,
387 VkDeviceMemory* pMemory) {
388 *pMemory =
reinterpret_cast<VkDeviceMemory
>(0xCAFEB0BA);
392VkResult vkBindImageMemory(VkDevice
device,
394 VkDeviceMemory memory,
395 VkDeviceSize memoryOffset) {
399VkResult vkCreateImageView(VkDevice
device,
400 const VkImageViewCreateInfo* pCreateInfo,
401 const VkAllocationCallbacks* pAllocator,
402 VkImageView* pView) {
403 *pView =
reinterpret_cast<VkImageView
>(0xFEE1DEAD);
407VkResult vkCreateBuffer(VkDevice
device,
408 const VkBufferCreateInfo* pCreateInfo,
409 const VkAllocationCallbacks* pAllocator,
411 *pBuffer =
reinterpret_cast<VkBuffer
>(0xDEADDEAD);
415void vkGetBufferMemoryRequirements2KHR(
417 const VkBufferMemoryRequirementsInfo2* pInfo,
418 VkMemoryRequirements2* pMemoryRequirements) {
419 pMemoryRequirements->memoryRequirements.size = 1024;
420 pMemoryRequirements->memoryRequirements.memoryTypeBits = 1;
423VkResult vkBindBufferMemory(VkDevice
device,
425 VkDeviceMemory memory,
426 VkDeviceSize memoryOffset) {
430VkResult vkCreateRenderPass(VkDevice
device,
431 const VkRenderPassCreateInfo* pCreateInfo,
432 const VkAllocationCallbacks* pAllocator,
433 VkRenderPass* pRenderPass) {
434 *pRenderPass =
reinterpret_cast<VkRenderPass
>(0x12341234);
435 MockDevice* mock_device =
reinterpret_cast<MockDevice*
>(
device);
436 mock_device->AddCalledFunction(
"vkCreateRenderPass");
440VkResult vkCreateDescriptorSetLayout(
442 const VkDescriptorSetLayoutCreateInfo* pCreateInfo,
443 const VkAllocationCallbacks* pAllocator,
444 VkDescriptorSetLayout* pSetLayout) {
445 *pSetLayout =
reinterpret_cast<VkDescriptorSetLayout
>(0x77777777);
449VkResult vkCreatePipelineLayout(VkDevice
device,
450 const VkPipelineLayoutCreateInfo* pCreateInfo,
451 const VkAllocationCallbacks* pAllocator,
452 VkPipelineLayout* pPipelineLayout) {
453 *pPipelineLayout =
reinterpret_cast<VkPipelineLayout
>(0x88888888);
457VkResult vkCreateGraphicsPipelines(
459 VkPipelineCache pipelineCache,
460 uint32_t createInfoCount,
461 const VkGraphicsPipelineCreateInfo* pCreateInfos,
462 const VkAllocationCallbacks* pAllocator,
463 VkPipeline* pPipelines) {
464 MockDevice* mock_device =
reinterpret_cast<MockDevice*
>(
device);
465 mock_device->AddCalledFunction(
"vkCreateGraphicsPipelines");
466 *pPipelines =
reinterpret_cast<VkPipeline
>(0x99999999);
470void vkDestroyDevice(VkDevice
device,
const VkAllocationCallbacks* pAllocator) {
471 MockDevice* mock_device =
reinterpret_cast<MockDevice*
>(
device);
472 mock_device->AddCalledFunction(
"vkDestroyDevice");
473 delete reinterpret_cast<MockDevice*
>(
device);
476void vkDestroyInstance(VkInstance
instance,
477 const VkAllocationCallbacks* pAllocator) {
478 if (g_mock_vulkan_state) {
479 g_mock_vulkan_state.reset();
483void vkDestroyPipeline(VkDevice
device,
485 const VkAllocationCallbacks* pAllocator) {
486 MockDevice* mock_device =
reinterpret_cast<MockDevice*
>(
device);
487 mock_device->AddCalledFunction(
"vkDestroyPipeline");
490VkResult vkCreateShaderModule(VkDevice
device,
491 const VkShaderModuleCreateInfo* pCreateInfo,
492 const VkAllocationCallbacks* pAllocator,
493 VkShaderModule* pShaderModule) {
494 MockDevice* mock_device =
reinterpret_cast<MockDevice*
>(
device);
495 mock_device->AddCalledFunction(
"vkCreateShaderModule");
496 *pShaderModule =
reinterpret_cast<VkShaderModule
>(0x11111111);
500void vkDestroyShaderModule(VkDevice
device,
501 VkShaderModule shaderModule,
502 const VkAllocationCallbacks* pAllocator) {
503 MockDevice* mock_device =
reinterpret_cast<MockDevice*
>(
device);
504 mock_device->AddCalledFunction(
"vkDestroyShaderModule");
507void vkDestroyPipelineCache(VkDevice
device,
508 VkPipelineCache pipelineCache,
509 const VkAllocationCallbacks* pAllocator) {
510 MockDevice* mock_device =
reinterpret_cast<MockDevice*
>(
device);
511 mock_device->AddCalledFunction(
"vkDestroyPipelineCache");
514void vkDestroySurfaceKHR(VkInstance
instance,
515 VkSurfaceKHR surface,
516 const VkAllocationCallbacks* pAllocator) {
520void vkCmdBindPipeline(VkCommandBuffer commandBuffer,
521 VkPipelineBindPoint pipelineBindPoint,
522 VkPipeline pipeline) {
523 MockCommandBuffer* mock_command_buffer =
524 reinterpret_cast<MockCommandBuffer*
>(commandBuffer);
525 mock_command_buffer->called_functions_->push_back(
"vkCmdBindPipeline");
528void vkCmdPipelineBarrier(VkCommandBuffer commandBuffer,
529 VkPipelineStageFlags srcStageMask,
530 VkPipelineStageFlags dstStageMask,
531 VkDependencyFlags dependencyFlags,
532 uint32_t memoryBarrierCount,
533 const VkMemoryBarrier* pMemoryBarriers,
534 uint32_t bufferMemoryBarrierCount,
535 const VkBufferMemoryBarrier* pBufferMemoryBarriers,
536 uint32_t imageMemoryBarrierCount,
537 const VkImageMemoryBarrier* pImageMemoryBarriers) {
538 MockCommandBuffer* mock_command_buffer =
539 reinterpret_cast<MockCommandBuffer*
>(commandBuffer);
540 mock_command_buffer->called_functions_->push_back(
"vkCmdPipelineBarrier");
541 if (pImageMemoryBarriers) {
542 for (uint32_t
i = 0;
i < imageMemoryBarrierCount; ++
i) {
543 mock_command_buffer->image_memory_barriers_.push_back(
544 pImageMemoryBarriers[
i]);
549void vkCmdSetStencilReference(VkCommandBuffer commandBuffer,
550 VkStencilFaceFlags faceMask,
551 uint32_t reference) {
552 MockCommandBuffer* mock_command_buffer =
553 reinterpret_cast<MockCommandBuffer*
>(commandBuffer);
554 mock_command_buffer->called_functions_->push_back(
"vkCmdSetStencilReference");
557void vkCmdSetScissor(VkCommandBuffer commandBuffer,
558 uint32_t firstScissor,
559 uint32_t scissorCount,
560 const VkRect2D* pScissors) {
561 MockCommandBuffer* mock_command_buffer =
562 reinterpret_cast<MockCommandBuffer*
>(commandBuffer);
563 mock_command_buffer->called_functions_->push_back(
"vkCmdSetScissor");
566void vkCmdSetViewport(VkCommandBuffer commandBuffer,
567 uint32_t firstViewport,
568 uint32_t viewportCount,
569 const VkViewport* pViewports) {
570 MockCommandBuffer* mock_command_buffer =
571 reinterpret_cast<MockCommandBuffer*
>(commandBuffer);
572 mock_command_buffer->called_functions_->push_back(
"vkCmdSetViewport");
573 for (uint32_t
i = 0;
i < viewportCount; ++
i) {
574 mock_command_buffer->recorded_viewports_.push_back(pViewports[
i]);
578void vkFreeCommandBuffers(VkDevice
device,
579 VkCommandPool commandPool,
580 uint32_t commandBufferCount,
581 const VkCommandBuffer* pCommandBuffers) {
582 MockDevice* mock_device =
reinterpret_cast<MockDevice*
>(
device);
583 mock_device->AddCalledFunction(
"vkFreeCommandBuffers");
586void vkDestroyCommandPool(VkDevice
device,
587 VkCommandPool commandPool,
588 const VkAllocationCallbacks* pAllocator) {
589 MockDevice* mock_device =
reinterpret_cast<MockDevice*
>(
device);
590 mock_device->DeleteCommandPool(
591 reinterpret_cast<MockCommandPool*
>(commandPool));
592 mock_device->AddCalledFunction(
"vkDestroyCommandPool");
595VkResult vkEndCommandBuffer(VkCommandBuffer commandBuffer) {
599VkResult vkCreateFence(VkDevice
device,
600 const VkFenceCreateInfo* pCreateInfo,
601 const VkAllocationCallbacks* pAllocator,
603 MockDevice* mock_device =
reinterpret_cast<MockDevice*
>(
device);
604 mock_device->AddCalledFunction(
"vkCreateFence");
605 *pFence =
reinterpret_cast<VkFence
>(
new MockFence());
609VkResult vkDestroyFence(VkDevice
device,
611 const VkAllocationCallbacks* pAllocator) {
612 delete reinterpret_cast<MockFence*
>(fence);
616VkResult vkQueueSubmit(VkQueue
queue,
617 uint32_t submitCount,
618 const VkSubmitInfo* pSubmits,
623VkResult vkWaitForFences(VkDevice
device,
625 const VkFence* pFences,
629 return GetMockVulkanState().wait_for_fences_callback(
630 device, fenceCount, pFences, waitAll, timeout);
635VkResult vkGetFenceStatus(VkDevice
device, VkFence fence) {
636 MockDevice* mock_device =
reinterpret_cast<MockDevice*
>(
device);
637 MockFence* mock_fence =
reinterpret_cast<MockFence*
>(fence);
638 return mock_fence->GetStatus();
641VkResult vkResetFences(VkDevice
device,
643 const VkFence* fences) {
647VkResult vkCreateDebugUtilsMessengerEXT(
649 const VkDebugUtilsMessengerCreateInfoEXT* pCreateInfo,
650 const VkAllocationCallbacks* pAllocator,
651 VkDebugUtilsMessengerEXT* pMessenger) {
655VkResult vkSetDebugUtilsObjectNameEXT(
657 const VkDebugUtilsObjectNameInfoEXT* pNameInfo) {
661VkResult vkCreateQueryPool(VkDevice
device,
662 const VkQueryPoolCreateInfo* pCreateInfo,
663 const VkAllocationCallbacks* pAllocator,
664 VkQueryPool* pQueryPool) {
665 *pQueryPool =
reinterpret_cast<VkQueryPool
>(
new MockQueryPool());
666 MockDevice* mock_device =
reinterpret_cast<MockDevice*
>(
device);
667 mock_device->AddCalledFunction(
"vkCreateQueryPool");
671void vkDestroyQueryPool(VkDevice
device,
672 VkQueryPool queryPool,
673 const VkAllocationCallbacks* pAllocator) {
674 MockDevice* mock_device =
reinterpret_cast<MockDevice*
>(
device);
675 mock_device->AddCalledFunction(
"vkDestroyQueryPool");
676 delete reinterpret_cast<MockQueryPool*
>(queryPool);
679VkResult vkGetQueryPoolResults(VkDevice
device,
680 VkQueryPool queryPool,
686 VkQueryResultFlags flags) {
687 MockDevice* mock_device =
reinterpret_cast<MockDevice*
>(
device);
688 if (dataSize ==
sizeof(uint32_t)) {
689 uint32_t*
data =
static_cast<uint32_t*
>(pData);
690 for (
auto i = firstQuery;
i < queryCount;
i++) {
693 }
else if (dataSize ==
sizeof(int64_t)) {
694 uint64_t*
data =
static_cast<uint64_t*
>(pData);
695 for (
auto i = firstQuery;
i < queryCount;
i++) {
699 mock_device->AddCalledFunction(
"vkGetQueryPoolResults");
703VkResult vkCreateDescriptorPool(VkDevice
device,
704 const VkDescriptorPoolCreateInfo* pCreateInfo,
705 const VkAllocationCallbacks* pAllocator,
706 VkDescriptorPool* pDescriptorPool) {
707 MockDevice* mock_device =
reinterpret_cast<MockDevice*
>(
device);
709 reinterpret_cast<VkDescriptorPool
>(
new MockDescriptorPool());
710 mock_device->AddCalledFunction(
"vkCreateDescriptorPool");
714void vkDestroyDescriptorPool(VkDevice
device,
715 VkDescriptorPool descriptorPool,
716 const VkAllocationCallbacks* pAllocator) {
717 MockDevice* mock_device =
reinterpret_cast<MockDevice*
>(
device);
718 mock_device->AddCalledFunction(
"vkDestroyDescriptorPool");
719 delete reinterpret_cast<MockDescriptorPool*
>(descriptorPool);
722VkResult vkResetDescriptorPool(VkDevice
device,
723 VkDescriptorPool descriptorPool,
724 VkDescriptorPoolResetFlags flags) {
725 MockDevice* mock_device =
reinterpret_cast<MockDevice*
>(
device);
726 mock_device->AddCalledFunction(
"vkResetDescriptorPool");
730VkResult vkAllocateDescriptorSets(
732 const VkDescriptorSetAllocateInfo* pAllocateInfo,
733 VkDescriptorSet* pDescriptorSets) {
734 MockDevice* mock_device =
reinterpret_cast<MockDevice*
>(
device);
735 mock_device->AddCalledFunction(
"vkAllocateDescriptorSets");
739VkResult vkGetPhysicalDeviceSurfaceFormatsKHR(
740 VkPhysicalDevice physicalDevice,
741 VkSurfaceKHR surface,
742 uint32_t* pSurfaceFormatCount,
743 VkSurfaceFormatKHR* pSurfaceFormats) {
744 *pSurfaceFormatCount = 1u;
745 if (pSurfaceFormats !=
nullptr) {
747 VkSurfaceFormatKHR{.format = VK_FORMAT_R8G8B8A8_UNORM,
748 .colorSpace = VK_COLOR_SPACE_SRGB_NONLINEAR_KHR};
753VkResult vkGetPhysicalDeviceSurfaceCapabilitiesKHR(
754 VkPhysicalDevice physicalDevice,
755 VkSurfaceKHR surface,
756 VkSurfaceCapabilitiesKHR* pSurfaceCapabilities) {
757 *pSurfaceCapabilities = VkSurfaceCapabilitiesKHR{
762 .width =
static_cast<uint32_t
>(currentImageSize.width),
763 .
height =
static_cast<uint32_t
>(currentImageSize.height),
772 .width =
static_cast<uint32_t
>(currentImageSize.width),
773 .
height =
static_cast<uint32_t
>(currentImageSize.height),
775 .maxImageArrayLayers = 1,
776 .supportedTransforms =
777 VkSurfaceTransformFlagBitsKHR::VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR,
779 VkSurfaceTransformFlagBitsKHR::VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR,
780 .supportedCompositeAlpha = VkCompositeAlphaFlagBitsKHR::
781 VK_COMPOSITE_ALPHA_PRE_MULTIPLIED_BIT_KHR,
782 .supportedUsageFlags =
783 VkImageUsageFlagBits::VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT};
787VkResult vkGetPhysicalDeviceSurfaceSupportKHR(VkPhysicalDevice physicalDevice,
788 uint32_t queueFamilyIndex,
789 VkSurfaceKHR surface,
790 VkBool32* pSupported) {
791 *pSupported = VK_TRUE;
795VkResult vkCreateSwapchainKHR(VkDevice
device,
796 const VkSwapchainCreateInfoKHR* pCreateInfo,
797 const VkAllocationCallbacks* pAllocator,
798 VkSwapchainKHR* pSwapchain) {
799 *pSwapchain =
reinterpret_cast<VkSwapchainKHR
>(
new MockSwapchainKHR());
803void vkDestroySwapchainKHR(VkDevice
device,
804 VkSwapchainKHR swapchain,
805 const VkAllocationCallbacks* pAllocator) {
806 delete reinterpret_cast<MockSwapchainKHR*
>(
swapchain);
809VkResult vkGetSwapchainImagesKHR(VkDevice
device,
810 VkSwapchainKHR swapchain,
811 uint32_t* pSwapchainImageCount,
812 VkImage* pSwapchainImages) {
813 MockSwapchainKHR* mock_swapchain =
814 reinterpret_cast<MockSwapchainKHR*
>(
swapchain);
815 auto&
images = mock_swapchain->images;
816 *pSwapchainImageCount =
images.size();
817 if (pSwapchainImages !=
nullptr) {
818 for (
size_t i = 0;
i <
images.size();
i++) {
819 pSwapchainImages[
i] =
reinterpret_cast<VkImage
>(&
images[
i]);
825VkResult vkCreateSemaphore(VkDevice
device,
826 const VkSemaphoreCreateInfo* pCreateInfo,
827 const VkAllocationCallbacks* pAllocator,
828 VkSemaphore* pSemaphore) {
829 *pSemaphore =
reinterpret_cast<VkSemaphore
>(
new MockSemaphore());
833void vkDestroySemaphore(VkDevice
device,
834 VkSemaphore semaphore,
835 const VkAllocationCallbacks* pAllocator) {
836 delete reinterpret_cast<MockSemaphore*
>(semaphore);
839VkResult vkAcquireNextImageKHR(VkDevice
device,
840 VkSwapchainKHR swapchain,
842 VkSemaphore semaphore,
844 uint32_t* pImageIndex) {
846 return GetMockVulkanState().acquire_next_image_callback(
847 device, swapchain, timeout, semaphore, fence, pImageIndex);
851 *pImageIndex = (current_index + 1) % 3u;
855VkResult vkCreateFramebuffer(VkDevice
device,
856 const VkFramebufferCreateInfo* pCreateInfo,
857 const VkAllocationCallbacks* pAllocator,
858 VkFramebuffer* pFramebuffer) {
859 *pFramebuffer =
reinterpret_cast<VkFramebuffer
>(
new MockFramebuffer());
863void vkDestroyFramebuffer(VkDevice
device,
864 VkFramebuffer framebuffer,
865 const VkAllocationCallbacks* pAllocator) {
866 delete reinterpret_cast<MockFramebuffer*
>(framebuffer);
869void vkTrimCommandPool(VkDevice
device,
870 VkCommandPool commandPool,
871 VkCommandPoolTrimFlags flags) {
872 MockDevice* mock_device =
reinterpret_cast<MockDevice*
>(
device);
873 mock_device->AddCalledFunction(
"vkTrimCommandPool");
876VkResult vkGetPipelineCacheData(VkDevice
device,
877 VkPipelineCache pipelineCache,
881 const std::array<uint8_t, 5> cache_data{1, 2, 3, 4, 5};
882 size_t dst_buffer_size = *pDataSize;
883 size_t length = std::min(dst_buffer_size, cache_data.size());
884 std::memcpy(pData, cache_data.data(),
length);
886 return (dst_buffer_size >=
length) ? VK_SUCCESS : VK_INCOMPLETE;
893PFN_vkVoidFunction GetMockVulkanProcAddress(VkInstance
instance,
895 if (strcmp(
"vkEnumerateInstanceExtensionProperties", pName) == 0) {
896 return reinterpret_cast<PFN_vkVoidFunction
>(
897 vkEnumerateInstanceExtensionProperties);
898 }
else if (strcmp(
"vkEnumerateInstanceLayerProperties", pName) == 0) {
899 return reinterpret_cast<PFN_vkVoidFunction
>(
900 vkEnumerateInstanceLayerProperties);
901 }
else if (strcmp(
"vkEnumeratePhysicalDevices", pName) == 0) {
902 return reinterpret_cast<PFN_vkVoidFunction
>(vkEnumeratePhysicalDevices);
903 }
else if (strcmp(
"vkGetPhysicalDeviceFormatProperties", pName) == 0) {
904 return reinterpret_cast<PFN_vkVoidFunction
>(
905 vkGetPhysicalDeviceFormatProperties);
906 }
else if (strcmp(
"vkGetPhysicalDeviceProperties", pName) == 0) {
907 return reinterpret_cast<PFN_vkVoidFunction
>(vkGetPhysicalDeviceProperties);
908 }
else if (strcmp(
"vkGetPhysicalDeviceQueueFamilyProperties", pName) == 0) {
909 return reinterpret_cast<PFN_vkVoidFunction
>(
910 vkGetPhysicalDeviceQueueFamilyProperties);
911 }
else if (strcmp(
"vkEnumerateDeviceExtensionProperties", pName) == 0) {
912 return reinterpret_cast<PFN_vkVoidFunction
>(
913 vkEnumerateDeviceExtensionProperties);
914 }
else if (strcmp(
"vkCreateDevice", pName) == 0) {
915 return reinterpret_cast<PFN_vkVoidFunction
>(vkCreateDevice);
916 }
else if (strcmp(
"vkCreateInstance", pName) == 0) {
917 return reinterpret_cast<PFN_vkVoidFunction
>(vkCreateInstance);
918 }
else if (strcmp(
"vkGetPhysicalDeviceMemoryProperties", pName) == 0) {
919 return reinterpret_cast<PFN_vkVoidFunction
>(
920 vkGetPhysicalDeviceMemoryProperties);
921 }
else if (strcmp(
"vkCreatePipelineCache", pName) == 0) {
922 return reinterpret_cast<PFN_vkVoidFunction
>(vkCreatePipelineCache);
923 }
else if (strcmp(
"vkCreateCommandPool", pName) == 0) {
924 return reinterpret_cast<PFN_vkVoidFunction
>(vkCreateCommandPool);
925 }
else if (strcmp(
"vkResetCommandPool", pName) == 0) {
926 return reinterpret_cast<PFN_vkVoidFunction
>(vkResetCommandPool);
927 }
else if (strcmp(
"vkAllocateCommandBuffers", pName) == 0) {
928 return reinterpret_cast<PFN_vkVoidFunction
>(vkAllocateCommandBuffers);
929 }
else if (strcmp(
"vkBeginCommandBuffer", pName) == 0) {
930 return reinterpret_cast<PFN_vkVoidFunction
>(vkBeginCommandBuffer);
931 }
else if (strcmp(
"vkCreateImage", pName) == 0) {
932 return reinterpret_cast<PFN_vkVoidFunction
>(vkCreateImage);
933 }
else if (strcmp(
"vkGetInstanceProcAddr", pName) == 0) {
934 return reinterpret_cast<PFN_vkVoidFunction
>(GetMockVulkanProcAddress);
935 }
else if (strcmp(
"vkGetDeviceProcAddr", pName) == 0) {
936 return reinterpret_cast<PFN_vkVoidFunction
>(GetMockVulkanProcAddress);
937 }
else if (strcmp(
"vkGetImageMemoryRequirements2KHR", pName) == 0 ||
938 strcmp(
"vkGetImageMemoryRequirements2", pName) == 0) {
939 return reinterpret_cast<PFN_vkVoidFunction
>(
940 vkGetImageMemoryRequirements2KHR);
941 }
else if (strcmp(
"vkAllocateMemory", pName) == 0) {
942 return reinterpret_cast<PFN_vkVoidFunction
>(vkAllocateMemory);
943 }
else if (strcmp(
"vkBindImageMemory", pName) == 0) {
944 return reinterpret_cast<PFN_vkVoidFunction
>(vkBindImageMemory);
945 }
else if (strcmp(
"vkCreateImageView", pName) == 0) {
946 return reinterpret_cast<PFN_vkVoidFunction
>(vkCreateImageView);
947 }
else if (strcmp(
"vkCreateBuffer", pName) == 0) {
948 return reinterpret_cast<PFN_vkVoidFunction
>(vkCreateBuffer);
949 }
else if (strcmp(
"vkGetBufferMemoryRequirements2KHR", pName) == 0 ||
950 strcmp(
"vkGetBufferMemoryRequirements2", pName) == 0) {
951 return reinterpret_cast<PFN_vkVoidFunction
>(
952 vkGetBufferMemoryRequirements2KHR);
953 }
else if (strcmp(
"vkBindBufferMemory", pName) == 0) {
954 return reinterpret_cast<PFN_vkVoidFunction
>(vkBindBufferMemory);
955 }
else if (strcmp(
"vkCreateRenderPass", pName) == 0) {
956 return reinterpret_cast<PFN_vkVoidFunction
>(vkCreateRenderPass);
957 }
else if (strcmp(
"vkCreateDescriptorSetLayout", pName) == 0) {
958 return reinterpret_cast<PFN_vkVoidFunction
>(vkCreateDescriptorSetLayout);
959 }
else if (strcmp(
"vkCreatePipelineLayout", pName) == 0) {
960 return reinterpret_cast<PFN_vkVoidFunction
>(vkCreatePipelineLayout);
961 }
else if (strcmp(
"vkCreateGraphicsPipelines", pName) == 0) {
962 return reinterpret_cast<PFN_vkVoidFunction
>(vkCreateGraphicsPipelines);
963 }
else if (strcmp(
"vkDestroyDevice", pName) == 0) {
964 return reinterpret_cast<PFN_vkVoidFunction
>(vkDestroyDevice);
965 }
else if (strcmp(
"vkDestroyInstance", pName) == 0) {
966 return reinterpret_cast<PFN_vkVoidFunction
>(vkDestroyInstance);
967 }
else if (strcmp(
"vkDestroyPipeline", pName) == 0) {
968 return reinterpret_cast<PFN_vkVoidFunction
>(vkDestroyPipeline);
969 }
else if (strcmp(
"vkCreateShaderModule", pName) == 0) {
970 return reinterpret_cast<PFN_vkVoidFunction
>(vkCreateShaderModule);
971 }
else if (strcmp(
"vkDestroyShaderModule", pName) == 0) {
972 return reinterpret_cast<PFN_vkVoidFunction
>(vkDestroyShaderModule);
973 }
else if (strcmp(
"vkDestroyPipelineCache", pName) == 0) {
974 return reinterpret_cast<PFN_vkVoidFunction
>(vkDestroyPipelineCache);
975 }
else if (strcmp(
"vkCmdBindPipeline", pName) == 0) {
976 return reinterpret_cast<PFN_vkVoidFunction
>(vkCmdBindPipeline);
977 }
else if (strcmp(
"vkCmdPipelineBarrier", pName) == 0) {
978 return reinterpret_cast<PFN_vkVoidFunction
>(vkCmdPipelineBarrier);
979 }
else if (strcmp(
"vkCmdSetStencilReference", pName) == 0) {
980 return reinterpret_cast<PFN_vkVoidFunction
>(vkCmdSetStencilReference);
981 }
else if (strcmp(
"vkCmdSetScissor", pName) == 0) {
982 return reinterpret_cast<PFN_vkVoidFunction
>(vkCmdSetScissor);
983 }
else if (strcmp(
"vkCmdSetViewport", pName) == 0) {
984 return reinterpret_cast<PFN_vkVoidFunction
>(vkCmdSetViewport);
985 }
else if (strcmp(
"vkDestroyCommandPool", pName) == 0) {
986 return reinterpret_cast<PFN_vkVoidFunction
>(vkDestroyCommandPool);
987 }
else if (strcmp(
"vkFreeCommandBuffers", pName) == 0) {
988 return reinterpret_cast<PFN_vkVoidFunction
>(vkFreeCommandBuffers);
989 }
else if (strcmp(
"vkEndCommandBuffer", pName) == 0) {
990 return reinterpret_cast<PFN_vkVoidFunction
>(vkEndCommandBuffer);
991 }
else if (strcmp(
"vkCreateFence", pName) == 0) {
992 return reinterpret_cast<PFN_vkVoidFunction
>(vkCreateFence);
993 }
else if (strcmp(
"vkDestroyFence", pName) == 0) {
994 return reinterpret_cast<PFN_vkVoidFunction
>(vkDestroyFence);
995 }
else if (strcmp(
"vkQueueSubmit", pName) == 0) {
996 return reinterpret_cast<PFN_vkVoidFunction
>(vkQueueSubmit);
997 }
else if (strcmp(
"vkWaitForFences", pName) == 0) {
998 return reinterpret_cast<PFN_vkVoidFunction
>(vkWaitForFences);
999 }
else if (strcmp(
"vkGetFenceStatus", pName) == 0) {
1000 return reinterpret_cast<PFN_vkVoidFunction
>(vkGetFenceStatus);
1001 }
else if (strcmp(
"vkResetFences", pName) == 0) {
1002 return reinterpret_cast<PFN_vkVoidFunction
>(vkResetFences);
1003 }
else if (strcmp(
"vkCreateDebugUtilsMessengerEXT", pName) == 0) {
1004 return reinterpret_cast<PFN_vkVoidFunction
>(vkCreateDebugUtilsMessengerEXT);
1005 }
else if (strcmp(
"vkSetDebugUtilsObjectNameEXT", pName) == 0) {
1006 return reinterpret_cast<PFN_vkVoidFunction
>(vkSetDebugUtilsObjectNameEXT);
1007 }
else if (strcmp(
"vkCreateQueryPool", pName) == 0) {
1008 return reinterpret_cast<PFN_vkVoidFunction
>(vkCreateQueryPool);
1009 }
else if (strcmp(
"vkDestroyQueryPool", pName) == 0) {
1010 return reinterpret_cast<PFN_vkVoidFunction
>(vkDestroyQueryPool);
1011 }
else if (strcmp(
"vkGetQueryPoolResults", pName) == 0) {
1012 return reinterpret_cast<PFN_vkVoidFunction
>(vkGetQueryPoolResults);
1013 }
else if (strcmp(
"vkCreateDescriptorPool", pName) == 0) {
1014 return reinterpret_cast<PFN_vkVoidFunction
>(vkCreateDescriptorPool);
1015 }
else if (strcmp(
"vkDestroyDescriptorPool", pName) == 0) {
1016 return reinterpret_cast<PFN_vkVoidFunction
>(vkDestroyDescriptorPool);
1017 }
else if (strcmp(
"vkResetDescriptorPool", pName) == 0) {
1018 return reinterpret_cast<PFN_vkVoidFunction
>(vkResetDescriptorPool);
1019 }
else if (strcmp(
"vkAllocateDescriptorSets", pName) == 0) {
1020 return reinterpret_cast<PFN_vkVoidFunction
>(vkAllocateDescriptorSets);
1021 }
else if (strcmp(
"vkGetPhysicalDeviceSurfaceFormatsKHR", pName) == 0) {
1022 return reinterpret_cast<PFN_vkVoidFunction
>(
1023 vkGetPhysicalDeviceSurfaceFormatsKHR);
1024 }
else if (strcmp(
"vkGetPhysicalDeviceSurfaceCapabilitiesKHR", pName) == 0) {
1025 return reinterpret_cast<PFN_vkVoidFunction
>(
1026 vkGetPhysicalDeviceSurfaceCapabilitiesKHR);
1027 }
else if (strcmp(
"vkGetPhysicalDeviceSurfaceSupportKHR", pName) == 0) {
1028 return reinterpret_cast<PFN_vkVoidFunction
>(
1029 vkGetPhysicalDeviceSurfaceSupportKHR);
1030 }
else if (strcmp(
"vkCreateSwapchainKHR", pName) == 0) {
1031 return reinterpret_cast<PFN_vkVoidFunction
>(vkCreateSwapchainKHR);
1032 }
else if (strcmp(
"vkDestroySwapchainKHR", pName) == 0) {
1033 return reinterpret_cast<PFN_vkVoidFunction
>(vkDestroySwapchainKHR);
1034 }
else if (strcmp(
"vkGetSwapchainImagesKHR", pName) == 0) {
1035 return reinterpret_cast<PFN_vkVoidFunction
>(vkGetSwapchainImagesKHR);
1036 }
else if (strcmp(
"vkCreateSemaphore", pName) == 0) {
1037 return reinterpret_cast<PFN_vkVoidFunction
>(vkCreateSemaphore);
1038 }
else if (strcmp(
"vkDestroySemaphore", pName) == 0) {
1039 return reinterpret_cast<PFN_vkVoidFunction
>(vkDestroySemaphore);
1040 }
else if (strcmp(
"vkDestroySurfaceKHR", pName) == 0) {
1041 return reinterpret_cast<PFN_vkVoidFunction
>(vkDestroySurfaceKHR);
1042 }
else if (strcmp(
"vkAcquireNextImageKHR", pName) == 0) {
1043 return reinterpret_cast<PFN_vkVoidFunction
>(vkAcquireNextImageKHR);
1044 }
else if (strcmp(
"vkCreateFramebuffer", pName) == 0) {
1045 return reinterpret_cast<PFN_vkVoidFunction
>(vkCreateFramebuffer);
1046 }
else if (strcmp(
"vkDestroyFramebuffer", pName) == 0) {
1047 return reinterpret_cast<PFN_vkVoidFunction
>(vkDestroyFramebuffer);
1048 }
else if (strcmp(
"vkTrimCommandPool", pName) == 0) {
1049 return reinterpret_cast<PFN_vkVoidFunction
>(vkTrimCommandPool);
1050 }
else if (strcmp(
"vkGetPipelineCacheData", pName) == 0) {
1051 return reinterpret_cast<PFN_vkVoidFunction
>(vkGetPipelineCacheData);
1059 : instance_extensions_({
"VK_KHR_surface",
"VK_MVK_macos_surface"}),
1060 device_extensions_({
"VK_KHR_swapchain"}),
1061 format_properties_callback_([](VkPhysicalDevice physicalDevice,
1063 VkFormatProperties* pFormatProperties) {
1064 if (format == VK_FORMAT_R8G8B8A8_UNORM) {
1065 pFormatProperties->optimalTilingFeatures =
1066 static_cast<VkFormatFeatureFlags
>(
1067 vk::FormatFeatureFlagBits::eColorAttachment);
1068 }
else if (format == VK_FORMAT_D32_SFLOAT_S8_UINT) {
1069 pFormatProperties->optimalTilingFeatures =
1070 static_cast<VkFormatFeatureFlags
>(
1071 vk::FormatFeatureFlagBits::eDepthStencilAttachment);
1072 }
else if (format == VK_FORMAT_S8_UINT) {
1073 pFormatProperties->optimalTilingFeatures =
1074 static_cast<VkFormatFeatureFlags
>(
1075 vk::FormatFeatureFlagBits::eDepthStencilAttachment);
1083 if (settings_callback_) {
1084 settings_callback_(settings);
1086 g_mock_vulkan_state.reset(
new MockVulkanState());
1087 g_mock_vulkan_state->instance_extensions = instance_extensions_;
1088 g_mock_vulkan_state->instance_layers = instance_layers_;
1089 g_mock_vulkan_state->device_extensions = device_extensions_;
1090 g_mock_vulkan_state->format_properties_callback = format_properties_callback_;
1091 g_mock_vulkan_state->physical_device_properties_callback =
1092 physical_properties_callback_;
1093 g_mock_vulkan_state->acquire_next_image_callback =
1094 acquire_next_image_callback_;
1095 g_mock_vulkan_state->wait_for_fences_callback = wait_for_fences_callback_;
1103 MockDevice* mock_device =
reinterpret_cast<MockDevice*
>(
device);
1104 return mock_device->GetCalledFunctions();
1108 currentImageSize =
size;
1112 VkCommandBuffer buffer) {
1113 MockCommandBuffer* mock_command_buffer =
1114 reinterpret_cast<MockCommandBuffer*
>(
buffer);
1115 return mock_command_buffer->image_memory_barriers_;
1119 MockCommandBuffer* mock_command_buffer =
1120 reinterpret_cast<MockCommandBuffer*
>(
buffer);
1121 return mock_command_buffer->recorded_viewports_;
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)
std::shared_ptr< ContextVK > Build()
Create a Vulkan context with Vulkan functions mocked. The caller is given a chance to tinker on the s...
MockVulkanContextBuilder()
FlutterVulkanImage * image
#define FML_CHECK(condition)
std::vector< std::string > instance_layers
std::vector< std::string > device_extensions
std::function< void(VkPhysicalDevice physicalDevice, VkFormat format, VkFormatProperties *pFormatProperties)> format_properties_callback
std::function< void(VkPhysicalDevice physicalDevice, VkPhysicalDeviceProperties *pProperties)> physical_device_properties_callback
std::function< std::remove_pointer_t< PFN_vkWaitForFences > > wait_for_fences_callback
std::shared_ptr< std::vector< std::string > > called_functions_
std::array< MockImage, 3 > images
std::vector< std::string > instance_extensions
std::function< std::remove_pointer_t< PFN_vkAcquireNextImageKHR > > acquire_next_image_callback
std::vector< VkImageMemoryBarrier > image_memory_barriers_
std::vector< VkViewport > recorded_viewports_
it will be possible to load the file into Perfetto s trace viewer use test Running tests that layout and measure text will not yield consistent results across various platforms Enabling this option will make font resolution default to the Ahem test font on all disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot data
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set profile Make the profiler discard new samples once the profiler sample buffer is full When this flag is not the profiler sample buffer is used as a ring buffer
std::shared_ptr< std::vector< std::string > > GetMockVulkanFunctions(VkDevice device)
const std::vector< VkViewport > & GetRecordedViewports(VkCommandBuffer buffer)
Returns the viewports passed to vkCmdSetViewport calls on the given command buffer,...
std::vector< VkImageMemoryBarrier > & GetImageMemoryBarriers(VkCommandBuffer buffer)
void SetSwapchainImageSize(ISize size)
Override the image size returned by all swapchain images.
constexpr Color operator*(T value, const Color &c)
PFN_vkGetInstanceProcAddr proc_address_callback
std::optional< EmbedderData > embedder_data
#define IPLR_GUARDED_BY(x)