5#ifndef FLUTTER_IMPELLER_RENDERER_BACKEND_VULKAN_TEST_MOCK_VULKAN_H_
6#define FLUTTER_IMPELLER_RENDERER_BACKEND_VULKAN_TEST_MOCK_VULKAN_H_
15#include "vulkan/vulkan_core.h"
16#include "vulkan/vulkan_enums.hpp"
30 VkResult
GetStatus() {
return static_cast<VkResult
>(result_.load()); }
33 void SetStatus(vk::Result result) { result_ = result; }
36 static void SetStatus(vk::UniqueFence& fence, vk::Result result) {
38 VkFence raw_fence = fence.get();
46 VkFence raw_fence = fence.get();
52 std::atomic<vk::Result> result_ = vk::Result::eSuccess;
70 std::shared_ptr<ContextVK>
Build();
76 settings_callback_ = settings_callback;
101 std::function<
void(VkPhysicalDevice physicalDevice,
103 VkFormatProperties* pFormatProperties)>
110 std::function<
void(VkPhysicalDevice
device,
111 VkPhysicalDeviceProperties* physicalProperties)>
112 physical_properties_callback) {
113 physical_properties_callback_ = std::move(physical_properties_callback);
119 embedder_data_ = embedder_data;
124 std::function<std::remove_pointer_t<PFN_vkAcquireNextImageKHR>>
131 std::function<std::remove_pointer_t<PFN_vkWaitForFences>>
139 std::vector<std::string> instance_extensions_;
140 std::vector<std::string> instance_layers_;
141 std::vector<std::string> device_extensions_;
142 std::optional<ContextVK::EmbedderData> embedder_data_;
143 std::function<void(VkPhysicalDevice physicalDevice,
145 VkFormatProperties* pFormatProperties)>
146 format_properties_callback_;
147 std::function<void(VkPhysicalDevice
device,
148 VkPhysicalDeviceProperties* physicalProperties)>
149 physical_properties_callback_;
150 std::function<std::remove_pointer_t<PFN_vkAcquireNextImageKHR>>
151 acquire_next_image_callback_;
152 std::function<std::remove_pointer_t<PFN_vkWaitForFences>>
153 wait_for_fences_callback_;
160 VkCommandBuffer buffer);
void SetStatus(vk::Result result)
static MockFence * GetRawPointer(vk::UniqueFence &fence)
static void SetStatus(vk::UniqueFence &fence, vk::Result result)
MockVulkanContextBuilder & SetPhysicalPropertiesCallback(std::function< void(VkPhysicalDevice device, VkPhysicalDeviceProperties *physicalProperties)> physical_properties_callback)
MockVulkanContextBuilder & SetDeviceExtensions(const std::vector< std::string > &device_extensions)
MockVulkanContextBuilder SetEmbedderData(const ContextVK::EmbedderData &embedder_data)
MockVulkanContextBuilder SetWaitForFencesCallback(std::function< std::remove_pointer_t< PFN_vkWaitForFences > > wait_for_fences_callback)
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 & SetInstanceExtensions(const std::vector< std::string > &instance_extensions)
MockVulkanContextBuilder()
MockVulkanContextBuilder SetAcquireNextImageCallback(std::function< std::remove_pointer_t< PFN_vkAcquireNextImageKHR > > acquire_next_image_callback)
MockVulkanContextBuilder & SetInstanceLayers(const std::vector< std::string > &instance_layers)
MockVulkanContextBuilder & SetPhysicalDeviceFormatPropertiesCallback(std::function< void(VkPhysicalDevice physicalDevice, VkFormat format, VkFormatProperties *pFormatProperties)> format_properties_callback)
MockVulkanContextBuilder & SetSettingsCallback(const std::function< void(ContextVK::Settings &)> &settings_callback)
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< std::remove_pointer_t< PFN_vkWaitForFences > > wait_for_fences_callback
std::vector< std::string > instance_extensions
std::function< std::remove_pointer_t< PFN_vkAcquireNextImageKHR > > acquire_next_image_callback
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
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.