mirror of
https://github.com/TomHarte/CLK.git
synced 2024-12-23 20:29:42 +00:00
Sketches interface for a GPU data bookender, to avoid stray errors with packed pixel formats.
This commit is contained in:
parent
46345c6a3e
commit
1157bde453
@ -98,6 +98,21 @@ class TextureBuilder {
|
||||
/// allocated, indicating their final resting locations and their lengths.
|
||||
void flush(const std::function<void(const std::vector<WriteArea> &write_areas, size_t count)> &);
|
||||
|
||||
/// A Bookender helps to paper over precision errors when rendering; its job is to provide single-sample
|
||||
/// extensions that duplicate the left and right edges of a written area. By default the texture builder will
|
||||
/// simply copy the appropriate number of bytes per pixel, but if the client is using a packed pixel format
|
||||
/// then that may be incorrect, e.g. if each sample is a byte but contains two pixels, each in a single nibble,
|
||||
/// then the correct duplication might be a byte composed of copies of the two top nibbles as the left bookend,
|
||||
/// and one composed of copies of the two bottom nibbles on the right.
|
||||
struct Bookender {
|
||||
/// Writes to left_bookend the sample that should appear as a continuation before the left_value;
|
||||
/// writes to right_bookend the sample that should appear as a continuation after right_value.
|
||||
void add_bookends(uint8_t *const left_value, uint8_t *const right_value, uint8_t *left_bookend, uint8_t *right_bookend);
|
||||
};
|
||||
|
||||
/// Sets the current bookender. Will be called synchronously within the builder-writing thread.
|
||||
void set_bookender(Bookender *bookender);
|
||||
|
||||
private:
|
||||
// the buffer size
|
||||
size_t bytes_per_pixel_;
|
||||
|
Loading…
Reference in New Issue
Block a user