Add includeDirectories parameter to buildShaderBundleJson#16
Merged
Conversation
buildShaderBundleJson accepts an optional includeDirectories list, appended to impellerc's #include search path after the manifest directory and the bundled shader_lib, so a build hook can compile shaders that #include reusable GLSL shipped by another package by passing that package's shader directory. Extracts the impellerc argument construction into a new public shaderBundleImpellercArguments() helper so it is unit-testable without invoking impellerc. Files resolved through the extra directories are not auto-declared as dependencies; callers declare them via the build output. Bumps to 0.4.4.
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.
buildShaderBundleJsonnow accepts an optionalincludeDirectorieslist. Those directories are appended toimpellerc's#includesearch path, after the manifest's own directory and the bundledshader_lib. This lets a build hook compile shaders that#includereusable GLSL shipped by another package: resolve that package's shader directory and pass it here.The
impellercargument construction is extracted into a new publicshaderBundleImpellercArguments(...)helper, mirroring the existingcollectShaderBundleDependencies, so it can be unit-tested without invokingimpellerc.Files resolved through the extra directories are not auto-declared as build dependencies; a caller declares them via the build output if edits to them should retrigger the build. Once
impellerc --depfileis consumed in--shader-bundlemode (#15), those transitive includes would be tracked automatically.Motivation
flutter_scene's upcoming custom-material (
.fmat) preprocessor emits fragment shaders that#includeflutter_scene's framework GLSL. That framework lives in the flutter_scene package, not in the consumer's project, so it is not on the consumer'simpellercinclude path. This parameter lets the consumer's build hook put flutter_scene's shader directory on the path directly, instead of copying the framework files into the build output on every build.Tests
New unit tests for
shaderBundleImpellercArguments: the two default includes are always emitted, extra directories are appended in order after them, and an empty list matches the default behaviour. Existing tests are unchanged.Backward compatible: the parameter defaults to empty. Bumps the version to 0.4.4.