deck.gl icon indicating copy to clipboard operation
deck.gl copied to clipboard

[Bug]HexagonLayer issues warnings if colorRange has "too many" elements (starting with version 9.1.x)

Open clo-vis opened this issue 8 months ago • 2 comments

Description

If I create a HexagonLayer with a large colorRange, the following warnings are issued:

  • INVALID_VALUE: texSubImage2D: width or height out of range
  • GL_INVALID_VALUE: Desired resource size is greater than max texture size.

In addition, all hexagons become black.

These warnings were not issued with deck.gl 9.0.x.

Expected Behavior

Same behavior as in deck.gl 9.0.x, or at least a warning in the documentation of colorRange about large color ranges (and what "large" means).

Steps to Reproduce

Add

colorRange: new Array(2 ** 14 + 1).fill([186, 74, 0, 128]),

to the HexagonLayer example in the documentation.

Environment

  • Framework version: 9.1.4
  • Browser: Opera, Edge, Firefox
  • OS: Windows

Logs

  • INVALID_VALUE: texSubImage2D: width or height out of range
  • GL_INVALID_VALUE: Desired resource size is greater than max texture size.

clo-vis avatar Mar 10 '25 09:03 clo-vis

Modern graphics hardware has a limit on the size of textures. If you set the color range too large, the deck.gl may try to create or use texture resources that exceed this limit during internal processing. For example, the texSubImage2D function, which is used to update a portion of the texture, fires an INVALID error if the width or height passed in exceeds the legal range of the texture If you try to create a texture with a size larger than the maximum texture size supported by your hardware, a GL error is triggered.

//Query for the maximum texture size
const gl = document.createElement('canvas').getContext('webgl');
const maxTextureSize = gl.getParameter(gl.MAX_TEXTURE_SIZE);

Set the appropriate colorrange so that the texture resources generated by the colorrange do not exceed the maximum limit

liuwo23 avatar Mar 13 '25 09:03 liuwo23

As this is "working as intended", it's an issue in the documentation of colorRange - but I cannot change the issues's label from bug to doc.

Since valid colorRanges suddenly became invalid after upgrading from 9.0 to 9.1, the Upgrade Guide could also mention this breaking change.

clo-vis avatar Mar 13 '25 10:03 clo-vis