blob: 2565185712d1d7ee41a3a1993ed6ac139342bc48 [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;
egdaniel470d77a2016-03-18 12:50:27 -070020class GrVkCommandBuffer;
Greg Daniel164a9f02016-02-22 09:56:40 -050021class GrVkGpu;
22class GrVkRenderPass;
23
24class GrVkPipeline : public GrVkResource {
25public:
halcanary9d524f22016-03-29 09:03:52 -070026 static GrVkPipeline* Create(GrVkGpu* gpu,
Greg Daniel164a9f02016-02-22 09:56:40 -050027 const GrPipeline& pipeline,
28 const GrPrimitiveProcessor& primProc,
29 VkPipelineShaderStageCreateInfo* shaderStageInfo,
30 int shaderStageCount,
31 GrPrimitiveType primitiveType,
32 const GrVkRenderPass& renderPass,
jvanverth03509ea2016-03-02 13:19:47 -080033 VkPipelineLayout layout,
34 VkPipelineCache cache);
Greg Daniel164a9f02016-02-22 09:56:40 -050035
36 VkPipeline pipeline() const { return fPipeline; }
37
egdaniel470d77a2016-03-18 12:50:27 -070038 static void SetDynamicState(GrVkGpu*, GrVkCommandBuffer*, const GrPipeline&);
39
jvanverth7ec92412016-07-06 09:24:57 -070040#ifdef SK_TRACE_VK_RESOURCES
41 void dumpInfo() const override {
42 SkDebugf("GrVkPipeline: %d (%d refs)\n", fPipeline, this->getRefCnt());
43 }
44#endif
egdaniel470d77a2016-03-18 12:50:27 -070045
egdaniel12c75632016-09-19 13:39:34 -070046protected:
Greg Daniel164a9f02016-02-22 09:56:40 -050047 GrVkPipeline(VkPipeline pipeline) : INHERITED(), fPipeline(pipeline) {}
48
Greg Daniel164a9f02016-02-22 09:56:40 -050049 VkPipeline fPipeline;
50
egdaniel12c75632016-09-19 13:39:34 -070051private:
52 void freeGPUData(const GrVkGpu* gpu) const override;
53
Greg Daniel164a9f02016-02-22 09:56:40 -050054 typedef GrVkResource INHERITED;
55};
56
57#endif