Load image w/o CircularBuffer

This commit is contained in:
2023-04-01 14:57:03 +02:00
parent 0f78e62ab0
commit 6333581c4c
7 changed files with 43 additions and 31 deletions

View File

@@ -20,17 +20,17 @@ namespace JabyEngine {
struct Configuration {
ProcessRoutine process_routine = nullptr;
const uint32_t* data_adr = nullptr;
size_t data_word_size = 0ull;
const uint8_t* data_adr = nullptr;
size_t data_bytes = 0ull;
template<typename T>
static __always_inline Configuration from(GenericProcessRoutine<T> process_routine, const uint32_t* data_adr) {
static __always_inline Configuration from(GenericProcessRoutine<T> process_routine, const uint8_t* data_adr) {
return {reinterpret_cast<ProcessRoutine>(process_routine), data_adr};
}
constexpr void processed(size_t words) {
this->data_adr += words;
this->data_word_size -= words;
constexpr void processed(size_t bytes) {
this->data_adr += bytes;
this->data_bytes -= bytes;
}
};
@@ -39,14 +39,14 @@ namespace JabyEngine {
Reserved reserved;
template<typename T>
static __always_inline State from(const T& reserved, const uint32_t* data_adr, GenericProcessRoutine<T> process_routine) {
static __always_inline State from(const T& reserved, const uint8_t* data_adr, GenericProcessRoutine<T> process_routine) {
return {Configuration::from(process_routine, data_adr), *reinterpret_cast<const Reserved*>(&reserved)};
static_assert(sizeof(T) <= sizeof(Reserved));
}
public:
Progress process(size_t word_size) {
this->config.data_word_size += word_size;
Progress process(size_t bytes_ready) {
this->config.data_bytes += bytes_ready;
return (*this->config.process_routine)(this->config, this->reserved);
}
};