Fling Engine  0.00.1
Fling Engine is a game engine written in Vulkan
DepthBuffer.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "FlingVulkan.h"
4 
5 namespace Fling
6 {
7  class LogicalDevice;
8 
9  class DepthBuffer
10  {
11  public:
12  explicit DepthBuffer(LogicalDevice* t_Dev, VkSampleCountFlagBits t_SampleCount, VkExtent2D t_Extents);
13 
14  ~DepthBuffer();
15 
16  FORCEINLINE const VkImage& GetVkImage() const { return m_Image; }
17  FORCEINLINE const VkDeviceMemory& GetVkMemory() const { return m_Memory; }
18  FORCEINLINE const VkImageView& GetVkImageView() const { return m_ImageView; }
19  FORCEINLINE const VkFormat& GetFormat() const { return m_Format; }
20 
21 
27  void Create();
28 
33  void Cleanup();
34 
35  static VkFormat GetDepthBufferFormat();
36 
37  void SetExtents(VkExtent2D t_Extents);
38 
39  private:
40 
41  void CreateImage();
42 
43  void CreateImageView();
44 
46 
47  VkImage m_Image = VK_NULL_HANDLE;
48  VkDeviceMemory m_Memory = VK_NULL_HANDLE;
49  VkImageView m_ImageView = VK_NULL_HANDLE;
50  VkFormat m_Format{};
51  VkExtent2D m_Extents{};
52 
53  VkSampleCountFlagBits m_SampleCount = VK_SAMPLE_COUNT_1_BIT;
54  };
55 } // namespace Fling
VkFormat m_Format
Definition: DepthBuffer.h:50
VkSampleCountFlagBits m_SampleCount
Definition: DepthBuffer.h:53
FORCEINLINE const VkImageView & GetVkImageView() const
Definition: DepthBuffer.h:18
void CreateImageView()
Definition: DepthBuffer.cpp:93
VkDeviceMemory m_Memory
Definition: DepthBuffer.h:48
void Cleanup()
Cleans up all Vulkan resources of this depth buffer.
Definition: DepthBuffer.cpp:41
const LogicalDevice * m_Device
Definition: DepthBuffer.h:45
A logical device represents the application view of the device.
Definition: LogicalDevice.h:13
FORCEINLINE const VkFormat & GetFormat() const
Definition: DepthBuffer.h:19
VkExtent2D m_Extents
Definition: DepthBuffer.h:51
void SetExtents(VkExtent2D t_Extents)
Definition: DepthBuffer.cpp:72
void Create()
Creates all VK resources.
Definition: DepthBuffer.cpp:17
~DepthBuffer()
Definition: DepthBuffer.cpp:36
FORCEINLINE const VkDeviceMemory & GetVkMemory() const
Definition: DepthBuffer.h:17
VkImage m_Image
Definition: DepthBuffer.h:47
DepthBuffer(LogicalDevice *t_Dev, VkSampleCountFlagBits t_SampleCount, VkExtent2D t_Extents)
Definition: DepthBuffer.cpp:8
Definition: Engine.h:29
FORCEINLINE const VkImage & GetVkImage() const
Definition: DepthBuffer.h:16
VkImageView m_ImageView
Definition: DepthBuffer.h:49
static VkFormat GetDepthBufferFormat()
Definition: DepthBuffer.cpp:63
void CreateImage()
Definition: DepthBuffer.cpp:77
Definition: DepthBuffer.h:9