From d19f26887d6de1922cc37fe62f62b27d977c67d5 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Mon, 20 Feb 2017 10:39:31 -0500 Subject: [PATCH] Performed a very naive shuffling of output builder sets onto the OpenGL queue. Which makes the frequency switcher work properly from it's possibly-contextless thread. --- Outputs/CRT/CRT.hpp | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/Outputs/CRT/CRT.hpp b/Outputs/CRT/CRT.hpp index f64562800..559c69a3e 100644 --- a/Outputs/CRT/CRT.hpp +++ b/Outputs/CRT/CRT.hpp @@ -233,7 +233,9 @@ class CRT { */ inline void set_openGL_context_will_change(bool should_delete_resources) { - openGL_output_builder_.set_openGL_context_will_change(should_delete_resources); + enqueue_openGL_function([should_delete_resources, this] { + openGL_output_builder_.set_openGL_context_will_change(should_delete_resources); + }); } /*! Sets a function that will map from whatever data the machine provided to a composite signal. @@ -245,7 +247,9 @@ class CRT { */ inline void set_composite_sampling_function(const std::string &shader) { - openGL_output_builder_.set_composite_sampling_function(shader); + enqueue_openGL_function([shader, this] { + openGL_output_builder_.set_composite_sampling_function(shader); + }); } /*! Sets a function that will map from whatever data the machine provided to an RGB signal. @@ -263,17 +267,23 @@ class CRT { */ inline void set_rgb_sampling_function(const std::string &shader) { - openGL_output_builder_.set_rgb_sampling_function(shader); + enqueue_openGL_function([shader, this] { + openGL_output_builder_.set_rgb_sampling_function(shader); + }); } inline void set_output_device(OutputDevice output_device) { - openGL_output_builder_.set_output_device(output_device); + enqueue_openGL_function([output_device, this] { + openGL_output_builder_.set_output_device(output_device); + }); } inline void set_visible_area(Rect visible_area) { - openGL_output_builder_.set_visible_area(visible_area); + enqueue_openGL_function([visible_area, this] { + openGL_output_builder_.set_visible_area(visible_area); + }); } Rect get_rect_for_area(int first_line_after_sync, int number_of_lines, int first_cycle_after_sync, int number_of_cycles, float aspect_ratio);