• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2016 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 GrVkCopyManager_DEFINED
9 #define GrVkCopyManager_DEFINED
10 
11 #include "GrVkDescriptorSetManager.h"
12 
13 #include "vk/GrVkDefines.h"
14 
15 class GrSurface;
16 class GrVkCopyPipeline;
17 class GrVkGpu;
18 class GrVkUniformBuffer;
19 class GrVkVertexBuffer;
20 struct SkIPoint;
21 struct SkIRect;
22 
23 class GrVkCopyManager {
24 public:
25     GrVkCopyManager();
26 
27     ~GrVkCopyManager();
28 
29     bool copySurfaceAsDraw(GrVkGpu* gpu,
30                            GrSurface* dst,
31                            GrSurface* src,
32                            const SkIRect& srcRect,
33                            const SkIPoint& dstPoint);
34 
35     void destroyResources(GrVkGpu* gpu);
36     void abandonResources();
37 
38 private:
39     bool createCopyProgram(GrVkGpu* gpu);
40 
41     // Everything below is only created once and shared by all copy draws/pipelines
42     VkShaderModule fVertShaderModule;
43     VkShaderModule fFragShaderModule;
44     VkPipelineShaderStageCreateInfo fShaderStageInfo[2];
45 
46     GrVkDescriptorSetManager::Handle fSamplerDSHandle;
47     VkPipelineLayout fPipelineLayout;
48 
49     sk_sp<GrVkVertexBuffer> fVertexBuffer;
50     std::unique_ptr<GrVkUniformBuffer> fUniformBuffer;
51 };
52 
53 #endif
54