1 /* 2 * Copyright 2023 Google Inc. 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_VulkanYcbcrConversion_DEFINED 9 #define skgpu_graphite_VulkanYcbcrConversion_DEFINED 10 11 #include "src/gpu/graphite/Resource.h" 12 13 #include "include/private/gpu/vk/SkiaVulkan.h" 14 #include "src/core/SkChecksum.h" 15 16 #include <cinttypes> 17 18 namespace skgpu { 19 struct VulkanYcbcrConversionInfo; 20 } 21 22 namespace skgpu::graphite { 23 24 class VulkanSharedContext; 25 26 class VulkanYcbcrConversion : public Resource { 27 public: 28 static sk_sp<VulkanYcbcrConversion> Make(const VulkanSharedContext*, 29 const VulkanYcbcrConversionInfo&); 30 ycbcrConversion()31 const VkSamplerYcbcrConversion& ycbcrConversion() const { return fYcbcrConversion; } 32 getResourceType()33 const char* getResourceType() const override { return "Vulkan YCbCr Conversion"; } 34 35 // Static utilities for working with VulkanYcbcrConversionInfo and ImmutableSamplerInfo, both of 36 // which pack the necessary information to create a VulkanYcbcrConversion resource. These are 37 // not on VulkanYcbcrConversionInfo because that is a public type for use with 38 // VulkanTextureInfo. 39 static ImmutableSamplerInfo ToImmutableSamplerInfo(const VulkanYcbcrConversionInfo&); 40 static VulkanYcbcrConversionInfo FromImmutableSamplerInfo(ImmutableSamplerInfo); 41 42 private: 43 VulkanYcbcrConversion(const VulkanSharedContext*, VkSamplerYcbcrConversion); 44 45 void freeGpuData() override; 46 47 VkSamplerYcbcrConversion fYcbcrConversion; 48 }; 49 } // namespace skgpu::graphite 50 51 #endif // skgpu_graphite_VulkanYcbcrConversion_DEFINED 52