Shader Bundler for offline shader transpilation#130
Open
kunitoki wants to merge 7 commits into
Open
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev/gpu_graphics_try_1 #130 +/- ##
==========================================================
- Coverage 78.40% 78.40% -0.01%
==========================================================
Files 704 704
Lines 69768 69768
==========================================================
- Hits 54703 54699 -4
- Misses 15065 15069 +4
... and 2 files with indirect coverage changes Continue to review full report in Codecov by Harness.
🚀 New features to boost your workflow:
|
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.
This pull request introduces a new system for building, bundling, and embedding shader programs in the YUP library. The main changes are the addition of a standalone shader bundler tool, new CMake helpers to automate shader bundling and embedding, and updates to the graphics example to use this new workflow. This makes it easier to manage cross-platform shader assets and ensures shaders are compiled and embedded at configure time, even when cross-compiling.
Shader Bundling Tool and Build Integration:
Added a new standalone console tool,
yup_shader_bundler, which takes.vertand.fragGLSL files and produces a.yslbundle containing transpiled variants for all target shading languages (GLSL, ESSL, HLSL, MSL, WGSL). The tool is built as a host executable, ensuring it works during cross-compilation. (CHANGELOG.md,cmake/tools/shader_bundler/CMakeLists.txt,cmake/tools/shader_bundler/source/main.cpp) [1] [2] [3]Introduced a new CMake helper function,
yup_add_shader_bundle(), which builds the bundler tool (if needed), generates the shader bundle at configure time, and embeds the resulting binary as a linkable object library. This works transparently across platforms and cross-compilation scenarios. (cmake/yup_shader_bundler.cmake,cmake/yup.cmake) [1] [2]Example Usage and Demonstration:
Updated the graphics example to use the new
yup_add_shader_bundle()function, embedding the cube's vertex and fragment shaders and linking them into the example. (examples/graphics/CMakeLists.txt,examples/graphics/data/shaders/cube.vert,examples/graphics/data/shaders/cube.frag) [1] [2] [3]Modified the
SpinningCubeDemoto load shaders from the embedded bundle at runtime usingShaderBundle::loadFromData(), and to compile the GPU pipeline from the bundle rather than raw GLSL source strings. (examples/graphics/source/examples/SpinningCubeDemo.h) [1] [2]These changes significantly improve shader asset management in YUP, streamline the build process, and provide a robust foundation for cross-platform graphics development.