add webp#3097
Draft
mercury233 wants to merge 2 commits into
Draft
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds optional WebP card image support by integrating libwebp (vendored on Windows, system on Linux/macOS), introducing a WebP decode helper in ImageUtility, and updating the card image loader to fall back to .webp files when no .jpg is found. The PR is explicitly marked WIP with several TODOs (performance trade-off discussion, prefer_webp option, build system polish, Irrlicht integration).
Changes:
- New
ImageUtility::LoadWebPImagemirroring the existing JPEG loader, with decode-time scaling and fast-path options for downscaled output. ImageManager::GetImagenow selects a loader function based on which of four candidate files exists (expansions/pics/*.jpg|webp, thenpics/*.jpg|webp).- Build plumbing added for libwebp: premake options/include/link dirs, vendored premake project under
premake/webp/,.gitignore, and CI workflow updates for Windows/Linux/macOS.
Reviewed changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| premake5.lua | Adds BUILD_WEBP, options, include dir, and conditional include "webp". |
| premake/webp/src/webp/config.h | Empty config used only when SIMD detection is disabled. |
| premake/webp/premake5.lua | Vendored libwebp static-lib project with SIMD source selection. |
| gframe/premake5.lua | Adds WebP include/lib dirs and links webp. |
| gframe/image_utility.h | Declares LoadWebPImage. |
| gframe/image_utility.cpp | Implements WebP decoder with decode-time scaling and fast-path tweaks. |
| gframe/image_manager.cpp | Picks JPEG/WebP loader per file extension, with 4-step fallback chain. |
| .gitignore | Ignores vendored /webp directory. |
| .github/workflows/build.yml | Downloads/extracts libwebp on Windows, installs system libwebp on Linux, switches macOS to brew reinstall and adds webp, passes --build-webp. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Collaborator
|
suggest to do after #3099 |
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.
Support WebP-format card images.
TODO:
prefer_webpto avoid repeatedly attempting nonexistent paths when loading WebP-format card images.