Support both stb_image_resize.h and stb_image_resize2.h#2130
Open
taylorhoward92 wants to merge 1 commit into
Open
Support both stb_image_resize.h and stb_image_resize2.h#2130taylorhoward92 wants to merge 1 commit into
taylorhoward92 wants to merge 1 commit into
Conversation
Use __has_include to detect which stb image resize header is available and conditionally use the appropriate API. This allows building against both old stb (which provides stb_image_resize.h) and new stb (which replaced it with stb_image_resize2.h). API mapping: - stbir_resize_uint8 -> stbir_resize_uint8_linear (non-gamma-corrected) - stbir_resize_uint8_srgb params (num_channels, alpha_channel, flags) collapsed into single stbir_pixel_layout enum (e.g. STBIR_RGBA_PM) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
taylorhoward92
pushed a commit
to taylorhoward92/nixpkgs
that referenced
this pull request
Apr 7, 2026
Pulls in a pending upstream patch (ValveSoftware/gamescope#2130) that supports both the old stb_image_resize.h and the new stb_image_resize2.h using __has_include for compile-time detection. This prepares gamescope for the upcoming stb update (NixOS#491159) which removes stb_image_resize.h in favor of stb_image_resize2.h. Tested against both old stb (0-unstable-2023-01-29) and new stb (0-unstable-2025-10-25) on x86_64-linux and aarch64-linux. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
13 tasks
|
@misyltoad is there a reason for not bumping the stb subproject to a more recent commit instead, and include only the new header? It is currently pointing to nothings/stb@5736b15, which is 3 years old, so presumably a newer version wouldn't hurt. |
samestep
pushed a commit
to samestep/nixpkgs
that referenced
this pull request
May 15, 2026
Pulls in a pending upstream patch (ValveSoftware/gamescope#2130) that supports both the old stb_image_resize.h and the new stb_image_resize2.h using __has_include for compile-time detection. This prepares gamescope for the upcoming stb update (NixOS#491159) which removes stb_image_resize.h in favor of stb_image_resize2.h. Tested against both old stb (0-unstable-2023-01-29) and new stb (0-unstable-2025-10-25) on x86_64-linux and aarch64-linux. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uses
__has_includeto detect which stb image resize header is available and conditionally use the appropriate API. This allows building against both old stb (which providesstb_image_resize.h) and new stb (which replaced it withstb_image_resize2.h).The newer versions of the nothings/stb repository moved
stb_image_resize.htodeprecated/and replaced it withstb_image_resize2.h. This change adds compatibility so gamescope can build against either version.This is intended to be used in combination with #1846 when needed by Linux distributions (e.g. NixOS) that use a system-level stb package rather than the vendored subproject.
API mapping:
stbir_resize_uint8→stbir_resize_uint8_linear(the non-gamma-corrected variant;stbir_resize_uint8_srgbis the gamma-aware one)stbir_resize_uint8_srgbparameters(num_channels=4, alpha_channel=3, STBIR_FLAG_ALPHA_PREMULTIPLIED)→ singlestbir_pixel_layoutenumSTBIR_RGBA_PM