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
Revised documentation to reflect luma.gl v9 updates, including changes to GPU parameter handling, device initialization, and usage of string constants over WebGL constants.
Copy file name to clipboardExpand all lines: docs/api-reference/core/deck.md
+14-9Lines changed: 14 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -147,35 +147,40 @@ 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.
183
+
- An alternative way to set `parameters` is to instead define the `onDeviceInitialized` callback (it receives the `device.handle` context as parameter) and call the luma.gl `setParameters` method inside it.
Copy file name to clipboardExpand all lines: docs/upgrade-guide.md
+106-3Lines changed: 106 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -72,19 +72,122 @@ 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
+
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
+
```
76
84
77
85
### 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
89
+
For more information read the [luma v9 porting guide](https://luma.gl/docs/legacy/porting-guide)
90
+
81
91
Quick summary:
82
92
83
93
-`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)
-`DeckProps.glOptions (WebGLContextAttributes)` should be replaced with `DeckProps.deviceProps.webgl`: [WebGLContextAttributes](https://luma.gl/docs/api-reference/core/device#webglcontextattributes)
85
116
-`DeckProps.glOptions.preserveDrawingBuffers` is now set by default, and does not need to be overridden.
117
+
-`DeckProps.glOptions.powerPreference` is now set to `'high-performance'` by default, and does not need to be overridden.
86
118
-`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/).
119
+
120
+
```ts
121
+
// deck.gl v9
122
+
import {Deck} from'@deck.gl/core'
123
+
124
+
newDeck({
125
+
deviceProps: {
126
+
type: 'webgl',
127
+
// powerPreference: 'high-performance' is now set by default
128
+
webgl: {
129
+
stencil: true
130
+
// preserveDrawingBuffers: true is now set by default
131
+
}
132
+
},
133
+
onDeviceInitialized: (device) => {
134
+
const gl =device.handle// WebGL2RenderingContext when using a webgl device
135
+
}
136
+
});
137
+
138
+
// deck.gl v8
139
+
import {Deck} from'@deck.gl/core/typed'
140
+
141
+
newDeck({
142
+
glOptions: {
143
+
stencil: true,
144
+
preserveDrawingBuffers: true,
145
+
powerPreference: 'high-performance'
146
+
},
147
+
onWebGLInitialized: (gl) => {}
148
+
});
149
+
```
150
+
151
+
-`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/).
152
+
153
+
```ts
154
+
// deck.gl v9 using string constants
155
+
import {Deck} from'@deck.gl/core'
156
+
newDeck({
157
+
parameters: {
158
+
blendColorOperation: 'add',
159
+
blendColorSrcFactor: 'src-alpha',
160
+
blendColorDstFactor: 'one',
161
+
blendAlphaOperation: 'add',
162
+
blendAlphaSrcFactor: 'one-minus-dst-alpha',
163
+
blendAlphaDstFactor: 'one'
164
+
}
165
+
})
166
+
167
+
// deck.gl v9 using GL constants
168
+
// The constant module remains but is now considered an internal luma.gl module, and is no longer intended to be imported by applications.
169
+
import {Deck} from'@deck.gl/core'
170
+
import {GL} from'@luma.gl/constants'// Note the ESM import
171
+
172
+
newDeck({
173
+
parameters: {
174
+
blendEquation: [GL.ADD, GL.ADD],
175
+
blendFunc: [GL.ONE, GL.ONE, GL.ONE, GL.ONE],
176
+
}
177
+
})
178
+
179
+
// deck.gl v8
180
+
import {Deck} from'@deck.gl/core/typed'
181
+
importGLfrom'@luma.gl/constants';
182
+
183
+
newDeck({
184
+
parameters: {
185
+
blendEquation: [GL.ADD, GL.ADD],
186
+
blendFunc: [GL.ONE, GL.ONE, GL.ONE, GL.ONE],
187
+
}
188
+
})
189
+
```
190
+
88
191
- 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
192
- 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).
0 commit comments