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