1
0
mirror of https://github.com/TomHarte/CLK.git synced 2025-01-11 08:30:55 +00:00

Ensured the GL context is available when switching Atari 2600 output, and that it locks the output.

This commit is contained in:
Thomas Harte 2016-04-24 20:56:21 -04:00
parent 2bd6566768
commit 884755c560
2 changed files with 7 additions and 1 deletions

View File

@ -41,7 +41,9 @@ struct CRTDelegate: public Outputs::CRT::Delegate {
_didDecideRegion = YES; _didDecideRegion = YES;
if(numberOfUnexpectedSyncs >= numberOfFrames >> 1) if(numberOfUnexpectedSyncs >= numberOfFrames >> 1)
{ {
_atari2600.switch_region(); [self.view performWithGLContext:^{
_atari2600.switch_region();
}];
} }
} }
} }

View File

@ -909,6 +909,7 @@ void OpenGLOutputBuilder::set_timing(unsigned int cycles_per_line, unsigned int
void OpenGLOutputBuilder::set_colour_space_uniforms() void OpenGLOutputBuilder::set_colour_space_uniforms()
{ {
_output_mutex->lock();
GLfloat rgbToYUV[] = {0.299f, -0.14713f, 0.615f, 0.587f, -0.28886f, -0.51499f, 0.114f, 0.436f, -0.10001f}; GLfloat rgbToYUV[] = {0.299f, -0.14713f, 0.615f, 0.587f, -0.28886f, -0.51499f, 0.114f, 0.436f, -0.10001f};
GLfloat yuvToRGB[] = {1.0f, 1.0f, 1.0f, 0.0f, -0.39465f, 2.03211f, 1.13983f, -0.58060f, 0.0f}; GLfloat yuvToRGB[] = {1.0f, 1.0f, 1.0f, 0.0f, -0.39465f, 2.03211f, 1.13983f, -0.58060f, 0.0f};
@ -949,10 +950,12 @@ void OpenGLOutputBuilder::set_colour_space_uniforms()
glUniformMatrix3fv(uniform, 1, GL_FALSE, toRGB); glUniformMatrix3fv(uniform, 1, GL_FALSE, toRGB);
} }
} }
_output_mutex->unlock();
} }
void OpenGLOutputBuilder::set_timing_uniforms() void OpenGLOutputBuilder::set_timing_uniforms()
{ {
_output_mutex->lock();
OpenGL::Shader *intermediate_shaders[] = { OpenGL::Shader *intermediate_shaders[] = {
composite_input_shader_program.get(), composite_input_shader_program.get(),
composite_y_filter_shader_program.get(), composite_y_filter_shader_program.get(),
@ -1021,4 +1024,5 @@ void OpenGLOutputBuilder::set_timing_uniforms()
chrominance_filter.get_coefficients(weights); chrominance_filter.get_coefficients(weights);
glUniform4fv(weightsUniform, 3, weights); glUniform4fv(weightsUniform, 3, weights);
} }
_output_mutex->unlock();
} }