Repository navigation
feat(deck.gl-geotiff): render signed integer and float bands in MultiCOGLayer (experimental) - #777
Merged
Merged
Conversation
…COGLayer createBandTexture accepted Uint8Array and Uint16Array only, so a MultiCOGLayer over Int16 or Float32 COGs threw on its first tile. Signed integers, Uint32Array and floats now upload as r32float, converted to Float32Array where needed, so the shader samples raw values. The integer texture formats would need an isampler2D/usampler2D the pipeline's sampler2D modules cannot read, and no normalised format holds a signed 16-bit sample without EXT_texture_norm16. Co-Authored-By: Claude Fable 5.1 <[email protected]>
…nnot filter them WebGL treats a float texture under a linear sampler as incomplete unless OES_texture_float_linear is present, and every fetch from an incomplete texture returns zeros. The extension is missing on roughly half of iOS and a quarter of Android WebGL2 contexts, so r32float bands rendered black there. Ask the device before choosing the sampler. Co-Authored-By: Claude Fable 5.1 <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
#773 rewrote createBandTexture for devices without r16unorm. Keep its flow (resolveTextureFormat, isFilterable, and the uploaded byte length) and add this branch's r32float upload for every other typed array. That drops this branch's sampler fallback. It asked device.isTextureFormatFilterable, which luma.gl answers true for r32float on every WebGL2 device, so float bands still sampled linear without OES_texture_float_linear and drew black. isFilterable checks the float32-filterable feature instead. The uploaded byte length also makes the tile cache count Int16 bands at their float32 size. Co-Authored-By: Claude Opus 5.5 <[email protected]>
uint8 and uint16 bands reach the render pipeline normalized to 0-1, while signed integer, uint32 and float bands keep their raw values, so a FilterNoDataVal value or LinearRescale range depends on the band's type. Document that on renderPipeline, and update the dev doc that still said createBandTexture only handled uint8 and uint16. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Brings in #775's `resampling` prop. Its render-time filter check uses isFilterable on each texture, so the r32float bands from this branch stay nearest on devices that can't filter floats. Both sides appended a describe block to the MultiCOGLayer tests; keep both. Co-Authored-By: Claude Opus 5.5 <[email protected]>
kylebarron
commented
Oct 22, 2026
| **Status**: Works for every single-band type; multi-band textures are not handled. | ||
|
|
||
| `createBandTexture` supports `r8unorm` (Uint8Array) and `r16unorm` (Uint16Array). Multi-band textures, float32, and other formats are not yet handled. Should eventually use `inferTextureFormat` from `texture.ts`. | ||
| `createBandTexture` uploads `Uint8Array` as `r8unorm` and `Uint16Array` as `r16unorm` (or 0-1 `r32float` on devices without `EXT_texture_norm16`). Every other typed array uploads as `r32float` with raw values. `inferTextureFormat` from `texture.ts` doesn't fit: its integer formats need an integer sampler, which `CompositeBands` doesn't use. |
Member
Author
There was a problem hiding this comment.
createBandTextureuploadsUint8Arrayasr8unormandUint16Arrayasr16unorm(or 0-1r32floaton devices withoutEXT_texture_norm16). Every other typed array uploads asr32floatwith raw values.
I'm still unsure about whether this is the right approach.
Member
Author
There was a problem hiding this comment.
It feels messy to create an API like this.
Perhaps we could merge it but mark it as experimental, somehow, signaling that it's likely to change in the future?
Member
Author
There was a problem hiding this comment.
Let's mark it as experimental and merge
…perimental uint8 and uint16 bands reach the render pipeline normalized to 0-1, and every other type keeps its raw value. That split is likely to change so that every type arrives in the same units, so say in the renderPipeline docs that the other types are experimental rather than presenting their units as settled. Co-Authored-By: Claude Opus 5.5 <[email protected]>
kylebarron
commented
Oct 22, 2026
Apply the review suggestion: give the r16unorm fallback and the experimental note their own paragraphs, and bold "experimental". Co-Authored-By: Claude Opus 5.5 <[email protected]>
kylebarron
commented
Oct 22, 2026
…n paragraph Apply the review suggestion, and bold "experimental". Co-Authored-By: Claude Opus 5.5 <[email protected]>
This was referenced Nov 6, 2026
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.
Note
This PR was written by Claude (Claude Code), not by @kylebarron.
MultiCOGLayeronly uploadedUint8ArrayandUint16Arraybands, so a source with any other sample type, such as Int16 or Float32, threwUnsupported typed array typeon every tile.Signed integers,
uint32and floats now upload asr32float, converted toFloat32Arraywhere needed, so the shader reads raw sample values. Integer texture formats would need an integer sampler, whichCompositeBands'sampler2Dcan't read. Integers past 2^24 andFloat64Arraysamples round to float32.These bands sample nearest where the device can't filter float32 textures:
createBandTextureand theresamplingprop from #775 both check withisFilterablefrom #773. luma.gl'sisTextureFormatFilterablereportsr32floatas filterable on every WebGL2 device. A linear sampler withoutOES_texture_float_linearleaves the texture incomplete, so the scene draws black.uint8anduint16bands still reach the render pipeline normalized to 0-1, while every other type keeps its raw value. TherenderPipelinedocs now say so, since nodata values and rescale ranges depend on it. They also mark the other types as experimental: that split is likely to change so that every type arrives in the same units. The tile cache counts the float32 bytes uploaded, which for Int16 is twice the source size.Thanks to @earlybard for #650, which this finishes. His two commits are kept, followed by merges of main (resolved onto #773's
createBandTexture) and docs commits.Checked in Chrome 155 on macOS with the Int16 scene from #650 (Digital Earth Australia Sentinel-2 ARD, nodata -999):
Unsupported typed array type: Int16Array.OES_texture_float_linearhidden: the scene draws, sampling nearest. feat(deck.gl-geotiff): render signed integer and float bands in MultiCOGLayer #650's own fallback drew it black.uint16scene is unchanged.Closes #650
🤖 Written by Claude Code