Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Namespaces | Macros
GraphiteVulkanWindowContext.cpp File Reference
#include "tools/window/GraphiteVulkanWindowContext.h"
#include "include/core/SkSurface.h"
#include "include/gpu/MutableTextureState.h"
#include "include/gpu/graphite/BackendSemaphore.h"
#include "include/gpu/graphite/BackendTexture.h"
#include "include/gpu/graphite/Context.h"
#include "include/gpu/graphite/ContextOptions.h"
#include "include/gpu/graphite/GraphiteTypes.h"
#include "include/gpu/graphite/Recorder.h"
#include "include/gpu/graphite/Surface.h"
#include "include/gpu/graphite/TextureInfo.h"
#include "include/gpu/graphite/vk/VulkanGraphiteTypes.h"
#include "include/gpu/graphite/vk/VulkanGraphiteUtils.h"
#include "include/gpu/vk/VulkanExtensions.h"
#include "include/gpu/vk/VulkanMutableTextureState.h"
#include "include/gpu/vk/VulkanTypes.h"
#include "include/private/gpu/graphite/ContextOptionsPriv.h"
#include "src/base/SkAutoMalloc.h"
#include "src/gpu/graphite/vk/VulkanGraphiteUtilsPriv.h"
#include "src/gpu/vk/VulkanInterface.h"
#include "tools/GpuToolUtils.h"
#include "tools/ToolUtils.h"

Go to the source code of this file.

Namespaces

namespace  skwindow
 
namespace  skwindow::internal
 

Macros

#define GET_PROC(F)
 
#define GET_DEV_PROC(F)
 

Macro Definition Documentation

◆ GET_DEV_PROC

