Flutter Engine
 
Loading...
Searching...
No Matches
main.cc File Reference
#include <chrono>
#include <cstdlib>
#include <iostream>
#include <optional>
#include <tuple>
#include <vector>
#include "vulkan/vulkan.hpp"
#include "GLFW/glfw3.h"
#include "embedder.h"

Go to the source code of this file.

Macros

#define VULKAN_HPP_NO_EXCEPTIONS   1
 
#define VULKAN_HPP_DISPATCH_LOADER_DYNAMIC   1
 
#define S1(x)   #x
 
#define S2(x)   S1(x)
 
#define LOCATION   __FILE__ " : " S2(__LINE__)
 
#define CHECK_VK_RESULT(x)
 

Functions

void GLFW_ErrorCallback (int error, const char *description)
 
void GLFWcursorPositionCallbackAtPhase (GLFWwindow *window, FlutterPointerPhase phase, double x, double y)
 
void GLFWcursorPositionCallback (GLFWwindow *window, double x, double y)
 
void GLFWmouseButtonCallback (GLFWwindow *window, int key, int action, int mods)
 
void GLFWKeyCallback (GLFWwindow *window, int key, int scancode, int action, int mods)
 
void GLFWframebufferSizeCallback (GLFWwindow *window, int width, int height)
 
void PrintUsage ()
 
bool InitializeSwapchain ()
 
FlutterVulkanImage FlutterGetNextImageCallback (void *user_data, const FlutterFrameInfo *frame_info)
 
bool FlutterPresentCallback (void *user_data, const FlutterVulkanImage *image)
 
void * FlutterGetInstanceProcAddressCallback (void *user_data, FlutterVulkanInstanceHandle instance, const char *procname)
 
VkBool32 DebugReportCallback (VkDebugReportFlagsEXT flags, VkDebugReportObjectTypeEXT, uint64_t, size_t, int32_t, const char *pLayerPrefix, const char *pMessage, void *)
 
VkBool32 DebugUtilsCallback (VkDebugUtilsMessageSeverityFlagBitsEXT severity, VkDebugUtilsMessageTypeFlagsEXT, const VkDebugUtilsMessengerCallbackDataEXT *cb_data, void *)
 
int main (int argc, char **argv)
 

Variables

auto & d = VULKAN_HPP_DEFAULT_DISPATCHER
 
struct { 
 
   bool   enable_validation_layers = true 
 
   bool   utils_supported = false 
 
   bool   report_supported = false 
 
   VkDebugReportCallbackEXT   report_callback = VK_NULL_HANDLE 
 
   VkDebugUtilsMessengerEXT   utils_messenger_callback = VK_NULL_HANDLE 
 
g_debug 
 
static double g_pixelRatio = 1.0
 
static const size_t kInitialWindowWidth = 800
 
static const size_t kInitialWindowHeight = 600
 
static const VkPresentModeKHR kPreferredPresentMode = VK_PRESENT_MODE_FIFO_KHR
 
static constexpr FlutterViewId kImplicitViewId = 0
 
struct { 
 
   GLFWwindow *   window 
 
   std::vector< const char * >   enabled_instance_extensions 
 
   std::vector< const char * >   enabled_layer_names 
 
   VkInstance   instance 
 
   VkSurfaceKHR   surface 
 
   VkPhysicalDevice   physical_device 
 
   std::vector< const char * >   enabled_device_extensions 
 
   VkDevice   device 
 
   uint32_t   queue_family_index 
 
   VkQueue   queue 
 
   VkCommandPool   swapchain_command_pool 
 
   std::vector< VkCommandBuffer >   present_transition_buffers 
 
   VkFence   image_ready_fence 
 
   VkSemaphore   present_transition_semaphore 
 
   VkSurfaceFormatKHR   surface_format 
 
   VkSwapchainKHR   swapchain 
 
   std::vector< VkImage >   swapchain_images 
 
   uint32_t   last_image_index 
 
   FlutterEngine   engine 
 
