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