Commit Graph

2840 Commits

Author SHA1 Message Date
fd0fd6a891 Implement projectm-eval mutex callbacks
The projectm_eval_memory_host_lock/unlock_mutex() callbacks were no-ops,
providing no protection when multiple preset expressions access shared
memory blocks from different threads. Add a real std::mutex so the eval
library's built-in synchronization actually works.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-29 17:28:56 -04:00
3649044362 adjust sdl-test-ui to use GLAD and SDL2 to get gl functions 2026-02-23 23:46:12 -06:00
c7754456d8 add projectm_create_with_opengl_load_proc() api
replace OpenGL depencencies with GLAD
add GL resolver, GL probe, GLAD loader
remove GLEW
2026-02-23 23:46:12 -06:00
184aefacc3 add GLAD library CMake build 2026-02-17 23:08:31 -06:00
95f163a06c add generated GLAD 2.0.8 sources (gl 3.3, gles2 3.2, egl 1.4, wgl 1.0, glx 1.4, loader=true, alias=true, extensions=none) 2026-02-17 01:20:00 -06:00
f67dac9481 Fix macOS framework build to properly include headers (#964)
* Fix macOS framework build to properly include headers

The previous implementation using CMake's built-in FRAMEWORK property
had two issues:
1. Headers were not copied into the framework at all
2. PUBLIC_HEADER flattens directory structure, breaking C++ interface

This replaces the CMake FRAMEWORK support with a custom MacOSFramework
cmake module that:
- Builds proper framework bundles from scratch
- Preserves header directory hierarchy (Audio/, Renderer/ subdirs)
- Creates correct symlink structure (Versions/A, Current, etc.)
- Generates Info.plist with bundle metadata

Also adds CI test script (scripts/test-macos-framework.sh) that validates:
- Framework directory structure
- Header completeness
- Linkability (compile and link test program)

Fixes the empty framework issue reported after ef00cfc8e.

* Fix review issues in macOS framework build

- Add missing Renderer/TextureTypes.hpp to C++ framework headers
- Skip pkg-config generation for playlist in framework mode
- Use stored framework path property for install instead of TARGET_FILE_DIR
- Show compiler errors on linkability test failure instead of suppressing
- Fix comment about framework output location

* Add framework CI jobs and harden test script

New CI job matrix (build-framework):
- Tests framework builds on both arm64 and x86_64
- Tests with and without C++ interface
- Runs strict validation after build AND after install
- Verifies installed frameworks match build output

Test script improvements:
- Exhaustive header lists (all C API + all C++ headers)
- Exact header count validation (catches stale/unexpected files)
- Strict mode (STRICT=1) where SKIPs become FAILs
- Info.plist CFBundleExecutable validation
- Symlink target verification (Current, Headers, Resources)
- Mach-O dylib binary type check
- dylib install name validation
- Flexible framework search across build tree and install prefix
- Test pass counter in summary

---------

Co-authored-by: Mischa <mish@Kensington.local>
2026-02-16 09:00:52 -08:00
56a222007a Fix angle to per-pixel expressions 2026-02-16 14:02:18 +01:00
8be21152a7 Fix inverted Y coordinate passed to per-pixel expressions 2026-02-16 14:02:13 +01:00
bd9f68e199 Bugfix: possible nullptr dereference in texture sampler
Crashes in some rare cases, e.g. "martin - test random mosscity.milk"
2026-02-15 23:34:10 +01:00
ceb86ebca7 Add API flag to start presets with clean canvas
Adds projectm_set_preset_start_clean() and projectm_get_preset_start_clean()
functions to control whether new presets start with a black canvas or inherit
the previous preset's last frame.

Default behavior remains unchanged (copy previous frame), but applications
can now opt-in to clean starts by setting this flag to true.

Fixes #298
2026-02-01 21:23:32 -08:00
5acd8bf9ee Clarify async loading documentation in preset load callback 2026-02-01 21:23:03 -08:00
e718f99e6f Address Copilot review feedback 2026-02-01 21:23:03 -08:00
aa24265fd1 Fix: Only fire switched event if preset load succeeded 2026-02-01 21:23:03 -08:00
be07112ae7 Add preset load callback to playlist library
Adds projectm_playlist_set_preset_load_event_callback() to allow applications
to handle preset loading themselves. This enables loading presets from:
- Archives (ZIP files)
- Network sources (HTTP)
- Custom storage solutions
- Asynchronous loading patterns

When the callback is set and returns true, the playlist library skips its
default filesystem-based loading. If the callback returns false or isn't set,
the default behavior is used.

Fixes #946
2026-02-01 21:23:03 -08:00
85b8c08a02 Add texture loading callback for custom texture sources
Adds a callback that allows applications to provide textures from
non-filesystem sources like archives, network, or procedurally
generated content. The callback receives the texture name and can
return either raw pixel data or an existing OpenGL texture ID.

Changes:
- Add SetTextureLoadCallback API for custom texture loading
- Add texture ownership tracking to prevent deletion of app-provided textures
- Update texture creation to use stb_image instead of SOIL
- Add validation and error logging for callback-provided textures

Fixes #870

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 17:13:33 -08:00
67c7564d70 chore: sync 2026-02-01 17:13:15 -08:00
b7d1ef845d Address Copilot review feedback
- Use absolute paths for headers exported to parent scope
- Include C++ headers in framework when ENABLE_CXX_INTERFACE is on
2026-02-01 17:13:15 -08:00
ef00cfc8e7 Add macOS Framework build support
Adds ENABLE_MACOS_FRAMEWORK cmake option to build projectM-4.framework
and projectM-4-playlist.framework bundles instead of plain dylibs.
Only available on macOS with shared library builds.

The frameworks include all public headers in the Headers/ directory
and use standard macOS framework versioning (Version A).

Fixes #924
2026-02-01 17:13:15 -08:00
a98d21dc0a Rename SOIL2 vendor lib to stb_image and remove SOIL2 code 2026-01-27 12:09:04 +01:00
f17f60d0ae Load textures directly via stb_image instead of SOIL2 2026-01-27 12:09:04 +01:00
99bfcf9a0f Simplify texture creation in MilkdropNoise 2026-01-26 23:06:01 +01:00
ba8023e8aa Add methods to upload image data in Texture class 2026-01-26 23:04:46 +01:00
de1f1b6d43 Add regression tests for HLSLParser parenthesized expressions
Covers the fix for issue #940 with tests for:
- Parenthesized constructor with binary operators
- Double-nested parentheses
- Both operands parenthesized
- Chained operators after parens
2026-01-20 23:20:16 +01:00
c86dee9b7a Fix HLSLParser failing on parenthesized expressions in declarations
The parser rejected valid HLSL like `float2 var = (float2(x,y)) * scalar`
with "expected ';'" errors. When parsing a parenthesized expression, the
loop would break before consuming the closing paren, so subsequent binary
operators were never seen.

Moves end-char consumption into the else block and checks for operators
after consuming the paren, continuing the loop if one is found.

Fixes #940
2026-01-20 23:20:11 +01:00
fb1505a292 Add CXX interface test application and add it to workflows 2026-01-20 15:13:30 +01:00
b33eed393d Fix CXX interface exports and headers
Added separate export header, export macros for all required classes and functions and installing the headers in the correct directory structure.
2026-01-20 15:13:30 +01:00
db22c9335a update projectm-eval 2026-01-17 09:04:04 -08:00
014fb59dd5 Fix missing include in API CMake file 2025-12-18 11:17:57 +01:00
f06cbf95a1 Add default values of all parameters to Doxygen comments.
Also added a note that projectm_set_window_size() needs to be called once with non-zero size arguments to initiate any rendering.
2025-12-12 19:04:32 +01:00
cd8b804046 Fix upper limit of per-pixel mesh dimensions from 400 to 300 2025-12-12 19:04:27 +01:00
0b4393f3ea Fix shared lib and boost flags in Windows GHA workflows
Before, it was always built with boost and as shared libs.
2025-12-10 22:23:48 +01:00
7c2b14e074 Windows GHA workflow: Pre-fetch NuGet.exe to avoid error
vcpkg will emit additional logging output if no NuGet.exe is installed, which will then make the pwsh command replacement fail as not just the executable location is echoed.
2025-12-10 22:15:32 +01:00
49410adca7 Move projectM-opengl.h into Renderer lib 2025-12-10 21:55:36 +01:00
4f3d062053 Move PresetFileParser into MilkdropPreset subdir
Makes more sense contextually.
2025-12-10 21:55:36 +01:00
0483e0334d Fix includes and some comments 2025-12-10 21:55:34 +01:00
0a4a2b543f Add CMake argument ENABLE_VERBOSE_LOGGING, disable trace/debug logging in Release builds 2025-12-07 17:24:48 +01:00
4a0fa11f0f Move GLSL version check to ProjectM class constructor
Log a fatal error if it fails.
2025-12-07 17:24:48 +01:00
3c80d89337 Use new Logging class for all output 2025-12-07 17:24:48 +01:00
c6e02c9e1a Add logging API functions and callbacks 2025-12-07 17:24:48 +01:00
c23f1b9613 Add a new logging class 2025-12-07 17:24:48 +01:00
8e228952ac Use PUBLIC_HEADER CMake target property to install API headers 2025-12-07 17:24:48 +01:00
ccd606df60 Update copyright in API headers 2025-12-07 17:24:48 +01:00
fa532eddc6 Add API function for texture burn-in 2025-12-07 17:23:03 +01:00
e66b110665 Add texture burn-in support
Also use shader cache in texture copier and a transformation matrix for flipping instead of flags.
2025-12-07 17:23:00 +01:00
af479c01d6 Fix installed pkgconfig files using wrong linker argument
for some unknown reason I used "-l:<lib>" in the .pc files while it should just be "-l<lib>". This would prevent libprojectM (and the playlist lib) from being linked in projects using pkgconfig.
2025-12-02 18:04:26 +01:00
834acc376c fixed an issue with sep attribute mngt / per pixel
Signed-off-by: Kai Blaschke <kai.blaschke@kb-dev.net>
2025-12-02 08:50:47 +01:00
b7a88d59dd Keep references to textures and samplers in descriptors
Previously, if the TextureManager was recreated, e.g. when changing the texture paths, all loaded textures were deleted, even if currently in use by a preset. Storing textures and samplers as shared pointers instead of weak pointers will make sure the objects are kept alive until the preset is unloaded.

Signed-off-by: Kai Blaschke <kai.blaschke@kb-dev.net>
2025-12-02 08:50:47 +01:00
d5c7f350d7 Apply possible HLSL compiler optimization for pow() function with literal 1 as exponent
Signed-off-by: Kai Blaschke <kai.blaschke@kb-dev.net>
2025-12-02 08:50:47 +01:00
249305f683 Fix wrong type used in PCM smoothing in custom waves.
Signed-off-by: Kai Blaschke <kai.blaschke@kb-dev.net>
2025-12-02 08:50:47 +01:00
7ea533a96d Place shader "PS" function into its own line and wrap arguments for readability.
Signed-off-by: Kai Blaschke <kai.blaschke@kb-dev.net>
2025-12-02 08:50:47 +01:00