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 GrVkFramebuffer_DEFINED
9 #define GrVkFramebuffer_DEFINED
10 
11 #include "GrTypes.h"
12 #include "GrVkResource.h"
13 #include "vk/GrVkTypes.h"
14 
15 class GrVkGpu;
16 class GrVkImageView;
17 class GrVkRenderPass;
18 
19 class GrVkFramebuffer : public GrVkResource {
20 public:
21     static GrVkFramebuffer* Create(GrVkGpu* gpu,
22                                    int width, int height,
23                                    const GrVkRenderPass* renderPass,
24                                    const GrVkImageView* colorAttachment,
25                                    const GrVkImageView* stencilAttachment);
26 
framebuffer()27     VkFramebuffer framebuffer() const { return fFramebuffer; }
28 
29 #ifdef SK_TRACE_VK_RESOURCES
dumpInfo()30     void dumpInfo() const override {
31         SkDebugf("GrVkFramebuffer: %d (%d refs)\n", fFramebuffer, this->getRefCnt());
32     }
33 #endif
34 
35 private:
GrVkFramebuffer(VkFramebuffer framebuffer)36     GrVkFramebuffer(VkFramebuffer framebuffer) : INHERITED(), fFramebuffer(framebuffer) {}
37 
38     GrVkFramebuffer(const GrVkFramebuffer&);
39     GrVkFramebuffer& operator=(const GrVkFramebuffer&);
40 
41     void freeGPUData(GrVkGpu* gpu) const override;
42 
43     VkFramebuffer  fFramebuffer;
44 
45     typedef GrVkResource INHERITED;
46 };
47 
48 #endif
49