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 GrVkPipeline_DEFINED 9 #define GrVkPipeline_DEFINED 10 11 #include "include/gpu/vk/GrVkTypes.h" 12 #include "include/private/GrTypesPriv.h" 13 #include "src/gpu/vk/GrVkManagedResource.h" 14 15 class GrPipeline; 16 class GrPrimitiveProcessor; 17 class GrRenderTarget; 18 class GrXferProcessor; 19 class GrStencilSettings; 20 class GrVkCommandBuffer; 21 class GrVkGpu; 22 class GrVkRenderPass; 23 struct SkIRect; 24 25 class GrVkPipeline : public GrVkManagedResource { 26 public: 27 static GrVkPipeline* Create(GrVkGpu*, 28 const GrProgramInfo&, 29 VkPipelineShaderStageCreateInfo* shaderStageInfo, 30 int shaderStageCount, 31 VkRenderPass compatibleRenderPass, 32 VkPipelineLayout layout, 33 VkPipelineCache cache); 34 pipeline()35 VkPipeline pipeline() const { return fPipeline; } layout()36 VkPipelineLayout layout() const { return fPipelineLayout; } 37 38 static void SetDynamicScissorRectState(GrVkGpu*, GrVkCommandBuffer*, const GrRenderTarget*, 39 GrSurfaceOrigin, const SkIRect& scissorRect); 40 static void SetDynamicViewportState(GrVkGpu*, GrVkCommandBuffer*, const GrRenderTarget*); 41 static void SetDynamicBlendConstantState(GrVkGpu*, 42 GrVkCommandBuffer*, 43 const GrSwizzle& writeSwizzle, 44 const GrXferProcessor&); 45 46 #ifdef SK_TRACE_MANAGED_RESOURCES dumpInfo()47 void dumpInfo() const override { 48 SkDebugf("GrVkPipeline: %d (%d refs)\n", fPipeline, this->getRefCnt()); 49 } 50 #endif 51 52 protected: GrVkPipeline(const GrVkGpu * gpu,VkPipeline pipeline,VkPipelineLayout layout)53 GrVkPipeline(const GrVkGpu* gpu, VkPipeline pipeline, VkPipelineLayout layout) 54 : INHERITED(gpu), fPipeline(pipeline), fPipelineLayout(layout) {} 55 56 VkPipeline fPipeline; 57 VkPipelineLayout fPipelineLayout; 58 59 private: 60 void freeGPUData() const override; 61 62 typedef GrVkManagedResource INHERITED; 63 }; 64 65 #endif 66