docs: give useTexture/useTextures a dedicated page - #3868
Open
RyanHang07 wants to merge 1 commit into
Open
Conversation
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.
Closes #3838
New page at
docs/webgpu/textures.mdx. I usednav: 17since that slot was open between Compute and Multi-Canvas. It coversuseTextureanduseTexturestogether: thecachedefault, refcounteddispose(), why a texture sticks around after its last consumer unmounts, and when the registry actually re-renders.loading-textures.mdxlinks to it now instead of repeating it. I kept the moved prose as close to verbatim as I could so the diff reads as a move. One thing I did change: the flip-flopadd()snippet now says it has to run from an event handler or effect.add()callssetStateand the old version read like render-phase code.overview.mdxgets two small edits. It was pointing at the#the-texture-registry-with-usetextures-experimentalanchor that this PR deletes, and I added the new page to its Sections list.A few things I wasn't sure about:
Placement. Both hooks live in
core/hooks/now, andwebgpu/hooks/useTextures.tsxis just a back-compat re-export.overview.mdxitself calls them core hooks that work with any renderer. I put the page underdocs/webgpu/because that's what the issue asked for, but happy to move it.preload/clear. These are
useLoaderaliases and don't touch the registry, so I left them off rather than sit them next todispose()and imply they're related.ChangeTexture.tsxdoes usepreloadthough, so if it should be documented somewhere, is that here or on theuseLoaderside?