Vulkan: Favor default initializers.

This commit is contained in:
BearOso 2024-10-22 14:27:23 -05:00
parent 932b093d98
commit 170a6aa1a4
14 changed files with 7 additions and 79 deletions

View File

@ -19,14 +19,6 @@
using std::string;
using std::to_string;
SlangPreset::SlangPreset()
{
}
SlangPreset::~SlangPreset()
{
}
bool SlangPreset::load_preset_file(string filename)
{
if (!ends_with(filename, ".slangp"))

View File

@ -7,9 +7,6 @@
struct SlangPreset
{
SlangPreset();
~SlangPreset();
void print();
bool load_preset_file(std::string filename);
bool introspect();

View File

@ -4,14 +4,6 @@
#include <cstring>
#include <charconv>
IniFile::IniFile()
{
}
IniFile::~IniFile()
{
}
static std::string trim_comments(std::string str)
{
for (auto &comment : { "//", "#" })

View File

@ -4,8 +4,6 @@
struct IniFile
{
IniFile();
~IniFile();
bool load_file(std::string filename);
std::string get_string(std::string key, std::string default_string);
int get_int(std::string key, int default_int);

View File

@ -14,15 +14,6 @@
using std::string;
using std::vector;
SlangShader::SlangShader()
{
ubo_size = 0;
}
SlangShader::~SlangShader()
{
}
/*
Recursively load shader file and included files into memory, applying
#include and #pragma directives. Will strip all directives except

View File

@ -65,9 +65,6 @@ struct SlangShader
Fragment
};
SlangShader();
~SlangShader();
bool preprocess_shader_file(std::string filename, std::vector<std::string> &lines);
void set_base_path(std::string filename);
bool load_file(std::string new_filename = "");

View File

@ -7,18 +7,6 @@
namespace Vulkan
{
PipelineImage::PipelineImage()
{
image_width = 0;
image_height = 0;
device = nullptr;
command_pool = nullptr;
allocator = nullptr;
queue = nullptr;
image = nullptr;
current_layout = vk::ImageLayout::eUndefined;
}
PipelineImage::~PipelineImage()
{
destroy();

View File

@ -6,7 +6,7 @@ namespace Vulkan
struct PipelineImage
{
PipelineImage();
PipelineImage() = default;
void init(vk::Device device, vk::CommandPool command, vk::Queue queue, vma::Allocator allocator);
void init(Vulkan::Context *context);
~PipelineImage();

View File

@ -65,18 +65,6 @@ vk::SamplerAddressMode wrap_mode_from_string(std::string s)
return vk::SamplerAddressMode::eClampToBorder;
}
SlangPipeline::SlangPipeline()
{
device = nullptr;
shader = nullptr;
uniform_buffer = nullptr;
uniform_buffer_allocation = nullptr;
source_width = 0;
source_height = 0;
destination_width = 0;
destination_height = 0;
}
void SlangPipeline::init(Context *context_, SlangShader *shader_)
{
this->context = context_;

View File

@ -10,7 +10,7 @@ namespace Vulkan
class SlangPipeline
{
public:
SlangPipeline();
SlangPipeline() = default;
void init(Context *context_, SlangShader *shader_);
~SlangPipeline();

View File

@ -12,7 +12,6 @@ Swapchain::Swapchain(Context &context_)
command_pool(context.command_pool.get()),
surface(context.surface.get())
{
end_render_pass_function = nullptr;
}
Swapchain::~Swapchain()

View File

@ -41,7 +41,7 @@ class Swapchain
vk::RenderPass &get_render_pass();
private:
std::function<void()> end_render_pass_function;
std::function<void()> end_render_pass_function = nullptr;
void create_render_pass();
struct Frame
@ -79,11 +79,11 @@ class Swapchain
std::vector<ImageData> image_data;
Vulkan::Context &context;
vk::SurfaceKHR &surface;
vk::Device &device;
vk::CommandPool &command_pool;
vk::PhysicalDevice &physical_device;
vk::Queue &queue;
vk::PhysicalDevice &physical_device;
vk::CommandPool &command_pool;
vk::SurfaceKHR &surface;
};
} // namespace Vulkan

View File

@ -7,20 +7,6 @@
namespace Vulkan
{
Texture::Texture()
{
image_width = 0;
image_height = 0;
buffer_size = 0;
device = nullptr;
command_pool = nullptr;
allocator = nullptr;
queue = nullptr;
buffer = nullptr;
image = nullptr;
sampler = nullptr;
}
Texture::~Texture()
{
destroy();

View File

@ -7,7 +7,7 @@ namespace Vulkan
struct Texture
{
Texture();
Texture() = default;
void init(vk::Device device, vk::CommandPool command, vk::Queue queue, vma::Allocator allocator);
void init(Context *context);
~Texture();