Skip to content

Precompute static shader math on the CPU for EffectStack#24070

Open
Breakdown-Dog wants to merge 2 commits intobevyengine:mainfrom
Breakdown-Dog:precompute
Open

Precompute static shader math on the CPU for EffectStack#24070
Breakdown-Dog wants to merge 2 commits intobevyengine:mainfrom
Breakdown-Dog:precompute

Conversation

@Breakdown-Dog
Copy link
Copy Markdown
Contributor

Objective

  • Previously, values like inv_radius and aspect ratio corrections were calculated inside fragment shaders.
  • This PR moves these calculations to the CPU (once per frame).

Solution

  • Refactored EffectStack to precompute static/invariant math on the CPU side before binding uniforms, rather than computing them per-pixel in WGSL.

Additional Cleanup:

  • Extracted the render pipeline setup logic from mod.rs into a dedicated pipeline.rs to keep the main module focused on effect parameters and CPU precomputation. Pure structural refactor, no behavioral changes.

Testing

  • Example post-processing runs as expected.

@kfc35 kfc35 added A-Rendering Drawing game state to the screen C-Code-Quality A section of code that is hard to understand or change S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels May 2, 2026
@github-project-automation github-project-automation Bot moved this to Needs SME Triage in Rendering May 2, 2026
@cart cart closed this May 5, 2026
@github-project-automation github-project-automation Bot moved this from Needs SME Triage to Done in Rendering May 5, 2026
@cart cart reopened this May 5, 2026
@github-project-automation github-project-automation Bot moved this from Done to Needs SME Triage in Rendering May 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Rendering Drawing game state to the screen C-Code-Quality A section of code that is hard to understand or change S-Needs-Review Needs reviewer attention (from anyone!) to move forward

Projects

Status: Needs SME Triage

Development

Successfully merging this pull request may close these issues.

3 participants