   bool   resize_pending = false 
 
g_state 
 Global struct for holding the Window+Vulkan state.
 

Macro Definition Documentation

◆ CHECK_VK_RESULT

#define CHECK_VK_RESULT (   x)
Value:
do { \
vk::resultCheck(static_cast<vk::Result>(x), LOCATION); \
} while (0)
int32_t x
#define LOCATION
Definition main.cc:20

Definition at line 22 of file main.cc.

23 { \
24 vk::resultCheck(static_cast<vk::Result>(x), LOCATION); \
25 } while (0)

◆ LOCATION

#define LOCATION   __FILE__ " : " S2(__LINE__)

Definition at line 20 of file main.cc.

◆ S1

#define S1 (   x)    #x

Definition at line 18 of file main.cc.

◆ S2

#define S2 (   x)    S1(x)

Definition at line 19 of file main.cc.

◆ VULKAN_HPP_DISPATCH_LOADER_DYNAMIC

#define VULKAN_HPP_DISPATCH_LOADER_DYNAMIC   1

Definition at line 14 of file main.cc.

◆ VULKAN_HPP_NO_EXCEPTIONS

#define VULKAN_HPP_NO_EXCEPTIONS   1

Definition at line 13 of file main.cc.

Function Documentation

◆ DebugReportCallback()

VkBool32 DebugReportCallback ( VkDebugReportFlagsEXT  flags,
VkDebugReportObjectTypeEXT  ,
uint64_t  ,
size_t  ,
int32_t  ,
const char *  pLayerPrefix,
const char *  pMessage,
void *   
)

Definition at line 423 of file main.cc.

430 {
431 if (flags & VK_DEBUG_REPORT_INFORMATION_BIT_EXT) {
432 std::cout << "VULKAN: (" << pLayerPrefix << ") " << pMessage << std::endl;
433 } else if (flags & VK_DEBUG_REPORT_WARNING_BIT_EXT) {
434 std::cout << "VULKAN DEBUG: (" << pLayerPrefix << ") " << pMessage
435 << std::endl;
436 } else if (flags & VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT) {
437 std::cout << "VULKAN PERF WARNING: (" << pLayerPrefix << ") " << pMessage
438 << std::endl;
439 } else if (flags & VK_DEBUG_REPORT_ERROR_BIT_EXT) {
440 std::cerr << "VULKAN ERROR: (" << pLayerPrefix << ") " << pMessage
441 << std::endl;
442 } else if (flags & VK_DEBUG_REPORT_DEBUG_BIT_EXT) {
443 std::cout << "VULKAN DEBUG: (" << pLayerPrefix << ") " << pMessage
444 << std::endl;
445 }
446 return VK_FALSE;
447}

◆ DebugUtilsCallback()

VkBool32 DebugUtilsCallback ( VkDebugUtilsMessageSeverityFlagBitsEXT  severity,
VkDebugUtilsMessageTypeFlagsEXT  ,
const VkDebugUtilsMessengerCallbackDataEXT *  cb_data,
void *   
)

Definition at line 449 of file main.cc.

452 {
453 if (strstr(cb_data->pMessage, "ALL_GRAPHICS_BIT") ||
454 strstr(cb_data->pMessage, "ALL_COMMANDS_BIT")) {
455 return VK_FALSE;
456 }
457 if (severity & VK_DEBUG_UTILS_MESSAGE_SEVERITY_VERBOSE_BIT_EXT) {
458 std::cout << "VULKAN: (" << cb_data->pMessageIdName << ") "
459 << cb_data->pMessage << std::endl;
460 } else if (severity & VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT) {
461 std::cout << "VULKAN INFO: (" << cb_data->pMessageIdName << ") "
462 << cb_data->pMessage << std::endl;
463 } else if (severity & VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT) {
464 std::cout << "VULKAN WARN: (" << cb_data->pMessageIdName << ") "
465 << cb_data->pMessage << std::endl;
466 } else if (severity & VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT) {
467 std::cerr << "VULKAN ERROR: (" << cb_data->pMessageIdName << ") "
468 << cb_data->pMessage << std::endl;
469 }
470 return VK_TRUE;
471}

◆ FlutterGetInstanceProcAddressCallback()

void * FlutterGetInstanceProcAddressCallback ( void *  user_data,
FlutterVulkanInstanceHandle  instance,
const char *  procname 
)

Definition at line 414 of file main.cc.

417 {
418 auto* proc = glfwGetInstanceProcAddress(
419 reinterpret_cast<VkInstance>(instance), procname);
420 return reinterpret_cast<void*>(proc);
421}
VkInstance instance
Definition main.cc:64

References instance.

Referenced by main().

◆ FlutterGetNextImageCallback()

FlutterVulkanImage FlutterGetNextImageCallback ( void *  user_data,
const FlutterFrameInfo frame_info 
)

Definition at line 350 of file main.cc.

352 {
353 // If the GLFW framebuffer has been resized, discard the swapchain and create
354 // a new one.
355 if (g_state.resize_pending) {
357 }
358
359 d.vkAcquireNextImageKHR(g_state.device, g_state.swapchain, UINT64_MAX,
360 nullptr, g_state.image_ready_fence,
361 &g_state.last_image_index);
362
363 // Flutter Engine expects the image to be available for transitioning and
364 // attaching immediately, and so we need to force a host sync here before
365 // returning.
366 d.vkWaitForFences(g_state.device, 1, &g_state.image_ready_fence, true,
367 UINT64_MAX);
368 d.vkResetFences(g_state.device, 1, &g_state.image_ready_fence);
369
370 return {
371 .struct_size = sizeof(FlutterVulkanImage),
372 .image = reinterpret_cast<uint64_t>(
373 g_state.swapchain_images[g_state.last_image_index]),
374 .format = g_state.surface_format.format,
375 };
376}
FlutterVulkanImage * image
bool InitializeSwapchain()
Definition main.cc:165
auto & d
Definition main.cc:28
struct @14 g_state
Global struct for holding the Window+Vulkan state.
uint32_t format
The VkFormat of the image (for example: VK_FORMAT_R8G8B8A8_UNORM).
Definition embedder.h:933

References d, FlutterVulkanImage::format, g_state, image, and InitializeSwapchain().

Referenced by main().

◆ FlutterPresentCallback()

bool FlutterPresentCallback ( void *  user_data,
const FlutterVulkanImage image 
)

Definition at line 378 of file main.cc.

378 {
379 VkPipelineStageFlags stage_flags =
380 VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT;
381 VkSubmitInfo submit_info = {
382 .sType = VK_STRUCTURE_TYPE_SUBMIT_INFO,
383 .waitSemaphoreCount = 0,
384 .pWaitSemaphores = nullptr,
385 .pWaitDstStageMask = &stage_flags,
386 .commandBufferCount = 1,
387 .pCommandBuffers =
388 &g_state.present_transition_buffers[g_state.last_image_index],
389 .signalSemaphoreCount = 1,
390 .pSignalSemaphores = &g_state.present_transition_semaphore,
391 };
392 d.vkQueueSubmit(g_state.queue, 1, &submit_info, nullptr);
393
394 VkPresentInfoKHR present_info = {
395 .sType = VK_STRUCTURE_TYPE_PRESENT_INFO_KHR,
396 .waitSemaphoreCount = 1,
397 .pWaitSemaphores = &g_state.present_transition_semaphore,
398 .swapchainCount = 1,
399 .pSwapchains = &g_state.swapchain,
400 .pImageIndices = &g_state.last_image_index,
401 };
402 VkResult result = d.vkQueuePresentKHR(g_state.queue, &present_info);
403
404 // If the swapchain is no longer compatible with the surface, discard the
405 // swapchain and create a new one.
406 if (result == VK_SUBOPTIMAL_KHR || result == VK_ERROR_OUT_OF_DATE_KHR) {
408 }
409 d.vkQueueWaitIdle(g_state.queue);
410
411 return result == VK_SUCCESS;
412}

References d, g_state, and InitializeSwapchain().

Referenced by main().

◆ GLFW_ErrorCallback()

void GLFW_ErrorCallback ( int  error,
const char *  description 
)

Definition at line 89 of file main.cc.

89 {
90 std::cerr << "GLFW Error: (" << error << ") " << description << std::endl;
91}
const uint8_t uint32_t uint32_t GError ** error

References error.

Referenced by main().

◆ GLFWcursorPositionCallback()

void GLFWcursorPositionCallback ( GLFWwindow *  window,
double  x,
double  y 
)

Definition at line 112 of file main.cc.

112 {
114}
@ kMove
Definition embedder.h:1257
GLFWwindow * window
Definition main.cc:60
void GLFWcursorPositionCallbackAtPhase(GLFWwindow *window, FlutterPointerPhase phase, double x, double y)
Definition main.cc:93
double y

References GLFWcursorPositionCallbackAtPhase(), kMove, window, x, and y.

Referenced by GLFWmouseButtonCallback().

◆ GLFWcursorPositionCallbackAtPhase()

void GLFWcursorPositionCallbackAtPhase ( GLFWwindow *  window,
FlutterPointerPhase  phase,
double  x,
double  y 
)

Definition at line 93 of file main.cc.

96 {
97 FlutterPointerEvent event = {};
98 event.struct_size = sizeof(event);
99 event.phase = phase;
100 event.x = x * g_pixelRatio;
101 event.y = y * g_pixelRatio;
102 event.timestamp =
103 std::chrono::duration_cast<std::chrono::microseconds>(
104 std::chrono::high_resolution_clock::now().time_since_epoch())
105 .count();
106 // This example only supports a single window, therefore we assume the event
107 // occurred in the only view, the implicit view.
108 event.view_id = kImplicitViewId;
109 FlutterEngineSendPointerEvent(g_state.engine, &event, 1);
110}
FlutterEngineResult FlutterEngineSendPointerEvent(FLUTTER_API_SYMBOL(FlutterEngine) engine, const FlutterPointerEvent *pointers, size_t events_count)
Definition embedder.cc:2769
static double g_pixelRatio
Definition main.cc:43
static constexpr FlutterViewId kImplicitViewId
Definition main.cc:50
size_t struct_size
The size of this struct. Must be sizeof(FlutterPointerEvent).
Definition embedder.h:1308

References FlutterEngineSendPointerEvent(), g_pixelRatio, g_state, kImplicitViewId, FlutterPointerEvent::struct_size, x, and y.

Referenced by GLFWcursorPositionCallback(), and GLFWmouseButtonCallback().

◆ GLFWframebufferSizeCallback()

void GLFWframebufferSizeCallback ( GLFWwindow *  window,
int  width,
int  height 
)

Definition at line 145 of file main.cc.

145 {
146 g_state.resize_pending = true;
147
148 FlutterWindowMetricsEvent event = {};
149 event.struct_size = sizeof(event);
150 event.width = width;
151 event.height = height;
152 event.pixel_ratio = g_pixelRatio;
153 // This example only supports a single window, therefore we assume the event
154 // occurred in the only view, the implicit view.
155 event.view_id = kImplicitViewId;
157}
FlutterEngineResult FlutterEngineSendWindowMetricsEvent(FLUTTER_API_SYMBOL(FlutterEngine) engine, const FlutterWindowMetricsEvent *flutter_metrics)
Definition embedder.cc:2660
int32_t height
int32_t width
size_t struct_size
The size of this struct. Must be sizeof(FlutterWindowMetricsEvent).
Definition embedder.h:1047

References FlutterEngineSendWindowMetricsEvent(), g_pixelRatio, g_state, height, kImplicitViewId, FlutterWindowMetricsEvent::struct_size, and width.

Referenced by main().

◆ GLFWKeyCallback()

void GLFWKeyCallback ( GLFWwindow *  window,
int  key,
int  scancode,
int  action,
int  mods 
)

Definition at line 135 of file main.cc.

139 {
140 if (key == GLFW_KEY_ESCAPE && action == GLFW_PRESS) {
141 glfwSetWindowShouldClose(window, GLFW_TRUE);
142 }
143}
#define GLFW_TRUE

References action, GLFW_TRUE, key, and window.

Referenced by main().

◆ GLFWmouseButtonCallback()

void GLFWmouseButtonCallback ( GLFWwindow *  window,
int  key,
int  action,
int  mods 
)

Definition at line 116 of file main.cc.

119 {
120 if (key == GLFW_MOUSE_BUTTON_1 && action == GLFW_PRESS) {
121 double x, y;
122 glfwGetCursorPos(window, &x, &y);
124 glfwSetCursorPosCallback(window, GLFWcursorPositionCallback);
125 }
126
127 if (key == GLFW_MOUSE_BUTTON_1 && action == GLFW_RELEASE) {
128 double x, y;
129 glfwGetCursorPos(window, &x, &y);
131 glfwSetCursorPosCallback(window, nullptr);
132 }
133}
@ kUp
Definition embedder.h:1245
@ kDown
Definition embedder.h:1252
void GLFWcursorPositionCallback(GLFWwindow *window, double x, double y)
Definition main.cc:112

References action, GLFWcursorPositionCallback(), GLFWcursorPositionCallbackAtPhase(), kDown, key, kUp, window, x, and y.

Referenced by main().

◆ InitializeSwapchain()

bool InitializeSwapchain ( )

Choose an image format that can be presented to the surface, preferring

the common BGRA+sRGB if available.


Choose the presentable image size that's as close as possible to the

window size.


Choose the present mode.


Create the swapchain.


Fetch swapchain images.


Record a command buffer for each of the images to be executed prior to

presenting.

Definition at line 165 of file main.cc.

165 {
166 if (g_state.resize_pending) {
167 g_state.resize_pending = false;
168 d.vkDestroySwapchainKHR(g_state.device, g_state.swapchain, nullptr);
169
170 d.vkQueueWaitIdle(g_state.queue);
171 d.vkResetCommandPool(g_state.device, g_state.swapchain_command_pool,
172 VK_COMMAND_POOL_RESET_RELEASE_RESOURCES_BIT);
173 }
174
175 /// --------------------------------------------------------------------------
176 /// Choose an image format that can be presented to the surface, preferring
177 /// the common BGRA+sRGB if available.
178 /// --------------------------------------------------------------------------
179
180 uint32_t format_count;
181 d.vkGetPhysicalDeviceSurfaceFormatsKHR(
182 g_state.physical_device, g_state.surface, &format_count, nullptr);
183 std::vector<VkSurfaceFormatKHR> formats(format_count);
184 d.vkGetPhysicalDeviceSurfaceFormatsKHR(
185 g_state.physical_device, g_state.surface, &format_count, formats.data());
186 assert(!formats.empty()); // Shouldn't be possible.
187
188 g_state.surface_format = formats[0];
189 for (const auto& format : formats) {
190 if (format.format == VK_FORMAT_B8G8R8A8_UNORM &&
191 format.colorSpace == VK_COLOR_SPACE_SRGB_NONLINEAR_KHR) {
192 g_state.surface_format = format;
193 }
194 }
195
196 /// --------------------------------------------------------------------------
197 /// Choose the presentable image size that's as close as possible to the
198 /// window size.
199 /// --------------------------------------------------------------------------
200
201 VkExtent2D extent;
202
203 VkSurfaceCapabilitiesKHR surface_capabilities;
204 d.vkGetPhysicalDeviceSurfaceCapabilitiesKHR(
205 g_state.physical_device, g_state.surface, &surface_capabilities);
206
207 if (surface_capabilities.currentExtent.width != UINT32_MAX) {
208 // If the surface reports a specific extent, we must use it.
209 extent = surface_capabilities.currentExtent;
210 } else {
211 // `glfwGetWindowSize` returns the window size in screen coordinates, so we
212 // instead use `glfwGetFramebufferSize` to get the size in pixels in order
213 // to properly support high DPI displays.
214 int width, height;
215 glfwGetFramebufferSize(g_state.window, &width, &height);
216
217 VkExtent2D actual_extent = {
218 .width = static_cast<uint32_t>(width),
219 .height = static_cast<uint32_t>(height),
220 };
221 actual_extent.width =
222 std::max(surface_capabilities.minImageExtent.width,
223 std::min(surface_capabilities.maxImageExtent.width,
224 actual_extent.width));
225 actual_extent.height =
226 std::max(surface_capabilities.minImageExtent.height,
227 std::min(surface_capabilities.maxImageExtent.height,
228 actual_extent.height));
229 }
230
231 /// --------------------------------------------------------------------------
232 /// Choose the present mode.
233 /// --------------------------------------------------------------------------
234
235 uint32_t mode_count;
236 d.vkGetPhysicalDeviceSurfacePresentModesKHR(
237 g_state.physical_device, g_state.surface, &mode_count, nullptr);
238 std::vector<VkPresentModeKHR> modes(mode_count);
239 d.vkGetPhysicalDeviceSurfacePresentModesKHR(
240 g_state.physical_device, g_state.surface, &mode_count, modes.data());
241 assert(!formats.empty()); // Shouldn't be possible.
242
243 // If the preferred mode isn't available, just choose the first one.
244 VkPresentModeKHR present_mode = modes[0];
245 for (const auto& mode : modes) {
246 if (mode == kPreferredPresentMode) {
247 present_mode = mode;
248 break;
249 }
250 }
251
252 /// --------------------------------------------------------------------------
253 /// Create the swapchain.
254 /// --------------------------------------------------------------------------
255
256 VkSwapchainCreateInfoKHR info = {
257 .sType = VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR,
258 .surface = g_state.surface,
259 .minImageCount = surface_capabilities.minImageCount + 1,
260 .imageFormat = g_state.surface_format.format,
261 .imageColorSpace = g_state.surface_format.colorSpace,
262 .imageExtent = extent,
263 .imageArrayLayers = 1,
264 .imageUsage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT,
265 .imageSharingMode = VK_SHARING_MODE_EXCLUSIVE,
266 .queueFamilyIndexCount = 0,
267 .pQueueFamilyIndices = nullptr,
268 .preTransform = surface_capabilities.currentTransform,
269 .compositeAlpha = VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR,
270 .presentMode = present_mode,
271 .clipped = true,
272 };
273 if (d.vkCreateSwapchainKHR(g_state.device, &info, nullptr,
274 &g_state.swapchain) != VK_SUCCESS) {
275 return false;
276 }
277
278 /// --------------------------------------------------------------------------
279 /// Fetch swapchain images.
280 /// --------------------------------------------------------------------------
281
282 uint32_t image_count;
283 d.vkGetSwapchainImagesKHR(g_state.device, g_state.swapchain, &image_count,
284 nullptr);
285 g_state.swapchain_images.resize(image_count);
286 d.vkGetSwapchainImagesKHR(g_state.device, g_state.swapchain, &image_count,
287 g_state.swapchain_images.data());
288
289 /// --------------------------------------------------------------------------
290 /// Record a command buffer for each of the images to be executed prior to
291 /// presenting.
292 /// --------------------------------------------------------------------------
293
294 g_state.present_transition_buffers.resize(g_state.swapchain_images.size());
295
296 VkCommandBufferAllocateInfo buffers_info = {
297 .sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO,
298 .commandPool = g_state.swapchain_command_pool,
299 .level = VK_COMMAND_BUFFER_LEVEL_PRIMARY,
300 .commandBufferCount =
301 static_cast<uint32_t>(g_state.present_transition_buffers.size()),
302 };
303 d.vkAllocateCommandBuffers(g_state.device, &buffers_info,
304 g_state.present_transition_buffers.data());
305
306 for (size_t i = 0; i < g_state.swapchain_images.size(); i++) {
307 auto image = g_state.swapchain_images[i];
308 auto buffer = g_state.present_transition_buffers[i];
309
310 VkCommandBufferBeginInfo begin_info = {
311 .sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO};
312 d.vkBeginCommandBuffer(buffer, &begin_info);
313
314 // Flutter Engine hands back the image after writing to it
315 VkImageMemoryBarrier barrier = {
316 .sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER,
317 .srcAccessMask = 0,
318 .dstAccessMask = VK_ACCESS_MEMORY_READ_BIT,
319 .oldLayout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL,
320 .newLayout = VK_IMAGE_LAYOUT_PRESENT_SRC_KHR,
321 .srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
322 .dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
323 .image = image,
324 .subresourceRange = {
325 .aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
326 .baseMipLevel = 0,
327 .levelCount = 1,
328 .baseArrayLayer = 0,
329 .layerCount = 1,
330 }};
331 d.vkCmdPipelineBarrier(
332 buffer, // commandBuffer
333 VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT, // srcStageMask
334 VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT, // dstStageMask
335 0, // dependencyFlags
336 0, // memoryBarrierCount
337 nullptr, // pMemoryBarriers
338 0, // bufferMemoryBarrierCount
339 nullptr, // pBufferMemoryBarriers
340 1, // imageMemoryBarrierCount
341 &barrier // pImageMemoryBarriers
342 );
343
344 d.vkEndCommandBuffer(buffer);
345 }
346
347 return true; // \o/
348}
#define UINT32_MAX
Definition comments.cc:87
static const VkPresentModeKHR kPreferredPresentMode
Definition main.cc:49
uint32_t uint32_t * format
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 mode
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
Definition switch_defs.h:98

References d, format, g_state, height, i, image, kPreferredPresentMode, UINT32_MAX, and width.

Referenced by FlutterGetNextImageCallback(), FlutterPresentCallback(), and main().

◆ main()

int main ( int  argc,
char **  argv 
)

Create a GLFW window.


Dynamically load the Vulkan loader with GLFW and use it to populate GLAD's

proc table.


Create a Vulkan instance.


Create the window surface.


Select a compatible physical device.


Create a logical device and a graphics queue handle.


Create sync primitives and command pool to use in the render loop

callbacks.


Create swapchain.


Start Flutter Engine.


GLFW render loop.


Cleanup.

Definition at line 473 of file main.cc.

473 {
474 if (argc != 3) {
475 PrintUsage();
476 return 1;
477 }
478
479 std::string project_path = argv[1];
480 std::string icudtl_path = argv[2];
481
482 /// --------------------------------------------------------------------------
483 /// Create a GLFW window.
484 /// --------------------------------------------------------------------------
485
486 {
487 if (!glfwInit()) {
488 std::cerr << "Failed to initialize GLFW." << std::endl;
489 return EXIT_FAILURE;
490 }
491
492 glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API);
493 g_state.window = glfwCreateWindow(kInitialWindowWidth, kInitialWindowHeight,
494 "Flutter", nullptr, nullptr);
495 if (!g_state.window) {
496 std::cerr << "Failed to create GLFW window." << std::endl;
497 return EXIT_FAILURE;
498 }
499
500 int framebuffer_width, framebuffer_height;
501 glfwGetFramebufferSize(g_state.window, &framebuffer_width,
502 &framebuffer_height);
503 g_pixelRatio = framebuffer_width / kInitialWindowWidth;
504
505 glfwSetErrorCallback(GLFW_ErrorCallback);
506 }
507
508 /// --------------------------------------------------------------------------
509 /// Dynamically load the Vulkan loader with GLFW and use it to populate GLAD's
510 /// proc table.
511 /// --------------------------------------------------------------------------
512
513 if (!glfwVulkanSupported()) {
514 std::cerr << "GLFW was unable to resolve either a Vulkan loader or a "
515 "compatible physical device!"
516 << std::endl;
517#if defined(__APPLE__)
518 std::cerr
519 << "NOTE: Apple platforms don't ship with a Vulkan loader or any "
520 "Vulkan drivers. Follow this guide to set up a Vulkan loader on "
521 "macOS and use the MoltenVK ICD: "
522 "https://vulkan.lunarg.com/doc/sdk/latest/mac/getting_started.html"
523 << std::endl;
524#endif
525 return EXIT_FAILURE;
526 }
527
528 VULKAN_HPP_DEFAULT_DISPATCHER.init(glfwGetInstanceProcAddress);
529
530 /// --------------------------------------------------------------------------
531 /// Create a Vulkan instance.
532 /// --------------------------------------------------------------------------
533
534 {
535 uint32_t extension_count;
536 const char** glfw_extensions =
537 glfwGetRequiredInstanceExtensions(&extension_count);
538 g_state.enabled_instance_extensions.resize(extension_count);
539 memcpy(g_state.enabled_instance_extensions.data(), glfw_extensions,
540 extension_count * sizeof(char*));
541
542 if (g_debug.enable_validation_layers) {
543 auto props = vk::enumerateInstanceExtensionProperties();
544 for (const auto& prop : props.value) {
545 if (strcmp(prop.extensionName,
546 VK_EXT_VALIDATION_FEATURES_EXTENSION_NAME) == 0) {
547 g_state.enabled_instance_extensions.push_back(
548 VK_EXT_VALIDATION_FEATURES_EXTENSION_NAME);
549 }
550 if (strcmp(prop.extensionName, VK_EXT_DEBUG_UTILS_EXTENSION_NAME) ==
551 0) {
552 g_debug.utils_supported = true;
553 }
554 if (strcmp(prop.extensionName, VK_EXT_DEBUG_REPORT_EXTENSION_NAME) ==
555 0) {
556 g_debug.report_supported = true;
557 }
558 }
559 if (g_debug.utils_supported) {
560 g_state.enabled_instance_extensions.push_back(
561 VK_EXT_DEBUG_UTILS_EXTENSION_NAME);
562 g_debug.report_supported = false;
563 } else if (g_debug.report_supported) {
564 g_state.enabled_instance_extensions.push_back(
565 VK_EXT_DEBUG_REPORT_EXTENSION_NAME);
566 }
567
568 auto available_layers = vk::enumerateInstanceLayerProperties();
569 for (const auto& l : available_layers.value) {
570 if (strcmp(l.layerName, "VK_LAYER_KHRONOS_validation") == 0) {
571 g_state.enabled_layer_names.push_back("VK_LAYER_KHRONOS_validation");
572 }
573 }
574 }
575
576 std::cout << "Enabling " << g_state.enabled_instance_extensions.size()
577 << " instance extensions:" << std::endl;
578 for (const auto& extension : g_state.enabled_instance_extensions) {
579 std::cout << " - " << extension << std::endl;
580 }
581 std::cout << "Enabling " << g_state.enabled_layer_names.size()
582 << " layers:" << std::endl;
583 for (const auto& layer : g_state.enabled_layer_names) {
584 std::cout << " - " << layer << std::endl;
585 }
586
587 VkApplicationInfo app_info = {
588 .sType = VK_STRUCTURE_TYPE_APPLICATION_INFO,
589 .pNext = nullptr,
590 .pApplicationName = "Flutter",
591 .applicationVersion = VK_MAKE_VERSION(1, 0, 0),
592 .pEngineName = "No Engine",
593 .engineVersion = VK_MAKE_VERSION(1, 0, 0),
594 .apiVersion = VK_MAKE_VERSION(1, 1, 0),
595 };
596 VkInstanceCreateInfo info = {};
597 info.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO;
598 info.flags = 0;
599 info.pApplicationInfo = &app_info;
600 info.enabledExtensionCount = g_state.enabled_instance_extensions.size();
601 info.ppEnabledExtensionNames = g_state.enabled_instance_extensions.data();
602 info.enabledLayerCount = g_state.enabled_layer_names.size();
603 info.ppEnabledLayerNames = g_state.enabled_layer_names.data();
604
605 if (d.vkCreateInstance(&info, nullptr, &g_state.instance) != VK_SUCCESS) {
606 std::cerr << "Failed to create Vulkan instance." << std::endl;
607 return EXIT_FAILURE;
608 }
609 }
610
611 // Load instance procs.
612 VULKAN_HPP_DEFAULT_DISPATCHER.init(vk::Instance(g_state.instance));
613
614 /// --------------------------------------------------------------------------
615 /// Create the window surface.
616 /// --------------------------------------------------------------------------
617
618 if (glfwCreateWindowSurface(g_state.instance, g_state.window, NULL,
619 &g_state.surface) != VK_SUCCESS) {
620 std::cerr << "Failed to create window surface." << std::endl;
621 return EXIT_FAILURE;
622 }
623
624 /// --------------------------------------------------------------------------
625 /// Select a compatible physical device.
626 /// --------------------------------------------------------------------------
627
628 {
629 uint32_t count;
630 d.vkEnumeratePhysicalDevices(g_state.instance, &count, nullptr);
631 std::vector<VkPhysicalDevice> physical_devices(count);
632 d.vkEnumeratePhysicalDevices(g_state.instance, &count,
633 physical_devices.data());
634
635 std::cout << "Enumerating " << count << " physical device(s)." << std::endl;
636
637 uint32_t selected_score = 0;
638 for (const auto& pdevice : physical_devices) {
639 VkPhysicalDeviceProperties properties;
640 VkPhysicalDeviceFeatures features;
641 d.vkGetPhysicalDeviceProperties(pdevice, &properties);
642 d.vkGetPhysicalDeviceFeatures(pdevice, &features);
643
644 std::cout << "Checking device: " << properties.deviceName << std::endl;
645
646 uint32_t score = 0;
647 std::vector<const char*> supported_extensions;
648
649 uint32_t qfp_count;
650 d.vkGetPhysicalDeviceQueueFamilyProperties(pdevice, &qfp_count, nullptr);
651 std::vector<VkQueueFamilyProperties> qfp(qfp_count);
652 d.vkGetPhysicalDeviceQueueFamilyProperties(pdevice, &qfp_count,
653 qfp.data());
654 std::optional<uint32_t> graphics_queue_family;
655 for (uint32_t i = 0; i < qfp.size(); i++) {
656 // Only pick graphics queues that can also present to the surface.
657 // Graphics queues that can't present are rare if not nonexistent, but
658 // the spec allows for this, so check it anyways.
659 VkBool32 surface_present_supported;
660 d.vkGetPhysicalDeviceSurfaceSupportKHR(pdevice, i, g_state.surface,
661 &surface_present_supported);
662
663 if (!graphics_queue_family.has_value() &&
664 qfp[i].queueFlags & VK_QUEUE_GRAPHICS_BIT &&
665 surface_present_supported) {
666 graphics_queue_family = i;
667 }
668 }
669
670 // Skip physical devices that don't have a graphics queue.
671 if (!graphics_queue_family.has_value()) {
672 std::cout << " - Skipping due to no suitable graphics queues."
673 << std::endl;
674 continue;
675 }
676
677 // Prefer discrete GPUs.
678 if (properties.deviceType == VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU) {
679 score += 1 << 30;
680 }
681
682 uint32_t extension_count;
683 d.vkEnumerateDeviceExtensionProperties(pdevice, nullptr, &extension_count,
684 nullptr);
685 std::vector<VkExtensionProperties> available_extensions(extension_count);
686 d.vkEnumerateDeviceExtensionProperties(pdevice, nullptr, &extension_count,
687 available_extensions.data());
688
689 bool supports_swapchain = false;
690 for (const auto& available_extension : available_extensions) {
691 if (strcmp(VK_KHR_SWAPCHAIN_EXTENSION_NAME,
692 available_extension.extensionName) == 0) {
693 supports_swapchain = true;
694 supported_extensions.push_back(VK_KHR_SWAPCHAIN_EXTENSION_NAME);
695 }
696 // The spec requires VK_KHR_portability_subset be enabled whenever it's
697 // available on a device. It's present on compatibility ICDs like
698 // MoltenVK.
699 else if (strcmp("VK_KHR_portability_subset",
700 available_extension.extensionName) == 0) {
701 supported_extensions.push_back("VK_KHR_portability_subset");
702 }
703
704 // Prefer GPUs that support VK_KHR_get_memory_requirements2.
705 else if (strcmp(VK_KHR_GET_MEMORY_REQUIREMENTS_2_EXTENSION_NAME,
706 available_extension.extensionName) == 0) {
707 score += 1 << 29;
708 supported_extensions.push_back(
709 VK_KHR_GET_MEMORY_REQUIREMENTS_2_EXTENSION_NAME);
710 }
711 }
712
713 // Skip physical devices that don't have swapchain support.
714 if (!supports_swapchain) {
715 std::cout << " - Skipping due to lack of swapchain support."
716 << std::endl;
717 continue;
718 }
719
720 // Prefer GPUs with larger max texture sizes.
721 score += properties.limits.maxImageDimension2D;
722
723 if (selected_score < score) {
724 std::cout << " - This is the best device so far. Score: 0x" << std::hex
725 << score << std::dec << std::endl;
726
727 selected_score = score;
728 g_state.physical_device = pdevice;
729 g_state.enabled_device_extensions = supported_extensions;
730 g_state.queue_family_index = graphics_queue_family.value_or(
731 std::numeric_limits<uint32_t>::max());
732 }
733 }
734
735 if (g_state.physical_device == nullptr) {
736 std::cerr << "Failed to find a compatible Vulkan physical device."
737 << std::endl;
738 return EXIT_FAILURE;
739 }
740 }
741
742 /// --------------------------------------------------------------------------
743 /// Create a logical device and a graphics queue handle.
744 /// --------------------------------------------------------------------------
745
746 std::cout << "Enabling " << g_state.enabled_device_extensions.size()
747 << " device extensions:" << std::endl;
748 for (const char* extension : g_state.enabled_device_extensions) {
749 std::cout << " - " << extension << std::endl;
750 }
751
752 {
753 VkPhysicalDeviceFeatures device_features = {};
754
755 VkDeviceQueueCreateInfo graphics_queue = {};
756 graphics_queue.sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO;
757 graphics_queue.queueFamilyIndex = g_state.queue_family_index;
758 graphics_queue.queueCount = 1;
759 float priority = 1.0f;
760 graphics_queue.pQueuePriorities = &priority;
761
762 VkDeviceCreateInfo device_info = {};
763 device_info.sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO;
764 device_info.enabledExtensionCount =
765 g_state.enabled_device_extensions.size();
766 device_info.ppEnabledExtensionNames =
767 g_state.enabled_device_extensions.data();
768 device_info.pEnabledFeatures = &device_features;
769 device_info.queueCreateInfoCount = 1;
770 device_info.pQueueCreateInfos = &graphics_queue;
771
772 if (d.vkCreateDevice(g_state.physical_device, &device_info, nullptr,
773 &g_state.device) != VK_SUCCESS) {
774 std::cerr << "Failed to create Vulkan logical device." << std::endl;
775 return EXIT_FAILURE;
776 }
777 }
778
779 d.vkGetDeviceQueue(g_state.device, g_state.queue_family_index, 0,
780 &g_state.queue);
781
782 /// --------------------------------------------------------------------------
783 /// Create sync primitives and command pool to use in the render loop
784 /// callbacks.
785 /// --------------------------------------------------------------------------
786
787 {
788 VkFenceCreateInfo f_info = {.sType = VK_STRUCTURE_TYPE_FENCE_CREATE_INFO};
789 d.vkCreateFence(g_state.device, &f_info, nullptr,
790 &g_state.image_ready_fence);
791
792 VkSemaphoreCreateInfo s_info = {
793 .sType = VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO};
794 d.vkCreateSemaphore(g_state.device, &s_info, nullptr,
795 &g_state.present_transition_semaphore);
796
797 VkCommandPoolCreateInfo pool_info = {
798 .sType = VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO,
799 .queueFamilyIndex = g_state.queue_family_index,
800 };
801 d.vkCreateCommandPool(g_state.device, &pool_info, nullptr,
802 &g_state.swapchain_command_pool);
803 }
804
805 /// --------------------------------------------------------------------------
806 /// Create swapchain.
807 /// --------------------------------------------------------------------------
808
809 if (!InitializeSwapchain()) {
810 std::cerr << "Failed to create swapchain." << std::endl;
811 return EXIT_FAILURE;
812 }
813
814 /// --------------------------------------------------------------------------
815 /// Start Flutter Engine.
816 /// --------------------------------------------------------------------------
817
818 {
819 FlutterRendererConfig config = {};
820 config.type = kVulkan;
821 config.vulkan.struct_size = sizeof(config.vulkan);
822 config.vulkan.version = VK_MAKE_VERSION(1, 1, 0);
823 config.vulkan.instance = g_state.instance;
824 config.vulkan.physical_device = g_state.physical_device;
825 config.vulkan.device = g_state.device;
826 config.vulkan.queue_family_index = g_state.queue_family_index;
827 config.vulkan.queue = g_state.queue;
829 g_state.enabled_instance_extensions.size();
831 g_state.enabled_instance_extensions.data();
833 g_state.enabled_device_extensions.size();
835 g_state.enabled_device_extensions.data();
840
841 // This directory is generated by `flutter build bundle`.
842 std::string assets_path = project_path + "/build/flutter_assets";
845 .assets_path = assets_path.c_str(),
846 .icu_data_path =
847 icudtl_path.c_str(), // Find this in your bin/cache directory.
848 };
849 FlutterEngineResult result =
851 &g_state.engine);
852 if (result != kSuccess || g_state.engine == nullptr) {
853 std::cerr << "Failed to start Flutter Engine." << std::endl;
854 return EXIT_FAILURE;
855 }
856
857 // Trigger a FlutterEngineSendWindowMetricsEvent to communicate the initial
858 // size of the window.
859 int width, height;
860 glfwGetFramebufferSize(g_state.window, &width, &height);
862 g_state.resize_pending = false;
863 }
864
865 /// --------------------------------------------------------------------------
866 /// GLFW render loop.
867 /// --------------------------------------------------------------------------
868
869 glfwSetKeyCallback(g_state.window, GLFWKeyCallback);
870 glfwSetFramebufferSizeCallback(g_state.window, GLFWframebufferSizeCallback);
871 glfwSetMouseButtonCallback(g_state.window, GLFWmouseButtonCallback);
872
873 while (!glfwWindowShouldClose(g_state.window)) {
874 glfwWaitEvents();
875 }
876
877 /// --------------------------------------------------------------------------
878 /// Cleanup.
879 /// --------------------------------------------------------------------------
880
881 if (FlutterEngineShutdown(g_state.engine) != kSuccess) {
882 std::cerr << "Flutter Engine shutdown failed." << std::endl;
883 }
884
885 d.vkDestroyCommandPool(g_state.device, g_state.swapchain_command_pool,
886 nullptr);
887 d.vkDestroySemaphore(g_state.device, g_state.present_transition_semaphore,
888 nullptr);
889 d.vkDestroyFence(g_state.device, g_state.image_ready_fence, nullptr);
890
891 if (g_state.swapchain) {
892 d.vkDestroySwapchainKHR(g_state.device, g_state.swapchain, nullptr);
893 }
894
895 d.vkDestroyDevice(g_state.device, nullptr);
896 d.vkDestroySurfaceKHR(g_state.instance, g_state.surface, nullptr);
897
898 if (g_debug.enable_validation_layers) {
899 if (g_debug.report_callback) {
900 d.vkDestroyDebugReportCallbackEXT(g_state.instance,
901 g_debug.report_callback, nullptr);
902 }
903 if (g_debug.utils_messenger_callback) {
904 d.vkDestroyDebugUtilsMessengerEXT(
905 g_state.instance, g_debug.utils_messenger_callback, nullptr);
906 }
907 }
908
909 d.vkDestroyInstance(g_state.instance, nullptr);
910
911 glfwDestroyWindow(g_state.window);
912 glfwTerminate();
913
914 return 0;
915}
int32_t value
FlutterEngineResult FlutterEngineRun(size_t version, const FlutterRendererConfig *config, const FlutterProjectArgs *args, void *user_data, FLUTTER_API_SYMBOL(FlutterEngine) *engine_out)
Initialize and run a Flutter engine instance and return a handle to it. This is a convenience method ...
Definition embedder.cc:1971
FlutterEngineResult FlutterEngineShutdown(FLUTTER_API_SYMBOL(FlutterEngine) engine)
Shuts down a Flutter engine instance. The engine handle is no longer valid for any calls in the embed...
Definition embedder.cc:2649
@ kVulkan
Definition embedder.h:86
FlutterEngineResult
Definition embedder.h:72
@ kSuccess
Definition embedder.h:73
#define FLUTTER_ENGINE_VERSION
Definition embedder.h:70
FlutterVulkanImage FlutterGetNextImageCallback(void *user_data, const FlutterFrameInfo *frame_info)
Definition main.cc:350
bool FlutterPresentCallback(void *user_data, const FlutterVulkanImage *image)
Definition main.cc:378
void PrintUsage()
Definition main.cc:159
void GLFWframebufferSizeCallback(GLFWwindow *window, int width, int height)
Definition main.cc:145
std::vector< const char * > enabled_device_extensions
Definition main.cc:68
struct @13 g_debug
std::vector< const char * > enabled_instance_extensions
Definition main.cc:62
static const size_t kInitialWindowHeight
Definition main.cc:45
void * FlutterGetInstanceProcAddressCallback(void *user_data, FlutterVulkanInstanceHandle instance, const char *procname)
Definition main.cc:414
static const size_t kInitialWindowWidth
Definition main.cc:44
void GLFWKeyCallback(GLFWwindow *window, int key, int scancode, int action, int mods)
Definition main.cc:135
void GLFWmouseButtonCallback(GLFWwindow *window, int key, int action, int mods)
Definition main.cc:116
std::vector< const char * > enabled_layer_names
Definition main.cc:63
void GLFW_ErrorCallback(int error, const char *description)
Definition main.cc:89
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
char ** argv
Definition library.h:9
size_t struct_size
The size of this struct. Must be sizeof(FlutterProjectArgs).
Definition embedder.h:2458
FlutterVulkanRendererConfig vulkan
Definition embedder.h:1036
FlutterRendererType type
Definition embedder.h:1031
FlutterVulkanQueueHandle queue
Definition embedder.h:977
FlutterVulkanDeviceHandle device
Definition embedder.h:968
FlutterVulkanInstanceProcAddressCallback get_instance_proc_address_callback
Definition embedder.h:1006
size_t struct_size
The size of this struct. Must be sizeof(FlutterVulkanRendererConfig).
Definition embedder.h:956
size_t enabled_instance_extension_count
Definition embedder.h:980
uint32_t queue_family_index
The queue family index of the VkQueue supplied in the next field.
Definition embedder.h:970
FlutterVulkanImageCallback get_next_image_callback
Definition embedder.h:1010
const char ** enabled_instance_extensions
Definition embedder.h:987
const char ** enabled_device_extensions
Definition embedder.h:998
FlutterVulkanInstanceHandle instance
Definition embedder.h:963
FlutterVulkanPresentCallback present_image_callback
Definition embedder.h:1016
FlutterVulkanPhysicalDeviceHandle physical_device
VkPhysicalDevice handle.
Definition embedder.h:965

