@luma.gl/webgl 9.0.0-alpha.52 → 9.0.0-alpha.53
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/sampler-parameters.d.ts +2 -8
- package/dist/adapter/converters/sampler-parameters.d.ts.map +1 -1
- package/dist/adapter/converters/sampler-parameters.js +12 -107
- package/dist/adapter/converters/sampler-parameters.js.map +1 -1
- package/dist/adapter/device-helpers/get-device-info.d.ts.map +1 -1
- package/dist/adapter/device-helpers/get-device-info.js +21 -3
- package/dist/adapter/device-helpers/get-device-info.js.map +1 -1
- package/dist/adapter/resources/webgl-texture.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-texture.js +2 -3
- package/dist/adapter/resources/webgl-texture.js.map +1 -1
- package/dist/adapter/webgl-device.d.ts.map +1 -1
- package/dist/adapter/webgl-device.js +9 -7
- package/dist/adapter/webgl-device.js.map +1 -1
- package/dist/context/polyfill/polyfill-context.js +5 -2
- package/dist/context/polyfill/polyfill-context.js.map +1 -1
- package/dist/dist.dev.js +63 -40
- package/dist/index.cjs +148 -126
- package/dist.min.js +38 -38
- package/package.json +5 -5
- package/src/adapter/converters/sampler-parameters.ts +26 -151
- package/src/adapter/device-helpers/get-device-info.ts +24 -5
- package/src/adapter/resources/webgl-texture.ts +3 -4
- package/src/adapter/webgl-device.ts +13 -10
- package/src/context/polyfill/polyfill-context.ts +6 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@luma.gl/webgl",
|
|
3
|
-
"version": "9.0.0-alpha.
|
|
3
|
+
"version": "9.0.0-alpha.53",
|
|
4
4
|
"description": "WebGL2 adapter for the luma.gl API",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -44,12 +44,12 @@
|
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"@babel/runtime": "^7.0.0",
|
|
47
|
-
"@luma.gl/constants": "9.0.0-alpha.
|
|
48
|
-
"@luma.gl/core": "9.0.0-alpha.
|
|
47
|
+
"@luma.gl/constants": "9.0.0-alpha.53",
|
|
48
|
+
"@luma.gl/core": "9.0.0-alpha.53",
|
|
49
49
|
"@probe.gl/env": "^4.0.2"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"@luma.gl/test-utils": "9.0.0-alpha.
|
|
52
|
+
"@luma.gl/test-utils": "9.0.0-alpha.53"
|
|
53
53
|
},
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "f8939f1cf52a15f11ec053d4906e40f0b2a86836"
|
|
55
55
|
}
|
|
@@ -2,19 +2,17 @@
|
|
|
2
2
|
// Copyright (c) vis.gl contributors
|
|
3
3
|
|
|
4
4
|
// SAMPLER FILTERS
|
|
5
|
-
import {
|
|
5
|
+
import {SamplerProps} from '@luma.gl/core';
|
|
6
6
|
import {GL, GLSamplerParameters} from '@luma.gl/constants';
|
|
7
|
-
import {convertCompareFunction
|
|
8
|
-
|
|
9
|
-
/* eslint-disable consistent-return */
|
|
7
|
+
import {convertCompareFunction} from './device-parameters';
|
|
10
8
|
|
|
11
9
|
/**
|
|
12
10
|
* Convert WebGPU-style sampler props to WebGL
|
|
13
11
|
* @param props
|
|
14
12
|
* @returns
|
|
15
13
|
*/
|
|
16
|
-
export function convertSamplerParametersToWebGL(props:
|
|
17
|
-
const params:
|
|
14
|
+
export function convertSamplerParametersToWebGL(props: SamplerProps): GLSamplerParameters {
|
|
15
|
+
const params: GLSamplerParameters = {};
|
|
18
16
|
if (props.addressModeU) {
|
|
19
17
|
params[GL.TEXTURE_WRAP_S] = convertAddressMode(props.addressModeU);
|
|
20
18
|
}
|
|
@@ -54,8 +52,27 @@ export function convertSamplerParametersToWebGL(props: SamplerParameters): GLSam
|
|
|
54
52
|
return params;
|
|
55
53
|
}
|
|
56
54
|
|
|
55
|
+
/**
|
|
56
|
+
* Override sampler settings that are not supported by Non-Power-of-Two textures in WebGL1.
|
|
57
|
+
*/
|
|
58
|
+
export function updateSamplerParametersForNPOT(
|
|
59
|
+
parameters: GLSamplerParameters
|
|
60
|
+
): GLSamplerParameters {
|
|
61
|
+
const newParameters = {...parameters};
|
|
62
|
+
if (parameters[GL.TEXTURE_MIN_FILTER] !== GL.NEAREST) {
|
|
63
|
+
// log.warn(`texture: ${this} is Non-Power-Of-Two, forcing TEXTURE_MIN_FILTER to LINEAR`)();
|
|
64
|
+
newParameters[GL.TEXTURE_MIN_FILTER] = GL.LINEAR;
|
|
65
|
+
}
|
|
66
|
+
// log.warn(`texture: ${this} is Non-Power-Of-Two, forcing TEXTURE_WRAP_S to CLAMP_TO_EDGE`)();
|
|
67
|
+
newParameters[GL.TEXTURE_WRAP_S] = GL.CLAMP_TO_EDGE;
|
|
68
|
+
newParameters[GL.TEXTURE_WRAP_T] = GL.CLAMP_TO_EDGE;
|
|
69
|
+
return newParameters;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// HELPERS
|
|
73
|
+
|
|
57
74
|
/** Convert address more */
|
|
58
|
-
function convertAddressMode(addressMode: 'clamp-to-edge' | 'repeat' | 'mirror-repeat'): GL {
|
|
75
|
+
function convertAddressMode(addressMode: 'clamp-to-edge' | 'repeat' | 'mirror-repeat'): GL.CLAMP_TO_EDGE | GL.REPEAT | GL.MIRRORED_REPEAT {
|
|
59
76
|
switch (addressMode) {
|
|
60
77
|
case 'clamp-to-edge':
|
|
61
78
|
return GL.CLAMP_TO_EDGE;
|
|
@@ -66,7 +83,7 @@ function convertAddressMode(addressMode: 'clamp-to-edge' | 'repeat' | 'mirror-re
|
|
|
66
83
|
}
|
|
67
84
|
}
|
|
68
85
|
|
|
69
|
-
function convertMaxFilterMode(maxFilter: 'nearest' | 'linear'): GL {
|
|
86
|
+
function convertMaxFilterMode(maxFilter: 'nearest' | 'linear'): GL.NEAREST | GL.LINEAR {
|
|
70
87
|
switch (maxFilter) {
|
|
71
88
|
case 'nearest':
|
|
72
89
|
return GL.NEAREST;
|
|
@@ -82,7 +99,7 @@ function convertMaxFilterMode(maxFilter: 'nearest' | 'linear'): GL {
|
|
|
82
99
|
function convertMinFilterMode(
|
|
83
100
|
minFilter: 'nearest' | 'linear',
|
|
84
101
|
mipmapFilter?: 'nearest' | 'linear'
|
|
85
|
-
): GL {
|
|
102
|
+
): GL.NEAREST | GL.LINEAR | GL.NEAREST_MIPMAP_NEAREST | GL.LINEAR_MIPMAP_NEAREST | GL.NEAREST_MIPMAP_LINEAR | GL.LINEAR_MIPMAP_LINEAR {
|
|
86
103
|
if (!mipmapFilter) {
|
|
87
104
|
return convertMaxFilterMode(minFilter);
|
|
88
105
|
}
|
|
@@ -93,145 +110,3 @@ function convertMinFilterMode(
|
|
|
93
110
|
return mipmapFilter === 'nearest' ? GL.LINEAR_MIPMAP_NEAREST : GL.LINEAR_MIPMAP_LINEAR;
|
|
94
111
|
}
|
|
95
112
|
}
|
|
96
|
-
|
|
97
|
-
// Convert from WebGL to WebGPU
|
|
98
|
-
|
|
99
|
-
/**
|
|
100
|
-
* Convert WebGL-style sampler props to WebGPU
|
|
101
|
-
* @param props
|
|
102
|
-
* @returns
|
|
103
|
-
*/
|
|
104
|
-
export function convertToSamplerParameters(params: GLSamplerParameters): SamplerParameters {
|
|
105
|
-
const props: SamplerParameters = {};
|
|
106
|
-
if (params[GL.TEXTURE_WRAP_S]) {
|
|
107
|
-
props.addressModeU = convertToAddressMode(params[GL.TEXTURE_WRAP_S]);
|
|
108
|
-
}
|
|
109
|
-
if (params[GL.TEXTURE_WRAP_T]) {
|
|
110
|
-
props.addressModeV = convertToAddressMode(params[GL.TEXTURE_WRAP_T]);
|
|
111
|
-
}
|
|
112
|
-
if (params[GL.TEXTURE_WRAP_R]) {
|
|
113
|
-
props.addressModeW = convertToAddressMode(params[GL.TEXTURE_WRAP_R]);
|
|
114
|
-
}
|
|
115
|
-
if (params[GL.TEXTURE_MAG_FILTER]) {
|
|
116
|
-
props.magFilter = convertToMaxFilterMode(params[GL.TEXTURE_MAG_FILTER]);
|
|
117
|
-
}
|
|
118
|
-
if (params[GL.TEXTURE_MIN_FILTER]) {
|
|
119
|
-
props.minFilter = convertToMinFilterMode(params[GL.TEXTURE_MIN_FILTER]);
|
|
120
|
-
}
|
|
121
|
-
if (params[GL.TEXTURE_MIN_FILTER]) {
|
|
122
|
-
props.mipmapFilter = convertToMipmapFilterMode(params[GL.TEXTURE_MIN_FILTER]);
|
|
123
|
-
}
|
|
124
|
-
if (params[GL.TEXTURE_MIN_LOD]) {
|
|
125
|
-
props.lodMinClamp = params[GL.TEXTURE_MIN_LOD];
|
|
126
|
-
}
|
|
127
|
-
if (params[GL.TEXTURE_MAX_LOD]) {
|
|
128
|
-
props.lodMaxClamp = params[GL.TEXTURE_MAX_LOD];
|
|
129
|
-
}
|
|
130
|
-
if (params[GL.TEXTURE_COMPARE_MODE]) {
|
|
131
|
-
props.type =
|
|
132
|
-
params[GL.TEXTURE_COMPARE_MODE] === GL.COMPARE_REF_TO_TEXTURE
|
|
133
|
-
? 'comparison-sampler'
|
|
134
|
-
: 'color-sampler';
|
|
135
|
-
}
|
|
136
|
-
if (params[GL.TEXTURE_COMPARE_FUNC]) {
|
|
137
|
-
props.compare = convertToCompareFunction('compare', params[GL.TEXTURE_COMPARE_FUNC]);
|
|
138
|
-
}
|
|
139
|
-
// NOTE depends on extension (very common)
|
|
140
|
-
if (params[GL.TEXTURE_MAX_ANISOTROPY_EXT]) {
|
|
141
|
-
props.maxAnisotropy = params[GL.TEXTURE_MAX_ANISOTROPY_EXT];
|
|
142
|
-
}
|
|
143
|
-
return props;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
/** Convert address more */
|
|
147
|
-
function convertToAddressMode(
|
|
148
|
-
addressMode: GL.CLAMP_TO_EDGE | GL.REPEAT | GL.MIRRORED_REPEAT
|
|
149
|
-
): 'clamp-to-edge' | 'repeat' | 'mirror-repeat' {
|
|
150
|
-
switch (addressMode) {
|
|
151
|
-
case GL.CLAMP_TO_EDGE:
|
|
152
|
-
return 'clamp-to-edge';
|
|
153
|
-
case GL.REPEAT:
|
|
154
|
-
return 'repeat';
|
|
155
|
-
case GL.MIRRORED_REPEAT:
|
|
156
|
-
return 'mirror-repeat';
|
|
157
|
-
default:
|
|
158
|
-
throw new Error('address');
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
function convertToMaxFilterMode(filterMode: GL.NEAREST | GL.LINEAR): 'nearest' | 'linear' {
|
|
163
|
-
switch (filterMode) {
|
|
164
|
-
case GL.NEAREST:
|
|
165
|
-
return 'nearest';
|
|
166
|
-
case GL.LINEAR:
|
|
167
|
-
return 'linear';
|
|
168
|
-
default:
|
|
169
|
-
throw new Error('maxfilter');
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
type GLMinFilter =
|
|
174
|
-
| GL.NEAREST
|
|
175
|
-
| GL.LINEAR
|
|
176
|
-
| GL.NEAREST_MIPMAP_NEAREST
|
|
177
|
-
| GL.LINEAR_MIPMAP_NEAREST
|
|
178
|
-
| GL.NEAREST_MIPMAP_LINEAR
|
|
179
|
-
| GL.LINEAR_MIPMAP_LINEAR;
|
|
180
|
-
|
|
181
|
-
/** WebGPU has separate min filter and mipmap filter, WebGL is combined */
|
|
182
|
-
function convertToMinFilterMode(filterMode: GLMinFilter): 'nearest' | 'linear' {
|
|
183
|
-
switch (filterMode) {
|
|
184
|
-
// TODO is this correct?
|
|
185
|
-
case GL.NEAREST:
|
|
186
|
-
return 'nearest';
|
|
187
|
-
case GL.LINEAR:
|
|
188
|
-
return 'linear';
|
|
189
|
-
case GL.NEAREST_MIPMAP_NEAREST:
|
|
190
|
-
return 'nearest';
|
|
191
|
-
case GL.LINEAR_MIPMAP_NEAREST:
|
|
192
|
-
return 'linear';
|
|
193
|
-
case GL.NEAREST_MIPMAP_LINEAR:
|
|
194
|
-
return 'nearest';
|
|
195
|
-
case GL.LINEAR_MIPMAP_LINEAR:
|
|
196
|
-
return 'linear';
|
|
197
|
-
default:
|
|
198
|
-
throw new Error('minfilter');
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
function convertToMipmapFilterMode(filterMode: GLMinFilter): 'nearest' | 'linear' {
|
|
203
|
-
switch (filterMode) {
|
|
204
|
-
// TODO is this correct?
|
|
205
|
-
case GL.NEAREST:
|
|
206
|
-
return 'nearest';
|
|
207
|
-
case GL.LINEAR:
|
|
208
|
-
return 'linear';
|
|
209
|
-
case GL.NEAREST_MIPMAP_NEAREST:
|
|
210
|
-
return 'nearest';
|
|
211
|
-
case GL.LINEAR_MIPMAP_NEAREST:
|
|
212
|
-
return 'nearest';
|
|
213
|
-
case GL.NEAREST_MIPMAP_LINEAR:
|
|
214
|
-
return 'linear';
|
|
215
|
-
case GL.LINEAR_MIPMAP_LINEAR:
|
|
216
|
-
return 'linear';
|
|
217
|
-
default:
|
|
218
|
-
throw new Error('mipmap');
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
/**
|
|
223
|
-
* Override sampler settings that are not supported by Non-Power-of-Two textures in WebGL1.
|
|
224
|
-
*/
|
|
225
|
-
export function updateSamplerParametersForNPOT(
|
|
226
|
-
parameters: GLSamplerParameters
|
|
227
|
-
): GLSamplerParameters {
|
|
228
|
-
const newParameters = {...parameters};
|
|
229
|
-
if (parameters[GL.TEXTURE_MIN_FILTER] !== GL.NEAREST) {
|
|
230
|
-
// log.warn(`texture: ${this} is Non-Power-Of-Two, forcing TEXTURE_MIN_FILTER to LINEAR`)();
|
|
231
|
-
newParameters[GL.TEXTURE_MIN_FILTER] = GL.LINEAR;
|
|
232
|
-
}
|
|
233
|
-
// log.warn(`texture: ${this} is Non-Power-Of-Two, forcing TEXTURE_WRAP_S to CLAMP_TO_EDGE`)();
|
|
234
|
-
newParameters[GL.TEXTURE_WRAP_S] = GL.CLAMP_TO_EDGE;
|
|
235
|
-
newParameters[GL.TEXTURE_WRAP_T] = GL.CLAMP_TO_EDGE;
|
|
236
|
-
return newParameters;
|
|
237
|
-
}
|
|
@@ -25,6 +25,7 @@ export function getDeviceInfo(gl: WebGLRenderingContext): DeviceInfo {
|
|
|
25
25
|
// "Sniff" the GPU type and backend from the info. This works best if unmasked info is available.
|
|
26
26
|
const gpu = identifyGPUVendor(vendor, renderer);
|
|
27
27
|
const gpuBackend = identifyGPUBackend(vendor, renderer);
|
|
28
|
+
const gpuType = identifyGPUType(vendor, renderer);
|
|
28
29
|
|
|
29
30
|
// Determine GLSL version
|
|
30
31
|
// For now, skip parsing of the long version string, just use context type below to deduce version
|
|
@@ -36,6 +37,7 @@ export function getDeviceInfo(gl: WebGLRenderingContext): DeviceInfo {
|
|
|
36
37
|
return {
|
|
37
38
|
type: isWebGL2(gl) ? 'webgl2' : 'webgl',
|
|
38
39
|
gpu,
|
|
40
|
+
gpuType,
|
|
39
41
|
gpuBackend,
|
|
40
42
|
vendor,
|
|
41
43
|
renderer,
|
|
@@ -72,13 +74,30 @@ function identifyGPUVendor(vendor: string, renderer: string): 'nvidia' | 'intel'
|
|
|
72
74
|
}
|
|
73
75
|
|
|
74
76
|
/** "Sniff" the GPU backend from the info. This works best if unmasked info is available. */
|
|
75
|
-
function identifyGPUBackend(vendor: string, renderer: string): '
|
|
76
|
-
if ((/ANGLE/i.exec(vendor)) || (/ANGLE/i.exec(renderer))) {
|
|
77
|
-
return 'angle';
|
|
78
|
-
}
|
|
77
|
+
function identifyGPUBackend(vendor: string, renderer: string): 'opengl' | 'metal' | 'unknown' {
|
|
79
78
|
if ((/Metal/i.exec(vendor)) || (/Metal/i.exec(renderer))) {
|
|
80
79
|
return 'metal';
|
|
81
80
|
}
|
|
82
|
-
|
|
81
|
+
if ((/ANGLE/i.exec(vendor)) || (/ANGLE/i.exec(renderer))) {
|
|
82
|
+
return 'opengl';
|
|
83
|
+
}
|
|
83
84
|
return 'unknown';
|
|
84
85
|
}
|
|
86
|
+
|
|
87
|
+
function identifyGPUType(vendor: string, renderer: string): 'discrete' | 'integrated' | 'cpu' | 'unknown' {
|
|
88
|
+
if ((/SwiftShader/i.exec(vendor)) || (/SwiftShader/i.exec(renderer))) {
|
|
89
|
+
return 'cpu';
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
const gpuVendor = identifyGPUVendor(vendor, renderer);
|
|
93
|
+
switch (gpuVendor) {
|
|
94
|
+
case 'intel':
|
|
95
|
+
return 'integrated';
|
|
96
|
+
case 'software':
|
|
97
|
+
return 'cpu';
|
|
98
|
+
case 'unknown':
|
|
99
|
+
return 'unknown';
|
|
100
|
+
default:
|
|
101
|
+
return 'discrete';
|
|
102
|
+
}
|
|
103
|
+
}
|
|
@@ -12,10 +12,9 @@ import {
|
|
|
12
12
|
Sampler,
|
|
13
13
|
SamplerProps,
|
|
14
14
|
SamplerParameters,
|
|
15
|
-
TypedArray
|
|
16
|
-
isObjectEmpty
|
|
15
|
+
TypedArray
|
|
17
16
|
} from '@luma.gl/core';
|
|
18
|
-
import {Texture,
|
|
17
|
+
import {Texture, log, assert, isPowerOfTwo, loadImage, isObjectEmpty} from '@luma.gl/core';
|
|
19
18
|
import {GL, GLSamplerParameters} from '@luma.gl/constants';
|
|
20
19
|
import {withGLParameters} from '../../context/state-tracker/with-parameters';
|
|
21
20
|
import {
|
|
@@ -193,7 +192,7 @@ export class WEBGLTexture extends Texture<WEBGLTextureProps> {
|
|
|
193
192
|
constructor(device: Device, props: WEBGLTextureProps) {
|
|
194
193
|
super(device, {...DEFAULT_WEBGL_TEXTURE_PROPS, format: 'rgba8unorm', ...props});
|
|
195
194
|
|
|
196
|
-
this.device =
|
|
195
|
+
this.device = device as WebGLDevice;
|
|
197
196
|
this.gl = this.device.gl;
|
|
198
197
|
this.gl2 = this.device.gl2;
|
|
199
198
|
this.handle = this.props.handle || this.gl.createTexture();
|
|
@@ -132,7 +132,7 @@ export class WebGLDevice extends Device {
|
|
|
132
132
|
}
|
|
133
133
|
|
|
134
134
|
static async create(props: DeviceProps = {}): Promise<WebGLDevice> {
|
|
135
|
-
log.groupCollapsed(LOG_LEVEL, 'WebGLDevice created');
|
|
135
|
+
log.groupCollapsed(LOG_LEVEL, 'WebGLDevice created')();
|
|
136
136
|
|
|
137
137
|
// Wait for page to load. Only wait when props. canvas is string
|
|
138
138
|
// to avoid setting page onload callback unless necessary
|
|
@@ -158,7 +158,18 @@ export class WebGLDevice extends Device {
|
|
|
158
158
|
return WebGLDevice.attach(props.gl);
|
|
159
159
|
}
|
|
160
160
|
|
|
161
|
-
|
|
161
|
+
const device = new WebGLDevice(props);
|
|
162
|
+
|
|
163
|
+
// Log some debug info about the newly created context
|
|
164
|
+
const message = `\
|
|
165
|
+
Created ${device.info.type}${device.debug ? ' debug' : ''} context: \
|
|
166
|
+
${device.info.vendor}, ${device.info.renderer} for canvas: ${device.canvasContext.id}`;
|
|
167
|
+
log.probe(LOG_LEVEL, message)();
|
|
168
|
+
log.table(LOG_LEVEL, device.info)();
|
|
169
|
+
|
|
170
|
+
log.groupEnd(LOG_LEVEL)();
|
|
171
|
+
|
|
172
|
+
return device;
|
|
162
173
|
}
|
|
163
174
|
|
|
164
175
|
//
|
|
@@ -240,14 +251,6 @@ export class WebGLDevice extends Device {
|
|
|
240
251
|
const canvas = this.handle.canvas || (props.canvas as HTMLCanvasElement);
|
|
241
252
|
this.spector = initializeSpectorJS({...this.props, canvas});
|
|
242
253
|
}
|
|
243
|
-
|
|
244
|
-
// Log some debug info about the newly created context
|
|
245
|
-
const message = `\
|
|
246
|
-
Created ${this.info.type}${this.debug ? ' debug' : ''} context: \
|
|
247
|
-
${this.info.vendor}, ${this.info.renderer} for canvas: ${this.canvasContext.id}`;
|
|
248
|
-
log.probe(LOG_LEVEL, message)();
|
|
249
|
-
|
|
250
|
-
log.groupEnd(LOG_LEVEL)();
|
|
251
254
|
}
|
|
252
255
|
|
|
253
256
|
/**
|
|
@@ -38,9 +38,13 @@ function initializeExtensions(gl: WebGLRenderingContext): void {
|
|
|
38
38
|
const contextState = getContextData(gl);
|
|
39
39
|
// `getSupportedExtensions` can return null when context is lost.
|
|
40
40
|
const EXTENSIONS = gl.getSupportedExtensions() || [];
|
|
41
|
+
// Generates warnings in Chrome
|
|
42
|
+
const IGNORE_EXTENSIONS = ['WEBGL_polygon_mode'];
|
|
41
43
|
for (const extensionName of EXTENSIONS) {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
+
if (!IGNORE_EXTENSIONS.includes(extensionName)) {
|
|
45
|
+
const extension = gl.getExtension(extensionName);
|
|
46
|
+
contextState._extensions[extensionName] = extension;
|
|
47
|
+
}
|
|
44
48
|
}
|
|
45
49
|
}
|
|
46
50
|
|