Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Reduce webgl module imports #8472

Merged
merged 2 commits into from Feb 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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