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 14 #include "vk/GrVkDefines.h" 15 16 class GrSurface; 17 class GrVkCopyPipeline; 18 class GrVkGpu; 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 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