References args, argv, d, FlutterVulkanRendererConfig::device, FlutterVulkanRendererConfig::enabled_device_extension_count, FlutterVulkanRendererConfig::enabled_device_extensions, FlutterVulkanRendererConfig::enabled_instance_extension_count, FlutterVulkanRendererConfig::enabled_instance_extensions, FLUTTER_ENGINE_VERSION, FlutterEngineRun(), FlutterEngineShutdown(), FlutterGetInstanceProcAddressCallback(), FlutterGetNextImageCallback(), FlutterPresentCallback(), g_debug, g_pixelRatio, g_state, FlutterVulkanRendererConfig::get_instance_proc_address_callback, FlutterVulkanRendererConfig::get_next_image_callback, GLFW_ErrorCallback(), GLFWframebufferSizeCallback(), GLFWKeyCallback(), GLFWmouseButtonCallback(), height, i, InitializeSwapchain(), FlutterVulkanRendererConfig::instance, kInitialWindowHeight, kInitialWindowWidth, kSuccess, kVulkan, FlutterVulkanRendererConfig::physical_device, FlutterVulkanRendererConfig::present_image_callback, PrintUsage(), FlutterVulkanRendererConfig::queue, FlutterVulkanRendererConfig::queue_family_index, FlutterVulkanRendererConfig::struct_size, FlutterProjectArgs::struct_size, FlutterRendererConfig::type, FlutterVulkanRendererConfig::version, FlutterRendererConfig::vulkan, and width.

