blob: b4788deee9e18c4b3dd6cbaab8c4b7c8c33b07a5 [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
11#include "GrTypes.h"
12
13#include "GrVkResource.h"
14
jvanverthe50f3e72016-03-28 07:03:06 -070015#include "vk/GrVkDefines.h"
Greg Daniel164a9f02016-02-22 09:56:40 -050016
17class GrNonInstancedVertices;
18class GrPipeline;
19class GrPrimitiveProcessor;
csmartdaltonc633abb2016-11-01 08:55:55 -070020class GrStencilSettings;
egdaniel470d77a2016-03-18 12:50:27 -070021class GrVkCommandBuffer;
Greg Daniel164a9f02016-02-22 09:56:40 -050022class GrVkGpu;
23class GrVkRenderPass;
24
25class GrVkPipeline : public GrVkResource {
26public:
halcanary9d524f22016-03-29 09:03:52 -070027 static GrVkPipeline* Create(GrVkGpu* gpu,
Greg Daniel164a9f02016-02-22 09:56:40 -050028 const GrPipeline& pipeline,
csmartdaltonc633abb2016-11-01 08:55:55 -070029 const GrStencilSettings&,
Greg Daniel164a9f02016-02-22 09:56:40 -050030 const GrPrimitiveProcessor& primProc,
31 VkPipelineShaderStageCreateInfo* shaderStageInfo,
32 int shaderStageCount,
33 GrPrimitiveType primitiveType,
34 const GrVkRenderPass& renderPass,
jvanverth03509ea2016-03-02 13:19:47 -080035 VkPipelineLayout layout,
36 VkPipelineCache cache);
Greg Daniel164a9f02016-02-22 09:56:40 -050037
38 VkPipeline pipeline() const { return fPipeline; }
39
egdaniel470d77a2016-03-18 12:50:27 -070040 static void SetDynamicState(GrVkGpu*, GrVkCommandBuffer*, const GrPipeline&);
41
jvanverth7ec92412016-07-06 09:24:57 -070042#ifdef SK_TRACE_VK_RESOURCES
43 void dumpInfo() const override {
44 SkDebugf("GrVkPipeline: %d (%d refs)\n", fPipeline, this->getRefCnt());
45 }
46#endif
egdaniel470d77a2016-03-18 12:50:27 -070047
egdaniel12c75632016-09-19 13:39:34 -070048protected:
Greg Daniel164a9f02016-02-22 09:56:40 -050049 GrVkPipeline(VkPipeline pipeline) : INHERITED(), fPipeline(pipeline) {}
50
Greg Daniel164a9f02016-02-22 09:56:40 -050051 VkPipeline fPipeline;
52
egdaniel12c75632016-09-19 13:39:34 -070053private:
54 void freeGPUData(const GrVkGpu* gpu) const override;
55
Greg Daniel164a9f02016-02-22 09:56:40 -050056 typedef GrVkResource INHERITED;
57};
58
59#endif