tomato-testing/src/texture_uploader.hpp

48 lines
992 B
C++
Raw Normal View History

2023-07-26 20:09:57 +02:00
#pragma once
#include <cstdint>
2024-03-08 22:04:58 +01:00
#include <cstddef>
2023-07-26 20:09:57 +02:00
struct TextureUploaderI {
static constexpr const char* version {"3"};
2024-01-18 00:32:11 +01:00
enum Filter {
NEAREST,
LINEAR,
};
2024-03-08 22:04:58 +01:00
enum Access {
STATIC,
STREAMING,
// target?
};
enum Format {
RGBA,
//RGB,
IYUV,
YV12,
NV12,
NV21,
MAX
};
2023-07-26 20:09:57 +02:00
virtual ~TextureUploaderI(void) {}
[[deprecated]] virtual uint64_t uploadRGBA(const uint8_t* data, uint32_t width, uint32_t height, Filter filter = LINEAR, Access access = STATIC) = 0;
2024-03-08 22:04:58 +01:00
// keeps width height filter
// TODO: wh instead of size?
[[deprecated]] virtual bool updateRGBA(uint64_t tex_id, const uint8_t* data, size_t size) = 0;
// use upload to create a texture, and update to update existing
virtual uint64_t upload(const uint8_t* data, uint32_t width, uint32_t height, Format format = RGBA, Filter filter = LINEAR, Access access = STATIC) = 0;
virtual bool update(uint64_t tex_id, const uint8_t* data, size_t size) = 0;
2023-07-26 20:09:57 +02:00
virtual void destroy(uint64_t tex_id) = 0;
};