◆ PrintUsage()

void PrintUsage ( )

Definition at line 159 of file main.cc.

159 {
160 std::cerr
161 << "usage: embedder_example_vulkan <path to project> <path to icudtl.dat>"
162 << std::endl;
163}

Referenced by main().

Variable Documentation

◆ d

◆ device

VkDevice device

Definition at line 69 of file main.cc.

Referenced by vulkan::VulkanProcTable::AcquireProc(), impeller::AHBFrameSynchronizerVK::AHBFrameSynchronizerVK(), impeller::AHBTextureSourceVK::AHBTextureSourceVK(), impeller::AllocatedTextureSourceVK::AllocatedTextureSourceVK(), impeller::RenderPassBuilderVK::Build(), impeller::testing::CanBatchSubmitTest(), impeller::testing::CanUseFramebufferFetch(), impeller::testing::CanUseMipgeneration(), impeller::testing::CanUsePrimitiveRestartSubmitTest(), impeller::ContextMTL::Create(), impeller::ContextMTL::Create(), impeller::ContextMTL::Create(), impeller::CommandPoolVK::CreateCommandBuffer(), impeller::CreateCompatRenderPassForPipeline(), impeller::CreateDepthStencilDescriptor(), flutter::testing::TestVulkanContext::CreateImage(), impeller::CreateMetalCommandQueue(), impeller::CreateSampler(), flutter::testing::CreateSimpleSimulatedPointerData(), flutter::testing::CreateSimulatedMousePointerData(), flutter::testing::CreateSimulatedPointerData(), flutter::testing::CreateSimulatedTrackpadGestureData(), vulkan::CreateSkiaGetProc(), flutter::testing::CreateSurfaceManager(), impeller::DeviceMaxTextureSizeSupported(), impeller::DeviceSupportsComputeSubgroups(), impeller::DeviceSupportsDeviceTransientTargets(), impeller::DeviceSupportsExtendedRangeFormats(), impeller::DeviceSupportsFramebufferFetch(), DoesHardwareSupportWideGamut(), impeller::DriverInfoVK::DriverInfoVK(), flutter::EmbedderSurfaceMetalImpeller::EmbedderSurfaceMetalImpeller(), flutter::EmbedderSurfaceMetalSkia::EmbedderSurfaceMetalSkia(), flutter::EmbedderSurfaceVulkanImpeller::EmbedderSurfaceVulkanImpeller(), flutter::testing::EmbedderTestContextMetal::EmbedderTestContextMetal(), fl_engine_send_touch_add_event(), fl_engine_send_touch_down_event(), fl_engine_send_touch_move_event(), fl_engine_send_touch_remove_event(), fl_engine_send_touch_up_event(), FlutterEngineSendPointerEvent(), impeller::QueuesVK::FromQueueIndices(), get_device_kind(), flutter::egl::Manager::GetDevice(), impeller::CapabilitiesVK::GetEnabledDeviceFeatures(), impeller::testing::GetMockVulkanFunctions(), impeller::HasSuitableColorFormat(), impeller::HasSuitableDepthStencilFormat(), impeller::ImpellerMetalCaptureManager::ImpellerMetalCaptureManager(), impeller::InferMetalCapabilities(), impeller::testing::IsBadVersionTest(), IsMetalRendererConfigValid(), IsVulkanRendererConfigValid(), impeller::KHRFrameSynchronizerVK::KHRFrameSynchronizerVK(), impeller::KHRSwapchainImageVK::KHRSwapchainImageVK(), flutter::FlutterSkiaVulkanMemoryAllocator::Make(), impeller::MTLShaderLibraryFromFileData(), impeller::MTLShaderLibraryFromFilePaths(), impeller::PhysicalDeviceSupportsRequiredFormats(), impeller::PickPhysicalDevice(), impeller::PickQueue(), impeller::CommandPoolRecyclerVK::Reclaim(), impeller::ContextVK::SetDebugName(), impeller::CapabilitiesVK::SetPhysicalDevice(), flutter::testing::ShellTestPlatformViewMetal::ShellTestPlatformViewMetal(), flutter::ShouldUseMetalRenderer(), impeller::SupportsLossyTextureCompression(), impeller::testing::TEST(), impeller::testing::TEST(), impeller::testing::TEST(), impeller::testing::TEST(), impeller::testing::TEST(), impeller::testing::TEST(), impeller::testing::TEST(), impeller::testing::TEST(), impeller::testing::TEST(), impeller::testing::TEST(), impeller::testing::TEST(), impeller::testing::TEST(), impeller::testing::TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), impeller::testing::TEST(), impeller::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST_F(), flutter::testing::TestMetalContext::TestMetalContext(), impeller::WaitSetEntry::UpdateSignalledStatus(), vulkan::VulkanDevice::VulkanDevice(), impeller::AHBFrameSynchronizerVK::WaitForFence(), impeller::KHRFrameSynchronizerVK::WaitForFence(), and impeller::PipelineVK::~PipelineVK().

