1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-06-25 18:30:07 +00:00

Fixes timing of wrap.

This commit is contained in:
Thomas Harte 2019-11-07 23:24:51 -05:00
parent b7c407be10
commit 68f9084d9e

View File

@ -228,11 +228,8 @@ void ScanTarget::end_data(size_t actual_length) {
&write_area_texture_[size_t(write_pointers_.write_area) * data_type_size_],
data_type_size_);
// The write area was allocated in the knowledge that there's sufficient
// distance left on the current line, but there's a risk of exactly filling
// the final line, in which case this should wrap back to 0.
// Advance to the end of the current run.
write_pointers_.write_area += actual_length + 1;
write_pointers_.write_area %= (write_area_texture_.size() / data_type_size_);
// Also bookend the end.
memcpy(
@ -240,6 +237,11 @@ void ScanTarget::end_data(size_t actual_length) {
&write_area_texture_[size_t(write_pointers_.write_area - 2) * data_type_size_],
data_type_size_);
// The write area was allocated in the knowledge that there's sufficient
// distance left on the current line, but there's a risk of exactly filling
// the final line, in which case this should wrap back to 0.
write_pointers_.write_area %= (write_area_texture_.size() / data_type_size_);
// Record that no further end_data calls are expected.
data_is_allocated_ = false;
}