blob: b00dd4b89703e8b12921b882342733edf334c898 [file] [log] [blame]
Greg Daniel164a9f02016-02-22 09:56:40 -05001/*
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 Salomonf4a00e42018-03-23 15:15:03 -040011#include "GrTypesPriv.h"
Greg Daniel164a9f02016-02-22 09:56:40 -050012#include "GrVkResource.h"
Greg Daniel487132b2018-12-20 14:09:36 -050013#include "vk/GrVkTypes.h"
Greg Daniel164a9f02016-02-22 09:56:40 -050014
Greg Daniel164a9f02016-02-22 09:56:40 -050015class GrPipeline;
16class GrPrimitiveProcessor;
Chris Dalton46983b72017-06-06 12:27:16 -060017class GrRenderTarget;
18class GrXferProcessor;
csmartdaltonc633abb2016-11-01 08:55:55 -070019class GrStencilSettings;
egdaniel470d77a2016-03-18 12:50:27 -070020class GrVkCommandBuffer;
Greg Daniel164a9f02016-02-22 09:56:40 -050021class GrVkGpu;
22class GrVkRenderPass;
Chris Dalton46983b72017-06-06 12:27:16 -060023struct SkIRect;
Greg Daniel164a9f02016-02-22 09:56:40 -050024
25class GrVkPipeline : public GrVkResource {
26public:
Robert Phillipsd0fe8752019-01-31 14:13:59 -050027 static GrVkPipeline* Create(GrVkGpu*,
28 int numColorSamples,
29 const GrPrimitiveProcessor&,
Greg Daniel164a9f02016-02-22 09:56:40 -050030 const GrPipeline& pipeline,
csmartdaltonc633abb2016-11-01 08:55:55 -070031 const GrStencilSettings&,
Greg Daniel164a9f02016-02-22 09:56:40 -050032 VkPipelineShaderStageCreateInfo* shaderStageInfo,
33 int shaderStageCount,
34 GrPrimitiveType primitiveType,
Greg Daniel99b88e02018-10-03 15:31:20 -040035 VkRenderPass compatibleRenderPass,
jvanverth03509ea2016-03-02 13:19:47 -080036 VkPipelineLayout layout,
37 VkPipelineCache cache);
Greg Daniel164a9f02016-02-22 09:56:40 -050038
39 VkPipeline pipeline() const { return fPipeline; }
40
Chris Dalton46983b72017-06-06 12:27:16 -060041 static void SetDynamicScissorRectState(GrVkGpu*, GrVkCommandBuffer*, const GrRenderTarget*,
Robert Phillipsb0e93a22017-08-29 08:26:54 -040042 GrSurfaceOrigin, SkIRect);
Jim Van Verth6a40abc2017-11-02 16:56:09 +000043 static void SetDynamicViewportState(GrVkGpu*, GrVkCommandBuffer*, const GrRenderTarget*);
Chris Dalton46983b72017-06-06 12:27:16 -060044 static void SetDynamicBlendConstantState(GrVkGpu*, GrVkCommandBuffer*, GrPixelConfig,
45 const GrXferProcessor&);
egdaniel470d77a2016-03-18 12:50:27 -070046
jvanverth7ec92412016-07-06 09:24:57 -070047#ifdef SK_TRACE_VK_RESOURCES
48 void dumpInfo() const override {
49 SkDebugf("GrVkPipeline: %d (%d refs)\n", fPipeline, this->getRefCnt());
50 }
51#endif
egdaniel470d77a2016-03-18 12:50:27 -070052
egdaniel12c75632016-09-19 13:39:34 -070053protected:
Greg Daniel164a9f02016-02-22 09:56:40 -050054 GrVkPipeline(VkPipeline pipeline) : INHERITED(), fPipeline(pipeline) {}
55
Greg Daniel164a9f02016-02-22 09:56:40 -050056 VkPipeline fPipeline;
57
egdaniel12c75632016-09-19 13:39:34 -070058private:
Ethan Nicholas8e265a72018-12-12 16:22:40 -050059 void freeGPUData(GrVkGpu* gpu) const override;
egdaniel12c75632016-09-19 13:39:34 -070060
Greg Daniel164a9f02016-02-22 09:56:40 -050061 typedef GrVkResource INHERITED;
62};
63
64#endif