Capture up to eight scans per submission group.

This commit is contained in:
Thomas Harte 2022-07-03 21:54:28 -04:00
parent 3179d0d963
commit 4078baa424
2 changed files with 26 additions and 5 deletions

View File

@ -23,5 +23,6 @@ void ScanTarget::set_modals(Modals m) {
}
void ScanTarget::submit() {
printf("");
scan_buffer_pointer_ = sample_buffer_pointer_ = 0;
has_failed_ = false;
}

View File

@ -28,7 +28,20 @@ class ScanTarget: public Outputs::Display::ScanTarget {
// some notes on their meaning to this specific scan target are given below.
void set_modals(Modals) override;
Scan *begin_scan() override { return &current_scan_; }
Scan *begin_scan() override {
if(has_failed_ || scan_buffer_pointer_ == 8) {
has_failed_ = true;
return nullptr;
}
vended_buffer_ = &scan_buffer_[scan_buffer_pointer_];
++scan_buffer_pointer_;
return vended_buffer_;
}
void end_scan() override {
// TODO: adjust sample buffer locations.
}
uint8_t *begin_data(size_t, size_t required_alignment) override {
// Achieve required alignment.
@ -36,6 +49,8 @@ class ScanTarget: public Outputs::Display::ScanTarget {
// Return target.
return &sample_buffer_[sample_buffer_pointer_];
// TODO: nullptr case.
}
void end_data(size_t actual_length) override {
sample_buffer_pointer_ += actual_length;
@ -46,13 +61,18 @@ class ScanTarget: public Outputs::Display::ScanTarget {
template <InputDataType, DisplayType, ColourSpace> void process();
// Temporaries; each scan is rasterised synchronously and upon
// completion, so the storage here is a lot simpler than for
// Temporaries; each set of scans is rasterised synchronously upon
// its submit, so the storage here is a lot simpler than for
// the GPU-powered scan targets.
Scan current_scan_;
std::array<Scan, 8> scan_buffer_;
Scan *vended_buffer_ = nullptr;
size_t scan_buffer_pointer_ = 0;
std::array<uint8_t, 2048> sample_buffer_;
size_t sample_buffer_pointer_ = 0;
bool has_failed_ = false;
};
}