mirror of
https://github.com/raysan5/raylib.git
synced 2025-12-25 10:22:33 -05:00
[rl_gputex] fix: decouple logging and memory allocation from Raylib
- make sure that src/external/rl_gputex.h uses it's own macros
for printing warnings and allocating memory
- add few additional macros in order to decouple rl_gputex from headers
that are being included by Raylib (e.g. *_MEMSET, *_NULL and so on)
- make sure that rl_gputex uses RL_*ALLOC, TRACELOG and RLAPI macros
when (and only when) being included by src/rtextures.c
- replace LOG() and RL_GPUTEX_SHOW_LOG_INFO macros with: RL_GPUTEX_WARN
and RL_GPUTEX_SHOW_WARN_INFO (this is a breaking change, but it was
broken and unusable anyway, see:
https://github.com/raysan5/raylib/issues/5039#issuecomment-3065732596 )
- fixes issue all issues mentioned in:
https://github.com/raysan5/raylib/issues/5039#issuecomment-3065732596
- remove logging upon successfully saving a file; Raylib does this
anyway and we want rl_gputex to only print WARNings upon failures;
see: https://discord.com/channels/426912293134270465/541710686468702250/1394406734306480352
- add additional condition when saving a file; now checks for both
fwrite() and fclose() failures; before it would warn about both,
but only return result based on fclose()
- add some notes about the current state of compiling rl_gputex
without depending on Raylib (spoiler: it's still broken...)
- bump rl_gputex version to 1.1 since this is a potential breaking
change (only for people attempting to use it without Raylib)
Fixes: https://github.com/raysan5/raylib/issues/5039
Reference: https://discord.com/channels/426912293134270465/541710686468702250/1394403611852931255
This commit is contained in:
@ -168,6 +168,18 @@
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wunused-function"
|
||||
#endif
|
||||
|
||||
|
||||
#define RL_GPUTEX_MALLOC RL_MALLOC
|
||||
#define RL_GPUTEX_CALLOC RL_CALLOC
|
||||
#define RL_GPUTEX_REALLOC RL_REALLOC
|
||||
#define RL_GPUTEX_FREE RL_FREE
|
||||
#define RL_GPUTEX_WARN(...) TRACELOG(LOG_WARNING, "IMAGE: " __VA_ARGS__)
|
||||
#define RL_GPUTEX_SHOW_WARN_INFO
|
||||
|
||||
// FIXME: probably, we should NOT export public functions from rl_gputex
|
||||
// but this is how it always worked... so let's keep it this way
|
||||
#define RLGPUTEXAPI RLAPI
|
||||
|
||||
#define RL_GPUTEX_IMPLEMENTATION
|
||||
#include "external/rl_gputex.h" // Required for: rl_load_xxx_from_memory()
|
||||
|
||||
Reference in New Issue
Block a user