Add Transform Feedback manual page - #1115
Open
mvaligursky wants to merge 2 commits into
Open
Conversation
Transform feedback was not documented anywhere on the site, so this covers both the default interleaved capture and the separate-buffer mode added in engine 2.22. Documents the WebGL2-only constraint and the compute shader alternative on WebGPU, the single interleaved buffer workflow including why the automatic buffer swap means a mesh rendering from the input buffer needs no updating, and the separate-buffer mode with its three buffer roles. Also captures several things that are not apparent from the API reference: why a buffer cannot be both a per-vertex simulation stream and a per-instance render stream, the declaration-order attribute semantics and the location collision from mixing standard and custom attribute names, the four-component limit per varying in separate mode, and the need to supply initial data for a buffer only ever written by the GPU. Adds the page to the Advanced Rendering sidebar and the Japanese mirror with translated frontmatter. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
3 tasks
The engine now asserts when a transform feedback buffer has no GPU storage, and warns when a buffer was not created with BUFFER_GPUDYNAMIC (playcanvas/engine#9135). Both messages name the buffer and say how to fix it, so the manual no longer needs to carry the workarounds. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Warning
Do not merge until engine 2.22 is released — the separate-buffer mode documented here ships with that release (playcanvas/engine#9109, playcanvas/engine#9131), as do the diagnostics this page now relies on (playcanvas/engine#9135). The embedded
graphics/transform-feedback-separateexample does not exist on the live examples site yet, so its thumbnail and iframe currently 404.Transform feedback was documented nowhere on the site — no mentions in
docs/ori18n/. So this covers both the long-standing interleaved mode and the separate-buffer mode added in 2.22, as a single page.New page
advanced-rendering/transform-feedback.md, following the structure of the neighbouring Multi-Draw and Hardware Instancing pages:GraphicsDevice.isWebGL2, with a pointer to compute shaders as the WebGPU equivalent since there is no direct onecreateShader,process(), and why the automatic buffer swap means a mesh rendering from the input buffer needs no updatingTRANSFORM_FEEDBACK_SEPARATE, the three buffer roles, and feeding instanced renderingNotes worth reviewing
A few points in here are not apparent from the API reference, and were learned the hard way while building the example:
instancingis a property ofVertexFormat, so the divisor applies to every use of the buffer. This is the reason the write-only buffer role exists, so the page explains it rather than just listing the roles.vertex_positionmaps to location 0, and the first custom name is assignedATTR0— also location 0. Called out in a warning admonition.Two further rough edges — a buffer only ever written by the GPU still needing initial data, and
BUFFER_GPUDYNAMICbeing silently worked around — were filed as TransformFeedback: buffer allocation and usage requirements are implicit engine#9134 and are now reported by the engine itself in Report transform feedback buffer setup problems where they happen engine#9135. Since those asserts name the buffer and say how to fix it, the page does not document the workarounds. The underlying requirements still stand, so if TransformFeedback: buffer allocation and usage requirements are implicit engine#9134 is closed without changingVertexBufferallocation, it is worth revisiting whether they belong here after all.Also
sidebars.js(the Advanced Rendering list is manual, so the page is invisible without it), placed after Indirect Drawinghtml-in-canvas.mdTesting
npm run lint— 0 errors across 1306 filescompute-shaderslives undershaders/, which caught an initially wrong pathEngineExampleplaceholders render with the correct titles. Thegraphics/transform-feedbackthumbnail resolves (HTTP 200);graphics/transform-feedback-separateis HTTP 404 until the examples site redeploys — hence the warning above