You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Update docs for luma.gl v9 and API changes
Revised documentation to reflect luma.gl v9 updates, including changes to GPU parameter handling, device initialization, and usage of string constants over WebGL constants.
* Sections and better formatting
* Update upgrade-guide.md
* Remove outdated note about setting GPU parameters
Deleted a note referencing the use of the `onDeviceInitialized` callback and luma.gl's `setParameters` method as an alternative way to set GPU parameters, likely due to deprecation or changes in recommended practices.
Copy file name to clipboardExpand all lines: docs/api-reference/core/deck.md
+13-9Lines changed: 13 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -147,35 +147,39 @@ Note:
147
147
148
148
#### `parameters` (object) {#parameters}
149
149
150
-
Expects an object with GPU parameters. Before each frame is rendered, this object will be passed to luma.gl's `setParameters` function to reset the GPU context parameters, e.g. to disable depth testing, change blending modes etc. The default parameters set by `Deck` on initialization are the following:
150
+
Expects an object with GPU parameters. Before each frame is rendered, this object will be passed to luma.gl's `RenderPass` to reset the GPU context parameters, e.g. to disable depth testing, change blending modes etc. The default parameters set by `Deck` on initialization are the following:
Refer to the luma.gl [setParameters](https://github.com/visgl/luma.gl/blob/8.5-release/modules/gltools/docs/api-reference/parameter-setting.md) API for documentation on supported parameters and values.
165
+
Refer to the luma.gl [GPU parameters](https://luma.gl/docs/api-reference/core/parameters) API for documentation on supported parameters and values.
163
166
164
167
```js
165
-
importGLfrom'@luma.gl/constants';
166
168
newDeck({
167
169
// ...
168
170
parameters: {
169
-
blendFunc: [GL.ONE, GL.ONE, GL.ONE, GL.ONE],
170
-
depthTest:false
171
+
blendColorSrcFactor:'one',
172
+
blendColorDstFactor:'one',
173
+
blendAlphaSrcFactor:'one',
174
+
blendAlphaDstFactor:'one'
175
+
depthWriteEnabled:false
171
176
}
172
177
});
173
178
```
174
179
175
180
Notes:
176
181
177
182
- Any GPU `parameters` prop supplied to individual layers will still override the global `parameters` when that layer is rendered.
178
-
- An alternative way to set `parameters` is to instead define the `onWebGLInitialized` callback (it receives the `gl` context as parameter) and call the luma.gl `setParameters` method inside it.
Copy file name to clipboardExpand all lines: docs/upgrade-guide.md
+118-9Lines changed: 118 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -72,21 +72,125 @@ The following issues are known and can be expected to resolve in a 9.0 patch:
72
72
73
73
### Typescript
74
74
75
-
Typescript is now enabled on all modules. The `'@deck.gl/xxx/typed'` packages are removed.
75
+
Typescript is now enabled on all modules. The `'@deck.gl/xxx/typed'` packages are removed.
76
76
77
-
### luma.gl v9 Updates
77
+
```ts
78
+
// deck.gl v9
79
+
import {Deck} from'@deck.gl/core'
80
+
81
+
// deck.gl v8
82
+
import {Deck} from'@deck.gl/core/typed'
83
+
```
84
+
85
+
### @deck.gl/core and luma.gl v9 Updates
78
86
79
87
The biggest changes in deck.gl v9 are due to the upgrade to the luma.gl v9 API. Fortunately, deck.gl encapsulates most of the luma.gl API so the changes to deck.gl applications should be limited, in particular if the application does not directly interact with GPU resources.
80
88
81
-
Quick summary:
89
+
For more information read the [luma v9 porting guide](https://luma.gl/docs/legacy/porting-guide)
90
+
91
+
#### External GL Context
92
+
93
+
`DeckProps.gl (WebGLRenderingContext)` should be replaced with `device`: [Device](https://luma.gl/docs/api-reference/core/device):
-`DeckProps.gl (WebGLRenderingContext)` should be replaced with `device`: [Device](https://luma.gl/docs/api-reference/core/device).
84
-
-`DeckProps.glOptions (WebGLContextAttributes)` should be replaced with `DeckProps.deviceProps.webgl`: `deviceProps: {type: 'webgl', webgl: ...glOptions}`: [WebGLDeviceProps](https://luma.gl/docs/api-reference/webgl/#webgldeviceprops)
110
+
newDeck({
111
+
gl: canvas.getContext('webgl2')
112
+
});
113
+
```
114
+
115
+
#### GL Options and Device Initialization
116
+
117
+
-`DeckProps.glOptions (WebGLContextAttributes)` should be replaced with `DeckProps.deviceProps.webgl`: [WebGLContextAttributes](https://luma.gl/docs/api-reference/core/device#webglcontextattributes)
85
118
-`DeckProps.glOptions.preserveDrawingBuffers` is now set by default, and does not need to be overridden.
119
+
-`DeckProps.glOptions.powerPreference` is now set to `'high-performance'` by default, and does not need to be overridden.
86
120
-`DeckProps.onWebGLInitialized` callback is now `DeckProps.onDeviceInitialized`.
87
-
-`LayerProps.parameters` and `LayerProps.textureParameters` no longer use WebGL constants, but instead use (WebGPU style) [string constants](https://luma.gl/docs/api-reference/core/parameters/).
88
-
- When providing [binary data attributes](./api-reference/core/layer.md#data), `type` is now a WebGPU-style [string format](https://luma.gl/docs/api-guide/gpu/gpu-attributes#vertexformat) instead of a GL constant.
89
-
- GPU resources should no longer be created by directly instantiating classes. For example, instead of `new Buffer(gl)` use `device.createBuffer()`, instead of `new Texture()` use `device.createTexture()`. See [Device methods](https://luma.gl/docs/api-reference/core/device#methods).
121
+
122
+
```ts
123
+
// deck.gl v9
124
+
import {Deck} from'@deck.gl/core'
125
+
126
+
newDeck({
127
+
deviceProps: {
128
+
type: 'webgl',
129
+
// powerPreference: 'high-performance' is now set by default
130
+
webgl: {
131
+
stencil: true
132
+
// preserveDrawingBuffers: true is now set by default
133
+
}
134
+
},
135
+
onDeviceInitialized: (device) => {
136
+
const gl =device.handle// WebGL2RenderingContext when using a webgl device
137
+
}
138
+
});
139
+
140
+
// deck.gl v8
141
+
import {Deck} from'@deck.gl/core/typed'
142
+
143
+
newDeck({
144
+
glOptions: {
145
+
stencil: true,
146
+
preserveDrawingBuffers: true,
147
+
powerPreference: 'high-performance'
148
+
},
149
+
onWebGLInitialized: (gl) => {}
150
+
});
151
+
```
152
+
153
+
#### GPU Parameters
154
+
155
+
`DeckProps.parameters`, `LayerProps.parameters`, and `LayerProps.textureParameters` no longer use WebGL constants, but instead use (WebGPU style) [string constants](https://luma.gl/docs/api-reference/core/parameters/):
156
+
157
+
```ts
158
+
// deck.gl v9 using string constants (preferred)
159
+
import {Deck} from'@deck.gl/core'
160
+
newDeck({
161
+
parameters: {
162
+
blendColorOperation: 'add',
163
+
blendColorSrcFactor: 'src-alpha',
164
+
blendColorDstFactor: 'one',
165
+
blendAlphaOperation: 'add',
166
+
blendAlphaSrcFactor: 'one-minus-dst-alpha',
167
+
blendAlphaDstFactor: 'one'
168
+
}
169
+
})
170
+
171
+
// deck.gl v9 using GL constants
172
+
// The constant module remains but is now considered an internal luma.gl module, and is no longer intended to be imported by applications.
173
+
import {Deck} from'@deck.gl/core'
174
+
import {GL} from'@luma.gl/constants'// Note the ESM import
175
+
176
+
newDeck({
177
+
parameters: {
178
+
blendEquation: [GL.ADD, GL.ADD],
179
+
blendFunc: [GL.ONE, GL.ONE, GL.ONE, GL.ONE],
180
+
}
181
+
})
182
+
183
+
// deck.gl v8
184
+
import {Deck} from'@deck.gl/core/typed'
185
+
importGLfrom'@luma.gl/constants';
186
+
187
+
newDeck({
188
+
parameters: {
189
+
blendEquation: [GL.ADD, GL.ADD],
190
+
blendFunc: [GL.ONE, GL.ONE, GL.ONE, GL.ONE],
191
+
}
192
+
})
193
+
```
90
194
91
195
#### Custom Layers
92
196
@@ -112,14 +216,19 @@ class MyLayer {
112
216
}
113
217
```
114
218
115
-
116
219
While the 9.0 release of deck.gl does not yet support WebGPU, our goal is to enable WebGPU soon in a 9.x release. A number of changes will be required to deck.gl curtom layers:
117
220
118
221
- deck.gl now uses uniform buffers instead of global uniforms. It is not yet required to use uniform buffers but it will be necessary if you would like to run deck.gl on WebGPU in future releases.
119
222
- When defining an attribute, `type` is now a WebGPU-style [string format](https://luma.gl/docs/api-guide/gpu/gpu-attributes#vertexformat) instead of GL constant, and `divisor` is replaced by `stepMode`. See [AttributeManager.add](./api-reference/core/attribute-manager.md#add)
120
223
- WebGL draw modes `GL.TRIANGLE_FAN` and `GL.LINE_LOOP` are not supported on WebGPU. Select a different topology when creating geometries.
121
224
- The luma picking module now [uses uniform buffers](https://github.com/visgl/luma.gl/blob/master/modules/shadertools/src/modules/engine/picking/picking.ts#L34-L50). To access picking state in shaders use `picking.isActive` rather than `picking_isActive`
122
225
226
+
#### Additional Changes
227
+
228
+
- When providing [binary data attributes](./api-reference/core/layer.md#data), `type` is now a WebGPU-style [string format](https://luma.gl/docs/api-guide/gpu/gpu-attributes#vertexformat) instead of a GL constant.
229
+
- GPU resources should no longer be created by directly instantiating classes. For example, instead of `new Buffer(gl)` use `device.createBuffer()`, instead of `new Texture()` use `device.createTexture()`. See [Device methods](https://luma.gl/docs/api-reference/core/device#methods).
230
+
231
+
123
232
### @deck.gl/mapbox
124
233
125
234
`MapboxLayer` has been removed. Use `MapboxOverlay` instead.
0 commit comments