Skip to content

Add includeDirectories parameter to buildShaderBundleJson#16

Merged
bdero merged 1 commit into
masterfrom
custom-include-dirs
May 26, 2026
Merged

Add includeDirectories parameter to buildShaderBundleJson#16
bdero merged 1 commit into
masterfrom
custom-include-dirs

Conversation

@bdero
Copy link
Copy Markdown
Owner

@bdero bdero commented May 26, 2026

buildShaderBundleJson now accepts an optional includeDirectories list. Those directories are appended to impellerc's #include search path, after the manifest's own directory and the bundled shader_lib. This lets a build hook compile shaders that #include reusable GLSL shipped by another package: resolve that package's shader directory and pass it here.

The impellerc argument construction is extracted into a new public shaderBundleImpellercArguments(...) helper, mirroring the existing collectShaderBundleDependencies, so it can be unit-tested without invoking impellerc.

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 --depfile is consumed in --shader-bundle mode (#15), those transitive includes would be tracked automatically.

Motivation

flutter_scene's upcoming custom-material (.fmat) preprocessor emits fragment shaders that #include flutter_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's impellerc include 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.

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.
@bdero bdero merged commit bfaad8f into master May 26, 2026
2 checks passed
@bdero bdero deleted the custom-include-dirs branch May 26, 2026 10:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant