Merge remote-tracking branch 'origin/master' into rlsw-blend-mode

This commit is contained in:
Bigfoot71 2026-03-18 22:30:42 +01:00
commit 073b94ffc3
12 changed files with 308 additions and 280 deletions

View file

@ -747,12 +747,13 @@ Detailed changes:
[rexm] REVIEWED: `Makefile.Web` before trying to rebuild new example for web by @raysan5
[rexm] REVIEWED: Using `Makefile.Web` for specific web versions generation by @raysan5
[external] RENAMED: `rl_gputex.h` to `rltexgpu.h`, compressed textures loading
[external] REVIEWED: `rltexgpu.h`, make it usable standalone by @raysan5
[external] REVIEWED: `rltexgpu.h, fix the swizzling in `rl_load_dds_from_memory()` (#5422) by @msmith-codes
[external]`REVIEWED: `rltexgpu.h, decouple logging and memory allocation from raylib by @sleeptightAnsiC
[external] REVIEWED: `jar_mod.h`, buffer overflow on memcpy by @LoneAuios
[external] REVIEWED: `sdefl` and `sinfl` issues (#5367) by @raysan5
[external] REVIEWED: `sinfl_bsr()`, improvements by @RicoP
[external] REVIEWED: `rl_gputex.h`, make it usable standalone by @raysan5
[external] REVIEWED: `rl_gputex.h,, fix the swizzling in `rl_load_dds_from_memory()` (#5422) by @msmith-codes
[external]`REVIEWED: `rl_gputex.h,, decouple logging and memory allocation from raylib by @sleeptightAnsiC
[external] REVIEWED: `stb_truetype`, fix composite glyph scaling logic (#4811) by @ashishbhattarai
[external] UPDATED: dr_libs (#5020) by @Emil2010
[external] UPDATED: miniaudio to v0.11.22 (#4983) by @M374LX

View file

@ -419,7 +419,7 @@ Highlights for `raylib 4.5`:
- **`NEW` Support QOA audio format (import/export)**: Just a couple of months ago the new [QOA file format](https://qoaformat.org/) was published, a very simple, portable and open source quite-ok-audio file format. raylib already supports it, added to `raudio` module and including audio loading from file, loading from memory, streaming from file, streaming from memory and **exporting to QOA** audio format. **Because simplicity really matters to raylib!**
- **`NEW` Module for compressed textures loading**: [`rl_gputex`](https://github.com/raysan5/raylib/blob/master/src/external/rl_gputex.h), a portable single-file header-only small library to load compressed texture file-formats (DDS, PKM, KTX, PVR, ASTC). Provided functionality is not new to raylib but it was part of the raylib `rtextures` module, now it has been moved into a separate self-contained library, **improving portability**. Note that this module is only intended to **load compressed data from files, ready to be uploaded to GPU**, no compression/decompression functionality is provided. This change is a first step towards a better modularization of raylib library.
- **`NEW` Module for compressed textures loading**: [`rl_gputex`](https://github.com/raysan5/raylib/blob/master/src/external/rltexgpu.h), a portable single-file header-only small library to load compressed texture file-formats (DDS, PKM, KTX, PVR, ASTC). Provided functionality is not new to raylib but it was part of the raylib `rtextures` module, now it has been moved into a separate self-contained library, **improving portability**. Note that this module is only intended to **load compressed data from files, ready to be uploaded to GPU**, no compression/decompression functionality is provided. This change is a first step towards a better modularization of raylib library.
- **Reviewed `rlgl` module for automatic limits checking**: Again, [`rlgl`](https://github.com/raysan5/raylib/blob/master/src/rlgl.h) has been reviewed to simplify usage. Now users do not need to worry about reaching the internal render-batch limits when they send their triangles to draw 2d/3d, `rlgl` manages it automatically! This change allows a **great simplification for other modules** like `rshapes`, `rtextures` and `rmodels` that do not need to worry about bufffer overflows and can just define as many vertex as desired!

View file

@ -13,16 +13,28 @@ Here is a wishlist with features and ideas to improve the library. Note that fea
_Current version of raylib is complete and functional but there is always room for improvements._
**raylib 5.x**
- [ ] `rcore`: Support additional platforms: iOS, consoles?
- [x] `rcore_web`: Avoid GLFW dependency, functionality can be directly implemented using emscripten SDK
- [x] `rlgl`: Review GLSL shaders naming conventions for consistency
- [ ] `textures`: Improve compressed textures support, loading and saving
**raylib 7.0**
- [ ] `rcore_desktop_win32`: Improve new Windows platform backend - inputs, highdpi
- [ ] `rcore_desktop_emscripten`: Improve new Web platform backend - inputs, highdpi
- [ ] `rcore_desktop_cocoa`: Create additional platform backend: macOS
- [ ] `rcore_desktop_x11`: Create additional platform backend: Linux/X11
- [ ] `rcore_desktop_wayland`: Create additional platform backend: Linux/Wayland
- [ ] `rcore`: Investigate alternative embedded platforms and realtime OSs
- [ ] `rlsw`: Software renderer optimizations: mipmaps, platform-specific SIMD
- [ ] `rtextures`: Consider moving N-patch system to separate example
- [ ] `rtextures`: Review blending modes system, provide more options or better samples
- [ ] `raudio`: Support microphone input, basic API to read microphone
- [ ] `rltexgpu`: Improve compressed textures support, loading and saving, improve KTX 2.0
- [ ] `rlobj`: Create OBJ loader, supporting material file separately (low priority)
**raylib 6.0**
- [x] `rlsw`: New Software Renderer backend, pseudo-OpenGL 1.1 implementation
- [x] `rcore_emscripten`: New emscripten-only backend, avoiding GLFW dependency
- [x] `rlgl`: Review GLSL shaders naming conventions for consistency, redesigned shader API
- [x] `rmodels`: Improve 3d objects loading, specially animations (obj, gltf)
- [x] `examples`: Review all examples, add more and better code explanations
- [x] Software renderer backend? Maybe using `Image` provided API
**raylib 4.x**
**raylib 5.0**
- [x] Split core module into separate platforms?
- [x] Redesign gestures system, improve touch inputs management
- [x] Redesign camera module (more flexible) ([#1143](https://github.com/raysan5/raylib/issues/1143), https://github.com/raysan5/raylib/discussions/2507)
@ -30,7 +42,6 @@ _Current version of raylib is complete and functional but there is always room f
- [x] Focus on HTML5 ([raylib 5k gamejam](https://itch.io/jam/raylib-5k-gamejam)) and embedded platforms (RPI and similar SOCs)
- [x] Additional support libraries: [raygui](https://github.com/raysan5/raygui), [rres](https://github.com/raysan5/rres)
**raylib 4.0**
- [x] Improved consistency and coherency in raylib API
- [x] Continuous Deployment using GitHub Actions

View file

@ -585,6 +585,9 @@
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\..\src\external\cgltf.h" />
<ClInclude Include="..\..\..\src\external\rlsw.h" />
<ClInclude Include="..\..\..\src\external\rltexgpu.h" />
<ClInclude Include="..\..\..\src\external\rprand.h" />
<ClInclude Include="..\..\..\src\rcamera.h" />
<ClInclude Include="..\..\..\src\config.h" />
<ClInclude Include="..\..\..\src\external\glad.h" />

View file

@ -102,6 +102,15 @@
<ClInclude Include="..\..\..\src\external\stb_vorbis.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\external\rlsw.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\external\rltexgpu.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\external\rprand.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="..\..\..\src\raylib.dll.rc" />

View file

@ -959,6 +959,7 @@ ifeq ($(ROOT),root)
endif
rm --force --interactive --verbose $(RAYLIB_H_INSTALL_PATH)/raylib.h
rm --force --interactive --verbose $(RAYLIB_H_INSTALL_PATH)/raymath.h
rm --force --interactive --verbose $(RAYLIB_H_INSTALL_PATH)/rcamera.h
rm --force --interactive --verbose $(RAYLIB_H_INSTALL_PATH)/rlgl.h
@echo "raylib development files removed!"
else

39
src/external/rlsw.h vendored
View file

@ -969,8 +969,8 @@ typedef struct {
int allocSz; // Allocated size
SWfilter minFilter; // Minification filter
SWfilter magFilter; // Magnification filter
SWwrap sWrap; // texcoord.x wrap mode
SWwrap tWrap; // texcoord.y wrap mode
SWwrap sWrap; // Wrap mode for texcoord.x
SWwrap tWrap; // Wrap mode for texcoord.y
float tx; // Texel width
float ty; // Texel height
} sw_texture_t;
@ -1364,7 +1364,7 @@ static inline uint16_t sw_float_to_half_ui(uint32_t ui)
// Overflow: infinity; 143 encodes exponent 16
h = (em >= (143 << 23))? 0x7c00 : h;
// NaN; note that we convert all types of NaN to qNaN
// NaN; note that all types of NaN are converted to qNaN
h = (em > (255 << 23))? 0x7e00 : h;
return (uint16_t)(s | h);
@ -1381,8 +1381,8 @@ static inline uint32_t sw_half_to_float_ui(uint16_t h)
// Denormal: flush to zero
r = (em < (1 << 10))? 0 : r;
// Infinity/NaN; note that we preserve NaN payload as a byproduct of unifying inf/nan cases
// 112 is an exponent bias fixup; since we already applied it once, applying it twice converts 31 to 255
// Infinity/NaN; note that NaN payload is preeserved as a byproduct of unifying inf/nan cases
// 112 is an exponent bias fixup; since it was already applied once, applying it twice converts 31 to 255
r += (em >= (31 << 10))? (112 << 23) : 0;
return s | r;
@ -2478,8 +2478,9 @@ static inline void sw_texture_sample_linear(float *SW_RESTRICT color, const sw_t
static inline void sw_texture_sample(float *SW_RESTRICT color, const sw_texture_t *SW_RESTRICT tex,
float u, float v, float dUdx, float dUdy, float dVdx, float dVdy)
{
// Previous method: There is no need to compute the square root
// because using the squared value, the comparison remains (L2 > 1.0f*1.0f)
// NOTE: Commented there is the previous method used
// There was no need to compute the square root because
// using the squared value, the comparison remains (L2 > 1.0f*1.0f)
//float du = sqrtf(dUdx*dUdx + dUdy*dUdy);
//float dv = sqrtf(dVdx*dVdx + dVdy*dVdy);
//float L = (du > dv)? du : dv;
@ -2525,10 +2526,9 @@ static inline void sw_default_framebuffer_free(sw_default_framebuffer_t *fb)
static inline void sw_framebuffer_fill_color(sw_texture_t *colorBuffer, const float color[4])
{
// NOTE: MSVC doesn't support VLA, so we allocate the largest possible size
//uint8_t pixel[SW_FRAMEBUFFER_COLOR_SIZE];
uint8_t pixel[16];
// NOTE: MSVC doesn't support VLA, so the largest possible size is allocated: 16 bytes
//uint8_t pixel[SW_FRAMEBUFFER_COLOR_SIZE] = { 0 };
uint8_t pixel[16] = { 0 };
SW_FRAMEBUFFER_COLOR_SET(pixel, color, 0);
uint8_t *dst = (uint8_t *)colorBuffer->pixels;
@ -2565,10 +2565,9 @@ static inline void sw_framebuffer_fill_color(sw_texture_t *colorBuffer, const fl
static inline void sw_framebuffer_fill_depth(sw_texture_t *depthBuffer, float depth)
{
// NOTE: MSVC doesn't support VLA, so we allocate the largest possible size
//uint8_t pixel[SW_FRAMEBUFFER_DEPTH_SIZE];
uint8_t pixel[4];
// NOTE: MSVC doesn't support VLA, so the largest possible size is allocated: 4 bytes
//uint8_t pixel[SW_FRAMEBUFFER_DEPTH_SIZE] = { 0 };
uint8_t pixel[4] = { 0 };
SW_FRAMEBUFFER_DEPTH_SET(pixel, depth, 0);
uint8_t *dst = (uint8_t *)depthBuffer->pixels;
@ -3833,7 +3832,7 @@ static void sw_immediate_set_texcoord(const float texcoord[2])
static void sw_immediate_push_vertex(const float position[4])
{
// Check if we are in a valid draw mode
// Check if the draw mode is valid
if (!sw_is_draw_mode_valid(RLSW.drawMode))
{
RLSW.errCode = SW_INVALID_OPERATION;
@ -4153,9 +4152,9 @@ const char *swGetString(SWget name)
switch (name)
{
case SW_VENDOR: result = "RLSW Header"; break;
case SW_RENDERER: result = "RLSW Software Renderer"; break;
case SW_VERSION: result = "RLSW 1.0"; break;
case SW_VENDOR: result = "RLSW"; break;
case SW_RENDERER: result = "RLSW OpenGL Software Renderer"; break;
case SW_VERSION: result = RLSW_VERSION; break;
case SW_EXTENSIONS: result = "None"; break;
default: RLSW.errCode = SW_INVALID_ENUM; break;
}
@ -4550,7 +4549,7 @@ void swOrtho(double left, double right, double bottom, double top, double znear,
void swBegin(SWdraw mode)
{
// Check if we can render
// Check if render is possible
if (!sw_is_ready_to_render())
{
RLSW.errCode = SW_INVALID_OPERATION;

1553
src/external/rltexgpu.h vendored Normal file

File diff suppressed because it is too large Load diff

View file

@ -2166,7 +2166,7 @@ static KeyboardKey ConvertScancodeToKey(SDL_Scancode sdlScancode)
return mapScancodeToKey[sdlScancode];
}
return KEY_NULL; // No equivalent key in Raylib
return KEY_NULL; // No equivalent key in raylib
}
// Get next codepoint in a byte sequence and bytes processed

View file

@ -1652,9 +1652,9 @@ int InitPlatform(void)
if (rlGetVersion() == RL_OPENGL_SOFTWARE) // Using software renderer
{
TRACELOG(LOG_INFO, "GL: OpenGL device information:");
TRACELOG(LOG_INFO, " > Vendor: %s", "raylib");
TRACELOG(LOG_INFO, " > Renderer: %s", "rlsw - OpenGL Software Renderer");
TRACELOG(LOG_INFO, " > Version: %s", "1.0");
TRACELOG(LOG_INFO, " > Vendor: %s", glGetString(GL_VENDOR));
TRACELOG(LOG_INFO, " > Renderer: %s", glGetString(GL_RENDERER));
TRACELOG(LOG_INFO, " > Version: %s", glGetString(GL_VERSION));
TRACELOG(LOG_INFO, " > GLSL: %s", "NOT SUPPORTED");
}
@ -1870,7 +1870,8 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lpara
// WARNING: Don't trust the docs, they say this message can not be obtained if not calling DefWindowProc()
// in response to WM_WINDOWPOSCHANGED but looks like when a window is created,
// this message can be obtained without getting WM_WINDOWPOSCHANGED
HandleWindowResize(hwnd, &platform.appScreenWidth, &platform.appScreenHeight);
// WARNING: This call fails for Software-Renderer backend
//HandleWindowResize(hwnd, &platform.appScreenWidth, &platform.appScreenHeight);
} break;
//case WM_MOVE
case WM_WINDOWPOSCHANGED:

View file

@ -40,7 +40,7 @@
* [rtextures] stb_image_write (Sean Barret) for image writing (BMP, TGA, PNG, JPG)
* [rtextures] stb_image_resize2 (Sean Barret) for image resizing algorithms
* [rtextures] stb_perlin (Sean Barret) for Perlin Noise image generation
* [rtextures] rl_gputex (Ramon Santamaria) for GPU-compressed texture formats
* [rtextures] rltexgpu (Ramon Santamaria) for GPU-compressed texture formats
* [rtext] stb_truetype (Sean Barret) for ttf fonts loading
* [rtext] stb_rect_pack (Sean Barret) for rectangles packing
* [rmodels] par_shapes (Philip Rideout) for parametric 3d shapes generation

View file

@ -100,19 +100,19 @@
#endif
#if SUPPORT_FILEFORMAT_DDS
#define RL_GPUTEX_SUPPORT_DDS
#define RLTEXGPU_SUPPORT_DDS
#endif
#if SUPPORT_FILEFORMAT_PKM
#define RL_GPUTEX_SUPPORT_PKM
#define RLTEXGPU_SUPPORT_PKM
#endif
#if SUPPORT_FILEFORMAT_KTX
#define RL_GPUTEX_SUPPORT_KTX
#define RLTEXGPU_SUPPORT_KTX
#endif
#if SUPPORT_FILEFORMAT_PVR
#define RL_GPUTEX_SUPPORT_PVR
#define RLTEXGPU_SUPPORT_PVR
#endif
#if SUPPORT_FILEFORMAT_ASTC
#define RL_GPUTEX_SUPPORT_ASTC
#define RLTEXGPU_SUPPORT_ASTC
#endif
// Image fileformats not supported by default
@ -161,13 +161,13 @@
#pragma GCC diagnostic ignored "-Wunused-function"
#endif
#define RL_GPUTEX_MALLOC RL_MALLOC
#define RL_GPUTEX_FREE RL_FREE
#define RL_GPUTEX_LOG(...) TRACELOG(LOG_WARNING, "IMAGE: " __VA_ARGS__)
#define RL_GPUTEX_SHOW_LOG_INFO
#define RL_GPUTEX_IMPLEMENTATION
#include "external/rl_gputex.h" // Required for: rl_load_xxx_from_memory()
// NOTE: Used to read compressed textures data (multiple formats support)
#define RLTEXGPU_MALLOC RL_MALLOC
#define RLTEXGPU_FREE RL_FREE
#define RLTEXGPU_LOG(...) TRACELOG(LOG_WARNING, "IMAGE: " __VA_ARGS__)
#define RLTEXGPU_SHOW_LOG_INFO
#define RLTEXGPU_IMPLEMENTATION
#include "external/rltexgpu.h" // Required for: rl_load_xxx_from_memory()
// NOTE: Used to read compressed textures data (multiple formats support)
#if defined(__GNUC__) // GCC and Clang
#pragma GCC diagnostic pop
#endif