utility::Cleanup: Replace "Nop"
A default constructor suffices where "Nop" was used, so it was removed.
This commit is contained in:
parent
d5d722022c
commit
d29d2434ab
3 changed files with 8 additions and 10 deletions
|
@ -456,8 +456,8 @@ image::Bl dither::blue_noise(int width, int height, int threads,
|
|||
// create compute pipeline.
|
||||
VkPipelineLayout compute_pipeline_layout;
|
||||
VkPipeline compute_pipeline;
|
||||
utility::Cleanup cleanup_pipeline_layout(utility::Cleanup::Nop{});
|
||||
utility::Cleanup cleanup_pipeline(utility::Cleanup::Nop{});
|
||||
utility::Cleanup cleanup_pipeline_layout{};
|
||||
utility::Cleanup cleanup_pipeline{};
|
||||
{
|
||||
VkShaderModuleCreateInfo shader_module_create_info{};
|
||||
shader_module_create_info.sType =
|
||||
|
@ -549,8 +549,8 @@ image::Bl dither::blue_noise(int width, int height, int threads,
|
|||
|
||||
VkBuffer precomputed_buf;
|
||||
VkDeviceMemory precomputed_buf_mem;
|
||||
utility::Cleanup cleanup_precomputed_buf(utility::Cleanup::Nop{});
|
||||
utility::Cleanup cleanup_precomputed_buf_mem(utility::Cleanup::Nop{});
|
||||
utility::Cleanup cleanup_precomputed_buf{};
|
||||
utility::Cleanup cleanup_precomputed_buf_mem{};
|
||||
{
|
||||
VkBuffer staging_buffer;
|
||||
VkDeviceMemory staging_buffer_mem;
|
||||
|
@ -647,8 +647,8 @@ image::Bl dither::blue_noise(int width, int height, int threads,
|
|||
|
||||
VkBuffer other_buf;
|
||||
VkDeviceMemory other_buf_mem;
|
||||
utility::Cleanup cleanup_other_buf(utility::Cleanup::Nop{});
|
||||
utility::Cleanup cleanup_other_buf_mem(utility::Cleanup::Nop{});
|
||||
utility::Cleanup cleanup_other_buf{};
|
||||
utility::Cleanup cleanup_other_buf_mem{};
|
||||
{
|
||||
VkBuffer staging_buffer;
|
||||
VkDeviceMemory staging_buffer_mem;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
utility::Cleanup::Cleanup(std::function<void(void *)> fn, void *ptr)
|
||||
: fn(fn), ptr(ptr) {}
|
||||
|
||||
utility::Cleanup::Cleanup(Nop) : fn(), ptr(nullptr) {}
|
||||
utility::Cleanup::Cleanup() : fn(), ptr(nullptr) {}
|
||||
|
||||
utility::Cleanup::~Cleanup() {
|
||||
if (this->fn.has_value()) {
|
||||
|
|
|
@ -33,10 +33,8 @@ inline float dist(int a, int b, int width) {
|
|||
|
||||
class Cleanup {
|
||||
public:
|
||||
struct Nop {};
|
||||
|
||||
Cleanup();
|
||||
Cleanup(std::function<void(void *)> fn, void *ptr);
|
||||
Cleanup(Nop nop);
|
||||
~Cleanup();
|
||||
|
||||
// allow move
|
||||
|
|
Loading…
Reference in a new issue