diff --git a/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj b/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj index fd3a1442f..1aafde12b 100644 --- a/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj +++ b/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj @@ -352,7 +352,7 @@ 4BB73EB71B587A5100552FC2 /* AllSuiteATests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BB73EB61B587A5100552FC2 /* AllSuiteATests.swift */; }; 4BB73EC21B587A5100552FC2 /* Clock_SignalUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BB73EC11B587A5100552FC2 /* Clock_SignalUITests.swift */; }; 4BBB14311CD2CECE00BDB55C /* IntermediateShader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BBB142F1CD2CECE00BDB55C /* IntermediateShader.cpp */; }; - 4BBF99141C8FBA6F0075DAFB /* InputTextureBuilder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BBF99081C8FBA6F0075DAFB /* InputTextureBuilder.cpp */; }; + 4BBF99141C8FBA6F0075DAFB /* TextureBuilder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BBF99081C8FBA6F0075DAFB /* TextureBuilder.cpp */; }; 4BBF99151C8FBA6F0075DAFB /* CRTOpenGL.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BBF990A1C8FBA6F0075DAFB /* CRTOpenGL.cpp */; }; 4BBF99181C8FBA6F0075DAFB /* TextureTarget.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BBF99121C8FBA6F0075DAFB /* TextureTarget.cpp */; }; 4BC3B74F1CD194CC00F86E85 /* Shader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BC3B74D1CD194CC00F86E85 /* Shader.cpp */; }; @@ -828,8 +828,8 @@ 4BBB142F1CD2CECE00BDB55C /* IntermediateShader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IntermediateShader.cpp; sourceTree = ""; }; 4BBB14301CD2CECE00BDB55C /* IntermediateShader.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = IntermediateShader.hpp; sourceTree = ""; }; 4BBC34241D2208B100FFC9DF /* CSFastLoading.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSFastLoading.h; sourceTree = ""; }; - 4BBF99081C8FBA6F0075DAFB /* InputTextureBuilder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InputTextureBuilder.cpp; sourceTree = ""; }; - 4BBF99091C8FBA6F0075DAFB /* InputTextureBuilder.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = InputTextureBuilder.hpp; sourceTree = ""; }; + 4BBF99081C8FBA6F0075DAFB /* TextureBuilder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TextureBuilder.cpp; sourceTree = ""; }; + 4BBF99091C8FBA6F0075DAFB /* TextureBuilder.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = TextureBuilder.hpp; sourceTree = ""; }; 4BBF990A1C8FBA6F0075DAFB /* CRTOpenGL.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CRTOpenGL.cpp; sourceTree = ""; }; 4BBF990B1C8FBA6F0075DAFB /* CRTOpenGL.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = CRTOpenGL.hpp; sourceTree = ""; }; 4BBF990E1C8FBA6F0075DAFB /* Flywheel.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = Flywheel.hpp; sourceTree = ""; }; @@ -1688,8 +1688,8 @@ isa = PBXGroup; children = ( 4BC3B74C1CD194CC00F86E85 /* Shaders */, - 4BBF99081C8FBA6F0075DAFB /* InputTextureBuilder.cpp */, - 4BBF99091C8FBA6F0075DAFB /* InputTextureBuilder.hpp */, + 4BBF99081C8FBA6F0075DAFB /* TextureBuilder.cpp */, + 4BBF99091C8FBA6F0075DAFB /* TextureBuilder.hpp */, 4BBF990A1C8FBA6F0075DAFB /* CRTOpenGL.cpp */, 4BBF990B1C8FBA6F0075DAFB /* CRTOpenGL.hpp */, 4BBF990E1C8FBA6F0075DAFB /* Flywheel.hpp */, @@ -2320,7 +2320,7 @@ 4BE77A2E1D84ADFB00BC3827 /* File.cpp in Sources */, 4BAB62B51D327F7E00DF5BA0 /* G64.cpp in Sources */, 4BD468F71D8DF41D0084958B /* 1770.cpp in Sources */, - 4BBF99141C8FBA6F0075DAFB /* InputTextureBuilder.cpp in Sources */, + 4BBF99141C8FBA6F0075DAFB /* TextureBuilder.cpp in Sources */, 4B2409551C45AB05004DA684 /* Speaker.cpp in Sources */, 4BCF1FA81DADC5250039D2E7 /* CSOric.mm in Sources */, 4B6C73BD1D387AE500AFCFCA /* DiskController.cpp in Sources */, diff --git a/Outputs/CRT/Internals/CRTOpenGL.cpp b/Outputs/CRT/Internals/CRTOpenGL.cpp index ec772821e..683eb8f32 100644 --- a/Outputs/CRT/Internals/CRTOpenGL.cpp +++ b/Outputs/CRT/Internals/CRTOpenGL.cpp @@ -78,10 +78,9 @@ OpenGLOutputBuilder::OpenGLOutputBuilder(unsigned int buffer_depth) : _rgb_shader(nullptr), _last_output_width(0), _last_output_height(0), - _fence(nullptr) + _fence(nullptr), + _texture_builder(new TextureBuilder(buffer_depth)) { - _texture_builder.reset(new InputTextureBuilder(buffer_depth)); - _output_buffer.data.resize(OutputVertexBufferDataSize); _source_buffer.data.resize(SourceVertexBufferDataSize); diff --git a/Outputs/CRT/Internals/CRTOpenGL.hpp b/Outputs/CRT/Internals/CRTOpenGL.hpp index ac05966f6..590e6bf18 100644 --- a/Outputs/CRT/Internals/CRTOpenGL.hpp +++ b/Outputs/CRT/Internals/CRTOpenGL.hpp @@ -14,7 +14,7 @@ #include "OpenGL.hpp" #include "TextureTarget.hpp" #include "Shader.hpp" -#include "InputTextureBuilder.hpp" +#include "TextureBuilder.hpp" #include "Shaders/OutputShader.hpp" #include "Shaders/IntermediateShader.hpp" @@ -57,7 +57,7 @@ class OpenGLOutputBuilder { void prepare_source_vertex_array(); // the run and input data buffers - std::unique_ptr _texture_builder; + std::unique_ptr _texture_builder; std::unique_ptr _output_mutex; std::unique_ptr _draw_mutex; diff --git a/Outputs/CRT/Internals/Shaders/Shader.hpp b/Outputs/CRT/Internals/Shaders/Shader.hpp index b28335032..947b47326 100644 --- a/Outputs/CRT/Internals/Shaders/Shader.hpp +++ b/Outputs/CRT/Internals/Shaders/Shader.hpp @@ -12,7 +12,7 @@ #include "OpenGL.hpp" #include #include -#include +#include #include namespace OpenGL { @@ -110,7 +110,7 @@ private: GLuint _shader_program; void flush_functions(); - std::list> _enqueued_functions; + std::vector> _enqueued_functions; std::mutex _function_mutex; protected: diff --git a/Outputs/CRT/Internals/InputTextureBuilder.cpp b/Outputs/CRT/Internals/TextureBuilder.cpp similarity index 81% rename from Outputs/CRT/Internals/InputTextureBuilder.cpp rename to Outputs/CRT/Internals/TextureBuilder.cpp index 2a027ffaa..c55df69d8 100644 --- a/Outputs/CRT/Internals/InputTextureBuilder.cpp +++ b/Outputs/CRT/Internals/TextureBuilder.cpp @@ -1,18 +1,18 @@ // -// InputTextureBuilder.cpp +// TextureBuilder.cpp // Clock Signal // // Created by Thomas Harte on 08/03/2016. // Copyright © 2016 Thomas Harte. All rights reserved. // -#include "InputTextureBuilder.hpp" +#include "TextureBuilder.hpp" #include "CRTOpenGL.hpp" #include using namespace Outputs::CRT; -InputTextureBuilder::InputTextureBuilder(size_t bytes_per_pixel) : +TextureBuilder::TextureBuilder(size_t bytes_per_pixel) : _bytes_per_pixel(bytes_per_pixel), _next_write_x_position(0), _next_write_y_position(0) @@ -20,7 +20,7 @@ InputTextureBuilder::InputTextureBuilder(size_t bytes_per_pixel) : _image.resize(bytes_per_pixel * InputBufferBuilderWidth * InputBufferBuilderHeight); } -uint8_t *InputTextureBuilder::allocate_write_area(size_t required_length) +uint8_t *TextureBuilder::allocate_write_area(size_t required_length) { if(_next_write_y_position != InputBufferBuilderHeight) { @@ -45,12 +45,12 @@ uint8_t *InputTextureBuilder::allocate_write_area(size_t required_length) return &_image[_write_target_pointer * _bytes_per_pixel]; } -bool InputTextureBuilder::is_full() +bool TextureBuilder::is_full() { return (_next_write_y_position == InputBufferBuilderHeight); } -void InputTextureBuilder::reduce_previous_allocation_to(size_t actual_length) +void TextureBuilder::reduce_previous_allocation_to(size_t actual_length) { if(_next_write_y_position == InputBufferBuilderHeight) return; @@ -81,29 +81,29 @@ void InputTextureBuilder::reduce_previous_allocation_to(size_t actual_length) _next_write_x_position -= (_last_allocation_amount - actual_length); } -uint8_t *InputTextureBuilder::get_image_pointer() +uint8_t *TextureBuilder::get_image_pointer() { return _image.data(); } -uint16_t InputTextureBuilder::get_and_finalise_current_line() +uint16_t TextureBuilder::get_and_finalise_current_line() { uint16_t result = _write_y_position + (_next_write_x_position ? 1 : 0); _next_write_x_position = _next_write_y_position = 0; return result; } -uint16_t InputTextureBuilder::get_last_write_x_position() +uint16_t TextureBuilder::get_last_write_x_position() { return _write_x_position; } -uint16_t InputTextureBuilder::get_last_write_y_position() +uint16_t TextureBuilder::get_last_write_y_position() { return _write_y_position; } -size_t InputTextureBuilder::get_bytes_per_pixel() +size_t TextureBuilder::get_bytes_per_pixel() { return _bytes_per_pixel; } diff --git a/Outputs/CRT/Internals/InputTextureBuilder.hpp b/Outputs/CRT/Internals/TextureBuilder.hpp similarity index 92% rename from Outputs/CRT/Internals/InputTextureBuilder.hpp rename to Outputs/CRT/Internals/TextureBuilder.hpp index 5dc930dd5..26ad25b51 100644 --- a/Outputs/CRT/Internals/InputTextureBuilder.hpp +++ b/Outputs/CRT/Internals/TextureBuilder.hpp @@ -1,13 +1,13 @@ // -// InputTextureBuilder.hpp +// TextureBuilder.hpp // Clock Signal // // Created by Thomas Harte on 08/03/2016. // Copyright © 2016 Thomas Harte. All rights reserved. // -#ifndef Outputs_CRT_Internals_InputBufferBuilder_hpp -#define Outputs_CRT_Internals_InputBufferBuilder_hpp +#ifndef Outputs_CRT_Internals_TextureBuilder_hpp +#define Outputs_CRT_Internals_TextureBuilder_hpp #include #include @@ -24,10 +24,10 @@ namespace CRT { with runs of data, ensuring each run is neighboured immediately to the left and right by copies of its first and last pixels. */ -class InputTextureBuilder { +class TextureBuilder { public: /// Constructs an instance of InputTextureBuilder that contains a texture of colour depth @c bytes_per_pixel. - InputTextureBuilder(size_t bytes_per_pixel); + TextureBuilder(size_t bytes_per_pixel); /// Finds the first available space of at least @c required_length pixels in size. Calls must be paired off /// with calls to @c reduce_previous_allocation_to.