Add VKB_BUILD_SHADERS cmake option to control shader build#1528
Open
SRSaunders wants to merge 2 commits intoKhronosGroup:mainfrom
Open
Add VKB_BUILD_SHADERS cmake option to control shader build#1528SRSaunders wants to merge 2 commits intoKhronosGroup:mainfrom
SRSaunders wants to merge 2 commits intoKhronosGroup:mainfrom
Conversation
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.
Description
This PR adds a new
VKB_BUILD_SHADERScmake option (defaultON) to control whether shaders are built for the project. Currently shaders are always built even though they are already available in pre-built form as part of the project. This seems wasteful unless the end-user actually wants to modify shaders and rebuild. In addition, this adds to build time for a project that already has long build duration (~9 minutes).As part of this PR, this new option is used to turn off shader compilation for iOS CI builds. iOS is unique in that it requires the SDK to be available during CI for packaging and app bundle creation reasons. A side-effect of this is that shader compilers are therefore available to the iOS CI build and shaders are always built, which is wasteful.
This PR also removes a short term workaround that @SaschaWillems put in place disabling slang shader compilation for iOS CI builds. This is no longer needed for several reasons: a) current iOS/macOS SDKs contain working slang compilers, and b) the new
VKB_BUILD_SHADERSoption is used to turn off shader compilation for iOS CI in this PR.Some project build time comparisons (with SDK and/or shader compilers installed):
macOS Sequoia on x86_64 6C/12T using Xcode 26.3 debug build:
VKB_BUILD_SHADERS=ON: 490 secondsVKB_BUILD_SHADERS=OFF: 413 seconds (14% improvement)Windows 11 VS 2019 debug build (exact same machine as above but booted into Windows 11):
VKB_BUILD_SHADERS=ON: 517 secondsVKB_BUILD_SHADERS=OFF: 480 seconds (7% improvement)Note I have set the default value for
VKB_BUILD_SHADERSto beONfor backwards compatibility, there may be a good argument to set the default value toOFF. I will wait for feedback from maintainers on this point.Fixes #
General Checklist:
Please ensure the following points are checked:
Note: The Samples CI runs a number of checks including:
If this PR contains framework changes:
batchcommand line argument to make sure all samples still work properlySample Checklist
If your PR contains a new or modified sample, these further checks must be carried out in addition to the General Checklist: