• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2022 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 
8 #ifndef skgpu_graphite_VulkanGraphiteTypes_DEFINED
9 #define skgpu_graphite_VulkanGraphiteTypes_DEFINED
10 
11 #include "include/gpu/graphite/GraphiteTypes.h"
12 #include "include/gpu/vk/VulkanTypes.h"
13 
14 namespace skgpu::graphite {
15 
16 struct VulkanTextureInfo {
17     uint32_t fSampleCount = 1;
18     Mipmapped fMipmapped = Mipmapped::kNo;
19 
20     // VkImageCreateInfo properties
21     // Currently the only supported flag is VK_IMAGE_CREATE_PROTECTED_BIT. Any other flag will not
22     // be accepted
23     VkImageCreateFlags       fFlags = 0;
24     VkFormat                 fFormat = VK_FORMAT_UNDEFINED;
25     VkImageTiling            fImageTiling = VK_IMAGE_TILING_OPTIMAL;
26     VkImageUsageFlags        fImageUsageFlags = 0;
27     VkSharingMode            fSharingMode = VK_SHARING_MODE_EXCLUSIVE;
28 
29     // Properties related to the image view and sampling. These are less inherent properties of the
30     // VkImage but describe how the VkImage should be used within Skia.
31 
32     // What aspect to use for the VkImageView. The normal, default is VK_IMAGE_ASPECT_COLOR_BIT.
33     // However, if the VkImage is a Ycbcr format, the client can pass a specific plan here to have
34     // Skia directly sample a plane. In that case the client should also pass in a VkFormat that is
35     // compatible with the plane as described by the Vulkan spec.
36     VkImageAspectFlags         fAspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
37     VulkanYcbcrConversionInfo  fYcbcrConversionInfo;
38 
39     VulkanTextureInfo() = default;
VulkanTextureInfoVulkanTextureInfo40     VulkanTextureInfo(uint32_t sampleCount,
41                       Mipmapped mipmapped,
42                       VkImageCreateFlags flags,
43                       VkFormat format,
44                       VkImageTiling imageTiling,
45                       VkImageUsageFlags imageUsageFlags,
46                       VkSharingMode sharingMode,
47                       VkImageAspectFlags aspectMask,
48                       VulkanYcbcrConversionInfo ycbcrConversionInfo)
49             : fSampleCount(sampleCount)
50             , fMipmapped(mipmapped)
51             , fFlags(flags)
52             , fFormat(format)
53             , fImageTiling(imageTiling)
54             , fImageUsageFlags(imageUsageFlags)
55             , fSharingMode(sharingMode)
56             , fAspectMask(aspectMask)
57             , fYcbcrConversionInfo(ycbcrConversionInfo) {}
58 };
59 
60 } // namespace skgpu::graphite
61 
62 #endif // skgpu_graphite_VulkanGraphiteTypes_DEFINED
63 
64 
65