mirror of
https://github.com/TomHarte/CLK.git
synced 2024-11-26 23:52:26 +00:00
Fixed error that could lead to split output run vertex writes.
This commit is contained in:
parent
1a214a8308
commit
986019f9f9
@ -69,7 +69,8 @@ CRT::CRT(unsigned int common_output_divisor) :
|
||||
_common_output_divisor(common_output_divisor),
|
||||
_is_writing_composite_run(false),
|
||||
_delegate(nullptr),
|
||||
_frames_since_last_delegate_call(0) {}
|
||||
_frames_since_last_delegate_call(0),
|
||||
_did_start_run(false) {}
|
||||
|
||||
CRT::CRT(unsigned int cycles_per_line, unsigned int common_output_divisor, unsigned int height_of_display, ColourSpace colour_space, unsigned int colour_cycle_numerator, unsigned int colour_cycle_denominator, unsigned int buffer_depth) : CRT(common_output_divisor)
|
||||
{
|
||||
@ -186,9 +187,9 @@ void CRT::advance_cycles(unsigned int number_of_cycles, unsigned int source_divi
|
||||
if(needs_endpoint)
|
||||
{
|
||||
if(
|
||||
_openGL_output_builder->composite_output_run_has_room_for_vertices(_did_start_run ? 6 : 3) &&
|
||||
!_openGL_output_builder->composite_output_buffer_is_full() &&
|
||||
_is_writing_composite_run == _did_start_run)
|
||||
_is_writing_composite_run == _did_start_run &&
|
||||
_openGL_output_builder->composite_output_run_has_room_for_vertices(_did_start_run ? 3 : 6) &&
|
||||
!_openGL_output_builder->composite_output_buffer_is_full())
|
||||
{
|
||||
uint8_t *next_run = _openGL_output_builder->get_next_output_run();
|
||||
if(next_run)
|
||||
|
@ -188,14 +188,6 @@ void OpenGLOutputBuilder::draw_frame(unsigned int output_width, unsigned int out
|
||||
|
||||
set_timing_uniforms();
|
||||
set_colour_space_uniforms();
|
||||
|
||||
// This should return either an actual framebuffer number, if this is a target with a framebuffer intended for output,
|
||||
// or 0 if no framebuffer is bound, in which case 0 is also what we want to supply to bind the implied framebuffer. So
|
||||
// it works either way.
|
||||
// glGetIntegerv(GL_FRAMEBUFFER_BINDING, (GLint *)&defaultFramebuffer);
|
||||
|
||||
// TODO: is this sustainable, cross-platform? If so, why store it at all?
|
||||
// defaultFramebuffer = 0;
|
||||
}
|
||||
|
||||
// determine how many lines are newly reclaimed; they'll need to be cleared
|
||||
@ -214,12 +206,6 @@ void OpenGLOutputBuilder::draw_frame(unsigned int output_width, unsigned int out
|
||||
_drawn_source_buffer_data_pointer = _source_buffer_data_pointer;
|
||||
_drawn_output_buffer_data_pointer = _output_buffer_data_pointer;
|
||||
|
||||
// drawing commands having been issued, reclaim the array buffer pointer
|
||||
// glBindBuffer(GL_ARRAY_BUFFER, output_array_buffer);
|
||||
//
|
||||
// glBindBuffer(GL_ARRAY_BUFFER, source_array_buffer);
|
||||
// _source_buffer_data = (uint8_t *)glMapBufferRange(GL_ARRAY_BUFFER, 0, SourceVertexBufferDataSize, GL_MAP_WRITE_BIT | GL_MAP_UNSYNCHRONIZED_BIT | GL_MAP_FLUSH_EXPLICIT_BIT);
|
||||
|
||||
if(_fence != nullptr)
|
||||
{
|
||||
glClientWaitSync(_fence, GL_SYNC_FLUSH_COMMANDS_BIT, GL_TIMEOUT_IGNORED);
|
||||
@ -316,9 +302,6 @@ void OpenGLOutputBuilder::draw_frame(unsigned int output_width, unsigned int out
|
||||
|
||||
active_pipeline++;
|
||||
}
|
||||
|
||||
// TODO: determine why the finish below is required
|
||||
// glFinish();
|
||||
}
|
||||
|
||||
// transfer to framebuffer
|
||||
|
@ -119,7 +119,7 @@ class OpenGLOutputBuilder {
|
||||
|
||||
inline bool composite_output_run_has_room_for_vertices(GLsizei vertices_to_write)
|
||||
{
|
||||
return _composite_src_output_y <= _cleared_composite_output_y + IntermediateBufferHeight - vertices_to_write * OutputVertexSize;
|
||||
return _output_buffer_data_pointer <= _drawn_output_buffer_data_pointer + OutputVertexBufferDataSize - vertices_to_write * OutputVertexSize;
|
||||
}
|
||||
|
||||
inline uint8_t *get_next_output_run()
|
||||
|
Loading…
Reference in New Issue
Block a user