Skip to content

fix(strands): preserve loop state updated before break - #9354

Merged
davepagurek merged 1 commit into
processing:mainfrom
bhabishnu:fix/strands-break-state-submit
Oct 29, 2026
Merged

davepagurek merged 1 commit into
processing:mainfrom
bhabishnu:fix/strands-break-state-submit

Conversation

@bhabishnu

Copy link
Copy Markdown
Contributor

Resolves #9327

Loop state was only written back at the end of the loop body, so a break could exit with the value from the start of that iteration.

This updates the Strands loop handling so the current carried values are committed before break.

Changes:

  • Pass the loop's carried values to break before control-flow renaming, so they resolve to the live value at the break site.
  • Commit those values to the innermost StrandsFor before emitting the break.
  • Add WebGL and WebGPU regression tests covering updates before break, assignments in the breaking branch, and nested loops.

Tested on both WebGL and WebGPU.

@p5-bot

p5-bot Bot commented Oct 29, 2026

Copy link
Copy Markdown

Continuous Release

CDN link

Published Packages

Commit hash: 90c982e

Previous deployments

This is an automated message.

@davepagurek davepagurek left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for working on this! I did some testing and logging of the transpiled js + compiled glsl and the behaviour seems correct.

@davepagurek
davepagurek merged commit ddf4301 into processing:main Oct 29, 2026
4 checks passed
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.

[p5.js 2.0+ Bug Report]: p5.strands drops state updates made before break

2 participants