1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-12-27 01:31:42 +00:00

This thing has clearly becoma a real class.

This commit is contained in:
Thomas Harte 2016-11-19 20:12:40 +08:00
parent 7857ef774f
commit c2349ee3f4

View File

@ -56,25 +56,27 @@ class ArrayBuilder {
Submission submit();
private:
struct Buffer {
Buffer(size_t size, std::function<void(bool is_input, uint8_t *, size_t)> submission_function);
~Buffer();
class Buffer {
public:
Buffer(size_t size, std::function<void(bool is_input, uint8_t *, size_t)> submission_function);
~Buffer();
std::vector<uint8_t> data;
size_t allocated_data;
size_t flushed_data;
size_t submitted_data;
bool is_full, was_reset;
GLuint buffer;
uint8_t *get_storage(size_t size);
uint8_t *reget_storage(size_t &size);
uint8_t *get_storage(size_t size);
uint8_t *reget_storage(size_t &size);
void flush();
size_t submit(bool is_input);
void bind();
void reset();
void flush();
size_t submit(bool is_input);
void bind();
void reset();
std::function<void(bool is_input, uint8_t *, size_t)> submission_function_;
private:
bool is_full, was_reset;
GLuint buffer;
std::function<void(bool is_input, uint8_t *, size_t)> submission_function_;
std::vector<uint8_t> data;
size_t allocated_data;
size_t flushed_data;
size_t submitted_data;
} output_, input_;
uint8_t *get_storage(size_t size, Buffer &buffer);