1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-07-11 04:28:58 +00:00

Proven through deliberate inefficiency: the issues are (i) texture upload; and (ii) buffer wraparound.

This commit is contained in:
Thomas Harte 2016-05-03 22:22:12 -04:00
parent 759fbd89ca
commit 3684c6404f
3 changed files with 15 additions and 10 deletions

View File

@ -40,8 +40,8 @@ const GLsizei IntermediateBufferWidth = 2048;
const GLsizei IntermediateBufferHeight = 2048; const GLsizei IntermediateBufferHeight = 2048;
// Some internal buffer sizes // Some internal buffer sizes
const GLsizeiptr OutputVertexBufferDataSize = 59904; // a multiple of 6 * OutputVertexSize const GLsizeiptr OutputVertexBufferDataSize = 5990400; // a multiple of 6 * OutputVertexSize
const GLsizeiptr SourceVertexBufferDataSize = 87360; // a multiple of 2 * SourceVertexSize const GLsizeiptr SourceVertexBufferDataSize = 8736000; // a multiple of 2 * SourceVertexSize
} }
} }

View File

@ -46,7 +46,7 @@ struct CRTInputBufferBuilder {
inline uint16_t get_last_write_y_position() inline uint16_t get_last_write_y_position()
{ {
return _write_y_position; return _write_y_position % InputBufferBuilderHeight;
} }
inline size_t get_bytes_per_pixel() inline size_t get_bytes_per_pixel()

View File

@ -270,14 +270,19 @@ void OpenGLOutputBuilder::draw_frame(unsigned int output_width, unsigned int out
} }
// upload new source pixels // upload new source pixels
glActiveTexture(source_data_texture_unit); if(number_of_texture_upload_zones)
for(int c = 0; c < number_of_texture_upload_zones; c++)
{ {
glTexSubImage2D( GL_TEXTURE_2D, 0, glActiveTexture(source_data_texture_unit);
0, texture_upload_zones[c*2], glTexImage2D(GL_TEXTURE_2D, 0, internalFormatForDepth(_buffer_builder->get_bytes_per_pixel()), InputBufferBuilderWidth, InputBufferBuilderHeight, 0, formatForDepth(_buffer_builder->get_bytes_per_pixel()), GL_UNSIGNED_BYTE, (void *)0);
InputBufferBuilderWidth, texture_upload_zones[c*2 + 1], // for(int c = 0; c < number_of_texture_upload_zones; c++)
formatForDepth(_buffer_builder->get_bytes_per_pixel()), GL_UNSIGNED_BYTE, // {
(void *)((size_t)texture_upload_zones[c*2] * InputBufferBuilderWidth * _buffer_builder->get_bytes_per_pixel())); // glTexSubImage2D( GL_TEXTURE_2D, 0,
// 0, texture_upload_zones[c*2],
// InputBufferBuilderWidth, texture_upload_zones[c*2 + 1],
// formatForDepth(_buffer_builder->get_bytes_per_pixel()), GL_UNSIGNED_BYTE,
// (void *)((size_t)texture_upload_zones[c*2] * InputBufferBuilderWidth * _buffer_builder->get_bytes_per_pixel()));
// }
// glFinish();
} }
struct RenderStage { struct RenderStage {