mirror of
https://github.com/TomHarte/CLK.git
synced 2025-01-11 08:30:55 +00:00
Switched back to broad locking for CRT updates. To eliminate one more thing.
This commit is contained in:
parent
95ee2fffdb
commit
a82fa31370
@ -279,24 +279,29 @@ void CRT::output_scan(const Scan *const scan)
|
||||
*/
|
||||
void CRT::output_sync(unsigned int number_of_cycles)
|
||||
{
|
||||
_openGL_output_builder->lock_output();
|
||||
Scan scan{
|
||||
.type = Scan::Type::Sync,
|
||||
.number_of_cycles = number_of_cycles
|
||||
};
|
||||
output_scan(&scan);
|
||||
_openGL_output_builder->unlock_output();
|
||||
}
|
||||
|
||||
void CRT::output_blank(unsigned int number_of_cycles)
|
||||
{
|
||||
_openGL_output_builder->lock_output();
|
||||
Scan scan {
|
||||
.type = Scan::Type::Blank,
|
||||
.number_of_cycles = number_of_cycles
|
||||
};
|
||||
output_scan(&scan);
|
||||
_openGL_output_builder->unlock_output();
|
||||
}
|
||||
|
||||
void CRT::output_level(unsigned int number_of_cycles)
|
||||
{
|
||||
_openGL_output_builder->lock_output();
|
||||
Scan scan {
|
||||
.type = Scan::Type::Level,
|
||||
.number_of_cycles = number_of_cycles,
|
||||
@ -304,10 +309,12 @@ void CRT::output_level(unsigned int number_of_cycles)
|
||||
.tex_y = _openGL_output_builder->get_last_write_y_posititon()
|
||||
};
|
||||
output_scan(&scan);
|
||||
_openGL_output_builder->unlock_output();
|
||||
}
|
||||
|
||||
void CRT::output_colour_burst(unsigned int number_of_cycles, uint8_t phase, uint8_t amplitude)
|
||||
{
|
||||
_openGL_output_builder->lock_output();
|
||||
Scan scan {
|
||||
.type = Scan::Type::ColourBurst,
|
||||
.number_of_cycles = number_of_cycles,
|
||||
@ -315,10 +322,12 @@ void CRT::output_colour_burst(unsigned int number_of_cycles, uint8_t phase, uint
|
||||
.amplitude = amplitude
|
||||
};
|
||||
output_scan(&scan);
|
||||
_openGL_output_builder->unlock_output();
|
||||
}
|
||||
|
||||
void CRT::output_data(unsigned int number_of_cycles, unsigned int source_divider)
|
||||
{
|
||||
_openGL_output_builder->lock_output();
|
||||
if(_openGL_output_builder->reduce_previous_allocation_to(number_of_cycles / source_divider))
|
||||
{
|
||||
Scan scan {
|
||||
@ -334,6 +343,7 @@ void CRT::output_data(unsigned int number_of_cycles, unsigned int source_divider
|
||||
{
|
||||
output_blank(number_of_cycles);
|
||||
}
|
||||
_openGL_output_builder->unlock_output();
|
||||
}
|
||||
|
||||
Outputs::CRT::Rect CRT::get_rect_for_area(int first_line_after_sync, int number_of_lines, int first_cycle_after_sync, int number_of_cycles, float aspect_ratio)
|
||||
|
@ -107,14 +107,12 @@ class OpenGLOutputBuilder {
|
||||
inline uint8_t *get_next_source_run()
|
||||
{
|
||||
if(_source_buffer_data_pointer == _drawn_source_buffer_data_pointer + SourceVertexBufferDataSize) return nullptr;
|
||||
_output_mutex->lock();
|
||||
return &_source_buffer_data.get()[_source_buffer_data_pointer % SourceVertexBufferDataSize];
|
||||
}
|
||||
|
||||
inline void complete_source_run()
|
||||
{
|
||||
_source_buffer_data_pointer += 2 * SourceVertexSize;
|
||||
_output_mutex->unlock();
|
||||
}
|
||||
|
||||
inline bool composite_output_run_has_room_for_vertices(GLsizei vertices_to_write)
|
||||
@ -125,13 +123,21 @@ class OpenGLOutputBuilder {
|
||||
inline uint8_t *get_next_output_run()
|
||||
{
|
||||
if(_output_buffer_data_pointer == _drawn_output_buffer_data_pointer + OutputVertexBufferDataSize) return nullptr;
|
||||
_output_mutex->lock();
|
||||
return &_output_buffer_data.get()[_output_buffer_data_pointer % OutputVertexBufferDataSize];
|
||||
}
|
||||
|
||||
inline void complete_output_run(GLsizei vertices_written)
|
||||
{
|
||||
_output_buffer_data_pointer += vertices_written * OutputVertexSize;
|
||||
}
|
||||
|
||||
inline void lock_output()
|
||||
{
|
||||
_output_mutex->lock();
|
||||
}
|
||||
|
||||
inline void unlock_output()
|
||||
{
|
||||
_output_mutex->unlock();
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user