Flutter Engine
The Flutter Engine
VulkanWindowContext.cpp
Go to the documentation of this file.
1/*
2 * Copyright 2023 Google LLC
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
9
25
26#ifdef VK_USE_PLATFORM_WIN32_KHR
27// windows wants to define this as CreateSemaphoreA or CreateSemaphoreW
28#undef CreateSemaphore
29#endif
30
31#define GET_PROC(F) f ## F = \
32 (PFN_vk ## F) backendContext.fGetProc("vk" #F, fInstance, VK_NULL_HANDLE)
33#define GET_DEV_PROC(F) f ## F = \
34 (PFN_vk ## F) backendContext.fGetProc("vk" #F, VK_NULL_HANDLE, fDevice)
35
36namespace skwindow::internal {
37
38VulkanWindowContext::VulkanWindowContext(const DisplayParams& params,
39 CreateVkSurfaceFn createVkSurface,
40 CanPresentFn canPresent,
42 : WindowContext(params)
43 , fCreateVkSurfaceFn(std::move(createVkSurface))
44 , fCanPresentFn(std::move(canPresent))
45 , fSurface(VK_NULL_HANDLE)
46 , fSwapchain(VK_NULL_HANDLE)
47 , fImages(nullptr)
48 , fImageLayouts(nullptr)
49 , fSurfaces(nullptr)
50 , fBackbuffers(nullptr) {
51 fGetInstanceProcAddr = instProc;
52 this->initializeContext();
53}
54
55void VulkanWindowContext::initializeContext() {
57 // any config code here (particularly for msaa)?
58
59 PFN_vkGetInstanceProcAddr getInstanceProc = fGetInstanceProcAddr;
60 skgpu::VulkanBackendContext backendContext;
63 if (!sk_gpu_test::CreateVkBackendContext(getInstanceProc, &backendContext, &extensions,
64 &features, &fDebugCallback, &fPresentQueueIndex,
65 fCanPresentFn,
66 fDisplayParams.fCreateProtectedNativeBackend)) {
67 sk_gpu_test::FreeVulkanFeaturesStructs(&features);
68 return;
69 }
70
71 if (!extensions.hasExtension(VK_KHR_SURFACE_EXTENSION_NAME, 25) ||
73 sk_gpu_test::FreeVulkanFeaturesStructs(&features);
74 return;
75 }
76
77 fInstance = backendContext.fInstance;
78 fPhysicalDevice = backendContext.fPhysicalDevice;
79 fDevice = backendContext.fDevice;
80 fGraphicsQueueIndex = backendContext.fGraphicsQueueIndex;
81 fGraphicsQueue = backendContext.fQueue;
82
83 PFN_vkGetPhysicalDeviceProperties localGetPhysicalDeviceProperties =
84 reinterpret_cast<PFN_vkGetPhysicalDeviceProperties>(
85 backendContext.fGetProc("vkGetPhysicalDeviceProperties",
86 backendContext.fInstance,
88 if (!localGetPhysicalDeviceProperties) {
89 sk_gpu_test::FreeVulkanFeaturesStructs(&features);
90 return;
91 }
92 VkPhysicalDeviceProperties physDeviceProperties;
93 localGetPhysicalDeviceProperties(backendContext.fPhysicalDevice, &physDeviceProperties);
94 uint32_t physDevVersion = physDeviceProperties.apiVersion;
95
96 fInterface.reset(new skgpu::VulkanInterface(backendContext.fGetProc,
97 fInstance,
98 fDevice,
99 backendContext.fMaxAPIVersion,
100 physDevVersion,
101 &extensions));
102
103 GET_PROC(DestroyInstance);
104 if (fDebugCallback != VK_NULL_HANDLE) {
105 GET_PROC(DestroyDebugReportCallbackEXT);
106 }
107 GET_PROC(DestroySurfaceKHR);
108 GET_PROC(GetPhysicalDeviceSurfaceSupportKHR);
109 GET_PROC(GetPhysicalDeviceSurfaceCapabilitiesKHR);
110 GET_PROC(GetPhysicalDeviceSurfaceFormatsKHR);
111 GET_PROC(GetPhysicalDeviceSurfacePresentModesKHR);
112 GET_DEV_PROC(DeviceWaitIdle);
113 GET_DEV_PROC(QueueWaitIdle);
114 GET_DEV_PROC(DestroyDevice);
115 GET_DEV_PROC(CreateSwapchainKHR);
116 GET_DEV_PROC(DestroySwapchainKHR);
117 GET_DEV_PROC(GetSwapchainImagesKHR);
118 GET_DEV_PROC(AcquireNextImageKHR);
119 GET_DEV_PROC(QueuePresentKHR);
120 GET_DEV_PROC(GetDeviceQueue);
121
122 fContext = GrDirectContexts::MakeVulkan(backendContext, fDisplayParams.fGrContextOptions);
123
124 fSurface = fCreateVkSurfaceFn(fInstance);
125 if (VK_NULL_HANDLE == fSurface) {
126 this->destroyContext();
127 sk_gpu_test::FreeVulkanFeaturesStructs(&features);
128 return;
129 }
130
131 VkBool32 supported;
132 VkResult res = fGetPhysicalDeviceSurfaceSupportKHR(fPhysicalDevice, fPresentQueueIndex,
133 fSurface, &supported);
134 if (VK_SUCCESS != res) {
135 this->destroyContext();
136 sk_gpu_test::FreeVulkanFeaturesStructs(&features);
137 return;
138 }
139
140 if (!this->createSwapchain(-1, -1, fDisplayParams)) {
141 this->destroyContext();
142 sk_gpu_test::FreeVulkanFeaturesStructs(&features);
143 return;
144 }
145
146 // create presentQueue
147 fGetDeviceQueue(fDevice, fPresentQueueIndex, 0, &fPresentQueue);
148 sk_gpu_test::FreeVulkanFeaturesStructs(&features);
149}
150
151bool VulkanWindowContext::createSwapchain(int width, int height,
152 const DisplayParams& params) {
153 // check for capabilities
155 VkResult res = fGetPhysicalDeviceSurfaceCapabilitiesKHR(fPhysicalDevice, fSurface, &caps);
156 if (VK_SUCCESS != res) {
157 return false;
158 }
159
160 uint32_t surfaceFormatCount;
161 res = fGetPhysicalDeviceSurfaceFormatsKHR(fPhysicalDevice, fSurface, &surfaceFormatCount,
162 nullptr);
163 if (VK_SUCCESS != res) {
164 return false;
165 }
166
167 SkAutoMalloc surfaceFormatAlloc(surfaceFormatCount * sizeof(VkSurfaceFormatKHR));
168 VkSurfaceFormatKHR* surfaceFormats = (VkSurfaceFormatKHR*)surfaceFormatAlloc.get();
169 res = fGetPhysicalDeviceSurfaceFormatsKHR(fPhysicalDevice, fSurface, &surfaceFormatCount,
170 surfaceFormats);
171 if (VK_SUCCESS != res) {
172 return false;
173 }
174
175 uint32_t presentModeCount;
176 res = fGetPhysicalDeviceSurfacePresentModesKHR(fPhysicalDevice, fSurface, &presentModeCount,
177 nullptr);
178 if (VK_SUCCESS != res) {
179 return false;
180 }
181
182 SkAutoMalloc presentModeAlloc(presentModeCount * sizeof(VkPresentModeKHR));
183 VkPresentModeKHR* presentModes = (VkPresentModeKHR*)presentModeAlloc.get();
184 res = fGetPhysicalDeviceSurfacePresentModesKHR(fPhysicalDevice, fSurface, &presentModeCount,
185 presentModes);
186 if (VK_SUCCESS != res) {
187 return false;
188 }
189
190 VkExtent2D extent = caps.currentExtent;
191 // use the hints
192 if (extent.width == (uint32_t)-1) {
193 extent.width = width;
194 extent.height = height;
195 }
196
197 // clamp width; to protect us from broken hints
198 if (extent.width < caps.minImageExtent.width) {
199 extent.width = caps.minImageExtent.width;
200 } else if (extent.width > caps.maxImageExtent.width) {
201 extent.width = caps.maxImageExtent.width;
202 }
203 // clamp height
204 if (extent.height < caps.minImageExtent.height) {
205 extent.height = caps.minImageExtent.height;
206 } else if (extent.height > caps.maxImageExtent.height) {
207 extent.height = caps.maxImageExtent.height;
208 }
209
210 fWidth = (int)extent.width;
211 fHeight = (int)extent.height;
212
213 uint32_t imageCount = caps.minImageCount + 2;
214 if (caps.maxImageCount > 0 && imageCount > caps.maxImageCount) {
215 // Application must settle for fewer images than desired:
216 imageCount = caps.maxImageCount;
217 }
218
222 SkASSERT((caps.supportedUsageFlags & usageFlags) == usageFlags);
225 }
227 usageFlags |= VK_IMAGE_USAGE_SAMPLED_BIT;
228 }
232 VkCompositeAlphaFlagBitsKHR composite_alpha =
236
237 // Pick our surface format.
238 VkFormat surfaceFormat = VK_FORMAT_UNDEFINED;
240 for (uint32_t i = 0; i < surfaceFormatCount; ++i) {
241 VkFormat localFormat = surfaceFormats[i].format;
242 if (GrVkFormatIsSupported(localFormat)) {
243 surfaceFormat = localFormat;
244 colorSpace = surfaceFormats[i].colorSpace;
245 break;
246 }
247 }
248 fDisplayParams = params;
249 fSampleCount = std::max(1, params.fMSAASampleCount);
250 fStencilBits = 8;
251
252 if (VK_FORMAT_UNDEFINED == surfaceFormat) {
253 return false;
254 }
255
257 switch (surfaceFormat) {
258 case VK_FORMAT_R8G8B8A8_UNORM: // fall through
261 break;
262 case VK_FORMAT_B8G8R8A8_UNORM: // fall through
264 break;
265 default:
266 return false;
267 }
268
269 // If mailbox mode is available, use it, as it is the lowest-latency non-
270 // tearing mode. If not, fall back to FIFO which is always available.
272 bool hasImmediate = false;
273 for (uint32_t i = 0; i < presentModeCount; ++i) {
274 // use mailbox
275 if (VK_PRESENT_MODE_MAILBOX_KHR == presentModes[i]) {
277 }
278 if (VK_PRESENT_MODE_IMMEDIATE_KHR == presentModes[i]) {
279 hasImmediate = true;
280 }
281 }
282 if (params.fDisableVsync && hasImmediate) {
284 }
285
286 VkSwapchainCreateInfoKHR swapchainCreateInfo;
287 memset(&swapchainCreateInfo, 0, sizeof(VkSwapchainCreateInfoKHR));
289 swapchainCreateInfo.flags = fDisplayParams.fCreateProtectedNativeBackend
291 : 0;
292 swapchainCreateInfo.surface = fSurface;
293 swapchainCreateInfo.minImageCount = imageCount;
294 swapchainCreateInfo.imageFormat = surfaceFormat;
295 swapchainCreateInfo.imageColorSpace = colorSpace;
296 swapchainCreateInfo.imageExtent = extent;
297 swapchainCreateInfo.imageArrayLayers = 1;
298 swapchainCreateInfo.imageUsage = usageFlags;
299
300 uint32_t queueFamilies[] = { fGraphicsQueueIndex, fPresentQueueIndex };
301 if (fGraphicsQueueIndex != fPresentQueueIndex) {
302 swapchainCreateInfo.imageSharingMode = VK_SHARING_MODE_CONCURRENT;
303 swapchainCreateInfo.queueFamilyIndexCount = 2;
304 swapchainCreateInfo.pQueueFamilyIndices = queueFamilies;
305 } else {
306 swapchainCreateInfo.imageSharingMode = VK_SHARING_MODE_EXCLUSIVE;
307 swapchainCreateInfo.queueFamilyIndexCount = 0;
308 swapchainCreateInfo.pQueueFamilyIndices = nullptr;
309 }
310
312 swapchainCreateInfo.compositeAlpha = composite_alpha;
313 swapchainCreateInfo.presentMode = mode;
314 swapchainCreateInfo.clipped = true;
315 swapchainCreateInfo.oldSwapchain = fSwapchain;
316
317 res = fCreateSwapchainKHR(fDevice, &swapchainCreateInfo, nullptr, &fSwapchain);
318 if (VK_SUCCESS != res) {
319 return false;
320 }
321
322 // destroy the old swapchain
323 if (swapchainCreateInfo.oldSwapchain != VK_NULL_HANDLE) {
324 fDeviceWaitIdle(fDevice);
325
326 this->destroyBuffers();
327
328 fDestroySwapchainKHR(fDevice, swapchainCreateInfo.oldSwapchain, nullptr);
329 }
330
331 if (!this->createBuffers(swapchainCreateInfo.imageFormat, usageFlags, colorType,
332 swapchainCreateInfo.imageSharingMode)) {
333 fDeviceWaitIdle(fDevice);
334
335 this->destroyBuffers();
336
337 fDestroySwapchainKHR(fDevice, swapchainCreateInfo.oldSwapchain, nullptr);
338 }
339
340 return true;
341}
342
343bool VulkanWindowContext::createBuffers(VkFormat format,
344 VkImageUsageFlags usageFlags,
346 VkSharingMode sharingMode) {
347 fGetSwapchainImagesKHR(fDevice, fSwapchain, &fImageCount, nullptr);
348 SkASSERT(fImageCount);
349 fImages = new VkImage[fImageCount];
350 fGetSwapchainImagesKHR(fDevice, fSwapchain, &fImageCount, fImages);
351
352 // set up initial image layouts and create surfaces
353 fImageLayouts = new VkImageLayout[fImageCount];
354 fSurfaces = new sk_sp<SkSurface>[fImageCount];
355 for (uint32_t i = 0; i < fImageCount; ++i) {
356 fImageLayouts[i] = VK_IMAGE_LAYOUT_UNDEFINED;
357
359 info.fImage = fImages[i];
360 info.fAlloc = skgpu::VulkanAlloc();
361 info.fImageLayout = VK_IMAGE_LAYOUT_UNDEFINED;
362 info.fImageTiling = VK_IMAGE_TILING_OPTIMAL;
363 info.fFormat = format;
364 info.fImageUsageFlags = usageFlags;
365 info.fLevelCount = 1;
366 info.fCurrentQueueFamily = fPresentQueueIndex;
367 info.fProtected = skgpu::Protected(fDisplayParams.fCreateProtectedNativeBackend);
368 info.fSharingMode = sharingMode;
369
370 if (usageFlags & VK_IMAGE_USAGE_SAMPLED_BIT) {
371 GrBackendTexture backendTexture = GrBackendTextures::MakeVk(fWidth, fHeight, info);
372 fSurfaces[i] = SkSurfaces::WrapBackendTexture(fContext.get(),
373 backendTexture,
375 fDisplayParams.fMSAASampleCount,
376 colorType,
377 fDisplayParams.fColorSpace,
378 &fDisplayParams.fSurfaceProps);
379 } else {
380 if (fDisplayParams.fMSAASampleCount > 1) {
381 return false;
382 }
383 info.fSampleCount = fSampleCount;
384 GrBackendRenderTarget backendRT = GrBackendRenderTargets::MakeVk(fWidth, fHeight, info);
386 backendRT,
388 colorType,
389 fDisplayParams.fColorSpace,
390 &fDisplayParams.fSurfaceProps);
391 }
392 if (!fSurfaces[i]) {
393 return false;
394 }
395 }
396
397 // set up the backbuffers
398 VkSemaphoreCreateInfo semaphoreInfo;
399 memset(&semaphoreInfo, 0, sizeof(VkSemaphoreCreateInfo));
401 semaphoreInfo.pNext = nullptr;
402 semaphoreInfo.flags = 0;
403
404 // we create one additional backbuffer structure here, because we want to
405 // give the command buffers they contain a chance to finish before we cycle back
406 fBackbuffers = new BackbufferInfo[fImageCount + 1];
407 for (uint32_t i = 0; i < fImageCount + 1; ++i) {
408 fBackbuffers[i].fImageIndex = -1;
410 CreateSemaphore(fDevice, &semaphoreInfo, nullptr,
411 &fBackbuffers[i].fRenderSemaphore));
413 }
414 fCurrentBackbufferIndex = fImageCount;
415 return true;
416}
417
418void VulkanWindowContext::destroyBuffers() {
419
420 if (fBackbuffers) {
421 for (uint32_t i = 0; i < fImageCount + 1; ++i) {
422 fBackbuffers[i].fImageIndex = -1;
423 GR_VK_CALL(fInterface,
424 DestroySemaphore(fDevice,
425 fBackbuffers[i].fRenderSemaphore,
426 nullptr));
427 }
428 }
429
430 delete[] fBackbuffers;
431 fBackbuffers = nullptr;
432
433 // Does this actually free the surfaces?
434 delete[] fSurfaces;
435 fSurfaces = nullptr;
436 delete[] fImageLayouts;
437 fImageLayouts = nullptr;
438 delete[] fImages;
439 fImages = nullptr;
440}
441
442VulkanWindowContext::~VulkanWindowContext() {
443 this->destroyContext();
444}
445
446void VulkanWindowContext::destroyContext() {
447 if (this->isValid()) {
448 fQueueWaitIdle(fPresentQueue);
449 fDeviceWaitIdle(fDevice);
450
451 this->destroyBuffers();
452
453 if (VK_NULL_HANDLE != fSwapchain) {
454 fDestroySwapchainKHR(fDevice, fSwapchain, nullptr);
455 fSwapchain = VK_NULL_HANDLE;
456 }
457
458 if (VK_NULL_HANDLE != fSurface) {
459 fDestroySurfaceKHR(fInstance, fSurface, nullptr);
460 fSurface = VK_NULL_HANDLE;
461 }
462 }
463
464 SkASSERT(fContext->unique());
465 fContext.reset();
466 fInterface.reset();
467
468 if (VK_NULL_HANDLE != fDevice) {
469 fDestroyDevice(fDevice, nullptr);
470 fDevice = VK_NULL_HANDLE;
471 }
472
473#ifdef SK_ENABLE_VK_LAYERS
474 if (fDebugCallback != VK_NULL_HANDLE) {
475 fDestroyDebugReportCallbackEXT(fInstance, fDebugCallback, nullptr);
476 }
477#endif
478
479 fPhysicalDevice = VK_NULL_HANDLE;
480
481 if (VK_NULL_HANDLE != fInstance) {
482 fDestroyInstance(fInstance, nullptr);
483 fInstance = VK_NULL_HANDLE;
484 }
485}
486
487VulkanWindowContext::BackbufferInfo* VulkanWindowContext::getAvailableBackbuffer() {
488 SkASSERT(fBackbuffers);
489
490 ++fCurrentBackbufferIndex;
491 if (fCurrentBackbufferIndex > fImageCount) {
492 fCurrentBackbufferIndex = 0;
493 }
494
495 BackbufferInfo* backbuffer = fBackbuffers + fCurrentBackbufferIndex;
496 return backbuffer;
497}
498
499sk_sp<SkSurface> VulkanWindowContext::getBackbufferSurface() {
500 BackbufferInfo* backbuffer = this->getAvailableBackbuffer();
501 SkASSERT(backbuffer);
502
503 // semaphores should be in unsignaled state
504 VkSemaphoreCreateInfo semaphoreInfo;
505 memset(&semaphoreInfo, 0, sizeof(VkSemaphoreCreateInfo));
507 semaphoreInfo.pNext = nullptr;
508 semaphoreInfo.flags = 0;
509 VkSemaphore semaphore;
510 SkDEBUGCODE(VkResult result = )GR_VK_CALL(fInterface, CreateSemaphore(fDevice, &semaphoreInfo,
511 nullptr, &semaphore));
513
514 // acquire the image
515 VkResult res = fAcquireNextImageKHR(fDevice, fSwapchain, UINT64_MAX,
516 semaphore, VK_NULL_HANDLE,
517 &backbuffer->fImageIndex);
518 if (VK_ERROR_SURFACE_LOST_KHR == res) {
519 // need to figure out how to create a new vkSurface without the platformData*
520 // maybe use attach somehow? but need a Window
521 GR_VK_CALL(fInterface, DestroySemaphore(fDevice, semaphore, nullptr));
522 return nullptr;
523 }
524 if (VK_ERROR_OUT_OF_DATE_KHR == res) {
525 // tear swapchain down and try again
526 if (!this->createSwapchain(-1, -1, fDisplayParams)) {
527 GR_VK_CALL(fInterface, DestroySemaphore(fDevice, semaphore, nullptr));
528 return nullptr;
529 }
530 backbuffer = this->getAvailableBackbuffer();
531
532 // acquire the image
533 res = fAcquireNextImageKHR(fDevice, fSwapchain, UINT64_MAX,
534 semaphore, VK_NULL_HANDLE,
535 &backbuffer->fImageIndex);
536
537 if (VK_SUCCESS != res) {
538 GR_VK_CALL(fInterface, DestroySemaphore(fDevice, semaphore, nullptr));
539 return nullptr;
540 }
541 }
542
543 SkSurface* surface = fSurfaces[backbuffer->fImageIndex].get();
544
545 GrBackendSemaphore beSemaphore = GrBackendSemaphores::MakeVk(semaphore);
546
547 surface->wait(1, &beSemaphore);
548
549 return sk_ref_sp(surface);
550}
551
552void VulkanWindowContext::onSwapBuffers() {
553
554 BackbufferInfo* backbuffer = fBackbuffers + fCurrentBackbufferIndex;
555 SkSurface* surface = fSurfaces[backbuffer->fImageIndex].get();
556
557 GrBackendSemaphore beSemaphore = GrBackendSemaphores::MakeVk(backbuffer->fRenderSemaphore);
558
560 info.fNumSemaphores = 1;
561 info.fSignalSemaphores = &beSemaphore;
563 VK_IMAGE_LAYOUT_PRESENT_SRC_KHR, fPresentQueueIndex);
564 auto dContext = surface->recordingContext()->asDirectContext();
565 dContext->flush(surface, info, &presentState);
566 dContext->submit();
567
568 // Submit present operation to present queue
569 const VkPresentInfoKHR presentInfo =
570 {
572 nullptr, // pNext
573 1, // waitSemaphoreCount
574 &backbuffer->fRenderSemaphore, // pWaitSemaphores
575 1, // swapchainCount
576 &fSwapchain, // pSwapchains
577 &backbuffer->fImageIndex, // pImageIndices
578 nullptr // pResults
579 };
580
581 fQueuePresentKHR(fPresentQueue, &presentInfo);
582}
583
584} // namespace skwindow::internal
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
Definition: DM.cpp:213
@ kTopLeft_GrSurfaceOrigin
Definition: GrTypes.h:148
bool GrVkFormatIsSupported(VkFormat format)
Definition: GrVkUtil.cpp:21
#define GR_VK_CALL(IFACE, X)
Definition: GrVkUtil.h:24
#define SkASSERT(cond)
Definition: SkAssert.h:116
SkColorType
Definition: SkColorType.h:19
@ kBGRA_8888_SkColorType
pixel with 8 bits for blue, green, red, alpha; in 32-bit word
Definition: SkColorType.h:26
@ kRGBA_8888_SkColorType
pixel with 8 bits for red, green, blue, alpha; in 32-bit word
Definition: SkColorType.h:24
static SkColorType colorType(AImageDecoder *decoder, const AImageDecoderHeaderInfo *headerInfo)
sk_sp< T > sk_ref_sp(T *obj)
Definition: SkRefCnt.h:381
const Context & fContext
SkDEBUGCODE(SK_SPI) SkThreadID SkGetThreadID()
#define GET_DEV_PROC(F)
#define GET_PROC(F)
void * get()
Definition: SkAutoMalloc.h:64
const EmbeddedViewParams * params
VkSurfaceKHR surface
Definition: main.cc:49
GAsyncResult * result
uint32_t uint32_t * format
static float max(float r, float g, float b)
Definition: hsl.cpp:49
SK_API GrBackendRenderTarget MakeVk(int width, int height, const GrVkImageInfo &)
SK_API GrBackendSemaphore MakeVk(VkSemaphore semaphore)
SK_API GrBackendTexture MakeVk(int width, int height, const GrVkImageInfo &, std::string_view label={})
SK_API sk_sp< GrDirectContext > MakeVulkan(const skgpu::VulkanBackendContext &, const GrContextOptions &)
SK_API sk_sp< SkSurface > WrapBackendRenderTarget(GrRecordingContext *context, const GrBackendRenderTarget &backendRenderTarget, GrSurfaceOrigin origin, SkColorType colorType, sk_sp< SkColorSpace > colorSpace, const SkSurfaceProps *surfaceProps, RenderTargetReleaseProc releaseProc=nullptr, ReleaseContext releaseContext=nullptr)
SK_API sk_sp< SkSurface > WrapBackendTexture(GrRecordingContext *context, const GrBackendTexture &backendTexture, GrSurfaceOrigin origin, int sampleCnt, SkColorType colorType, sk_sp< SkColorSpace > colorSpace, const SkSurfaceProps *surfaceProps, TextureReleaseProc textureReleaseProc=nullptr, ReleaseContext releaseContext=nullptr)
it will be possible to load the file into Perfetto s trace viewer 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
Definition: switches.h:228
SK_API MutableTextureState MakeVulkan(VkImageLayout layout, uint32_t queueFamilyIndex)
Protected
Definition: GpuTypes.h:61
int32_t height
int32_t width
uint32_t width
Definition: vulkan_core.h:2858
uint32_t height
Definition: vulkan_core.h:2859
VkStructureType sType
Definition: vulkan_core.h:3392
VkSemaphoreCreateFlags flags
Definition: vulkan_core.h:3394
VkSurfaceTransformFlagBitsKHR currentTransform
Definition: vulkan_core.h:7656
VkCompositeAlphaFlagsKHR supportedCompositeAlpha
Definition: vulkan_core.h:7657
VkSurfaceTransformFlagsKHR supportedTransforms
Definition: vulkan_core.h:7655
VkImageUsageFlags supportedUsageFlags
Definition: vulkan_core.h:7658
VkColorSpaceKHR colorSpace
Definition: vulkan_core.h:7663
VkPresentModeKHR presentMode
Definition: vulkan_core.h:7742
VkImageUsageFlags imageUsage
Definition: vulkan_core.h:7736
VkSharingMode imageSharingMode
Definition: vulkan_core.h:7737
VkStructureType sType
Definition: vulkan_core.h:7727
VkSwapchainCreateFlagsKHR flags
Definition: vulkan_core.h:7729
VkSwapchainKHR oldSwapchain
Definition: vulkan_core.h:7744
VkColorSpaceKHR imageColorSpace
Definition: vulkan_core.h:7733
VkSurfaceTransformFlagBitsKHR preTransform
Definition: vulkan_core.h:7740
const uint32_t * pQueueFamilyIndices
Definition: vulkan_core.h:7739
VkCompositeAlphaFlagBitsKHR compositeAlpha
Definition: vulkan_core.h:7741
@ VK_SWAPCHAIN_CREATE_PROTECTED_BIT_KHR
Definition: vulkan_core.h:7711
VkImageLayout
Definition: vulkan_core.h:1330
@ VK_IMAGE_LAYOUT_PRESENT_SRC_KHR
Definition: vulkan_core.h:1348
@ VK_IMAGE_LAYOUT_UNDEFINED
Definition: vulkan_core.h:1331
VkSharingMode
Definition: vulkan_core.h:1812
@ VK_SHARING_MODE_CONCURRENT
Definition: vulkan_core.h:1814
@ VK_SHARING_MODE_EXCLUSIVE
Definition: vulkan_core.h:1813
VkFlags VkImageUsageFlags
Definition: vulkan_core.h:2382
@ VK_IMAGE_TILING_OPTIMAL
Definition: vulkan_core.h:1767
#define VK_KHR_SURFACE_EXTENSION_NAME
Definition: vulkan_core.h:7592
void(VKAPI_PTR * PFN_vkGetPhysicalDeviceProperties)(VkPhysicalDevice physicalDevice, VkPhysicalDeviceProperties *pProperties)
Definition: vulkan_core.h:3986
@ VK_IMAGE_USAGE_TRANSFER_DST_BIT
Definition: vulkan_core.h:2353
@ VK_IMAGE_USAGE_SAMPLED_BIT
Definition: vulkan_core.h:2354
@ VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT
Definition: vulkan_core.h:2359
@ VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT
Definition: vulkan_core.h:2356
@ VK_IMAGE_USAGE_TRANSFER_SRC_BIT
Definition: vulkan_core.h:2352
VkCompositeAlphaFlagBitsKHR
Definition: vulkan_core.h:7639
@ VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR
Definition: vulkan_core.h:7640
@ VK_COMPOSITE_ALPHA_INHERIT_BIT_KHR
Definition: vulkan_core.h:7643
VkResult
Definition: vulkan_core.h:140
@ VK_SUCCESS
Definition: vulkan_core.h:141
@ VK_ERROR_OUT_OF_DATE_KHR
Definition: vulkan_core.h:168
@ VK_ERROR_SURFACE_LOST_KHR
Definition: vulkan_core.h:165
@ VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR
Definition: vulkan_core.h:7627
VkPresentModeKHR
Definition: vulkan_core.h:7594
@ VK_PRESENT_MODE_IMMEDIATE_KHR
Definition: vulkan_core.h:7595
@ VK_PRESENT_MODE_MAILBOX_KHR
Definition: vulkan_core.h:7596
@ VK_PRESENT_MODE_FIFO_KHR
Definition: vulkan_core.h:7597
#define VK_NULL_HANDLE
Definition: vulkan_core.h:46
VkFormat
Definition: vulkan_core.h:1458
@ VK_FORMAT_R8G8B8A8_SRGB
Definition: vulkan_core.h:1502
@ VK_FORMAT_B8G8R8A8_UNORM
Definition: vulkan_core.h:1503
@ VK_FORMAT_R8G8B8A8_UNORM
Definition: vulkan_core.h:1496
@ VK_FORMAT_UNDEFINED
Definition: vulkan_core.h:1459
VkColorSpaceKHR
Definition: vulkan_core.h:7604
@ VK_COLORSPACE_SRGB_NONLINEAR_KHR
Definition: vulkan_core.h:7621
uint32_t VkBool32
Definition: vulkan_core.h:94
#define VK_KHR_SWAPCHAIN_EXTENSION_NAME
Definition: vulkan_core.h:7707
PFN_vkVoidFunction(VKAPI_PTR * PFN_vkGetInstanceProcAddr)(VkInstance instance, const char *pName)
Definition: vulkan_core.h:3989
@ VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO
Definition: vulkan_core.h:211
@ VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR
Definition: vulkan_core.h:418
@ VK_STRUCTURE_TYPE_PRESENT_INFO_KHR
Definition: vulkan_core.h:419