#define GET_DEV_PROC (   F)
Value:
f ## F = \
(PFN_vk ## F) backendContext.fGetProc("vk" #F, VK_NULL_HANDLE, fDevice)
#define F(x)
Definition SkMD5.cpp:120
#define VK_NULL_HANDLE
Definition vulkan_core.h:46

Definition at line 39 of file GraphiteVulkanWindowContext.cpp.

41 {
42
43GraphiteVulkanWindowContext::GraphiteVulkanWindowContext(const DisplayParams& params,
44 CreateVkSurfaceFn createVkSurface,
45 CanPresentFn canPresent,
47 : WindowContext(params)
48 , fCreateVkSurfaceFn(std::move(createVkSurface))
49 , fCanPresentFn(std::move(canPresent))
50 , fSurface(VK_NULL_HANDLE)
51 , fSwapchain(VK_NULL_HANDLE)
52 , fImages(nullptr)
53 , fImageLayouts(nullptr)
54 , fSurfaces(nullptr)
55 , fBackbuffers(nullptr) {
56 fGetInstanceProcAddr = instProc;
57 this->initializeContext();
58}
59
60void GraphiteVulkanWindowContext::initializeContext() {
61 SkASSERT(!fGraphiteContext && !fGraphiteRecorder);
62 // any config code here (particularly for msaa)?
63
64 PFN_vkGetInstanceProcAddr getInstanceProc = fGetInstanceProcAddr;
65 skgpu::VulkanBackendContext backendContext;
68 if (!sk_gpu_test::CreateVkBackendContext(getInstanceProc, &backendContext, &extensions,
69 &features, &fDebugCallback, &fPresentQueueIndex,
70 fCanPresentFn,
71 fDisplayParams.fCreateProtectedNativeBackend)) {
72 sk_gpu_test::FreeVulkanFeaturesStructs(&features);
73 return;
74 }
75
76 if (!extensions.hasExtension(VK_KHR_SURFACE_EXTENSION_NAME, 25) ||
78 sk_gpu_test::FreeVulkanFeaturesStructs(&features);
79 return;
80 }
81
82 fInstance = backendContext.fInstance;
83 fPhysicalDevice = backendContext.fPhysicalDevice;
84 fDevice = backendContext.fDevice;
85 fGraphicsQueueIndex = backendContext.fGraphicsQueueIndex;
86 fGraphicsQueue = backendContext.fQueue;
87
88 PFN_vkGetPhysicalDeviceProperties localGetPhysicalDeviceProperties =
89 reinterpret_cast<PFN_vkGetPhysicalDeviceProperties>(
90 backendContext.fGetProc("vkGetPhysicalDeviceProperties",
91 backendContext.fInstance,
93 if (!localGetPhysicalDeviceProperties) {
94 sk_gpu_test::FreeVulkanFeaturesStructs(&features);
95 return;
96 }
97 VkPhysicalDeviceProperties physDeviceProperties;
98 localGetPhysicalDeviceProperties(backendContext.fPhysicalDevice, &physDeviceProperties);
99 uint32_t physDevVersion = physDeviceProperties.apiVersion;
100
101 fInterface.reset(new skgpu::VulkanInterface(backendContext.fGetProc, fInstance, fDevice,
102 backendContext.fMaxAPIVersion, physDevVersion,
103 &extensions));
104
105 GET_PROC(DestroyInstance);
106 if (fDebugCallback != VK_NULL_HANDLE) {
107 GET_PROC(DestroyDebugReportCallbackEXT);
108 }
109 GET_PROC(DestroySurfaceKHR);
110 GET_PROC(GetPhysicalDeviceSurfaceSupportKHR);
111 GET_PROC(GetPhysicalDeviceSurfaceCapabilitiesKHR);
112 GET_PROC(GetPhysicalDeviceSurfaceFormatsKHR);
113 GET_PROC(GetPhysicalDeviceSurfacePresentModesKHR);
114 GET_DEV_PROC(DeviceWaitIdle);
115 GET_DEV_PROC(QueueWaitIdle);
116 GET_DEV_PROC(DestroyDevice);
117 GET_DEV_PROC(CreateSwapchainKHR);
118 GET_DEV_PROC(DestroySwapchainKHR);
119 GET_DEV_PROC(GetSwapchainImagesKHR);
120 GET_DEV_PROC(AcquireNextImageKHR);
121 GET_DEV_PROC(QueuePresentKHR);
122 GET_DEV_PROC(GetDeviceQueue);
123
124 skgpu::graphite::ContextOptions contextOptions;
125 skgpu::graphite::ContextOptionsPriv contextOptionsPriv;
126 // Needed to make synchronous readPixels work
127 contextOptionsPriv.fStoreContextRefInRecorder = true;
128 contextOptions.fOptionsPriv = &contextOptionsPriv;
129 fGraphiteContext = skgpu::graphite::ContextFactory::MakeVulkan(backendContext, contextOptions);
130 fGraphiteRecorder = fGraphiteContext->makeRecorder(ToolUtils::CreateTestingRecorderOptions());
131
132 fSurface = fCreateVkSurfaceFn(fInstance);
133 if (VK_NULL_HANDLE == fSurface) {
134 this->destroyContext();
135 sk_gpu_test::FreeVulkanFeaturesStructs(&features);
136 return;
137 }
138
139 VkBool32 supported;
140 VkResult res = fGetPhysicalDeviceSurfaceSupportKHR(fPhysicalDevice, fPresentQueueIndex,
141 fSurface, &supported);
142 if (VK_SUCCESS != res) {
143 this->destroyContext();
144 sk_gpu_test::FreeVulkanFeaturesStructs(&features);
145 return;
146 }
147
148 if (!this->createSwapchain(-1, -1, fDisplayParams)) {
149 this->destroyContext();
150 sk_gpu_test::FreeVulkanFeaturesStructs(&features);
151 return;
152 }
153
154 // create presentQueue
155 fGetDeviceQueue(fDevice, fPresentQueueIndex, 0, &fPresentQueue);
156 sk_gpu_test::FreeVulkanFeaturesStructs(&features);
157}
158
159bool GraphiteVulkanWindowContext::createSwapchain(int width, int height,
160 const DisplayParams& params) {
161 // check for capabilities
163 VkResult res = fGetPhysicalDeviceSurfaceCapabilitiesKHR(fPhysicalDevice, fSurface, &caps);
164 if (VK_SUCCESS != res) {
165 return false;
166 }
167
168 uint32_t surfaceFormatCount;
169 res = fGetPhysicalDeviceSurfaceFormatsKHR(fPhysicalDevice, fSurface, &surfaceFormatCount,
170 nullptr);
171 if (VK_SUCCESS != res) {
172 return false;
173 }
174
175 SkAutoMalloc surfaceFormatAlloc(surfaceFormatCount * sizeof(VkSurfaceFormatKHR));
176 VkSurfaceFormatKHR* surfaceFormats = (VkSurfaceFormatKHR*)surfaceFormatAlloc.get();
177 res = fGetPhysicalDeviceSurfaceFormatsKHR(fPhysicalDevice, fSurface, &surfaceFormatCount,
178 surfaceFormats);
179 if (VK_SUCCESS != res) {
180 return false;
181 }
182
183 uint32_t presentModeCount;
184 res = fGetPhysicalDeviceSurfacePresentModesKHR(fPhysicalDevice, fSurface, &presentModeCount,
185 nullptr);
186 if (VK_SUCCESS != res) {
187 return false;
188 }
189
190 SkAutoMalloc presentModeAlloc(presentModeCount * sizeof(VkPresentModeKHR));
191 VkPresentModeKHR* presentModes = (VkPresentModeKHR*)presentModeAlloc.get();
192 res = fGetPhysicalDeviceSurfacePresentModesKHR(fPhysicalDevice, fSurface, &presentModeCount,
193 presentModes);
194 if (VK_SUCCESS != res) {
195 return false;
196 }
197
198 VkExtent2D extent = caps.currentExtent;
199 // use the hints
200 if (extent.width == (uint32_t)-1) {
201 extent.width = width;
202 extent.height = height;
203 }
204
205 // clamp width; to protect us from broken hints
206 if (extent.width < caps.minImageExtent.width) {
207 extent.width = caps.minImageExtent.width;
208 } else if (extent.width > caps.maxImageExtent.width) {
209 extent.width = caps.maxImageExtent.width;
210 }
211 // clamp height
212 if (extent.height < caps.minImageExtent.height) {
213 extent.height = caps.minImageExtent.height;
214 } else if (extent.height > caps.maxImageExtent.height) {
215 extent.height = caps.maxImageExtent.height;
216 }
217
218 fWidth = (int)extent.width;
219 fHeight = (int)extent.height;
220
221 uint32_t imageCount = caps.minImageCount + 2;
222 if (caps.maxImageCount > 0 && imageCount > caps.maxImageCount) {
223 // Application must settle for fewer images than desired:
224 imageCount = caps.maxImageCount;
225 }
226
230 SkASSERT((caps.supportedUsageFlags & usageFlags) == usageFlags);
233 }
235 usageFlags |= VK_IMAGE_USAGE_SAMPLED_BIT;
236 }
240 VkCompositeAlphaFlagBitsKHR composite_alpha =
244
245 // Pick our surface format.
246 VkFormat surfaceFormat = VK_FORMAT_UNDEFINED;
248 for (uint32_t i = 0; i < surfaceFormatCount; ++i) {
249 VkFormat localFormat = surfaceFormats[i].format;
250 if (skgpu::graphite::vkFormatIsSupported(localFormat)) {
251 surfaceFormat = localFormat;
252 colorSpace = surfaceFormats[i].colorSpace;
253 break;
254 }
255 }
256 fDisplayParams = params;
257 fSampleCount = std::max(1, params.fMSAASampleCount);
258 fStencilBits = 8;
259
260 if (VK_FORMAT_UNDEFINED == surfaceFormat) {
261 return false;
262 }
263
265 switch (surfaceFormat) {
266 case VK_FORMAT_R8G8B8A8_UNORM: // fall through
269 break;
270 case VK_FORMAT_B8G8R8A8_UNORM: // fall through
272 break;
273 default:
274 return false;
275 }
276
277 // If mailbox mode is available, use it, as it is the lowest-latency non-
278 // tearing mode. If not, fall back to FIFO which is always available.
280 bool hasImmediate = false;
281 for (uint32_t i = 0; i < presentModeCount; ++i) {
282 // use mailbox
283 if (VK_PRESENT_MODE_MAILBOX_KHR == presentModes[i]) {
285 }
286 if (VK_PRESENT_MODE_IMMEDIATE_KHR == presentModes[i]) {
287 hasImmediate = true;
288 }
289 }
290 if (params.fDisableVsync && hasImmediate) {
292 }
293
294 VkSwapchainCreateInfoKHR swapchainCreateInfo;
295 memset(&swapchainCreateInfo, 0, sizeof(VkSwapchainCreateInfoKHR));
297 swapchainCreateInfo.flags = fDisplayParams.fCreateProtectedNativeBackend
299 : 0;
300 swapchainCreateInfo.surface = fSurface;
301 swapchainCreateInfo.minImageCount = imageCount;
302 swapchainCreateInfo.imageFormat = surfaceFormat;
303 swapchainCreateInfo.imageColorSpace = colorSpace;
304 swapchainCreateInfo.imageExtent = extent;
305 swapchainCreateInfo.imageArrayLayers = 1;
306 swapchainCreateInfo.imageUsage = usageFlags;
307
308 uint32_t queueFamilies[] = { fGraphicsQueueIndex, fPresentQueueIndex };
309 if (fGraphicsQueueIndex != fPresentQueueIndex) {
310 swapchainCreateInfo.imageSharingMode = VK_SHARING_MODE_CONCURRENT;
311 swapchainCreateInfo.queueFamilyIndexCount = 2;
312 swapchainCreateInfo.pQueueFamilyIndices = queueFamilies;
313 } else {
314 swapchainCreateInfo.imageSharingMode = VK_SHARING_MODE_EXCLUSIVE;
315 swapchainCreateInfo.queueFamilyIndexCount = 0;
316 swapchainCreateInfo.pQueueFamilyIndices = nullptr;
317 }
318
320 swapchainCreateInfo.compositeAlpha = composite_alpha;
321 swapchainCreateInfo.presentMode = mode;
322 swapchainCreateInfo.clipped = true;
323 swapchainCreateInfo.oldSwapchain = fSwapchain;
324
325 res = fCreateSwapchainKHR(fDevice, &swapchainCreateInfo, nullptr, &fSwapchain);
326 if (VK_SUCCESS != res) {
327 return false;
328 }
329
330 // destroy the old swapchain
331 if (swapchainCreateInfo.oldSwapchain != VK_NULL_HANDLE) {
332 fDeviceWaitIdle(fDevice);
333
334 this->destroyBuffers();
335
336 fDestroySwapchainKHR(fDevice, swapchainCreateInfo.oldSwapchain, nullptr);
337 swapchainCreateInfo.oldSwapchain = VK_NULL_HANDLE;
338 }
339
340 if (!this->createBuffers(swapchainCreateInfo.imageFormat, usageFlags, colorType,
341 swapchainCreateInfo.imageSharingMode)) {
342 fDeviceWaitIdle(fDevice);
343
344 this->destroyBuffers();
345
346 fDestroySwapchainKHR(fDevice, swapchainCreateInfo.oldSwapchain, nullptr);
347 swapchainCreateInfo.oldSwapchain = VK_NULL_HANDLE;
348 }
349
350 return true;
351}
352
353bool GraphiteVulkanWindowContext::createBuffers(VkFormat format,
354 VkImageUsageFlags usageFlags,
356 VkSharingMode sharingMode) {
357 fGetSwapchainImagesKHR(fDevice, fSwapchain, &fImageCount, nullptr);
358 SkASSERT(fImageCount);
359 fImages = new VkImage[fImageCount];
360 fGetSwapchainImagesKHR(fDevice, fSwapchain, &fImageCount, fImages);
361
362 // set up initial image layouts and create surfaces
363 fImageLayouts = new VkImageLayout[fImageCount];
364 fSurfaces = new sk_sp<SkSurface>[fImageCount];
365 for (uint32_t i = 0; i < fImageCount; ++i) {
366 fImageLayouts[i] = VK_IMAGE_LAYOUT_UNDEFINED;
367
370 info.fFormat = format;
371 info.fImageUsageFlags = usageFlags;
372 info.fSharingMode = sharingMode;
373 info.fFlags = fDisplayParams.fCreateProtectedNativeBackend ? VK_IMAGE_CREATE_PROTECTED_BIT
374 : 0;
375
376 skgpu::graphite::BackendTexture backendTex(this->dimensions(),
377 info,
379 fPresentQueueIndex,
380 fImages[i],
382
383 fSurfaces[i] = SkSurfaces::WrapBackendTexture(this->graphiteRecorder(),
384 backendTex,
385 colorType,
386 fDisplayParams.fColorSpace,
387 &fDisplayParams.fSurfaceProps);
388
389 if (!fSurfaces[i]) {
390 return false;
391 }
392 }
393
394 // set up the backbuffers
395 VkSemaphoreCreateInfo semaphoreInfo;
396 memset(&semaphoreInfo, 0, sizeof(VkSemaphoreCreateInfo));
398 semaphoreInfo.pNext = nullptr;
399 semaphoreInfo.flags = 0;
400
401 // we create one additional backbuffer structure here, because we want to
402 // give the command buffers they contain a chance to finish before we cycle back
403 fBackbuffers = new BackbufferInfo[fImageCount + 1];
404 for (uint32_t i = 0; i < fImageCount + 1; ++i) {
405 fBackbuffers[i].fImageIndex = -1;
408 fInterface,
409 result,
410 CreateSemaphore(
411 fDevice, &semaphoreInfo, nullptr, &fBackbuffers[i].fRenderSemaphore));
412 }
413 fCurrentBackbufferIndex = fImageCount;
414
415 return true;
416}
417
418void GraphiteVulkanWindowContext::destroyBuffers() {
419 if (fBackbuffers) {
420 for (uint32_t i = 0; i < fImageCount + 1; ++i) {
421 fBackbuffers[i].fImageIndex = -1;
422 VULKAN_CALL(fInterface,
423 DestroySemaphore(fDevice,
424 fBackbuffers[i].fRenderSemaphore,
425 nullptr));
426 }
427 }
428
429 delete[] fBackbuffers;
430 fBackbuffers = nullptr;
431
432 // Does this actually free the surfaces?
433 delete[] fSurfaces;
434 fSurfaces = nullptr;
435 delete[] fImageLayouts;
436 fImageLayouts = nullptr;
437 delete[] fImages;
438 fImages = nullptr;
439}
440
441GraphiteVulkanWindowContext::~GraphiteVulkanWindowContext() {
442 this->destroyContext();
443}
444
445void GraphiteVulkanWindowContext::destroyContext() {
446 if (this->isValid()) {
447 fQueueWaitIdle(fPresentQueue);
448 fDeviceWaitIdle(fDevice);
449
450 if (fWaitSemaphore != VK_NULL_HANDLE) {
451 VULKAN_CALL(fInterface, DestroySemaphore(fDevice, fWaitSemaphore, nullptr));
452 fWaitSemaphore = VK_NULL_HANDLE;
453 }
454
455 this->destroyBuffers();
456
457 if (fSwapchain != VK_NULL_HANDLE) {
458 fDestroySwapchainKHR(fDevice, fSwapchain, nullptr);
459 fSwapchain = VK_NULL_HANDLE;
460 }
461
462 if (fSurface != VK_NULL_HANDLE) {
463 fDestroySurfaceKHR(fInstance, fSurface, nullptr);
464 fSurface = VK_NULL_HANDLE;
465 }
466 }
467
468 if (fGraphiteContext) {
469 fGraphiteRecorder.reset();
470 fGraphiteContext.reset();
471 }
472 fInterface.reset();
473
474 if (fDevice != VK_NULL_HANDLE) {
475 fDestroyDevice(fDevice, nullptr);
476 fDevice = VK_NULL_HANDLE;
477 }
478
479#ifdef SK_ENABLE_VK_LAYERS
480 if (fDebugCallback != VK_NULL_HANDLE) {
481 fDestroyDebugReportCallbackEXT(fInstance, fDebugCallback, nullptr);
482 }
483#endif
484
485 fPhysicalDevice = VK_NULL_HANDLE;
486
487 if (fInstance != VK_NULL_HANDLE) {
488 fDestroyInstance(fInstance, nullptr);
489 fInstance = VK_NULL_HANDLE;
490 }
491}
492
493GraphiteVulkanWindowContext::BackbufferInfo* GraphiteVulkanWindowContext::getAvailableBackbuffer() {
494 SkASSERT(fBackbuffers);
495
496 ++fCurrentBackbufferIndex;
497 if (fCurrentBackbufferIndex > fImageCount) {
498 fCurrentBackbufferIndex = 0;
499 }
500
501 BackbufferInfo* backbuffer = fBackbuffers + fCurrentBackbufferIndex;
502 return backbuffer;
503}
504
505sk_sp<SkSurface> GraphiteVulkanWindowContext::getBackbufferSurface() {
506 BackbufferInfo* backbuffer = this->getAvailableBackbuffer();
507 SkASSERT(backbuffer);
508
509 // semaphores should be in unsignaled state
510 VkSemaphoreCreateInfo semaphoreInfo;
511 memset(&semaphoreInfo, 0, sizeof(VkSemaphoreCreateInfo));
513 semaphoreInfo.pNext = nullptr;
514 semaphoreInfo.flags = 0;
517 fInterface, result, CreateSemaphore(fDevice, &semaphoreInfo, nullptr, &fWaitSemaphore));
518
519 // acquire the image
520 VkResult res = fAcquireNextImageKHR(fDevice, fSwapchain, UINT64_MAX,
521 fWaitSemaphore, VK_NULL_HANDLE,
522 &backbuffer->fImageIndex);
523 if (VK_ERROR_SURFACE_LOST_KHR == res) {
524 // TODO: Recreate fSurface using fCreateVkSurfaceFn, and then rebuild the swapchain
525 VULKAN_CALL(fInterface, DestroySemaphore(fDevice, fWaitSemaphore, nullptr));
526 return nullptr;
527 }
528 if (VK_ERROR_OUT_OF_DATE_KHR == res) {
529 // tear swapchain down and try again
530 if (!this->createSwapchain(-1, -1, fDisplayParams)) {
531 VULKAN_CALL(fInterface, DestroySemaphore(fDevice, fWaitSemaphore, nullptr));
532 return nullptr;
533 }
534 backbuffer = this->getAvailableBackbuffer();
535
536 // acquire the image
537 res = fAcquireNextImageKHR(fDevice, fSwapchain, UINT64_MAX,
538 fWaitSemaphore, VK_NULL_HANDLE,
539 &backbuffer->fImageIndex);
540
541 if (VK_SUCCESS != res) {
542 VULKAN_CALL(fInterface, DestroySemaphore(fDevice, fWaitSemaphore, nullptr));
543 return nullptr;
544 }
545 }
546
547 SkSurface* surface = fSurfaces[backbuffer->fImageIndex].get();
548
549 return sk_ref_sp(surface);
550}
551
552void GraphiteVulkanWindowContext::onSwapBuffers() {
553 if (!fGraphiteContext) {
554 return;
555 }
556 SkASSERT(fGraphiteRecorder);
557
558 BackbufferInfo* backbuffer = fBackbuffers + fCurrentBackbufferIndex;
559
560 std::unique_ptr<skgpu::graphite::Recording> recording = fGraphiteRecorder->snap();
561 if (recording) {
563 info.fRecording = recording.get();
564
565 // set up surface for layout transition
566 info.fTargetSurface = fSurfaces[backbuffer->fImageIndex].get();
568 VK_IMAGE_LAYOUT_PRESENT_SRC_KHR, fPresentQueueIndex);
569 info.fTargetTextureState = &presentState;
570
571 SkASSERT(fWaitSemaphore != VK_NULL_HANDLE);
572 skgpu::graphite::BackendSemaphore beWaitSemaphore(fWaitSemaphore);
573 info.fNumWaitSemaphores = 1;
574 info.fWaitSemaphores = &beWaitSemaphore;
575 skgpu::graphite::BackendSemaphore beSignalSemaphore(backbuffer->fRenderSemaphore);
576 info.fNumSignalSemaphores = 1;
577 info.fSignalSemaphores = &beSignalSemaphore;
578
579 // Insert finishedProc to delete waitSemaphore when done
580 struct FinishContext {
582 VkDevice device;
583 VkSemaphore waitSemaphore;
584 };
585 auto* finishContext = new FinishContext{fInterface, fDevice, fWaitSemaphore};
587 skgpu::CallbackResult status) {
588 // regardless of the status we need to destroy the semaphore
589 const auto* context = reinterpret_cast<const FinishContext*>(c);
590 VULKAN_CALL(context->interface,
591 DestroySemaphore(context->device, context->waitSemaphore, nullptr));
592 };
593 info.fFinishedContext = finishContext;
594 info.fFinishedProc = finishCallback;
595
596 fGraphiteContext->insertRecording(info);
597 fGraphiteContext->submit(skgpu::graphite::SyncToCpu::kNo);
598 fWaitSemaphore = VK_NULL_HANDLE; // FinishCallback will destroy this
599 }
600
601 // Submit present operation to present queue
602 const VkPresentInfoKHR presentInfo =
603 {
605 nullptr, // pNext
606 1, // waitSemaphoreCount
607 &backbuffer->fRenderSemaphore, // pWaitSemaphores
608 1, // swapchainCount
609 &fSwapchain, // pSwapchains
610 &backbuffer->fImageIndex, // pImageIndices
611 nullptr // pResults
612 };
613
614 fQueuePresentKHR(fPresentQueue, &presentInfo);
615}
616
617} //namespace skwindow::internal
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
Definition DM.cpp:213
#define GET_DEV_PROC(F)
#define GET_PROC(F)
#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
#define VULKAN_CALL(IFACE, X)
#define VULKAN_CALL_RESULT_NOCHECK(IFACE, RESULT, X)
Type::kYUV Type::kRGBA() int(0.7 *637)
const EmbeddedViewParams * params
VkDevice device
Definition main.cc:53
VkSurfaceKHR surface
Definition main.cc:49
GAsyncResult * result
uint32_t uint32_t * format
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)
SK_API std::unique_ptr< Context > MakeVulkan(const VulkanBackendContext &, const ContextOptions &)
bool vkFormatIsSupported(VkFormat format)
void * GpuFinishedContext
void(*)(GpuFinishedContext finishedContext, CallbackResult) GpuFinishedProc
CallbackResult
Definition GpuTypes.h:45
Definition ref_ptr.h:256
int32_t height
int32_t width
uint32_t width
uint32_t height
VkStructureType sType
VkSemaphoreCreateFlags flags
VkSurfaceTransformFlagBitsKHR currentTransform
VkCompositeAlphaFlagsKHR supportedCompositeAlpha
VkSurfaceTransformFlagsKHR supportedTransforms
VkImageUsageFlags supportedUsageFlags
VkColorSpaceKHR colorSpace
VkPresentModeKHR presentMode
VkImageUsageFlags imageUsage
VkSharingMode imageSharingMode
VkSwapchainCreateFlagsKHR flags
VkSwapchainKHR oldSwapchain
VkColorSpaceKHR imageColorSpace
VkSurfaceTransformFlagBitsKHR preTransform
const uint32_t * pQueueFamilyIndices
VkCompositeAlphaFlagBitsKHR compositeAlpha
ContextOptionsPriv * fOptionsPriv
@ VK_SWAPCHAIN_CREATE_PROTECTED_BIT_KHR
VkImageLayout
@ VK_IMAGE_LAYOUT_PRESENT_SRC_KHR
@ VK_IMAGE_LAYOUT_UNDEFINED
VkSharingMode
@ VK_SHARING_MODE_CONCURRENT
@ VK_SHARING_MODE_EXCLUSIVE
VkFlags VkImageUsageFlags
@ VK_IMAGE_CREATE_PROTECTED_BIT
@ VK_IMAGE_TILING_OPTIMAL
#define VK_KHR_SURFACE_EXTENSION_NAME
void(VKAPI_PTR * PFN_vkGetPhysicalDeviceProperties)(VkPhysicalDevice physicalDevice, VkPhysicalDeviceProperties *pProperties)
@ VK_IMAGE_USAGE_TRANSFER_DST_BIT
@ VK_IMAGE_USAGE_SAMPLED_BIT
@ VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT
@ VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT
@ VK_IMAGE_USAGE_TRANSFER_SRC_BIT
VkCompositeAlphaFlagBitsKHR
@ VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR
@ VK_COMPOSITE_ALPHA_INHERIT_BIT_KHR
VkResult
@ VK_SUCCESS
@ VK_ERROR_OUT_OF_DATE_KHR
@ VK_ERROR_SURFACE_LOST_KHR
@ VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR
VkPresentModeKHR
@ VK_PRESENT_MODE_IMMEDIATE_KHR
@ VK_PRESENT_MODE_MAILBOX_KHR
@ VK_PRESENT_MODE_FIFO_KHR
VkFormat
@ VK_FORMAT_R8G8B8A8_SRGB
@ VK_FORMAT_B8G8R8A8_UNORM
@ VK_FORMAT_R8G8B8A8_UNORM
@ VK_FORMAT_UNDEFINED
VkColorSpaceKHR
@ VK_COLORSPACE_SRGB_NONLINEAR_KHR
uint32_t VkBool32
Definition vulkan_core.h:94
#define VK_KHR_SWAPCHAIN_EXTENSION_NAME
PFN_vkVoidFunction(VKAPI_PTR * PFN_vkGetInstanceProcAddr)(VkInstance instance, const char *pName)
@ VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO
@ VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR
@ VK_STRUCTURE_TYPE_PRESENT_INFO_KHR

◆ GET_PROC

#define GET_PROC (   F)
Value:
f ## F = \
(PFN_vk ## F) backendContext.fGetProc("vk" #F, fInstance, VK_NULL_HANDLE)

Definition at line 37 of file GraphiteVulkanWindowContext.cpp.