@@ -4172,18 +4172,18 @@ var LibraryGL = {
4172
4172
glFrontFace__sig : 'vi' ,
4173
4173
} ;
4174
4174
4175
- // Simple pass-through functions. Starred ones have return values. [X] ones have X in the C name but not in the JS name
4176
- var glFuncs = [ [ 0 , 'finish flush' ] ,
4177
- [ 1 , 'clearDepth clearDepth[f] depthFunc enable disable frontFace cullFace clear lineWidth clearStencil stencilMask checkFramebufferStatus* generateMipmap activeTexture blendEquation isEnabled*' ] ,
4178
- [ 2 , 'blendFunc blendEquationSeparate depthRange depthRange[f] stencilMaskSeparate hint polygonOffset vertexAttrib1f' ] ,
4179
- [ 3 , 'texParameteri texParameterf vertexAttrib2f stencilFunc stencilOp ' ] ,
4180
- [ 4 , 'viewport clearColor scissor vertexAttrib3f renderbufferStorage blendFuncSeparate blendColor stencilFuncSeparate stencilOpSeparate ' ] ,
4181
- [ 5 , 'vertexAttrib4f ' ] ,
4182
- [ 6 , '' ] ,
4183
- [ 7 , '' ] ,
4184
- [ 8 , 'copyTexImage2D copyTexSubImage2D ' ] ,
4185
- [ 9 , '' ] ,
4186
- [ 10 , '' ] ] ;
4175
+ // Simple pass-through functions.
4176
+ // - Starred ones have return values.
4177
+ // - [X] ones have X in the C name but not in the JS name
4178
+ var glPassthroughFuncs = [
4179
+ [ 0 , 'finish flush ' ] ,
4180
+ [ 1 , 'clearDepth clearDepth[f] depthFunc enable disable frontFace cullFace clear lineWidth clearStencil stencilMask checkFramebufferStatus* generateMipmap activeTexture blendEquation isEnabled* ' ] ,
4181
+ [ 2 , 'blendFunc blendEquationSeparate depthRange depthRange[f] stencilMaskSeparate hint polygonOffset vertexAttrib1f ' ] ,
4182
+ [ 3 , 'texParameteri texParameterf vertexAttrib2f stencilFunc stencilOp ' ] ,
4183
+ [ 4 , 'viewport clearColor scissor vertexAttrib3f renderbufferStorage blendFuncSeparate blendColor stencilFuncSeparate stencilOpSeparate ' ] ,
4184
+ [ 5 , 'vertexAttrib4f ' ] ,
4185
+ [ 8 , 'copyTexImage2D copyTexSubImage2D ' ] ,
4186
+ ] ;
4187
4187
4188
4188
function createGLPassthroughFunctions ( lib , funcs ) {
4189
4189
funcs . forEach ( ( data ) => {
@@ -4194,11 +4194,10 @@ function createGLPassthroughFunctions(lib, funcs) {
4194
4194
const returnStub = '(function(' + args + ') { return GLctx[\'NAME\'](' + args + ') })' ;
4195
4195
const sigEnd = range ( num ) . map ( ( ) => 'i' ) . join ( '' ) ;
4196
4196
names . split ( ' ' ) . forEach ( ( name ) => {
4197
- if ( name . length == 0 ) return ;
4198
4197
let stub = plainStub ;
4199
4198
let sig ;
4200
- if ( name [ name . length - 1 ] == '*' ) {
4201
- name = name . substr ( 0 , name . length - 1 ) ;
4199
+ if ( name . endsWith ( '*' ) ) {
4200
+ name = name . slice ( 0 , - 1 ) ;
4202
4201
stub = returnStub ;
4203
4202
sig = 'i' + sigEnd ;
4204
4203
} else {
@@ -4207,7 +4206,7 @@ function createGLPassthroughFunctions(lib, funcs) {
4207
4206
let cName = name ;
4208
4207
if ( name . includes ( '[' ) ) {
4209
4208
cName = name . replace ( '[' , '' ) . replace ( ']' , '' ) ;
4210
- name = cName . substr ( 0 , cName . length - 1 ) ;
4209
+ name = cName . slice ( 0 , - 1 ) ;
4211
4210
}
4212
4211
cName = 'gl' + cName [ 0 ] . toUpperCase ( ) + cName . substr ( 1 ) ;
4213
4212
assert ( ! ( cName in lib ) , "Cannot reimplement the existing function " + cName ) ;
@@ -4217,7 +4216,7 @@ function createGLPassthroughFunctions(lib, funcs) {
4217
4216
} ) ;
4218
4217
}
4219
4218
4220
- createGLPassthroughFunctions ( LibraryGL , glFuncs ) ;
4219
+ createGLPassthroughFunctions ( LibraryGL , glPassthroughFuncs ) ;
4221
4220
4222
4221
autoAddDeps ( LibraryGL , '$GL' ) ;
4223
4222
0 commit comments