6 Commits

Author SHA1 Message Date
Ray
43366d1c6a Some formatting tweaks 2026-05-13 09:28:08 +02:00
Ray
f35f4b9fad REVIEWED: GetTime(), small addition for RPI Pico 2 2026-05-13 09:17:04 +02:00
Ray
c4b4fcc17e Format review 2026-05-13 09:16:29 +02:00
Ray
fbf132d1d1 Use rlgl provided interface instead of rlsw direct access 2026-05-13 09:16:19 +02:00
Ray
e274c195af Update rcore.c 2026-05-13 09:15:50 +02:00
fd28dc5644 [rtext] add warning for loadfontex/loadfontfrommemory (#5864)
* add warning for loadfontex/loadfontfrommemory

* bump to re-run build tests
2026-05-13 08:56:13 +02:00
5 changed files with 79 additions and 75 deletions

104
src/external/rlsw.h vendored
View File

@ -166,16 +166,15 @@
// Fast power-of-two texture wrap (SW_REPEAT mode only) // Fast power-of-two texture wrap (SW_REPEAT mode only)
// When defined, textures whose width/height are powers of two use a bitmask // When defined, textures whose width/height are powers of two use a bitmask
// wrap (`x & (size-1)`) instead of `floorf`-based fractional wrap or the // wrap (`x & (size-1)`) instead of `floorf`-based fractional wrap or the signed `%` chain in the linear sampler
// signed `%` chain in the linear sampler. Saves a software divide on Xtensa // Saves a software divide on Xtensa and a few instructions everywhere
// and a few instructions everywhere. NPOT textures keep using the original // NPOT textures keep using the original path via a runtime `(size & (size-1)) == 0` check,
// path via a runtime `(size & (size-1)) == 0` check, so SW_REPEAT remains // so SW_REPEAT remains correct for them
// correct for them. The only observable behavior change is for POT textures // The only observable behavior change is for POT textures sampled with negative UV coordinates:
// sampled with negative UV coordinates: bitmask wrap (two's complement) can // bitmask wrap (two's complement) can differ from `sw_fract` by one texel
// differ from `sw_fract` by one texel. Off by default to keep bit-for-bit // Off by default to keep bit-for-bit behavior; opt in if you control your asset UVs
// behavior; opt in if you control your asset UVs.
// //
// #define SW_TEXTURE_REPEAT_POT_FAST //#define SW_TEXTURE_REPEAT_POT_FAST
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// OpenGL Compatibility Types // OpenGL Compatibility Types
@ -860,11 +859,9 @@ SWAPI void swGetFramebufferAttachmentParameteriv(SWattachment attachment, SWatta
#endif #endif
// ESP-DSP acceleration: ESP-IDF ships an optimized math library that includes // ESP-DSP acceleration: ESP-IDF ships an optimized math library that includes
// `dspm_mult_4x4x4_f32` (4x4 matrix multiply) and `dspm_mult_4x4x1_f32` // `dspm_mult_4x4x4_f32` (4x4 matrix multiply) and `dspm_mult_4x4x1_f32` (matrix * vector)
// (matrix * vector). These are S3-tuned hand-vectorized kernels that beat the // These are S3-tuned hand-vectorized kernels that beat the scalar versions for both throughput and code-size
// scalar versions for both throughput and code-size. Detection is opt-in to // Detection is opt-in to keep the dependency optional: define SW_USE_ESP_DSP from your build system
// keep the dependency optional: define SW_USE_ESP_DSP from your build system
// (or rely on the `idf_component.yml` example shown in the rlsw docs).
#if defined(ESP_PLATFORM) && defined(SW_USE_ESP_DSP) #if defined(ESP_PLATFORM) && defined(SW_USE_ESP_DSP)
#define SW_HAS_ESP_DSP #define SW_HAS_ESP_DSP
#include "dspm_mult.h" #include "dspm_mult.h"
@ -884,41 +881,41 @@ SWAPI void swGetFramebufferAttachmentParameteriv(SWattachment attachment, SWatta
#define SW_DEG2RAD (SW_PI/180.0f) #define SW_DEG2RAD (SW_PI/180.0f)
#define SW_RAD2DEG (180.0f/SW_PI) #define SW_RAD2DEG (180.0f/SW_PI)
// When clipping a convex polygon against a plane, at most one vertex is added. // When clipping a convex polygon against a plane, at most one vertex is added
// Starting from a quadrilateral (4 vertices), clipped sequentially against // Starting from a quadrilateral (4 vertices), clipped sequentially against
// the frustum (6 planes) then the scissor rectangle (4 planes): // the frustum (6 planes) then the scissor rectangle (4 planes):
// 4 + 6 + 4 = 14 vertices maximum. // 4 + 6 + 4 = 14 vertices maximum
#define SW_MAX_CLIPPED_POLYGON_VERTICES 14 #define SW_MAX_CLIPPED_POLYGON_VERTICES 14
#define SW_CLIP_EPSILON 1e-4f #define SW_CLIP_EPSILON 1e-4f
#define SW_HANDLE_NULL 0u #define SW_HANDLE_NULL 0u
#define SW_POOL_SLOT_LIVE 0x80u // bit7 of the generation byte #define SW_POOL_SLOT_LIVE 0x80u // bit7 of the generation byte
#define SW_POOL_SLOT_VER_MASK 0x7Fu // bits6:0 = anti-ABA counter #define SW_POOL_SLOT_VER_MASK 0x7Fu // bits6:0 = anti-ABA counter
#define SW_CONCAT(a, b) a##b #define SW_CONCAT(a, b) a##b
#define SW_CONCATX(a, b) SW_CONCAT(a, b) #define SW_CONCATX(a, b) SW_CONCAT(a, b)
#define SW_FRAMEBUFFER_COLOR8_GET(c,p,o) SW_CONCATX(sw_pixel_read_color8_, SW_FRAMEBUFFER_COLOR_TYPE)((c),(p),(o)) #define SW_FRAMEBUFFER_COLOR8_GET(c,p,o) SW_CONCATX(sw_pixel_read_color8_, SW_FRAMEBUFFER_COLOR_TYPE)((c),(p),(o))
#define SW_FRAMEBUFFER_COLOR_GET(c,p,o) SW_CONCATX(sw_pixel_read_color_, SW_FRAMEBUFFER_COLOR_TYPE)((c),(p),(o)) #define SW_FRAMEBUFFER_COLOR_GET(c,p,o) SW_CONCATX(sw_pixel_read_color_, SW_FRAMEBUFFER_COLOR_TYPE)((c),(p),(o))
#define SW_FRAMEBUFFER_COLOR_SET(p,c,o) SW_CONCATX(sw_pixel_write_color_, SW_FRAMEBUFFER_COLOR_TYPE)((p),(c),(o)) #define SW_FRAMEBUFFER_COLOR_SET(p,c,o) SW_CONCATX(sw_pixel_write_color_, SW_FRAMEBUFFER_COLOR_TYPE)((p),(c),(o))
#define SW_FRAMEBUFFER_DEPTH_GET(p,o) SW_CONCATX(sw_pixel_read_depth_, SW_FRAMEBUFFER_DEPTH_TYPE)((p),(o)) #define SW_FRAMEBUFFER_DEPTH_GET(p,o) SW_CONCATX(sw_pixel_read_depth_, SW_FRAMEBUFFER_DEPTH_TYPE)((p),(o))
#define SW_FRAMEBUFFER_DEPTH_SET(p,d,o) SW_CONCATX(sw_pixel_write_depth_, SW_FRAMEBUFFER_DEPTH_TYPE)((p),(d),(o)) #define SW_FRAMEBUFFER_DEPTH_SET(p,d,o) SW_CONCATX(sw_pixel_write_depth_, SW_FRAMEBUFFER_DEPTH_TYPE)((p),(d),(o))
#define SW_FRAMEBUFFER_COLOR_FORMAT SW_CONCATX(SW_PIXELFORMAT_COLOR_, SW_FRAMEBUFFER_COLOR_TYPE) #define SW_FRAMEBUFFER_COLOR_FORMAT SW_CONCATX(SW_PIXELFORMAT_COLOR_, SW_FRAMEBUFFER_COLOR_TYPE)
#define SW_FRAMEBUFFER_DEPTH_FORMAT SW_CONCATX(SW_PIXELFORMAT_DEPTH_, SW_FRAMEBUFFER_DEPTH_TYPE) #define SW_FRAMEBUFFER_DEPTH_FORMAT SW_CONCATX(SW_PIXELFORMAT_DEPTH_, SW_FRAMEBUFFER_DEPTH_TYPE)
#define SW_FRAMEBUFFER_COLOR_SIZE SW_PIXELFORMAT_SIZE[SW_FRAMEBUFFER_COLOR_FORMAT] #define SW_FRAMEBUFFER_COLOR_SIZE SW_PIXELFORMAT_SIZE[SW_FRAMEBUFFER_COLOR_FORMAT]
#define SW_FRAMEBUFFER_DEPTH_SIZE SW_PIXELFORMAT_SIZE[SW_FRAMEBUFFER_DEPTH_FORMAT] #define SW_FRAMEBUFFER_DEPTH_SIZE SW_PIXELFORMAT_SIZE[SW_FRAMEBUFFER_DEPTH_FORMAT]
#define SW_STATE_SCISSOR_TEST (1 << 0) #define SW_STATE_SCISSOR_TEST (1 << 0)
#define SW_STATE_TEXTURE_2D (1 << 1) #define SW_STATE_TEXTURE_2D (1 << 1)
#define SW_STATE_DEPTH_TEST (1 << 2) #define SW_STATE_DEPTH_TEST (1 << 2)
#define SW_STATE_CULL_FACE (1 << 3) #define SW_STATE_CULL_FACE (1 << 3)
#define SW_STATE_BLEND (1 << 4) #define SW_STATE_BLEND (1 << 4)
#define SW_BLEND_FLAG_NOOP (1 << 0) #define SW_BLEND_FLAG_NOOP (1 << 0)
#define SW_BLEND_FLAG_NEEDS_ALPHA (1 << 1) #define SW_BLEND_FLAG_NEEDS_ALPHA (1 << 1)
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// Module Types and Structures Definition // Module Types and Structures Definition
@ -1175,7 +1172,7 @@ static inline void sw_matrix_mul_rst(float *SW_RESTRICT dst, const float *SW_RES
// column-major, so passing them flat is equivalent to passing transposes: // column-major, so passing them flat is equivalent to passing transposes:
// dspm_mult(L^T, R^T) computes (L^T)*(R^T) = (R*L)^T, written back into a // dspm_mult(L^T, R^T) computes (L^T)*(R^T) = (R*L)^T, written back into a
// flat array gives the same bit pattern as the column-major product (R*L) // flat array gives the same bit pattern as the column-major product (R*L)
// -- exactly the semantic the scalar fallback below has. // -- exactly the semantic the scalar fallback below has
dspm_mult_4x4x4_f32(left, right, dst); dspm_mult_4x4x4_f32(left, right, dst);
#else #else
float l00 = left[0], l01 = left[1], l02 = left[2], l03 = left[3]; float l00 = left[0], l01 = left[1], l02 = left[2], l03 = left[3];
@ -1248,12 +1245,12 @@ static inline float sw_fract(float x)
return (x - floorf(x)); return (x - floorf(x));
} }
// Fast reciprocal: 1-ULP accurate in ~7 instructions on Xtensa using the // Xtensa architecture optimization
// hardware `recip0.s` seed + two Newton-Raphson refinement steps. All work // Fast reciprocal: 1-ULP accurate in ~7 instructions using the
// stays in FPU registers — no `__divsf3` software call. Hot-path divisions // hardware `recip0.s` seed + two Newton-Raphson refinement steps
// in the rasterizer (span/triangle setup, perspective divide, etc.) call // All work stays in FPU registers — no `__divsf3` software call
// this. On non-Xtensa targets it transparently expands to `1.0f / x`, so // Hot-path divisions in the rasterizer (span/triangle setup, perspective divide, etc.) call this
// generated code is identical to before. // On non-Xtensa targets it transparently expands to `1.0f / x`, so generated code is identical to before
#if defined(__XTENSA__) #if defined(__XTENSA__)
__attribute__((always_inline)) __attribute__((always_inline))
static inline float sw_rcp(float x) static inline float sw_rcp(float x)
@ -3558,8 +3555,8 @@ static inline bool sw_quad_face_culling(void)
// winding in the projected space when all w > 0 // winding in the projected space when all w > 0
// A value of 0 for sgnArea means P0, P1, P2 are collinear in (x, y, w) // A value of 0 for sgnArea means P0, P1, P2 are collinear in (x, y, w)
// space, which corresponds to a degenerate triangle projection // space, which corresponds to a degenerate triangle projection
// Such quads might also be degenerate or non-planar. They are typically // Such quads might also be degenerate or non-planar
// not culled by this test (0 < 0 is false, 0 > 0 is false) // They are typically not culled by this test (0 < 0 is false, 0 > 0 is false)
// and should be handled by the clipper if necessary // and should be handled by the clipper if necessary
return (RLSW.cullFace == SW_FRONT)? (sgnArea < 0.0f) : (sgnArea > 0.0f); // Cull if winding is "clockwise" : "counter-clockwise" return (RLSW.cullFace == SW_FRONT)? (sgnArea < 0.0f) : (sgnArea > 0.0f); // Cull if winding is "clockwise" : "counter-clockwise"
@ -3879,8 +3876,7 @@ static inline void sw_poly_fill_render(uint32_t state)
//------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------
static void sw_immediate_begin(SWdraw mode) static void sw_immediate_begin(SWdraw mode)
{ {
// NOTE: Any checks to ensure command recording can start // NOTE: Any checks to ensure command recording can start must be performed before calling this function
// must be performed before calling this function.
// Recalculate the MVP if this is needed // Recalculate the MVP if this is needed
if (RLSW.isDirtyMVP) if (RLSW.isDirtyMVP)
@ -3891,8 +3887,8 @@ static void sw_immediate_begin(SWdraw mode)
#ifdef SW_HAS_ESP_DSP #ifdef SW_HAS_ESP_DSP
// Pre-transpose to row-major so dspm_mult_4x4x1_f32(matMVP_rm, v, out) // Pre-transpose to row-major so dspm_mult_4x4x1_f32(matMVP_rm, v, out)
// computes M*v directly in the per-vertex hot path. 16 scalar copies // computes M*v directly in the per-vertex hot path; 16 scalar copies
// per MVP update vs. saving ~20 cycles per vertex transform. // per MVP update vs saving ~20 cycles per vertex transform
for (int i = 0; i < 4; i++) for (int i = 0; i < 4; i++)
{ {
for (int j = 0; j < 4; j++) for (int j = 0; j < 4; j++)
@ -3955,7 +3951,7 @@ static void sw_immediate_push_vertex(const float position[4])
// Calculate clip coordinates // Calculate clip coordinates
#ifdef SW_HAS_ESP_DSP #ifdef SW_HAS_ESP_DSP
// dspm_mult_4x4x1_f32 declares its inputs non-const; rlsw treats them as // dspm_mult_4x4x1_f32 declares its inputs non-const; rlsw treats them as
// read-only and the cast is safe (the kernel only loads from B). // read-only and the cast is safe (the kernel only loads from B)
dspm_mult_4x4x1_f32(RLSW.matMVP_rm, (float *)position, vertex->position); dspm_mult_4x4x1_f32(RLSW.matMVP_rm, (float *)position, vertex->position);
#else #else
const float *m = RLSW.matMVP; const float *m = RLSW.matMVP;
@ -5567,7 +5563,7 @@ static void SW_RASTER_TRIANGLE(const sw_vertex_t *v0, const sw_vertex_t *v1, con
if (v0->position[1] > v1->position[1]) { const sw_vertex_t *tmp = v0; v0 = v1; v1 = tmp; } if (v0->position[1] > v1->position[1]) { const sw_vertex_t *tmp = v0; v0 = v1; v1 = tmp; }
// Extracting coordinates from the sorted vertices // Extracting coordinates from the sorted vertices
// Put x away for safe keeping. Only y is used right now. Silences warnings. // Put x away for safe keeping; only y is used right now; silences warnings
float y0 = v0->position[1]; float y0 = v0->position[1];
float y1 = v1->position[1]; float y1 = v1->position[1];
float y2 = v2->position[1]; float y2 = v2->position[1];

View File

@ -810,8 +810,8 @@ void SetWindowSize(int width, int height)
RGFW_monitor* currentMonitor = RGFW_window_getMonitor(platform.window); RGFW_monitor* currentMonitor = RGFW_window_getMonitor(platform.window);
CORE.Window.screenScale = MatrixScale(currentMonitor->pixelRatio, currentMonitor->pixelRatio, 1.0f); CORE.Window.screenScale = MatrixScale(currentMonitor->pixelRatio, currentMonitor->pixelRatio, 1.0f);
CORE.Window.render.width = CORE.Window.screen.width * currentMonitor->pixelRatio; CORE.Window.render.width = CORE.Window.screen.width*currentMonitor->pixelRatio;
CORE.Window.render.height = CORE.Window.screen.height * currentMonitor->pixelRatio; CORE.Window.render.height = CORE.Window.screen.height*currentMonitor->pixelRatio;
CORE.Window.currentFbo.width = CORE.Window.render.width; CORE.Window.currentFbo.width = CORE.Window.render.width;
CORE.Window.currentFbo.height = CORE.Window.render.height; CORE.Window.currentFbo.height = CORE.Window.render.height;
#else #else
@ -1132,16 +1132,16 @@ void SwapScreenBuffer(void)
{ {
if (platform.surface) if (platform.surface)
{ {
// copy rlsw pixel data to the surface framebuffer // Copy rlsw pixel data to the surface framebuffer
swReadPixels(0, 0, platform.surfaceWidth, platform.surfaceHeight, SW_RGBA, SW_UNSIGNED_BYTE, platform.surfacePixels); rlCopyFramebuffer(0, 0, platform.surfaceWidth, platform.surfaceHeight, PIXELFORMAT_UNCOMPRESSED_R8G8B8A8, platform.surfacePixels);
// Mac wants a different pixel order. I cant seem to get this to work any other way // Mac wants a different pixel order. I cant seem to get this to work any other way
#if defined(__APPLE__) #if defined(__APPLE__)
unsigned char temp = 0; unsigned char temp = 0;
unsigned char *p = NULL; unsigned char *p = NULL;
for (int i = 0; i < (platform.surfaceWidth * platform.surfaceHeight); i += 1) for (int i = 0; i < (platform.surfaceWidth*platform.surfaceHeight); i += 1)
{ {
p = platform.surfacePixels + (i * 4); p = platform.surfacePixels + (i*4);
temp = p[0]; temp = p[0];
p[0] = p[2]; p[0] = p[2];
p[2] = temp; p[2] = temp;
@ -1357,13 +1357,13 @@ void PollInputEvents(void)
if (FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_HIGHDPI)) if (FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_HIGHDPI))
{ {
RGFW_monitor* currentMonitor = RGFW_window_getMonitor(platform.window); RGFW_monitor* currentMonitor = RGFW_window_getMonitor(platform.window);
SetupViewport(platform.window->w * currentMonitor->pixelRatio, platform.window->h * currentMonitor->pixelRatio); SetupViewport(platform.window->w*currentMonitor->pixelRatio, platform.window->h*currentMonitor->pixelRatio);
CORE.Window.screenScale = MatrixScale(currentMonitor->pixelRatio, currentMonitor->pixelRatio, 1.0f); CORE.Window.screenScale = MatrixScale(currentMonitor->pixelRatio, currentMonitor->pixelRatio, 1.0f);
CORE.Window.screen.width = platform.window->w; CORE.Window.screen.width = platform.window->w;
CORE.Window.screen.height = platform.window->h; CORE.Window.screen.height = platform.window->h;
CORE.Window.render.width = CORE.Window.screen.width * currentMonitor->pixelRatio; CORE.Window.render.width = CORE.Window.screen.width*currentMonitor->pixelRatio;
CORE.Window.render.height = CORE.Window.screen.height * currentMonitor->pixelRatio; CORE.Window.render.height = CORE.Window.screen.height*currentMonitor->pixelRatio;
} }
else else
{ {
@ -1406,10 +1406,10 @@ void PollInputEvents(void)
#if defined(__APPLE__) #if defined(__APPLE__)
RGFW_monitor* currentMonitor = RGFW_window_getMonitor(platform.window); RGFW_monitor* currentMonitor = RGFW_window_getMonitor(platform.window);
CORE.Window.screenScale = MatrixScale(currentMonitor->pixelRatio, currentMonitor->pixelRatio, 1.0f); CORE.Window.screenScale = MatrixScale(currentMonitor->pixelRatio, currentMonitor->pixelRatio, 1.0f);
SetupViewport(platform.window->w * currentMonitor->pixelRatio, platform.window->h * currentMonitor->pixelRatio); SetupViewport(platform.window->w*currentMonitor->pixelRatio, platform.window->h*currentMonitor->pixelRatio);
CORE.Window.render.width = CORE.Window.screen.width * currentMonitor->pixelRatio; CORE.Window.render.width = CORE.Window.screen.width*currentMonitor->pixelRatio;
CORE.Window.render.height = CORE.Window.screen.height * currentMonitor->pixelRatio; CORE.Window.render.height = CORE.Window.screen.height*currentMonitor->pixelRatio;
CORE.Window.currentFbo.width = CORE.Window.render.width; CORE.Window.currentFbo.width = CORE.Window.render.width;
CORE.Window.currentFbo.height = CORE.Window.render.height; CORE.Window.currentFbo.height = CORE.Window.render.height;
#endif #endif
@ -1427,7 +1427,7 @@ void PollInputEvents(void)
if (platform.surfacePixels != NULL) if (platform.surfacePixels != NULL)
{ {
RL_FREE(platform.surfacePixels); RL_FREE(platform.surfacePixels);
platform.surfacePixels = RL_MALLOC(platform.surfaceWidth * platform.surfaceHeight * 4); platform.surfacePixels = RL_MALLOC(platform.surfaceWidth*platform.surfaceHeight*4);
} }
if (platform.surface != NULL) if (platform.surface != NULL)
@ -1743,8 +1743,8 @@ int InitPlatform(void)
if (FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_HIGHDPI)) if (FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_HIGHDPI))
{ {
#if !defined(__APPLE__) #if !defined(__APPLE__)
CORE.Window.screen.width = CORE.Window.screen.width * GetWindowScaleDPI().x; CORE.Window.screen.width = CORE.Window.screen.width*GetWindowScaleDPI().x;
CORE.Window.screen.height = CORE.Window.screen.height * GetWindowScaleDPI().y; CORE.Window.screen.height = CORE.Window.screen.height*GetWindowScaleDPI().y;
#endif #endif
} }
@ -1828,8 +1828,8 @@ int InitPlatform(void)
RGFW_monitor* currentMonitor = RGFW_window_getMonitor(platform.window); RGFW_monitor* currentMonitor = RGFW_window_getMonitor(platform.window);
CORE.Window.screenScale = MatrixScale(currentMonitor->pixelRatio, currentMonitor->pixelRatio, 1.0f); CORE.Window.screenScale = MatrixScale(currentMonitor->pixelRatio, currentMonitor->pixelRatio, 1.0f);
CORE.Window.render.width = CORE.Window.screen.width * currentMonitor->pixelRatio; CORE.Window.render.width = CORE.Window.screen.width*currentMonitor->pixelRatio;
CORE.Window.render.height = CORE.Window.screen.height * currentMonitor->pixelRatio; CORE.Window.render.height = CORE.Window.screen.height*currentMonitor->pixelRatio;
CORE.Window.currentFbo.width = CORE.Window.render.width; CORE.Window.currentFbo.width = CORE.Window.render.width;
CORE.Window.currentFbo.height = CORE.Window.render.height; CORE.Window.currentFbo.height = CORE.Window.render.height;
#else #else
@ -1846,8 +1846,8 @@ int InitPlatform(void)
RGFW_monitor* currentMonitor = RGFW_window_getMonitor(platform.window); RGFW_monitor* currentMonitor = RGFW_window_getMonitor(platform.window);
CORE.Window.screenScale = MatrixScale(currentMonitor->pixelRatio, currentMonitor->pixelRatio, 1.0f); CORE.Window.screenScale = MatrixScale(currentMonitor->pixelRatio, currentMonitor->pixelRatio, 1.0f);
CORE.Window.render.width = CORE.Window.screen.width * currentMonitor->pixelRatio; CORE.Window.render.width = CORE.Window.screen.width*currentMonitor->pixelRatio;
CORE.Window.render.height = CORE.Window.screen.height * currentMonitor->pixelRatio; CORE.Window.render.height = CORE.Window.screen.height*currentMonitor->pixelRatio;
CORE.Window.currentFbo.width = CORE.Window.render.width; CORE.Window.currentFbo.width = CORE.Window.render.width;
CORE.Window.currentFbo.height = CORE.Window.render.height; CORE.Window.currentFbo.height = CORE.Window.render.height;
#endif #endif
@ -1855,7 +1855,7 @@ int InitPlatform(void)
platform.surfaceWidth = CORE.Window.currentFbo.width; platform.surfaceWidth = CORE.Window.currentFbo.width;
platform.surfaceHeight = CORE.Window.currentFbo.height; platform.surfaceHeight = CORE.Window.currentFbo.height;
platform.surfacePixels = RL_MALLOC(platform.surfaceWidth * platform.surfaceHeight * 4); platform.surfacePixels = RL_MALLOC(platform.surfaceWidth*platform.surfaceHeight*4);
if (platform.surfacePixels == NULL) if (platform.surfacePixels == NULL)
{ {
TRACELOG(LOG_FATAL, "PLATFORM: Failed to initialize software pixel buffer"); TRACELOG(LOG_FATAL, "PLATFORM: Failed to initialize software pixel buffer");

View File

@ -374,6 +374,8 @@ double GetTime(void)
unsigned long long nanoSeconds = (unsigned long long)ts.tv_sec*1000000000LLU + (unsigned long long)ts.tv_nsec; unsigned long long nanoSeconds = (unsigned long long)ts.tv_sec*1000000000LLU + (unsigned long long)ts.tv_nsec;
time = (double)(nanoSeconds - CORE.Time.base)*1e-9; // Elapsed time since InitTimer() time = (double)(nanoSeconds - CORE.Time.base)*1e-9; // Elapsed time since InitTimer()
#elif defined(PICO_RP2350)
time = (double)to_ms_since_boot(get_absolute_time())/1000.0;
#endif #endif
return time; return time;
} }

View File

@ -506,6 +506,7 @@ __declspec(dllimport) void __stdcall Sleep(unsigned long msTimeout); // Required
const char *TextFormat(const char *text, ...); // Formatting of text with variables to 'embed' const char *TextFormat(const char *text, ...); // Formatting of text with variables to 'embed'
#endif #endif
// NOTE: PLATFORM_DESKTOP defaults to GLFW backend
#if defined(PLATFORM_DESKTOP) #if defined(PLATFORM_DESKTOP)
#define PLATFORM_DESKTOP_GLFW #define PLATFORM_DESKTOP_GLFW
#endif #endif

View File

@ -580,8 +580,13 @@ Font LoadFontFromMemory(const char *fileType, const unsigned char *fileData, int
TRACELOG(LOG_INFO, "FONT: Data loaded successfully (%i pixel size | %i glyphs)", font.baseSize, font.glyphCount); TRACELOG(LOG_INFO, "FONT: Data loaded successfully (%i pixel size | %i glyphs)", font.baseSize, font.glyphCount);
} }
else font = GetFontDefault(); else
{
TRACELOG(LOG_WARNING, "FONT: Font is not supported by LoadFontEx/LoadFontFromMemory or no glyphs found, reverted to default font");
font = GetFontDefault();
}
#else #else
TRACELOG(LOG_WARNING, "FONT: Font is not supported by LoadFontEx/LoadFontFromMemory or no glyphs found, reverted to default font");
font = GetFontDefault(); font = GetFontDefault();
#endif #endif