Skip to content

Commit

Permalink
UBOs upgrade guide
Browse files Browse the repository at this point in the history
  • Loading branch information
felixpalmer committed Dec 13, 2024
1 parent 1494bd2 commit 6f9905d
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions docs/upgrade-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,28 @@

## Upgrading to v9.1

### Uniform buffer objects

All shaders that use global uniform defitions need to be migrated to Uniform Buffer Objects and the shader references updated, for example:

```glsl
// Global uniform
uniform float opacity;
// UBO
uniform layerUniforms {
uniform float opacity;
} layer;
```

The [ShaderModule](https://luma.gl/docs/api-reference/shadertools/shader-module) class is used to encapsulate and inject the uniforms, as well as providing using useful type checks. It maps (typed) props to uniforms defined in the UBO block. See [layerUniforms](https://github.com/visgl/deck.gl/blob/master/modules/core/src/shaderlib/misc/layer-uniforms.ts) for an example.

Layers need to be modified:
- `getShaders()` needs to additionaly return the `ShaderModule` that defines the UBO
- Instead of calling `model.setUniforms` (or `model.setBindings`) use `model.shaderInputs.setProps` to update the UBO with props

For more information see [presentation](https://docs.google.com/presentation/d/1OcjA_hdu6vEvL_nxm7ywnXZQbMr5eR4R_L-wcz6K0HI/) ([https://www.youtube.com/watch?v=ei6scnRpNhU](recording))

### User input handling

- The main gesture recognition library, [mjolnir.js](https://visgl.github.io/mjolnir.js), is upgraded to v3.0. Hammer.js is no longer an (indirect) dependency, due to its lack of maintenance and various issues with SSR and test environments.
Expand Down

0 comments on commit 6f9905d

Please sign in to comment.