Skip to content

Commit

Permalink
chore: Reduce webgl module imports (#8472)
Browse files Browse the repository at this point in the history
  • Loading branch information
ibgreen committed Feb 6, 2024
1 parent 940da34 commit eb44d5e
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 8 deletions.
3 changes: 1 addition & 2 deletions modules/core/src/lib/deck-picker.ts
Expand Up @@ -19,7 +19,6 @@
// THE SOFTWARE.

import type {Device} from '@luma.gl/core';
import {readPixelsToArray} from '@luma.gl/webgl';
import PickLayersPass, {PickingColorDecoder} from '../passes/pick-layers-pass';
import {getClosestObject, getUniqueObjects, PickedPixel} from './picking/query-object';
import {
Expand Down Expand Up @@ -528,7 +527,7 @@ export default class DeckPicker {
// Returns an Uint8ClampedArray of picked pixels
const {x, y, width, height} = deviceRect;
const pickedColors = new (pickZ ? Float32Array : Uint8Array)(width * height * 4);
readPixelsToArray(pickingFBO as Framebuffer, {
this.device.readPixelsToArrayWebGL(pickingFBO as Framebuffer, {
sourceX: x,
sourceY: y,
sourceWidth: width,
Expand Down
3 changes: 1 addition & 2 deletions modules/core/src/transitions/gpu-spring-transition.ts
@@ -1,7 +1,6 @@
/* eslint-disable complexity, max-statements, max-params */
import type {Device} from '@luma.gl/core';
import {BufferTransform} from '@luma.gl/engine';
import {readPixelsToArray} from '@luma.gl/webgl';
import {GL} from '@luma.gl/constants';
import {
padBuffer,
Expand Down Expand Up @@ -160,7 +159,7 @@ export default class GPUSpringTransition implements GPUTransition {
value: this.attribute.value as NumericArray
});

const isTransitioning = readPixelsToArray(framebuffer)[0] > 0;
const isTransitioning = this.device.readPixelsToArrayWebGL(framebuffer)[0] > 0;

if (!isTransitioning) {
transition.end();
Expand Down
1 change: 0 additions & 1 deletion modules/extensions/src/mask/mask-effect.ts
@@ -1,6 +1,5 @@
import {Layer, Viewport, Effect, PreRenderOptions, CoordinateSystem, log} from '@deck.gl/core';
import type {Device, Texture} from '@luma.gl/core';
// import {readPixelsToArray} from '@luma.gl/webgl-legacy';
import {equals} from '@math.gl/core';
import MaskPass from './mask-pass';
import {joinLayerBounds, getRenderBounds, makeViewport, Bounds} from '../utils/projection-utils';
Expand Down
3 changes: 1 addition & 2 deletions modules/extensions/src/utils/debug.ts
@@ -1,15 +1,14 @@
/* global document */

import {Framebuffer} from '@luma.gl/core';
import {readPixelsToArray} from '@luma.gl/webgl';

/** Debug utility to draw FBO contents onto screen */
// eslint-disable-next-line
export const debugFBO = function (
fbo: Framebuffer,
{minimap, opaque}: {minimap?: boolean; opaque?: boolean} = {}
) {
const color = readPixelsToArray(fbo);
const color = fbo.device.readPixelsToArrayWebGL(fbo);
let canvas = document.getElementById('fbo-canvas') as HTMLCanvasElement;
const canvasHeight = (minimap ? 2 : 1) * fbo.height;
if (!canvas) {
Expand Down
1 change: 0 additions & 1 deletion modules/layers/src/icon-layer/icon-manager.ts
@@ -1,6 +1,5 @@
/* global document */
import {Device, Texture, SamplerProps} from '@luma.gl/core';
// import {copyToTexture} from '@luma.gl/webgl';
// import {ImageLoader} from '@loaders.gl/images';
import {load} from '@loaders.gl/core';
import {createIterable} from '@deck.gl/core';
Expand Down

0 comments on commit eb44d5e

Please sign in to comment.