◆ enable_validation_layers

◆ enabled_device_extensions

std::vector<const char*> enabled_device_extensions

Definition at line 68 of file main.cc.

◆ enabled_instance_extensions

std::vector<const char*> enabled_instance_extensions

Definition at line 62 of file main.cc.

◆ enabled_layer_names

std::vector<const char*> enabled_layer_names

Definition at line 63 of file main.cc.

◆ engine

FlutterEngine engine

Definition at line 84 of file main.cc.

Referenced by FlutterViewController::attached, create_node(), create_regular(), flutter::HostWindow::CreateDialogWindow(), flutter::testing::CreateMockFlutterEngine(), flutter::HostWindow::CreateRegularWindow(), FlutterRenderer::createRendererConfig, CreateViewController(), DispatchJSONPlatformMessage(), ensure_pointer_added(), ensure_touch_added(), flutter::testing::expectSoftwareRenderingOutputMatches(), fl_accessible_node_new(), fl_accessible_text_field_new(), fl_binary_messenger_new(), fl_binary_messenger_response_handle_impl_dispose(), fl_display_monitor_new(), fl_engine_for_id(), fl_key_embedder_responder_handle_event(), fl_key_embedder_responder_handle_event_impl(), fl_key_embedder_responder_new(), fl_keyboard_manager_new(), fl_pointer_manager_handle_button_press(), fl_pointer_manager_handle_button_release(), fl_pointer_manager_handle_enter(), fl_pointer_manager_handle_leave(), fl_pointer_manager_handle_motion(), fl_pointer_manager_new(), fl_scrolling_manager_handle_rotation_begin(), fl_scrolling_manager_handle_rotation_end(), fl_scrolling_manager_handle_rotation_update(), fl_scrolling_manager_handle_scroll_event(), fl_scrolling_manager_handle_zoom_begin(), fl_scrolling_manager_handle_zoom_end(), fl_scrolling_manager_handle_zoom_update(), fl_scrolling_manager_new(), fl_settings_handler_new(), fl_task_runner_new(), fl_task_runner_process_expired_tasks_locked(), fl_texture_registrar_new(), fl_touch_manager_handle_touch_event(), fl_touch_manager_new(), fl_view_accessible_new(), fl_view_new(), fl_view_new_for_engine(), fl_windowing_handler_new(), FlutterDesktopEngineCreate(), FlutterDesktopEngineCreateViewController(), FlutterDesktopEngineDestroy(), FlutterDesktopEngineGetMessenger(), FlutterDesktopEngineGetPluginRegistrar(), FlutterDesktopEngineGetTextureRegistrar(), FlutterDesktopEngineProcessExternalWindowMessage(), FlutterDesktopEngineReloadSystemFonts(), FlutterDesktopEngineRun(), FlutterDesktopEngineSetNextFrameCallback(), FlutterDesktopGetPluginRegistrar(), FlutterDesktopRunEngineEventLoopWithTimeout(), FlutterDesktopShutDownEngine(), FlutterDesktopViewControllerCreate(), FlutterEngineAddView(), FlutterEngineDeinitialize(), FlutterEngineDispatchSemanticsAction(), FlutterEngineMarkExternalTextureFrameAvailable(), FlutterEngineNotifyDisplayUpdate(), FlutterEngineNotifyLowMemoryWarning(), FlutterEngineOnVsync(), FlutterEnginePostCallbackOnAllNativeThreads(), FlutterEnginePostDartObject(), FlutterEnginePostRenderThreadTask(), FlutterEngineRegisterExternalTexture(), FlutterEngineReloadSystemFonts(), FlutterEngineRemoveView(), FlutterEngineRunInitialized(), FlutterEngineRunTask(), FlutterEngineScheduleFrame(), FlutterEngineSendKeyEvent(), FlutterEngineSendPlatformMessage(), FlutterEngineSendPointerEvent(), FlutterEngineSendSemanticsAction(), FlutterEngineSendViewFocusEvent(), FlutterEngineSendWindowMetricsEvent(), FlutterEngineSetNextFrameCallback(), FlutterEngineShutdown(), FlutterEngineUnregisterExternalTexture(), FlutterEngineUpdateAccessibilityFeatures(), FlutterEngineUpdateLocales(), FlutterEngineUpdateSemanticsEnabled(), FlutterPlatformMessageCreateResponseHandle(), FlutterPlatformMessageReleaseResponseHandle(), flutter::testing::UniqueEngineTraits::Free(), G_DECLARE_FINAL_TYPE(), G_DECLARE_FINAL_TYPE(), flutter_runner::Engine::GetEngineReturnCode(), HandleForEngine(), FlutterPlatformPlugin::handleMethodCall:result:, flutter::HostWindow::HostWindow(), InternalFlutter_Window_Destroy(), InternalFlutter_Window_GetHandle(), InternalFlutter_WindowController_CreateRegularWindow(), InternalFlutterWindows_WindowManager_CreateDialogWindow(), InternalFlutterWindows_WindowManager_CreateRegularWindow(), InternalFlutterWindows_WindowManager_GetTopLevelWindowHandle(), InternalFlutterWindows_WindowManager_HasTopLevelWindows(), InternalFlutterWindows_WindowManager_Initialize(), InternalSendPlatformMessage(), mark_texture_frame_available(), flutter::FlutterWindowsTextureRegistrar::MarkTextureFrameAvailable(), flutter::testing::MockEmbedderApiForKeyboard(), notify_display_update(), flutter::testing::ShellTest::NotifyIdle(), OnPlatformMessage(), flutter::testing::EngineDeleter::operator()(), flutter::testing::ShellTest::PumpOneFrame(), register_texture(), flutter::testing::WindowsConfigBuilder::Run(), flutter::Engine::Run(), RunFlutter(), RunFlutterEngine(), flutter::testing::WindowsConfigBuilder::RunHeadless(), send_on_channel(), send_on_channel_finish(), send_response(), set_message_handler_on_channel(), FlutterDesktopMessenger::SetEngine(), flutter::testing::ShellTest::SetViewportMetrics(), synthesize_simple_event(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), flutter::TEST(), flutter::TEST(), flutter::TEST(), flutter::TEST(), flutter::TEST(), flutter::TEST(), flutter::TEST(), flutter::TEST(), flutter::TEST(), flutter::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), flutter::testing::TEST(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::TEST_F(), flutter::TEST_F(), flutter::TEST_F(), flutter::TEST_F(), flutter::TEST_F(), flutter::TEST_F(), flutter::TEST_F(), flutter::TEST_F(), flutter::TEST_F(), flutter::TEST_F(), flutter::TEST_F(), flutter::TEST_F(), flutter::TEST_F(), flutter::TEST_F(), flutter::TEST_F(), flutter::TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_P(), flutter::testing::TEST_P(), flutter::testing::TEST_P(), flutter::testing::TEST_P(), flutter::testing::TEST_P(), flutter::testing::TEST_P(), ToEmbedderEngine(), unregister_texture(), flutter::FlutterWindowsTextureRegistrar::UnregisterTexture(), update_settings(), and flutter_runner::ComponentV2::WriteProfileToTrace().

◆ [struct]

struct { ... } g_debug

◆ g_pixelRatio

double g_pixelRatio = 1.0
static

Definition at line 43 of file main.cc.

Referenced by GLFWcursorPositionCallbackAtPhase(), GLFWframebufferSizeCallback(), and main().

◆ [struct]

struct { ... } g_state

◆ image_ready_fence

VkFence image_ready_fence

Definition at line 76 of file main.cc.

◆ instance

VkInstance instance

Definition at line 64 of file main.cc.

Referenced by vulkan::VulkanProcTable::AcquireProc(), impeller::interop::ContextVKGetInstanceProcAddress(), ui::AXFragmentRootPlatformNodeWin::Create(), impeller::interop::testing::PlaygroundTest::CreateContext(), vulkan::CreateSkiaGetProc(), vulkan::VulkanNativeSurfaceAndroid::CreateSurfaceHandle(), impeller::DebugReportVK::DebugReportVK(), fml::LogState::Default(), flutter::EmbedderSurfaceVulkanImpeller::EmbedderSurfaceVulkanImpeller(), FlutterGetInstanceProcAddressCallback(), fml::MessageLoopTaskQueues::GetInstance(), flutter::PluginRegistrarManager::GetInstance(), ui::AXTreeManagerMap::GetInstance(), ui::AXFragmentRootMapWin::GetInstance(), ui::UiaRegistrarWin::GetInstance(), flutter::TaskRunnerWindow::GetSharedInstance(), InferVulkanPlatformViewCreationCallback(), fml::ChronoTimestampProvider::Instance(), flutter::DartTimestampProvider::Instance(), flutter::testing::EmbedderTestContextVulkan::InstanceProcAddr(), IsVulkanRendererConfigValid(), flutter::WindowsProcTable::LoadCursor(), flutter::FlutterSkiaVulkanMemoryAllocator::Make(), impeller::PickPhysicalDevice(), fml::CFRef< T >::Release(), fml::CFRefTraits< CFRefTestState * >::Release(), fml::CFRefTraits< CGImageRef >::Release(), fml::CFRefTraits< T >::Release(), fml::CFRef< T >::Reset(), fml::CFRefTraits< CFRefTestState * >::Retain(), fml::CFRefTraits< CGImageRef >::Retain(), fml::CFRefTraits< T >::Retain(), fml::CFRef< T >::Retain(), impeller::interop::ContextVK::Settings::Settings(), flutter::testing::SignalHandler::SignalHandler(), fml::testing::TEST(), flutter::testing::TEST_F(), and vulkan::VulkanApplication::VulkanApplication().

◆ kImplicitViewId

constexpr FlutterViewId kImplicitViewId = 0
staticconstexpr

Definition at line 50 of file main.cc.

Referenced by GLFWcursorPositionCallbackAtPhase(), and GLFWframebufferSizeCallback().

◆ kInitialWindowHeight

const size_t kInitialWindowHeight = 600
static

Definition at line 45 of file main.cc.

Referenced by main().

◆ kInitialWindowWidth

const size_t kInitialWindowWidth = 800
static

Definition at line 44 of file main.cc.

Referenced by main().

◆ kPreferredPresentMode

const VkPresentModeKHR kPreferredPresentMode = VK_PRESENT_MODE_FIFO_KHR
static

Definition at line 49 of file main.cc.

Referenced by InitializeSwapchain().

◆ last_image_index

uint32_t last_image_index

Definition at line 82 of file main.cc.

◆ physical_device

◆ present_transition_buffers

std::vector<VkCommandBuffer> present_transition_buffers

Definition at line 74 of file main.cc.

◆ present_transition_semaphore

VkSemaphore present_transition_semaphore

Definition at line 77 of file main.cc.

◆ queue

◆ queue_family_index

◆ report_callback

VkDebugReportCallbackEXT report_callback = VK_NULL_HANDLE

Definition at line 39 of file main.cc.

◆ report_supported

bool report_supported = false

Definition at line 38 of file main.cc.

◆ resize_pending

bool resize_pending = false

Definition at line 86 of file main.cc.

◆ surface

VkSurfaceKHR surface

Definition at line 65 of file main.cc.

Referenced by flutter::GPUSurfaceGLSkia::AcquireFrame(), flutter::GPUSurfaceVulkan::AcquireFrame(), impeller::AHBSwapchainImplVK::AcquireNextDrawable(), impeller::SurfaceContextVK::AcquireNextSurface(), impeller::interop::SwapchainVK::AcquireNextSurface(), vulkan::VulkanSwapchain::AcquireSurface(), flutter_runner::VulkanSurfacePool::AcquireSurface(), FlutterTextInputPlugin()::addToInputParentViewIfNeeded:, flutter_runner::VulkanSurfacePool::AgeAndCollectOldBuffers(), flutter::AndroidEGLSurface::AndroidEGLSurface(), flutter::testing::BM_DrawArc(), flutter::testing::BM_DrawCircle(), flutter::testing::BM_DrawDRRect(), flutter::testing::BM_DrawImage(), flutter::testing::BM_DrawImageNine(), flutter::testing::BM_DrawImageRect(), flutter::testing::BM_DrawLine(), flutter::testing::BM_DrawOval(), flutter::testing::BM_DrawPath(), flutter::testing::BM_DrawPoints(), flutter::testing::BM_DrawRect(), flutter::testing::BM_DrawRRect(), flutter::testing::BM_DrawShadow(), flutter::testing::BM_DrawTextBlob(), flutter::testing::BM_DrawVertices(), flutter::testing::BM_SaveLayer(), impeller::BulkUpdateAtlasBitmap(), vulkan::VulkanDevice::ChoosePresentMode(), vulkan::VulkanDevice::ChooseSurfaceFormat(), flutter::ConvertToRasterUsingResourceContext(), flutter::testing::EmbedderTestBackingStoreProducerMetal::Create(), flutter::testing::EmbedderTestBackingStoreProducerVulkan::Create(), impeller::SwapchainVK::Create(), impeller::KHRSwapchainImplVK::Create(), flutter::FlutterCompositor::CreateBackingStore(), flutter::AndroidSurfaceGLImpeller::CreateGPUSurface(), flutter::AndroidSurfaceSoftware::CreateGPUSurface(), flutter::OverlayLayerPool::CreateLayer(), flutter::AndroidContextGLSkia::CreateOffscreenSurface(), flutter::AndroidContextGLSkia::CreateOnscreenSurface(), flutter::AndroidContextGLSkia::CreatePbufferSurface(), impeller::egl::Display::CreatePixelBufferSurface(), flutter::TesterPlatformView::CreateRenderingSurface(), flutter::testing::CreateRenderSurface(), impeller::testing::CreateSurface(), flutter_runner::VulkanSurfacePool::CreateSurface(), vulkan::VulkanNativeSurfaceAndroid::CreateSurfaceHandle(), impeller::egl::Display::CreateWindowSurface(), flutter::egl::Manager::CreateWindowSurface(), flutter::testing::DlSurfaceInstanceBase::DlSurfaceInstanceBase(), flutter::testing::expectSoftwareRenderingOutputMatches(), flutter::testing::DlSurfaceInstance::FlushSubmitCpuSync(), flutter::testing::DisplayListNopTest::get_output(), flutter::SurfacePool::GetLayer(), flutter::testing::TestGLOnscreenOnlySurface::GetOnscreenSurface(), flutter::testing::TestGLOnscreenOnlySurface::GetRasterSurfaceSnapshot(), flutter::testing::RenderEnvironment::getResult(), vulkan::VulkanDevice::GetSurfaceCapabilities(), impeller::interop::ImpellerSurfaceDrawDisplayList(), impeller::interop::ImpellerSurfacePresent(), impeller::interop::ImpellerSurfaceRelease(), impeller::interop::ImpellerSurfaceRetain(), main(), impeller::egl::Context::MakeCurrent(), flutter::testing::DlMetalSurfaceProvider::MakeOffscreenSurface(), flutter::testing::DlSoftwareSurfaceProvider::MakeOffscreenSurface(), flutter::SnapshotControllerImpeller::MakeRenderContextCurrent(), MakeSkSurfaceFromBackingStore(), MakeSkSurfaceFromBackingStore(), MakeSkSurfaceFromBackingStore(), MakeSkSurfaceFromBackingStore(), MakeSkSurfaceFromBackingStore(), MakeSkSurfaceFromBackingStore(), MakeSkSurfaceFromBackingStore(), flutter::testing::MakeTestImage(), flutter::testing::MakeTestImage(), flutter::testing::MockTexture::MakeTestTexture(), flutter::PlatformViewAndroid::NotifyChanged(), flutter::PlatformView::NotifyCreated(), flutter::PlatformViewAndroid::NotifyCreated(), flutter::PlatformViewAndroid::NotifyDestroyed(), flutter::PlatformViewAndroid::NotifySurfaceWindowChanged(), impeller::Playground::OpenPlaygroundHere(), impeller::interop::testing::PlaygroundTest::OpenPlaygroundHere(), flutter::OverlayLayer::OverlayLayer(), flutter::OverlayLayer::OverlayLayer(), impeller::PlaygroundImplVK::PlaygroundImplVK(), flutter::FlutterCompositor::Present(), flutter::CompositorOpenGL::Present(), flutter_runner::SoftwareSurfaceProducer::ProduceSurface(), flutter::RasterCache::Rasterize(), flutter::ViewModifier::SetSurface(), flutter::Rasterizer::Setup(), impeller::SurfaceContextVK::SetWindowSurface(), flutter_runner::VulkanSurfacePool::ShrinkToFit(), flutter::testing::SkRenderResult::SkRenderResult(), vulkan::VulkanSwapchain::Submit(), flutter_runner::ExternalViewEmbedder::SubmitFlutterView(), flutter_runner::SoftwareSurfaceProducer::SubmitSurfaces(), flutter_runner::VulkanSurfaceProducer::SubmitSurfaces(), impeller::interop::Surface::Surface(), flutter::egl::Surface::Surface(), flutter::SurfaceFrame::SurfaceFrame(), impeller::interop::SurfaceGLES::SurfaceGLES(), impeller::interop::SurfaceMTL::SurfaceMTL(), flutter::testing::SurfacePixelDataMatchesBytes(), impeller::interop::SurfaceVK::SurfaceVK(), flutter::AndroidEGLSurfaceDamage::SwapBuffersWithDamage(), impeller::interop::SwapchainVK::SwapchainVK(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::TEST(), flutter::TEST(), flutter::TEST(), flutter::TEST(), flutter::TEST(), flutter::TEST(), flutter::TEST(), flutter::TEST(), flutter::TEST(), flutter::TEST(), flutter::TEST(), flutter::TEST(), flutter::TEST(), flutter::TEST(), flutter::TEST(), flutter::TEST(), flutter::TEST(), impeller::testing::TEST(), impeller::testing::TEST(), impeller::testing::TEST(), impeller::testing::TEST(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_P(), impeller::interop::testing::TEST_P(), impeller::interop::testing::TEST_P(), impeller::interop::testing::TEST_P(), impeller::interop::testing::TEST_P(), impeller::interop::testing::TEST_P(), impeller::interop::testing::TEST_P(), impeller::interop::testing::TEST_P(), impeller::interop::testing::TEST_P(), impeller::interop::testing::TEST_P(), impeller::interop::testing::TEST_P(), impeller::interop::testing::TEST_P(), impeller::interop::testing::TEST_P(), impeller::interop::testing::TEST_P(), impeller::interop::testing::TEST_P(), impeller::testing::TEST_P(), impeller::UpdateAtlasBitmap(), UpdateContentSubLayers(), vulkan::VulkanSurface::VulkanSurface(), vulkan::VulkanSwapchain::VulkanSwapchain(), and flutter::egl::WindowSurface::WindowSurface().

◆ surface_format

VkSurfaceFormatKHR surface_format

Definition at line 79 of file main.cc.

◆ swapchain

◆ swapchain_command_pool

VkCommandPool swapchain_command_pool

Definition at line 73 of file main.cc.

◆ swapchain_images

std::vector<VkImage> swapchain_images

Definition at line 81 of file main.cc.

◆ utils_messenger_callback

VkDebugUtilsMessengerEXT utils_messenger_callback = VK_NULL_HANDLE

Definition at line 40 of file main.cc.

◆ utils_supported

bool utils_supported = false

Definition at line 37 of file main.cc.

◆ window

GLFWwindow* window

Definition at line 60 of file main.cc.

Referenced by create_regular(), flutter::WindowManager::CreateDialogWindow(), flutter::AndroidContextGLSkia::CreateOnscreenSurface(), flutter::AndroidContextGLImpeller::CreateOnscreenSurface(), flutter::WindowManager::CreateRegularWindow(), CreateShareWindowForWindow(), flutter::FlutterWindowsEngine::CreateView(), impeller::egl::Display::CreateWindowSurface(), cursor_changed_cb(), EngineOnFlutterPlatformMessage(), fl_compositor_opengl_render(), fl_compositor_render(), fl_compositor_software_render(), fl_window_monitor_new(), fl_window_state_monitor_new(), fl_windowing_handler_create_window(), FlutterDesktopCreateWindow(), FlutterDesktopWindowSetTitle(), flutter::HostWindow::FocusRootViewOf(), G_DEFINE_TYPE_WITH_PRIVATE(), gdk_window_get_state(), impeller::PlaygroundImpl::GetContentScale(), flutter::HostWindow::GetOwnedWindows(), GetWindowController(), GLFWAssignEventCallbacks(), GLFWCharCallback(), GLFWClearCanvas(), GLFWClearEventCallbacks(), GLFWCursorEnterCallback(), GLFWcursorPositionCallback(), GLFWCursorPositionCallback(), GLFWcursorPositionCallbackAtPhase(), GLFWFramebufferSizeCallback(), GLFWKeyCallback(), GLFWKeyCallback(), GLFWKeyCallback(), GLFWmouseButtonCallback(), GLFWMouseButtonCallback(), GLFWScrollCallback(), GLFWWindowRefreshCallback(), GLFWwindowSizeCallback(), gtk_im_context_set_client_window(), gtk_window_deiconify(), gtk_window_iconify(), gtk_window_is_maximized(), gtk_window_maximize(), gtk_window_new(), gtk_window_resize(), gtk_window_set_default_size(), gtk_window_set_geometry_hints(), gtk_window_set_title(), gtk_window_unmaximize(), handle_geometry_changed(), InternalFlutter_Window_Activate(), InternalFlutter_Window_Destroy(), InternalFlutter_Window_GetContentSize(), InternalFlutter_Window_GetTitle(), InternalFlutter_Window_IsActivated(), InternalFlutter_Window_IsFullScreen(), InternalFlutter_Window_IsMaximized(), InternalFlutter_Window_IsMinimized(), InternalFlutter_Window_Minimize(), InternalFlutter_Window_SetConstraints(), InternalFlutter_Window_SetContentSize(), InternalFlutter_Window_SetFullScreen(), InternalFlutter_Window_SetMaximized(), InternalFlutter_Window_SetTitle(), InternalFlutter_Window_Unminimize(), InternalFlutterWindows_WindowManager_GetFullscreen(), InternalFlutterWindows_WindowManager_SetFullscreen(), InternalFlutterWindows_WindowManager_SetWindowConstraints(), InternalFlutterWindows_WindowManager_SetWindowSize(), main(), main(), flutter::NativeActivity::NativeActivity(), flutter::WindowManager::OnEngineShutdown(), flutter::GTestActivity::OnNativeWindowCreated(), impeller::Playground::OpenPlaygroundHere(), impeller::PlaygroundImplGLES::PlaygroundImplGLES(), impeller::PlaygroundImplMTL::PlaygroundImplMTL(), impeller::PlaygroundImplVK::PlaygroundImplVK(), impeller::PlaygroundKeyCallback(), quit_application(), RunFlutter(), SendPointerEventWithData(), SetEventLocationFromCursorPosition(), SetEventPhaseFromCursorButtonState(), SetHoverCallbacksEnabled(), flutter::AndroidSurfaceDynamicImpeller::SetNativeWindow(), flutter::AndroidSurfaceGLImpeller::SetNativeWindow(), flutter::AndroidSurfaceGLSkia::SetNativeWindow(), flutter::AndroidSurfaceSoftware::SetNativeWindow(), flutter::AndroidSurfaceVKImpeller::SetNativeWindow(), SetUpCommonEngineState(), flutter::FlutterWindow::SetView(), impeller::android::SurfaceControl::SurfaceControl(), flutter::SurfaceCreated(), flutter::SurfaceWindowChanged(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::android::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), TEST(), TEST(), flutter::TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), TEST_F(), TEST_F(), TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), impeller::interop::testing::TEST_P(), impeller::interop::testing::TEST_P(), impeller::interop::testing::TEST_P(), impeller::interop::testing::TEST_P(), impeller::interop::testing::TEST_P(), impeller::interop::testing::TEST_P(), impeller::interop::testing::TEST_P(), impeller::interop::testing::TEST_P(), impeller::interop::testing::TEST_P(), window_data_new(), and flutter::HostWindow::WndProc().