deck.gl icon indicating copy to clipboard operation
deck.gl copied to clipboard

Types: luma.gl Parameters

Open felixpalmer opened this issue 1 year ago • 3 comments

Background

I noticed that that passing depthTest in Parameters raises a type error, despite working in the past:

const scatter = new ScatterplotLayer({
  parameters: {depthTest: false}
});

Even though luma is not including this on the Parameters type, it continues to work in practice.

I've gone ahead and added some types to surface the inconsistencies, and found that the following keys are used by deck but untyped in luma:

  • depthRange (collision-filter-pass.ts)
  • depthTest (terrain-pass.ts)

@ibgreen should these types be added to luma or should deck be migrating to a new API?

Change List

  • Add Parameters type where previously missing
  • Add isDrawableLayerParameters type helper

felixpalmer avatar Oct 10 '24 13:10 felixpalmer

Type errors will occur when using non-WebGPU compatible parameters. Perhaps they work now but if so they will soon no longer work

Docs at https://luma.gl/docs/api-reference/core/parameters Type defs here https://github.com/visgl/luma.gl/blob/master/modules/core/src/adapter/types/parameters.ts#L99

Recommendations:

  • depthTest should be replaced with https://github.com/visgl/luma.gl/blob/bd27f0b51114c751900525b366991e35a542e950/examples/showcase/instancing/app.ts#L178
  • depthRange- Not sure if there is any equivalent, WebGPU uses 0-1 (clear depth buffer is 1)

ibgreen avatar Oct 10 '24 16:10 ibgreen

Regarding depthRange, it isn't clear why we even need to add this. We only ever set it to [0,1]. I think it originally was introduced as a Mapbox workaround and the usage then spread to other places.

felixpalmer avatar Oct 11 '24 07:10 felixpalmer

Coverage Status

coverage: 91.63% (+0.004%) from 91.626% when pulling cf9f118c9d304f466124f860ce8af41891294f9e on felix/draw-layer-parameters into e5822eb61a09ab424ea039492383cb474413ad01 on master.

coveralls avatar Oct 11 '24 11:10 coveralls