Repository navigation
WriteGPUBuffer and populateWith: one upload path, and documented ordering - #85
Merged
Merged
Conversation
…ring - Both are queue writes (queue.writeBuffer): they land before any of the execute()'s GPU work, wherever they appear in the action list, unlike Kernel, ClearBuffer and CopyBufferToBuffer, which are encoder commands and run in order. This was undocumented; primitive.mjs, the action classes and docs/architecture.md now say so. - One upload path, BasePrimitive.__writeBuffer(label, data, offset), used by both (settles the todo in __allocateBuffer). WriteGPUBuffer now also skips uploading unchanged data into a uniform buffer (tracked per offset), and an unknown buffer is an error instead of a warning followed by a crash. - Doc comments for AllocateBuffer, WriteGPUBuffer, ClearBuffer and CopyBufferToBuffer; WriteGPUBuffer's offset in the types. - test_wgsl_functions: the input is written with real data, whole and then at an offset, and a new test reads it back. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015kfNC6id65zEHzuAAH4jtJ
Conflict in docs/architecture.md: both sides added a section before "Composing primitives". Kept both: "WGSL helpers" (#84), then "Actions, and when they take effect" (this PR). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015kfNC6id65zEHzuAAH4jtJ
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.
Follow-up from the declared-buffers work:
WriteGPUBufferandAllocateBuffer'spopulateWith.The trap, now documented
Both are queue writes (
queue.writeBuffer). They happen whileexecute()is still recording the encoder, so they land before any of thatexecute()'s GPU work, wherever they appear in the action list:Kernel,ClearBuffer,CopyBufferToBufferandExecutePrimitive, by contrast, are encoder commands and run in list order. None of this was written down anywhere. It's now inprimitive.mjs(one note, plus doc comments on each action class) and in a new "Actions, and when they take effect" section ofdocs/architecture.md.Changes
BasePrimitive.__writeBuffer(label, data, offset). This settles the todo in__allocateBuffer.WriteGPUBuffernow also skips uploading unchanged data into a uniform buffer, tracked per offset.test_wgsl_functions: the input is now written with real data, once whole and then at an offset, and a new test reads it back. Before, it wrote zeros into an already-zero buffer.WriteGPUBuffer'soffsetis now in the type declarations.Checked
main(lavapipe's 8 lanes).Independent of #84.
Generated by Claude Code