Skip to content

HDR prep: normalize rendering colors at input boundaries - #11130

Merged
ibgreen merged 3 commits into
masterfrom
codex/normalized-colors-prep
Nov 15, 2026
Merged

ibgreen merged 3 commits into
masterfrom
codex/normalized-colors-prep

Conversation

@ibgreen

@ibgreen ibgreen commented Nov 15, 2026 •

Copy link
Copy Markdown
Collaborator

Background

deck.gl v10 should support HDR colors which requires larger than 1.0 / 255 values.

This prep diff does not change the deck.gl API, it just consolidates the under the hood handling of colors.

Rendering colors use scattered byte conversions. Centralize straightforward input boundaries while preserving public byte colors and attribute storage. Lights pass normalized copies to luma.gl; public light objects remain mutable and byte-valued. Picking IDs retain their encoding. View clear colors retain the legacy zero-alpha fallback.

Change List

  • Normalize bitmap and text uniform colors through shared helpers
  • Separate highlight normalization from picking-ID handling
  • Normalize light copies before shader-module handoff
  • Centralize view clear-color and normalized palette conversion
  • Preserve palette texture byte packing
  • Unit tests cover alpha, picking IDs, palettes, and light mutation

Verified: lint; 33 focused browser tests pass across the suite and isolated render-pass rerun. One initial WebGPU timeout passed on rerun.


Note

Low Risk
Low risk refactoring that standardizes color normalization at shader uniform boundaries while preserving public byte-color contracts and picking encodings.

Overview
Refactors color normalization across layer uniforms, render passes, and shader modules by adopting @luma.gl/shaders utility functions (normalizeByteColor3 and normalizeByteColor4).

Replaces manual per-channel division in BitmapLayer tinting, MultiIconLayer outlines, aggregation layer color ranges, and viewport clearColor handling. Additionally, LightingEffect now supplies normalized light colors with useByteColors: false to shader uniforms while preserving public byte-valued light instances, and pickingModule normalizes highlightColor independently from byte-encoded picking IDs.

Reviewed by Cursor Bugbot for commit 35f80b1. Bugbot is set up for automated code reviews on this repo. Configure here.

@greptile-apps

greptile-apps Bot commented Nov 15, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; the latest change adds the requested regression test without changing rendering code.

Summary

This PR moves color conversion to shared helpers while keeping public colors byte-valued.

  • Bitmap and text layers convert byte colors before sending them to shaders.
  • Lighting sends normalized light colors to shaders without changing public lights.
  • Picking highlights are normalized separately from encoded picking colors.
  • View clear colors are normalized before the render pass clears the view.
  • Aggregation color ranges use shared conversion while palette textures stay byte-packed.

Reviews (4) · Last reviewed commit: "test(layers): cover byte typed-array bit..." · Reviewed by Greptile

@coveralls

coveralls commented Nov 15, 2026 •

Copy link
Copy Markdown

Coverage Status

coverage: 83.328% (+0.01%) from 83.317% — codex/normalized-colors-prep into master

@ibgreen ibgreen changed the title refactor(layers): centralize bitmap and text color normalization refactor: normalize rendering colors at input boundaries Nov 15, 2026
@ibgreen
ibgreen requested a review from chrisgervang November 15, 2026 16:18
@ibgreen ibgreen changed the title refactor: normalize rendering colors at input boundaries HDR prep: normalize rendering colors at input boundaries Nov 15, 2026
@ibgreen
ibgreen added this pull request to the merge queue Nov 15, 2026
Merged via the queue into master with commit df4de77 Nov 15, 2026
9 checks passed
@ibgreen
ibgreen deleted the codex/normalized-colors-prep branch November 15, 2026 16:33
colorToUse = [...clearColor.slice(0, 3), clearColor[3] || 255].map(
c => c / 255
) as NumberArray4;
// Retain the legacy zero-alpha fallback while decoding public byte colors.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// Retain the legacy zero-alpha fallback while decoding public byte colors.
// Retain the zero-alpha fallback while decoding public byte colors.

Do we intend to drop this? If not, I wouldn't call it legacy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants