From 52bb516d5cd427b80e269c38339c63c8b7310d1e Mon Sep 17 00:00:00 2001 From: lisyarus Date: Wed, 30 Nov 2022 17:27:39 +0300 Subject: [PATCH] Initialize gfx objects id to 0 in class instead of constructor --- libs/gfx/include/psemek/gfx/array.hpp | 2 +- libs/gfx/include/psemek/gfx/buffer.hpp | 3 +-- libs/gfx/include/psemek/gfx/framebuffer.hpp | 2 +- libs/gfx/include/psemek/gfx/program.hpp | 3 +-- libs/gfx/include/psemek/gfx/renderbuffer.hpp | 2 +- libs/gfx/include/psemek/gfx/texture.hpp | 5 ++--- libs/gfx/source/array.cpp | 1 - libs/gfx/source/framebuffer.cpp | 1 - libs/gfx/source/renderbuffer.cpp | 1 - 9 files changed, 7 insertions(+), 13 deletions(-) diff --git a/libs/gfx/include/psemek/gfx/array.hpp b/libs/gfx/include/psemek/gfx/array.hpp index 3bfbf4e9..811865e2 100644 --- a/libs/gfx/include/psemek/gfx/array.hpp +++ b/libs/gfx/include/psemek/gfx/array.hpp @@ -28,7 +28,7 @@ namespace psemek::gfx void reset(); private: - GLuint id_; + GLuint id_ = 0; explicit array(std::nullptr_t); }; diff --git a/libs/gfx/include/psemek/gfx/buffer.hpp b/libs/gfx/include/psemek/gfx/buffer.hpp index 723a033e..5da857e0 100644 --- a/libs/gfx/include/psemek/gfx/buffer.hpp +++ b/libs/gfx/include/psemek/gfx/buffer.hpp @@ -122,11 +122,10 @@ namespace psemek::gfx } private: - GLuint id_; + GLuint id_ = 0; std::weak_ptr mapped_; explicit basic_buffer(std::nullptr_t) - : id_{0} {} }; diff --git a/libs/gfx/include/psemek/gfx/framebuffer.hpp b/libs/gfx/include/psemek/gfx/framebuffer.hpp index 16fe1d2c..bce4f2ce 100644 --- a/libs/gfx/include/psemek/gfx/framebuffer.hpp +++ b/libs/gfx/include/psemek/gfx/framebuffer.hpp @@ -71,7 +71,7 @@ namespace psemek::gfx } private: - GLuint id_; + GLuint id_ = 0; explicit framebuffer(std::nullptr_t); }; diff --git a/libs/gfx/include/psemek/gfx/program.hpp b/libs/gfx/include/psemek/gfx/program.hpp index f4f21aee..61e08409 100644 --- a/libs/gfx/include/psemek/gfx/program.hpp +++ b/libs/gfx/include/psemek/gfx/program.hpp @@ -120,12 +120,11 @@ namespace psemek::gfx void uniform_block_binding(GLuint index, GLuint binding) const; private: - GLuint program_; + GLuint program_ = 0; mutable boost::container::flat_map> uniforms_; mutable boost::container::flat_map> uniform_blocks_; program(std::nullptr_t) - : program_{0} {} }; diff --git a/libs/gfx/include/psemek/gfx/renderbuffer.hpp b/libs/gfx/include/psemek/gfx/renderbuffer.hpp index 483366ff..f12a39de 100644 --- a/libs/gfx/include/psemek/gfx/renderbuffer.hpp +++ b/libs/gfx/include/psemek/gfx/renderbuffer.hpp @@ -45,7 +45,7 @@ namespace psemek::gfx } private: - GLuint id_; + GLuint id_ = 0; geom::vector size_ = {0, 0}; explicit renderbuffer(std::nullptr_t); diff --git a/libs/gfx/include/psemek/gfx/texture.hpp b/libs/gfx/include/psemek/gfx/texture.hpp index 52caf8f3..be7da838 100644 --- a/libs/gfx/include/psemek/gfx/texture.hpp +++ b/libs/gfx/include/psemek/gfx/texture.hpp @@ -81,8 +81,8 @@ namespace psemek::gfx void clamp(); protected: - GLuint id_; - geom::vector size_; + GLuint id_ = 0; + geom::vector size_ = geom::vector::zero(); explicit basic_texture(std::nullptr_t); }; @@ -465,7 +465,6 @@ namespace psemek::gfx template basic_texture::basic_texture(std::nullptr_t) - : id_{0} {} inline buffer_texture::buffer_texture() diff --git a/libs/gfx/source/array.cpp b/libs/gfx/source/array.cpp index 8cd0dba1..b7a0ae50 100644 --- a/libs/gfx/source/array.cpp +++ b/libs/gfx/source/array.cpp @@ -48,7 +48,6 @@ namespace psemek::gfx } array::array(std::nullptr_t) - : id_{0} {} } diff --git a/libs/gfx/source/framebuffer.cpp b/libs/gfx/source/framebuffer.cpp index 345db3ce..40cd41b4 100644 --- a/libs/gfx/source/framebuffer.cpp +++ b/libs/gfx/source/framebuffer.cpp @@ -187,7 +187,6 @@ namespace psemek::gfx } framebuffer::framebuffer(std::nullptr_t) - : id_{0} {} } diff --git a/libs/gfx/source/renderbuffer.cpp b/libs/gfx/source/renderbuffer.cpp index de42b33c..7c951ea0 100644 --- a/libs/gfx/source/renderbuffer.cpp +++ b/libs/gfx/source/renderbuffer.cpp @@ -55,7 +55,6 @@ namespace psemek::gfx } renderbuffer::renderbuffer(std::nullptr_t) - : id_{0} {} }