Flutter Engine
The Flutter Engine
GrVkTypes.h
Go to the documentation of this file.
1
2/*
3 * Copyright 2016 Google Inc.
4 *
5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file.
7 */
8
9#ifndef GrVkTypes_DEFINED
10#define GrVkTypes_DEFINED
11
14
18
19/*
20 * When wrapping a GrBackendTexture or GrBackendRendenderTarget, the fCurrentQueueFamily should
21 * either be VK_QUEUE_FAMILY_IGNORED, VK_QUEUE_FAMILY_EXTERNAL, or VK_QUEUE_FAMILY_FOREIGN_EXT. If
22 * fSharingMode is VK_SHARING_MODE_EXCLUSIVE then fCurrentQueueFamily can also be the graphics
23 * queue index passed into Skia.
24 */
32 uint32_t fSampleCount = 1;
33 uint32_t fLevelCount = 0;
38#ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
39 bool fPartOfSwapchainOrAndroidWindow = false;
40#endif
41
42 bool operator==(const GrVkImageInfo& that) const {
43 bool equal = fImage == that.fImage && fAlloc == that.fAlloc &&
44 fImageTiling == that.fImageTiling &&
45 fImageLayout == that.fImageLayout &&
46 fFormat == that.fFormat &&
48 fSampleCount == that.fSampleCount &&
49 fLevelCount == that.fLevelCount &&
51 fProtected == that.fProtected &&
54#ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
55 equal = equal && (fPartOfSwapchainOrAndroidWindow == that.fPartOfSwapchainOrAndroidWindow);
56#endif
57 return equal;
58 }
59};
60
62
63/**
64 * This object is wrapped in a GrBackendDrawableInfo and passed in as an argument to
65 * drawBackendGpu() calls on an SkDrawable. The drawable will use this info to inject direct
66 * Vulkan calls into our stream of GPU draws.
67 *
68 * The SkDrawable is given a secondary VkCommandBuffer in which to record draws. The GPU backend
69 * will then execute that command buffer within a render pass it is using for its own draws. The
70 * drawable is also given the attachment of the color index, a compatible VkRenderPass, and the
71 * VkFormat of the color attachment so that it can make VkPipeline objects for the draws. The
72 * SkDrawable must not alter the state of the VkRenderpass or sub pass.
73 *
74 * Additionally, the SkDrawable may fill in the passed in fDrawBounds with the bounds of the draws
75 * that it submits to the command buffer. This will be used by the GPU backend for setting the
76 * bounds in vkCmdBeginRenderPass. If fDrawBounds is not updated, we will assume that the entire
77 * attachment may have been written to.
78 *
79 * The SkDrawable is always allowed to create its own command buffers and submit them to the queue
80 * to render offscreen textures which will be sampled in draws added to the passed in
81 * VkCommandBuffer. If this is done the SkDrawable is in charge of adding the required memory
82 * barriers to the queue for the sampled images since the Skia backend will not do this.
83 */
85 VkCommandBuffer fSecondaryCommandBuffer;
90#ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
91 bool fFromSwapchainOrAndroidWindow;
92#endif
93};
94
96 uint32_t fSampleCount = 1;
97 uint32_t fLevelCount = 0;
99
105};
106
107#endif
skgpu::VulkanGetProc GrVkGetProc
Definition: GrVkTypes.h:61
skgpu::VulkanBackendMemory GrVkBackendMemory
Definition: GrVkTypes.h:15
static bool equal(const SkBitmap &a, const SkBitmap &b)
Definition: ImageTest.cpp:1395
intptr_t VulkanBackendMemory
Definition: VulkanTypes.h:32
std::function< PFN_vkVoidFunction(const char *, VkInstance, VkDevice)> VulkanGetProc
Definition: VulkanTypes.h:30
Protected
Definition: GpuTypes.h:61
VkRect2D * fDrawBounds
Definition: GrVkTypes.h:89
VkFormat fFormat
Definition: GrVkTypes.h:88
uint32_t fColorAttachmentIndex
Definition: GrVkTypes.h:86
VkRenderPass fCompatibleRenderPass
Definition: GrVkTypes.h:87
VkCommandBuffer fSecondaryCommandBuffer
Definition: GrVkTypes.h:85
VkImage fImage
Definition: GrVkTypes.h:26
bool operator==(const GrVkImageInfo &that) const
Definition: GrVkTypes.h:42
VkSharingMode fSharingMode
Definition: GrVkTypes.h:37
skgpu::VulkanAlloc fAlloc
Definition: GrVkTypes.h:27
uint32_t fCurrentQueueFamily
Definition: GrVkTypes.h:34
VkFormat fFormat
Definition: GrVkTypes.h:30
uint32_t fSampleCount
Definition: GrVkTypes.h:32
skgpu::Protected fProtected
Definition: GrVkTypes.h:35
uint32_t fLevelCount
Definition: GrVkTypes.h:33
skgpu::VulkanYcbcrConversionInfo fYcbcrConversionInfo
Definition: GrVkTypes.h:36
VkImageLayout fImageLayout
Definition: GrVkTypes.h:29
VkImageUsageFlags fImageUsageFlags
Definition: GrVkTypes.h:31
VkImageTiling fImageTiling
Definition: GrVkTypes.h:28
uint32_t fSampleCount
Definition: GrVkTypes.h:96
VkImageUsageFlags fImageUsageFlags
Definition: GrVkTypes.h:102
VkImageTiling fImageTiling
Definition: GrVkTypes.h:100
uint32_t fLevelCount
Definition: GrVkTypes.h:97
skgpu::Protected fProtected
Definition: GrVkTypes.h:98
skgpu::VulkanYcbcrConversionInfo fYcbcrConversionInfo
Definition: GrVkTypes.h:103
VkFormat fFormat
Definition: GrVkTypes.h:101
VkSharingMode fSharingMode
Definition: GrVkTypes.h:104
VkImageLayout
Definition: vulkan_core.h:1330
@ VK_IMAGE_LAYOUT_UNDEFINED
Definition: vulkan_core.h:1331
VkSharingMode
Definition: vulkan_core.h:1812
@ VK_SHARING_MODE_EXCLUSIVE
Definition: vulkan_core.h:1813
VkFlags VkImageUsageFlags
Definition: vulkan_core.h:2382
VkImageTiling
Definition: vulkan_core.h:1766
@ VK_IMAGE_TILING_OPTIMAL
Definition: vulkan_core.h:1767
#define VK_NULL_HANDLE
Definition: vulkan_core.h:46
VkFormat
Definition: vulkan_core.h:1458
@ VK_FORMAT_UNDEFINED
Definition: vulkan_core.h:1459
#define VK_QUEUE_FAMILY_IGNORED
Definition: vulkan_core.h:127