Compare commits

...

2 Commits

Author SHA1 Message Date
Green Sky
fee884ff32
update to v3 texture uploader 2025-01-13 13:47:59 +01:00
Green Sky
d8d74c9a5e
fix and update imgui 2025-01-13 13:24:43 +01:00
2 changed files with 24 additions and 5 deletions

View File

@ -18,14 +18,15 @@ endif()
if (NOT TARGET imgui)
FetchContent_Declare(imgui
GIT_REPOSITORY https://github.com/ocornut/imgui.git
GIT_TAG 00ad3c6 # v1.90.7
GIT_TAG cb16568 # v1.91.3
EXCLUDE_FROM_ALL
CONFIGURE_COMMAND "" # remove?
)
# imgui does not provide a cmake
FetchContent_GetProperties(imgui)
if(NOT imgui_POPULATED)
FetchContent_Populate(imgui)
FetchContent_MakeAvailable(imgui)
add_library(imgui STATIC
${imgui_SOURCE_DIR}/imgui.h
@ -45,6 +46,7 @@ if (NOT TARGET imgui)
)
target_include_directories(imgui PUBLIC ${imgui_SOURCE_DIR})
target_compile_features(imgui PUBLIC cxx_std_11)
target_compile_definitions(imgui PUBLIC IMGUI_USE_WCHAR32)
endif()
endif()

View File

@ -4,7 +4,7 @@
#include <cstddef>
struct TextureUploaderI {
static constexpr const char* version {"2"};
static constexpr const char* version {"3"};
enum Filter {
NEAREST,
@ -17,13 +17,30 @@ struct TextureUploaderI {
// target?
};
enum Format {
RGBA,
//RGB,
IYUV,
YV12,
NV12,
NV21,
MAX
};
virtual ~TextureUploaderI(void) {}
virtual uint64_t uploadRGBA(const uint8_t* data, uint32_t width, uint32_t height, Filter filter = LINEAR, Access access = STATIC) = 0;
[[deprecated]] virtual uint64_t uploadRGBA(const uint8_t* data, uint32_t width, uint32_t height, Filter filter = LINEAR, Access access = STATIC) = 0;
// keeps width height filter
// TODO: wh instead of size?
virtual bool updateRGBA(uint64_t tex_id, const uint8_t* data, size_t size) = 0;
[[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;
virtual void destroy(uint64_t tex_id) = 0;
};