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