Skip to content

Commit d8d16da

Browse files
authored
Added impellerc example for auditing fragment shaders (#12613)
_Description of what this PR is changing or adding, and why:_ Adds low level example of how to audit the output of impellerc. _Issues fixed by this PR (if any):_ flutter/flutter#171471 _PRs or commits this PR depends on (if any):_ ## Presubmit checklist - [x] If you are unwilling, or unable, to sign the CLA, even for a _tiny_, one-word PR, please file an issue instead of a PR. - [x] If this PR is not meant to land until a future stable release, mark it as draft with an explanation. - [x] This PR follows the [Google Developer Documentation Style Guidelines](https://developers.google.com/style)—for example, it doesn't use _i.e._ or _e.g._, and it avoids _I_ and _we_ (first-person pronouns). - [x] This PR uses [semantic line breaks](https://github.com/dart-lang/site-shared/blob/main/doc/writing-for-dart-and-flutter-websites.md#semantic-line-breaks) of 80 characters or fewer.
1 parent 667f699 commit d8d16da

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

src/content/ui/design/graphics/fragment-shaders.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,29 @@ with the index starting over at 0.
258258

259259
Any float uniforms that are left uninitialized will default to `0.0`.
260260

261+
The reflection data generated by the Flutter's shader compiler can be audited
262+
with the following commands in order to see things like uniform offsets.
263+
264+
```shell
265+
cd $FLUTTER
266+
# Generate the .sl file.
267+
`find bin/ -name impellerc` \
268+
--runtime-stage-metal \
269+
--iplr \
270+
--input=path/to/myshader.frag \
271+
--sl=foo.sl \
272+
--spirv=foo.spirv \
273+
--include=engine/src/flutter/impeller/compiler/shader_lib/ \
274+
--input-type=frag
275+
# Convert the .sl file to .json
276+
flatc \
277+
--json \
278+
./engine/src/flutter/impeller/runtime_stage/runtime_stage.fbs \
279+
-- ./foo.sl
280+
# View results
281+
cat foo.json
282+
```
283+
261284
#### Current position
262285

263286
The shader has access to a `varying` value that contains the local coordinates for

0 commit comments

Comments
 (0)