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 "GrTypes.h" 12 #include "GrVkDescriptorSetManager.h" 13 #include "vk/GrVkTypes.h" 14 15 class GrSurface; 16 class GrVkCopyPipeline; 17 class GrVkGpu; 18 class GrVkPipelineLayout; 19 class GrVkUniformBuffer; 20 class GrVkVertexBuffer; 21 struct SkIPoint; 22 struct SkIRect; 23 24 class GrVkCopyManager { 25 public: 26 GrVkCopyManager(); 27 28 ~GrVkCopyManager(); 29 30 bool copySurfaceAsDraw(GrVkGpu* gpu, 31 GrSurface* dst, GrSurfaceOrigin dstOrigin, 32 GrSurface* src, GrSurfaceOrigin srcOrigin, 33 const SkIRect& srcRect, const SkIPoint& dstPoint, 34 bool canDiscardOutsideDstRect); 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; 48 GrVkPipelineLayout* fPipelineLayout; 49 50 sk_sp<GrVkVertexBuffer> fVertexBuffer; 51 std::unique_ptr<GrVkUniformBuffer> fUniformBuffer; 52 }; 53 54 #endif 55