Debian Codegraph @

include/gpu/ganesh/vk/GrVkBackendSurface.h

raw
1 /*
2 * Copyright 2023 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 GrVkBackendSurface_DEFINED
9 #define GrVkBackendSurface_DEFINED
10
11 #include "include/private/base/SkAPI.h"
12 #include "include/private/gpu/vk/SkiaVulkan.h"
13
14 #include <string_view>
15
16 class GrBackendFormat;
17 class GrBackendTexture;
18 class GrBackendRenderTarget;
19 struct GrVkImageInfo;
20
21 namespace skgpu {
22 struct VulkanYcbcrConversionInfo;
23 }
24
25 namespace GrBackendFormats {
26
27 SK_API GrBackendFormat MakeVk(VkFormat format, bool willUseDRMFormatModifiers = false);
28 SK_API GrBackendFormat MakeVk(const skgpu::VulkanYcbcrConversionInfo& ycbcrInfo,
29 bool willUseDRMFormatModifiers = false);
30
31 SK_API bool AsVkFormat(const GrBackendFormat&, VkFormat*);
32 SK_API const skgpu::VulkanYcbcrConversionInfo* GetVkYcbcrConversionInfo(const GrBackendFormat&);
33
34 } // namespace GrBackendFormats
35
36
37 namespace GrBackendTextures {
38
39 SK_API GrBackendTexture MakeVk(int width,
40 int height,
41 const GrVkImageInfo&,
42 std::string_view label = {});
43
44 // If the backend API is Vulkan, copies a snapshot of the GrVkImageInfo struct into the passed
45 // in pointer and returns true. This snapshot will set the fImageLayout to the current layout
46 // state. Otherwise returns false if the backend API is not Vulkan.
47 SK_API bool GetVkImageInfo(const GrBackendTexture&, GrVkImageInfo*);
48
49 // Anytime the client changes the VkImageLayout of the VkImage captured by this
50 // GrBackendTexture, they must call this function to notify Skia of the changed layout.
51 SK_API void SetVkImageLayout(GrBackendTexture*, VkImageLayout);
52
53 } // namespace GrBackendTextures
54
55
56 namespace GrBackendRenderTargets {
57
58 SK_API GrBackendRenderTarget MakeVk(int width, int height, const GrVkImageInfo&);
59
60 // If the backend API is Vulkan, copies a snapshot of the GrVkImageInfo struct into the passed
61 // in pointer and returns true. This snapshot will set the fImageLayout to the current layout
62 // state. Otherwise returns false if the backend API is not Vulkan.
63 SK_API bool GetVkImageInfo(const GrBackendRenderTarget&, GrVkImageInfo*);
64
65 // Anytime the client changes the VkImageLayout of the VkImage captured by this
66 // GrBackendRenderTarget, they must call this function to notify Skia of the changed layout.
67 SK_API void SetVkImageLayout(GrBackendRenderTarget*, VkImageLayout);
68
69 } // namespace GrBackendRenderTargets
70
71 #endif