Skip to content

Remove the usage warning from TransformFeedback buffer adoption - #9136

Merged
mvaligursky merged 1 commit into
mainfrom
mv-tf-remove-usage-warn
Jul 28, 2026
Merged

Remove the usage warning from TransformFeedback buffer adoption#9136
mvaligursky merged 1 commit into
mainfrom
mv-tf-remove-usage-warn

Conversation

@mvaligursky

Copy link
Copy Markdown
Contributor

Description

Reverts the Debug.warnOnce half of #9135. The storage assert from that PR stays — it catches a real mistake with no supported use behind it.

The warning fires on the shipped, unmodified graphics/transform-feedback example:

Vertex buffer 6 supplied to TransformFeedback was created with usage 0 instead of
BUFFER_GPUDYNAMIC, so its contents are being re-uploaded to change it.

That example does nothing wrong. mesh.setPositions(positions, 4) creates its vertex buffer with the default BUFFER_STATIC usage, and handing that to TransformFeedback is the documented contract — the class doc says the input can be "any VertexBuffer, either manually created, or from a Mesh". The re-upload is not a mistake path; it is the intended adoption mechanism for exactly this case, and it runs once at construction, never per frame (_createOutputBuffer is constructor-only).

From inside the helper, the legitimate case (borrowing a static mesh buffer) and the case worth catching (a buffer built for repeated GPU-only use with a forgotten usage flag) are indistinguishable — same object shape, same call, same one-time reallocation, and nothing on VertexBuffer encodes the caller's intent. So the warning cannot be sharpened to fire only when it should; it can only accuse correct code. Removed, with the one-time adoption cost recorded in a comment instead.

Testing

  • Full unit suite passes (2119), lint clean.
  • Debug remains imported and used by the other checks in the file.

Checklist

  • I have read the contributing guidelines
  • My code follows the project's coding standards
  • This PR focuses on a single change

🤖 Generated with Claude Code

The warning added in #9135 fires on the shipped graphics/transform-feedback example, which
passes a mesh vertex buffer created by Mesh#setPositions with the default BUFFER_STATIC
usage. That is not a mistake - the class documents "any VertexBuffer, either manually
created, or from a Mesh" as a valid input, and the re-upload exists precisely to adopt such
buffers. From inside the helper the legitimate case is indistinguishable from a forgotten
usage flag, so the warning cannot be made accurate and is removed. The one-time adoption
cost at construction is now noted in a comment instead.

The storage assert from #9135 is unaffected - that one catches a real mistake with no
supported use behind it.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

Build size report

This PR does not change the size of the minified bundles.

Bundle Minified Gzip Brotli
playcanvas.min.js 2327.9 KB — 599.0 KB — 465.5 KB —
playcanvas.min.mjs 2325.3 KB — 597.9 KB — 464.9 KB —

@mvaligursky
mvaligursky merged commit 40a7671 into main Jul 28, 2026
10 checks passed
@mvaligursky
mvaligursky deleted the mv-tf-remove-usage-warn branch July 28, 2026 13:37
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