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/GrVkResource.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 GrVkResource { 26 public: 27 static GrVkPipeline* Create(GrVkGpu*, 28 const GrProgramInfo&, 29 const GrStencilSettings&, 30 VkPipelineShaderStageCreateInfo* shaderStageInfo, 31 int shaderStageCount, 32 GrPrimitiveType primitiveType, 33 VkRenderPass compatibleRenderPass, 34 VkPipelineLayout layout, 35 VkPipelineCache cache); 36 pipeline()37 VkPipeline pipeline() const { return fPipeline; } layout()38 VkPipelineLayout layout() const { return fPipelineLayout; } 39 40 static void SetDynamicScissorRectState(GrVkGpu*, GrVkCommandBuffer*, const GrRenderTarget*, 41 GrSurfaceOrigin, const SkIRect& scissorRect); 42 static void SetDynamicViewportState(GrVkGpu*, GrVkCommandBuffer*, const GrRenderTarget*); 43 static void SetDynamicBlendConstantState(GrVkGpu*, GrVkCommandBuffer*, 44 const GrSwizzle& outputSwizzle, 45 const GrXferProcessor&); 46 47 #ifdef SK_TRACE_VK_RESOURCES dumpInfo()48 void dumpInfo() const override { 49 SkDebugf("GrVkPipeline: %d (%d refs)\n", fPipeline, this->getRefCnt()); 50 } 51 #endif 52 53 protected: GrVkPipeline(VkPipeline pipeline,VkPipelineLayout layout)54 GrVkPipeline(VkPipeline pipeline, VkPipelineLayout layout) 55 : INHERITED(), fPipeline(pipeline), fPipelineLayout(layout) {} 56 57 VkPipeline fPipeline; 58 VkPipelineLayout fPipelineLayout; 59 60 private: 61 void freeGPUData(GrVkGpu* gpu) const override; 62 63 typedef GrVkResource INHERITED; 64 }; 65 66 #endif 67