Skip to content

Commit

Permalink
chore: Remove internal texture parameters (v9.1) (#8851)
Browse files Browse the repository at this point in the history
  • Loading branch information
ibgreen committed Apr 29, 2024
1 parent 4511f61 commit be76eef
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 29 deletions.
@@ -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
@@ -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
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
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
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
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
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
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

0 comments on commit be76eef

Please sign in to comment.