vsg: include/vsg/vk/Framebuffer.h Source File

vsg 1.1.3 VulkanSceneGraph library

Loading...
Searching...
No Matches
Framebuffer.h
1#pragma once
2
3/* <editor-fold desc="MIT License">
4
5Copyright(c) 2018 Robert Osfield
6
7Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
8
9The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
10
11THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
12
13</editor-fold> */
14
15#include <vsg/state/ImageView.h>
16#include <vsg/vk/RenderPass.h>
17
18namespace vsg
19{
20
22 class VSG_DECLSPEC Framebuffer : public Inherit<Object, Framebuffer>
23 {
24 public:
25 Framebuffer(ref_ptr<RenderPass> renderPass, const ImageViews& attachments, uint32_t width, uint32_t height, uint32_t layers);
26
27 operator VkFramebuffer() const { return _framebuffer; }
28 VkFramebuffer vk() const { return _framebuffer; }
29
30 Device* getDevice() { return _device; }
31 const Device* getDevice() const { return _device; }
32
33 RenderPass* getRenderPass() { return _renderPass; }
34 const RenderPass* getRenderPass() const { return _renderPass; }
35
36 ImageViews& getAttachments() { return _attachments; }
37 const ImageViews& getAttachments() const { return _attachments; }
38
39 uint32_t width() const { return _width; }
40 uint32_t height() const { return _height; }
41 uint32_t layers() const { return _layers; }
42
43 VkExtent2D extent2D() const { return VkExtent2D{_width, _height}; }
44
45 protected:
46 virtual ~Framebuffer();
47
48 VkFramebuffer _framebuffer;
49 ref_ptr<Device> _device;
50
51 ref_ptr<RenderPass> _renderPass;
52 ImageViews _attachments;
53
54 const uint32_t _width;
55 const uint32_t _height;
56 const uint32_t _layers;
57 };
58 VSG_type_name(vsg::Framebuffer);
59
60} // namespace vsg
vsg::Device
Device encapsulates VkDevice, a logical handle to the PhysicalDevice with capabilities specified duri...
Definition Device.h:37
vsg::Framebuffer
Framebuffer encapsulates VkFramebuffer, used as a rendering target associated with a Window or for re...
Definition Framebuffer.h:23
vsg::Inherit
Definition Inherit.h:28
vsg::RenderPass
RenderPass encapsulation of VkRenderPass.
Definition RenderPass.h:86
vsg::ref_ptr
Definition ref_ptr.h:22