@luma.gl/webgl 9.0.0-beta.6 → 9.0.0-beta.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapter/converters/device-parameters.d.ts.map +1 -1
- package/dist/adapter/converters/device-parameters.js +81 -84
- package/dist/adapter/converters/sampler-parameters.js +17 -17
- package/dist/adapter/converters/shader-formats.js +12 -12
- package/dist/adapter/converters/texture-formats.d.ts +10 -8
- package/dist/adapter/converters/texture-formats.d.ts.map +1 -1
- package/dist/adapter/converters/texture-formats.js +175 -168
- package/dist/adapter/converters/vertex-formats.js +20 -20
- package/dist/adapter/device-helpers/webgl-device-features.d.ts +2 -1
- package/dist/adapter/device-helpers/webgl-device-features.d.ts.map +1 -1
- package/dist/adapter/device-helpers/webgl-device-features.js +14 -2
- package/dist/adapter/device-helpers/webgl-device-info.js +5 -5
- package/dist/adapter/device-helpers/webgl-device-limits.js +10 -10
- package/dist/adapter/helpers/decode-webgl-types.js +45 -45
- package/dist/adapter/helpers/get-shader-layout.js +29 -29
- package/dist/adapter/helpers/set-uniform.js +40 -40
- package/dist/adapter/helpers/webgl-topology-utils.js +38 -38
- package/dist/adapter/objects/webgl-renderbuffer.js +6 -6
- package/dist/adapter/objects/webgl-resource.js +1 -2
- package/dist/adapter/resources/webgl-buffer.js +14 -14
- package/dist/adapter/resources/webgl-command-buffer.js +25 -25
- package/dist/adapter/resources/webgl-external-texture.js +3 -3
- package/dist/adapter/resources/webgl-framebuffer.d.ts +2 -4
- package/dist/adapter/resources/webgl-framebuffer.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-framebuffer.js +41 -36
- package/dist/adapter/resources/webgl-query-set.js +6 -6
- package/dist/adapter/resources/webgl-render-pass.js +5 -5
- package/dist/adapter/resources/webgl-render-pipeline.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-render-pipeline.js +19 -13
- package/dist/adapter/resources/webgl-sampler.js +2 -2
- package/dist/adapter/resources/webgl-shader.js +4 -4
- package/dist/adapter/resources/webgl-texture.d.ts +2 -1
- package/dist/adapter/resources/webgl-texture.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-texture.js +29 -27
- package/dist/adapter/resources/webgl-transform-feedback.js +8 -8
- package/dist/adapter/resources/webgl-vertex-array.d.ts +1 -1
- package/dist/adapter/resources/webgl-vertex-array.js +5 -5
- package/dist/adapter/webgl-device.d.ts +6 -3
- package/dist/adapter/webgl-device.d.ts.map +1 -1
- package/dist/adapter/webgl-device.js +22 -17
- package/dist/classic/accessor.js +4 -4
- package/dist/classic/clear.js +2 -2
- package/dist/classic/copy-and-blit.js +15 -16
- package/dist/classic/format-utils.d.ts +2 -2
- package/dist/classic/format-utils.js +14 -14
- package/dist/classic/typed-array-utils.js +18 -18
- package/dist/context/parameters/unified-parameter-api.d.ts +3 -4
- package/dist/context/parameters/unified-parameter-api.d.ts.map +1 -1
- package/dist/context/parameters/unified-parameter-api.js +4 -9
- package/dist/context/parameters/webgl-parameter-tables.d.ts +2 -13
- package/dist/context/parameters/webgl-parameter-tables.d.ts.map +1 -1
- package/dist/context/parameters/webgl-parameter-tables.js +292 -298
- package/dist/context/state-tracker/with-parameters.d.ts +1 -2
- package/dist/context/state-tracker/with-parameters.d.ts.map +1 -1
- package/dist/context/state-tracker/with-parameters.js +2 -5
- package/dist/dist.dev.js +877 -840
- package/dist/index.cjs +1253 -1188
- package/dist/index.cjs.map +4 -4
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist.min.js +6 -6
- package/package.json +4 -4
- package/src/adapter/converters/device-parameters.ts +9 -11
- package/src/adapter/converters/texture-formats.ts +64 -61
- package/src/adapter/device-helpers/webgl-device-features.ts +22 -2
- package/src/adapter/objects/webgl-renderbuffer.ts +1 -1
- package/src/adapter/objects/webgl-resource.ts +1 -1
- package/src/adapter/resources/webgl-external-texture.ts +3 -3
- package/src/adapter/resources/webgl-framebuffer.ts +29 -26
- package/src/adapter/resources/webgl-render-pass.ts +3 -3
- package/src/adapter/resources/webgl-render-pipeline.ts +13 -6
- package/src/adapter/resources/webgl-texture.ts +7 -3
- package/src/adapter/webgl-device.ts +24 -19
- package/src/classic/clear.ts +2 -2
- package/src/context/parameters/unified-parameter-api.ts +4 -16
- package/src/context/state-tracker/with-parameters.ts +2 -7
- package/src/index.ts +4 -4
- package/dist/adapter/device-helpers/device-features.d.ts +0 -6
- package/dist/adapter/device-helpers/device-features.d.ts.map +0 -1
- package/dist/adapter/device-helpers/device-features.js +0 -65
- package/dist/adapter/device-helpers/device-limits.d.ts +0 -50
- package/dist/adapter/device-helpers/device-limits.d.ts.map +0 -1
- package/dist/adapter/device-helpers/device-limits.js +0 -92
- package/dist/adapter/device-helpers/get-device-info.d.ts +0 -4
- package/dist/adapter/device-helpers/get-device-info.d.ts.map +0 -1
- package/dist/adapter/device-helpers/get-device-info.js +0 -87
- package/dist/context/context/context-data.d.ts +0 -14
- package/dist/context/context/context-data.d.ts.map +0 -1
- package/dist/context/context/context-data.js +0 -33
- package/dist/context/context/create-browser-context.d.ts +0 -35
- package/dist/context/context/create-browser-context.d.ts.map +0 -1
- package/dist/context/context/create-browser-context.js +0 -66
|
@@ -84,11 +84,11 @@ export class WebGLDevice extends Device {
|
|
|
84
84
|
// Public `Device` API
|
|
85
85
|
//
|
|
86
86
|
|
|
87
|
-
|
|
87
|
+
/** type of this device */
|
|
88
|
+
static readonly type: string = 'webgl';
|
|
88
89
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
}
|
|
90
|
+
/** type of this device */
|
|
91
|
+
readonly type = 'webgl';
|
|
92
92
|
|
|
93
93
|
/** The underlying WebGL context */
|
|
94
94
|
readonly handle: WebGL2RenderingContext;
|
|
@@ -106,6 +106,11 @@ export class WebGLDevice extends Device {
|
|
|
106
106
|
// Static methods, expected to be present by `luma.createDevice()`
|
|
107
107
|
//
|
|
108
108
|
|
|
109
|
+
/** Check if WebGL 2 is available */
|
|
110
|
+
static isSupported(): boolean {
|
|
111
|
+
return typeof WebGL2RenderingContext !== 'undefined';
|
|
112
|
+
}
|
|
113
|
+
|
|
109
114
|
/**
|
|
110
115
|
* Get a device instance from a GL context
|
|
111
116
|
* Creates and instruments the device if not already created
|
|
@@ -149,12 +154,18 @@ export class WebGLDevice extends Device {
|
|
|
149
154
|
|
|
150
155
|
// Wait for all the loads to settle before creating the context.
|
|
151
156
|
// The Device.create() functions are async, so in contrast to the constructor, we can `await` here.
|
|
152
|
-
await Promise.
|
|
157
|
+
const results = await Promise.allSettled(promises);
|
|
158
|
+
for (const result of results) {
|
|
159
|
+
if (result.status === 'rejected') {
|
|
160
|
+
log.error(`Failed to initialize debug libraries ${result.reason}`)();
|
|
161
|
+
}
|
|
162
|
+
}
|
|
153
163
|
|
|
154
164
|
log.probe(LOG_LEVEL + 1, 'DOM is loaded')();
|
|
155
165
|
|
|
156
166
|
// @ts-expect-error
|
|
157
167
|
if (props.gl?.device) {
|
|
168
|
+
log.warn('reattaching existing device')();
|
|
158
169
|
return WebGLDevice.attach(props.gl);
|
|
159
170
|
}
|
|
160
171
|
|
|
@@ -162,7 +173,7 @@ export class WebGLDevice extends Device {
|
|
|
162
173
|
|
|
163
174
|
// Log some debug info about the newly created context
|
|
164
175
|
const message = `\
|
|
165
|
-
Created ${device.
|
|
176
|
+
Created ${device.type}${device.debug ? ' debug' : ''} context: \
|
|
166
177
|
${device.info.vendor}, ${device.info.renderer} for canvas: ${device.canvasContext.id}`;
|
|
167
178
|
log.probe(LOG_LEVEL, message)();
|
|
168
179
|
log.table(LOG_LEVEL, device.info)();
|
|
@@ -216,8 +227,11 @@ ${device.info.vendor}, ${device.info.renderer} for canvas: ${device.canvasContex
|
|
|
216
227
|
|
|
217
228
|
// luma Device fields
|
|
218
229
|
this.info = getDeviceInfo(this.gl, this._extensions);
|
|
219
|
-
this.features = new WebGLDeviceFeatures(this.gl, this._extensions);
|
|
220
230
|
this.limits = new WebGLDeviceLimits(this.gl);
|
|
231
|
+
this.features = new WebGLDeviceFeatures(this.gl, this._extensions, this.props.disabledFeatures);
|
|
232
|
+
if (this.props.initalizeFeatures) {
|
|
233
|
+
this.features.initializeFeatures();
|
|
234
|
+
}
|
|
221
235
|
|
|
222
236
|
this.canvasContext.resize();
|
|
223
237
|
|
|
@@ -330,15 +344,6 @@ ${device.info.vendor}, ${device.info.renderer} for canvas: ${device.canvasContex
|
|
|
330
344
|
|
|
331
345
|
private renderPass: WEBGLRenderPass | null = null;
|
|
332
346
|
|
|
333
|
-
getDefaultRenderPass(): WEBGLRenderPass {
|
|
334
|
-
this.renderPass =
|
|
335
|
-
this.renderPass ||
|
|
336
|
-
this.beginRenderPass({
|
|
337
|
-
framebuffer: this.canvasContext.getCurrentFramebuffer()
|
|
338
|
-
});
|
|
339
|
-
return this.renderPass;
|
|
340
|
-
}
|
|
341
|
-
|
|
342
347
|
override createCommandEncoder(props?: CommandEncoderProps): WEBGLCommandEncoder {
|
|
343
348
|
return new WEBGLCommandEncoder(this, props);
|
|
344
349
|
}
|
|
@@ -395,15 +400,15 @@ ${device.info.vendor}, ${device.info.renderer} for canvas: ${device.canvasContex
|
|
|
395
400
|
}
|
|
396
401
|
|
|
397
402
|
override setParametersWebGL(parameters: any): void {
|
|
398
|
-
setGLParameters(this, parameters);
|
|
403
|
+
setGLParameters(this.gl, parameters);
|
|
399
404
|
}
|
|
400
405
|
|
|
401
406
|
override getParametersWebGL(parameters: any): any {
|
|
402
|
-
return getGLParameters(this, parameters);
|
|
407
|
+
return getGLParameters(this.gl, parameters);
|
|
403
408
|
}
|
|
404
409
|
|
|
405
410
|
override withParametersWebGL(parameters: any, func: any): any {
|
|
406
|
-
withGLParameters(this, parameters, func);
|
|
411
|
+
withGLParameters(this.gl, parameters, func);
|
|
407
412
|
}
|
|
408
413
|
|
|
409
414
|
override clearWebGL(options?: {
|
package/src/classic/clear.ts
CHANGED
|
@@ -60,8 +60,8 @@ export function clear(
|
|
|
60
60
|
assert(clearFlags !== 0, ERR_ARGUMENTS);
|
|
61
61
|
|
|
62
62
|
// Temporarily set any clear "colors" and call clear
|
|
63
|
-
|
|
64
|
-
|
|
63
|
+
const gl = (device as WebGLDevice).gl;
|
|
64
|
+
withGLParameters(gl, parameters, () => {
|
|
65
65
|
gl.clear(clearFlags);
|
|
66
66
|
});
|
|
67
67
|
}
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
// Provides a unified API for getting and setting any WebGL parameter
|
|
6
6
|
// Also knows default values of all parameters, enabling fast cache initialization
|
|
7
7
|
// Provides base functionality for the state caching.
|
|
8
|
-
import {Device} from '@luma.gl/core';
|
|
9
8
|
import type {GLParameters} from '@luma.gl/constants';
|
|
10
9
|
import {
|
|
11
10
|
GL_PARAMETER_DEFAULTS,
|
|
@@ -14,8 +13,6 @@ import {
|
|
|
14
13
|
GL_PARAMETER_GETTERS
|
|
15
14
|
} from './webgl-parameter-tables';
|
|
16
15
|
|
|
17
|
-
import {WebGLDevice} from '../../adapter/webgl-device';
|
|
18
|
-
|
|
19
16
|
export type {GLParameters};
|
|
20
17
|
|
|
21
18
|
/**
|
|
@@ -24,13 +21,7 @@ export type {GLParameters};
|
|
|
24
21
|
* @note requires a `cache` object to be set on the context (gl.state.cache)
|
|
25
22
|
* This object is used to fill in any missing values for composite setter functions
|
|
26
23
|
*/
|
|
27
|
-
export function setGLParameters(
|
|
28
|
-
device: Device | WebGL2RenderingContext,
|
|
29
|
-
parameters: GLParameters
|
|
30
|
-
): void {
|
|
31
|
-
const webglDevice = WebGLDevice.attach(device);
|
|
32
|
-
const gl = webglDevice.gl;
|
|
33
|
-
|
|
24
|
+
export function setGLParameters(gl: WebGL2RenderingContext, parameters: GLParameters): void {
|
|
34
25
|
if (isObjectEmpty(parameters)) {
|
|
35
26
|
return;
|
|
36
27
|
}
|
|
@@ -93,12 +84,9 @@ export function setGLParameters(
|
|
|
93
84
|
* by external code needs to be synchronized for the first time
|
|
94
85
|
*/
|
|
95
86
|
export function getGLParameters(
|
|
96
|
-
|
|
87
|
+
gl: WebGL2RenderingContext,
|
|
97
88
|
parameters: keyof GLParameters | (keyof GLParameters)[] | GLParameters = GL_PARAMETER_DEFAULTS
|
|
98
89
|
): GLParameters {
|
|
99
|
-
const webglDevice = WebGLDevice.attach(device);
|
|
100
|
-
const gl = webglDevice.gl;
|
|
101
|
-
|
|
102
90
|
// support both arrays of parameters and objects (keys represent parameters)
|
|
103
91
|
|
|
104
92
|
if (typeof parameters === 'number') {
|
|
@@ -124,8 +112,8 @@ export function getGLParameters(
|
|
|
124
112
|
* NOT the canvas size dimensions, so they will have to be properly set after
|
|
125
113
|
* calling this function.
|
|
126
114
|
*/
|
|
127
|
-
export function resetGLParameters(
|
|
128
|
-
setGLParameters(
|
|
115
|
+
export function resetGLParameters(gl: WebGL2RenderingContext): void {
|
|
116
|
+
setGLParameters(gl, GL_PARAMETER_DEFAULTS);
|
|
129
117
|
}
|
|
130
118
|
|
|
131
119
|
// Helpers
|
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
4
|
|
|
5
|
-
import type {Device} from '@luma.gl/core';
|
|
6
|
-
import {WebGLDevice} from '../../adapter/webgl-device';
|
|
7
5
|
import {GLParameters, setGLParameters} from '../parameters/unified-parameter-api';
|
|
8
6
|
import {pushContextState, popContextState} from './track-context-state';
|
|
9
7
|
|
|
@@ -16,16 +14,13 @@ import {pushContextState, popContextState} from './track-context-state';
|
|
|
16
14
|
* - Returns the return value of the supplied function
|
|
17
15
|
*/
|
|
18
16
|
export function withGLParameters(
|
|
19
|
-
|
|
17
|
+
gl: WebGL2RenderingContext,
|
|
20
18
|
parameters: GLParameters & {nocatch?: boolean},
|
|
21
19
|
func: any
|
|
22
20
|
): any {
|
|
23
|
-
const webglDevice = WebGLDevice.attach(device);
|
|
24
|
-
const gl = webglDevice.gl;
|
|
25
|
-
|
|
26
21
|
if (isObjectEmpty(parameters)) {
|
|
27
22
|
// Avoid setting state if no parameters provided. Just call and return
|
|
28
|
-
return func(
|
|
23
|
+
return func(gl);
|
|
29
24
|
}
|
|
30
25
|
|
|
31
26
|
const {nocatch = true} = parameters;
|
package/src/index.ts
CHANGED
|
@@ -31,10 +31,6 @@ export {WEBGLRenderPass} from './adapter/resources/webgl-render-pass';
|
|
|
31
31
|
// export {WEBGLComputePass} from './adapter/resources/webgl-compute-pass';
|
|
32
32
|
export {WEBGLVertexArray} from './adapter/resources/webgl-vertex-array';
|
|
33
33
|
|
|
34
|
-
// Internal WebGL classes
|
|
35
|
-
export type {RenderbufferProps} from './adapter/objects/webgl-renderbuffer';
|
|
36
|
-
export {WEBGLRenderbuffer} from './adapter/objects/webgl-renderbuffer';
|
|
37
|
-
|
|
38
34
|
// WebGL adapter classes
|
|
39
35
|
export {WEBGLTransformFeedback} from './adapter/resources/webgl-transform-feedback';
|
|
40
36
|
|
|
@@ -50,6 +46,10 @@ export {setDeviceParameters, withDeviceParameters} from './adapter/converters/de
|
|
|
50
46
|
export {getShaderLayout} from './adapter/helpers/get-shader-layout';
|
|
51
47
|
export {convertGLToTextureFormat} from './adapter/converters/texture-formats';
|
|
52
48
|
|
|
49
|
+
// Internal WebGL classes
|
|
50
|
+
export type {RenderbufferProps as _RenderbufferProps} from './adapter/objects/webgl-renderbuffer';
|
|
51
|
+
export {WEBGLRenderbuffer as _WEBGLRenderbuffer} from './adapter/objects/webgl-renderbuffer';
|
|
52
|
+
|
|
53
53
|
// TEST EXPORTS
|
|
54
54
|
export {TEXTURE_FORMATS as _TEXTURE_FORMATS} from './adapter/converters/texture-formats';
|
|
55
55
|
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { DeviceFeature } from '@luma.gl/core';
|
|
2
|
-
/** Get WebGPU style feature strings */
|
|
3
|
-
export declare function getDeviceFeatures(gl: WebGL2RenderingContext): Set<DeviceFeature>;
|
|
4
|
-
/** Extract all WebGL features */
|
|
5
|
-
export declare function getWebGLFeatures(gl: WebGL2RenderingContext): Set<DeviceFeature>;
|
|
6
|
-
//# sourceMappingURL=device-features.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"device-features.d.ts","sourceRoot":"","sources":["../../../src/adapter/device-helpers/device-features.ts"],"names":[],"mappings":"AAMA,OAAO,EAAC,aAAa,EAAC,MAAM,eAAe,CAAC;AAG5C,uCAAuC;AACvC,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,sBAAsB,GAAG,GAAG,CAAC,aAAa,CAAC,CAiBhF;AAED,iCAAiC;AACjC,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,sBAAsB,GAAG,GAAG,CAAC,aAAa,CAAC,CAe/E"}
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
// luma.gl, MIT license
|
|
2
|
-
// Copyright (c) vis.gl contributors
|
|
3
|
-
import { getTextureFeatures } from '../converters/texture-formats';
|
|
4
|
-
/** Get WebGPU style feature strings */
|
|
5
|
-
export function getDeviceFeatures(gl) {
|
|
6
|
-
const features = getWebGLFeatures(gl);
|
|
7
|
-
// texture features
|
|
8
|
-
// features.add('texture-compression-bc');
|
|
9
|
-
for (const textureFeature of getTextureFeatures(gl)) {
|
|
10
|
-
features.add(textureFeature);
|
|
11
|
-
}
|
|
12
|
-
// TODO
|
|
13
|
-
// features.add('depth-clip-control'); // GPUPrimitiveState.clampDepth
|
|
14
|
-
// features.add('depth24unorm-stencil8'); // GPUTextureFormat 'depth24unorm-stencil8'.
|
|
15
|
-
// features.add('depth32float-stencil8'); // GPUTextureFormat 'depth32float-stencil8'.
|
|
16
|
-
// features.add('timestamp-query'); // GPUQueryType "timestamp-query"
|
|
17
|
-
// "indirect-first-instance"
|
|
18
|
-
return features;
|
|
19
|
-
}
|
|
20
|
-
/** Extract all WebGL features */
|
|
21
|
-
export function getWebGLFeatures(gl) {
|
|
22
|
-
// Enables EXT_float_blend first: https://developer.mozilla.org/en-US/docs/Web/API/EXT_float_blend
|
|
23
|
-
gl.getExtension('EXT_color_buffer_float');
|
|
24
|
-
gl.getExtension('WEBGL_color_buffer_float');
|
|
25
|
-
gl.getExtension('EXT_float_blend');
|
|
26
|
-
const features = new Set(WEBGL_ALWAYS_FEATURES);
|
|
27
|
-
for (const feature of Object.keys(WEBGL_FEATURES)) {
|
|
28
|
-
// @ts-expect-error
|
|
29
|
-
if (isFeatureSupported(gl, feature)) {
|
|
30
|
-
// @ts-expect-error
|
|
31
|
-
features.add(feature);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
return features;
|
|
35
|
-
}
|
|
36
|
-
function isFeatureSupported(gl, feature) {
|
|
37
|
-
const featureInfo = WEBGL_FEATURES[feature];
|
|
38
|
-
if (!featureInfo) {
|
|
39
|
-
return false;
|
|
40
|
-
}
|
|
41
|
-
// Get extension name from table
|
|
42
|
-
const featureDefinition = featureInfo;
|
|
43
|
-
// Check if the value is dependent on checking one or more extensions
|
|
44
|
-
if (typeof featureDefinition === 'boolean') {
|
|
45
|
-
return featureDefinition;
|
|
46
|
-
}
|
|
47
|
-
return Boolean(gl.getExtension(featureDefinition));
|
|
48
|
-
}
|
|
49
|
-
const WEBGL_ALWAYS_FEATURES = ['webgl', 'glsl', 'transform-feedback-webgl'];
|
|
50
|
-
/**
|
|
51
|
-
* Defines luma.gl "feature" names and semantics
|
|
52
|
-
* when value is 'string' it is the name of the extension that enables this feature
|
|
53
|
-
*/
|
|
54
|
-
const WEBGL_FEATURES = {
|
|
55
|
-
'timer-query-webgl': 'EXT_disjoint_timer_query_webgl2',
|
|
56
|
-
'transform-feedback-webgl': true,
|
|
57
|
-
// WEBGL1 SUPPORT
|
|
58
|
-
'texture-blend-float-webgl': 'EXT_float_blend',
|
|
59
|
-
'float32-filterable-linear-webgl': 'OES_texture_float_linear',
|
|
60
|
-
'float16-filterable-linear-webgl': 'OES_texture_half_float_linear',
|
|
61
|
-
'texture-filterable-anisotropic-webgl': 'EXT_texture_filter_anisotropic',
|
|
62
|
-
// FRAMEBUFFERS, TEXTURES AND RENDERBUFFERS
|
|
63
|
-
'float32-renderable-webgl': 'EXT_color_buffer_float',
|
|
64
|
-
'float16-renderable-webgl': 'EXT_color_buffer_half_float',
|
|
65
|
-
};
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import type { DeviceLimits } from '@luma.gl/core';
|
|
2
|
-
import { GL } from '@luma.gl/constants';
|
|
3
|
-
/** Populate a WebGPU style device limits */
|
|
4
|
-
export declare function getDeviceLimits(gl: WebGL2RenderingContext): DeviceLimits;
|
|
5
|
-
/** WebGL context limits */
|
|
6
|
-
export type WebGLLimits = {
|
|
7
|
-
[GL.ALIASED_LINE_WIDTH_RANGE]: [number, number];
|
|
8
|
-
[GL.ALIASED_POINT_SIZE_RANGE]: [number, number];
|
|
9
|
-
[GL.MAX_TEXTURE_SIZE]: number;
|
|
10
|
-
[GL.MAX_CUBE_MAP_TEXTURE_SIZE]: number;
|
|
11
|
-
[GL.MAX_TEXTURE_IMAGE_UNITS]: number;
|
|
12
|
-
[GL.MAX_COMBINED_TEXTURE_IMAGE_UNITS]: number;
|
|
13
|
-
[GL.MAX_VERTEX_TEXTURE_IMAGE_UNITS]: number;
|
|
14
|
-
[GL.MAX_RENDERBUFFER_SIZE]: number;
|
|
15
|
-
[GL.MAX_VARYING_VECTORS]: number;
|
|
16
|
-
[GL.MAX_VERTEX_ATTRIBS]: number;
|
|
17
|
-
[GL.MAX_VERTEX_UNIFORM_VECTORS]: number;
|
|
18
|
-
[GL.MAX_FRAGMENT_UNIFORM_VECTORS]: number;
|
|
19
|
-
[GL.MAX_VIEWPORT_DIMS]: [number, number];
|
|
20
|
-
[GL.MAX_TEXTURE_MAX_ANISOTROPY_EXT]: number;
|
|
21
|
-
[GL.MAX_3D_TEXTURE_SIZE]: number;
|
|
22
|
-
[GL.MAX_ARRAY_TEXTURE_LAYERS]: number;
|
|
23
|
-
[GL.MAX_COLOR_ATTACHMENTS]: number;
|
|
24
|
-
[GL.MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS]: number;
|
|
25
|
-
[GL.MAX_COMBINED_UNIFORM_BLOCKS]: number;
|
|
26
|
-
[GL.MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS]: number;
|
|
27
|
-
[GL.MAX_DRAW_BUFFERS]: number;
|
|
28
|
-
[GL.MAX_ELEMENT_INDEX]: number;
|
|
29
|
-
[GL.MAX_ELEMENTS_INDICES]: number;
|
|
30
|
-
[GL.MAX_ELEMENTS_VERTICES]: number;
|
|
31
|
-
[GL.MAX_FRAGMENT_INPUT_COMPONENTS]: number;
|
|
32
|
-
[GL.MAX_FRAGMENT_UNIFORM_BLOCKS]: number;
|
|
33
|
-
[GL.MAX_FRAGMENT_UNIFORM_COMPONENTS]: number;
|
|
34
|
-
[GL.MAX_SAMPLES]: number;
|
|
35
|
-
[GL.MAX_TEXTURE_LOD_BIAS]: number;
|
|
36
|
-
[GL.MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS]: number;
|
|
37
|
-
[GL.MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS]: number;
|
|
38
|
-
[GL.MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS]: number;
|
|
39
|
-
[GL.MAX_UNIFORM_BLOCK_SIZE]: number;
|
|
40
|
-
[GL.MAX_UNIFORM_BUFFER_BINDINGS]: number;
|
|
41
|
-
[GL.MAX_VARYING_COMPONENTS]: number;
|
|
42
|
-
[GL.MAX_VERTEX_OUTPUT_COMPONENTS]: number;
|
|
43
|
-
[GL.MAX_VERTEX_UNIFORM_BLOCKS]: number;
|
|
44
|
-
[GL.MAX_VERTEX_UNIFORM_COMPONENTS]: number;
|
|
45
|
-
[GL.MIN_PROGRAM_TEXEL_OFFSET]: number;
|
|
46
|
-
[GL.MAX_PROGRAM_TEXEL_OFFSET]: number;
|
|
47
|
-
[GL.UNIFORM_BUFFER_OFFSET_ALIGNMENT]: number;
|
|
48
|
-
};
|
|
49
|
-
export declare function getWebGLLimits(gl: WebGL2RenderingContext): WebGLLimits;
|
|
50
|
-
//# sourceMappingURL=device-limits.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"device-limits.d.ts","sourceRoot":"","sources":["../../../src/adapter/device-helpers/device-limits.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
// luma.gl, MIT license
|
|
2
|
-
// Copyright (c) vis.gl contributors
|
|
3
|
-
import { GL } from '@luma.gl/constants';
|
|
4
|
-
/** Populate a WebGPU style device limits */
|
|
5
|
-
export function getDeviceLimits(gl) {
|
|
6
|
-
return {
|
|
7
|
-
maxTextureDimension1D: 0, // WebGL does not support 1D textures
|
|
8
|
-
maxTextureDimension2D: gl.getParameter(GL.MAX_TEXTURE_SIZE),
|
|
9
|
-
maxTextureDimension3D: gl.getParameter(GL.MAX_3D_TEXTURE_SIZE),
|
|
10
|
-
maxTextureArrayLayers: gl.getParameter(GL.MAX_ARRAY_TEXTURE_LAYERS),
|
|
11
|
-
maxBindGroups: 1, // TBD - if we emulate bind groups we could support any number...
|
|
12
|
-
maxDynamicUniformBuffersPerPipelineLayout: 0, // TBD
|
|
13
|
-
maxDynamicStorageBuffersPerPipelineLayout: 0, // TBD
|
|
14
|
-
maxSampledTexturesPerShaderStage: gl.getParameter(GL.MAX_VERTEX_TEXTURE_IMAGE_UNITS), // TBD
|
|
15
|
-
maxSamplersPerShaderStage: gl.getParameter(GL.MAX_COMBINED_TEXTURE_IMAGE_UNITS),
|
|
16
|
-
maxStorageBuffersPerShaderStage: 0, // TBD
|
|
17
|
-
maxStorageTexturesPerShaderStage: 0, // TBD
|
|
18
|
-
maxUniformBuffersPerShaderStage: gl.getParameter(GL.MAX_UNIFORM_BUFFER_BINDINGS),
|
|
19
|
-
maxUniformBufferBindingSize: gl.getParameter(GL.MAX_UNIFORM_BLOCK_SIZE),
|
|
20
|
-
maxStorageBufferBindingSize: 0,
|
|
21
|
-
minUniformBufferOffsetAlignment: gl.getParameter(GL.UNIFORM_BUFFER_OFFSET_ALIGNMENT),
|
|
22
|
-
minStorageBufferOffsetAlignment: 0, // TBD
|
|
23
|
-
maxVertexBuffers: 0,
|
|
24
|
-
maxVertexAttributes: gl.getParameter(GL.MAX_VERTEX_ATTRIBS),
|
|
25
|
-
maxVertexBufferArrayStride: 2048, // TBD, this is just the default value from WebGPU
|
|
26
|
-
maxInterStageShaderComponents: gl.getParameter(GL.MAX_VARYING_COMPONENTS),
|
|
27
|
-
maxComputeWorkgroupStorageSize: 0, // WebGL does not support compute shaders
|
|
28
|
-
maxComputeInvocationsPerWorkgroup: 0, // WebGL does not support compute shaders
|
|
29
|
-
maxComputeWorkgroupSizeX: 0, // WebGL does not support compute shaders
|
|
30
|
-
maxComputeWorkgroupSizeY: 0, // WebGL does not support compute shaders
|
|
31
|
-
maxComputeWorkgroupSizeZ: 0, // WebGL does not support compute shaders
|
|
32
|
-
maxComputeWorkgroupsPerDimension: 0 // WebGL does not support compute shaders
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
export function getWebGLLimits(gl) {
|
|
36
|
-
function get(pname) {
|
|
37
|
-
return gl.getParameter(pname);
|
|
38
|
-
}
|
|
39
|
-
function get2(pname, defaultValue) {
|
|
40
|
-
return gl.getParameter(pname) || defaultValue;
|
|
41
|
-
}
|
|
42
|
-
// function getMaxAnistropy() {
|
|
43
|
-
// const extension = gl.getExtension('EXT_texture_filter_anisotropic');
|
|
44
|
-
// }
|
|
45
|
-
return {
|
|
46
|
-
[GL.ALIASED_LINE_WIDTH_RANGE]: get(GL.ALIASED_LINE_WIDTH_RANGE),
|
|
47
|
-
[GL.ALIASED_POINT_SIZE_RANGE]: get(GL.ALIASED_POINT_SIZE_RANGE),
|
|
48
|
-
[GL.MAX_TEXTURE_SIZE]: get(GL.MAX_TEXTURE_SIZE),
|
|
49
|
-
[GL.MAX_CUBE_MAP_TEXTURE_SIZE]: get(GL.MAX_CUBE_MAP_TEXTURE_SIZE), // GLint
|
|
50
|
-
[GL.MAX_TEXTURE_IMAGE_UNITS]: get(GL.MAX_TEXTURE_IMAGE_UNITS), // GLint
|
|
51
|
-
[GL.MAX_COMBINED_TEXTURE_IMAGE_UNITS]: get(GL.MAX_COMBINED_TEXTURE_IMAGE_UNITS), // GLint
|
|
52
|
-
[GL.MAX_VERTEX_TEXTURE_IMAGE_UNITS]: get(GL.MAX_VERTEX_TEXTURE_IMAGE_UNITS), // GLint
|
|
53
|
-
[GL.MAX_RENDERBUFFER_SIZE]: get(GL.MAX_RENDERBUFFER_SIZE), // GLint
|
|
54
|
-
[GL.MAX_VARYING_VECTORS]: get(GL.MAX_VARYING_VECTORS), // GLint
|
|
55
|
-
[GL.MAX_VERTEX_ATTRIBS]: get(GL.MAX_VERTEX_ATTRIBS), // GLint
|
|
56
|
-
[GL.MAX_VERTEX_UNIFORM_VECTORS]: get(GL.MAX_VERTEX_UNIFORM_VECTORS), // GLint
|
|
57
|
-
[GL.MAX_FRAGMENT_UNIFORM_VECTORS]: get(GL.MAX_FRAGMENT_UNIFORM_VECTORS), // GLint
|
|
58
|
-
[GL.MAX_VIEWPORT_DIMS]: get(GL.MAX_VIEWPORT_DIMS),
|
|
59
|
-
// Extensions
|
|
60
|
-
[GL.MAX_TEXTURE_MAX_ANISOTROPY_EXT]: get(GL.MAX_TEXTURE_MAX_ANISOTROPY_EXT), // getMaxAnistropy(),
|
|
61
|
-
// WebGL2 Limits
|
|
62
|
-
[GL.MAX_3D_TEXTURE_SIZE]: get2(GL.MAX_3D_TEXTURE_SIZE), // GLint
|
|
63
|
-
[GL.MAX_ARRAY_TEXTURE_LAYERS]: get2(GL.MAX_ARRAY_TEXTURE_LAYERS), // GLint
|
|
64
|
-
// [GL.MAX_CLIENT_WAIT_TIMEOUT_WEBGL]: get2(GL.MAX_CLIENT_WAIT_TIMEOUT_WEBGL), // GLint64
|
|
65
|
-
[GL.MAX_COLOR_ATTACHMENTS]: get2(GL.MAX_COLOR_ATTACHMENTS), // GLint
|
|
66
|
-
[GL.MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS]: get2(GL.MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS), // GLint64
|
|
67
|
-
[GL.MAX_COMBINED_UNIFORM_BLOCKS]: get2(GL.MAX_COMBINED_UNIFORM_BLOCKS), // GLint
|
|
68
|
-
[GL.MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS]: get2(GL.MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS), // GLint64
|
|
69
|
-
[GL.MAX_DRAW_BUFFERS]: get2(GL.MAX_DRAW_BUFFERS), // GLint
|
|
70
|
-
[GL.MAX_ELEMENT_INDEX]: get2(GL.MAX_ELEMENT_INDEX), // GLint64
|
|
71
|
-
[GL.MAX_ELEMENTS_INDICES]: get2(GL.MAX_ELEMENTS_INDICES), // GLint
|
|
72
|
-
[GL.MAX_ELEMENTS_VERTICES]: get2(GL.MAX_ELEMENTS_VERTICES), // GLint
|
|
73
|
-
[GL.MAX_FRAGMENT_INPUT_COMPONENTS]: get2(GL.MAX_FRAGMENT_INPUT_COMPONENTS), // GLint
|
|
74
|
-
[GL.MAX_FRAGMENT_UNIFORM_BLOCKS]: get2(GL.MAX_FRAGMENT_UNIFORM_BLOCKS), // GLint
|
|
75
|
-
[GL.MAX_FRAGMENT_UNIFORM_COMPONENTS]: get2(GL.MAX_FRAGMENT_UNIFORM_COMPONENTS), // GLint
|
|
76
|
-
[GL.MAX_SAMPLES]: get2(GL.MAX_SAMPLES), // GLint
|
|
77
|
-
// [GL.MAX_SERVER_WAIT_TIMEOUT]: get2(GL.MAX_SERVER_WAIT_TIMEOUT), // GLint64
|
|
78
|
-
[GL.MAX_TEXTURE_LOD_BIAS]: get2(GL.MAX_TEXTURE_LOD_BIAS), // GLfloat
|
|
79
|
-
[GL.MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS]: get2(GL.MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS), // GLint
|
|
80
|
-
[GL.MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS]: get2(GL.MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS), // GLint
|
|
81
|
-
[GL.MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS]: get2(GL.MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS), // GLint
|
|
82
|
-
[GL.MAX_UNIFORM_BLOCK_SIZE]: get2(GL.MAX_UNIFORM_BLOCK_SIZE), // GLint64
|
|
83
|
-
[GL.MAX_UNIFORM_BUFFER_BINDINGS]: get2(GL.MAX_UNIFORM_BUFFER_BINDINGS), // GLint
|
|
84
|
-
[GL.MAX_VARYING_COMPONENTS]: get2(GL.MAX_VARYING_COMPONENTS), // GLint
|
|
85
|
-
[GL.MAX_VERTEX_OUTPUT_COMPONENTS]: get2(GL.MAX_VERTEX_OUTPUT_COMPONENTS), // GLint
|
|
86
|
-
[GL.MAX_VERTEX_UNIFORM_BLOCKS]: get2(GL.MAX_VERTEX_UNIFORM_BLOCKS), // GLint
|
|
87
|
-
[GL.MAX_VERTEX_UNIFORM_COMPONENTS]: get2(GL.MAX_VERTEX_UNIFORM_COMPONENTS), // GLint
|
|
88
|
-
[GL.MIN_PROGRAM_TEXEL_OFFSET]: get2(GL.MIN_PROGRAM_TEXEL_OFFSET), // GLint
|
|
89
|
-
[GL.MAX_PROGRAM_TEXEL_OFFSET]: get2(GL.MAX_PROGRAM_TEXEL_OFFSET), // GLint
|
|
90
|
-
[GL.UNIFORM_BUFFER_OFFSET_ALIGNMENT]: get2(GL.UNIFORM_BUFFER_OFFSET_ALIGNMENT) // GLint
|
|
91
|
-
};
|
|
92
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-device-info.d.ts","sourceRoot":"","sources":["../../../src/adapter/device-helpers/get-device-info.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,UAAU,EAAC,MAAM,eAAe,CAAC;AAGzC,8DAA8D;AAC9D,wBAAgB,aAAa,CAAC,EAAE,EAAE,sBAAsB,GAAG,UAAU,CAuCpE"}
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
// luma.gl, MIT license
|
|
2
|
-
// Copyright (c) vis.gl contributors
|
|
3
|
-
import { GL } from '@luma.gl/constants';
|
|
4
|
-
/** @returns strings identifying the GPU vendor and driver. */
|
|
5
|
-
export function getDeviceInfo(gl) {
|
|
6
|
-
// "Masked" info is always available, but don't contain much useful information
|
|
7
|
-
const vendorMasked = gl.getParameter(GL.VENDOR);
|
|
8
|
-
const rendererMasked = gl.getParameter(GL.RENDERER);
|
|
9
|
-
// If we are lucky, unmasked info is available
|
|
10
|
-
// https://www.khronos.org/registry/webgl/extensions/WEBGL_debug_renderer_info/
|
|
11
|
-
const ext = gl.getExtension('WEBGL_debug_renderer_info');
|
|
12
|
-
const vendorUnmasked = gl.getParameter(ext ? ext.UNMASKED_VENDOR_WEBGL : GL.VENDOR);
|
|
13
|
-
const rendererUnmasked = gl.getParameter(ext ? ext.UNMASKED_RENDERER_WEBGL : GL.RENDERER);
|
|
14
|
-
const vendor = vendorUnmasked || vendorMasked;
|
|
15
|
-
const renderer = rendererUnmasked || rendererMasked;
|
|
16
|
-
// Driver version
|
|
17
|
-
const version = gl.getParameter(GL.VERSION);
|
|
18
|
-
// "Sniff" the GPU type and backend from the info. This works best if unmasked info is available.
|
|
19
|
-
const gpu = identifyGPUVendor(vendor, renderer);
|
|
20
|
-
const gpuBackend = identifyGPUBackend(vendor, renderer);
|
|
21
|
-
const gpuType = identifyGPUType(vendor, renderer);
|
|
22
|
-
// Determine GLSL version
|
|
23
|
-
// For now, skip parsing of the long version string, just use context type below to deduce version
|
|
24
|
-
// const version = gl.getParameter(GL.SHADING_LANGUAGE_VERSION) as string;
|
|
25
|
-
// const shadingLanguageVersion = parseGLSLVersion(version);
|
|
26
|
-
const shadingLanguage = 'glsl';
|
|
27
|
-
const shadingLanguageVersion = 300;
|
|
28
|
-
return {
|
|
29
|
-
type: 'webgl',
|
|
30
|
-
gpu,
|
|
31
|
-
gpuType,
|
|
32
|
-
gpuBackend,
|
|
33
|
-
vendor,
|
|
34
|
-
renderer,
|
|
35
|
-
version,
|
|
36
|
-
shadingLanguage,
|
|
37
|
-
shadingLanguageVersion
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
/** "Sniff" the GPU type from the info. This works best if unmasked info is available. */
|
|
41
|
-
function identifyGPUVendor(vendor, renderer) {
|
|
42
|
-
if ((/NVIDIA/i.exec(vendor)) || (/NVIDIA/i.exec(renderer))) {
|
|
43
|
-
return 'nvidia';
|
|
44
|
-
}
|
|
45
|
-
if ((/INTEL/i.exec(vendor)) || (/INTEL/i.exec(renderer))) {
|
|
46
|
-
return 'intel';
|
|
47
|
-
}
|
|
48
|
-
if ((/Apple/i.exec(vendor)) || (/Apple/i.exec(renderer))) {
|
|
49
|
-
return 'apple';
|
|
50
|
-
}
|
|
51
|
-
if ((/AMD/i.exec(vendor)) ||
|
|
52
|
-
(/AMD/i.exec(renderer)) ||
|
|
53
|
-
(/ATI/i.exec(vendor)) ||
|
|
54
|
-
(/ATI/i.exec(renderer))) {
|
|
55
|
-
return 'amd';
|
|
56
|
-
}
|
|
57
|
-
if ((/SwiftShader/i.exec(vendor)) || (/SwiftShader/i.exec(renderer))) {
|
|
58
|
-
return 'software';
|
|
59
|
-
}
|
|
60
|
-
return 'unknown';
|
|
61
|
-
}
|
|
62
|
-
/** "Sniff" the GPU backend from the info. This works best if unmasked info is available. */
|
|
63
|
-
function identifyGPUBackend(vendor, renderer) {
|
|
64
|
-
if ((/Metal/i.exec(vendor)) || (/Metal/i.exec(renderer))) {
|
|
65
|
-
return 'metal';
|
|
66
|
-
}
|
|
67
|
-
if ((/ANGLE/i.exec(vendor)) || (/ANGLE/i.exec(renderer))) {
|
|
68
|
-
return 'opengl';
|
|
69
|
-
}
|
|
70
|
-
return 'unknown';
|
|
71
|
-
}
|
|
72
|
-
function identifyGPUType(vendor, renderer) {
|
|
73
|
-
if ((/SwiftShader/i.exec(vendor)) || (/SwiftShader/i.exec(renderer))) {
|
|
74
|
-
return 'cpu';
|
|
75
|
-
}
|
|
76
|
-
const gpuVendor = identifyGPUVendor(vendor, renderer);
|
|
77
|
-
switch (gpuVendor) {
|
|
78
|
-
case 'intel':
|
|
79
|
-
return 'integrated';
|
|
80
|
-
case 'software':
|
|
81
|
-
return 'cpu';
|
|
82
|
-
case 'unknown':
|
|
83
|
-
return 'unknown';
|
|
84
|
-
default:
|
|
85
|
-
return 'discrete';
|
|
86
|
-
}
|
|
87
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Stores luma.gl specific state associated with a context
|
|
3
|
-
*/
|
|
4
|
-
export interface WebGLContextData {
|
|
5
|
-
_polyfilled: boolean;
|
|
6
|
-
_extensions: Record<string, any>;
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* Gets luma.gl specific state from a context
|
|
10
|
-
* @returns context state
|
|
11
|
-
*/
|
|
12
|
-
export declare function getContextData(gl: WebGL2RenderingContext): WebGLContextData;
|
|
13
|
-
export declare function initializeExtensions(gl: WebGL2RenderingContext): void;
|
|
14
|
-
//# sourceMappingURL=context-data.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"context-data.d.ts","sourceRoot":"","sources":["../../../src/context/context/context-data.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,WAAW,EAAE,OAAO,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAClC;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,EAAE,EAAE,sBAAsB,GAAG,gBAAgB,CAc3E;AAED,wBAAgB,oBAAoB,CAAC,EAAE,EAAE,sBAAsB,GAAG,IAAI,CAYrE"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
// luma.gl, MIT license
|
|
2
|
-
// Copyright (c) vis.gl contributors
|
|
3
|
-
/**
|
|
4
|
-
* Gets luma.gl specific state from a context
|
|
5
|
-
* @returns context state
|
|
6
|
-
*/
|
|
7
|
-
export function getContextData(gl) {
|
|
8
|
-
// @ts-expect-error
|
|
9
|
-
const luma = gl.luma;
|
|
10
|
-
if (!luma) {
|
|
11
|
-
const contextState = {
|
|
12
|
-
_polyfilled: false,
|
|
13
|
-
_extensions: {}
|
|
14
|
-
};
|
|
15
|
-
// @ts-expect-error
|
|
16
|
-
gl.luma = contextState;
|
|
17
|
-
}
|
|
18
|
-
// @ts-expect-error
|
|
19
|
-
return gl.luma;
|
|
20
|
-
}
|
|
21
|
-
export function initializeExtensions(gl) {
|
|
22
|
-
const contextState = getContextData(gl);
|
|
23
|
-
// `getSupportedExtensions` can return null when context is lost.
|
|
24
|
-
const EXTENSIONS = gl.getSupportedExtensions() || [];
|
|
25
|
-
// Generates warnings in Chrome
|
|
26
|
-
const IGNORE_EXTENSIONS = ['WEBGL_polygon_mode'];
|
|
27
|
-
for (const extensionName of EXTENSIONS) {
|
|
28
|
-
if (!IGNORE_EXTENSIONS.includes(extensionName)) {
|
|
29
|
-
const extension = gl.getExtension(extensionName);
|
|
30
|
-
contextState._extensions[extensionName] = extension;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* ContextProps
|
|
3
|
-
* @param onContextLost
|
|
4
|
-
* @param onContextRestored
|
|
5
|
-
*
|
|
6
|
-
* BROWSER CONTEXT PARAMETERS
|
|
7
|
-
* @param debug Instrument context (at the expense of performance).
|
|
8
|
-
* @param alpha Default render target has an alpha buffer.
|
|
9
|
-
* @param depth Default render target has a depth buffer of at least 16 bits.
|
|
10
|
-
* @param stencil Default render target has a stencil buffer of at least 8 bits.
|
|
11
|
-
* @param antialias Boolean that indicates whether or not to perform anti-aliasing.
|
|
12
|
-
* @param premultipliedAlpha Boolean that indicates that the page compositor will assume the drawing buffer contains colors with pre-multiplied alpha.
|
|
13
|
-
* @param preserveDrawingBuffer Default render target buffers will not be automatically cleared and will preserve their values until cleared or overwritten
|
|
14
|
-
* @param failIfMajorPerformanceCaveat Do not create if the system performance is low.
|
|
15
|
-
*/
|
|
16
|
-
type ContextProps = {
|
|
17
|
-
onContextLost?: (event: Event) => void;
|
|
18
|
-
onContextRestored?: (event: Event) => void;
|
|
19
|
-
alpha?: boolean;
|
|
20
|
-
desynchronized?: boolean;
|
|
21
|
-
antialias?: boolean;
|
|
22
|
-
depth?: boolean;
|
|
23
|
-
failIfMajorPerformanceCaveat?: boolean;
|
|
24
|
-
powerPreference?: 'default' | 'high-performance' | 'low-power';
|
|
25
|
-
premultipliedAlpha?: boolean;
|
|
26
|
-
preserveDrawingBuffer?: boolean;
|
|
27
|
-
};
|
|
28
|
-
/**
|
|
29
|
-
* Create a WebGL context for a canvas
|
|
30
|
-
* Note calling this multiple time on the same canvas does return the same context
|
|
31
|
-
* @param canvas A canvas element or offscreen canvas
|
|
32
|
-
*/
|
|
33
|
-
export declare function createBrowserContext(canvas: HTMLCanvasElement | OffscreenCanvas, props: ContextProps): WebGL2RenderingContext;
|
|
34
|
-
export {};
|
|
35
|
-
//# sourceMappingURL=create-browser-context.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create-browser-context.d.ts","sourceRoot":"","sources":["../../../src/context/context/create-browser-context.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;GAcG;AACH,KAAK,YAAY,GAAG;IAClB,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IACvC,iBAAiB,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IAC3C,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,4BAA4B,CAAC,EAAE,OAAO,CAAC;IACvC,eAAe,CAAC,EAAE,SAAS,GAAG,kBAAkB,GAAG,WAAW,CAAC;IAC/D,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,qBAAqB,CAAC,EAAE,OAAO,CAAC;CACjC,CAAC;AAUF;;;;GAIG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,iBAAiB,GAAG,eAAe,EAC3C,KAAK,EAAE,YAAY,GAClB,sBAAsB,CA+CxB"}
|