xref: /aosp_15_r20/external/skia/src/gpu/ganesh/vk/GrVkMSAALoadManager.h (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
1 /*
2  * Copyright 2020 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 GrVkMSAALoadManager_DEFINED
9 #define GrVkMSAALoadManager_DEFINED
10 
11 #include "include/private/gpu/vk/SkiaVulkan.h"
12 
13 class GrAttachment;
14 class GrVkCommandBuffer;
15 class GrVkGpu;
16 class GrVkImage;
17 class GrVkRenderPass;
18 struct SkIRect;
19 
20 class GrVkMSAALoadManager {
21 public:
22     GrVkMSAALoadManager();
23 
24     ~GrVkMSAALoadManager();
25 
26     bool loadMSAAFromResolve(GrVkGpu* gpu,
27                              GrVkCommandBuffer* commandBuffer,
28                              const GrVkRenderPass& renderPass,
29                              GrAttachment* dst,
30                              GrVkImage* src,
31                              const SkIRect& srcRect);
32 
33     void destroyResources(GrVkGpu* gpu);
34 
35 private:
36     bool createMSAALoadProgram(GrVkGpu* gpu);
37 
38     // Everything below is only created once and shared by all msaa load pipelines
39     VkShaderModule fVertShaderModule;
40     VkShaderModule fFragShaderModule;
41     VkPipelineShaderStageCreateInfo fShaderStageInfo[2];
42 
43     // All pipelines used by this class use the same VkPipelineLayout. Therefore, unlike regular
44     // GrVkPipelines, we have the manager own the layout instead of the GrVkPipeline.
45     VkPipelineLayout fPipelineLayout;
46 };
47 
48 #endif
49 
50