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