Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Namespaces | Macros
VulkanWindowContext.cpp File Reference
#include "tools/window/VulkanWindowContext.h"
#include "include/core/SkSurface.h"
#include "include/gpu/GrBackendSemaphore.h"
#include "include/gpu/GrBackendSurface.h"
#include "include/gpu/GrDirectContext.h"
#include "include/gpu/ganesh/SkSurfaceGanesh.h"
#include "include/gpu/ganesh/vk/GrVkBackendSemaphore.h"
#include "include/gpu/ganesh/vk/GrVkBackendSurface.h"
#include "include/gpu/ganesh/vk/GrVkDirectContext.h"
#include "include/gpu/vk/GrVkTypes.h"
#include "include/gpu/vk/VulkanExtensions.h"
#include "include/gpu/vk/VulkanMutableTextureState.h"
#include "src/base/SkAutoMalloc.h"
#include "src/gpu/ganesh/vk/GrVkImage.h"
#include "src/gpu/ganesh/vk/GrVkUtil.h"
#include "src/gpu/vk/VulkanInterface.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 33 of file VulkanWindowContext.cpp.

35 {
36
37VulkanWindowContext::VulkanWindowContext(const DisplayParams& params,
38 CreateVkSurfaceFn createVkSurface,
39 CanPresentFn canPresent,
41 : WindowContext(params)
42 , fCreateVkSurfaceFn(std::move(createVkSurface))
43 , fCanPresentFn(std::move(canPresent))
44 , fSurface(VK_NULL_HANDLE)
45 , fSwapchain(VK_NULL_HANDLE)
46 , fImages(nullptr)
47 , fImageLayouts(nullptr)
48 , fSurfaces(nullptr)
49 , fBackbuffers(nullptr) {
50 fGetInstanceProcAddr = instProc;
51 this->initializeContext();
52}
53
54void VulkanWindowContext::initializeContext() {
56 // any config code here (particularly for msaa)?
57
58 PFN_vkGetInstanceProcAddr getInstanceProc = fGetInstanceProcAddr;
59 GrVkBackendContext backendContext;
62 if (!sk_gpu_test::CreateVkBackendContext(getInstanceProc, &backendContext, &extensions,
63 &features, &fDebugCallback, &fPresentQueueIndex,
64 fCanPresentFn,
65 fDisplayParams.fCreateProtectedNativeBackend)) {
66 sk_gpu_test::FreeVulkanFeaturesStructs(&features);
67 return;
68 }
69
70 if (!extensions.hasExtension(VK_KHR_SURFACE_EXTENSION_NAME, 25) ||
72 sk_gpu_test::FreeVulkanFeaturesStructs(&features);
73 return;
74 }
75
76 fInstance = backendContext.fInstance;
77 fPhysicalDevice = backendContext.fPhysicalDevice;
78 fDevice = backendContext.fDevice;
79 fGraphicsQueueIndex = backendContext.fGraphicsQueueIndex;
80 fGraphicsQueue = backendContext.fQueue;
81
82 PFN_vkGetPhysicalDeviceProperties localGetPhysicalDeviceProperties =
83 reinterpret_cast<PFN_vkGetPhysicalDeviceProperties>(
84 backendContext.fGetProc("vkGetPhysicalDeviceProperties",
85 backendContext.fInstance,
87 if (!localGetPhysicalDeviceProperties) {
88 sk_gpu_test::FreeVulkanFeaturesStructs(&features);
89 return;
90 }
91 VkPhysicalDeviceProperties physDeviceProperties;
92 localGetPhysicalDeviceProperties(backendContext.fPhysicalDevice, &physDeviceProperties);
93 uint32_t physDevVersion = physDeviceProperties.apiVersion;
94
95 fInterface.reset(new skgpu::VulkanInterface(backendContext.fGetProc, fInstance, fDevice,
96 backendContext.fInstanceVersion, physDevVersion,
97 &extensions));
98
99 GET_PROC(DestroyInstance);
100 if (fDebugCallback != VK_NULL_HANDLE) {
101 GET_PROC(DestroyDebugReportCallbackEXT);
102 }
103 GET_PROC(DestroySurfaceKHR);
104 GET_PROC(GetPhysicalDeviceSurfaceSupportKHR);
105 GET_PROC(GetPhysicalDeviceSurfaceCapabilitiesKHR);
106 GET_PROC(GetPhysicalDeviceSurfaceFormatsKHR);
107 GET_PROC(GetPhysicalDeviceSurfacePresentModesKHR);
108 GET_DEV_PROC(DeviceWaitIdle);
109 GET_DEV_PROC(QueueWaitIdle);
110 GET_DEV_PROC(DestroyDevice);
111 GET_DEV_PROC(CreateSwapchainKHR);
112 GET_DEV_PROC(DestroySwapchainKHR);
113 GET_DEV_PROC(GetSwapchainImagesKHR);
114 GET_DEV_PROC(AcquireNextImageKHR);
115 GET_DEV_PROC(QueuePresentKHR);
116 GET_DEV_PROC(GetDeviceQueue);
117
118 fContext = GrDirectContexts::MakeVulkan(backendContext, fDisplayParams.fGrContextOptions);
119
120 fSurface = fCreateVkSurfaceFn(fInstance);
121 if (VK_NULL_HANDLE == fSurface) {
122 this->destroyContext();
123 sk_gpu_test::FreeVulkanFeaturesStructs(&features);
124 return;
125 }
126
127 VkBool32 supported;
128 VkResult res = fGetPhysicalDeviceSurfaceSupportKHR(fPhysicalDevice, fPresentQueueIndex,
129 fSurface, &supported);
130 if (VK_SUCCESS != res) {
131 this->destroyContext();
132 sk_gpu_test::FreeVulkanFeaturesStructs(&features);
133 return;
134 }
135
136 if (!this->createSwapchain(-1, -1, fDisplayParams)) {
137 this->destroyContext();
138 sk_gpu_test::FreeVulkanFeaturesStructs(&features);
139 return;
140 }
141
142 // create presentQueue
143 fGetDeviceQueue(fDevice, fPresentQueueIndex, 0, &fPresentQueue);
144 sk_gpu_test::FreeVulkanFeaturesStructs(&features);
145}
146
147bool VulkanWindowContext::createSwapchain(int width, int height,
148 const DisplayParams& params) {
149 // check for capabilities
151 VkResult res = fGetPhysicalDeviceSurfaceCapabilitiesKHR(fPhysicalDevice, fSurface, &caps);
152 if (VK_SUCCESS != res) {
153 return false;
154 }
155
156 uint32_t surfaceFormatCount;
157 res = fGetPhysicalDeviceSurfaceFormatsKHR(fPhysicalDevice, fSurface, &surfaceFormatCount,
158 nullptr);
159 if (VK_SUCCESS != res) {
160 return false;
161 }
162
163 SkAutoMalloc surfaceFormatAlloc(surfaceFormatCount * sizeof(VkSurfaceFormatKHR));
164 VkSurfaceFormatKHR* surfaceFormats = (VkSurfaceFormatKHR*)surfaceFormatAlloc.get();
165 res = fGetPhysicalDeviceSurfaceFormatsKHR(fPhysicalDevice, fSurface, &surfaceFormatCount,
166 surfaceFormats);
167 if (VK_SUCCESS != res) {
168 return false;
169 }
170
171 uint32_t presentModeCount;
172 res = fGetPhysicalDeviceSurfacePresentModesKHR(fPhysicalDevice, fSurface, &presentModeCount,
173 nullptr);
174 if (VK_SUCCESS != res) {
175 return false;
176 }
177
178 SkAutoMalloc presentModeAlloc(presentModeCount * sizeof(VkPresentModeKHR));
179 VkPresentModeKHR* presentModes = (VkPresentModeKHR*)presentModeAlloc.get();
180 res = fGetPhysicalDeviceSurfacePresentModesKHR(fPhysicalDevice, fSurface, &presentModeCount,
181 presentModes);
182 if (VK_SUCCESS != res) {
183 return false;
184 }
185
186 VkExtent2D extent = caps.currentExtent;
187 // use the hints
188 if (extent.width == (uint32_t)-1) {
189 extent.width = width;
190 extent.height = height;
191 }
192
193 // clamp width; to protect us from broken hints
194 if (extent.width < caps.minImageExtent.width) {
195 extent.width = caps.minImageExtent.width;
196 } else if (extent.width > caps.maxImageExtent.width) {
197 extent.width = caps.maxImageExtent.width;
198 }
199 // clamp height
200 if (extent.height < caps.minImageExtent.height) {
201 extent.height = caps.minImageExtent.height;
202 } else if (extent.height > caps.maxImageExtent.height) {
203 extent.height = caps.maxImageExtent.height;
204 }
205
206 fWidth = (int)extent.width;
207 fHeight = (int)extent.height;
208
209 uint32_t imageCount = caps.minImageCount + 2;
210 if (caps.maxImageCount > 0 && imageCount > caps.maxImageCount) {
211 // Application must settle for fewer images than desired:
212 imageCount = caps.maxImageCount;
213 }
214
218 SkASSERT((caps.supportedUsageFlags & usageFlags) == usageFlags);
221 }
223 usageFlags |= VK_IMAGE_USAGE_SAMPLED_BIT;
224 }
228 VkCompositeAlphaFlagBitsKHR composite_alpha =
232
233 // Pick our surface format.
234 VkFormat surfaceFormat = VK_FORMAT_UNDEFINED;
236 for (uint32_t i = 0; i < surfaceFormatCount; ++i) {
237 VkFormat localFormat = surfaceFormats[i].format;
238 if (GrVkFormatIsSupported(localFormat)) {
239 surfaceFormat = localFormat;
240 colorSpace = surfaceFormats[i].colorSpace;
241 break;
242 }
243 }
244 fDisplayParams = params;
245 fSampleCount = std::max(1, params.fMSAASampleCount);
246 fStencilBits = 8;
247
248 if (VK_FORMAT_UNDEFINED == surfaceFormat) {
249 return false;
250 }
251
253 switch (surfaceFormat) {
254 case VK_FORMAT_R8G8B8A8_UNORM: // fall through
257 break;
258 case VK_FORMAT_B8G8R8A8_UNORM: // fall through
260 break;
261 default:
262 return false;
263 }
264
265 // If mailbox mode is available, use it, as it is the lowest-latency non-
266 // tearing mode. If not, fall back to FIFO which is always available.
268 bool hasImmediate = false;
269 for (uint32_t i = 0; i < presentModeCount; ++i) {
270 // use mailbox
271 if (VK_PRESENT_MODE_MAILBOX_KHR == presentModes[i]) {
273 }
274 if (VK_PRESENT_MODE_IMMEDIATE_KHR == presentModes[i]) {
275 hasImmediate = true;
276 }
277 }
278 if (params.fDisableVsync && hasImmediate) {
280 }
281
282 VkSwapchainCreateInfoKHR swapchainCreateInfo;
283 memset(&swapchainCreateInfo, 0, sizeof(VkSwapchainCreateInfoKHR));
285 swapchainCreateInfo.flags = fDisplayParams.fCreateProtectedNativeBackend
287 : 0;
288 swapchainCreateInfo.surface = fSurface;
289 swapchainCreateInfo.minImageCount = imageCount;
290 swapchainCreateInfo.imageFormat = surfaceFormat;
291 swapchainCreateInfo.imageColorSpace = colorSpace;
292 swapchainCreateInfo.imageExtent = extent;
293 swapchainCreateInfo.imageArrayLayers = 1;
294 swapchainCreateInfo.imageUsage = usageFlags;
295
296 uint32_t queueFamilies[] = { fGraphicsQueueIndex, fPresentQueueIndex };
297 if (fGraphicsQueueIndex != fPresentQueueIndex) {
298 swapchainCreateInfo.imageSharingMode = VK_SHARING_MODE_CONCURRENT;
299 swapchainCreateInfo.queueFamilyIndexCount = 2;
300 swapchainCreateInfo.pQueueFamilyIndices = queueFamilies;
301 } else {
302 swapchainCreateInfo.imageSharingMode = VK_SHARING_MODE_EXCLUSIVE;
303 swapchainCreateInfo.queueFamilyIndexCount = 0;
304 swapchainCreateInfo.pQueueFamilyIndices = nullptr;
305 }
306
308 swapchainCreateInfo.compositeAlpha = composite_alpha;
309 swapchainCreateInfo.presentMode = mode;
310 swapchainCreateInfo.clipped = true;
311 swapchainCreateInfo.oldSwapchain = fSwapchain;
312
313 res = fCreateSwapchainKHR(fDevice, &swapchainCreateInfo, nullptr, &fSwapchain);
314 if (VK_SUCCESS != res) {
315 return false;
316 }
317
318 // destroy the old swapchain
319 if (swapchainCreateInfo.oldSwapchain != VK_NULL_HANDLE) {
320 fDeviceWaitIdle(fDevice);
321
322 this->destroyBuffers();
323
324 fDestroySwapchainKHR(fDevice, swapchainCreateInfo.oldSwapchain, nullptr);
325 }
326
327 if (!this->createBuffers(swapchainCreateInfo.imageFormat, usageFlags, colorType,
328 swapchainCreateInfo.imageSharingMode)) {
329 fDeviceWaitIdle(fDevice);
330
331 this->destroyBuffers();
332
333 fDestroySwapchainKHR(fDevice, swapchainCreateInfo.oldSwapchain, nullptr);
334 }
335
336 return true;
337}
338
339bool VulkanWindowContext::createBuffers(VkFormat format,
340 VkImageUsageFlags usageFlags,
342 VkSharingMode sharingMode) {
343 fGetSwapchainImagesKHR(fDevice, fSwapchain, &fImageCount, nullptr);
344 SkASSERT(fImageCount);
345 fImages = new VkImage[fImageCount];
346 fGetSwapchainImagesKHR(fDevice, fSwapchain, &fImageCount, fImages);
347
348 // set up initial image layouts and create surfaces
349 fImageLayouts = new VkImageLayout[fImageCount];
350 fSurfaces = new sk_sp<SkSurface>[fImageCount];
351 for (uint32_t i = 0; i < fImageCount; ++i) {
352 fImageLayouts[i] = VK_IMAGE_LAYOUT_UNDEFINED;
353
355 info.fImage = fImages[i];
356 info.fAlloc = skgpu::VulkanAlloc();
357 info.fImageLayout = VK_IMAGE_LAYOUT_UNDEFINED;
358 info.fImageTiling = VK_IMAGE_TILING_OPTIMAL;
359 info.fFormat = format;
360 info.fImageUsageFlags = usageFlags;
361 info.fLevelCount = 1;
362 info.fCurrentQueueFamily = fPresentQueueIndex;
363 info.fProtected = skgpu::Protected(fDisplayParams.fCreateProtectedNativeBackend);
364 info.fSharingMode = sharingMode;
365
366 if (usageFlags & VK_IMAGE_USAGE_SAMPLED_BIT) {
367 GrBackendTexture backendTexture = GrBackendTextures::MakeVk(fWidth, fHeight, info);
368 fSurfaces[i] = SkSurfaces::WrapBackendTexture(fContext.get(),
369 backendTexture,
371 fDisplayParams.fMSAASampleCount,
372 colorType,
373 fDisplayParams.fColorSpace,
374 &fDisplayParams.fSurfaceProps);
375 } else {
376 if (fDisplayParams.fMSAASampleCount > 1) {
377 return false;
378 }
379 info.fSampleCount = fSampleCount;
380 GrBackendRenderTarget backendRT = GrBackendRenderTargets::MakeVk(fWidth, fHeight, info);
382 backendRT,
384 colorType,
385 fDisplayParams.fColorSpace,
386 &fDisplayParams.fSurfaceProps);
387 }
388 if (!fSurfaces[i]) {
389 return false;
390 }
391 }
392
393 // set up the backbuffers
394 VkSemaphoreCreateInfo semaphoreInfo;
395 memset(&semaphoreInfo, 0, sizeof(VkSemaphoreCreateInfo));
397 semaphoreInfo.pNext = nullptr;
398 semaphoreInfo.flags = 0;
399
400 // we create one additional backbuffer structure here, because we want to
401 // give the command buffers they contain a chance to finish before we cycle back
402 fBackbuffers = new BackbufferInfo[fImageCount + 1];
403 for (uint32_t i = 0; i < fImageCount + 1; ++i) {
404 fBackbuffers[i].fImageIndex = -1;
406 CreateSemaphore(fDevice, &semaphoreInfo, nullptr,
407 &fBackbuffers[i].fRenderSemaphore));
409 }
410 fCurrentBackbufferIndex = fImageCount;
411 return true;
412}
413
414void VulkanWindowContext::destroyBuffers() {
415
416 if (fBackbuffers) {
417 for (uint32_t i = 0; i < fImageCount + 1; ++i) {
418 fBackbuffers[i].fImageIndex = -1;
419 GR_VK_CALL(fInterface,
420 DestroySemaphore(fDevice,
421 fBackbuffers[i].fRenderSemaphore,
422 nullptr));
423 }
424 }
425
426 delete[] fBackbuffers;
427 fBackbuffers = nullptr;
428
429 // Does this actually free the surfaces?
430 delete[] fSurfaces;
431 fSurfaces = nullptr;
432 delete[] fImageLayouts;
433 fImageLayouts = nullptr;
434 delete[] fImages;
435 fImages = nullptr;
436}
437
438VulkanWindowContext::~VulkanWindowContext() {
439 this->destroyContext();
440}
441
442void VulkanWindowContext::destroyContext() {
443 if (this->isValid()) {
444 fQueueWaitIdle(fPresentQueue);
445 fDeviceWaitIdle(fDevice);
446
447 this->destroyBuffers();
448
449 if (VK_NULL_HANDLE != fSwapchain) {
450 fDestroySwapchainKHR(fDevice, fSwapchain, nullptr);
451 fSwapchain = VK_NULL_HANDLE;
452 }
453
454 if (VK_NULL_HANDLE != fSurface) {
455 fDestroySurfaceKHR(fInstance, fSurface, nullptr);
456 fSurface = VK_NULL_HANDLE;
457 }
458 }
459
460 SkASSERT(fContext->unique());
461 fContext.reset();
462 fInterface.reset();
463
464 if (VK_NULL_HANDLE != fDevice) {
465 fDestroyDevice(fDevice, nullptr);
466 fDevice = VK_NULL_HANDLE;
467 }
468
469#ifdef SK_ENABLE_VK_LAYERS
470 if (fDebugCallback != VK_NULL_HANDLE) {
471 fDestroyDebugReportCallbackEXT(fInstance, fDebugCallback, nullptr);
472 }
473#endif
474
475 fPhysicalDevice = VK_NULL_HANDLE;
476
477 if (VK_NULL_HANDLE != fInstance) {
478 fDestroyInstance(fInstance, nullptr);
479 fInstance = VK_NULL_HANDLE;
480 }
481}
482
483VulkanWindowContext::BackbufferInfo* VulkanWindowContext::getAvailableBackbuffer() {
484 SkASSERT(fBackbuffers);
485
486 ++fCurrentBackbufferIndex;
487 if (fCurrentBackbufferIndex > fImageCount) {
488 fCurrentBackbufferIndex = 0;
489 }
490
491 BackbufferInfo* backbuffer = fBackbuffers + fCurrentBackbufferIndex;
492 return backbuffer;
493}
494
495sk_sp<SkSurface> VulkanWindowContext::getBackbufferSurface() {
496 BackbufferInfo* backbuffer = this->getAvailableBackbuffer();
497 SkASSERT(backbuffer);
498
499 // semaphores should be in unsignaled state
500 VkSemaphoreCreateInfo semaphoreInfo;
501 memset(&semaphoreInfo, 0, sizeof(VkSemaphoreCreateInfo));
503 semaphoreInfo.pNext = nullptr;
504 semaphoreInfo.flags = 0;
505 VkSemaphore semaphore;
506 SkDEBUGCODE(VkResult result = )GR_VK_CALL(fInterface, CreateSemaphore(fDevice, &semaphoreInfo,
507 nullptr, &semaphore));
509
510 // acquire the image
511 VkResult res = fAcquireNextImageKHR(fDevice, fSwapchain, UINT64_MAX,
512 semaphore, VK_NULL_HANDLE,
513 &backbuffer->fImageIndex);
514 if (VK_ERROR_SURFACE_LOST_KHR == res) {
515 // need to figure out how to create a new vkSurface without the platformData*
516 // maybe use attach somehow? but need a Window
517 GR_VK_CALL(fInterface, DestroySemaphore(fDevice, semaphore, nullptr));
518 return nullptr;
519 }
520 if (VK_ERROR_OUT_OF_DATE_KHR == res) {
521 // tear swapchain down and try again
522 if (!this->createSwapchain(-1, -1, fDisplayParams)) {
523 GR_VK_CALL(fInterface, DestroySemaphore(fDevice, semaphore, nullptr));
524 return nullptr;
525 }
526 backbuffer = this->getAvailableBackbuffer();
527
528 // acquire the image
529 res = fAcquireNextImageKHR(fDevice, fSwapchain, UINT64_MAX,
530 semaphore, VK_NULL_HANDLE,
531 &backbuffer->fImageIndex);
532
533 if (VK_SUCCESS != res) {
534 GR_VK_CALL(fInterface, DestroySemaphore(fDevice, semaphore, nullptr));
535 return nullptr;
536 }
537 }
538
539 SkSurface* surface = fSurfaces[backbuffer->fImageIndex].get();
540
541 GrBackendSemaphore beSemaphore = GrBackendSemaphores::MakeVk(semaphore);
542
543 surface->wait(1, &beSemaphore);
544
545 return sk_ref_sp(surface);
546}
547
548void VulkanWindowContext::onSwapBuffers() {
549
550 BackbufferInfo* backbuffer = fBackbuffers + fCurrentBackbufferIndex;
551 SkSurface* surface = fSurfaces[backbuffer->fImageIndex].get();
552
553 GrBackendSemaphore beSemaphore = GrBackendSemaphores::MakeVk(backbuffer->fRenderSemaphore);
554
557 info.fSignalSemaphores = &beSemaphore;
559 VK_IMAGE_LAYOUT_PRESENT_SRC_KHR, fPresentQueueIndex);
560 auto dContext = surface->recordingContext()->asDirectContext();
561 dContext->flush(surface, info, &presentState);
562 dContext->submit();
563
564 // Submit present operation to present queue
565 const VkPresentInfoKHR presentInfo =
566 {
568 nullptr, // pNext
569 1, // waitSemaphoreCount
570 &backbuffer->fRenderSemaphore, // pWaitSemaphores
571 1, // swapchainCount
572 &fSwapchain, // pSwapchains
573 &backbuffer->fImageIndex, // pImageIndices
574 nullptr // pResults
575 };
576
577 fQueuePresentKHR(fPresentQueue, &presentInfo);
578}
579
580} // 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
#define SkDEBUGCODE(...)
Definition SkDebug.h:23
static SkColorType colorType(AImageDecoder *decoder, const AImageDecoderHeaderInfo *headerInfo)
sk_sp< T > sk_ref_sp(T *obj)
Definition SkRefCnt.h:381
const Context & fContext
#define GET_DEV_PROC(F)
#define GET_PROC(F)
Type::kYUV Type::kRGBA() int(0.7 *637)
const EmbeddedViewParams * params
VkSurfaceKHR surface
Definition main.cc:49
GAsyncResult * result
uint32_t uint32_t * format
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 GrVkBackendContext &, 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
Definition ref_ptr.h:256
int32_t height
int32_t width
size_t fNumSemaphores
Definition GrTypes.h:217
VkPhysicalDevice fPhysicalDevice
skgpu::VulkanGetProc fGetProc
VkImage fImage
Definition GrVkTypes.h:26
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
@ 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_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 31 of file VulkanWindowContext.cpp.