What
When invoking `impellerc` with both `--depfile=` and `--shader-bundle=`, the resulting depfile is never written.
`impeller/compiler/impellerc_main.cc:211` takes an early return into `GenerateShaderBundle(switches)` when `--shader-bundle` is set. The depfile-writing branch (`OutputDepfile` at line 310) only runs on the non-bundle path. The user-visible result is that consumers of `--shader-bundle` have no way to learn which source files (the manifest entries plus their transitive `#include`s) contributed to the generated bundle.
Why it matters
Build systems that consume `impellerc` for shader bundles (notably Dart's `hooks` framework, which `flutter_gpu_shaders`' `buildShaderBundleJson` uses) need this information to rerun the bundle build when any contributing source file changes. Without it, the typical user workflow is:
- Author a `.frag` shader.
- Reference it from a manifest JSON file.
- Add the manifest to a `flutter_gpu_shaders` build hook.
- Edit the `.frag`.
- Notice that `flutter run` doesn't rebuild the shader bundle.
- Manually `flutter clean` and rerun.
Adding depfile support in shader-bundle mode lets build hooks declare the right dependency set and avoid the manual clean.
Repro
```
mkdir -p /tmp/depfile_test/shaders
cat > /tmp/depfile_test/shaders/test.frag <<'GLSL'
#version 460 core
#include "common.glsl"
out vec4 frag_color;
void main() { frag_color = COMMON_COLOR; }
GLSL
cat > /tmp/depfile_test/shaders/common.glsl <<'GLSL'
#define COMMON_COLOR vec4(1, 0, 0, 1)
GLSL
cd /tmp/depfile_test
impellerc --sl=out.shaderbundle \
--depfile=out.shaderbundle.d \
--include=shaders \
--shader-bundle='{"Test":{"type":"fragment","file":"shaders/test.frag"}}'
ls -la out.shaderbundle.d # File does not exist.
```
Fix
PR coming shortly: thread an optional `std::setstd::string* out_dependencies` parameter through `GenerateShaderBundleFlatbuffer` / `GenerateShaderFB` / `GenerateShaderBackendFB`. Each `Compiler` instance reports its `GetIncludedFileNames()` plus the primary source file path into the set (deduplicated across the 5 target-platform compiles of each shader). After bundle generation, write a Ninja-style depfile mirroring the one `Compiler::CreateDepfileContents` already emits for single-shader compiles.
What
When invoking `impellerc` with both `--depfile=` and `--shader-bundle=`, the resulting depfile is never written.
`impeller/compiler/impellerc_main.cc:211` takes an early return into `GenerateShaderBundle(switches)` when `--shader-bundle` is set. The depfile-writing branch (`OutputDepfile` at line 310) only runs on the non-bundle path. The user-visible result is that consumers of `--shader-bundle` have no way to learn which source files (the manifest entries plus their transitive `#include`s) contributed to the generated bundle.
Why it matters
Build systems that consume `impellerc` for shader bundles (notably Dart's `hooks` framework, which `flutter_gpu_shaders`' `buildShaderBundleJson` uses) need this information to rerun the bundle build when any contributing source file changes. Without it, the typical user workflow is:
Adding depfile support in shader-bundle mode lets build hooks declare the right dependency set and avoid the manual clean.
Repro
```
mkdir -p /tmp/depfile_test/shaders
cat > /tmp/depfile_test/shaders/test.frag <<'GLSL'
#version 460 core
#include "common.glsl"
out vec4 frag_color;
void main() { frag_color = COMMON_COLOR; }
GLSL
cat > /tmp/depfile_test/shaders/common.glsl <<'GLSL'
#define COMMON_COLOR vec4(1, 0, 0, 1)
GLSL
cd /tmp/depfile_test
impellerc --sl=out.shaderbundle \
--depfile=out.shaderbundle.d \
--include=shaders \
--shader-bundle='{"Test":{"type":"fragment","file":"shaders/test.frag"}}'
ls -la out.shaderbundle.d # File does not exist.
```
Fix
PR coming shortly: thread an optional `std::setstd::string* out_dependencies` parameter through `GenerateShaderBundleFlatbuffer` / `GenerateShaderFB` / `GenerateShaderBackendFB`. Each `Compiler` instance reports its `GetIncludedFileNames()` plus the primary source file path into the set (deduplicated across the 5 target-platform compiles of each shader). After bundle generation, write a Ninja-style depfile mirroring the one `Compiler::CreateDepfileContents` already emits for single-shader compiles.