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 | |
Greg Daniel | 164a9f0 | 2016-02-22 09:56:40 -0500 | [diff] [blame] | 17 | class GrPipeline; |
| 18 | class GrPrimitiveProcessor; |
Chris Dalton | 46983b7 | 2017-06-06 12:27:16 -0600 | [diff] [blame] | 19 | class GrRenderTarget; |
| 20 | class GrXferProcessor; |
csmartdalton | c633abb | 2016-11-01 08:55:55 -0700 | [diff] [blame] | 21 | class GrStencilSettings; |
egdaniel | 470d77a | 2016-03-18 12:50:27 -0700 | [diff] [blame] | 22 | class GrVkCommandBuffer; |
Greg Daniel | 164a9f0 | 2016-02-22 09:56:40 -0500 | [diff] [blame] | 23 | class GrVkGpu; |
| 24 | class GrVkRenderPass; |
Chris Dalton | 46983b7 | 2017-06-06 12:27:16 -0600 | [diff] [blame] | 25 | struct SkIRect; |
Greg Daniel | 164a9f0 | 2016-02-22 09:56:40 -0500 | [diff] [blame] | 26 | |
| 27 | class GrVkPipeline : public GrVkResource { |
| 28 | public: |
halcanary | 9d524f2 | 2016-03-29 09:03:52 -0700 | [diff] [blame] | 29 | static GrVkPipeline* Create(GrVkGpu* gpu, |
Greg Daniel | 164a9f0 | 2016-02-22 09:56:40 -0500 | [diff] [blame] | 30 | const GrPipeline& pipeline, |
csmartdalton | c633abb | 2016-11-01 08:55:55 -0700 | [diff] [blame] | 31 | const GrStencilSettings&, |
Greg Daniel | 164a9f0 | 2016-02-22 09:56:40 -0500 | [diff] [blame] | 32 | const GrPrimitiveProcessor& primProc, |
| 33 | VkPipelineShaderStageCreateInfo* shaderStageInfo, |
| 34 | int shaderStageCount, |
| 35 | GrPrimitiveType primitiveType, |
| 36 | const GrVkRenderPass& renderPass, |
jvanverth | 03509ea | 2016-03-02 13:19:47 -0800 | [diff] [blame] | 37 | VkPipelineLayout layout, |
| 38 | VkPipelineCache cache); |
Greg Daniel | 164a9f0 | 2016-02-22 09:56:40 -0500 | [diff] [blame] | 39 | |
| 40 | VkPipeline pipeline() const { return fPipeline; } |
| 41 | |
Chris Dalton | 46983b7 | 2017-06-06 12:27:16 -0600 | [diff] [blame] | 42 | static void SetDynamicScissorRectState(GrVkGpu*, GrVkCommandBuffer*, const GrRenderTarget*, |
Robert Phillips | b0e93a2 | 2017-08-29 08:26:54 -0400 | [diff] [blame] | 43 | GrSurfaceOrigin, SkIRect); |
Jim Van Verth | 6a40abc | 2017-11-02 16:56:09 +0000 | [diff] [blame^] | 44 | static void SetDynamicViewportState(GrVkGpu*, GrVkCommandBuffer*, const GrRenderTarget*); |
Chris Dalton | 46983b7 | 2017-06-06 12:27:16 -0600 | [diff] [blame] | 45 | static void SetDynamicBlendConstantState(GrVkGpu*, GrVkCommandBuffer*, GrPixelConfig, |
| 46 | const GrXferProcessor&); |
egdaniel | 470d77a | 2016-03-18 12:50:27 -0700 | [diff] [blame] | 47 | |
jvanverth | 7ec9241 | 2016-07-06 09:24:57 -0700 | [diff] [blame] | 48 | #ifdef SK_TRACE_VK_RESOURCES |
| 49 | void dumpInfo() const override { |
| 50 | SkDebugf("GrVkPipeline: %d (%d refs)\n", fPipeline, this->getRefCnt()); |
| 51 | } |
| 52 | #endif |
egdaniel | 470d77a | 2016-03-18 12:50:27 -0700 | [diff] [blame] | 53 | |
egdaniel | 12c7563 | 2016-09-19 13:39:34 -0700 | [diff] [blame] | 54 | protected: |
Greg Daniel | 164a9f0 | 2016-02-22 09:56:40 -0500 | [diff] [blame] | 55 | GrVkPipeline(VkPipeline pipeline) : INHERITED(), fPipeline(pipeline) {} |
| 56 | |
Greg Daniel | 164a9f0 | 2016-02-22 09:56:40 -0500 | [diff] [blame] | 57 | VkPipeline fPipeline; |
| 58 | |
egdaniel | 12c7563 | 2016-09-19 13:39:34 -0700 | [diff] [blame] | 59 | private: |
| 60 | void freeGPUData(const GrVkGpu* gpu) const override; |
| 61 | |
Greg Daniel | 164a9f0 | 2016-02-22 09:56:40 -0500 | [diff] [blame] | 62 | typedef GrVkResource INHERITED; |
| 63 | }; |
| 64 | |
| 65 | #endif |