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 // TODO: Either Make the ycbcr conversion info shareable with Ganesh or add a version for 38 // Graphite. 39 // GrVkYcbcrConversionInfo fYcbcrConversionInfo; 40 41 VulkanTextureInfo() = default; VulkanTextureInfoVulkanTextureInfo42 VulkanTextureInfo(uint32_t sampleCount, 43 Mipmapped mipmapped, 44 VkImageCreateFlags flags, 45 VkFormat format, 46 VkImageTiling imageTiling, 47 VkImageUsageFlags imageUsageFlags, 48 VkSharingMode sharingMode, 49 VkImageAspectFlags aspectMask) 50 : fSampleCount(sampleCount) 51 , fMipmapped(mipmapped) 52 , fFlags(flags) 53 , fFormat(format) 54 , fImageTiling(imageTiling) 55 , fImageUsageFlags(imageUsageFlags) 56 , fSharingMode(sharingMode) 57 , fAspectMask(aspectMask) {} 58 }; 59 60 } // namespace skgpu::graphite 61 62 #endif // skgpu_graphite_VulkanGraphiteTypes_DEFINED 63 64 65