fix(layers): submit command buffer after texture copy in IconLayer resize#10176
Conversation
…size Add missing device.submit() call after commandEncoder.finish() in the resizeTexture function. In luma.gl v9's CommandEncoder/CommandBuffer pattern, finish() only creates the command buffer but does not execute the GPU commands. Without submit(), the texture copy is never performed, causing existing icon data to be lost when the atlas texture is resized. This manifests when icons are added incrementally across render cycles, crossing a power-of-2 height boundary (e.g. from 256px to 512px). Previously loaded icons become permanently invisible because getDiffIcons caches already-seen icon URLs and never reloads the lost icons. Signed-off-by: Asish Kumar <officialasishkumar@gmail.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6b1f32cd78
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| height: oldHeight | ||
| }); | ||
| commandEncoder.finish(); | ||
| device.submit(); |
There was a problem hiding this comment.
Submit the finished command buffer explicitly
Calling device.submit() with no argument submits the device's default command encoder, not the command buffer returned by this function's local device.createCommandEncoder(). As written, commandEncoder.finish() is discarded, so the copyTextureToTexture recorded here is still never executed and icon atlas data can still be lost on resize. Capture the result of finish() and pass it to device.submit(commandBuffer).
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Good catch. Confirmed by tracing through the luma.gl source:
device.submit()with no argument calls_finalizeDefaultCommandEncoderForSubmit(), which finalizes the device's owncommandEncoderproperty -- not the locally created one.- The
CommandBufferreturned bycommandEncoder.finish()was being discarded, so thecopyTextureToTexturerecorded on the local encoder was never actually submitted.
Fixed in 7b4f82b by capturing the return value of finish() and passing it to device.submit(commandBuffer).
…eTexture device.submit() with no arguments finalizes and submits the device's default command encoder, not a locally created one. The texture copy was recorded on a separate command encoder created via device.createCommandEncoder(), so the CommandBuffer returned by finish() must be passed explicitly to device.submit() to ensure the copyTextureToTexture operation is actually executed. Signed-off-by: Asish Kumar <officialasishkumar@gmail.com>
Closes #9994
Change List
device.submit()call aftercommandEncoder.finish()inresizeTexture()withinicon-manager.tsfinish()only creates the command buffer — actual GPU commands are not executed untildevice.submit()is calledcopyTextureToTextureoperation is never performed, so existing icon data is lost when the atlas texture needs to grow (e.g. crossing a power-of-2 height boundary like 256px → 512px)getDiffIconscaches already-seen icon URLs and never reloads the lost data