Make Vulkan class a global instance
This commit is contained in:
@@ -1,21 +1,21 @@
|
||||
#include "copium/sampler/DepthAttachment.h"
|
||||
|
||||
#include "copium/core/Device.h"
|
||||
#include "copium/core/Vulkan.h"
|
||||
#include "copium/sampler/Image.h"
|
||||
|
||||
namespace Copium
|
||||
{
|
||||
DepthAttachment::DepthAttachment(Vulkan& vulkan, int width, int height)
|
||||
: Sampler{vulkan}
|
||||
DepthAttachment::DepthAttachment(int width, int height)
|
||||
: Sampler{}
|
||||
{
|
||||
InitializeDepthAttachment(width, height);
|
||||
}
|
||||
|
||||
DepthAttachment::~DepthAttachment()
|
||||
{
|
||||
vkDestroyImage(vulkan.GetDevice(), image, nullptr);
|
||||
vkFreeMemory(vulkan.GetDevice(), imageMemory, nullptr);
|
||||
vkDestroyImageView(vulkan.GetDevice(), imageView, nullptr);
|
||||
vkDestroyImage(Vulkan::GetDevice(), image, nullptr);
|
||||
vkFreeMemory(Vulkan::GetDevice(), imageMemory, nullptr);
|
||||
vkDestroyImageView(Vulkan::GetDevice(), imageView, nullptr);
|
||||
}
|
||||
|
||||
VkDescriptorImageInfo DepthAttachment::GetDescriptorImageInfo(int index) const
|
||||
@@ -34,8 +34,8 @@ namespace Copium
|
||||
|
||||
void DepthAttachment::InitializeDepthAttachment(int width, int height)
|
||||
{
|
||||
VkFormat depthFormat = Image::SelectDepthFormat(vulkan);
|
||||
Image::InitializeImage(vulkan, width, height, depthFormat, VK_IMAGE_TILING_OPTIMAL, VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT | VK_IMAGE_USAGE_SAMPLED_BIT, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT, &image, &imageMemory);
|
||||
imageView = Image::InitializeImageView(vulkan, image, depthFormat, VK_IMAGE_ASPECT_DEPTH_BIT);
|
||||
VkFormat depthFormat = Image::SelectDepthFormat();
|
||||
Image::InitializeImage(width, height, depthFormat, VK_IMAGE_TILING_OPTIMAL, VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT | VK_IMAGE_USAGE_SAMPLED_BIT, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT, &image, &imageMemory);
|
||||
imageView = Image::InitializeImageView(image, depthFormat, VK_IMAGE_ASPECT_DEPTH_BIT);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user