@@ -531,7 +531,7 @@ var LibraryGL = {
531
531
var realf = 'real_ ' + f ;
532
532
glCtx [ realf ] = glCtx [ f ] ;
533
533
var numArgs = GL . webGLFunctionLengths [ f ] ; // On Firefox & Chrome, could do "glCtx[realf].length", but that doesn't work on Edge, which always reports 0.
534
- if ( numArgs === undefined ) throw 'Unexpected WebGL function ' + f ;
534
+ if ( numArgs === undefined ) console . warn ( 'Unexpected WebGL function ' + f + ' when binding TRACE_WEBGL_CALLS' ) ;
535
535
var contextHandle = glCtx . canvas . GLctxObject . handle ;
536
536
var threadId = ( typeof _pthread_self !== 'undefined' ) ? _pthread_self : function ( ) { return 1 ; } ;
537
537
// Accessing 'arguments' is super slow, so to avoid overhead, statically reason the number of arguments.
@@ -548,7 +548,7 @@ var LibraryGL = {
548
548
case 9 : glCtx [ f ] = function webgl_9 ( a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8 , a9 ) { var ret = glCtx [ realf ] ( a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8 , a9 ) ; console . error ( '[Thread ' + threadId ( ) + ', GL ctx: ' + contextHandle + ']: ' + f + '(' + a1 + ', ' + a2 + ', ' + a3 + ', ' + a4 + ', ' + a5 + ', ' + a6 + ', ' + a7 + ', ' + a8 + ', ' + a9 + ') -> ' + ret ) ; return ret ; } ; break ;
549
549
case 10 : glCtx [ f ] = function webgl_10 ( a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8 , a9 , a10 ) { var ret = glCtx [ realf ] ( a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8 , a9 , a10 ) ; console . error ( '[Thread ' + threadId ( ) + ', GL ctx: ' + contextHandle + ']: ' + f + '(' + a1 + ', ' + a2 + ', ' + a3 + ', ' + a4 + ', ' + a5 + ', ' + a6 + ', ' + a7 + ', ' + a8 + ', ' + a9 + ', ' + a10 + ') -> ' + ret ) ; return ret ; } ; break ;
550
550
case 11 : glCtx [ f ] = function webgl_11 ( a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8 , a9 , a10 , a11 ) { var ret = glCtx [ realf ] ( a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8 , a9 , a10 , a11 ) ; console . error ( '[Thread ' + threadId ( ) + ', GL ctx: ' + contextHandle + ']: ' + f + '(' + a1 + ', ' + a2 + ', ' + a3 + ', ' + a4 + ', ' + a5 + ', ' + a6 + ', ' + a7 + ', ' + a8 + ', ' + a9 + ', ' + a10 + ', ' + a11 + ') -> ' + ret ) ; return ret ; } ; break ;
551
- default : throw 'hookWebGL failed! Unexpected length ' + glCtx [ realf ] . length ;
551
+ default : console . warn ( 'hookWebGL failed! Unexpected length ' + glCtx [ realf ] . length ) ;
552
552
}
553
553
} ,
554
554
@@ -2246,7 +2246,10 @@ var LibraryGL = {
2246
2246
assert ( ( value & 3 ) == 0 , 'Pointer to integer data passed to glUniform1iv must be aligned to four bytes!' ) ;
2247
2247
#endif
2248
2248
2249
- #if MIN_WEBGL_VERSION == 2
2249
+ #if MIN_WEBGL_VERSION >= 2
2250
+ #if GL_ASSERTIONS
2251
+ assert ( GL . currentContext . version >= 2 ) ;
2252
+ #endif
2250
2253
GLctx . uniform1iv ( GL . uniforms [ location ] , HEAP32 , value >> 2 , count ) ;
2251
2254
#else
2252
2255
@@ -2273,7 +2276,7 @@ var LibraryGL = {
2273
2276
#endif
2274
2277
}
2275
2278
GLctx . uniform1iv ( GL . uniforms [ location ] , view ) ;
2276
- #endif // MIN_WEBGL_VERSION = = 2
2279
+ #endif // MIN_WEBGL_VERSION > = 2
2277
2280
} ,
2278
2281
2279
2282
glUniform2iv__sig: 'viii' ,
@@ -2286,7 +2289,10 @@ var LibraryGL = {
2286
2289
assert ( ( value & 3 ) == 0 , 'Pointer to integer data passed to glUniform2iv must be aligned to four bytes!' ) ;
2287
2290
#endif
2288
2291
2289
- #if MIN_WEBGL_VERSION == 2
2292
+ #if MIN_WEBGL_VERSION >= 2
2293
+ #if GL_ASSERTIONS
2294
+ assert ( GL . currentContext . version >= 2 ) ;
2295
+ #endif
2290
2296
GLctx . uniform2iv ( GL . uniforms [ location ] , HEAP32 , value >> 2 , count * 2 ) ;
2291
2297
#else
2292
2298
@@ -2314,7 +2320,7 @@ var LibraryGL = {
2314
2320
#endif
2315
2321
}
2316
2322
GLctx . uniform2iv ( GL . uniforms [ location ] , view ) ;
2317
- #endif // MIN_WEBGL_VERSION = = 2
2323
+ #endif // MIN_WEBGL_VERSION > = 2
2318
2324
} ,
2319
2325
2320
2326
glUniform3iv__sig : 'viii ',
@@ -2327,7 +2333,10 @@ var LibraryGL = {
2327
2333
assert ( ( value & 3 ) == 0 , 'Pointer to integer data passed to glUniform3iv must be aligned to four bytes!' ) ;
2328
2334
#endif
2329
2335
2330
- #if MIN_WEBGL_VERSION == 2
2336
+ #if MIN_WEBGL_VERSION >= 2
2337
+ #if GL_ASSERTIONS
2338
+ assert ( GL . currentContext . version >= 2 ) ;
2339
+ #endif
2331
2340
GLctx . uniform3iv ( GL . uniforms [ location ] , HEAP32 , value >> 2 , count * 3 ) ;
2332
2341
#else
2333
2342
@@ -2356,7 +2365,7 @@ var LibraryGL = {
2356
2365
#endif
2357
2366
}
2358
2367
GLctx . uniform3iv ( GL . uniforms [ location ] , view ) ;
2359
- #endif // MIN_WEBGL_VERSION = = 2
2368
+ #endif // MIN_WEBGL_VERSION > = 2
2360
2369
} ,
2361
2370
2362
2371
glUniform4iv__sig : 'viii ',
@@ -2369,7 +2378,10 @@ var LibraryGL = {
2369
2378
assert ( ( value & 3 ) == 0 , 'Pointer to integer data passed to glUniform4iv must be aligned to four bytes!' ) ;
2370
2379
#endif
2371
2380
2372
- #if MIN_WEBGL_VERSION == 2
2381
+ #if MIN_WEBGL_VERSION >= 2
2382
+ #if GL_ASSERTIONS
2383
+ assert ( GL . currentContext . version >= 2 ) ;
2384
+ #endif
2373
2385
GLctx . uniform4iv ( GL . uniforms [ location ] , HEAP32 , value >> 2 , count * 4 ) ;
2374
2386
#else
2375
2387
@@ -2399,7 +2411,7 @@ var LibraryGL = {
2399
2411
#endif
2400
2412
}
2401
2413
GLctx . uniform4iv ( GL . uniforms [ location ] , view ) ;
2402
- #endif // MIN_WEBGL_VERSION = = 2
2414
+ #endif // MIN_WEBGL_VERSION > = 2
2403
2415
} ,
2404
2416
2405
2417
glUniform1fv__sig : 'viii ',
@@ -2412,7 +2424,10 @@ var LibraryGL = {
2412
2424
assert ( ( value & 3 ) == 0 , 'Pointer to float data passed to glUniform1fv must be aligned to four bytes!' ) ;
2413
2425
#endif
2414
2426
2415
- #if MIN_WEBGL_VERSION == 2
2427
+ #if MIN_WEBGL_VERSION >= 2
2428
+ #if GL_ASSERTIONS
2429
+ assert ( GL . currentContext . version >= 2 ) ;
2430
+ #endif
2416
2431
GLctx . uniform1fv ( GL . uniforms [ location ] , HEAPF32 , value >> 2 , count ) ;
2417
2432
#else
2418
2433
@@ -2439,7 +2454,7 @@ var LibraryGL = {
2439
2454
#endif
2440
2455
}
2441
2456
GLctx . uniform1fv ( GL . uniforms [ location ] , view ) ;
2442
- #endif // MIN_WEBGL_VERSION = = 2
2457
+ #endif // MIN_WEBGL_VERSION > = 2
2443
2458
} ,
2444
2459
2445
2460
glUniform2fv__sig: 'viii' ,
@@ -2452,7 +2467,10 @@ var LibraryGL = {
2452
2467
assert ( ( value & 3 ) == 0 , 'Pointer to float data passed to glUniform2fv must be aligned to four bytes!' ) ;
2453
2468
#endif
2454
2469
2455
- #if MIN_WEBGL_VERSION == 2
2470
+ #if MIN_WEBGL_VERSION >= 2
2471
+ #if GL_ASSERTIONS
2472
+ assert ( GL . currentContext . version >= 2 ) ;
2473
+ #endif
2456
2474
GLctx . uniform2fv ( GL . uniforms [ location ] , HEAPF32 , value >> 2 , count * 2 ) ;
2457
2475
#else
2458
2476
@@ -2480,7 +2498,7 @@ var LibraryGL = {
2480
2498
#endif
2481
2499
}
2482
2500
GLctx . uniform2fv ( GL . uniforms [ location ] , view ) ;
2483
- #endif // MIN_WEBGL_VERSION = = 2
2501
+ #endif // MIN_WEBGL_VERSION > = 2
2484
2502
} ,
2485
2503
2486
2504
glUniform3fv__sig : 'viii ',
@@ -2493,7 +2511,10 @@ var LibraryGL = {
2493
2511
assert ( ( value & 3 ) == 0 , 'Pointer to float data passed to glUniform3fv must be aligned to four bytes!' + value ) ;
2494
2512
#endif
2495
2513
2496
- #if MIN_WEBGL_VERSION == 2
2514
+ #if MIN_WEBGL_VERSION >= 2
2515
+ #if GL_ASSERTIONS
2516
+ assert ( GL . currentContext . version >= 2 ) ;
2517
+ #endif
2497
2518
GLctx . uniform3fv ( GL . uniforms [ location ] , HEAPF32 , value >> 2 , count * 3 ) ;
2498
2519
#else
2499
2520
@@ -2522,7 +2543,7 @@ var LibraryGL = {
2522
2543
#endif
2523
2544
}
2524
2545
GLctx . uniform3fv ( GL . uniforms [ location ] , view ) ;
2525
- #endif // MIN_WEBGL_VERSION = = 2
2546
+ #endif // MIN_WEBGL_VERSION > = 2
2526
2547
} ,
2527
2548
2528
2549
glUniform4fv__sig : 'viii ',
@@ -2535,7 +2556,10 @@ var LibraryGL = {
2535
2556
assert ( ( value & 3 ) == 0 , 'Pointer to float data passed to glUniform4fv must be aligned to four bytes!' ) ;
2536
2557
#endif
2537
2558
2538
- #if MIN_WEBGL_VERSION == 2
2559
+ #if MIN_WEBGL_VERSION >= 2
2560
+ #if GL_ASSERTIONS
2561
+ assert ( GL . currentContext . version >= 2 ) ;
2562
+ #endif
2539
2563
GLctx . uniform4fv ( GL . uniforms [ location ] , HEAPF32 , value >> 2 , count * 4 ) ;
2540
2564
#else
2541
2565
@@ -2569,7 +2593,7 @@ var LibraryGL = {
2569
2593
#endif
2570
2594
}
2571
2595
GLctx . uniform4fv ( GL . uniforms [ location ] , view ) ;
2572
- #endif // MIN_WEBGL_VERSION = = 2
2596
+ #endif // MIN_WEBGL_VERSION > = 2
2573
2597
} ,
2574
2598
2575
2599
glUniformMatrix2fv__sig : 'viiii ',
@@ -2582,7 +2606,10 @@ var LibraryGL = {
2582
2606
assert ( ( value & 3 ) == 0 , 'Pointer to float data passed to glUniformMatrix2fv must be aligned to four bytes!' ) ;
2583
2607
#endif
2584
2608
2585
- #if MIN_WEBGL_VERSION == 2
2609
+ #if MIN_WEBGL_VERSION >= 2
2610
+ #if GL_ASSERTIONS
2611
+ assert ( GL . currentContext . version >= 2 ) ;
2612
+ #endif
2586
2613
GLctx . uniformMatrix2fv ( GL . uniforms [ location ] , ! ! transpose , HEAPF32 , value >> 2 , count * 4 ) ;
2587
2614
#else
2588
2615
@@ -2612,7 +2639,7 @@ var LibraryGL = {
2612
2639
#endif
2613
2640
}
2614
2641
GLctx . uniformMatrix2fv ( GL . uniforms [ location ] , ! ! transpose , view ) ;
2615
- #endif // MIN_WEBGL_VERSION = = 2
2642
+ #endif // MIN_WEBGL_VERSION > = 2
2616
2643
} ,
2617
2644
2618
2645
glUniformMatrix3fv__sig : 'viiii ',
@@ -2625,7 +2652,10 @@ var LibraryGL = {
2625
2652
assert ( ( value & 3 ) == 0 , 'Pointer to float data passed to glUniformMatrix3fv must be aligned to four bytes!' ) ;
2626
2653
#endif
2627
2654
2628
- #if MIN_WEBGL_VERSION == 2
2655
+ #if MIN_WEBGL_VERSION >= 2
2656
+ #if GL_ASSERTIONS
2657
+ assert ( GL . currentContext . version >= 2 ) ;
2658
+ #endif
2629
2659
GLctx . uniformMatrix3fv ( GL . uniforms [ location ] , ! ! transpose , HEAPF32 , value >> 2 , count * 9 ) ;
2630
2660
#else
2631
2661
@@ -2660,7 +2690,7 @@ var LibraryGL = {
2660
2690
#endif
2661
2691
}
2662
2692
GLctx . uniformMatrix3fv ( GL . uniforms [ location ] , ! ! transpose , view ) ;
2663
- #endif // MIN_WEBGL_VERSION = = 2
2693
+ #endif // MIN_WEBGL_VERSION > = 2
2664
2694
} ,
2665
2695
2666
2696
glUniformMatrix4fv__sig : 'viiii ',
@@ -2673,7 +2703,10 @@ var LibraryGL = {
2673
2703
assert ( ( value & 3 ) == 0 , 'Pointer to float data passed to glUniformMatrix4fv must be aligned to four bytes!' ) ;
2674
2704
#endif
2675
2705
2676
- #if MIN_WEBGL_VERSION == 2
2706
+ #if MIN_WEBGL_VERSION >= 2
2707
+ #if GL_ASSERTIONS
2708
+ assert ( GL . currentContext . version >= 2 ) ;
2709
+ #endif
2677
2710
GLctx . uniformMatrix4fv ( GL . uniforms [ location ] , ! ! transpose , HEAPF32 , value >> 2 , count * 16 ) ;
2678
2711
#else
2679
2712
@@ -2719,7 +2752,7 @@ var LibraryGL = {
2719
2752
#endif
2720
2753
}
2721
2754
GLctx . uniformMatrix4fv ( GL . uniforms [ location ] , ! ! transpose , view ) ;
2722
- #endif // MIN_WEBGL_VERSION = = 2
2755
+ #endif // MIN_WEBGL_VERSION > = 2
2723
2756
} ,
2724
2757
2725
2758
glBindBuffer__sig : 'vii ',
0 commit comments