diff --git a/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj b/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj index 1aafde12b..4e3de67d9 100644 --- a/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj +++ b/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj @@ -47,6 +47,7 @@ 4B4DC8211D2C2425003C5BF8 /* Vic20.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B4DC81F1D2C2425003C5BF8 /* Vic20.cpp */; }; 4B4DC8281D2C2470003C5BF8 /* C1540.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B4DC8261D2C2470003C5BF8 /* C1540.cpp */; }; 4B4DC82B1D2C27A4003C5BF8 /* SerialBus.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B4DC8291D2C27A4003C5BF8 /* SerialBus.cpp */; }; + 4B5073071DDD3B9400C48FBD /* ArrayBuilder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B5073051DDD3B9400C48FBD /* ArrayBuilder.cpp */; }; 4B55CE5D1C3B7D6F0093A61B /* CSOpenGLView.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B55CE5C1C3B7D6F0093A61B /* CSOpenGLView.m */; }; 4B55CE5F1C3B7D960093A61B /* MachineDocument.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B55CE5E1C3B7D960093A61B /* MachineDocument.swift */; }; 4B59199C1DAC6C46005BB85C /* OricTAP.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B59199A1DAC6C46005BB85C /* OricTAP.cpp */; }; @@ -486,6 +487,8 @@ 4B4DC8271D2C2470003C5BF8 /* C1540.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = C1540.hpp; sourceTree = ""; }; 4B4DC8291D2C27A4003C5BF8 /* SerialBus.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SerialBus.cpp; sourceTree = ""; }; 4B4DC82A1D2C27A4003C5BF8 /* SerialBus.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = SerialBus.hpp; sourceTree = ""; }; + 4B5073051DDD3B9400C48FBD /* ArrayBuilder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ArrayBuilder.cpp; sourceTree = ""; }; + 4B5073061DDD3B9400C48FBD /* ArrayBuilder.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = ArrayBuilder.hpp; sourceTree = ""; }; 4B55CE5B1C3B7D6F0093A61B /* CSOpenGLView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSOpenGLView.h; sourceTree = ""; }; 4B55CE5C1C3B7D6F0093A61B /* CSOpenGLView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CSOpenGLView.m; sourceTree = ""; }; 4B55CE5E1C3B7D960093A61B /* MachineDocument.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MachineDocument.swift; sourceTree = ""; }; @@ -1687,16 +1690,18 @@ 4BBF99071C8FBA6F0075DAFB /* Internals */ = { isa = PBXGroup; children = ( - 4BC3B74C1CD194CC00F86E85 /* Shaders */, - 4BBF99081C8FBA6F0075DAFB /* TextureBuilder.cpp */, - 4BBF99091C8FBA6F0075DAFB /* TextureBuilder.hpp */, + 4B5073051DDD3B9400C48FBD /* ArrayBuilder.cpp */, 4BBF990A1C8FBA6F0075DAFB /* CRTOpenGL.cpp */, + 4BBF99081C8FBA6F0075DAFB /* TextureBuilder.cpp */, + 4BBF99121C8FBA6F0075DAFB /* TextureTarget.cpp */, + 4B5073061DDD3B9400C48FBD /* ArrayBuilder.hpp */, + 4B0B6E121C9DBD5D00FFB60D /* CRTConstants.hpp */, 4BBF990B1C8FBA6F0075DAFB /* CRTOpenGL.hpp */, 4BBF990E1C8FBA6F0075DAFB /* Flywheel.hpp */, 4BBF990F1C8FBA6F0075DAFB /* OpenGL.hpp */, - 4BBF99121C8FBA6F0075DAFB /* TextureTarget.cpp */, + 4BBF99091C8FBA6F0075DAFB /* TextureBuilder.hpp */, 4BBF99131C8FBA6F0075DAFB /* TextureTarget.hpp */, - 4B0B6E121C9DBD5D00FFB60D /* CRTConstants.hpp */, + 4BC3B74C1CD194CC00F86E85 /* Shaders */, ); path = Internals; sourceTree = ""; @@ -1704,12 +1709,12 @@ 4BC3B74C1CD194CC00F86E85 /* Shaders */ = { isa = PBXGroup; children = ( - 4BC3B74D1CD194CC00F86E85 /* Shader.cpp */, - 4BC3B74E1CD194CC00F86E85 /* Shader.hpp */, - 4BC3B7501CD1956900F86E85 /* OutputShader.cpp */, - 4BC3B7511CD1956900F86E85 /* OutputShader.hpp */, 4BBB142F1CD2CECE00BDB55C /* IntermediateShader.cpp */, + 4BC3B7501CD1956900F86E85 /* OutputShader.cpp */, + 4BC3B74D1CD194CC00F86E85 /* Shader.cpp */, 4BBB14301CD2CECE00BDB55C /* IntermediateShader.hpp */, + 4BC3B7511CD1956900F86E85 /* OutputShader.hpp */, + 4BC3B74E1CD194CC00F86E85 /* Shader.hpp */, ); path = Shaders; sourceTree = ""; @@ -2353,6 +2358,7 @@ 4BA22B071D8817CE0008C640 /* Disk.cpp in Sources */, 4BC3B7521CD1956900F86E85 /* OutputShader.cpp in Sources */, 4B4C83701D4F623200CD541F /* D64.cpp in Sources */, + 4B5073071DDD3B9400C48FBD /* ArrayBuilder.cpp in Sources */, 4B14145B1B58879D00E04248 /* CPU6502.cpp in Sources */, 4BEE0A6F1D72496600532C7B /* Cartridge.cpp in Sources */, 4B8805FB1DCFF807003085B1 /* Oric.cpp in Sources */, diff --git a/Outputs/CRT/Internals/ArrayBuilder.cpp b/Outputs/CRT/Internals/ArrayBuilder.cpp new file mode 100644 index 000000000..dd7057e63 --- /dev/null +++ b/Outputs/CRT/Internals/ArrayBuilder.cpp @@ -0,0 +1,10 @@ +// +// ArrayBuilder.cpp +// Clock Signal +// +// Created by Thomas Harte on 17/11/2016. +// Copyright © 2016 Thomas Harte. All rights reserved. +// + +#include "ArrayBuilder.hpp" + diff --git a/Outputs/CRT/Internals/ArrayBuilder.hpp b/Outputs/CRT/Internals/ArrayBuilder.hpp new file mode 100644 index 000000000..97a7b2b63 --- /dev/null +++ b/Outputs/CRT/Internals/ArrayBuilder.hpp @@ -0,0 +1,45 @@ +// +// ArrayBuilder.hpp +// Clock Signal +// +// Created by Thomas Harte on 17/11/2016. +// Copyright © 2016 Thomas Harte. All rights reserved. +// + +#ifndef ArrayBuilder_hpp +#define ArrayBuilder_hpp + +#include +#include + +#include "OpenGL.hpp" + +namespace Outputs { +namespace CRT { + +class ArrayBuilder { + public: + ArrayBuilder(); + virtual ~ArrayBuilder(); + + uint8_t *get_input_storage(size_t size); + uint8_t *get_output_storage(size_t size); + void flush_storage(); + + void bind_input(); + void bind_output(); + void submit(); + + private: + struct { + std::vector data; + size_t allocated_data, completed_data; + GLuint buffer; + } output_, input_; + std::mutex buffer_mutex_; +}; + +} +} + +#endif /* ArrayBuilder_hpp */