• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

keplergl / kepler.gl / 23881346444

02 Apr 2026 02:51AM UTC coverage: 60.559% (-1.1%) from 61.699%
23881346444

Pull #3271

github

web-flow
Merge cb3cf1185 into bc59e880b
Pull Request #3271: chore: deck.gl 9.2 upgrade & loaders.gl, luma.gl upgrades

6514 of 12797 branches covered (50.9%)

Branch coverage included in aggregate %.

284 of 765 new or added lines in 51 files covered. (37.12%)

122 existing lines in 17 files now uncovered.

13273 of 19877 relevant lines covered (66.78%)

79.35 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

48.86
/src/utils/src/gl-utils.ts
1
// SPDX-License-Identifier: MIT
2
// Copyright contributors to the kepler.gl project
3

4
import {console as Console} from 'global/window';
5
import {
6
  LAYER_BLENDINGS,
7
  GL_BLEND_FUNC_TO_WEBGPU,
8
  GL_BLEND_EQ_TO_WEBGPU,
9
  BLEND_OPERATION,
10
  BLEND_FACTOR,
11
  FILTER_MODE,
12
  DEPTH_STENCIL_FORMAT,
13
  TEXTURE_USAGE
14
} from '@kepler.gl/constants';
15
import {DeckRenderer} from '@deck.gl/core';
16

17
/**
18
 * Convert layer blending config to deck.gl 9.x parameters format.
19
 * In deck.gl 9.x, blending is set via `parameters` prop using WebGPU-style string constants
20
 * instead of calling setParameters with GL constants.
21
 */
22
export function getLayerBlendingParameters(
23
  layerBlending: string
24
): Record<string, string | boolean> {
25
  const blending = LAYER_BLENDINGS[layerBlending];
29✔
26
  if (!blending) return {};
29!
27
  const {blendFunc, blendEquation} = blending;
29✔
28
  if (!blendFunc) return {};
29!
29

30
  const params: Record<string, string | boolean> = {
29✔
31
    blend: true
32
  };
33

34
  if (blendFunc.length >= 2) {
29!
35
    if (!GL_BLEND_FUNC_TO_WEBGPU[blendFunc[0]])
29!
NEW
36
      Console.warn(`Unmapped blend function: ${blendFunc[0]}, falling back to 'one'`);
×
37
    if (!GL_BLEND_FUNC_TO_WEBGPU[blendFunc[1]])
29!
NEW
38
      Console.warn(`Unmapped blend function: ${blendFunc[1]}, falling back to 'zero'`);
×
39
    params.blendColorSrcFactor = GL_BLEND_FUNC_TO_WEBGPU[blendFunc[0]] || BLEND_FACTOR.ONE;
29!
40
    params.blendColorDstFactor = GL_BLEND_FUNC_TO_WEBGPU[blendFunc[1]] || BLEND_FACTOR.ZERO;
29!
41
  }
42
  if (blendFunc.length >= 4) {
29!
43
    if (!GL_BLEND_FUNC_TO_WEBGPU[blendFunc[2]])
29!
NEW
44
      Console.warn(`Unmapped blend function: ${blendFunc[2]}, falling back to 'one'`);
×
45
    if (!GL_BLEND_FUNC_TO_WEBGPU[blendFunc[3]])
29!
NEW
46
      Console.warn(`Unmapped blend function: ${blendFunc[3]}, falling back to 'zero'`);
×
47
    params.blendAlphaSrcFactor = GL_BLEND_FUNC_TO_WEBGPU[blendFunc[2]] || BLEND_FACTOR.ONE;
29!
48
    params.blendAlphaDstFactor = GL_BLEND_FUNC_TO_WEBGPU[blendFunc[3]] || BLEND_FACTOR.ZERO;
29!
49
  } else {
NEW
50
    params.blendAlphaSrcFactor = params.blendColorSrcFactor;
×
NEW
51
    params.blendAlphaDstFactor = params.blendColorDstFactor;
×
52
  }
53

54
  if (Array.isArray(blendEquation)) {
29!
55
    params.blendColorOperation = GL_BLEND_EQ_TO_WEBGPU[blendEquation[0]] || BLEND_OPERATION.ADD;
29!
56
    params.blendAlphaOperation = GL_BLEND_EQ_TO_WEBGPU[blendEquation[1]] || BLEND_OPERATION.ADD;
29!
NEW
57
  } else if (blendEquation) {
×
NEW
58
    params.blendColorOperation = GL_BLEND_EQ_TO_WEBGPU[blendEquation] || BLEND_OPERATION.ADD;
×
NEW
59
    params.blendAlphaOperation = params.blendColorOperation;
×
60
  }
61

62
  return params;
29✔
63
}
64

65
/**
66
 * Patch DeckRenderer to include depth-stencil attachments on post-processing
67
 * framebuffers. In deck.gl 9, _resizeRenderBuffers creates FBOs with only color
68
 * attachments, which breaks depth testing when post-processing effects are active.
69
 * This was not an issue in deck.gl 8 where Framebuffer() auto-created a depth buffer.
70
 */
71
interface DeckRendererInternals {
72
  _resizeRenderBuffers?: () => void;
73
  device: {
74
    canvasContext: {getDrawingBufferSize(): [number, number]};
75
    createTexture(props: Record<string, unknown>): unknown;
76
    createFramebuffer(props: Record<string, unknown>): {resize(size: [number, number]): void};
77
  };
78
  renderBuffers: {resize(size: [number, number]): void}[];
79
}
80

81
let _deckRendererPatched = false;
15✔
82
export function patchDeckRendererForPostProcessing(): void {
83
  if (_deckRendererPatched) return;
25✔
84
  _deckRendererPatched = true;
1✔
85

86
  const proto = DeckRenderer.prototype as unknown as DeckRendererInternals;
1✔
87
  const original =
88
    typeof proto._resizeRenderBuffers === 'function' ? proto._resizeRenderBuffers : null;
1!
89

90
  proto._resizeRenderBuffers = function _resizeRenderBufferPatched(this: DeckRendererInternals) {
1✔
NEW
91
    if (!this.device?.canvasContext) {
×
NEW
92
      return original?.call(this);
×
93
    }
94

NEW
95
    const {renderBuffers} = this;
×
NEW
96
    const size = this.device.canvasContext.getDrawingBufferSize();
×
NEW
97
    const [width, height] = size;
×
NEW
98
    if (renderBuffers.length === 0) {
×
NEW
99
      [0, 1].map((i: number) => {
×
NEW
100
        const colorTexture = this.device.createTexture({
×
101
          sampler: {minFilter: FILTER_MODE.LINEAR, magFilter: FILTER_MODE.LINEAR},
102
          width,
103
          height
104
        });
NEW
105
        const depthTexture = this.device.createTexture({
×
106
          id: `deck-renderbuffer-${i}-depth`,
107
          format: DEPTH_STENCIL_FORMAT.DEPTH24_PLUS,
108
          usage: TEXTURE_USAGE.RENDER_ATTACHMENT | TEXTURE_USAGE.SAMPLE,
109
          width,
110
          height
111
        });
NEW
112
        renderBuffers.push(
×
113
          this.device.createFramebuffer({
114
            id: `deck-renderbuffer-${i}`,
115
            colorAttachments: [colorTexture],
116
            depthStencilAttachment: depthTexture
117
          })
118
        );
119
      });
120
    }
NEW
121
    for (const buffer of renderBuffers) {
×
NEW
122
      buffer.resize(size);
×
123
    }
124
  };
125
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc