Skip to content

More pen optimizations - #24

Draft
GarboMuffin wants to merge 1 commit into
developfrom
pen-performance
Draft

GarboMuffin wants to merge 1 commit into
developfrom
pen-performance

Conversation

@GarboMuffin

@GarboMuffin GarboMuffin commented Oct 4, 2026 •

Copy link
Copy Markdown
Member

Need to review this more but this slop seems promising

four optimizations:

  • replace buffer subdata with fully new buffers. sounds unintuitive but actually seems to make it faster. the issue with subdata is if GPU is currently reading that array then this causes it to need to be copying it internally anyway
  • don't unbind framebuffer when switching between pen lines <-> pen stamps. unbinding the framebuffer at all causes the GPU pipelines to be less efficient
  • reduce some repeated setup for consecutive stamps
  • manually inline very hot pen code to avoid function call

Comment thread src/PenSkin.js
/** @type {object} */
this._stampDrawRegionId = {
enter: () => this._enterUsePenBuffer(),
// Leave the pen framebuffer bound when a run of stamps ends, like penStamp always has.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

probably better to have a render region for "i am rendering to the pen" and then have the within-pen stuff negotiate whatever state they need. this probably breaks extensions rn

This branch has not been deployed

No deployments
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.

1 participant