Greg Daniel | 164a9f0 | 2016-02-22 09:56:40 -0500 | [diff] [blame] | 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 | |
jvanverth | e50f3e7 | 2016-03-28 07:03:06 -0700 | [diff] [blame] | 15 | #include "vk/GrVkDefines.h" |
Greg Daniel | 164a9f0 | 2016-02-22 09:56:40 -0500 | [diff] [blame] | 16 | |
| 17 | class GrNonInstancedVertices; |
| 18 | class GrPipeline; |
| 19 | class GrPrimitiveProcessor; |
egdaniel | 470d77a | 2016-03-18 12:50:27 -0700 | [diff] [blame] | 20 | class GrVkCommandBuffer; |
Greg Daniel | 164a9f0 | 2016-02-22 09:56:40 -0500 | [diff] [blame] | 21 | class GrVkGpu; |
| 22 | class GrVkRenderPass; |
| 23 | |
| 24 | class GrVkPipeline : public GrVkResource { |
| 25 | public: |
halcanary | 9d524f2 | 2016-03-29 09:03:52 -0700 | [diff] [blame] | 26 | static GrVkPipeline* Create(GrVkGpu* gpu, |
Greg Daniel | 164a9f0 | 2016-02-22 09:56:40 -0500 | [diff] [blame] | 27 | const GrPipeline& pipeline, |
| 28 | const GrPrimitiveProcessor& primProc, |
| 29 | VkPipelineShaderStageCreateInfo* shaderStageInfo, |
| 30 | int shaderStageCount, |
| 31 | GrPrimitiveType primitiveType, |
| 32 | const GrVkRenderPass& renderPass, |
jvanverth | 03509ea | 2016-03-02 13:19:47 -0800 | [diff] [blame] | 33 | VkPipelineLayout layout, |
| 34 | VkPipelineCache cache); |
Greg Daniel | 164a9f0 | 2016-02-22 09:56:40 -0500 | [diff] [blame] | 35 | |
| 36 | VkPipeline pipeline() const { return fPipeline; } |
| 37 | |
egdaniel | 470d77a | 2016-03-18 12:50:27 -0700 | [diff] [blame] | 38 | static void SetDynamicState(GrVkGpu*, GrVkCommandBuffer*, const GrPipeline&); |
| 39 | |
jvanverth | 7ec9241 | 2016-07-06 09:24:57 -0700 | [diff] [blame] | 40 | #ifdef SK_TRACE_VK_RESOURCES |
| 41 | void dumpInfo() const override { |
| 42 | SkDebugf("GrVkPipeline: %d (%d refs)\n", fPipeline, this->getRefCnt()); |
| 43 | } |
| 44 | #endif |
egdaniel | 470d77a | 2016-03-18 12:50:27 -0700 | [diff] [blame] | 45 | |
egdaniel | 12c7563 | 2016-09-19 13:39:34 -0700 | [diff] [blame] | 46 | protected: |
Greg Daniel | 164a9f0 | 2016-02-22 09:56:40 -0500 | [diff] [blame] | 47 | GrVkPipeline(VkPipeline pipeline) : INHERITED(), fPipeline(pipeline) {} |
| 48 | |
Greg Daniel | 164a9f0 | 2016-02-22 09:56:40 -0500 | [diff] [blame] | 49 | VkPipeline fPipeline; |
| 50 | |
egdaniel | 12c7563 | 2016-09-19 13:39:34 -0700 | [diff] [blame] | 51 | private: |
| 52 | void freeGPUData(const GrVkGpu* gpu) const override; |
| 53 | |
Greg Daniel | 164a9f0 | 2016-02-22 09:56:40 -0500 | [diff] [blame] | 54 | typedef GrVkResource INHERITED; |
| 55 | }; |
| 56 | |
| 57 | #endif |