From d5fa5d4dd48eb367e222eb6c71dd38dc63301175 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Wed, 4 Feb 2026 13:53:38 -0500 Subject: [PATCH] Add `.reset` to clarify intent. --- Outputs/OpenGL/Primitives/Shader.hpp | 7 +++++++ Outputs/OpenGL/Primitives/TextureTarget.hpp | 7 +++++++ Outputs/OpenGL/ScanTarget.cpp | 8 ++++---- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/Outputs/OpenGL/Primitives/Shader.hpp b/Outputs/OpenGL/Primitives/Shader.hpp index b58e3761e..e51613ce7 100644 --- a/Outputs/OpenGL/Primitives/Shader.hpp +++ b/Outputs/OpenGL/Primitives/Shader.hpp @@ -69,6 +69,9 @@ public: Shader &operator =(Shader &&); Shader() = default; + Shader(const Shader&) = delete; + Shader &operator =(const Shader &) = delete; + /*! Performs an @c glUseProgram to make this the active shader unless: (i) it was the previous shader bound; and @@ -149,6 +152,10 @@ public: return shader_program_ == 0; } + void reset() { + *this = Shader(); + } + private: void init( const std::string &vertex_shader, diff --git a/Outputs/OpenGL/Primitives/TextureTarget.hpp b/Outputs/OpenGL/Primitives/TextureTarget.hpp index 50894aa80..eef67a05f 100644 --- a/Outputs/OpenGL/Primitives/TextureTarget.hpp +++ b/Outputs/OpenGL/Primitives/TextureTarget.hpp @@ -41,6 +41,9 @@ public: TextureTarget(TextureTarget &&); TextureTarget &operator =(TextureTarget &&); + TextureTarget(const TextureTarget &) = delete; + TextureTarget &operator =(const TextureTarget &) = delete; + /*! Binds this target as a framebuffer and sets the @c glViewport accordingly. */ @@ -69,6 +72,10 @@ public: return framebuffer_ == 0; } + void reset() { + *this = TextureTarget(); + } + /*! Draws this texture to the currently-bound framebuffer, which has the aspect ratio @c aspect_ratio. This texture will fill the height of the frame buffer, and pick diff --git a/Outputs/OpenGL/ScanTarget.cpp b/Outputs/OpenGL/ScanTarget.cpp index c55f40771..9007e386b 100644 --- a/Outputs/OpenGL/ScanTarget.cpp +++ b/Outputs/OpenGL/ScanTarget.cpp @@ -314,7 +314,7 @@ void ScanTarget::setup_pipeline() { CompositionTextureUnit ); } else { - separation_shader_ = OpenGL::Shader(); + separation_shader_.reset(); } if(is_composite(modals.display_type) || is_svideo(modals.display_type)) { @@ -328,7 +328,7 @@ void ScanTarget::setup_pipeline() { is_svideo(modals.display_type) ? CompositionTextureUnit : SeparationTextureUnit ); } else { - demodulation_shader_ = OpenGL::Shader(); + demodulation_shader_.reset(); } } @@ -346,7 +346,7 @@ void ScanTarget::setup_pipeline() { false ); } else { - separation_buffer_ = TextureTarget(); + separation_buffer_.reset(); } if(is_composite(modals.display_type) || is_svideo(modals.display_type)) { @@ -359,7 +359,7 @@ void ScanTarget::setup_pipeline() { false ); } else { - demodulation_buffer_ = TextureTarget(); + demodulation_buffer_.reset(); } }