mirror of
https://github.com/TomHarte/CLK.git
synced 2024-10-12 14:23:44 +00:00
Realising I've managed to confuse input and output, started shift to 'source' for what 'input' was.
This commit is contained in:
parent
e617bd2bb3
commit
fc5530b513
@ -101,13 +101,13 @@ Flywheel::SyncEvent CRT::get_next_horizontal_sync_event(bool hsync_is_requested,
|
|||||||
#define output_frame_id(v) next_run[OutputVertexSize*v + OutputVertexOffsetOfFrameID]
|
#define output_frame_id(v) next_run[OutputVertexSize*v + OutputVertexOffsetOfFrameID]
|
||||||
#define output_timestamp(v) (*(uint32_t *)&next_run[OutputVertexSize*v + OutputVertexOffsetOfTimestamp])
|
#define output_timestamp(v) (*(uint32_t *)&next_run[OutputVertexSize*v + OutputVertexOffsetOfTimestamp])
|
||||||
|
|
||||||
#define input_input_position_x(v) (*(uint16_t *)&next_run[InputVertexSize*v + InputVertexOffsetOfInputPosition + 0])
|
#define source_input_position_x(v) (*(uint16_t *)&next_run[SourceVertexSize*v + SourceVertexOffsetOfInputPosition + 0])
|
||||||
#define input_input_position_y(v) (*(uint16_t *)&next_run[InputVertexSize*v + InputVertexOffsetOfInputPosition + 2])
|
#define source_input_position_y(v) (*(uint16_t *)&next_run[SourceVertexSize*v + SourceVertexOffsetOfInputPosition + 2])
|
||||||
#define input_output_position_x(v) (*(uint16_t *)&next_run[InputVertexSize*v + InputVertexOffsetOfOutputPosition + 0])
|
#define source_output_position_x(v) (*(uint16_t *)&next_run[SourceVertexSize*v + SourceVertexOffsetOfOutputPosition + 0])
|
||||||
#define input_output_position_y(v) (*(uint16_t *)&next_run[InputVertexSize*v + InputVertexOffsetOfOutputPosition + 2])
|
#define source_output_position_y(v) (*(uint16_t *)&next_run[SourceVertexSize*v + SourceVertexOffsetOfOutputPosition + 2])
|
||||||
#define input_phase(v) next_run[OutputVertexSize*v + InputVertexOffsetOfPhaseAndAmplitude + 0]
|
#define source_phase(v) next_run[SourceVertexSize*v + SourceVertexOffsetOfPhaseAndAmplitude + 0]
|
||||||
#define input_amplitude(v) next_run[OutputVertexSize*v + InputVertexOffsetOfPhaseAndAmplitude + 1]
|
#define source_amplitude(v) next_run[SourceVertexSize*v + SourceVertexOffsetOfPhaseAndAmplitude + 1]
|
||||||
#define input_phase_time(v) (*(uint16_t *)&next_run[OutputVertexSize*v + InputVertexOffsetOfPhaseTime])
|
#define source_phase_time(v) (*(uint16_t *)&next_run[SourceVertexSize*v + SourceVertexOffsetOfPhaseTime])
|
||||||
|
|
||||||
void CRT::advance_cycles(unsigned int number_of_cycles, unsigned int source_divider, bool hsync_requested, bool vsync_requested, const bool vsync_charging, const Scan::Type type, uint16_t tex_x, uint16_t tex_y)
|
void CRT::advance_cycles(unsigned int number_of_cycles, unsigned int source_divider, bool hsync_requested, bool vsync_requested, const bool vsync_charging, const Scan::Type type, uint16_t tex_x, uint16_t tex_y)
|
||||||
{
|
{
|
||||||
@ -132,7 +132,7 @@ void CRT::advance_cycles(unsigned int number_of_cycles, unsigned int source_divi
|
|||||||
uint8_t *next_run = nullptr;
|
uint8_t *next_run = nullptr;
|
||||||
if(is_output_segment)
|
if(is_output_segment)
|
||||||
{
|
{
|
||||||
next_run = _openGL_output_builder->get_next_input_run();
|
next_run = _openGL_output_builder->get_next_output_run();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Vertex output is arranged for triangle strips, as:
|
// Vertex output is arranged for triangle strips, as:
|
||||||
@ -158,13 +158,13 @@ void CRT::advance_cycles(unsigned int number_of_cycles, unsigned int source_divi
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
input_input_position_x(0) = tex_x;
|
source_input_position_x(0) = tex_x;
|
||||||
input_input_position_y(0) = input_input_position_y(1) = tex_y;
|
source_input_position_y(0) = source_input_position_y(1) = tex_y;
|
||||||
input_output_position_x(0) = (uint16_t)_horizontal_flywheel->get_current_output_position();
|
source_output_position_x(0) = (uint16_t)_horizontal_flywheel->get_current_output_position();
|
||||||
input_output_position_y(0) = input_output_position_y(1) = _openGL_output_builder->get_composite_output_y();
|
source_output_position_y(0) = source_output_position_y(1) = _openGL_output_builder->get_composite_output_y();
|
||||||
input_phase(0) = input_phase(1) = _colour_burst_phase;
|
source_phase(0) = source_phase(1) = _colour_burst_phase;
|
||||||
input_amplitude(0) = input_amplitude(1) = _colour_burst_amplitude;
|
source_amplitude(0) = source_amplitude(1) = _colour_burst_amplitude;
|
||||||
input_phase_time(0) = input_phase_time(1) = _colour_burst_time;
|
source_phase_time(0) = source_phase_time(1) = _colour_burst_time;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -198,14 +198,14 @@ void CRT::advance_cycles(unsigned int number_of_cycles, unsigned int source_divi
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
input_input_position_x(1) = tex_x;
|
source_input_position_x(1) = tex_x;
|
||||||
input_output_position_x(1) = (uint16_t)_horizontal_flywheel->get_current_output_position();
|
source_output_position_x(1) = (uint16_t)_horizontal_flywheel->get_current_output_position();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(is_output_segment)
|
if(is_output_segment)
|
||||||
{
|
{
|
||||||
_openGL_output_builder->complete_input_run();
|
_openGL_output_builder->complete_output_run();
|
||||||
}
|
}
|
||||||
|
|
||||||
// if this is horizontal retrace then advance the output line counter and bookend an output run
|
// if this is horizontal retrace then advance the output line counter and bookend an output run
|
||||||
|
@ -27,12 +27,12 @@ const size_t OutputVertexSize = 16;
|
|||||||
|
|
||||||
// Input vertices, used only in composite mode, map from the input buffer to temporary buffer locations; such
|
// Input vertices, used only in composite mode, map from the input buffer to temporary buffer locations; such
|
||||||
// remapping occurs to ensure a continous stream of data for each scan, giving correct out-of-bounds behaviour
|
// remapping occurs to ensure a continous stream of data for each scan, giving correct out-of-bounds behaviour
|
||||||
const size_t InputVertexOffsetOfInputPosition = 0;
|
const size_t SourceVertexOffsetOfInputPosition = 0;
|
||||||
const size_t InputVertexOffsetOfOutputPosition = 4;
|
const size_t SourceVertexOffsetOfOutputPosition = 4;
|
||||||
const size_t InputVertexOffsetOfPhaseAndAmplitude = 8;
|
const size_t SourceVertexOffsetOfPhaseAndAmplitude = 8;
|
||||||
const size_t InputVertexOffsetOfPhaseTime = 12;
|
const size_t SourceVertexOffsetOfPhaseTime = 12;
|
||||||
|
|
||||||
const size_t InputVertexSize = 16;
|
const size_t SourceVertexSize = 16;
|
||||||
|
|
||||||
// These constants hold the size of the rolling buffer to which the CPU writes
|
// These constants hold the size of the rolling buffer to which the CPU writes
|
||||||
const int InputBufferBuilderWidth = 2048;
|
const int InputBufferBuilderWidth = 2048;
|
||||||
|
@ -215,15 +215,15 @@ void OpenGLOutputBuilder::draw_frame(unsigned int output_width, unsigned int out
|
|||||||
if(count > 0)
|
if(count > 0)
|
||||||
{
|
{
|
||||||
// draw
|
// draw
|
||||||
GLsizei primitive_count = (GLsizei)(count / InputVertexSize);
|
GLsizei primitive_count = (GLsizei)(count / OutputVertexSize);
|
||||||
GLsizei max_count = (GLsizei)((InputVertexBufferDataSize - start) / InputVertexSize);
|
GLsizei max_count = (GLsizei)((InputVertexBufferDataSize - start) / OutputVertexSize);
|
||||||
if(primitive_count < max_count)
|
if(primitive_count < max_count)
|
||||||
{
|
{
|
||||||
glDrawArrays(GL_TRIANGLE_STRIP, (GLint)(start / InputVertexSize), primitive_count);
|
glDrawArrays(GL_TRIANGLE_STRIP, (GLint)(start / OutputVertexSize), primitive_count);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
glDrawArrays(GL_TRIANGLE_STRIP, (GLint)(start / InputVertexSize), max_count);
|
glDrawArrays(GL_TRIANGLE_STRIP, (GLint)(start / OutputVertexSize), max_count);
|
||||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, primitive_count - max_count);
|
glDrawArrays(GL_TRIANGLE_STRIP, 0, primitive_count - max_count);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -104,30 +104,27 @@ class OpenGLOutputBuilder {
|
|||||||
_visible_area = visible_area;
|
_visible_area = visible_area;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline uint8_t *get_next_input_run()
|
inline uint8_t *get_next_source_run()
|
||||||
{
|
{
|
||||||
_output_mutex->lock();
|
return nullptr;
|
||||||
uint8_t *pointer = &_output_buffer_data[_output_buffer_data_pointer];
|
|
||||||
_output_buffer_data_pointer = (_output_buffer_data_pointer + 6 * InputVertexSize) % InputVertexBufferDataSize;
|
|
||||||
return pointer;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void complete_input_run()
|
inline void complete_source_run()
|
||||||
{
|
{
|
||||||
_run_builders[_run_write_pointer]->amount_of_data += 6 * InputVertexSize;
|
|
||||||
_output_mutex->unlock();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline uint8_t *get_next_output_run()
|
inline uint8_t *get_next_output_run()
|
||||||
{
|
{
|
||||||
// _output_mutex->lock();
|
_output_mutex->lock();
|
||||||
// return (_output_device == Monitor) ? _run_builders[_run_write_pointer]->get_next_run(6) : _composite_src_runs->get_next_run(2);
|
uint8_t *pointer = &_output_buffer_data[_output_buffer_data_pointer];
|
||||||
return nullptr;
|
_output_buffer_data_pointer = (_output_buffer_data_pointer + 6 * OutputVertexSize) % InputVertexBufferDataSize;
|
||||||
|
return pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void complete_output_run()
|
inline void complete_output_run()
|
||||||
{
|
{
|
||||||
// _output_mutex->unlock();
|
_run_builders[_run_write_pointer]->amount_of_data += 6 * OutputVertexSize;
|
||||||
|
_output_mutex->unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline OutputDevice get_output_device()
|
inline OutputDevice get_output_device()
|
||||||
|
Loading…
Reference in New Issue
Block a user