egdaniel | bc9b296 | 2016-09-27 08:00:53 -0700 | [diff] [blame] | 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 | |
Robert Phillips | b0e93a2 | 2017-08-29 08:26:54 -0400 | [diff] [blame] | 11 | #include "GrTypes.h" |
egdaniel | bc9b296 | 2016-09-27 08:00:53 -0700 | [diff] [blame] | 12 | #include "GrVkDescriptorSetManager.h" |
Greg Daniel | 487132b | 2018-12-20 14:09:36 -0500 | [diff] [blame] | 13 | #include "vk/GrVkTypes.h" |
egdaniel | bc9b296 | 2016-09-27 08:00:53 -0700 | [diff] [blame] | 14 | |
egdaniel | bc9b296 | 2016-09-27 08:00:53 -0700 | [diff] [blame] | 15 | class GrSurface; |
| 16 | class GrVkCopyPipeline; |
| 17 | class GrVkGpu; |
Greg Daniel | 7d918fd | 2018-06-19 15:22:01 -0400 | [diff] [blame] | 18 | class GrVkPipelineLayout; |
egdaniel | bc9b296 | 2016-09-27 08:00:53 -0700 | [diff] [blame] | 19 | class GrVkUniformBuffer; |
| 20 | class GrVkVertexBuffer; |
| 21 | struct SkIPoint; |
| 22 | struct SkIRect; |
| 23 | |
| 24 | class GrVkCopyManager { |
| 25 | public: |
Greg Daniel | f9f2723 | 2017-01-06 14:40:08 -0500 | [diff] [blame] | 26 | GrVkCopyManager(); |
| 27 | |
| 28 | ~GrVkCopyManager(); |
egdaniel | bc9b296 | 2016-09-27 08:00:53 -0700 | [diff] [blame] | 29 | |
| 30 | bool copySurfaceAsDraw(GrVkGpu* gpu, |
Robert Phillips | b0e93a2 | 2017-08-29 08:26:54 -0400 | [diff] [blame] | 31 | GrSurface* dst, GrSurfaceOrigin dstOrigin, |
| 32 | GrSurface* src, GrSurfaceOrigin srcOrigin, |
Greg Daniel | 55fa647 | 2018-03-16 16:13:10 -0400 | [diff] [blame] | 33 | const SkIRect& srcRect, const SkIPoint& dstPoint, |
| 34 | bool canDiscardOutsideDstRect); |
egdaniel | bc9b296 | 2016-09-27 08:00:53 -0700 | [diff] [blame] | 35 | |
| 36 | void destroyResources(GrVkGpu* gpu); |
| 37 | void abandonResources(); |
| 38 | |
| 39 | private: |
| 40 | bool createCopyProgram(GrVkGpu* gpu); |
| 41 | |
| 42 | // Everything below is only created once and shared by all copy draws/pipelines |
| 43 | VkShaderModule fVertShaderModule; |
| 44 | VkShaderModule fFragShaderModule; |
| 45 | VkPipelineShaderStageCreateInfo fShaderStageInfo[2]; |
| 46 | |
| 47 | GrVkDescriptorSetManager::Handle fSamplerDSHandle; |
Greg Daniel | 7d918fd | 2018-06-19 15:22:01 -0400 | [diff] [blame] | 48 | GrVkPipelineLayout* fPipelineLayout; |
egdaniel | bc9b296 | 2016-09-27 08:00:53 -0700 | [diff] [blame] | 49 | |
Hal Canary | 144caf5 | 2016-11-07 17:57:18 -0500 | [diff] [blame] | 50 | sk_sp<GrVkVertexBuffer> fVertexBuffer; |
Greg Daniel | f9f2723 | 2017-01-06 14:40:08 -0500 | [diff] [blame] | 51 | std::unique_ptr<GrVkUniformBuffer> fUniformBuffer; |
egdaniel | bc9b296 | 2016-09-27 08:00:53 -0700 | [diff] [blame] | 52 | }; |
| 53 | |
| 54 | #endif |