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: Remove internal texture parameters (v9.1) #8851

Merged
merged 5 commits into from
Apr 29, 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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {GL} from '@luma.gl/constants';
import type {TextureProps} from '@luma.gl/core';
import {AGGREGATION_OPERATION} from '../aggregation-operation-utils';

export const DEFAULT_RUN_PARAMS = {
Expand Down Expand Up @@ -31,16 +32,13 @@ export const DEFAULT_WEIGHT_PARAMS = {
export const PIXEL_SIZE = 4; // RGBA32F
export const WEIGHT_SIZE = 3;

export const MAX_MIN_TEXTURE_OPTS = {
format: GL.RGBA32F,
type: GL.FLOAT,
border: 0,
export const MAX_MIN_TEXTURE_OPTS: TextureProps = {
format: 'rgba32float',
mipmaps: false,
sampler: {
minFilter: 'nearest',
magFilter: 'nearest'
},
dataFormat: GL.RGBA,
width: 1,
height: 1
};
9 changes: 4 additions & 5 deletions modules/aggregation-layers/src/utils/resource-utils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {Device, SamplerProps} from '@luma.gl/core';

const DEFAULT_PARAMETERS: SamplerProps = {
const DEFAULT_SAMPLER: SamplerProps = {
minFilter: 'nearest',
magFilter: 'nearest'
};
Expand All @@ -11,20 +11,19 @@ type FloatTextureOptions = {
height?: number;
data?: any;
unpackFlipY?: boolean;
parameters?: SamplerProps;
sampler?: SamplerProps;
};

// TODO - not working
export function getFloatTexture(device: Device, opts: FloatTextureOptions) {
const {width = 1, height = 1, data = null, parameters = DEFAULT_PARAMETERS} = opts;
const {width = 1, height = 1, data = null, sampler = DEFAULT_SAMPLER} = opts;
const texture = device.createTexture({
data,
format: 'rgba32float', // device.info.type === 'webgl2' ? 'rgba32float' : GL.RGBA,
// type: GL.FLOAT,
// border: 0,
mipmaps: false,
sampler: parameters,
// dataFormat: GL.RGBA,
sampler,
width,
height
// ts-expect-error
Expand Down
6 changes: 1 addition & 5 deletions modules/core/src/passes/shadow-pass.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,7 @@ export default class ShadowPass extends LayersPass {
format: 'depth16unorm',
width: 1,
height: 1,
mipmaps: false,

// TODO fix getWebGLTextureParameters() in luma to avoid passing deprecated parameters
dataFormat: 6402, // gl.DEPTH_COMPONENT
type: 5125 // gl.UNSIGNED_INT
mipmaps: false
});

this.fbo = device.createFramebuffer({
Expand Down
1 change: 0 additions & 1 deletion modules/core/src/transitions/gpu-spring-transition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,6 @@ function getTexture(device: Device): Texture {
data: new Uint8Array(4),
format: 'rgba8unorm',
mipmaps: false,
// dataFormat: GL.RGBA,
width: 1,
height: 1
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,11 +248,7 @@ export default class CollisionFilterEffect implements Effect {
format: 'depth16unorm',
width,
height,
mipmaps: false,

// TODO fix getWebGLTextureParameters() in luma to avoid passing deprecated parameters
dataFormat: 6402, // gl.DEPTH_COMPONENT
type: 5125 // gl.UNSIGNED_INT
mipmaps: false
});
this.collisionFBOs[collisionGroup] = device.createFramebuffer({
id: `collision-${collisionGroup}`,
Expand Down
3 changes: 1 addition & 2 deletions modules/extensions/src/data-filter/aggregator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ export function getFramebuffer(device: Device, useFloatTarget: boolean): Framebu
colorAttachments: [
device.createTexture({
format: 'rgba32float',
type: GL.FLOAT,
mipmaps: false
})
]
Expand All @@ -80,7 +79,7 @@ export function getFramebuffer(device: Device, useFloatTarget: boolean): Framebu
return device.createFramebuffer({
width: 256,
height: 64,
colorAttachments: [device.createTexture({format: 'rgba8unorm', type: GL.FLOAT, mipmaps: false})]
colorAttachments: [device.createTexture({format: 'rgba8unorm', mipmaps: false})]
});
}

Expand Down
8 changes: 4 additions & 4 deletions modules/layers/src/icon-layer/icon-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ export default class IconManager {
private _texture: Texture | null = null;
private _externalTexture: Texture | null = null;
private _mapping: IconMapping = {};
private _textureParameters: SamplerProps | null = null;
private _samplerParameters: SamplerProps | null = null;

/** count of pending requests to fetch icons */
private _pendingCount: number = 0;
Expand Down Expand Up @@ -368,7 +368,7 @@ export default class IconManager {
}

if (textureParameters) {
this._textureParameters = textureParameters;
this._samplerParameters = textureParameters;
}
}

Expand Down Expand Up @@ -407,7 +407,7 @@ export default class IconManager {
format: 'rgba8unorm',
width: this._canvasWidth,
height: this._canvasHeight,
sampler: this._textureParameters || DEFAULT_SAMPLER_PARAMETERS
sampler: this._samplerParameters || DEFAULT_SAMPLER_PARAMETERS
});
}

Expand All @@ -416,7 +416,7 @@ export default class IconManager {
this._texture,
this._canvasWidth,
this._canvasHeight,
this._textureParameters || DEFAULT_SAMPLER_PARAMETERS
this._samplerParameters || DEFAULT_SAMPLER_PARAMETERS
);
}

Expand Down
3 changes: 1 addition & 2 deletions test/apps/wboit/wboit-layer/wboit-layer.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export default class WBOITLayer extends SolidPolygonLayer {

const accumulationTexture = new Texture2D(gl, {
...textureOpts,
format: gl.RGBA32F
format: 'rgba32float'
});

const revealageTexture = new Texture2D(gl, {
Expand All @@ -70,7 +70,6 @@ export default class WBOITLayer extends SolidPolygonLayer {
// const accumulationDepthTexture = new Texture2D(gl, {
// ...textureOpts,
// format: GL.DEPTH_COMPONENT32F,
// dataFormat: GL.DEPTH_COMPONENT
// });

const accumulationFramebuffer = new Framebuffer(gl, {
Expand Down
Loading