Commit Graph

5694 Commits

Author SHA1 Message Date
Peter0x44
dcb0ca5d14
[raudio]: free converterResidual in UnloadSoundAlias to prevent leak (#5857)
The example audio_sound_multi was leaking memory every single time the spacebar was pressed.

```c
Direct leak of 576 byte(s) in 9 object(s) allocated from:
    #0 0x758a41019447 in calloc (/usr/lib/liblsan.so.0+0x19447) (BuildId: 8ee115309adc591d231c961c43d245cfa68d9aa7)
    #1 0x562dfbd2c4f3 in LoadAudioBuffer (/home/peter/raylib/examples/audio/audio_sound_multi+0xfa4f3) (BuildId: ea2a6f45d724abeccf904143a32012266f259f93)
```

This patch fixes that leak.
2026-05-10 15:01:38 +02:00
Faraz Fallahi
07b729d5d6
fix: check fread return value in jar_mod_load_file (#5840) 2026-05-09 18:55:02 +02:00
Ray
b2ea5eae5e REVIEWED: long long usage in all raylib, minimize
REVIEWED: Using `long long` format instead of `long long int`, more consistent with the `short` alternative for smaller `int`, instead of `short int`
2026-05-08 22:59:55 +02:00
mjt
29ff1f02e9
Update Makefile comment (#5846) 2026-05-08 20:19:08 +02:00
Ray
aceb8ce3a8 Re-enable GLFW_LINUX_ENABLE_WAYLAND flag by default #5816
Wayland should be more stable at this point...
2026-05-07 15:24:08 +02:00
Ray
33e889907e ADDED: GL_SHADING_LANGUAGE_VERSION for swGetString() 2026-05-07 15:20:24 +02:00
Ray
61537200c0 Code cleaning 2026-05-07 15:18:42 +02:00
Colin James Wood
080f5c94bd
[rlsw][rcore_drm] Silence warnings when using PLATFORM_DRM and GRAPHICS_API_OPENGL_SOFTWARE (#5839)
* fix warnings: goto label not used outside of SW_ENABLE_DEPTH_TEST

* comment out x coordinates that aren't used in SW_RASTER_TRIANGLE

* silence warnings: unused DrmModeConnector functions in rcore_drm.c when using GRAPHICS_API_OPENGL_SOFTWARE
2026-05-07 15:17:20 +02:00
Jens Roth
7207c03c72
[rlsw] ESP32 optimizations (#5827)
* [rlsw] Add sw_rcp helper using Xtensa recip0.s for hot-path divisions

Adds a `sw_rcp(x)` inline reciprocal that on Xtensa (ESP32 / ESP32-S3
LX6/LX7) emits a `recip0.s` seed plus two Newton-Raphson refinement
steps -- 1-ULP accurate in ~7 instructions, all in FPU registers.
On every other target it expands to plain `1.0f/x`, so generated code
is byte-identical to before for non-Xtensa builds.

Replaces the hot-path `1.0f/x` calls that were previously compiling to
the `__divsf3` software helper on Xtensa:

  - perspective divide (1/w) in triangle clip-and-project (PCT and PC paths)
  - line and point clip-and-project NDC conversion
  - triangle span setup: dxRcp, blockLenRcp, wRcpA, wRcpB
  - triangle scanline setup: h02Rcp, h01Rcp, h12Rcp
  - axis-aligned quad: wRcp, hRcp
  - line rasterizer: stepRcp

Other `1.0f/x` uses (matrix translate/normalize, texture init `tx`/`ty`,
sw_matrix_rotate inverse-length) are not on the per-pixel hot path and
are left untouched.

Measured on ESP32-S3 @ 240 MHz, R5G6B5 240x240, textured 3D model:
contributes to a ~10-15% rasterization speedup.

Made-with: Cursor

* [rlsw] Use ESP-DSP for 4x4 matrix multiply and per-vertex MVP transform

Adds an opt-in ESP-DSP code path for ESP32 / ESP32-S3 builds. ESP-DSP is
ESP-IDF's official optimized math library and ships hand-vectorized
kernels that beat the scalar implementations on Xtensa.

Two integration points:

  1. `sw_matrix_mul_rst` -> `dspm_mult_4x4x4_f32` for any 4x4*4x4 multiply
     (used for MVP build, gluLookAt, push/multiply, etc.). rlsw stores
     matrices column-major and ESP-DSP reads row-major; the comment on the
     call site explains why the flat-buffer call still produces the
     correct column-major product (transpose-of-transposes equivalence).

  2. `sw_immediate_push_vertex` -> `dspm_mult_4x4x1_f32` for the per-vertex
     clip-space transform. Because ESP-DSP expects a row-major matrix in
     this case, a row-major copy `matMVP_rm[16]` is maintained alongside
     `matMVP` and refreshed once per `isDirtyMVP` rebuild in
     `sw_immediate_begin`. Cost is 16 scalar copies per matrix update,
     amortized over thousands of vertices per frame.

Detection is **opt-in** via `SW_USE_ESP_DSP` so existing ESP-IDF projects
that don't depend on the `esp-dsp` component keep building unchanged.
A user enables it from CMakeLists.txt (or anywhere before including
rlgl.h):

    target_compile_definitions(${COMPONENT_LIB} PRIVATE SW_USE_ESP_DSP=1)

and adds the dependency to `idf_component.yml`:

    espressif/esp-dsp: "^1.4.0"

Measured on ESP32-S3 @ 240 MHz, R5G6B5 240x240, textured 3D model:
contributes meaningfully to the overall frame-time improvement
(combined with sw_rcp).

Made-with: Cursor

* [rlsw] Add SW_TEXTURE_REPEAT_POT_FAST opt-in for POT bitmask wrap

Adds an opt-in compile-time flag that replaces the SW_REPEAT wrap chain
with a bitmask (`x & (size-1)`) for power-of-two textures. NPOT textures
keep using the original `sw_fract` / signed-modulo paths via a runtime
`(size & (size-1)) == 0` check, so SW_REPEAT remains correct for them.

Affects two samplers:

  - `sw_texture_sample_nearest`: drops the `floorf` + multiply + cast for
    POT textures in REPEAT mode (saves a software call on Xtensa).
  - `sw_texture_sample_linear`: replaces the `(x % w + w) % w` two-step
    modulo (a software divide on Xtensa) with a single bitwise AND for
    POT textures in REPEAT mode. Two's-complement int wrap covers
    negative coordinates correctly.

Off by default: for POT textures sampled with negative UVs, bitmask wrap
can differ from `sw_fract` wrap by one texel at the boundary. That is
imperceptible at typical resolutions but technically a behavior change,
so existing users get bit-for-bit identical output. Opt in if you
control your asset UVs and want the speedup:

    #define SW_TEXTURE_REPEAT_POT_FAST

This addresses the long-standing TODO comment "If the textures are POT,
avoid the division for SW_REPEAT" in `sw_texture_sample_linear`.

Made-with: Cursor
2026-05-06 12:38:52 +02:00
Ray
cf9f27db54 Update raymath.h 2026-05-02 09:09:50 +02:00
Ray
0a2b81b128 Update rcore_web.c 2026-05-02 09:09:40 +02:00
Tanguy
05c15c8ba7
SDL: Use precise mouse wheel values (#5830) 2026-05-01 19:29:51 +02:00
Lam Wei Lun
d768dae402
[build] Shift __cplusplus check to a higher level for bool type define (#5804)
* Adds a missing macro definition check

* Shifts __cplusplus check to a higher level for bool define

* Copy same change to rgestures.h and rlgl.h

* Fixes float comparison issues in raymath functions

* Revert "Fixes float comparison issues in raymath functions"

This reverts commit a266d0bbaa.
2026-04-29 18:02:49 +02:00
alphahex99
d580c47504
[raymath.h] Add missing (float * Vector) operator overloads (#5815) 2026-04-29 17:49:23 +02:00
Ray
d9427b1e6f REVIEWED: Avoid static variable floating around and include it to PlatformData struct 2026-04-29 17:42:51 +02:00
nate
da55d9067c
added NPOT check to rlLoadTexture to match rlGenTextureMipmaps and WebGL 1.0 standard (#5820) 2026-04-29 08:43:50 +02:00
Ray
2dd8d7e8b1 Update rcore_desktop_sdl.c 2026-04-29 01:08:16 +02:00
Huang Zhaobin
168e2c43d0
fix(rcore): correct string boundary handling (#5812)
Co-authored-by: Huang Zhaobin <xcpky@proton.me>
2026-04-29 00:18:33 +02:00
Ray
72a341a37f Update rtext.c 2026-04-27 12:34:43 +02:00
Ray
98efce4b0d WARNING: RENAMED: GetSplinePointBezierQuad() to GetSplinePointBezierQuadratic()
Consistent with similar spline functions and avoid confusion with `Quad` related functions.
2026-04-27 11:47:48 +02:00
Ray
c9c26d8071 REVIEWED: ImageColorContrast() parameter type, consistent with other Image*() functions 2026-04-27 11:46:43 +02:00
Ray
0e68f812b5 WARNING: REDESIGNED: ImageDrawRectangleLines(), consistency with DrawRectangleLines()
ADDED: `ImageDrawRectangleLinesEx()`
2026-04-27 11:45:50 +02:00
Ray
2752837839 REVIEWED: UpdateSound(), missleading parameter name! 2026-04-27 11:44:14 +02:00
Ray
361dcb2a1f WARNING: REVIEWED: DrawCapsule()/DrawCapsuleWires() parameter order
for consistency with `DrawSphere*()`
2026-04-27 11:42:53 +02:00
Ray
3d2008c70b RENAMED: ImageDrawTriangleEx() to ImageDrawTriangleGradient()
For consistency with the new `DrawTriangleGradient()`
2026-04-27 11:40:14 +02:00
Ray
3b70f83c7d Update raylib.h 2026-04-27 11:38:23 +02:00
Ray
636269f6af ADDED: DrawTriangleGradient() 2026-04-27 11:37:48 +02:00
Ray
620b21bfce REVIEWED: Several functions const correctness 2026-04-27 11:36:32 +02:00
Ray
06621eb3b7 REVIEWED: Comments for consistency and spelling 2026-04-27 11:34:58 +02:00
Ray
6ae16c9895 REVIEWED: FileMove(), additional security checks 2026-04-27 10:23:28 +02:00
Ray
00f3af78e3 UPDATED: Set version to raylib 6.1-dev to avoid confusions 2026-04-27 10:22:31 +02:00
Ray
47bb749ce9 RVIEWED: Comment to avoid invalid json gneration #5809 2026-04-27 10:21:50 +02:00
Jeffery Myers
8e82249f65
Update to latest DR libs to fix some warnings in MSVC (#5808) 2026-04-26 20:16:35 +02:00
Luca Duran
dff07d020c
Fix FileMove from delete file if FileCopy did not work (#5806) 2026-04-26 20:15:33 +02:00
bielern
c2ea6a38b5
Fix: Add NULL check to CheckCollisionLines (#5802) 2026-04-25 19:53:34 +02:00
Ray
4cae4ba9d5 REVIEWED: IsModelValid() #5780 2026-04-24 14:03:59 +02:00
Ray
07a056441a Update raudio.c 2026-04-24 13:59:41 +02:00
Ray
254953611e Update rcore.c 2026-04-24 13:58:52 +02:00
rigidatoms
5608460901
add missing UnloadFileData() (#5787)
Adds missing function necessary for using the module as a standalone library.
2026-04-24 13:57:20 +02:00
Ray
cc752037b9 Update rmodels.c 2026-04-19 13:54:39 +02:00
Maicon Santana
90e9145978
Making it similar to CheckCollisionSpheres to remove pow function (#5776) 2026-04-19 13:51:52 +02:00
Itwerntme
9060ac7c95
Mouse delta calculation with scaling (#5779)
Added scaling from SetMouseScale to mouse GetMouseDelta
2026-04-19 13:50:15 +02:00
Ray
4ced756474 Merge branch 'master' of https://github.com/raysan5/raylib 2026-04-18 18:53:05 +02:00
Ray
88f8ca42f5 Update rcore_drm.c 2026-04-18 18:53:03 +02:00
Thomas Anderson
f0a043bb75
[Platform/RGFW] add support for software rendering (#5773)
* add support for software rendering

* null check on freeing

* add back line

* rename framebuffer to surface

* add guard on free

* update makefile to prevent software on web

* update for mac
2026-04-17 18:09:57 +02:00
Ray
1cbe438f93 Update rcore_desktop_rgfw.c 2026-04-17 18:03:29 +02:00
Ray
7c96c24cf9 Update rcore.c 2026-04-17 17:57:05 +02:00
Ray
d116c92f13 Merge branch 'master' of https://github.com/raysan5/raylib 2026-04-17 17:57:01 +02:00
Ray
14fe0cbfd8 Update rlgl.h 2026-04-17 17:56:49 +02:00
Ray
94f3c094e7 Update raudio.c 2026-04-17 17:56:47 +02:00
Thomas Anderson
be768e27f9
fix issue with gettime (#5772) 2026-04-17 17:55:04 +02:00
Ray
49f88dc6ed Update config.h 2026-04-16 11:12:50 +02:00
Nilso Júnior
86aa0950bd
[raymath] Refactor QuaternionFromAxisAngle (#5766)
Checking if lenght equals 0 inside the if statement is not necessary.
2026-04-16 08:37:04 +02:00
Ray
96e30549f5 Align default values on comments for config variables 2026-04-16 00:05:23 +02:00
Ray
1e43c1d372 Revert "Remap stb_vorbis malloc/free calls to RL_MALLOC/RL_FREE (#5763)"
This reverts commit 21897f4bb9.
2026-04-15 23:58:05 +02:00
nadav78
21897f4bb9
Remap stb_vorbis malloc/free calls to RL_MALLOC/RL_FREE (#5763) 2026-04-15 23:51:47 +02:00
Ray
d8ebeb8939 Update raymath.h 2026-04-15 21:03:25 +02:00
Ray
82e980bd42 Log info about HighDPI content scaling on display initialization 2026-04-15 12:37:42 +02:00
Thomas Anderson
0decdcd497
update defines for new format etc (#5760) 2026-04-15 12:20:51 +02:00
Thomas Anderson
4628915787
Update typos/grammar (#5759) 2026-04-15 09:18:30 +02:00
Ray
1339ec637e Update raylib.h 2026-04-12 19:49:45 +02:00
Ray
51d693607e Update Makefile 2026-04-12 11:07:19 +02:00
Ray
a5427bc38f Update rlsw.h 2026-04-12 11:07:09 +02:00
Maicon Santana
605303f62b
fix: pthread_mutex_lock called on a destroyed mutex (#5752) 2026-04-12 10:32:05 +02:00
Thomas Anderson
b3592631b0
update makefile for PLATFORM_MEMORY (#5750) 2026-04-12 10:25:59 +02:00
Ray
ddfbe973d4 Updated Windows resource file 2026-04-12 10:24:35 +02:00
Thomas Anderson
fe5271c568
update raylib.rc to 6.0 (2026) (#5748) 2026-04-12 10:23:09 +02:00
Thomas Anderson
de95b3aa70
added gpuready check to gentexturemipmaps (#5747) 2026-04-10 15:42:06 +02:00
Ray
05a14456ae REDESIGNED: DrawCircleGradieent() to use Vector2 as center parameter #5738 2026-04-09 11:16:31 +02:00
Angshuman Kishore Mahato
c5fc771622
removed the first RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEMATRICES (#5727) 2026-04-06 00:38:04 +02:00
Krzysztof Szenk
4a6ceb9c76
[rcore_rgfw] Icon color format fix (#5724)
After RGFW update to 2.0.0-dev in fbd83cafc7, RGFW_window_setIcon api has changed -- not it takes pixel format enum instead of number of channels. On raylib side it was still passing 4 (number of channels in rgba) which is enum value for BGRA8. Instead we have to pass 2 now (RGFW_formatRGBA8 = 2).
2026-04-05 10:50:31 +02:00
Ray
6ef0044381 REVIEWED: Window messages WM_SIZING, WM_SIZE, WM_WINDOWPOSCHANGED #5720 2026-04-04 17:37:25 +02:00
Ray
1122add3ee Minor format tweak 2026-04-04 17:36:18 +02:00
Ray
92f82b4add Update raylib.h 2026-04-04 16:50:15 +02:00
Le Juez Victor
138ef838d9
[rlsw] Some platform fixes (#5720)
* fix drm with rlsw

* fix window resizing with sdl

* fix window resizing with win32
2026-04-04 16:47:33 +02:00
Ray
5c2dee0862 REVIEWED: LoadDirectoryFiles*() comments 2026-04-01 23:23:25 +02:00
Krzysztof Szenk
4ca9170f5b
[rcore_rgfw] Updating render resolution as well on SetWindowSize (#5709)
* [rcore_rgfw] Updating render resolution as well on SetWindowSize

* Actually, maybe even better call SetupViewport()
2026-04-01 09:46:14 +02:00
Ray
8743e11285 Update rmodels.c 2026-03-29 21:40:41 +02:00
Ray
04f81538b7 ADDED: Some sample code to export gltf/glb meshes -WIP- 2026-03-29 21:37:01 +02:00
Ray
6c0134bb5c Create cgltf_write.h 2026-03-29 21:24:24 +02:00
Ray
e9231bc4f1 Update stb_image_resize2.h 2026-03-29 21:24:20 +02:00
Ray
4c79c6837b Update qoi.h 2026-03-29 21:21:16 +02:00
Ray
e5f0c9f8b1 Update qoa.h 2026-03-29 21:21:11 +02:00
Ray
d5326fe880 Update m3d.h 2026-03-29 21:20:23 +02:00
Ray
adc4c9b875 Update dr_wav.h 2026-03-29 21:19:31 +02:00
Ray
b09da8fce8 Update dr_mp3.h 2026-03-29 21:18:56 +02:00
Ray
0b87a35e5a Update dr_flac.h 2026-03-29 21:18:28 +02:00
Ray
a1bf8d9c75 Update cgltf.h 2026-03-29 21:17:51 +02:00
Ray
da93ec4a21 Remove trailing spaces 2026-03-29 01:17:25 +01:00
Ray
29ded51ea4 Update rlgl.h 2026-03-29 00:43:50 +01:00
Jeffery Myers
bb78e98a71
Remove forced normalization of normal vectors in rlNormal3f, assume the user has set the correct input for the shader. (#5703) 2026-03-29 00:39:23 +01:00
Ray
8c44ea5032 Code gardening
REVIEWED: Some early returns, avoid if possible
REVIEWED: Some return variable names, for consistency, rename `success` to `result`
2026-03-29 00:37:01 +01:00
Ray
5fad835ff1 Update rcore.c 2026-03-28 23:54:51 +01:00
mjt
4142c89baa
Update rcore.c comment (#5700) 2026-03-27 21:58:28 +01:00
Ray
8a7aff509d WARNING: BREAKING: REDESIGNED: TextInsert(), TextReplace(), TextReplaceBetween(), using static buffers
Redesign has been conditioned by the usage of those functions on `rexm`, `rpc` and other tools; for many use cases a static buffer is enough and way more comfortable to use.
ADDED: `TextInsertAlloc()`, `TextReplaceAlloc()`, `TextReplaceBetweenAlloc()`, alternatives with internal allocations
2026-03-27 21:56:29 +01:00
Le Juez Victor
ba83bd33f3
simplify CheckCollisionSpheres using Vector3DistanceSqr (#5695) 2026-03-27 09:26:53 +01:00
Antonio Jose Ramos Marquez
51f4741912
[rmodel] fix for devices without VAO support (#5692) 2026-03-27 09:25:26 +01:00
Maicon Santana
a693365bf2
Move DrawModelPoints methods to example - point rendering (#5697) 2026-03-26 18:29:05 +01:00
Ray
0f0983c065 Remove trailing spaces 2026-03-25 16:51:02 +01:00
Krzysztof Szenk
cb05ef7f03
[rcore_desktop_rgfw] [emscripten] fix typo (#5687)
* RGFW also requires RGBA8 images as window icons, as raylib already reports in raylib.h

* LibraryConfigurations.cmake: exchanged MATCHES -> STREQUAL in platform choosing if-statements

* WebRGFW: remapping mouse/touch position to canvas pixel coordinates

* fix 'typo'

* has to be done like that because of += in case of captured mouse

* [rcore_desktop_rgfw] [emscripten] fix typo
2026-03-23 22:22:21 +01:00