WebGLRenderer: Correctly generate mipmaps for 3D & Array RenderTargets #29678
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.
Fixed #29628
Description
This PR ensures that the correct target type is passed into "bindTexture" for array and 3d render targets.
I've tested this with my 3d tiles use case and it works but the downside is that it's extremely slow and causes noticeable stalls (sometimes for what feels like almost a second or more) since
gl.generateMipmap
will regenerate the mipmaps for the whole volume target when just a single layer has been rendered to. This is especially problematic when rendering multiple layers per frame since that means the mip chain for the whole 3d texture will be generated every render (in this case ~256x256x900px). So for my use case I'll need something a bit different. Jotting a few potential thoughts down - maybe others have some better ideas: