1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-12-26 09:29:45 +00:00

Even better: why include the 'Input' prefix when there's only one?

This commit is contained in:
Thomas Harte 2016-11-16 22:57:17 +08:00
parent 04b2688683
commit 5c5e44874f
6 changed files with 28 additions and 29 deletions

View File

@ -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 = "<group>"; };
4BBB14301CD2CECE00BDB55C /* IntermediateShader.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = IntermediateShader.hpp; sourceTree = "<group>"; };
4BBC34241D2208B100FFC9DF /* CSFastLoading.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSFastLoading.h; sourceTree = "<group>"; };
4BBF99081C8FBA6F0075DAFB /* InputTextureBuilder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InputTextureBuilder.cpp; sourceTree = "<group>"; };
4BBF99091C8FBA6F0075DAFB /* InputTextureBuilder.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = InputTextureBuilder.hpp; sourceTree = "<group>"; };
4BBF99081C8FBA6F0075DAFB /* TextureBuilder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TextureBuilder.cpp; sourceTree = "<group>"; };
4BBF99091C8FBA6F0075DAFB /* TextureBuilder.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = TextureBuilder.hpp; sourceTree = "<group>"; };
4BBF990A1C8FBA6F0075DAFB /* CRTOpenGL.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CRTOpenGL.cpp; sourceTree = "<group>"; };
4BBF990B1C8FBA6F0075DAFB /* CRTOpenGL.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = CRTOpenGL.hpp; sourceTree = "<group>"; };
4BBF990E1C8FBA6F0075DAFB /* Flywheel.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = Flywheel.hpp; sourceTree = "<group>"; };
@ -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 */,

View File

@ -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);

View File

@ -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<InputTextureBuilder> _texture_builder;
std::unique_ptr<TextureBuilder> _texture_builder;
std::unique_ptr<std::mutex> _output_mutex;
std::unique_ptr<std::mutex> _draw_mutex;

View File

@ -12,7 +12,7 @@
#include "OpenGL.hpp"
#include <string>
#include <functional>
#include <list>
#include <vector>
#include <mutex>
namespace OpenGL {
@ -110,7 +110,7 @@ private:
GLuint _shader_program;
void flush_functions();
std::list<std::function<void(void)>> _enqueued_functions;
std::vector<std::function<void(void)>> _enqueued_functions;
std::mutex _function_mutex;
protected:

View File

@ -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 <string.h>
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;
}

View File

@ -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 <cstdint>
#include <memory>
@ -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.