blob: bec4aeb6002fcec20333d4ca6d0de128370e6525 [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
Greg Daniel164a9f02016-02-22 09:56:40 -050046private:
47 GrVkPipeline(VkPipeline pipeline) : INHERITED(), fPipeline(pipeline) {}
48
49 GrVkPipeline(const GrVkPipeline&);
50 GrVkPipeline& operator=(const GrVkPipeline&);
51
52 void freeGPUData(const GrVkGpu* gpu) const override;
53
54 VkPipeline fPipeline;
55
56 typedef GrVkResource INHERITED;
57};
58
59#endif