mirror of
https://github.com/TomHarte/CLK.git
synced 2024-09-06 05:54:28 +00:00
Some cleaning.
This commit is contained in:
parent
0d27d3bb7f
commit
c8ecfb89d8
@ -91,8 +91,8 @@ void OpenGLOutputBuilder::draw_frame(unsigned int output_width, unsigned int out
|
|||||||
|
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, output_array_buffer);
|
glBindBuffer(GL_ARRAY_BUFFER, output_array_buffer);
|
||||||
|
|
||||||
glBufferData(GL_ARRAY_BUFFER, buffer_size, NULL, GL_STREAM_DRAW);
|
glBufferData(GL_ARRAY_BUFFER, InputVertexBufferDataSize, NULL, GL_STREAM_DRAW);
|
||||||
_output_buffer_data = (uint8_t *)glMapBufferRange(GL_ARRAY_BUFFER, 0, buffer_size, GL_MAP_WRITE_BIT | GL_MAP_UNSYNCHRONIZED_BIT);
|
_output_buffer_data = (uint8_t *)glMapBufferRange(GL_ARRAY_BUFFER, 0, InputVertexBufferDataSize, GL_MAP_WRITE_BIT | GL_MAP_UNSYNCHRONIZED_BIT);
|
||||||
_output_buffer_data_pointer = 0;
|
_output_buffer_data_pointer = 0;
|
||||||
glBindVertexArray(output_vertex_array);
|
glBindVertexArray(output_vertex_array);
|
||||||
prepare_output_vertex_array();
|
prepare_output_vertex_array();
|
||||||
@ -111,10 +111,6 @@ void OpenGLOutputBuilder::draw_frame(unsigned int output_width, unsigned int out
|
|||||||
filteredTexture = std::unique_ptr<OpenGL::TextureTarget>(new OpenGL::TextureTarget(IntermediateBufferWidth, IntermediateBufferHeight));
|
filteredTexture = std::unique_ptr<OpenGL::TextureTarget>(new OpenGL::TextureTarget(IntermediateBufferWidth, IntermediateBufferHeight));
|
||||||
}
|
}
|
||||||
|
|
||||||
// glGetIntegerv(GL_FRAMEBUFFER_BINDING, (GLint *)&_openGL_state->defaultFramebuffer);
|
|
||||||
//
|
|
||||||
// printf("%d", glIsFramebuffer(_openGL_state->defaultFramebuffer));
|
|
||||||
|
|
||||||
// lock down any further work on the current frame
|
// lock down any further work on the current frame
|
||||||
_output_mutex->lock();
|
_output_mutex->lock();
|
||||||
|
|
||||||
@ -159,26 +155,6 @@ void OpenGLOutputBuilder::draw_frame(unsigned int output_width, unsigned int out
|
|||||||
// glBindTexture(GL_TEXTURE_2D, _openGL_state->textureName);
|
// glBindTexture(GL_TEXTURE_2D, _openGL_state->textureName);
|
||||||
// glGetIntegerv(GL_VIEWPORT, results);
|
// glGetIntegerv(GL_VIEWPORT, results);
|
||||||
|
|
||||||
// ensure array buffer is up to date
|
|
||||||
// glBindBuffer(GL_ARRAY_BUFFER, output_array_buffer);
|
|
||||||
// size_t max_number_of_vertices = 0;
|
|
||||||
// for(int c = 0; c < NumberOfFields; c++)
|
|
||||||
// {
|
|
||||||
// max_number_of_vertices = std::max(max_number_of_vertices, _run_builders[c]->number_of_vertices);
|
|
||||||
// }
|
|
||||||
// if(output_vertices_per_slice < max_number_of_vertices)
|
|
||||||
// {
|
|
||||||
// output_vertices_per_slice = max_number_of_vertices;
|
|
||||||
// glBufferData(GL_ARRAY_BUFFER, (GLsizeiptr)(max_number_of_vertices * OutputVertexSize * OutputVertexSize), NULL, GL_STREAM_DRAW);
|
|
||||||
//
|
|
||||||
// for(unsigned int c = 0; c < NumberOfFields; c++)
|
|
||||||
// {
|
|
||||||
// uint8_t *data = &_run_builders[c]->_runs[0];
|
|
||||||
// glBufferSubData(GL_ARRAY_BUFFER, (GLsizeiptr)(c * output_vertices_per_slice * OutputVertexSize), (GLsizeiptr)(_run_builders[c]->number_of_vertices * OutputVertexSize), data);
|
|
||||||
// _run_builders[c]->uploaded_vertices = _run_builders[c]->number_of_vertices;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// switch to the output shader
|
// switch to the output shader
|
||||||
if(rgb_shader_program)
|
if(rgb_shader_program)
|
||||||
{
|
{
|
||||||
@ -206,20 +182,9 @@ void OpenGLOutputBuilder::draw_frame(unsigned int output_width, unsigned int out
|
|||||||
{
|
{
|
||||||
glUniform1f(timestampBaseUniform, (GLfloat)total_age);
|
glUniform1f(timestampBaseUniform, (GLfloat)total_age);
|
||||||
|
|
||||||
// if(_run_builders[run]->uploaded_vertices != _run_builders[run]->number_of_vertices)
|
|
||||||
// {
|
|
||||||
// uint8_t *data = &_run_builders[run]->_runs[_run_builders[run]->uploaded_vertices * OutputVertexSize];
|
|
||||||
// glBufferSubData(GL_ARRAY_BUFFER,
|
|
||||||
// (GLsizeiptr)(((run * output_vertices_per_slice) + _run_builders[run]->uploaded_vertices) * OutputVertexSize),
|
|
||||||
// (GLsizeiptr)((_run_builders[run]->number_of_vertices - _run_builders[run]->uploaded_vertices) * OutputVertexSize), data);
|
|
||||||
// _run_builders[run]->uploaded_vertices = _run_builders[run]->number_of_vertices;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// draw this frame
|
// draw this frame
|
||||||
// glDrawArrays(GL_TRIANGLE_STRIP, (GLint)(run * output_vertices_per_slice), (GLsizei)_run_builders[run]->number_of_vertices);
|
|
||||||
|
|
||||||
GLsizei count = (GLsizei)_run_builders[run]->number_of_vertices;
|
GLsizei count = (GLsizei)_run_builders[run]->number_of_vertices;
|
||||||
GLsizei max_count = (GLsizei)((buffer_size - _run_builders[run]->start) / InputVertexSize);
|
GLsizei max_count = (GLsizei)((InputVertexBufferDataSize - _run_builders[run]->start) / InputVertexSize);
|
||||||
if(count < max_count)
|
if(count < max_count)
|
||||||
{
|
{
|
||||||
glDrawArrays(GL_TRIANGLE_STRIP, (GLint)(_run_builders[run]->start / InputVertexSize), count);
|
glDrawArrays(GL_TRIANGLE_STRIP, (GLint)(_run_builders[run]->start / InputVertexSize), count);
|
||||||
|
@ -47,7 +47,8 @@ const int InputBufferBuilderHeight = 1024;
|
|||||||
const int IntermediateBufferWidth = 2048;
|
const int IntermediateBufferWidth = 2048;
|
||||||
const int IntermediateBufferHeight = 2048;
|
const int IntermediateBufferHeight = 2048;
|
||||||
|
|
||||||
const GLsizeiptr buffer_size = (GLsizeiptr)(312 * 6 * 6 * OutputVertexSize);
|
// Some internal
|
||||||
|
const GLsizeiptr InputVertexBufferDataSize = 256 * 1024;
|
||||||
|
|
||||||
|
|
||||||
// Runs are divided discretely by vertical syncs in order to put a usable bounds on the uniform used to track
|
// Runs are divided discretely by vertical syncs in order to put a usable bounds on the uniform used to track
|
||||||
@ -139,7 +140,7 @@ class OpenGLOutputBuilder {
|
|||||||
|
|
||||||
inline uint8_t *get_next_input_run()
|
inline uint8_t *get_next_input_run()
|
||||||
{
|
{
|
||||||
if (_output_buffer_data_pointer + 6 * InputVertexSize > buffer_size) _output_buffer_data_pointer = 0;
|
if (_output_buffer_data_pointer + 6 * InputVertexSize > InputVertexBufferDataSize) _output_buffer_data_pointer = 0;
|
||||||
uint8_t *pointer = &_output_buffer_data[_output_buffer_data_pointer];
|
uint8_t *pointer = &_output_buffer_data[_output_buffer_data_pointer];
|
||||||
_output_buffer_data_pointer += 6 * InputVertexSize;
|
_output_buffer_data_pointer += 6 * InputVertexSize;
|
||||||
return pointer;
|
return pointer;
|
||||||
|
Loading…
Reference in New Issue
Block a user