1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-12-27 01:31:42 +00:00

Made an attemp to deal with glUnmapBuffer(GL_ARRAY_BUFFER) == GL_FALSE.

This commit is contained in:
Thomas Harte 2016-03-18 21:35:52 -04:00
parent 0b1c9fb291
commit 5b37a651ac

View File

@ -206,7 +206,6 @@ void OpenGLOutputBuilder::draw_frame(unsigned int output_width, unsigned int out
size_t first_size = InputVertexBufferDataSize - start; size_t first_size = InputVertexBufferDataSize - start;
memcpy(&target[start], &_output_buffer_data[start], first_size); memcpy(&target[start], &_output_buffer_data[start], first_size);
memcpy(target, _output_buffer_data, length - first_size); memcpy(target, _output_buffer_data, length - first_size);
glUnmapBuffer(GL_ARRAY_BUFFER);
} }
} }
else else
@ -215,10 +214,16 @@ void OpenGLOutputBuilder::draw_frame(unsigned int output_width, unsigned int out
if(target) if(target)
{ {
memcpy(target, &_output_buffer_data[start], length); memcpy(target, &_output_buffer_data[start], length);
glUnmapBuffer(GL_ARRAY_BUFFER);
} }
} }
while(glUnmapBuffer(GL_ARRAY_BUFFER) == GL_FALSE)
{
// "the data store contents are undefined. An application must detect this rare condition and reinitialize the data store."
uint8_t *target = (uint8_t *)glMapBufferRange(GL_ARRAY_BUFFER, 0, InputVertexBufferDataSize, GL_MAP_WRITE_BIT | GL_MAP_UNSYNCHRONIZED_BIT);
memcpy(target, _output_buffer_data, InputVertexBufferDataSize);
}
_run_builders[run]->amount_of_uploaded_data = _run_builders[run]->amount_of_data; _run_builders[run]->amount_of_uploaded_data = _run_builders[run]->amount_of_data;
} }