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 "GrTypes.h" 12 13 #include "GrVkResource.h" 14 15 #include "vk/GrVkDefines.h" 16 17 class GrNonInstancedVertices; 18 class GrPipeline; 19 class GrPrimitiveProcessor; 20 class GrStencilSettings; 21 class GrVkCommandBuffer; 22 class GrVkGpu; 23 class GrVkRenderPass; 24 25 class GrVkPipeline : public GrVkResource { 26 public: 27 static GrVkPipeline* Create(GrVkGpu* gpu, 28 const GrPipeline& pipeline, 29 const GrStencilSettings&, 30 const GrPrimitiveProcessor& primProc, 31 VkPipelineShaderStageCreateInfo* shaderStageInfo, 32 int shaderStageCount, 33 GrPrimitiveType primitiveType, 34 const GrVkRenderPass& renderPass, 35 VkPipelineLayout layout, 36 VkPipelineCache cache); 37 pipeline()38 VkPipeline pipeline() const { return fPipeline; } 39 40 static void SetDynamicState(GrVkGpu*, GrVkCommandBuffer*, const GrPipeline&); 41 42 #ifdef SK_TRACE_VK_RESOURCES dumpInfo()43 void dumpInfo() const override { 44 SkDebugf("GrVkPipeline: %d (%d refs)\n", fPipeline, this->getRefCnt()); 45 } 46 #endif 47 48 protected: GrVkPipeline(VkPipeline pipeline)49 GrVkPipeline(VkPipeline pipeline) : INHERITED(), fPipeline(pipeline) {} 50 51 VkPipeline fPipeline; 52 53 private: 54 void freeGPUData(const GrVkGpu* gpu) const override; 55 56 typedef GrVkResource INHERITED; 57 }; 58 59 #endif 60