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 {
|
2024-10-05 13:53:55 +02:00
|
|
|
static constexpr const char* version {"3"};
|
2024-01-18 00:32:11 +01:00
|
|
|
|
2024-01-21 13:58:22 +01:00
|
|
|
enum Filter {
|
|
|
|
NEAREST,
|
|
|
|
LINEAR,
|
|
|
|
};
|
|
|
|
|
2024-03-08 22:04:58 +01:00
|
|
|
enum Access {
|
|
|
|
STATIC,
|
|
|
|
STREAMING,
|
|
|
|
// target?
|
|
|
|
};
|
|
|
|
|
2024-10-05 13:53:55 +02:00
|
|
|
enum Format {
|
|
|
|
RGBA,
|
|
|
|
//RGB,
|
|
|
|
|
|
|
|
IYUV,
|
|
|
|
YV12,
|
|
|
|
|
|
|
|
NV12,
|
|
|
|
NV21,
|
|
|
|
|
|
|
|
MAX
|
|
|
|
};
|
|
|
|
|
2023-07-26 20:09:57 +02:00
|
|
|
virtual ~TextureUploaderI(void) {}
|
|
|
|
|
2024-10-05 13:53:55 +02:00
|
|
|
[[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?
|
2024-10-05 13:53:55 +02:00
|
|
|
[[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;
|
|
|
|
};
|
|
|
|
|