Skip to content

feat: add more shader group diagnostics to compile_report#2085

Merged
lgritz merged 2 commits intoAcademySoftwareFoundation:mainfrom
lgritz:lg-compilereport
Mar 5, 2026
Merged

feat: add more shader group diagnostics to compile_report#2085
lgritz merged 2 commits intoAcademySoftwareFoundation:mainfrom
lgritz:lg-compilereport

Conversation

@lgritz
Copy link
Collaborator

@lgritz lgritz commented Mar 3, 2026

When compile_report >= 1, report several new post-optimization stats for the shader group:

  • Number of active (non-unused) layers
  • Maximum connection depth of the shader network (node count along the longest layer-to-layer chain, so a single unconnected node = 1 and a chain A->B->C = 3)
  • Number of texture ops (texture, environment, gettextureinfo, texture3d)
  • Number of noise ops

Note that these stats (number of layers, texture ops, noise ops) are the total number in the post-optimized shader, but not the number that will be run on any particular execution of the shader. Trivial example: the noise calls may all be inside an "if" statement with a condition that is never true in practice, but that can't be known ahead of time. In the other direction, a loop with noise calls in the body will underestimate how many calls are made in each shader run. So take with a grain of salt -- these stats are related overall shader code complexity, but not necessarily to execution cost.

Coded via pair programming with Claude Code, using the Claude Sonnet 4.6 model.

lgritz added 2 commits March 3, 2026 15:06
When compile_report >= 1, report three new post-optimization stats for
the shader group:
- Number of active (non-unused) layers
- Maximum connection depth of the shader network (node count along the
  longest layer-to-layer chain, so a single unconnected node = 1 and
  a chain A->B->C = 3)
- Number of texture ops (texture, environment, gettextureinfo, texture3d)

Coded via pair programming with Claude Code, using the Claue Sonnet
4.6 model.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
Signed-off-by: Larry Gritz <lg@larrygritz.com>
@lgritz
Copy link
Collaborator Author

lgritz commented Mar 3, 2026

Hang on, don't review yet; I want to add one more stat, testing now.

@lgritz
Copy link
Collaborator Author

lgritz commented Mar 4, 2026

Amended to also count the number of noise calls in the post-optimized shader. Ok to review now.

Copy link
Contributor

@fpsunflower fpsunflower left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Would be curious to see the types of results you get from your production shaders ...

@lgritz
Copy link
Collaborator Author

lgritz commented Mar 4, 2026

Would be curious to see the types of results you get from your production shaders ...

The use is speculative, and may be subject to further refinement. I think we're looking for some way to leave breadcrumbs behind in the logs so that when a render is absurdly expensive, people can make a good guess about whether there is any particular material that looks so out of whack that maybe it's a possible culprit.

@lgritz lgritz merged commit a0eb54e into AcademySoftwareFoundation:main Mar 5, 2026
99 of 102 checks passed
@lgritz lgritz deleted the lg-compilereport branch March 5, 2026 01:02
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.

2 participants