1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-07-06 01:28:57 +00:00

Resolved potential crash if tape requests are made without one inserted. Softened glFinish to glFlush, though I'm still not sure I should strictly need even that.

This commit is contained in:
Thomas Harte 2016-04-19 21:00:48 -04:00
parent 88e237b8de
commit 66f2c10c04
3 changed files with 15 additions and 2 deletions

View File

@ -304,6 +304,7 @@ unsigned int Machine::perform_bus_operation(CPU6502::BusOperation operation, uin
{
if(
_use_fast_tape_hack &&
_tape.has_tape() &&
(operation == CPU6502::BusOperation::ReadOpcode) &&
(
(address == 0xf4e5) || (address == 0xf4e6) || // double NOPs at 0xf4e5, 0xf6de, 0xf6fa and 0xfa51
@ -886,7 +887,14 @@ void Tape::set_tape(std::shared_ptr<Storage::Tape> tape)
inline void Tape::get_next_tape_pulse()
{
_input.time_into_pulse = 0;
_input.current_pulse = _tape->get_next_pulse();
if(_tape)
_input.current_pulse = _tape->get_next_pulse();
else
{
_input.current_pulse.length.length = 1;
_input.current_pulse.length.clock_rate = 1;
_input.current_pulse.type = Storage::Tape::Pulse::Zero;
}
if(_input.pulse_stepper == nullptr || _input.current_pulse.length.clock_rate != _input.pulse_stepper->get_output_rate())
{
_input.pulse_stepper = std::unique_ptr<SignalProcessing::Stepper>(new SignalProcessing::Stepper(_input.current_pulse.length.clock_rate, 2000000));

View File

@ -63,6 +63,10 @@ class Tape {
Tape();
void set_tape(std::shared_ptr<Storage::Tape> tape);
inline bool has_tape()
{
return (bool)_tape;
}
inline uint8_t get_data_register();
inline void set_data_register(uint8_t value);

View File

@ -229,7 +229,6 @@ void OpenGLOutputBuilder::draw_frame(unsigned int output_width, unsigned int out
}
// transfer to screen
glFinish();
glBindFramebuffer(GL_FRAMEBUFFER, defaultFramebuffer);
compositeTexture->bind_texture();
perform_output_stage(output_width, output_height, composite_output_shader_program.get());
@ -287,6 +286,8 @@ void OpenGLOutputBuilder::perform_output_stage(unsigned int output_width, unsign
{
// draw
glUniform4fv(timestampBaseUniform, 1, timestampBases);
glFlush();
GLsizei primitive_count = (GLsizei)(count / OutputVertexSize);
GLsizei max_count = (GLsizei)((OutputVertexBufferDataSize - start) / OutputVertexSize);
if(primitive_count < max_count)