-
Notifications
You must be signed in to change notification settings - Fork 205
/
texture.js
748 lines (655 loc) · 22.3 KB
/
texture.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
import GL from '@luma.gl/constants';
import Resource from './resource';
import Buffer from './buffer';
import {
TEXTURE_FORMATS,
DATA_FORMAT_CHANNELS,
TYPE_SIZES,
isFormatSupported,
isLinearFilteringSupported
} from './texture-formats';
import {withParameters} from '../context';
import {isWebGL2, assertWebGL2Context, WebGLBuffer} from '../webgl-utils';
import {log, uid, isPowerOfTwo, assert} from '../utils';
// Supported min filters for NPOT texture.
const NPOT_MIN_FILTERS = [GL.LINEAR, GL.NEAREST];
export default class Texture extends Resource {
static isSupported(gl, {format, linearFiltering} = {}) {
let supported = true;
if (format) {
supported = supported && isFormatSupported(gl, format);
supported = supported && (!linearFiltering || isLinearFilteringSupported(gl, format));
}
return supported;
}
// target cannot be modified by bind:
// textures are special because when you first bind them to a target,
// they get special information. When you first bind a texture as a
// GL_TEXTURE_2D, you are actually setting special state in the texture.
// You are saying that this texture is a 2D texture.
// And it will always be a 2D texture; this state cannot be changed ever.
// If you have a texture that was first bound as a GL_TEXTURE_2D,
// you must always bind it as a GL_TEXTURE_2D;
// attempting to bind it as GL_TEXTURE_1D will give rise to an error
// (while run-time).
constructor(gl, props) {
const {
id = uid('texture'),
handle,
target
// , magFilter, minFilter, wrapS, wrapT
} = props;
super(gl, {id, handle});
this.target = target;
this.hasFloatTexture = gl.getExtension('OES_texture_float');
this.textureUnit = undefined;
// Program.draw() checks the loaded flag of all textures to avoid
// Textures that are still loading from promises
// Set to true as soon as texture has been initialized with valid data
this.loaded = false;
this.width = undefined;
this.height = undefined;
this.depth = undefined;
this.format = undefined;
this.type = undefined;
this.dataFormat = undefined;
this.border = undefined;
this.textureUnit = undefined;
this.mipmaps = undefined;
}
toString() {
return `Texture(${this.id},${this.width}x${this.height})`;
}
/* eslint-disable max-len, max-statements */
initialize(props = {}) {
let data = props.data;
if (data instanceof Promise) {
data.then(resolvedImageData =>
this.initialize(
Object.assign({}, props, {
pixels: resolvedImageData,
data: resolvedImageData
})
)
);
return this;
}
const {
pixels = null,
format = GL.RGBA,
type = GL.UNSIGNED_BYTE,
border = 0,
recreate = false,
parameters = {},
pixelStore = {},
textureUnit = undefined,
// Deprecated parameters
unpackFlipY = true
} = props;
let {mipmaps = true} = props;
// pixels variable is for API compatibility purpose
if (!data) {
// TODO - This looks backwards? Commenting out for now until we decide
// which prop to use
// log.deprecated('data', 'pixels')();
data = pixels;
}
let {width, height, dataFormat} = props;
const {depth = 0} = props;
// Deduce width and height
({width, height, dataFormat} = this._deduceParameters({
format,
type,
dataFormat,
compressed: false,
data,
width,
height
}));
// Store opts for accessors
this.width = width;
this.height = height;
this.depth = depth;
this.format = format;
this.type = type;
this.dataFormat = dataFormat;
this.border = border;
this.textureUnit = textureUnit;
if (Number.isFinite(this.textureUnit)) {
this.gl.activeTexture(GL.TEXTURE0 + this.textureUnit);
this.gl.bindTexture(this.target, this.handle);
}
// Note: luma.gl defaults to GL.UNPACK_FLIP_Y_WEBGL = true;
// TODO - compare v4 and v3
const DEFAULT_TEXTURE_SETTINGS = {
// Pixel store
[GL.UNPACK_FLIP_Y_WEBGL]: unpackFlipY
};
const glSettings = Object.assign({}, DEFAULT_TEXTURE_SETTINGS, pixelStore);
if (mipmaps && this._isNPOT()) {
log.warn(`texture: ${this} is Non-Power-Of-Two, disabling mipmaping`)();
mipmaps = false;
this._updateForNPOT(parameters);
}
this.mipmaps = mipmaps;
this.setImageData({
data,
width,
height,
depth,
format,
type,
dataFormat,
border,
mipmaps,
parameters: glSettings
});
if (mipmaps) {
this.generateMipmap();
}
// Set texture sampler parameters
this.setParameters(parameters);
// TODO - Store data to enable auto recreate on context loss
if (recreate) {
this.data = data;
}
return this;
}
// If size has changed, reinitializes with current format
// note clears image and mipmaps
resize({width, height}) {
if (width !== this.width || height !== this.height) {
return this.initialize({
width,
height,
format: this.format,
type: this.type,
dataFormat: this.dataFormat,
border: this.border,
mipmaps: false
});
}
return this;
}
// Call to regenerate mipmaps after modifying texture(s)
generateMipmap(params = {}) {
this.gl.bindTexture(this.target, this.handle);
withParameters(this.gl, params, () => {
this.gl.generateMipmap(this.target);
});
this.gl.bindTexture(this.target, null);
return this;
}
/*
* Allocates storage
* @param {*} pixels -
* null - create empty texture of specified format
* Typed array - init from image data in typed array
* Buffer|WebGLBuffer - (WEBGL2) init from image data in WebGLBuffer
* HTMLImageElement|Image - Inits with content of image. Auto width/height
* HTMLCanvasElement - Inits with contents of canvas. Auto width/height
* HTMLVideoElement - Creates video texture. Auto width/height
*
* @param {GLint} width -
* @param {GLint} height -
* @param {GLint} mipMapLevel -
* @param {GLenum} format - format of image data.
* @param {GLenum} type
* - format of array (autodetect from type) or
* - (WEBGL2) format of buffer
* @param {Number} offset - (WEBGL2) offset from start of buffer
* @param {GLint} border - must be 0.
* @parameters - temporary settings to be applied, can be used to supply pixel store settings.
*/
/* eslint-disable max-len, max-statements, complexity */
setImageData(options) {
this._trackDeallocatedMemory('Texture');
const {
target = this.target,
pixels = null,
level = 0,
format = this.format,
border = this.border,
offset = 0,
parameters = {}
} = options;
let {
data = null,
type = this.type,
width = this.width,
height = this.height,
dataFormat = this.dataFormat,
compressed = false
} = options;
// pixels variable is for API compatibility purpose
if (!data) {
data = pixels;
}
({type, dataFormat, compressed, width, height} = this._deduceParameters({
format,
type,
dataFormat,
compressed,
data,
width,
height
}));
const {gl} = this;
gl.bindTexture(this.target, this.handle);
let dataType = null;
({data, dataType} = this._getDataType({data, compressed}));
withParameters(this.gl, parameters, () => {
switch (dataType) {
case 'null':
gl.texImage2D(target, level, format, width, height, border, dataFormat, type, data);
break;
case 'typed-array':
// Looks like this assert is not necessary, as offset is ignored under WebGL1
// assert((offset === 0 || isWebGL2(gl)), 'offset supported in WebGL2 only');
gl.texImage2D(
target,
level,
format,
width,
height,
border,
dataFormat,
type,
data,
offset
);
break;
case 'buffer':
// WebGL2 enables creating textures directly from a WebGL buffer
assertWebGL2Context(gl);
gl.bindBuffer(GL.PIXEL_UNPACK_BUFFER, data.handle || data);
gl.texImage2D(target, level, format, width, height, border, dataFormat, type, offset);
gl.bindBuffer(GL.PIXEL_UNPACK_BUFFER, null);
break;
case 'browser-object':
if (isWebGL2(gl)) {
gl.texImage2D(target, level, format, width, height, border, dataFormat, type, data);
} else {
gl.texImage2D(target, level, format, dataFormat, type, data);
}
break;
case 'compressed':
gl.compressedTexImage2D(target, level, format, width, height, border, data);
break;
default:
assert(false, 'Unknown image data type');
}
});
if (data && data.byteLength) {
this._trackAllocatedMemory(data.byteLength, 'Texture');
} else {
// NOTE(Tarek): Default to RGBA bytes
const channels = DATA_FORMAT_CHANNELS[this.dataFormat] || 4;
const channelSize = TYPE_SIZES[this.type] || 1;
this._trackAllocatedMemory(this.width * this.height * channels * channelSize, 'Texture');
}
this.loaded = true;
return this;
}
/* eslint-enable max-len, max-statements, complexity */
/**
* Redefines an area of an existing texture
* Note: does not allocate storage
*/
/*
* Redefines an area of an existing texture
* @param {*} pixels, data -
* null - create empty texture of specified format
* Typed array - init from image data in typed array
* Buffer|WebGLBuffer - (WEBGL2) init from image data in WebGLBuffer
* HTMLImageElement|Image - Inits with content of image. Auto width/height
* HTMLCanvasElement - Inits with contents of canvas. Auto width/height
* HTMLVideoElement - Creates video texture. Auto width/height
*
* @param {GLint} x - xOffset from where texture to be updated
* @param {GLint} y - yOffset from where texture to be updated
* @param {GLint} width - width of the sub image to be updated
* @param {GLint} height - height of the sub image to be updated
* @param {GLint} level - mip level to be updated
* @param {GLenum} format - internal format of image data.
* @param {GLenum} type
* - format of array (autodetect from type) or
* - (WEBGL2) format of buffer or ArrayBufferView
* @param {GLenum} dataFormat - format of image data.
* @param {Number} offset - (WEBGL2) offset from start of buffer
* @param {GLint} border - must be 0.
* @parameters - temporary settings to be applied, can be used to supply pixel store settings.
*/
setSubImageData({
target = this.target,
pixels = null,
data = null,
x = 0,
y = 0,
width = this.width,
height = this.height,
level = 0,
format = this.format,
type = this.type,
dataFormat = this.dataFormat,
compressed = false,
offset = 0,
border = this.border,
parameters = {}
}) {
({type, dataFormat, compressed, width, height} = this._deduceParameters({
format,
type,
dataFormat,
compressed,
data,
width,
height
}));
assert(this.depth === 0, 'texSubImage not supported for 3D textures');
// pixels variable is for API compatibility purpose
if (!data) {
data = pixels;
}
// Support ndarrays
if (data && data.data) {
const ndarray = data;
data = ndarray.data;
width = ndarray.shape[0];
height = ndarray.shape[1];
}
// Support buffers
if (data instanceof Buffer) {
data = data.handle;
}
this.gl.bindTexture(this.target, this.handle);
withParameters(this.gl, parameters, () => {
// TODO - x,y parameters
if (compressed) {
this.gl.compressedTexSubImage2D(target, level, x, y, width, height, format, data);
} else if (data === null) {
this.gl.texSubImage2D(target, level, x, y, width, height, dataFormat, type, null);
} else if (ArrayBuffer.isView(data)) {
this.gl.texSubImage2D(target, level, x, y, width, height, dataFormat, type, data, offset);
} else if (data instanceof WebGLBuffer) {
// WebGL2 allows us to create texture directly from a WebGL buffer
assertWebGL2Context(this.gl);
// This texImage2D signature uses currently bound GL.PIXEL_UNPACK_BUFFER
this.gl.bindBuffer(GL.PIXEL_UNPACK_BUFFER, data);
this.gl.texSubImage2D(target, level, x, y, width, height, dataFormat, type, offset);
this.gl.bindBuffer(GL.PIXEL_UNPACK_BUFFER, null);
} else if (isWebGL2(this.gl)) {
// Assume data is a browser supported object (ImageData, Canvas, ...)
this.gl.texSubImage2D(target, level, x, y, width, height, dataFormat, type, data);
} else {
this.gl.texSubImage2D(target, level, x, y, dataFormat, type, data);
}
});
this.gl.bindTexture(this.target, null);
}
/* eslint-enable max-len, max-statements, complexity */
/**
* Defines a two-dimensional texture image or cube-map texture image with
* pixels from the current framebuffer (rather than from client memory).
* (gl.copyTexImage2D wrapper)
*
* Note that binding a texture into a Framebuffer's color buffer and
* rendering can be faster.
*/
copyFramebuffer(opts = {}) {
log.error(
'Texture.copyFramebuffer({...}) is no logner supported, use copyToTexture(source, target, opts})'
)();
return null;
}
getActiveUnit() {
return this.gl.getParameter(GL.ACTIVE_TEXTURE) - GL.TEXTURE0;
}
// target cannot be modified by bind:
// textures are special because when you first bind them to a target,
// they get special information. When you first bind a texture as a
// GL_TEXTURE_2D, you are actually setting special state in the texture.
// You are saying that this texture is a 2D texture.
// And it will always be a 2D texture; this state cannot be changed ever.
// If you have a texture that was first bound as a GL_TEXTURE_2D,
// you must always bind it as a GL_TEXTURE_2D;
// attempting to bind it as GL_TEXTURE_1D will give rise to an error
// (while run-time).
bind(textureUnit = this.textureUnit) {
const {gl} = this;
if (textureUnit !== undefined) {
this.textureUnit = textureUnit;
gl.activeTexture(gl.TEXTURE0 + textureUnit);
}
gl.bindTexture(this.target, this.handle);
return textureUnit;
}
unbind(textureUnit = this.textureUnit) {
const {gl} = this;
if (textureUnit !== undefined) {
this.textureUnit = textureUnit;
gl.activeTexture(gl.TEXTURE0 + textureUnit);
}
gl.bindTexture(this.target, null);
return textureUnit;
}
// PRIVATE METHODS
_getDataType({data, compressed = false}) {
if (compressed) {
return {data, dataType: 'compressed'};
}
if (data === null) {
return {data, dataType: 'null'};
}
if (ArrayBuffer.isView(data)) {
return {data, dataType: 'typed-array'};
}
if (data instanceof Buffer) {
return {data: data.handle, dataType: 'buffer'};
}
if (data instanceof WebGLBuffer) {
return {data, dataType: 'buffer'};
}
// Assume data is a browser supported object (ImageData, Canvas, ...)
return {data, dataType: 'browser-object'};
}
/* Copied from texture-2d.js
// WebGL2
setPixels(opts = {}) {
const {
buffer,
width = null,
height = null,
mipmapLevel = 0,
format = GL.RGBA,
type = GL.UNSIGNED_BYTE,
border = 0
} = opts;
const {gl} = this;
// This signature of texImage2D uses currently bound GL.PIXEL_UNPACK_BUFFER
gl.bindBuffer(GL.PIXEL_UNPACK_BUFFER, buffer.target);
// And as always, we must also bind the texture itself
this.bind();
gl.texImage2D(gl.TEXTURE_2D,
mipmapLevel, format, width, height, border, format, type, buffer.target);
this.unbind();
gl.bindBuffer(GL.GL.PIXEL_UNPACK_BUFFER, null);
return this;
}
setImageDataFromCompressedBuffer(opts) {
const {
buffer,
// offset = 0,
width = null,
height = null,
mipmapLevel = 0,
internalFormat = GL.RGBA,
// format = GL.RGBA,
// type = GL.UNSIGNED_BYTE,
border = 0
} = opts;
const {gl} = this;
gl.compressedTexImage2D(this.target,
mipmapLevel, internalFormat, width, height, border, buffer);
// gl.compressedTexSubImage2D(target,
// level, xoffset, yoffset, width, height, format, ArrayBufferView? pixels);
return this;
}
copySubImage(opts) {
const {
// pixels,
// offset = 0,
// x,
// y,
// width,
// height,
// mipmapLevel = 0,
// internalFormat = GL.RGBA,
// type = GL.UNSIGNED_BYTE,
// border = 0
} = opts;
// if (pixels instanceof ArrayBufferView) {
// gl.texSubImage2D(target, level, x, y, width, height, format, type, pixels);
// }
// gl.texSubImage2D(target, level, x, y, format, type, ? pixels);
// gl.texSubImage2D(target, level, x, y, format, type, HTMLImageElement pixels);
// gl.texSubImage2D(target, level, x, y, format, type, HTMLCanvasElement pixels);
// gl.texSubImage2D(target, level, x, y, format, type, HTMLVideoElement pixels);
// // Additional signature in a WebGL 2 context:
// gl.texSubImage2D(target, level, x, y, format, type, GLintptr offset);
}
*/
// HELPER METHODS
_deduceParameters(opts) {
const {format, data} = opts;
let {width, height, dataFormat, type, compressed} = opts;
// Deduce format and type from format
const textureFormat = TEXTURE_FORMATS[format];
dataFormat = dataFormat || (textureFormat && textureFormat.dataFormat);
type = type || (textureFormat && textureFormat.types[0]);
// Deduce compression from format
compressed = compressed || (textureFormat && textureFormat.compressed);
({width, height} = this._deduceImageSize(data, width, height));
return {dataFormat, type, compressed, width, height, format, data};
}
/* global ImageData, HTMLImageElement, HTMLCanvasElement, HTMLVideoElement */
// eslint-disable-next-line complexity
_deduceImageSize(data, width, height) {
let size;
if (typeof ImageData !== 'undefined' && data instanceof ImageData) {
size = {width: data.width, height: data.height};
} else if (typeof HTMLImageElement !== 'undefined' && data instanceof HTMLImageElement) {
size = {width: data.naturalWidth, height: data.naturalHeight};
} else if (typeof HTMLCanvasElement !== 'undefined' && data instanceof HTMLCanvasElement) {
size = {width: data.width, height: data.height};
} else if (typeof HTMLVideoElement !== 'undefined' && data instanceof HTMLVideoElement) {
size = {width: data.videoWidth, height: data.videoHeight};
} else if (!data) {
size = {width: width >= 0 ? width : 1, height: height >= 0 ? height : 1};
} else {
size = {width, height};
}
assert(size, 'Could not deduced texture size');
assert(
width === undefined || size.width === width,
'Deduced texture width does not match supplied width'
);
assert(
height === undefined || size.height === height,
'Deduced texture height does not match supplied height'
);
return size;
}
// RESOURCE METHODS
_createHandle() {
return this.gl.createTexture();
}
_deleteHandle() {
this.gl.deleteTexture(this.handle);
this._trackDeallocatedMemory('Texture');
}
_getParameter(pname) {
switch (pname) {
case GL.TEXTURE_WIDTH:
return this.width;
case GL.TEXTURE_HEIGHT:
return this.height;
default:
this.gl.bindTexture(this.target, this.handle);
const value = this.gl.getTexParameter(this.target, pname);
this.gl.bindTexture(this.target, null);
return value;
}
}
_setParameter(pname, param) {
this.gl.bindTexture(this.target, this.handle);
// NOTE: Apply NPOT workaround
param = this._getNPOTParam(pname, param);
// Apparently there are some integer/float conversion rules that made
// the WebGL committe expose two parameter setting functions in JavaScript.
// For now, pick the float version for parameters specified as GLfloat.
switch (pname) {
case GL.TEXTURE_MIN_LOD:
case GL.TEXTURE_MAX_LOD:
this.gl.texParameterf(this.handle, pname, param);
break;
case GL.TEXTURE_WIDTH:
case GL.TEXTURE_HEIGHT:
assert(false);
break;
default:
this.gl.texParameteri(this.target, pname, param);
break;
}
this.gl.bindTexture(this.target, null);
return this;
}
_isNPOT() {
if (isWebGL2(this.gl)) {
// NPOT restriction is only for WebGL1
return false;
}
// Width and height not available, consider it is not NPOT texture
if (!this.width || !this.height) {
return false;
}
return !isPowerOfTwo(this.width) || !isPowerOfTwo(this.height);
}
// Update default settings which are not supported by NPOT textures.
_updateForNPOT(parameters) {
if (parameters[this.gl.TEXTURE_MIN_FILTER] === undefined) {
// log.warn(`texture: ${this} is Non-Power-Of-Two, forcing TEXTURE_MIN_FILTER to LINEAR`)();
parameters[this.gl.TEXTURE_MIN_FILTER] = this.gl.LINEAR;
}
if (parameters[this.gl.TEXTURE_WRAP_S] === undefined) {
// log.warn(`texture: ${this} is Non-Power-Of-Two, forcing TEXTURE_WRAP_S to CLAMP_TO_EDGE`)();
parameters[this.gl.TEXTURE_WRAP_S] = this.gl.CLAMP_TO_EDGE;
}
if (parameters[this.gl.TEXTURE_WRAP_T] === undefined) {
// log.warn(`texture: ${this} is Non-Power-Of-Two, forcing TEXTURE_WRAP_T to CLAMP_TO_EDGE`)();
parameters[this.gl.TEXTURE_WRAP_T] = this.gl.CLAMP_TO_EDGE;
}
}
_getNPOTParam(pname, param) {
if (this._isNPOT()) {
switch (pname) {
case GL.TEXTURE_MIN_FILTER:
if (NPOT_MIN_FILTERS.indexOf(param) === -1) {
// log.warn(`texture: ${this} is Non-Power-Of-Two, forcing TEXTURE_MIN_FILTER to LINEAR`)();
param = GL.LINEAR;
}
break;
case GL.TEXTURE_WRAP_S:
case GL.TEXTURE_WRAP_T:
if (param !== GL.CLAMP_TO_EDGE) {
// log.warn(`texture: ${this} is Non-Power-Of-Two, ${getKey(this.gl, pname)} to CLAMP_TO_EDGE`)();
param = GL.CLAMP_TO_EDGE;
}
break;
default:
break;
}
}
return param;
}
}