@nativescript/canvas 2.0.0-alpha.21 → 2.0.0-alpha.23

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.
Files changed (32) hide show
  1. package/Canvas/index.android.js +1 -3
  2. package/Canvas/index.android.js.map +1 -1
  3. package/WebGL/WebGLRenderingContext/index.js.map +1 -1
  4. package/package.json +1 -1
  5. package/platforms/android/canvas-release.aar +0 -0
  6. package/platforms/ios/CanvasNative.xcframework/ios-arm64/dSYMs/CanvasNative.framework.dSYM/Contents/Resources/DWARF/CanvasNative +0 -0
  7. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/dSYMs/CanvasNative.framework.dSYM/Contents/Resources/DWARF/CanvasNative +0 -0
  8. package/platforms/ios/src/cpp/ImageAssetImpl.cpp +4 -4
  9. package/platforms/ios/src/cpp/canvas2d/CanvasRenderingContext2DImpl.cpp +291 -302
  10. package/platforms/ios/src/cpp/webgl/WebGLActiveInfoImpl.cpp +0 -2
  11. package/platforms/ios/src/cpp/webgl/WebGLRenderingContext.cpp +1545 -1760
  12. package/platforms/ios/src/cpp/webgl/extensions/ANGLE_instanced_arraysImpl.cpp +14 -14
  13. package/platforms/ios/src/cpp/webgl/extensions/EXT_blend_minmaxImpl.cpp +2 -2
  14. package/platforms/ios/src/cpp/webgl/extensions/EXT_color_buffer_half_floatImpl.cpp +4 -4
  15. package/platforms/ios/src/cpp/webgl/extensions/EXT_disjoint_timer_queryImpl.cpp +58 -71
  16. package/platforms/ios/src/cpp/webgl/extensions/EXT_sRGBImpl.h +4 -4
  17. package/platforms/ios/src/cpp/webgl/extensions/EXT_texture_filter_anisotropicImpl.h +2 -2
  18. package/platforms/ios/src/cpp/webgl/extensions/OES_element_index_uintImpl.h +1 -1
  19. package/platforms/ios/src/cpp/webgl/extensions/OES_standard_derivativesImpl.h +1 -1
  20. package/platforms/ios/src/cpp/webgl/extensions/OES_texture_half_floatImpl.h +1 -1
  21. package/platforms/ios/src/cpp/webgl/extensions/OES_vertex_array_objectImpl.h +1 -1
  22. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_color_buffer_floatImpl.h +4 -4
  23. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_compressed_texture_atcImpl.h +3 -3
  24. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_compressed_texture_etc1Impl.h +1 -1
  25. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_compressed_texture_etcImpl.h +10 -10
  26. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_compressed_texture_pvrtcImpl.h +4 -4
  27. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_compressed_texture_s3tcImpl.h +4 -4
  28. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_compressed_texture_s3tc_srgbImpl.h +4 -4
  29. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_depth_textureImpl.h +1 -1
  30. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_draw_buffersImpl.cpp +5 -13
  31. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_draw_buffersImpl.h +40 -39
  32. package/platforms/ios/src/cpp/webgl2/WebGL2RenderingContext.cpp +1454 -1586
@@ -122,12 +122,12 @@ v8::Local<v8::Value> WebGLRenderingContext::GetParameterInternal(v8::Isolate *is
122
122
  value == 0) {
123
123
  return scope.Escape(v8::Null(isolate));
124
124
  }
125
- return scope.Escape(v8::Number::New(isolate, (double) value));
125
+ return scope.Escape(v8::Integer::New(isolate, value));
126
126
  }
127
127
  case (uint32_t) GLConstants::UNPACK_COLORSPACE_CONVERSION_WEBGL:
128
- return scope.Escape(v8::Number::New(isolate,
129
- (double) canvas_native_webgl_state_get_unpack_colorspace_conversion_webgl(
130
- this->GetState())));
128
+ return scope.Escape(v8::Integer::New(isolate,
129
+ canvas_native_webgl_state_get_unpack_colorspace_conversion_webgl(
130
+ this->GetState())));
131
131
  case GL_ALIASED_LINE_WIDTH_RANGE:
132
132
  case GL_ALIASED_POINT_SIZE_RANGE:
133
133
  case GL_BLEND_COLOR:
@@ -307,7 +307,7 @@ void WebGLRenderingContext::ActiveTexture(const v8::FunctionCallbackInfo<v8::Val
307
307
 
308
308
  auto isolate = args.GetIsolate();
309
309
  auto context = isolate->GetCurrentContext();
310
- auto texture = (uint32_t) args[0]->NumberValue(context).ToChecked();
310
+ auto texture = args[0]->Uint32Value(context).ToChecked();
311
311
  canvas_native_webgl_active_texture(texture,
312
312
  ptr->GetState());
313
313
  }
@@ -322,32 +322,33 @@ void WebGLRenderingContext::AttachShader(const v8::FunctionCallbackInfo<v8::Valu
322
322
 
323
323
  auto programValue = args[0];
324
324
  auto shaderValue = args[1];
325
- if (programValue->IsObject() && shaderValue->IsObject()) {
326
- WebGLProgram *program = nullptr;
327
- WebGLShader *shader = nullptr;
328
- if (GetNativeType(isolate, programValue.As<v8::Object>()) == NativeType::WebGLProgram) {
329
- program = WebGLProgram::GetPointer(programValue.As<v8::Object>());
330
- }
331
325
 
332
- if (GetNativeType(isolate, shaderValue.As<v8::Object>()) == NativeType::WebGLShader) {
333
- shader = WebGLShader::GetPointer(shaderValue.As<v8::Object>());
334
- }
326
+ auto programType = GetNativeType(isolate, programValue);
327
+ auto shaderType = GetNativeType(isolate, shaderValue);
335
328
 
336
- if (program == nullptr) {
337
- return;
338
- }
329
+ WebGLProgram *program = nullptr;
330
+ WebGLShader *shader = nullptr;
331
+ if (programType == NativeType::WebGLProgram) {
332
+ program = WebGLProgram::GetPointer(programValue.As<v8::Object>());
333
+ }
339
334
 
340
- if (shader == nullptr) {
341
- return;
342
- }
335
+ if (shaderType == NativeType::WebGLShader) {
336
+ shader = WebGLShader::GetPointer(shaderValue.As<v8::Object>());
337
+ }
343
338
 
344
- canvas_native_webgl_attach_shader(
345
- program->GetProgram(),
346
- shader->GetShader(),
347
- ptr->GetState()
348
- );
339
+ if (program == nullptr) {
340
+ return;
341
+ }
349
342
 
343
+ if (shader == nullptr) {
344
+ return;
350
345
  }
346
+
347
+ canvas_native_webgl_attach_shader(
348
+ program->GetProgram(),
349
+ shader->GetShader(),
350
+ ptr->GetState()
351
+ );
351
352
  }
352
353
 
353
354
  void WebGLRenderingContext::BindAttribLocation(const v8::FunctionCallbackInfo<v8::Value> &args) {
@@ -359,23 +360,20 @@ void WebGLRenderingContext::BindAttribLocation(const v8::FunctionCallbackInfo<v8
359
360
  auto isolate = args.GetIsolate();
360
361
  auto context = isolate->GetCurrentContext();
361
362
 
362
- if (args.Length() > 2) {
363
- auto programValue = args[0];
364
- auto type = GetNativeType(isolate, programValue);
365
- if (type == NativeType::WebGLProgram && args[1]->IsNumber() &&
366
- args[2]->IsString()) {
367
- auto program = WebGLProgram::GetPointer(programValue.As<v8::Object>());
363
+ auto programValue = args[0];
364
+ auto type = GetNativeType(isolate, programValue);
365
+ if (type == NativeType::WebGLProgram) {
366
+ auto program = WebGLProgram::GetPointer(programValue.As<v8::Object>());
368
367
 
369
- auto index = (uint32_t) args[1]->NumberValue(context).ToChecked();
370
- auto name = ConvertFromV8String(isolate, args[2]);
371
- canvas_native_webgl_bind_attrib_location(
372
- program->GetProgram(),
373
- index,
374
- name.c_str(),
375
- ptr->GetState()
376
- );
368
+ auto index = args[1]->Uint32Value(context).ToChecked();
369
+ auto name = ConvertFromV8String(isolate, args[2]);
370
+ canvas_native_webgl_bind_attrib_location(
371
+ program->GetProgram(),
372
+ index,
373
+ name.c_str(),
374
+ ptr->GetState()
375
+ );
377
376
 
378
- }
379
377
  }
380
378
  }
381
379
 
@@ -388,33 +386,29 @@ void WebGLRenderingContext::BindBuffer(const v8::FunctionCallbackInfo<v8::Value>
388
386
  auto isolate = args.GetIsolate();
389
387
  auto context = isolate->GetCurrentContext();
390
388
 
391
- if (args.Length() > 1) {
392
- if (args[0]->IsNumber()) {
393
- auto target = (uint32_t) args[0]->NumberValue(context).ToChecked();
394
- if (!args[1]->IsNull() &&
395
- args[1]->IsObject()) {
396
- auto type = GetNativeType(isolate, args[1].As<v8::Object>());
397
- if (type == NativeType::WebGLBuffer) {
398
- auto buffer = WebGLBuffer::GetPointer(args[1].As<v8::Object>());
399
- if (buffer ==
400
- nullptr) { return; }
401
- canvas_native_webgl_bind_buffer(
402
- target,
403
- buffer->GetBuffer(),
404
- ptr->GetState()
405
- );
406
- }
407
-
408
- } else {
409
- // unbind
410
- // check for null or undefined ?
411
- canvas_native_webgl_bind_buffer(
412
- target,
413
- 0,
414
- ptr->GetState()
415
- );
416
- }
389
+ auto target = args[0]->Uint32Value(context).ToChecked();
390
+ if (!args[1]->IsNull() &&
391
+ args[1]->IsObject()) {
392
+ auto type = GetNativeType(isolate, args[1].As<v8::Object>());
393
+ if (type == NativeType::WebGLBuffer) {
394
+ auto buffer = WebGLBuffer::GetPointer(args[1].As<v8::Object>());
395
+ if (buffer ==
396
+ nullptr) { return; }
397
+ canvas_native_webgl_bind_buffer(
398
+ target,
399
+ buffer->GetBuffer(),
400
+ ptr->GetState()
401
+ );
417
402
  }
403
+
404
+ } else {
405
+ // unbind
406
+ // check for null or undefined ?
407
+ canvas_native_webgl_bind_buffer(
408
+ target,
409
+ 0,
410
+ ptr->GetState()
411
+ );
418
412
  }
419
413
  }
420
414
 
@@ -427,28 +421,26 @@ void WebGLRenderingContext::BindFramebuffer(const v8::FunctionCallbackInfo<v8::V
427
421
  auto isolate = args.GetIsolate();
428
422
  auto context = isolate->GetCurrentContext();
429
423
 
430
- if (args.Length() > 1) {
431
- if (args[0]->IsNumber()) {
432
- auto target = (uint32_t) args[0]->NumberValue(context).ToChecked();
433
- if (args[1]->IsObject()) {
434
- auto type = GetNativeType(isolate, args[1].As<v8::Object>());
435
- if (type == NativeType::WebGLFramebuffer) {
436
- auto framebuffer = WebGLFramebuffer::GetPointer(args[1].As<v8::Object>());
437
- canvas_native_webgl_bind_frame_buffer(
438
- target,
439
- framebuffer->GetFrameBuffer(),
440
- ptr->GetState()
441
- );
442
- }
443
- } else {
444
- // null value
445
- // unbind
424
+ if (args[0]->IsNumber()) {
425
+ auto target = args[0]->Uint32Value(context).ToChecked();
426
+ if (args[1]->IsObject()) {
427
+ auto type = GetNativeType(isolate, args[1]);
428
+ if (type == NativeType::WebGLFramebuffer) {
429
+ auto framebuffer = WebGLFramebuffer::GetPointer(args[1].As<v8::Object>());
446
430
  canvas_native_webgl_bind_frame_buffer(
447
431
  target,
448
- 0,
432
+ framebuffer->GetFrameBuffer(),
449
433
  ptr->GetState()
450
434
  );
451
435
  }
436
+ } else {
437
+ // null value
438
+ // unbind
439
+ canvas_native_webgl_bind_frame_buffer(
440
+ target,
441
+ 0,
442
+ ptr->GetState()
443
+ );
452
444
  }
453
445
  }
454
446
  }
@@ -462,30 +454,26 @@ void WebGLRenderingContext::BindRenderbuffer(const v8::FunctionCallbackInfo<v8::
462
454
  auto isolate = args.GetIsolate();
463
455
  auto context = isolate->GetCurrentContext();
464
456
 
465
- if (args.Length() > 1) {
466
- if (args[0]->IsNumber()) {
467
- auto target = (uint32_t) args[0]->NumberValue(context).ToChecked();
468
- if (args[1]->IsObject()) {
469
- auto type = GetNativeType(isolate, args[1].As<v8::Object>());
470
- if (type == NativeType::WebGLRenderbuffer) {
471
- auto renderbuffer = WebGLRenderbuffer::GetPointer(args[1].As<v8::Object>());
472
-
473
- if (renderbuffer ==
474
- nullptr) { return; }
475
- canvas_native_webgl_bind_render_buffer(
476
- target,
477
- renderbuffer->GetRenderBuffer(),
478
- ptr->GetState()
479
- );
480
- }
481
- } else {
482
- canvas_native_webgl_bind_render_buffer(
483
- target,
484
- 0,
485
- ptr->GetState()
486
- );
487
- }
457
+ auto target = args[0]->Uint32Value(context).ToChecked();
458
+ if (args[1]->IsObject()) {
459
+ auto type = GetNativeType(isolate, args[1].As<v8::Object>());
460
+ if (type == NativeType::WebGLRenderbuffer) {
461
+ auto renderbuffer = WebGLRenderbuffer::GetPointer(args[1].As<v8::Object>());
462
+
463
+ if (renderbuffer ==
464
+ nullptr) { return; }
465
+ canvas_native_webgl_bind_render_buffer(
466
+ target,
467
+ renderbuffer->GetRenderBuffer(),
468
+ ptr->GetState()
469
+ );
488
470
  }
471
+ } else {
472
+ canvas_native_webgl_bind_render_buffer(
473
+ target,
474
+ 0,
475
+ ptr->GetState()
476
+ );
489
477
  }
490
478
  }
491
479
 
@@ -498,27 +486,23 @@ void WebGLRenderingContext::BindTexture(const v8::FunctionCallbackInfo<v8::Value
498
486
  auto isolate = args.GetIsolate();
499
487
  auto context = isolate->GetCurrentContext();
500
488
 
501
- if (args.Length() > 1) {
502
- if (args[0]->IsNumber()) {
503
- auto target = (uint32_t) args[0]->NumberValue(context).ToChecked();
504
- if (args[1]->IsObject()) {
505
- auto type = GetNativeType(isolate, args[1].As<v8::Object>());
506
- if (type == NativeType::WebGLTexture) {
507
- auto texture = WebGLTexture::GetPointer(args[1].As<v8::Object>());
508
- canvas_native_webgl_bind_texture(
509
- target,
510
- texture->GetTexture(),
511
- ptr->GetState()
512
- );
513
- }
514
- } else {
515
- canvas_native_webgl_bind_texture(
516
- target,
517
- 0,
518
- ptr->GetState()
519
- );
520
- }
489
+ auto target = args[0]->Uint32Value(context).ToChecked();
490
+ if (args[1]->IsObject()) {
491
+ auto type = GetNativeType(isolate, args[1].As<v8::Object>());
492
+ if (type == NativeType::WebGLTexture) {
493
+ auto texture = WebGLTexture::GetPointer(args[1].As<v8::Object>());
494
+ canvas_native_webgl_bind_texture(
495
+ target,
496
+ texture->GetTexture(),
497
+ ptr->GetState()
498
+ );
521
499
  }
500
+ } else {
501
+ canvas_native_webgl_bind_texture(
502
+ target,
503
+ 0,
504
+ ptr->GetState()
505
+ );
522
506
  }
523
507
  }
524
508
 
@@ -531,20 +515,18 @@ void WebGLRenderingContext::BlendColor(const v8::FunctionCallbackInfo<v8::Value>
531
515
  auto isolate = args.GetIsolate();
532
516
  auto context = isolate->GetCurrentContext();
533
517
 
534
- if (args.Length() > 3) {
535
- auto red = args[0]->NumberValue(context).ToChecked();
536
- auto green = args[1]->NumberValue(context).ToChecked();
537
- auto blue = args[2]->NumberValue(context).ToChecked();
538
- auto alpha = args[3]->NumberValue(context).ToChecked();
539
-
540
- canvas_native_webgl_blend_color(
541
- static_cast<float>(red),
542
- static_cast<float>(green),
543
- static_cast<float>(blue),
544
- static_cast<float>(alpha),
545
- ptr->GetState()
546
- );
547
- }
518
+ auto red = args[0]->NumberValue(context).ToChecked();
519
+ auto green = args[1]->NumberValue(context).ToChecked();
520
+ auto blue = args[2]->NumberValue(context).ToChecked();
521
+ auto alpha = args[3]->NumberValue(context).ToChecked();
522
+
523
+ canvas_native_webgl_blend_color(
524
+ static_cast<float>(red),
525
+ static_cast<float>(green),
526
+ static_cast<float>(blue),
527
+ static_cast<float>(alpha),
528
+ ptr->GetState()
529
+ );
548
530
  }
549
531
 
550
532
  void WebGLRenderingContext::BlendEquationSeparate(const v8::FunctionCallbackInfo<v8::Value> &args) {
@@ -556,16 +538,14 @@ void WebGLRenderingContext::BlendEquationSeparate(const v8::FunctionCallbackInfo
556
538
  auto isolate = args.GetIsolate();
557
539
  auto context = isolate->GetCurrentContext();
558
540
 
559
- if (args.Length() > 1) {
560
- auto modeRGB = (uint32_t) args[0]->NumberValue(context).ToChecked();
561
- auto modeAlpha = (uint32_t) args[1]->NumberValue(context).ToChecked();
541
+ auto modeRGB = args[0]->Uint32Value(context).ToChecked();
542
+ auto modeAlpha = args[1]->Uint32Value(context).ToChecked();
562
543
 
563
- canvas_native_webgl_blend_equation_separate(
564
- modeRGB,
565
- modeAlpha,
566
- ptr->GetState()
567
- );
568
- }
544
+ canvas_native_webgl_blend_equation_separate(
545
+ modeRGB,
546
+ modeAlpha,
547
+ ptr->GetState()
548
+ );
569
549
  }
570
550
 
571
551
  void WebGLRenderingContext::BlendEquation(const v8::FunctionCallbackInfo<v8::Value> &args) {
@@ -577,13 +557,11 @@ void WebGLRenderingContext::BlendEquation(const v8::FunctionCallbackInfo<v8::Val
577
557
  auto isolate = args.GetIsolate();
578
558
  auto context = isolate->GetCurrentContext();
579
559
 
580
- if (args.Length() > 0) {
581
- auto mode = (uint32_t) args[0]->NumberValue(context).ToChecked();
582
- canvas_native_webgl_blend_equation(
583
- mode,
584
- ptr->GetState()
585
- );
586
- }
560
+ auto mode = args[0]->Uint32Value(context).ToChecked();
561
+ canvas_native_webgl_blend_equation(
562
+ mode,
563
+ ptr->GetState()
564
+ );
587
565
  }
588
566
 
589
567
  void WebGLRenderingContext::BlendFuncSeparate(const v8::FunctionCallbackInfo<v8::Value> &args) {
@@ -595,20 +573,18 @@ void WebGLRenderingContext::BlendFuncSeparate(const v8::FunctionCallbackInfo<v8:
595
573
  auto isolate = args.GetIsolate();
596
574
  auto context = isolate->GetCurrentContext();
597
575
 
598
- if (args.Length() > 3) {
599
- auto srcRGB = (uint32_t) args[0]->NumberValue(context).ToChecked();
600
- auto dstRGB = (uint32_t) args[1]->NumberValue(context).ToChecked();
601
- auto srcAlpha = (uint32_t) args[2]->NumberValue(context).ToChecked();
602
- auto dstAlpha = (uint32_t) args[3]->NumberValue(context).ToChecked();
603
-
604
- canvas_native_webgl_blend_func_separate(
605
- srcRGB,
606
- dstRGB,
607
- srcAlpha,
608
- dstAlpha,
609
- ptr->GetState()
610
- );
611
- }
576
+ auto srcRGB = args[0]->Uint32Value(context).ToChecked();
577
+ auto dstRGB = args[1]->Uint32Value(context).ToChecked();
578
+ auto srcAlpha = args[2]->Uint32Value(context).ToChecked();
579
+ auto dstAlpha = args[3]->Uint32Value(context).ToChecked();
580
+
581
+ canvas_native_webgl_blend_func_separate(
582
+ srcRGB,
583
+ dstRGB,
584
+ srcAlpha,
585
+ dstAlpha,
586
+ ptr->GetState()
587
+ );
612
588
  }
613
589
 
614
590
  void WebGLRenderingContext::BlendFunc(const v8::FunctionCallbackInfo<v8::Value> &args) {
@@ -620,16 +596,14 @@ void WebGLRenderingContext::BlendFunc(const v8::FunctionCallbackInfo<v8::Value>
620
596
  auto isolate = args.GetIsolate();
621
597
  auto context = isolate->GetCurrentContext();
622
598
 
623
- if (args.Length() > 1) {
624
- auto sfactor = (uint32_t) args[0]->NumberValue(context).ToChecked();
625
- auto dfactor = (uint32_t) args[1]->NumberValue(context).ToChecked();
599
+ auto sfactor = args[0]->Uint32Value(context).ToChecked();
600
+ auto dfactor = args[1]->Uint32Value(context).ToChecked();
626
601
 
627
- canvas_native_webgl_blend_func(
628
- sfactor,
629
- dfactor,
630
- ptr->GetState()
631
- );
632
- }
602
+ canvas_native_webgl_blend_func(
603
+ sfactor,
604
+ dfactor,
605
+ ptr->GetState()
606
+ );
633
607
  }
634
608
 
635
609
  void WebGLRenderingContext::BufferData(const v8::FunctionCallbackInfo<v8::Value> &args) {
@@ -644,8 +618,8 @@ void WebGLRenderingContext::BufferData(const v8::FunctionCallbackInfo<v8::Value>
644
618
  auto count = args.Length();
645
619
 
646
620
  if (count == 2) {
647
- auto target = (uint32_t) args[0]->NumberValue(context).ToChecked();
648
- auto usage = (uint32_t) args[1]->NumberValue(context).ToChecked();
621
+ auto target = args[0]->Uint32Value(context).ToChecked();
622
+ auto usage = args[1]->Uint32Value(context).ToChecked();
649
623
 
650
624
  canvas_native_webgl_buffer_data_none(
651
625
  target,
@@ -654,9 +628,9 @@ void WebGLRenderingContext::BufferData(const v8::FunctionCallbackInfo<v8::Value>
654
628
  ptr->GetState()
655
629
  );
656
630
  } else if (count == 3) {
657
- auto target = (uint32_t) args[0]->NumberValue(context).ToChecked();
631
+ auto target = args[0]->Uint32Value(context).ToChecked();
658
632
 
659
- auto usage = (uint32_t) args[2]->NumberValue(context).ToChecked();
633
+ auto usage = args[2]->Uint32Value(context).ToChecked();
660
634
 
661
635
  if (args[1]->IsObject()) {
662
636
 
@@ -668,7 +642,8 @@ void WebGLRenderingContext::BufferData(const v8::FunctionCallbackInfo<v8::Value>
668
642
  auto array = buf->Buffer();
669
643
  auto offset = buf->ByteOffset();
670
644
  auto size = buf->Length();
671
- auto data_ptr = static_cast<uint8_t*>(array->GetBackingStore()->Data()) + offset;
645
+ auto data_ptr =
646
+ static_cast<uint8_t *>(array->GetBackingStore()->Data()) + offset;
672
647
  auto data = static_cast<uint16_t *>((void *) data_ptr);
673
648
 
674
649
  canvas_native_webgl_buffer_data_u16(
@@ -683,7 +658,8 @@ void WebGLRenderingContext::BufferData(const v8::FunctionCallbackInfo<v8::Value>
683
658
  auto array = buf->Buffer();
684
659
  auto offset = buf->ByteOffset();
685
660
  auto size = buf->Length();
686
- auto data_ptr = static_cast<uint8_t*>(array->GetBackingStore()->Data()) + offset;
661
+ auto data_ptr =
662
+ static_cast<uint8_t *>(array->GetBackingStore()->Data()) + offset;
687
663
  auto data = static_cast<float *>((void *) data_ptr);
688
664
 
689
665
  canvas_native_webgl_buffer_data_f32(
@@ -698,7 +674,8 @@ void WebGLRenderingContext::BufferData(const v8::FunctionCallbackInfo<v8::Value>
698
674
  auto array = buf->Buffer();
699
675
  auto offset = buf->ByteOffset();
700
676
  auto size = buf->ByteLength();
701
- auto data_ptr = static_cast<uint8_t*>(array->GetBackingStore()->Data()) + offset;
677
+ auto data_ptr =
678
+ static_cast<uint8_t *>(array->GetBackingStore()->Data()) + offset;
702
679
  auto data = static_cast<uint8_t *>((void *) data_ptr);
703
680
 
704
681
 
@@ -747,7 +724,7 @@ void WebGLRenderingContext::BufferSubData(const v8::FunctionCallbackInfo<v8::Val
747
724
  auto count = args.Length();
748
725
 
749
726
  if (count == 2) {
750
- auto target = (uint32_t) args[0]->NumberValue(context).ToChecked();
727
+ auto target = args[0]->Uint32Value(context).ToChecked();
751
728
  auto offset = args[1]->NumberValue(context).ToChecked();
752
729
 
753
730
  canvas_native_webgl_buffer_sub_data_none(
@@ -756,7 +733,7 @@ void WebGLRenderingContext::BufferSubData(const v8::FunctionCallbackInfo<v8::Val
756
733
  ptr->GetState()
757
734
  );
758
735
  } else if (count == 3) {
759
- auto target = (uint32_t) args[0]->NumberValue(context).ToChecked();
736
+ auto target = args[0]->Uint32Value(context).ToChecked();
760
737
  auto offset = args[1]->NumberValue(context).ToChecked();
761
738
 
762
739
  if (args[2]->IsObject()) {
@@ -809,19 +786,16 @@ WebGLRenderingContext::CheckFramebufferStatus(const v8::FunctionCallbackInfo<v8:
809
786
 
810
787
  auto count = args.Length();
811
788
 
812
- if (count > 0) {
789
+ if (args[0]->IsNumber()) {
790
+ auto target = args[0]->Uint32Value(context).ToChecked();
813
791
 
814
- if (args[0]->IsNumber()) {
815
- auto target = (uint32_t) args[0]->NumberValue(context).ToChecked();
816
-
817
- auto ret = canvas_native_webgl_check_frame_buffer_status(
818
- target,
819
- ptr->GetState()
820
- );
792
+ auto ret = canvas_native_webgl_check_frame_buffer_status(
793
+ target,
794
+ ptr->GetState()
795
+ );
821
796
 
822
- args.GetReturnValue().Set((int32_t) ret);
823
- return;
824
- }
797
+ args.GetReturnValue().Set(ret);
798
+ return;
825
799
  }
826
800
 
827
801
  args.GetReturnValue().Set(0);
@@ -836,20 +810,18 @@ void WebGLRenderingContext::ClearColor(const v8::FunctionCallbackInfo<v8::Value>
836
810
  auto isolate = args.GetIsolate();
837
811
  auto context = isolate->GetCurrentContext();
838
812
 
839
- if (args.Length() > 3) {
840
- auto red = args[0]->NumberValue(context).ToChecked();
841
- auto green = args[1]->NumberValue(context).ToChecked();
842
- auto blue = args[2]->NumberValue(context).ToChecked();
843
- auto alpha = args[3]->NumberValue(context).ToChecked();
844
-
845
- canvas_native_webgl_clear_color(
846
- static_cast<float>(red),
847
- static_cast<float>(green),
848
- static_cast<float>(blue),
849
- static_cast<float>(alpha),
850
- ptr->GetState()
851
- );
852
- }
813
+ auto red = args[0]->NumberValue(context).ToChecked();
814
+ auto green = args[1]->NumberValue(context).ToChecked();
815
+ auto blue = args[2]->NumberValue(context).ToChecked();
816
+ auto alpha = args[3]->NumberValue(context).ToChecked();
817
+
818
+ canvas_native_webgl_clear_color(
819
+ static_cast<float>(red),
820
+ static_cast<float>(green),
821
+ static_cast<float>(blue),
822
+ static_cast<float>(alpha),
823
+ ptr->GetState()
824
+ );
853
825
  }
854
826
 
855
827
  void WebGLRenderingContext::ClearDepth(const v8::FunctionCallbackInfo<v8::Value> &args) {
@@ -861,14 +833,12 @@ void WebGLRenderingContext::ClearDepth(const v8::FunctionCallbackInfo<v8::Value>
861
833
  auto isolate = args.GetIsolate();
862
834
  auto context = isolate->GetCurrentContext();
863
835
 
864
- if (args.Length() > 0) {
865
- auto depth = args[0]->NumberValue(context).ToChecked();
836
+ auto depth = args[0]->NumberValue(context).ToChecked();
866
837
 
867
- canvas_native_webgl_clear_depth(
868
- static_cast<float>(depth),
869
- ptr->GetState()
870
- );
871
- }
838
+ canvas_native_webgl_clear_depth(
839
+ static_cast<float>(depth),
840
+ ptr->GetState()
841
+ );
872
842
  }
873
843
 
874
844
  void WebGLRenderingContext::ClearStencil(const v8::FunctionCallbackInfo<v8::Value> &args) {
@@ -880,13 +850,11 @@ void WebGLRenderingContext::ClearStencil(const v8::FunctionCallbackInfo<v8::Valu
880
850
  auto isolate = args.GetIsolate();
881
851
  auto context = isolate->GetCurrentContext();
882
852
 
883
- if (args.Length() > 0) {
884
- auto stencil = (int32_t) args[0]->NumberValue(context).ToChecked();
885
- canvas_native_webgl_clear_stencil(
886
- stencil,
887
- ptr->GetState()
888
- );
889
- }
853
+ auto stencil = args[0]->Int32Value(context).ToChecked();
854
+ canvas_native_webgl_clear_stencil(
855
+ stencil,
856
+ ptr->GetState()
857
+ );
890
858
  }
891
859
 
892
860
  void WebGLRenderingContext::Clear(const v8::FunctionCallbackInfo<v8::Value> &args) {
@@ -898,8 +866,7 @@ void WebGLRenderingContext::Clear(const v8::FunctionCallbackInfo<v8::Value> &arg
898
866
  auto isolate = args.GetIsolate();
899
867
  auto context = isolate->GetCurrentContext();
900
868
 
901
- //if (count > 0) {
902
- auto mask = (uint32_t) args[0]->NumberValue(context).ToChecked();
869
+ auto mask = args[0]->Uint32Value(context).ToChecked();
903
870
 
904
871
  canvas_native_webgl_clear(
905
872
  mask,
@@ -907,7 +874,6 @@ void WebGLRenderingContext::Clear(const v8::FunctionCallbackInfo<v8::Value> &arg
907
874
  );
908
875
 
909
876
  ptr->UpdateInvalidateState();
910
- // }
911
877
  }
912
878
 
913
879
  void WebGLRenderingContext::ColorMask(const v8::FunctionCallbackInfo<v8::Value> &args) {
@@ -918,20 +884,18 @@ void WebGLRenderingContext::ColorMask(const v8::FunctionCallbackInfo<v8::Value>
918
884
 
919
885
  auto isolate = args.GetIsolate();
920
886
 
921
- if (args.Length() > 3) {
922
- auto red = args[0]->BooleanValue(isolate);
923
- auto green = args[1]->BooleanValue(isolate);
924
- auto blue = args[2]->BooleanValue(isolate);
925
- auto alpha = args[3]->BooleanValue(isolate);
887
+ auto red = args[0]->BooleanValue(isolate);
888
+ auto green = args[1]->BooleanValue(isolate);
889
+ auto blue = args[2]->BooleanValue(isolate);
890
+ auto alpha = args[3]->BooleanValue(isolate);
926
891
 
927
- canvas_native_webgl_color_mask(
928
- red,
929
- green,
930
- blue,
931
- alpha,
932
- ptr->GetState()
933
- );
934
- }
892
+ canvas_native_webgl_color_mask(
893
+ red,
894
+ green,
895
+ blue,
896
+ alpha,
897
+ ptr->GetState()
898
+ );
935
899
  }
936
900
 
937
901
  void WebGLRenderingContext::Commit(const v8::FunctionCallbackInfo<v8::Value> &args) {
@@ -947,14 +911,12 @@ void WebGLRenderingContext::CompileShader(const v8::FunctionCallbackInfo<v8::Val
947
911
  return;
948
912
  }
949
913
 
950
- if (args.Length() > 0) {
951
- auto shader = WebGLShader::GetPointer(args[0].As<v8::Object>());
952
- if (shader != nullptr) {
953
- canvas_native_webgl_compile_shader(
954
- shader->GetShader(),
955
- ptr->GetState()
956
- );
957
- }
914
+ auto shader = WebGLShader::GetPointer(args[0].As<v8::Object>());
915
+ if (shader != nullptr) {
916
+ canvas_native_webgl_compile_shader(
917
+ shader->GetShader(),
918
+ ptr->GetState()
919
+ );
958
920
  }
959
921
  }
960
922
 
@@ -970,12 +932,12 @@ void WebGLRenderingContext::CompressedTexImage2D(const v8::FunctionCallbackInfo<
970
932
  auto count = args.Length();
971
933
 
972
934
  if (count == 6) {
973
- auto target = (uint32_t) args[0]->NumberValue(context).ToChecked();
974
- auto level = (int32_t) args[1]->NumberValue(context).ToChecked();
975
- auto internalformat = (uint32_t) args[2]->NumberValue(context).ToChecked();
976
- auto width = (int32_t) args[3]->NumberValue(context).ToChecked();
977
- auto height = (int32_t) args[4]->NumberValue(context).ToChecked();
978
- auto border = (int32_t) args[5]->NumberValue(context).ToChecked();
935
+ auto target = args[0]->Uint32Value(context).ToChecked();
936
+ auto level = args[1]->Int32Value(context).ToChecked();
937
+ auto internalformat = args[2]->Uint32Value(context).ToChecked();
938
+ auto width = args[3]->Int32Value(context).ToChecked();
939
+ auto height = args[4]->Int32Value(context).ToChecked();
940
+ auto border = args[5]->Int32Value(context).ToChecked();
979
941
 
980
942
  canvas_native_webgl_compressed_tex_image2d_none(
981
943
  target,
@@ -987,12 +949,12 @@ void WebGLRenderingContext::CompressedTexImage2D(const v8::FunctionCallbackInfo<
987
949
  ptr->GetState()
988
950
  );
989
951
  } else if (count > 6) {
990
- auto target = (uint32_t) args[0]->NumberValue(context).ToChecked();
991
- auto level = (int32_t) args[1]->NumberValue(context).ToChecked();
992
- auto internalformat = (uint32_t) args[2]->NumberValue(context).ToChecked();
993
- auto width = (int32_t) args[3]->NumberValue(context).ToChecked();
994
- auto height = (int32_t) args[4]->NumberValue(context).ToChecked();
995
- auto border = (int32_t) args[5]->NumberValue(context).ToChecked();
952
+ auto target = args[0]->Uint32Value(context).ToChecked();
953
+ auto level = args[1]->Int32Value(context).ToChecked();
954
+ auto internalformat = args[2]->Uint32Value(context).ToChecked();
955
+ auto width = args[3]->Int32Value(context).ToChecked();
956
+ auto height = args[4]->Int32Value(context).ToChecked();
957
+ auto border = args[5]->Int32Value(context).ToChecked();
996
958
  auto pixels = args[6];
997
959
  if (pixels->IsObject()) {
998
960
  if (pixels->IsArrayBufferView()) {
@@ -1001,7 +963,7 @@ void WebGLRenderingContext::CompressedTexImage2D(const v8::FunctionCallbackInfo<
1001
963
  auto array = buf->Buffer();
1002
964
  auto offset = buf->ByteOffset();
1003
965
  auto size = buf->ByteLength();
1004
- auto data_ptr = static_cast<uint8_t*>(array->GetBackingStore()->Data()) + offset;
966
+ auto data_ptr = static_cast<uint8_t *>(array->GetBackingStore()->Data()) + offset;
1005
967
  auto data = static_cast<uint8_t *>((void *) data_ptr);
1006
968
 
1007
969
 
@@ -1047,55 +1009,50 @@ WebGLRenderingContext::CompressedTexSubImage2D(const v8::FunctionCallbackInfo<v8
1047
1009
  auto isolate = args.GetIsolate();
1048
1010
  auto context = isolate->GetCurrentContext();
1049
1011
 
1050
- auto count = args.Length();
1051
-
1052
-
1053
- if (count > 7) {
1054
- auto target = (uint32_t) args[0]->NumberValue(context).ToChecked();
1055
- auto level = (int32_t) args[1]->NumberValue(context).ToChecked();
1056
- auto xoffset = (int32_t) args[2]->NumberValue(context).ToChecked();
1057
- auto yoffset = (int32_t) args[3]->NumberValue(context).ToChecked();
1058
- auto width = (int32_t) args[4]->NumberValue(context).ToChecked();
1059
- auto height = (int32_t) args[5]->NumberValue(context).ToChecked();
1060
- auto format = (uint32_t) args[6]->NumberValue(context).ToChecked();
1061
- if (args[7]->IsObject()) {
1062
- auto pixels = args[7];
1063
- if (pixels->IsArrayBufferView()) {
1064
- auto buf = pixels.As<v8::ArrayBufferView>();
1065
- auto array = buf->Buffer();
1066
- auto offset = buf->ByteOffset();
1067
- auto size = array->ByteLength();
1068
- auto data_ptr = static_cast<uint8_t*>(array->GetBackingStore()->Data()) + offset;
1069
- auto data = static_cast<uint8_t *>((void *) data_ptr);
1012
+ auto target = args[0]->Uint32Value(context).ToChecked();
1013
+ auto level = args[1]->Int32Value(context).ToChecked();
1014
+ auto xoffset = args[2]->Int32Value(context).ToChecked();
1015
+ auto yoffset = args[3]->Int32Value(context).ToChecked();
1016
+ auto width = args[4]->Int32Value(context).ToChecked();
1017
+ auto height = args[5]->Int32Value(context).ToChecked();
1018
+ auto format = args[6]->Uint32Value(context).ToChecked();
1019
+ if (args[7]->IsObject()) {
1020
+ auto pixels = args[7];
1021
+ if (pixels->IsArrayBufferView()) {
1022
+ auto buf = pixels.As<v8::ArrayBufferView>();
1023
+ auto array = buf->Buffer();
1024
+ auto offset = buf->ByteOffset();
1025
+ auto size = array->ByteLength();
1026
+ auto data_ptr = static_cast<uint8_t *>(array->GetBackingStore()->Data()) + offset;
1027
+ auto data = static_cast<uint8_t *>((void *) data_ptr);
1070
1028
 
1071
- canvas_native_webgl_compressed_tex_sub_image2d(
1072
- target,
1073
- level,
1074
- xoffset,
1075
- yoffset,
1076
- width,
1077
- height,
1078
- format,
1079
- data, size,
1080
- ptr->GetState()
1081
- );
1082
- } else if (pixels->IsArrayBuffer()) {
1083
- auto array = pixels.As<v8::ArrayBuffer>();
1084
- auto size = array->ByteLength();
1085
- auto data = (uint8_t *) array->GetBackingStore()->Data();
1029
+ canvas_native_webgl_compressed_tex_sub_image2d(
1030
+ target,
1031
+ level,
1032
+ xoffset,
1033
+ yoffset,
1034
+ width,
1035
+ height,
1036
+ format,
1037
+ data, size,
1038
+ ptr->GetState()
1039
+ );
1040
+ } else if (pixels->IsArrayBuffer()) {
1041
+ auto array = pixels.As<v8::ArrayBuffer>();
1042
+ auto size = array->ByteLength();
1043
+ auto data = (uint8_t *) array->GetBackingStore()->Data();
1086
1044
 
1087
- canvas_native_webgl_compressed_tex_sub_image2d(
1088
- target,
1089
- level,
1090
- xoffset,
1091
- yoffset,
1092
- width,
1093
- height,
1094
- format,
1095
- data, size,
1096
- ptr->GetState()
1097
- );
1098
- }
1045
+ canvas_native_webgl_compressed_tex_sub_image2d(
1046
+ target,
1047
+ level,
1048
+ xoffset,
1049
+ yoffset,
1050
+ width,
1051
+ height,
1052
+ format,
1053
+ data, size,
1054
+ ptr->GetState()
1055
+ );
1099
1056
  }
1100
1057
  }
1101
1058
 
@@ -1113,28 +1070,26 @@ void WebGLRenderingContext::CopyTexImage2D(const v8::FunctionCallbackInfo<v8::Va
1113
1070
  auto count = args.Length();
1114
1071
 
1115
1072
 
1116
- if (count > 7) {
1117
- auto target = (uint32_t) args[0]->NumberValue(context).ToChecked();
1118
- auto level = (int32_t) args[1]->NumberValue(context).ToChecked();
1119
- auto internalformat = (uint32_t) args[2]->NumberValue(context).ToChecked();
1120
- auto x = (int32_t) args[3]->NumberValue(context).ToChecked();
1121
- auto y = (int32_t) args[4]->NumberValue(context).ToChecked();
1122
- auto width = (int32_t) args[5]->NumberValue(context).ToChecked();
1123
- auto height = (int32_t) args[6]->NumberValue(context).ToChecked();
1124
- auto border = (int32_t) args[7]->NumberValue(context).ToChecked();
1073
+ auto target = args[0]->Uint32Value(context).ToChecked();
1074
+ auto level = args[1]->Int32Value(context).ToChecked();
1075
+ auto internalformat = args[2]->Uint32Value(context).ToChecked();
1076
+ auto x = args[3]->Int32Value(context).ToChecked();
1077
+ auto y = args[4]->Int32Value(context).ToChecked();
1078
+ auto width = args[5]->Int32Value(context).ToChecked();
1079
+ auto height = args[6]->Int32Value(context).ToChecked();
1080
+ auto border = args[7]->Int32Value(context).ToChecked();
1125
1081
 
1126
- canvas_native_webgl_copy_tex_image2d(
1127
- target,
1128
- level,
1129
- internalformat,
1130
- x,
1131
- y,
1132
- width,
1133
- height,
1134
- border,
1135
- ptr->GetState()
1136
- );
1137
- }
1082
+ canvas_native_webgl_copy_tex_image2d(
1083
+ target,
1084
+ level,
1085
+ internalformat,
1086
+ x,
1087
+ y,
1088
+ width,
1089
+ height,
1090
+ border,
1091
+ ptr->GetState()
1092
+ );
1138
1093
 
1139
1094
  }
1140
1095
 
@@ -1150,28 +1105,26 @@ void WebGLRenderingContext::CopyTexSubImage2D(const v8::FunctionCallbackInfo<v8:
1150
1105
  auto count = args.Length();
1151
1106
 
1152
1107
 
1153
- if (count > 7) {
1154
- auto target = (uint32_t) args[0]->NumberValue(context).ToChecked();
1155
- auto level = (int32_t) args[1]->NumberValue(context).ToChecked();
1156
- auto xoffset = (int32_t) args[2]->NumberValue(context).ToChecked();
1157
- auto yoffset = (int32_t) args[3]->NumberValue(context).ToChecked();
1158
- auto x = (int32_t) args[4]->NumberValue(context).ToChecked();
1159
- auto y = (int32_t) args[5]->NumberValue(context).ToChecked();
1160
- auto width = (int32_t) args[6]->NumberValue(context).ToChecked();
1161
- auto height = (int32_t) args[7]->NumberValue(context).ToChecked();
1108
+ auto target = args[0]->Uint32Value(context).ToChecked();
1109
+ auto level = args[1]->Int32Value(context).ToChecked();
1110
+ auto xoffset = args[2]->Int32Value(context).ToChecked();
1111
+ auto yoffset = args[3]->Int32Value(context).ToChecked();
1112
+ auto x = args[4]->Int32Value(context).ToChecked();
1113
+ auto y = args[5]->Int32Value(context).ToChecked();
1114
+ auto width = args[6]->Int32Value(context).ToChecked();
1115
+ auto height = args[7]->Int32Value(context).ToChecked();
1162
1116
 
1163
- canvas_native_webgl_copy_tex_sub_image2d(
1164
- target,
1165
- level,
1166
- xoffset,
1167
- yoffset,
1168
- x,
1169
- y,
1170
- width,
1171
- height,
1172
- ptr->GetState()
1173
- );
1174
- }
1117
+ canvas_native_webgl_copy_tex_sub_image2d(
1118
+ target,
1119
+ level,
1120
+ xoffset,
1121
+ yoffset,
1122
+ x,
1123
+ y,
1124
+ width,
1125
+ height,
1126
+ ptr->GetState()
1127
+ );
1175
1128
 
1176
1129
  }
1177
1130
 
@@ -1284,7 +1237,7 @@ void WebGLRenderingContext::CreateShader(const v8::FunctionCallbackInfo<v8::Valu
1284
1237
  return;
1285
1238
  }
1286
1239
 
1287
- auto type = (uint32_t) args[0]->NumberValue(context).ToChecked();
1240
+ auto type = args[0]->Uint32Value(context).ToChecked();
1288
1241
  auto shader = canvas_native_webgl_create_shader(
1289
1242
  type, ptr->GetState());
1290
1243
  if (shader != 0) {
@@ -1331,14 +1284,12 @@ void WebGLRenderingContext::CullFace(const v8::FunctionCallbackInfo<v8::Value> &
1331
1284
  auto context = isolate->GetCurrentContext();
1332
1285
 
1333
1286
 
1334
- if (args.Length() > 0) {
1335
- auto mode = (uint32_t) args[0]->NumberValue(context).ToChecked();
1336
-
1337
- canvas_native_webgl_cull_face(
1338
- mode,
1339
- ptr->GetState()
1340
- );
1341
- }
1287
+ auto mode = args[0]->Uint32Value(context).ToChecked();
1288
+
1289
+ canvas_native_webgl_cull_face(
1290
+ mode,
1291
+ ptr->GetState()
1292
+ );
1342
1293
 
1343
1294
  }
1344
1295
 
@@ -1351,19 +1302,15 @@ void WebGLRenderingContext::DeleteBuffer(const v8::FunctionCallbackInfo<v8::Valu
1351
1302
  auto isolate = args.GetIsolate();
1352
1303
 
1353
1304
 
1354
- if (args.Length() > 0) {
1355
- auto value = args[0];
1356
- if (value->IsObject()) {
1357
- auto type = GetNativeType(isolate, value.As<v8::Object>());
1358
- if (type == NativeType::WebGLBuffer) {
1359
- auto buffer = WebGLBuffer::GetPointer(value.As<v8::Object>());
1360
- if (buffer != nullptr) {
1361
- canvas_native_webgl_delete_buffer(
1362
- buffer->GetBuffer(),
1363
- ptr->GetState()
1364
- );
1365
- }
1366
- }
1305
+ auto value = args[0];
1306
+ auto type = GetNativeType(isolate, value.As<v8::Object>());
1307
+ if (type == NativeType::WebGLBuffer) {
1308
+ auto buffer = WebGLBuffer::GetPointer(value.As<v8::Object>());
1309
+ if (buffer != nullptr) {
1310
+ canvas_native_webgl_delete_buffer(
1311
+ buffer->GetBuffer(),
1312
+ ptr->GetState()
1313
+ );
1367
1314
  }
1368
1315
  }
1369
1316
 
@@ -1501,14 +1448,12 @@ void WebGLRenderingContext::DepthFunc(const v8::FunctionCallbackInfo<v8::Value>
1501
1448
 
1502
1449
  auto value = args[0];
1503
1450
 
1504
- if (args.Length() > 0) {
1505
- auto func = (uint32_t) value->NumberValue(context).ToChecked();
1451
+ auto func = value->Uint32Value(context).ToChecked();
1506
1452
 
1507
- canvas_native_webgl_depth_func(
1508
- func,
1509
- ptr->GetState()
1510
- );
1511
- }
1453
+ canvas_native_webgl_depth_func(
1454
+ func,
1455
+ ptr->GetState()
1456
+ );
1512
1457
  }
1513
1458
 
1514
1459
  void WebGLRenderingContext::DepthMask(const v8::FunctionCallbackInfo<v8::Value> &args) {
@@ -1519,16 +1464,12 @@ void WebGLRenderingContext::DepthMask(const v8::FunctionCallbackInfo<v8::Value>
1519
1464
 
1520
1465
  auto isolate = args.GetIsolate();
1521
1466
 
1522
- auto value = args[0];
1523
-
1524
- if (args.Length() > 0) {
1525
- auto mask = value->BooleanValue(isolate);
1467
+ auto mask = args[0]->BooleanValue(isolate);
1526
1468
 
1527
- canvas_native_webgl_depth_mask(
1528
- mask,
1529
- ptr->GetState()
1530
- );
1531
- }
1469
+ canvas_native_webgl_depth_mask(
1470
+ mask,
1471
+ ptr->GetState()
1472
+ );
1532
1473
  }
1533
1474
 
1534
1475
  void WebGLRenderingContext::DepthRange(const v8::FunctionCallbackInfo<v8::Value> &args) {
@@ -1543,14 +1484,11 @@ void WebGLRenderingContext::DepthRange(const v8::FunctionCallbackInfo<v8::Value>
1543
1484
  auto zNear = args[0];
1544
1485
  auto zFar = args[1];
1545
1486
 
1546
- if (args.Length() > 1) {
1547
-
1548
- canvas_native_webgl_depth_range(
1549
- static_cast<float>(zNear->NumberValue(context).ToChecked()),
1550
- static_cast<float>(zFar->NumberValue(context).ToChecked()),
1551
- ptr->GetState()
1552
- );
1553
- }
1487
+ canvas_native_webgl_depth_range(
1488
+ static_cast<float>(zNear->NumberValue(context).ToChecked()),
1489
+ static_cast<float>(zFar->NumberValue(context).ToChecked()),
1490
+ ptr->GetState()
1491
+ );
1554
1492
  }
1555
1493
 
1556
1494
  void WebGLRenderingContext::DetachShader(const v8::FunctionCallbackInfo<v8::Value> &args) {
@@ -1565,27 +1503,24 @@ void WebGLRenderingContext::DetachShader(const v8::FunctionCallbackInfo<v8::Valu
1565
1503
  auto programValue = args[0];
1566
1504
  auto shaderValue = args[1];
1567
1505
 
1568
- if (programValue->IsObject() &&
1569
- shaderValue->IsObject()) {
1570
- auto programType = GetNativeType(isolate, programValue);
1571
- auto shaderType = GetNativeType(isolate, shaderValue);
1572
- WebGLProgram *program = nullptr;
1573
- WebGLShader *shader = nullptr;
1574
- if (programType == NativeType::WebGLProgram) {
1575
- program = WebGLProgram::GetPointer(programValue.As<v8::Object>());
1576
- }
1577
- if (shaderType == NativeType::WebGLShader) {
1578
- shader = WebGLShader::GetPointer(shaderValue.As<v8::Object>());
1579
- }
1506
+ auto programType = GetNativeType(isolate, programValue);
1507
+ auto shaderType = GetNativeType(isolate, shaderValue);
1508
+ WebGLProgram *program = nullptr;
1509
+ WebGLShader *shader = nullptr;
1510
+ if (programType == NativeType::WebGLProgram) {
1511
+ program = WebGLProgram::GetPointer(programValue.As<v8::Object>());
1512
+ }
1513
+ if (shaderType == NativeType::WebGLShader) {
1514
+ shader = WebGLShader::GetPointer(shaderValue.As<v8::Object>());
1515
+ }
1580
1516
 
1581
- if (program != nullptr &&
1582
- shader != nullptr) {
1583
- canvas_native_webgl_detach_shader(
1584
- program->GetProgram(),
1585
- shader->GetShader(),
1586
- ptr->GetState()
1587
- );
1588
- }
1517
+ if (program != nullptr &&
1518
+ shader != nullptr) {
1519
+ canvas_native_webgl_detach_shader(
1520
+ program->GetProgram(),
1521
+ shader->GetShader(),
1522
+ ptr->GetState()
1523
+ );
1589
1524
  }
1590
1525
  }
1591
1526
 
@@ -1600,7 +1535,7 @@ WebGLRenderingContext::DisableVertexAttribArray(const v8::FunctionCallbackInfo<v
1600
1535
  auto context = isolate->GetCurrentContext();
1601
1536
 
1602
1537
 
1603
- auto index = (uint32_t) args[0]->NumberValue(context).ToChecked();
1538
+ auto index = args[0]->Uint32Value(context).ToChecked();
1604
1539
 
1605
1540
  canvas_native_webgl_disable_vertex_attrib_array(
1606
1541
  index,
@@ -1617,7 +1552,7 @@ void WebGLRenderingContext::Disable(const v8::FunctionCallbackInfo<v8::Value> &a
1617
1552
  auto isolate = args.GetIsolate();
1618
1553
  auto context = isolate->GetCurrentContext();
1619
1554
 
1620
- auto cap = (uint32_t) args[0]->NumberValue(context).ToChecked();
1555
+ auto cap = args[0]->Uint32Value(context).ToChecked();
1621
1556
 
1622
1557
  canvas_native_webgl_disable(
1623
1558
  cap,
@@ -1634,9 +1569,9 @@ void WebGLRenderingContext::DrawArrays(const v8::FunctionCallbackInfo<v8::Value>
1634
1569
  auto isolate = args.GetIsolate();
1635
1570
  auto context = isolate->GetCurrentContext();
1636
1571
 
1637
- auto mode = (uint32_t) args[0]->NumberValue(context).ToChecked();
1638
- auto first = (int32_t) args[1]->NumberValue(context).ToChecked();
1639
- auto count = (int32_t) args[2]->NumberValue(context).ToChecked();
1572
+ auto mode = args[0]->Uint32Value(context).ToChecked();
1573
+ auto first = args[1]->Int32Value(context).ToChecked();
1574
+ auto count = args[2]->Int32Value(context).ToChecked();
1640
1575
 
1641
1576
  canvas_native_webgl_draw_arrays(
1642
1577
  mode,
@@ -1657,9 +1592,9 @@ void WebGLRenderingContext::DrawElements(const v8::FunctionCallbackInfo<v8::Valu
1657
1592
  auto context = isolate->GetCurrentContext();
1658
1593
 
1659
1594
 
1660
- auto mode = (uint32_t) args[0]->NumberValue(context).ToChecked();
1661
- auto count = (int32_t) args[1]->NumberValue(context).ToChecked();
1662
- auto type = (uint32_t) args[2]->NumberValue(context).ToChecked();
1595
+ auto mode = args[0]->Uint32Value(context).ToChecked();
1596
+ auto count = args[1]->Int32Value(context).ToChecked();
1597
+ auto type = args[2]->Int32Value(context).ToChecked();
1663
1598
  auto offset = args[3]->NumberValue(context).ToChecked();
1664
1599
 
1665
1600
  canvas_native_webgl_draw_elements(
@@ -1682,7 +1617,7 @@ WebGLRenderingContext::EnableVertexAttribArray(const v8::FunctionCallbackInfo<v8
1682
1617
  auto isolate = args.GetIsolate();
1683
1618
  auto context = isolate->GetCurrentContext();
1684
1619
 
1685
- auto index = (uint32_t) args[0]->NumberValue(context).ToChecked();
1620
+ auto index = args[0]->Uint32Value(context).ToChecked();
1686
1621
 
1687
1622
  canvas_native_webgl_enable_vertex_attrib_array(
1688
1623
  index,
@@ -1699,7 +1634,7 @@ void WebGLRenderingContext::Enable(const v8::FunctionCallbackInfo<v8::Value> &ar
1699
1634
  auto isolate = args.GetIsolate();
1700
1635
  auto context = isolate->GetCurrentContext();
1701
1636
 
1702
- auto cap = (uint32_t) args[0]->NumberValue(context).ToChecked();
1637
+ auto cap = args[0]->Uint32Value(context).ToChecked();
1703
1638
 
1704
1639
  canvas_native_webgl_enable(
1705
1640
  cap,
@@ -1739,9 +1674,9 @@ WebGLRenderingContext::FramebufferRenderbuffer(const v8::FunctionCallbackInfo<v8
1739
1674
  auto isolate = args.GetIsolate();
1740
1675
  auto context = isolate->GetCurrentContext();
1741
1676
 
1742
- auto target = (uint32_t) args[0]->NumberValue(context).ToChecked();
1743
- auto attachment = (uint32_t) args[1]->NumberValue(context).ToChecked();
1744
- auto renderbuffertarget = (uint32_t) args[2]->NumberValue(context).ToChecked();
1677
+ auto target = args[0]->Uint32Value(context).ToChecked();
1678
+ auto attachment = args[1]->Uint32Value(context).ToChecked();
1679
+ auto renderbuffertarget = args[2]->Uint32Value(context).ToChecked();
1745
1680
  auto renderbufferValue = args[3];
1746
1681
  auto type = GetNativeType(isolate, renderbufferValue);
1747
1682
  if (type == NativeType::WebGLRenderbuffer) {
@@ -1767,10 +1702,10 @@ void WebGLRenderingContext::FramebufferTexture2D(const v8::FunctionCallbackInfo<
1767
1702
  auto isolate = args.GetIsolate();
1768
1703
  auto context = isolate->GetCurrentContext();
1769
1704
 
1770
- auto target = (uint32_t) args[0]->NumberValue(context).ToChecked();
1771
- auto attachment = (uint32_t) args[1]->NumberValue(context).ToChecked();
1772
- auto textarget = (uint32_t) args[2]->NumberValue(context).ToChecked();
1773
- auto level = (int32_t) args[4]->NumberValue(context).ToChecked();
1705
+ auto target = args[0]->Uint32Value(context).ToChecked();
1706
+ auto attachment = args[1]->Uint32Value(context).ToChecked();
1707
+ auto textarget = args[2]->Uint32Value(context).ToChecked();
1708
+ auto level = args[4]->Int32Value(context).ToChecked();
1774
1709
  auto textureValue = args[3];
1775
1710
  auto type = GetNativeType(isolate, textureValue);
1776
1711
  if (type == NativeType::WebGLTexture) {
@@ -1797,7 +1732,7 @@ void WebGLRenderingContext::FrontFace(const v8::FunctionCallbackInfo<v8::Value>
1797
1732
  auto isolate = args.GetIsolate();
1798
1733
  auto context = isolate->GetCurrentContext();
1799
1734
 
1800
- auto mode = (uint32_t) args[0]->NumberValue(context).ToChecked();
1735
+ auto mode = args[0]->Uint32Value(context).ToChecked();
1801
1736
 
1802
1737
  canvas_native_webgl_front_face(
1803
1738
  mode,
@@ -1814,7 +1749,7 @@ void WebGLRenderingContext::GenerateMipmap(const v8::FunctionCallbackInfo<v8::Va
1814
1749
  auto isolate = args.GetIsolate();
1815
1750
  auto context = isolate->GetCurrentContext();
1816
1751
 
1817
- auto target = (uint32_t) args[0]->NumberValue(context).ToChecked();
1752
+ auto target = args[0]->Uint32Value(context).ToChecked();
1818
1753
 
1819
1754
  canvas_native_webgl_generate_mipmap(
1820
1755
  target,
@@ -1834,7 +1769,7 @@ void WebGLRenderingContext::GetActiveAttrib(const v8::FunctionCallbackInfo<v8::V
1834
1769
  auto programValue = args[0];
1835
1770
  auto type = GetNativeType(isolate, programValue);
1836
1771
  if (type == NativeType::WebGLProgram) {
1837
- auto index = (int32_t) args[1]->NumberValue(context).ToChecked();
1772
+ auto index = args[1]->Int32Value(context).ToChecked();
1838
1773
  auto program = WebGLProgram::GetPointer(programValue.As<v8::Object>());
1839
1774
  if (program != nullptr) {
1840
1775
  auto info = canvas_native_webgl_get_active_attrib(
@@ -1865,7 +1800,7 @@ void WebGLRenderingContext::GetActiveUniform(const v8::FunctionCallbackInfo<v8::
1865
1800
  auto programValue = args[0];
1866
1801
  auto type = GetNativeType(isolate, programValue);
1867
1802
  if (type == NativeType::WebGLProgram) {
1868
- auto index = (int32_t) args[1]->NumberValue(
1803
+ auto index = args[1]->Int32Value(
1869
1804
  context).ToChecked();
1870
1805
  auto program = WebGLProgram::GetPointer(programValue.As<v8::Object>());
1871
1806
  if (program != nullptr) {
@@ -1963,23 +1898,18 @@ void WebGLRenderingContext::GetBufferParameter(const v8::FunctionCallbackInfo<v8
1963
1898
  auto isolate = args.GetIsolate();
1964
1899
  auto context = isolate->GetCurrentContext();
1965
1900
 
1966
- if (args.Length() > 1) {
1967
- auto target = (uint32_t) args[0]->NumberValue(
1968
- context).ToChecked();
1969
- auto pname = (uint32_t) args[1]->NumberValue(
1970
- context).ToChecked();
1971
-
1972
- auto param = canvas_native_webgl_get_buffer_parameter(
1973
- target,
1974
- pname,
1975
- ptr->GetState()
1976
- );
1901
+ auto target = args[0]->Uint32Value(
1902
+ context).ToChecked();
1903
+ auto pname = args[1]->Uint32Value(
1904
+ context).ToChecked();
1977
1905
 
1978
- args.GetReturnValue().Set(param);
1979
- return;
1980
- }
1906
+ auto param = canvas_native_webgl_get_buffer_parameter(
1907
+ target,
1908
+ pname,
1909
+ ptr->GetState()
1910
+ );
1981
1911
 
1982
- args.GetReturnValue().SetUndefined();
1912
+ args.GetReturnValue().Set(param);
1983
1913
 
1984
1914
  }
1985
1915
 
@@ -2076,7 +2006,7 @@ void WebGLRenderingContext::GetError(const v8::FunctionCallbackInfo<v8::Value> &
2076
2006
  auto ret = canvas_native_webgl_get_error(
2077
2007
  ptr->GetState());
2078
2008
 
2079
- args.GetReturnValue().Set((int32_t) ret);
2009
+ args.GetReturnValue().Set(ret);
2080
2010
 
2081
2011
  }
2082
2012
 
@@ -2327,11 +2257,11 @@ void WebGLRenderingContext::GetFramebufferAttachmentParameter(
2327
2257
  auto isolate = args.GetIsolate();
2328
2258
  auto context = isolate->GetCurrentContext();
2329
2259
 
2330
- auto target = (uint32_t) args[0]->NumberValue(
2260
+ auto target = args[0]->Uint32Value(
2331
2261
  context).ToChecked();
2332
- auto attachment = (uint32_t) args[1]->NumberValue(
2262
+ auto attachment = args[1]->Uint32Value(
2333
2263
  context).ToChecked();
2334
- auto pname = (uint32_t) args[2]->NumberValue(
2264
+ auto pname = args[2]->Uint32Value(
2335
2265
  context).ToChecked();
2336
2266
  auto ret = canvas_native_webgl_get_framebuffer_attachment_parameter(
2337
2267
  target,
@@ -2389,22 +2319,17 @@ void WebGLRenderingContext::GetParameter(const v8::FunctionCallbackInfo<v8::Valu
2389
2319
  auto isolate = args.GetIsolate();
2390
2320
  auto context = isolate->GetCurrentContext();
2391
2321
 
2392
- // TODO remove extra allocations
2393
- if (args.Length() > 0) {
2394
- auto pname = (uint32_t) args[0]->NumberValue(
2395
- context).ToChecked();
2396
- auto result = canvas_native_webgl_get_parameter(
2397
- pname,
2398
- ptr->GetState());
2322
+ auto pname = args[0]->Uint32Value(
2323
+ context).ToChecked();
2324
+ auto result = canvas_native_webgl_get_parameter(
2325
+ pname,
2326
+ ptr->GetState());
2399
2327
 
2400
- auto ret = ptr->GetParameterInternal(isolate, pname, result);
2328
+ auto ret = ptr->GetParameterInternal(isolate, pname, result);
2401
2329
 
2402
- canvas_native_webgl_WebGLResult_destroy(result);
2330
+ canvas_native_webgl_WebGLResult_destroy(result);
2403
2331
 
2404
- args.GetReturnValue().Set(ret);
2405
- return;
2406
- }
2407
- args.GetReturnValue().SetNull();
2332
+ args.GetReturnValue().Set(ret);
2408
2333
  }
2409
2334
 
2410
2335
  void WebGLRenderingContext::GetProgramInfoLog(const v8::FunctionCallbackInfo<v8::Value> &args) {
@@ -2416,31 +2341,28 @@ void WebGLRenderingContext::GetProgramInfoLog(const v8::FunctionCallbackInfo<v8:
2416
2341
 
2417
2342
  auto isolate = args.GetIsolate();
2418
2343
 
2419
- if (args.Length() > 0) {
2420
- auto programValue = args[0];
2421
- auto type = GetNativeType(isolate, programValue);
2422
- if (type == NativeType::WebGLProgram) {
2423
- auto program = WebGLProgram::GetPointer(programValue.As<v8::Object>());
2424
- if (program != nullptr) {
2425
- auto log = canvas_native_webgl_get_program_info_log(
2426
- program->GetProgram(),
2427
- ptr->GetState()
2428
- );
2429
-
2344
+ auto programValue = args[0];
2345
+ auto type = GetNativeType(isolate, programValue);
2346
+ if (type == NativeType::WebGLProgram) {
2347
+ auto program = WebGLProgram::GetPointer(programValue.As<v8::Object>());
2348
+ if (program != nullptr) {
2349
+ auto log = canvas_native_webgl_get_program_info_log(
2350
+ program->GetProgram(),
2351
+ ptr->GetState()
2352
+ );
2430
2353
 
2431
- if (strlen(log) == 0) {
2432
- args.GetReturnValue().SetEmptyString();
2433
- canvas_native_string_destroy((char *) log);
2434
- return;
2435
- }
2436
2354
 
2437
- args.GetReturnValue().Set(ConvertToV8OneByteString(isolate, (char *) log));
2355
+ if (strlen(log) == 0) {
2356
+ args.GetReturnValue().SetEmptyString();
2357
+ canvas_native_string_destroy((char *) log);
2438
2358
  return;
2439
2359
  }
2360
+
2361
+ args.GetReturnValue().Set(ConvertToV8OneByteString(isolate, (char *) log));
2362
+ return;
2440
2363
  }
2441
2364
  }
2442
2365
 
2443
- // todo check return
2444
2366
  args.GetReturnValue().SetEmptyString();
2445
2367
  }
2446
2368
 
@@ -2454,48 +2376,46 @@ void WebGLRenderingContext::GetProgramParameter(const v8::FunctionCallbackInfo<v
2454
2376
  auto isolate = args.GetIsolate();
2455
2377
  auto context = isolate->GetCurrentContext();
2456
2378
 
2457
- if (args.Length() > 1) {
2458
- auto programValue = args[0];
2459
- auto type = GetNativeType(isolate, programValue);
2460
- auto pname = (uint32_t) args[1]->NumberValue(
2461
- context).ToChecked();
2462
- if (type == NativeType::WebGLProgram) {
2463
- auto program = WebGLProgram::GetPointer(programValue.As<v8::Object>());
2464
- if (program != nullptr) {
2465
- auto ret = canvas_native_webgl_get_program_parameter(
2466
- program->GetProgram(),
2467
- pname,
2468
- ptr->GetState()
2469
- );
2379
+ auto programValue = args[0];
2380
+ auto type = GetNativeType(isolate, programValue);
2381
+ auto pname = args[1]->Uint32Value(
2382
+ context).ToChecked();
2383
+ if (type == NativeType::WebGLProgram) {
2384
+ auto program = WebGLProgram::GetPointer(programValue.As<v8::Object>());
2385
+ if (program != nullptr) {
2386
+ auto ret = canvas_native_webgl_get_program_parameter(
2387
+ program->GetProgram(),
2388
+ pname,
2389
+ ptr->GetState()
2390
+ );
2470
2391
 
2471
2392
 
2472
- if (canvas_native_webgl_result_get_is_none(
2473
- ret)) {
2474
- args.GetReturnValue().SetNull();
2393
+ if (canvas_native_webgl_result_get_is_none(
2394
+ ret)) {
2395
+ args.GetReturnValue().SetNull();
2396
+
2397
+ canvas_native_webgl_WebGLResult_destroy(ret);
2398
+ return;
2399
+ }
2400
+ switch (pname) {
2401
+ case GL_DELETE_STATUS:
2402
+ case GL_LINK_STATUS:
2403
+ case GL_VALIDATE_STATUS:
2404
+ args.GetReturnValue().Set(canvas_native_webgl_result_get_bool(
2405
+ ret));
2406
+ canvas_native_webgl_WebGLResult_destroy(ret);
2407
+ return;
2408
+ default:
2409
+ args.GetReturnValue().Set(canvas_native_webgl_result_get_i32(
2410
+ ret));
2475
2411
 
2476
2412
  canvas_native_webgl_WebGLResult_destroy(ret);
2477
2413
  return;
2478
- }
2479
- switch (pname) {
2480
- case GL_DELETE_STATUS:
2481
- case GL_LINK_STATUS:
2482
- case GL_VALIDATE_STATUS:
2483
- args.GetReturnValue().Set(canvas_native_webgl_result_get_bool(
2484
- ret));
2485
- canvas_native_webgl_WebGLResult_destroy(ret);
2486
- return;
2487
- default:
2488
- args.GetReturnValue().Set(canvas_native_webgl_result_get_i32(
2489
- ret));
2490
-
2491
- canvas_native_webgl_WebGLResult_destroy(ret);
2492
- return;
2493
- }
2494
2414
  }
2495
2415
  }
2496
2416
  }
2497
2417
 
2498
- // todo check return
2418
+
2499
2419
  args.GetReturnValue().SetNull();
2500
2420
  }
2501
2421
 
@@ -2511,9 +2431,9 @@ WebGLRenderingContext::GetRenderbufferParameter(const v8::FunctionCallbackInfo<v
2511
2431
  auto context = isolate->GetCurrentContext();
2512
2432
 
2513
2433
  if (args.Length() > 1) {
2514
- auto target = (uint32_t) args[0]->NumberValue(
2434
+ auto target = args[0]->Uint32Value(
2515
2435
  context).ToChecked();
2516
- auto pname = (uint32_t) args[1]->NumberValue(
2436
+ auto pname = args[1]->Uint32Value(
2517
2437
  context).ToChecked();
2518
2438
  auto ret = canvas_native_webgl_get_renderbuffer_parameter(
2519
2439
  target,
@@ -2537,31 +2457,28 @@ void WebGLRenderingContext::GetShaderInfoLog(const v8::FunctionCallbackInfo<v8::
2537
2457
 
2538
2458
  auto isolate = args.GetIsolate();
2539
2459
 
2540
- if (args.Length() > 0) {
2541
- auto value = args[0];
2542
- auto type = GetNativeType(isolate, value);
2543
- if (type == NativeType::WebGLShader) {
2544
- auto shader = WebGLShader::GetPointer(value.As<v8::Object>());
2545
- if (shader != nullptr) {
2546
- auto log = canvas_native_webgl_get_shader_info_log(
2547
- shader->GetShader(),
2548
- ptr->GetState()
2549
- );
2550
-
2551
- if (strlen(log) == 0) {
2552
- args.GetReturnValue().SetEmptyString();
2553
- canvas_native_string_destroy((char *) log);
2554
- return;
2555
- }
2556
-
2557
- args.GetReturnValue().Set(ConvertToV8OneByteString(isolate, (char *) log));
2460
+ auto value = args[0];
2461
+ auto type = GetNativeType(isolate, value);
2462
+ if (type == NativeType::WebGLShader) {
2463
+ auto shader = WebGLShader::GetPointer(value.As<v8::Object>());
2464
+ if (shader != nullptr) {
2465
+ auto log = canvas_native_webgl_get_shader_info_log(
2466
+ shader->GetShader(),
2467
+ ptr->GetState()
2468
+ );
2558
2469
 
2470
+ if (strlen(log) == 0) {
2471
+ args.GetReturnValue().SetEmptyString();
2472
+ canvas_native_string_destroy((char *) log);
2559
2473
  return;
2560
2474
  }
2475
+
2476
+ args.GetReturnValue().Set(ConvertToV8OneByteString(isolate, (char *) log));
2477
+
2478
+ return;
2561
2479
  }
2562
2480
  }
2563
2481
 
2564
- // todo check return
2565
2482
  args.GetReturnValue().SetEmptyString();
2566
2483
  }
2567
2484
 
@@ -2575,50 +2492,48 @@ void WebGLRenderingContext::GetShaderParameter(const v8::FunctionCallbackInfo<v8
2575
2492
  auto isolate = args.GetIsolate();
2576
2493
  auto context = isolate->GetCurrentContext();
2577
2494
 
2578
- if (args.Length() > 1) {
2579
- auto value = args[0];
2580
- auto type = GetNativeType(isolate, value);
2581
- auto pname = (uint32_t) args[1]->NumberValue(
2582
- context).ToChecked();
2583
- if (type == NativeType::WebGLShader) {
2584
- auto shader = WebGLShader::GetPointer(value.As<v8::Object>());
2585
- if (shader != nullptr) {
2586
- auto ret = canvas_native_webgl_get_shader_parameter(
2587
- shader->GetShader(),
2588
- pname,
2589
- ptr->GetState()
2590
- );
2591
-
2592
- if (canvas_native_webgl_result_get_is_none(
2593
- ret)) {
2594
- args.GetReturnValue().SetNull();
2595
-
2596
- canvas_native_webgl_WebGLResult_destroy(ret);
2597
- return;
2598
- }
2495
+ auto value = args[0];
2496
+ auto type = GetNativeType(isolate, value);
2497
+ auto pname = args[1]->Uint32Value(
2498
+ context).ToChecked();
2499
+ if (type == NativeType::WebGLShader) {
2500
+ auto shader = WebGLShader::GetPointer(value.As<v8::Object>());
2501
+ if (shader != nullptr) {
2502
+ auto ret = canvas_native_webgl_get_shader_parameter(
2503
+ shader->GetShader(),
2504
+ pname,
2505
+ ptr->GetState()
2506
+ );
2599
2507
 
2600
- if (pname ==
2601
- GL_DELETE_STATUS ||
2602
- pname ==
2603
- GL_COMPILE_STATUS) {
2604
- args.GetReturnValue().Set(canvas_native_webgl_result_get_bool(
2605
- ret));
2508
+ if (canvas_native_webgl_result_get_is_none(
2509
+ ret)) {
2510
+ args.GetReturnValue().SetNull();
2606
2511
 
2607
- canvas_native_webgl_WebGLResult_destroy(ret);
2608
- return;
2609
- }
2512
+ canvas_native_webgl_WebGLResult_destroy(ret);
2513
+ return;
2514
+ }
2610
2515
 
2611
- args.GetReturnValue().Set(canvas_native_webgl_result_get_i32(
2516
+ if (pname ==
2517
+ GL_DELETE_STATUS ||
2518
+ pname ==
2519
+ GL_COMPILE_STATUS) {
2520
+ args.GetReturnValue().Set(canvas_native_webgl_result_get_bool(
2612
2521
  ret));
2613
2522
 
2614
2523
  canvas_native_webgl_WebGLResult_destroy(ret);
2615
-
2616
2524
  return;
2617
2525
  }
2526
+
2527
+ args.GetReturnValue().Set(canvas_native_webgl_result_get_i32(
2528
+ ret));
2529
+
2530
+ canvas_native_webgl_WebGLResult_destroy(ret);
2531
+
2532
+ return;
2618
2533
  }
2619
2534
  }
2620
2535
 
2621
- // todo check return
2536
+
2622
2537
  args.GetReturnValue().SetNull();
2623
2538
  }
2624
2539
 
@@ -2633,25 +2548,19 @@ WebGLRenderingContext::GetShaderPrecisionFormat(const v8::FunctionCallbackInfo<v
2633
2548
  auto isolate = args.GetIsolate();
2634
2549
  auto context = isolate->GetCurrentContext();
2635
2550
 
2636
- if (args.Length() > 1) {
2637
- auto shaderType = (uint32_t) args[0]->NumberValue(
2638
- context).ToChecked();
2639
- auto precisionType = (uint32_t) args[1]->NumberValue(
2640
- context).ToChecked();
2641
- auto ret = canvas_native_webgl_get_shader_precision_format(
2642
- shaderType,
2643
- precisionType,
2644
- ptr->GetState()
2645
- );
2646
- auto shader = WebGLShaderPrecisionFormatImpl::NewInstance(isolate,
2647
- new WebGLShaderPrecisionFormatImpl(
2648
- ret));
2649
- args.GetReturnValue().Set(shader);
2650
- return;
2651
- }
2652
-
2653
- // todo check return
2654
- args.GetReturnValue().SetNull();
2551
+ auto shaderType = args[0]->Uint32Value(
2552
+ context).ToChecked();
2553
+ auto precisionType = args[1]->Uint32Value(
2554
+ context).ToChecked();
2555
+ auto ret = canvas_native_webgl_get_shader_precision_format(
2556
+ shaderType,
2557
+ precisionType,
2558
+ ptr->GetState()
2559
+ );
2560
+ auto shader = WebGLShaderPrecisionFormatImpl::NewInstance(isolate,
2561
+ new WebGLShaderPrecisionFormatImpl(
2562
+ ret));
2563
+ args.GetReturnValue().Set(shader);
2655
2564
  }
2656
2565
 
2657
2566
  void WebGLRenderingContext::GetShaderSource(const v8::FunctionCallbackInfo<v8::Value> &args) {
@@ -2663,30 +2572,27 @@ void WebGLRenderingContext::GetShaderSource(const v8::FunctionCallbackInfo<v8::V
2663
2572
 
2664
2573
  auto isolate = args.GetIsolate();
2665
2574
 
2666
- if (args.Length() > 0) {
2667
- auto value = args[0];
2668
- auto type = GetNativeType(isolate, value);
2669
- if (type == NativeType::WebGLShader) {
2670
- auto shader = WebGLShader::GetPointer(value.As<v8::Object>());
2671
-
2672
- if (shader != nullptr) {
2673
- auto source = canvas_native_webgl_get_shader_source(
2674
- shader->GetShader(),
2675
- ptr->GetState()
2676
- );
2575
+ auto value = args[0];
2576
+ auto type = GetNativeType(isolate, value);
2577
+ if (type == NativeType::WebGLShader) {
2578
+ auto shader = WebGLShader::GetPointer(value.As<v8::Object>());
2677
2579
 
2678
- if (strlen(source) == 0) {
2679
- args.GetReturnValue().SetEmptyString();
2680
- canvas_native_string_destroy((char *) source);
2681
- return;
2682
- }
2580
+ if (shader != nullptr) {
2581
+ auto source = canvas_native_webgl_get_shader_source(
2582
+ shader->GetShader(),
2583
+ ptr->GetState()
2584
+ );
2683
2585
 
2684
- args.GetReturnValue().Set(ConvertToV8OneByteString(isolate, (char *) source));
2586
+ if (strlen(source) == 0) {
2587
+ args.GetReturnValue().SetEmptyString();
2588
+ canvas_native_string_destroy((char *) source);
2685
2589
  return;
2686
2590
  }
2591
+
2592
+ args.GetReturnValue().Set(ConvertToV8OneByteString(isolate, (char *) source));
2593
+ return;
2687
2594
  }
2688
2595
  }
2689
-
2690
2596
  // todo check return
2691
2597
  args.GetReturnValue().SetEmptyString();
2692
2598
  }
@@ -2751,22 +2657,16 @@ WebGLRenderingContext::GetTexParameter(const v8::FunctionCallbackInfo<v8::Value>
2751
2657
  auto isolate = args.GetIsolate();
2752
2658
  auto context = isolate->GetCurrentContext();
2753
2659
 
2754
- if (args.Length() > 1) {
2755
- auto target = (uint32_t) args[0]->NumberValue(
2756
- context).ToChecked();
2757
- auto pname = (uint32_t) args[1]->NumberValue(
2758
- context).ToChecked();
2759
- auto ret = canvas_native_webgl_get_tex_parameter(
2760
- target,
2761
- pname,
2762
- ptr->GetState()
2763
- );
2764
- args.GetReturnValue().Set(ret);
2765
- return;
2766
- }
2767
-
2768
- // todo check return
2769
- args.GetReturnValue().SetNull();
2660
+ auto target = args[0]->Uint32Value(
2661
+ context).ToChecked();
2662
+ auto pname = args[1]->Uint32Value(
2663
+ context).ToChecked();
2664
+ auto ret = canvas_native_webgl_get_tex_parameter(
2665
+ target,
2666
+ pname,
2667
+ ptr->GetState()
2668
+ );
2669
+ args.GetReturnValue().Set(ret);
2770
2670
  }
2771
2671
 
2772
2672
  void
@@ -2779,27 +2679,25 @@ WebGLRenderingContext::GetUniformLocation(const v8::FunctionCallbackInfo<v8::Val
2779
2679
 
2780
2680
  auto isolate = args.GetIsolate();
2781
2681
 
2782
- if (args.Length() > 1) {
2783
- auto programValue = args[0];
2784
- auto type = GetNativeType(isolate, programValue);
2785
- auto nameValue = args[1];
2786
- if (type == NativeType::WebGLProgram && nameValue->IsString()) {
2787
- auto program = WebGLProgram::GetPointer(programValue.As<v8::Object>());
2788
- if (program != nullptr) {
2789
- auto name = ConvertFromV8String(isolate, args[1]);
2790
-
2791
- auto ret = canvas_native_webgl_get_uniform_location(
2792
- program->GetProgram(),
2793
- name.c_str(),
2794
- ptr->GetState()
2795
- );
2682
+ auto programValue = args[0];
2683
+ auto type = GetNativeType(isolate, programValue);
2684
+ auto nameValue = args[1];
2685
+ if (type == NativeType::WebGLProgram && nameValue->IsString()) {
2686
+ auto program = WebGLProgram::GetPointer(programValue.As<v8::Object>());
2687
+ if (program != nullptr) {
2688
+ auto name = ConvertFromV8String(isolate, args[1]);
2796
2689
 
2797
- auto location = WebGLUniformLocation::NewInstance(isolate, new WebGLUniformLocation(
2798
- ret));
2690
+ auto ret = canvas_native_webgl_get_uniform_location(
2691
+ program->GetProgram(),
2692
+ name.c_str(),
2693
+ ptr->GetState()
2694
+ );
2799
2695
 
2800
- args.GetReturnValue().Set(location);
2801
- return;
2802
- }
2696
+ auto location = WebGLUniformLocation::NewInstance(isolate, new WebGLUniformLocation(
2697
+ ret));
2698
+
2699
+ args.GetReturnValue().Set(location);
2700
+ return;
2803
2701
  }
2804
2702
  }
2805
2703
 
@@ -2818,183 +2716,181 @@ WebGLRenderingContext::GetUniform(const v8::FunctionCallbackInfo<v8::Value> &arg
2818
2716
  auto isolate = args.GetIsolate();
2819
2717
  auto context = isolate->GetCurrentContext();
2820
2718
 
2821
- if (args.Length() > 1) {
2822
- auto programValue = args[0];
2823
- auto programType = GetNativeType(isolate, programValue);
2824
- auto locationValue = args[1];
2825
- auto locationType = GetNativeType(isolate, locationValue);
2826
- if (programType == NativeType::WebGLProgram &&
2827
- locationType == NativeType::WebGLUniformLocation) {
2719
+ auto programValue = args[0];
2720
+ auto programType = GetNativeType(isolate, programValue);
2721
+ auto locationValue = args[1];
2722
+ auto locationType = GetNativeType(isolate, locationValue);
2723
+ if (programType == NativeType::WebGLProgram &&
2724
+ locationType == NativeType::WebGLUniformLocation) {
2828
2725
 
2829
- auto program = WebGLProgram::GetPointer(programValue.As<v8::Object>());
2830
- auto location = WebGLUniformLocation::GetPointer(locationValue.As<v8::Object>());
2726
+ auto program = WebGLProgram::GetPointer(programValue.As<v8::Object>());
2727
+ auto location = WebGLUniformLocation::GetPointer(locationValue.As<v8::Object>());
2831
2728
 
2832
2729
 
2833
- if (program != nullptr &&
2834
- location != nullptr) {
2730
+ if (program != nullptr &&
2731
+ location != nullptr) {
2835
2732
 
2836
- auto val = canvas_native_webgl_get_uniform(
2837
- program->GetProgram(),
2838
- location->GetUniformLocation(),
2839
- ptr->GetState());
2733
+ auto val = canvas_native_webgl_get_uniform(
2734
+ program->GetProgram(),
2735
+ location->GetUniformLocation(),
2736
+ ptr->GetState());
2840
2737
 
2841
- switch (canvas_native_webgl_result_get_type(
2842
- val)) {
2843
- case WebGLResultType::WebGLResultTypeBoolean:
2844
- args.GetReturnValue().Set(canvas_native_webgl_result_get_bool(
2845
- val));
2846
- canvas_native_webgl_WebGLResult_destroy(val);
2847
- return;
2848
- case WebGLResultType::WebGLResultTypeNone:
2849
- args.GetReturnValue().SetNull();
2850
- canvas_native_webgl_WebGLResult_destroy(val);
2851
- return;
2852
- case WebGLResultType::WebGLResultTypeString: {
2853
- auto str = canvas_native_webgl_result_get_string(
2854
- val);
2855
-
2856
- args.GetReturnValue().Set(
2857
- ConvertToV8OneByteString(isolate, (char *) str));
2858
- canvas_native_webgl_WebGLResult_destroy(val);
2859
- return;
2860
- }
2861
- case WebGLResultType::WebGLResultTypeBooleanArray: {
2862
- auto ret = canvas_native_webgl_result_get_bool_array(
2863
- val);
2864
- auto len = canvas_native_u8_buffer_get_length(ret);
2865
- auto buf = canvas_native_u8_buffer_get_bytes(ret);
2866
- auto array = v8::Array::New(
2867
- isolate, (int) len);
2868
- for (int i = 0;
2869
- i < len; ++i) {
2870
- auto item = buf[i];
2871
- array->Set(
2872
- context, i,
2873
- v8::Boolean::New(isolate,
2874
- item ==
2875
- 1));
2876
- }
2877
- args.GetReturnValue().Set(array);
2878
- canvas_native_webgl_WebGLResult_destroy(val);
2879
- return;
2738
+ switch (canvas_native_webgl_result_get_type(
2739
+ val)) {
2740
+ case WebGLResultType::WebGLResultTypeBoolean:
2741
+ args.GetReturnValue().Set(canvas_native_webgl_result_get_bool(
2742
+ val));
2743
+ canvas_native_webgl_WebGLResult_destroy(val);
2744
+ return;
2745
+ case WebGLResultType::WebGLResultTypeNone:
2746
+ args.GetReturnValue().SetNull();
2747
+ canvas_native_webgl_WebGLResult_destroy(val);
2748
+ return;
2749
+ case WebGLResultType::WebGLResultTypeString: {
2750
+ auto str = canvas_native_webgl_result_get_string(
2751
+ val);
2752
+
2753
+ args.GetReturnValue().Set(
2754
+ ConvertToV8OneByteString(isolate, (char *) str));
2755
+ canvas_native_webgl_WebGLResult_destroy(val);
2756
+ return;
2757
+ }
2758
+ case WebGLResultType::WebGLResultTypeBooleanArray: {
2759
+ auto ret = canvas_native_webgl_result_get_bool_array(
2760
+ val);
2761
+ auto len = canvas_native_u8_buffer_get_length(ret);
2762
+ auto buf = canvas_native_u8_buffer_get_bytes(ret);
2763
+ auto array = v8::Array::New(
2764
+ isolate, (int) len);
2765
+ for (int i = 0;
2766
+ i < len; ++i) {
2767
+ auto item = buf[i];
2768
+ array->Set(
2769
+ context, i,
2770
+ v8::Boolean::New(isolate,
2771
+ item ==
2772
+ 1));
2880
2773
  }
2881
- case WebGLResultType::WebGLResultTypeF32Array: {
2882
- auto ret = canvas_native_webgl_result_get_f32_array(
2883
- val);
2774
+ args.GetReturnValue().Set(array);
2775
+ canvas_native_webgl_WebGLResult_destroy(val);
2776
+ return;
2777
+ }
2778
+ case WebGLResultType::WebGLResultTypeF32Array: {
2779
+ auto ret = canvas_native_webgl_result_get_f32_array(
2780
+ val);
2884
2781
 
2885
2782
 
2886
- auto buf = (uint8_t *) canvas_native_f32_buffer_get_bytes_mut(ret);
2887
- auto size = canvas_native_f32_buffer_get_length(ret);
2888
- auto bytes_size = size * sizeof(float);
2783
+ auto buf = (uint8_t *) canvas_native_f32_buffer_get_bytes_mut(ret);
2784
+ auto size = canvas_native_f32_buffer_get_length(ret);
2785
+ auto bytes_size = size * sizeof(float);
2889
2786
 
2890
2787
 
2891
- auto store = v8::ArrayBuffer::NewBackingStore(buf,
2892
- bytes_size,
2893
- [](void *data, size_t length,
2894
- void *deleter_data) {
2895
- if (deleter_data !=
2896
- nullptr) {
2897
- canvas_native_f32_buffer_destroy(
2898
- (F32Buffer *) deleter_data);
2899
- }
2900
- },
2901
- ret);
2788
+ auto store = v8::ArrayBuffer::NewBackingStore(buf,
2789
+ bytes_size,
2790
+ [](void *data, size_t length,
2791
+ void *deleter_data) {
2792
+ if (deleter_data !=
2793
+ nullptr) {
2794
+ canvas_native_f32_buffer_destroy(
2795
+ (F32Buffer *) deleter_data);
2796
+ }
2797
+ },
2798
+ ret);
2902
2799
 
2903
- auto arraybuffer = v8::ArrayBuffer::New(isolate, std::move(store));
2800
+ auto arraybuffer = v8::ArrayBuffer::New(isolate, std::move(store));
2904
2801
 
2905
- args.GetReturnValue().Set(
2906
- v8::Float32Array::New(arraybuffer, 0, size)
2907
- );
2802
+ args.GetReturnValue().Set(
2803
+ v8::Float32Array::New(arraybuffer, 0, size)
2804
+ );
2908
2805
 
2909
- canvas_native_webgl_WebGLResult_destroy(val);
2806
+ canvas_native_webgl_WebGLResult_destroy(val);
2910
2807
 
2911
- return;
2912
- }
2913
- case WebGLResultType::WebGLResultTypeI32Array: {
2914
- auto ret = canvas_native_webgl_result_get_i32_array(
2915
- val);
2808
+ return;
2809
+ }
2810
+ case WebGLResultType::WebGLResultTypeI32Array: {
2811
+ auto ret = canvas_native_webgl_result_get_i32_array(
2812
+ val);
2916
2813
 
2917
2814
 
2918
- auto buf = (uint8_t *) canvas_native_i32_buffer_get_bytes_mut(ret);
2919
- auto size = canvas_native_i32_buffer_get_length(ret);
2920
- auto bytes_size = size * sizeof(int32_t);
2815
+ auto buf = (uint8_t *) canvas_native_i32_buffer_get_bytes_mut(ret);
2816
+ auto size = canvas_native_i32_buffer_get_length(ret);
2817
+ auto bytes_size = size * sizeof(int32_t);
2921
2818
 
2922
2819
 
2923
- auto store = v8::ArrayBuffer::NewBackingStore(buf, bytes_size,
2924
- [](void *data, size_t length,
2925
- void *deleter_data) {
2926
- if (deleter_data !=
2927
- nullptr) {
2928
- canvas_native_i32_buffer_destroy(
2929
- (I32Buffer *) deleter_data);
2930
- }
2931
- },
2932
- ret);
2820
+ auto store = v8::ArrayBuffer::NewBackingStore(buf, bytes_size,
2821
+ [](void *data, size_t length,
2822
+ void *deleter_data) {
2823
+ if (deleter_data !=
2824
+ nullptr) {
2825
+ canvas_native_i32_buffer_destroy(
2826
+ (I32Buffer *) deleter_data);
2827
+ }
2828
+ },
2829
+ ret);
2933
2830
 
2934
- auto arraybuffer = v8::ArrayBuffer::New(isolate, std::move(store));
2831
+ auto arraybuffer = v8::ArrayBuffer::New(isolate, std::move(store));
2935
2832
 
2936
2833
 
2937
- args.GetReturnValue().Set(
2938
- v8::Int32Array::New(arraybuffer, 0, size)
2939
- );
2834
+ args.GetReturnValue().Set(
2835
+ v8::Int32Array::New(arraybuffer, 0, size)
2836
+ );
2940
2837
 
2941
- canvas_native_webgl_WebGLResult_destroy(val);
2838
+ canvas_native_webgl_WebGLResult_destroy(val);
2942
2839
 
2943
- return;
2944
- }
2945
- case WebGLResultType::WebGLResultTypeU32Array: {
2946
- auto ret = canvas_native_webgl_result_get_u32_array(
2947
- val);
2840
+ return;
2841
+ }
2842
+ case WebGLResultType::WebGLResultTypeU32Array: {
2843
+ auto ret = canvas_native_webgl_result_get_u32_array(
2844
+ val);
2948
2845
 
2949
- auto buf = (uint8_t *) canvas_native_u32_buffer_get_bytes_mut(ret);
2950
- auto size = canvas_native_u32_buffer_get_length(ret);
2951
- auto bytes_size = size * sizeof(uint32_t);
2846
+ auto buf = (uint8_t *) canvas_native_u32_buffer_get_bytes_mut(ret);
2847
+ auto size = canvas_native_u32_buffer_get_length(ret);
2848
+ auto bytes_size = size * sizeof(uint32_t);
2952
2849
 
2953
2850
 
2954
- auto store = v8::ArrayBuffer::NewBackingStore(buf, bytes_size,
2955
- [](void *data, size_t length,
2956
- void *deleter_data) {
2957
- if (deleter_data !=
2958
- nullptr) {
2959
- canvas_native_u32_buffer_destroy(
2960
- (U32Buffer *) deleter_data);
2961
- }
2962
- },
2963
- ret);
2851
+ auto store = v8::ArrayBuffer::NewBackingStore(buf, bytes_size,
2852
+ [](void *data, size_t length,
2853
+ void *deleter_data) {
2854
+ if (deleter_data !=
2855
+ nullptr) {
2856
+ canvas_native_u32_buffer_destroy(
2857
+ (U32Buffer *) deleter_data);
2858
+ }
2859
+ },
2860
+ ret);
2964
2861
 
2965
- auto arraybuffer = v8::ArrayBuffer::New(isolate, std::move(store));
2862
+ auto arraybuffer = v8::ArrayBuffer::New(isolate, std::move(store));
2966
2863
 
2967
2864
 
2968
- args.GetReturnValue().Set(
2969
- v8::Uint32Array::New(arraybuffer, 0, size)
2970
- );
2865
+ args.GetReturnValue().Set(
2866
+ v8::Uint32Array::New(arraybuffer, 0, size)
2867
+ );
2971
2868
 
2972
2869
 
2973
- canvas_native_webgl_WebGLResult_destroy(val);
2870
+ canvas_native_webgl_WebGLResult_destroy(val);
2974
2871
 
2975
- return;
2872
+ return;
2976
2873
 
2977
2874
 
2978
- }
2979
- case WebGLResultType::WebGLResultTypeF32:
2980
- args.GetReturnValue().Set((double) canvas_native_webgl_result_get_f32(
2981
- val));
2982
-
2983
- canvas_native_webgl_WebGLResult_destroy(val);
2984
- return;
2985
- case WebGLResultType::WebGLResultTypeI32:
2986
- args.GetReturnValue().Set(canvas_native_webgl_result_get_i32(
2987
- val));
2988
-
2989
- canvas_native_webgl_WebGLResult_destroy(val);
2990
- return;
2991
- case WebGLResultType::WebGLResultTypeU32:
2992
- args.GetReturnValue().Set(canvas_native_webgl_result_get_u32(
2993
- val));
2994
-
2995
- canvas_native_webgl_WebGLResult_destroy(val);
2996
- return;
2997
2875
  }
2876
+ case WebGLResultType::WebGLResultTypeF32:
2877
+ args.GetReturnValue().Set((double) canvas_native_webgl_result_get_f32(
2878
+ val));
2879
+
2880
+ canvas_native_webgl_WebGLResult_destroy(val);
2881
+ return;
2882
+ case WebGLResultType::WebGLResultTypeI32:
2883
+ args.GetReturnValue().Set(canvas_native_webgl_result_get_i32(
2884
+ val));
2885
+
2886
+ canvas_native_webgl_WebGLResult_destroy(val);
2887
+ return;
2888
+ case WebGLResultType::WebGLResultTypeU32:
2889
+ args.GetReturnValue().Set(canvas_native_webgl_result_get_u32(
2890
+ val));
2891
+
2892
+ canvas_native_webgl_WebGLResult_destroy(val);
2893
+ return;
2998
2894
  }
2999
2895
  }
3000
2896
  }
@@ -3014,21 +2910,15 @@ WebGLRenderingContext::GetVertexAttribOffset(const v8::FunctionCallbackInfo<v8::
3014
2910
  auto isolate = args.GetIsolate();
3015
2911
  auto context = isolate->GetCurrentContext();
3016
2912
 
3017
- if (args.Length() > 1) {
3018
- auto index = (uint32_t) args[0]->NumberValue(
3019
- context).ToChecked();
3020
- auto pname = (uint32_t) args[1]->NumberValue(
3021
- context).ToChecked();
3022
- auto ret = canvas_native_webgl_get_vertex_attrib_offset(
3023
- index,
3024
- pname,
3025
- ptr->GetState());
3026
- args.GetReturnValue().Set(static_cast<double>(ret));
3027
- return;
3028
- }
3029
-
3030
- // todo check return
3031
- args.GetReturnValue().SetNull();
2913
+ auto index = args[0]->Uint32Value(
2914
+ context).ToChecked();
2915
+ auto pname = args[1]->Uint32Value(
2916
+ context).ToChecked();
2917
+ auto ret = canvas_native_webgl_get_vertex_attrib_offset(
2918
+ index,
2919
+ pname,
2920
+ ptr->GetState());
2921
+ args.GetReturnValue().Set(static_cast<double>(ret));
3032
2922
  }
3033
2923
 
3034
2924
  void
@@ -3043,63 +2933,58 @@ WebGLRenderingContext::GetVertexAttrib(const v8::FunctionCallbackInfo<v8::Value>
3043
2933
  auto context = isolate->GetCurrentContext();
3044
2934
 
3045
2935
 
3046
- if (args.Length() > 1) {
3047
- auto index = (uint32_t) args[0]->NumberValue(
3048
- context).ToChecked();
3049
- auto pname = (uint32_t) args[1]->NumberValue(
3050
- context).ToChecked();
3051
- auto ret = canvas_native_webgl_get_vertex_attrib(
3052
- index,
3053
- pname,
3054
- ptr->GetState());
2936
+ auto index = args[0]->Uint32Value(
2937
+ context).ToChecked();
2938
+ auto pname = args[1]->Uint32Value(
2939
+ context).ToChecked();
2940
+ auto ret = canvas_native_webgl_get_vertex_attrib(
2941
+ index,
2942
+ pname,
2943
+ ptr->GetState());
3055
2944
 
3056
- if (pname ==
3057
- GL_CURRENT_VERTEX_ATTRIB) {
3058
- auto val = canvas_native_webgl_result_get_f32_array(
3059
- ret);
2945
+ if (pname ==
2946
+ GL_CURRENT_VERTEX_ATTRIB) {
2947
+ auto val = canvas_native_webgl_result_get_f32_array(
2948
+ ret);
3060
2949
 
3061
2950
 
3062
- auto buf = (uint8_t *) canvas_native_f32_buffer_get_bytes_mut(val);
3063
- auto size = canvas_native_f32_buffer_get_length(val);
3064
- auto bytes_size = size * sizeof(float);
2951
+ auto buf = (uint8_t *) canvas_native_f32_buffer_get_bytes_mut(val);
2952
+ auto size = canvas_native_f32_buffer_get_length(val);
2953
+ auto bytes_size = size * sizeof(float);
3065
2954
 
3066
- auto store = v8::ArrayBuffer::NewBackingStore(buf, bytes_size,
3067
- [](void *data, size_t length,
3068
- void *deleter_data) {
3069
- if (deleter_data != nullptr) {
3070
- canvas_native_f32_buffer_destroy(
3071
- (F32Buffer *) deleter_data);
3072
- }
3073
- },
3074
- val);
2955
+ auto store = v8::ArrayBuffer::NewBackingStore(buf, bytes_size,
2956
+ [](void *data, size_t length,
2957
+ void *deleter_data) {
2958
+ if (deleter_data != nullptr) {
2959
+ canvas_native_f32_buffer_destroy(
2960
+ (F32Buffer *) deleter_data);
2961
+ }
2962
+ },
2963
+ val);
3075
2964
 
3076
- auto arraybuffer = v8::ArrayBuffer::New(isolate, std::move(store));
2965
+ auto arraybuffer = v8::ArrayBuffer::New(isolate, std::move(store));
3077
2966
 
3078
2967
 
3079
- args.GetReturnValue().Set(
3080
- v8::Float32Array::New(arraybuffer, 0, size)
3081
- );
2968
+ args.GetReturnValue().Set(
2969
+ v8::Float32Array::New(arraybuffer, 0, size)
2970
+ );
3082
2971
 
3083
- canvas_native_webgl_WebGLResult_destroy(ret);
3084
- return;
3085
- } else if (pname ==
3086
- GL_VERTEX_ATTRIB_ARRAY_ENABLED ||
3087
- pname ==
3088
- GL_VERTEX_ATTRIB_ARRAY_NORMALIZED) {
3089
- args.GetReturnValue().Set(canvas_native_webgl_result_get_bool(
3090
- ret));
3091
- canvas_native_webgl_WebGLResult_destroy(ret);
3092
- return;
3093
- } else {
3094
- args.GetReturnValue().Set(canvas_native_webgl_result_get_i32(
3095
- ret));
3096
- canvas_native_webgl_WebGLResult_destroy(ret);
3097
- return;
3098
- }
2972
+ canvas_native_webgl_WebGLResult_destroy(ret);
2973
+ return;
2974
+ } else if (pname ==
2975
+ GL_VERTEX_ATTRIB_ARRAY_ENABLED ||
2976
+ pname ==
2977
+ GL_VERTEX_ATTRIB_ARRAY_NORMALIZED) {
2978
+ args.GetReturnValue().Set(canvas_native_webgl_result_get_bool(
2979
+ ret));
2980
+ canvas_native_webgl_WebGLResult_destroy(ret);
2981
+ return;
2982
+ } else {
2983
+ args.GetReturnValue().Set(canvas_native_webgl_result_get_i32(
2984
+ ret));
2985
+ canvas_native_webgl_WebGLResult_destroy(ret);
2986
+ return;
3099
2987
  }
3100
-
3101
- // todo check return
3102
- args.GetReturnValue().SetNull();
3103
2988
  }
3104
2989
 
3105
2990
  void
@@ -3113,15 +2998,13 @@ WebGLRenderingContext::Hint(const v8::FunctionCallbackInfo<v8::Value> &args) {
3113
2998
  auto isolate = args.GetIsolate();
3114
2999
  auto context = isolate->GetCurrentContext();
3115
3000
 
3116
- if (args.Length() > 1) {
3117
- auto target = (uint32_t) args[0]->NumberValue(
3118
- context).ToChecked();
3119
- auto mode = (uint32_t) args[1]->NumberValue(
3120
- context).ToChecked();
3121
- canvas_native_webgl_hint(target,
3122
- mode,
3123
- ptr->GetState());
3124
- }
3001
+ auto target = args[0]->Uint32Value(
3002
+ context).ToChecked();
3003
+ auto mode = args[1]->Uint32Value(
3004
+ context).ToChecked();
3005
+ canvas_native_webgl_hint(target,
3006
+ mode,
3007
+ ptr->GetState());
3125
3008
  }
3126
3009
 
3127
3010
  void
@@ -3176,15 +3059,11 @@ WebGLRenderingContext::IsEnabled(const v8::FunctionCallbackInfo<v8::Value> &args
3176
3059
  auto isolate = args.GetIsolate();
3177
3060
  auto context = isolate->GetCurrentContext();
3178
3061
 
3179
- if (args.Length() > 0) {
3180
- auto cap = (uint32_t) args[0]->NumberValue(
3181
- context).ToChecked();
3182
- auto ret = canvas_native_webgl_is_enabled(
3183
- cap, ptr->GetState());
3184
- args.GetReturnValue().Set(ret);
3185
- return;
3186
- }
3187
- args.GetReturnValue().Set(false);
3062
+ auto cap = args[0]->Uint32Value(
3063
+ context).ToChecked();
3064
+ auto ret = canvas_native_webgl_is_enabled(
3065
+ cap, ptr->GetState());
3066
+ args.GetReturnValue().Set(ret);
3188
3067
  }
3189
3068
 
3190
3069
  void
@@ -3334,13 +3213,11 @@ WebGLRenderingContext::LineWidth(const v8::FunctionCallbackInfo<v8::Value> &args
3334
3213
  auto isolate = args.GetIsolate();
3335
3214
  auto context = isolate->GetCurrentContext();
3336
3215
 
3337
- if (args.Length() > 0) {
3338
- auto width = args[0]->NumberValue(
3339
- context).ToChecked();
3340
- canvas_native_webgl_line_width(
3341
- static_cast<float>(width),
3342
- ptr->GetState());
3343
- }
3216
+ auto width = args[0]->NumberValue(
3217
+ context).ToChecked();
3218
+ canvas_native_webgl_line_width(
3219
+ static_cast<float>(width),
3220
+ ptr->GetState());
3344
3221
 
3345
3222
  }
3346
3223
 
@@ -3374,26 +3251,23 @@ WebGLRenderingContext::PixelStorei(const v8::FunctionCallbackInfo<v8::Value> &ar
3374
3251
  auto isolate = args.GetIsolate();
3375
3252
  auto context = isolate->GetCurrentContext();
3376
3253
 
3377
- if (args.Length() > 1) {
3378
- auto pname = (uint32_t) args[0]->NumberValue(
3254
+ auto pname = args[0]->Uint32Value(
3255
+ context).ToChecked();
3256
+ if (args[1]->IsBoolean()) {
3257
+ auto param = args[1]->BooleanValue(isolate);
3258
+ canvas_native_webgl_pixel_storei(
3259
+ pname,
3260
+ param ? 1 : 0,
3261
+ ptr->GetState()
3262
+ );
3263
+ } else {
3264
+ auto param = args[1]->Int32Value(
3379
3265
  context).ToChecked();
3380
- if (args[1]->IsBoolean()) {
3381
- auto param = args[1]->BooleanValue(isolate);
3382
- canvas_native_webgl_pixel_storei(
3383
- pname,
3384
- param ? 1 : 0,
3385
- ptr->GetState()
3386
- );
3387
- } else {
3388
- auto param = (int32_t) args[1]->NumberValue(
3389
- context).ToChecked();
3390
- canvas_native_webgl_pixel_storei(
3391
- pname,
3392
- param,
3393
- ptr->GetState()
3394
- );
3395
- }
3396
-
3266
+ canvas_native_webgl_pixel_storei(
3267
+ pname,
3268
+ param,
3269
+ ptr->GetState()
3270
+ );
3397
3271
  }
3398
3272
  }
3399
3273
 
@@ -3407,17 +3281,15 @@ WebGLRenderingContext::PolygonOffset(const v8::FunctionCallbackInfo<v8::Value> &
3407
3281
  auto isolate = args.GetIsolate();
3408
3282
  auto context = isolate->GetCurrentContext();
3409
3283
 
3410
- if (args.Length() > 1) {
3411
- auto factor = args[0]->NumberValue(
3412
- context).ToChecked();
3413
- auto units = args[1]->NumberValue(
3414
- context).ToChecked();
3415
- canvas_native_webgl_polygon_offset(
3416
- static_cast<float>(factor),
3417
- static_cast<float>(units),
3418
- ptr->GetState()
3419
- );
3420
- }
3284
+ auto factor = args[0]->NumberValue(
3285
+ context).ToChecked();
3286
+ auto units = args[1]->NumberValue(
3287
+ context).ToChecked();
3288
+ canvas_native_webgl_polygon_offset(
3289
+ static_cast<float>(factor),
3290
+ static_cast<float>(units),
3291
+ ptr->GetState()
3292
+ );
3421
3293
 
3422
3294
  }
3423
3295
 
@@ -3432,62 +3304,60 @@ WebGLRenderingContext::ReadPixels(const v8::FunctionCallbackInfo<v8::Value> &arg
3432
3304
  auto context = isolate->GetCurrentContext();
3433
3305
 
3434
3306
 
3435
- if (args.Length() > 6) {
3436
- auto x = (int32_t) args[0]->NumberValue(
3437
- context).ToChecked();
3438
- auto y = (int32_t) args[1]->NumberValue(
3439
- context).ToChecked();
3440
- auto width = (int32_t) args[2]->NumberValue(
3441
- context).ToChecked();
3442
- auto height = (int32_t) args[3]->NumberValue(
3443
- context).ToChecked();
3444
- auto format = (uint32_t) args[4]->NumberValue(
3445
- context).ToChecked();
3446
- auto type = (uint32_t) args[5]->NumberValue(
3447
- context).ToChecked();
3307
+ auto x = args[0]->Int32Value(
3308
+ context).ToChecked();
3309
+ auto y = args[1]->Int32Value(
3310
+ context).ToChecked();
3311
+ auto width = args[2]->Int32Value(
3312
+ context).ToChecked();
3313
+ auto height = args[3]->Int32Value(
3314
+ context).ToChecked();
3315
+ auto format = args[4]->Uint32Value(
3316
+ context).ToChecked();
3317
+ auto type = args[5]->Uint32Value(
3318
+ context).ToChecked();
3448
3319
 
3449
- auto pixels = args[6];
3450
- if (pixels->IsArrayBufferView()) {
3451
- auto buf = pixels.As<v8::ArrayBufferView>();
3320
+ auto pixels = args[6];
3321
+ if (pixels->IsArrayBufferView()) {
3322
+ auto buf = pixels.As<v8::ArrayBufferView>();
3452
3323
 
3453
- auto array = buf->Buffer();
3454
- auto offset = buf->ByteOffset();
3455
- auto size = array->ByteLength();
3456
- auto data_ptr = static_cast<uint8_t*>(array->GetBackingStore()->Data()) + offset;
3457
- auto data = static_cast<uint8_t *>((void *) data_ptr);
3324
+ auto array = buf->Buffer();
3325
+ auto offset = buf->ByteOffset();
3326
+ auto size = array->ByteLength();
3327
+ auto data_ptr = static_cast<uint8_t *>(array->GetBackingStore()->Data()) + offset;
3328
+ auto data = static_cast<uint8_t *>((void *) data_ptr);
3458
3329
 
3459
3330
 
3460
- canvas_native_webgl_read_pixels_u8(
3461
- x,
3462
- y,
3463
- width,
3464
- height,
3465
- format,
3466
- type,
3467
- data, size,
3468
- ptr->GetState()
3469
- );
3470
- return;
3471
- }
3331
+ canvas_native_webgl_read_pixels_u8(
3332
+ x,
3333
+ y,
3334
+ width,
3335
+ height,
3336
+ format,
3337
+ type,
3338
+ data, size,
3339
+ ptr->GetState()
3340
+ );
3341
+ return;
3342
+ }
3472
3343
 
3473
3344
 
3474
- if (pixels->IsArrayBuffer()) {
3475
- auto array = pixels.As<v8::ArrayBuffer>();
3345
+ if (pixels->IsArrayBuffer()) {
3346
+ auto array = pixels.As<v8::ArrayBuffer>();
3476
3347
 
3477
- auto size = array->ByteLength();
3478
- auto data = (uint8_t *) array->GetBackingStore()->Data();
3348
+ auto size = array->ByteLength();
3349
+ auto data = (uint8_t *) array->GetBackingStore()->Data();
3479
3350
 
3480
- canvas_native_webgl_read_pixels_u8(
3481
- x,
3482
- y,
3483
- width,
3484
- height,
3485
- format,
3486
- type,
3487
- data, size,
3488
- ptr->GetState()
3489
- );
3490
- }
3351
+ canvas_native_webgl_read_pixels_u8(
3352
+ x,
3353
+ y,
3354
+ width,
3355
+ height,
3356
+ format,
3357
+ type,
3358
+ data, size,
3359
+ ptr->GetState()
3360
+ );
3491
3361
  }
3492
3362
 
3493
3363
  }
@@ -3502,23 +3372,21 @@ WebGLRenderingContext::RenderbufferStorage(const v8::FunctionCallbackInfo<v8::Va
3502
3372
  auto isolate = args.GetIsolate();
3503
3373
  auto context = isolate->GetCurrentContext();
3504
3374
 
3505
- if (args.Length() > 3) {
3506
- auto target = (uint32_t) args[0]->NumberValue(
3507
- context).ToChecked();
3508
- auto internalFormat = (uint32_t) args[1]->NumberValue(
3509
- context).ToChecked();
3510
- auto width = (int32_t) args[2]->NumberValue(
3511
- context).ToChecked();
3512
- auto height = (int32_t) args[3]->NumberValue(
3513
- context).ToChecked();
3514
- canvas_native_webgl_renderbuffer_storage(
3515
- target,
3516
- internalFormat,
3517
- width,
3518
- height,
3519
- ptr->GetState()
3520
- );
3521
- }
3375
+ auto target = args[0]->Uint32Value(
3376
+ context).ToChecked();
3377
+ auto internalFormat = args[1]->Uint32Value(
3378
+ context).ToChecked();
3379
+ auto width = args[2]->Int32Value(
3380
+ context).ToChecked();
3381
+ auto height = args[3]->Int32Value(
3382
+ context).ToChecked();
3383
+ canvas_native_webgl_renderbuffer_storage(
3384
+ target,
3385
+ internalFormat,
3386
+ width,
3387
+ height,
3388
+ ptr->GetState()
3389
+ );
3522
3390
 
3523
3391
  }
3524
3392
 
@@ -3532,16 +3400,14 @@ WebGLRenderingContext::SampleCoverage(const v8::FunctionCallbackInfo<v8::Value>
3532
3400
  auto isolate = args.GetIsolate();
3533
3401
  auto context = isolate->GetCurrentContext();
3534
3402
 
3535
- if (args.Length() > 1) {
3536
- auto value = args[0]->NumberValue(
3537
- context).ToChecked();
3538
- auto invert = args[1]->BooleanValue(isolate);
3539
- canvas_native_webgl_sample_coverage(
3540
- static_cast<float>(value),
3541
- invert,
3542
- ptr->GetState()
3543
- );
3544
- }
3403
+ auto value = args[0]->NumberValue(
3404
+ context).ToChecked();
3405
+ auto invert = args[1]->BooleanValue(isolate);
3406
+ canvas_native_webgl_sample_coverage(
3407
+ static_cast<float>(value),
3408
+ invert,
3409
+ ptr->GetState()
3410
+ );
3545
3411
 
3546
3412
  }
3547
3413
 
@@ -3555,24 +3421,22 @@ WebGLRenderingContext::Scissor(const v8::FunctionCallbackInfo<v8::Value> &args)
3555
3421
  auto isolate = args.GetIsolate();
3556
3422
  auto context = isolate->GetCurrentContext();
3557
3423
 
3558
- if (args.Length() > 3) {
3559
- auto x = (int32_t) args[0]->NumberValue(
3560
- context).ToChecked();
3561
- auto y = (int32_t) args[1]->NumberValue(
3562
- context).ToChecked();
3563
- auto width = (int32_t) args[2]->NumberValue(
3564
- context).ToChecked();
3565
- auto height = (int32_t) args[3]->NumberValue(
3566
- context).ToChecked();
3567
- canvas_native_webgl_scissor(
3568
- x,
3569
- y,
3570
- width,
3571
- height,
3572
- ptr->GetState()
3573
- );
3574
- }
3575
-
3424
+ auto x = args[0]->Int32Value(
3425
+ context).ToChecked();
3426
+ auto y = args[1]->Int32Value(
3427
+ context).ToChecked();
3428
+ auto width = args[2]->Int32Value(
3429
+ context).ToChecked();
3430
+ auto height = args[3]->Int32Value(
3431
+ context).ToChecked();
3432
+ canvas_native_webgl_scissor(
3433
+ x,
3434
+ y,
3435
+ width,
3436
+ height,
3437
+ ptr->GetState()
3438
+ );
3439
+
3576
3440
  }
3577
3441
 
3578
3442
  void
@@ -3587,7 +3451,7 @@ WebGLRenderingContext::ShaderSource(const v8::FunctionCallbackInfo<v8::Value> &a
3587
3451
  auto value = args[0];
3588
3452
  auto type = GetNativeType(isolate, value);
3589
3453
  auto sourceValue = args[1];
3590
- if (type == NativeType::WebGLShader && sourceValue->IsString()) {
3454
+ if (type == NativeType::WebGLShader) {
3591
3455
  auto shader = WebGLShader::GetPointer(value.As<v8::Object>());
3592
3456
  auto source = ConvertFromV8String(isolate, sourceValue);
3593
3457
  if (shader != nullptr) {
@@ -3610,23 +3474,21 @@ WebGLRenderingContext::StencilFuncSeparate(const v8::FunctionCallbackInfo<v8::Va
3610
3474
  auto isolate = args.GetIsolate();
3611
3475
  auto context = isolate->GetCurrentContext();
3612
3476
 
3613
- if (args.Length() > 3) {
3614
- auto face = (uint32_t) args[0]->NumberValue(
3615
- context).ToChecked();
3616
- auto func = (uint32_t) args[1]->NumberValue(
3617
- context).ToChecked();
3618
- auto ref = (int32_t) args[2]->NumberValue(
3619
- context).ToChecked();
3620
- auto mask = (uint32_t) args[3]->NumberValue(
3621
- context).ToChecked();
3622
- canvas_native_webgl_stencil_func_separate(
3623
- face,
3624
- func,
3625
- ref,
3626
- mask,
3627
- ptr->GetState()
3628
- );
3629
- }
3477
+ auto face = args[0]->Uint32Value(
3478
+ context).ToChecked();
3479
+ auto func = args[1]->Uint32Value(
3480
+ context).ToChecked();
3481
+ auto ref = args[2]->Int32Value(
3482
+ context).ToChecked();
3483
+ auto mask = args[3]->Uint32Value(
3484
+ context).ToChecked();
3485
+ canvas_native_webgl_stencil_func_separate(
3486
+ face,
3487
+ func,
3488
+ ref,
3489
+ mask,
3490
+ ptr->GetState()
3491
+ );
3630
3492
 
3631
3493
  }
3632
3494
 
@@ -3640,20 +3502,18 @@ WebGLRenderingContext::StencilFunc(const v8::FunctionCallbackInfo<v8::Value> &ar
3640
3502
  auto isolate = args.GetIsolate();
3641
3503
  auto context = isolate->GetCurrentContext();
3642
3504
 
3643
- if (args.Length() > 2) {
3644
- auto func = (uint32_t) args[0]->NumberValue(
3645
- context).ToChecked();
3646
- auto ref = (int32_t) args[1]->NumberValue(
3647
- context).ToChecked();
3648
- auto mask = (uint32_t) args[2]->NumberValue(
3649
- context).ToChecked();
3650
- canvas_native_webgl_stencil_func(
3651
- func,
3652
- ref,
3653
- mask,
3654
- ptr->GetState()
3655
- );
3656
- }
3505
+ auto func = args[0]->Uint32Value(
3506
+ context).ToChecked();
3507
+ auto ref = args[1]->Int32Value(
3508
+ context).ToChecked();
3509
+ auto mask = args[2]->Uint32Value(
3510
+ context).ToChecked();
3511
+ canvas_native_webgl_stencil_func(
3512
+ func,
3513
+ ref,
3514
+ mask,
3515
+ ptr->GetState()
3516
+ );
3657
3517
 
3658
3518
  }
3659
3519
 
@@ -3667,17 +3527,15 @@ WebGLRenderingContext::StencilMaskSeparate(const v8::FunctionCallbackInfo<v8::Va
3667
3527
  auto isolate = args.GetIsolate();
3668
3528
  auto context = isolate->GetCurrentContext();
3669
3529
 
3670
- if (args.Length() > 1) {
3671
- auto face = (uint32_t) args[0]->NumberValue(
3672
- context).ToChecked();
3673
- auto mask = (uint32_t) args[1]->NumberValue(
3674
- context).ToChecked();
3675
- canvas_native_webgl_stencil_mask_separate(
3676
- face,
3677
- mask,
3678
- ptr->GetState()
3679
- );
3680
- }
3530
+ auto face = args[0]->Uint32Value(
3531
+ context).ToChecked();
3532
+ auto mask = args[1]->Uint32Value(
3533
+ context).ToChecked();
3534
+ canvas_native_webgl_stencil_mask_separate(
3535
+ face,
3536
+ mask,
3537
+ ptr->GetState()
3538
+ );
3681
3539
 
3682
3540
  }
3683
3541
 
@@ -3691,14 +3549,12 @@ WebGLRenderingContext::StencilMask(const v8::FunctionCallbackInfo<v8::Value> &ar
3691
3549
  auto isolate = args.GetIsolate();
3692
3550
  auto context = isolate->GetCurrentContext();
3693
3551
 
3694
- if (args.Length() > 0) {
3695
- auto mask = (uint32_t) args[0]->NumberValue(
3696
- context).ToChecked();
3697
- canvas_native_webgl_stencil_mask(
3698
- mask,
3699
- ptr->GetState()
3700
- );
3701
- }
3552
+ auto mask = args[0]->Uint32Value(
3553
+ context).ToChecked();
3554
+ canvas_native_webgl_stencil_mask(
3555
+ mask,
3556
+ ptr->GetState()
3557
+ );
3702
3558
 
3703
3559
  }
3704
3560
 
@@ -3713,23 +3569,21 @@ WebGLRenderingContext::StencilOpSeparate(const v8::FunctionCallbackInfo<v8::Valu
3713
3569
  auto context = isolate->GetCurrentContext();
3714
3570
 
3715
3571
 
3716
- if (args.Length() > 3) {
3717
- auto face = (uint32_t) args[0]->NumberValue(
3718
- context).ToChecked();
3719
- auto fail = (uint32_t) args[1]->NumberValue(
3720
- context).ToChecked();
3721
- auto zfail = (uint32_t) args[2]->NumberValue(
3722
- context).ToChecked();
3723
- auto zpass = (uint32_t) args[3]->NumberValue(
3724
- context).ToChecked();
3725
- canvas_native_webgl_stencil_op_separate(
3726
- face,
3727
- fail,
3728
- zfail,
3729
- zpass,
3730
- ptr->GetState()
3731
- );
3732
- }
3572
+ auto face = args[0]->Uint32Value(
3573
+ context).ToChecked();
3574
+ auto fail = args[1]->Uint32Value(
3575
+ context).ToChecked();
3576
+ auto zfail = args[2]->Uint32Value(
3577
+ context).ToChecked();
3578
+ auto zpass = args[3]->Uint32Value(
3579
+ context).ToChecked();
3580
+ canvas_native_webgl_stencil_op_separate(
3581
+ face,
3582
+ fail,
3583
+ zfail,
3584
+ zpass,
3585
+ ptr->GetState()
3586
+ );
3733
3587
 
3734
3588
  }
3735
3589
 
@@ -3743,20 +3597,18 @@ WebGLRenderingContext::StencilOp(const v8::FunctionCallbackInfo<v8::Value> &args
3743
3597
  auto isolate = args.GetIsolate();
3744
3598
  auto context = isolate->GetCurrentContext();
3745
3599
 
3746
- if (args.Length() > 2) {
3747
- auto fail = (uint32_t) args[0]->NumberValue(
3748
- context).ToChecked();
3749
- auto zfail = (uint32_t) args[1]->NumberValue(
3750
- context).ToChecked();
3751
- auto zpass = (uint32_t) args[2]->NumberValue(
3752
- context).ToChecked();
3753
- canvas_native_webgl_stencil_op(
3754
- fail,
3755
- zfail,
3756
- zpass,
3757
- ptr->GetState()
3758
- );
3759
- }
3600
+ auto fail = args[0]->Uint32Value(
3601
+ context).ToChecked();
3602
+ auto zfail = args[1]->Uint32Value(
3603
+ context).ToChecked();
3604
+ auto zpass = args[2]->Uint32Value(
3605
+ context).ToChecked();
3606
+ canvas_native_webgl_stencil_op(
3607
+ fail,
3608
+ zfail,
3609
+ zpass,
3610
+ ptr->GetState()
3611
+ );
3760
3612
 
3761
3613
  }
3762
3614
 
@@ -3776,15 +3628,15 @@ WebGLRenderingContext::TexImage2D(const v8::FunctionCallbackInfo<v8::Value> &arg
3776
3628
  // TODO tidy
3777
3629
 
3778
3630
  if (count == 5) {
3779
- auto target = (int32_t) args[0]->NumberValue(
3631
+ auto target = args[0]->Int32Value(
3780
3632
  context).ToChecked();
3781
- auto level = (int32_t) args[1]->NumberValue(
3633
+ auto level = args[1]->Int32Value(
3782
3634
  context).ToChecked();
3783
- auto internalformat = (int32_t) args[2]->NumberValue(
3635
+ auto internalformat = args[2]->Int32Value(
3784
3636
  context).ToChecked();
3785
- auto format = (int32_t) args[3]->NumberValue(
3637
+ auto format = args[3]->Int32Value(
3786
3638
  context).ToChecked();
3787
- auto type = (int32_t) args[4]->NumberValue(
3639
+ auto type = args[4]->Int32Value(
3788
3640
  context).ToChecked();
3789
3641
 
3790
3642
  canvas_native_webgl_tex_image2d_image_none(
@@ -3797,15 +3649,15 @@ WebGLRenderingContext::TexImage2D(const v8::FunctionCallbackInfo<v8::Value> &arg
3797
3649
  );
3798
3650
 
3799
3651
  } else if (count == 6) {
3800
- auto target = (int32_t) args[0]->NumberValue(
3652
+ auto target = args[0]->Int32Value(
3801
3653
  context).ToChecked();
3802
- auto level = (int32_t) args[1]->NumberValue(
3654
+ auto level = args[1]->Int32Value(
3803
3655
  context).ToChecked();
3804
- auto internalformat = (int32_t) args[2]->NumberValue(
3656
+ auto internalformat = args[2]->Int32Value(
3805
3657
  context).ToChecked();
3806
- auto format = (int32_t) args[3]->NumberValue(
3658
+ auto format = args[3]->Int32Value(
3807
3659
  context).ToChecked();
3808
- auto type = (int32_t) args[4]->NumberValue(
3660
+ auto type = args[4]->Int32Value(
3809
3661
  context).ToChecked();
3810
3662
 
3811
3663
  auto pixels = args[5];
@@ -3886,21 +3738,21 @@ WebGLRenderingContext::TexImage2D(const v8::FunctionCallbackInfo<v8::Value> &arg
3886
3738
  break;
3887
3739
  }
3888
3740
  } else if (count == 8) {
3889
- auto target = (int32_t) args[0]->NumberValue(
3741
+ auto target = args[0]->Int32Value(
3890
3742
  context).ToChecked();
3891
- auto level = (int32_t) args[1]->NumberValue(
3743
+ auto level = args[1]->Int32Value(
3892
3744
  context).ToChecked();
3893
- auto internalformat = (int32_t) args[2]->NumberValue(
3745
+ auto internalformat = args[2]->Int32Value(
3894
3746
  context).ToChecked();
3895
- auto width = (int32_t) args[3]->NumberValue(
3747
+ auto width = args[3]->Int32Value(
3896
3748
  context).ToChecked();
3897
- auto height = (int32_t) args[4]->NumberValue(
3749
+ auto height = args[4]->Int32Value(
3898
3750
  context).ToChecked();
3899
- auto border = (int32_t) args[5]->NumberValue(
3751
+ auto border = args[5]->Int32Value(
3900
3752
  context).ToChecked();
3901
- auto format = (int32_t) args[6]->NumberValue(
3753
+ auto format = args[6]->Int32Value(
3902
3754
  context).ToChecked();
3903
- auto type = (int32_t) args[7]->NumberValue(
3755
+ auto type = args[7]->Int32Value(
3904
3756
  context).ToChecked();
3905
3757
  canvas_native_webgl_tex_image2d_none(
3906
3758
  target,
@@ -3914,21 +3766,21 @@ WebGLRenderingContext::TexImage2D(const v8::FunctionCallbackInfo<v8::Value> &arg
3914
3766
  ptr->GetState()
3915
3767
  );
3916
3768
  } else if (count == 9) {
3917
- auto target = (int32_t) args[0]->NumberValue(
3769
+ auto target = args[0]->Int32Value(
3918
3770
  context).ToChecked();
3919
- auto level = (int32_t) args[1]->NumberValue(
3771
+ auto level = args[1]->Int32Value(
3920
3772
  context).ToChecked();
3921
- auto internalformat = (int32_t) args[2]->NumberValue(
3773
+ auto internalformat = args[2]->Int32Value(
3922
3774
  context).ToChecked();
3923
- auto width = (int32_t) args[3]->NumberValue(
3775
+ auto width = args[3]->Int32Value(
3924
3776
  context).ToChecked();
3925
- auto height = (int32_t) args[4]->NumberValue(
3777
+ auto height = args[4]->Int32Value(
3926
3778
  context).ToChecked();
3927
- auto border = (int32_t) args[5]->NumberValue(
3779
+ auto border = args[5]->Int32Value(
3928
3780
  context).ToChecked();
3929
- auto format = (int32_t) args[6]->NumberValue(
3781
+ auto format = args[6]->Int32Value(
3930
3782
  context).ToChecked();
3931
- auto type = (int32_t) args[7]->NumberValue(
3783
+ auto type = args[7]->Int32Value(
3932
3784
  context).ToChecked();
3933
3785
 
3934
3786
 
@@ -3951,7 +3803,7 @@ WebGLRenderingContext::TexImage2D(const v8::FunctionCallbackInfo<v8::Value> &arg
3951
3803
  auto array = buf->Buffer();
3952
3804
  auto offset = buf->ByteOffset();
3953
3805
  auto size = array->ByteLength();
3954
- auto data_ptr = static_cast<uint8_t*>(array->GetBackingStore()->Data()) + offset;
3806
+ auto data_ptr = static_cast<uint8_t *>(array->GetBackingStore()->Data()) + offset;
3955
3807
  auto data = static_cast<uint8_t *>((void *) data_ptr);
3956
3808
 
3957
3809
 
@@ -4003,20 +3855,18 @@ WebGLRenderingContext::TexParameterf(const v8::FunctionCallbackInfo<v8::Value> &
4003
3855
  auto isolate = args.GetIsolate();
4004
3856
  auto context = isolate->GetCurrentContext();
4005
3857
 
4006
- if (args.Length() > 2) {
4007
- auto target = (uint32_t) args[0]->NumberValue(
4008
- context).ToChecked();
4009
- auto pname = (uint32_t) args[1]->NumberValue(
4010
- context).ToChecked();
4011
- auto param = args[2]->NumberValue(
4012
- context).ToChecked();
4013
- canvas_native_webgl_tex_parameterf(
4014
- target,
4015
- pname,
4016
- static_cast<float>(param),
4017
- ptr->GetState()
4018
- );
4019
- }
3858
+ auto target = args[0]->Uint32Value(
3859
+ context).ToChecked();
3860
+ auto pname = args[1]->Uint32Value(
3861
+ context).ToChecked();
3862
+ auto param = args[2]->NumberValue(
3863
+ context).ToChecked();
3864
+ canvas_native_webgl_tex_parameterf(
3865
+ target,
3866
+ pname,
3867
+ static_cast<float>(param),
3868
+ ptr->GetState()
3869
+ );
4020
3870
 
4021
3871
  }
4022
3872
 
@@ -4030,20 +3880,18 @@ WebGLRenderingContext::TexParameteri(const v8::FunctionCallbackInfo<v8::Value> &
4030
3880
  auto isolate = args.GetIsolate();
4031
3881
  auto context = isolate->GetCurrentContext();
4032
3882
 
4033
- if (args.Length() > 2) {
4034
- auto target = (uint32_t) args[0]->NumberValue(
4035
- context).ToChecked();
4036
- auto pname = (uint32_t) args[1]->NumberValue(
4037
- context).ToChecked();
4038
- auto param = (int32_t) args[2]->NumberValue(
4039
- context).ToChecked();
4040
- canvas_native_webgl_tex_parameteri(
4041
- target,
4042
- pname,
4043
- param,
4044
- ptr->GetState()
4045
- );
4046
- }
3883
+ auto target = args[0]->Uint32Value(
3884
+ context).ToChecked();
3885
+ auto pname = args[1]->Uint32Value(
3886
+ context).ToChecked();
3887
+ auto param = args[2]->Int32Value(
3888
+ context).ToChecked();
3889
+ canvas_native_webgl_tex_parameteri(
3890
+ target,
3891
+ pname,
3892
+ param,
3893
+ ptr->GetState()
3894
+ );
4047
3895
 
4048
3896
  }
4049
3897
 
@@ -4059,17 +3907,17 @@ WebGLRenderingContext::TexSubImage2D(const v8::FunctionCallbackInfo<v8::Value> &
4059
3907
 
4060
3908
  auto count = args.Length();
4061
3909
  if (count == 7) {
4062
- auto target = (uint32_t) args[0]->NumberValue(
3910
+ auto target = args[0]->Uint32Value(
4063
3911
  context).ToChecked();
4064
- auto level = (int32_t) args[1]->NumberValue(
3912
+ auto level = args[1]->Int32Value(
4065
3913
  context).ToChecked();
4066
- auto xoffset = (int32_t) args[2]->NumberValue(
3914
+ auto xoffset = args[2]->Int32Value(
4067
3915
  context).ToChecked();
4068
- auto yoffset = (int32_t) args[3]->NumberValue(
3916
+ auto yoffset = args[3]->Int32Value(
4069
3917
  context).ToChecked();
4070
- auto format = (uint32_t) args[4]->NumberValue(
3918
+ auto format = args[4]->Uint32Value(
4071
3919
  context).ToChecked();
4072
- auto type = (int32_t) args[5]->NumberValue(
3920
+ auto type = args[5]->Int32Value(
4073
3921
  context).ToChecked();
4074
3922
 
4075
3923
 
@@ -4150,21 +3998,21 @@ WebGLRenderingContext::TexSubImage2D(const v8::FunctionCallbackInfo<v8::Value> &
4150
3998
  }
4151
3999
 
4152
4000
  } else if (count == 9) {
4153
- auto target = (uint32_t) args[0]->NumberValue(
4001
+ auto target = args[0]->Uint32Value(
4154
4002
  context).ToChecked();
4155
- auto level = (int32_t) args[1]->NumberValue(
4003
+ auto level = args[1]->Int32Value(
4156
4004
  context).ToChecked();
4157
- auto xoffset = (int32_t) args[2]->NumberValue(
4005
+ auto xoffset = args[2]->Int32Value(
4158
4006
  context).ToChecked();
4159
- auto yoffset = (int32_t) args[3]->NumberValue(
4007
+ auto yoffset = args[3]->Int32Value(
4160
4008
  context).ToChecked();
4161
- auto width = (int32_t) args[4]->NumberValue(
4009
+ auto width = args[4]->Int32Value(
4162
4010
  context).ToChecked();
4163
- auto height = (int32_t) args[5]->NumberValue(
4011
+ auto height = args[5]->Int32Value(
4164
4012
  context).ToChecked();
4165
- auto format = (uint32_t) args[6]->NumberValue(
4013
+ auto format = args[6]->Uint32Value(
4166
4014
  context).ToChecked();
4167
- auto type = (int32_t) args[7]->NumberValue(
4015
+ auto type = args[7]->Int32Value(
4168
4016
  context).ToChecked();
4169
4017
 
4170
4018
  auto pixels = args[8];
@@ -4176,7 +4024,7 @@ WebGLRenderingContext::TexSubImage2D(const v8::FunctionCallbackInfo<v8::Value> &
4176
4024
  auto array = buf->Buffer();
4177
4025
  auto offset = buf->ByteOffset();
4178
4026
  auto size = array->ByteLength();
4179
- auto data_ptr = static_cast<uint8_t*>(array->GetBackingStore()->Data()) + offset;
4027
+ auto data_ptr = static_cast<uint8_t *>(array->GetBackingStore()->Data()) + offset;
4180
4028
  auto data = static_cast<uint8_t *>((void *) data_ptr);
4181
4029
 
4182
4030
 
@@ -4227,14 +4075,12 @@ WebGLRenderingContext::VertexAttrib1f(const v8::FunctionCallbackInfo<v8::Value>
4227
4075
  auto isolate = args.GetIsolate();
4228
4076
  auto context = isolate->GetCurrentContext();
4229
4077
 
4230
- if (args.Length() > 1) {
4231
- auto index = (uint32_t) args[0]->NumberValue(
4232
- context).ToChecked();
4233
- auto v0 = static_cast<float>(args[1]->NumberValue(
4234
- context).ToChecked());
4235
- canvas_native_webgl_vertex_attrib1f(
4236
- index, v0, ptr->GetState());
4237
- }
4078
+ auto index = args[0]->Uint32Value(
4079
+ context).ToChecked();
4080
+ auto v0 = static_cast<float>(args[1]->NumberValue(
4081
+ context).ToChecked());
4082
+ canvas_native_webgl_vertex_attrib1f(
4083
+ index, v0, ptr->GetState());
4238
4084
 
4239
4085
  }
4240
4086
 
@@ -4248,17 +4094,15 @@ WebGLRenderingContext::VertexAttrib2f(const v8::FunctionCallbackInfo<v8::Value>
4248
4094
  auto isolate = args.GetIsolate();
4249
4095
  auto context = isolate->GetCurrentContext();
4250
4096
 
4251
- if (args.Length() > 2) {
4252
- auto index = (uint32_t) args[0]->NumberValue(
4253
- context).ToChecked();
4254
- auto v0 = static_cast<float>(args[1]->NumberValue(
4255
- context).ToChecked());
4256
- auto v1 = static_cast<float>(args[2]->NumberValue(
4257
- context).ToChecked());
4258
- canvas_native_webgl_vertex_attrib2f(
4259
- index, v0, v1,
4260
- ptr->GetState());
4261
- }
4097
+ auto index = args[0]->Uint32Value(
4098
+ context).ToChecked();
4099
+ auto v0 = static_cast<float>(args[1]->NumberValue(
4100
+ context).ToChecked());
4101
+ auto v1 = static_cast<float>(args[2]->NumberValue(
4102
+ context).ToChecked());
4103
+ canvas_native_webgl_vertex_attrib2f(
4104
+ index, v0, v1,
4105
+ ptr->GetState());
4262
4106
 
4263
4107
  }
4264
4108
 
@@ -4272,19 +4116,17 @@ WebGLRenderingContext::VertexAttrib3f(const v8::FunctionCallbackInfo<v8::Value>
4272
4116
  auto isolate = args.GetIsolate();
4273
4117
  auto context = isolate->GetCurrentContext();
4274
4118
 
4275
- if (args.Length() > 3) {
4276
- auto index = (uint32_t) args[0]->NumberValue(
4277
- context).ToChecked();
4278
- auto v0 = static_cast<float>(args[1]->NumberValue(
4279
- context).ToChecked());
4280
- auto v1 = static_cast<float>(args[2]->NumberValue(
4281
- context).ToChecked());
4282
- auto v2 = static_cast<float>(args[3]->NumberValue(
4283
- context).ToChecked());
4284
- canvas_native_webgl_vertex_attrib3f(
4285
- index, v0, v1, v2,
4286
- ptr->GetState());
4287
- }
4119
+ auto index = args[0]->Uint32Value(
4120
+ context).ToChecked();
4121
+ auto v0 = static_cast<float>(args[1]->NumberValue(
4122
+ context).ToChecked());
4123
+ auto v1 = static_cast<float>(args[2]->NumberValue(
4124
+ context).ToChecked());
4125
+ auto v2 = static_cast<float>(args[3]->NumberValue(
4126
+ context).ToChecked());
4127
+ canvas_native_webgl_vertex_attrib3f(
4128
+ index, v0, v1, v2,
4129
+ ptr->GetState());
4288
4130
 
4289
4131
  }
4290
4132
 
@@ -4298,21 +4140,19 @@ WebGLRenderingContext::VertexAttrib4f(const v8::FunctionCallbackInfo<v8::Value>
4298
4140
  auto isolate = args.GetIsolate();
4299
4141
  auto context = isolate->GetCurrentContext();
4300
4142
 
4301
- if (args.Length() > 4) {
4302
- auto index = (uint32_t) args[0]->NumberValue(
4303
- context).ToChecked();
4304
- auto v0 = static_cast<float>(args[1]->NumberValue(
4305
- context).ToChecked());
4306
- auto v1 = static_cast<float>(args[2]->NumberValue(
4307
- context).ToChecked());
4308
- auto v2 = static_cast<float>(args[3]->NumberValue(
4309
- context).ToChecked());
4310
- auto v3 = static_cast<float>(args[4]->NumberValue(
4311
- context).ToChecked());
4312
- canvas_native_webgl_vertex_attrib4f(
4313
- index, v0, v1, v2, v3,
4314
- ptr->GetState());
4315
- }
4143
+ auto index = args[0]->Uint32Value(
4144
+ context).ToChecked();
4145
+ auto v0 = static_cast<float>(args[1]->NumberValue(
4146
+ context).ToChecked());
4147
+ auto v1 = static_cast<float>(args[2]->NumberValue(
4148
+ context).ToChecked());
4149
+ auto v2 = static_cast<float>(args[3]->NumberValue(
4150
+ context).ToChecked());
4151
+ auto v3 = static_cast<float>(args[4]->NumberValue(
4152
+ context).ToChecked());
4153
+ canvas_native_webgl_vertex_attrib4f(
4154
+ index, v0, v1, v2, v3,
4155
+ ptr->GetState());
4316
4156
 
4317
4157
  }
4318
4158
 
@@ -4326,25 +4166,23 @@ WebGLRenderingContext::VertexAttrib1fv(const v8::FunctionCallbackInfo<v8::Value>
4326
4166
  auto isolate = args.GetIsolate();
4327
4167
  auto context = isolate->GetCurrentContext();
4328
4168
 
4329
- if (args.Length() > 1) {
4330
- auto index = (uint32_t) args[0]->NumberValue(
4331
- context).ToChecked();
4169
+ auto index = args[0]->Uint32Value(
4170
+ context).ToChecked();
4332
4171
 
4333
- auto value = args[1];
4334
- if (value->IsFloat32Array()) {
4335
- auto buf = value.As<v8::Float32Array>();
4172
+ auto value = args[1];
4173
+ if (value->IsFloat32Array()) {
4174
+ auto buf = value.As<v8::Float32Array>();
4336
4175
 
4337
- auto array = buf->Buffer();
4338
- auto offset = buf->ByteOffset();
4339
- auto size = buf->Length();
4340
- auto data_ptr = static_cast<uint8_t*>(array->GetBackingStore()->Data()) + offset;
4341
- auto data = static_cast<float *>((void *) data_ptr);
4176
+ auto array = buf->Buffer();
4177
+ auto offset = buf->ByteOffset();
4178
+ auto size = buf->Length();
4179
+ auto data_ptr = static_cast<uint8_t *>(array->GetBackingStore()->Data()) + offset;
4180
+ auto data = static_cast<float *>((void *) data_ptr);
4342
4181
 
4343
4182
 
4344
- canvas_native_webgl_vertex_attrib1fv(
4345
- index, data, size,
4346
- ptr->GetState());
4347
- }
4183
+ canvas_native_webgl_vertex_attrib1fv(
4184
+ index, data, size,
4185
+ ptr->GetState());
4348
4186
  }
4349
4187
  }
4350
4188
 
@@ -4358,25 +4196,23 @@ WebGLRenderingContext::VertexAttrib2fv(const v8::FunctionCallbackInfo<v8::Value>
4358
4196
  auto isolate = args.GetIsolate();
4359
4197
  auto context = isolate->GetCurrentContext();
4360
4198
 
4361
- if (args.Length() > 1) {
4362
- auto index = (uint32_t) args[0]->NumberValue(
4363
- context).ToChecked();
4199
+ auto index = args[0]->Uint32Value(
4200
+ context).ToChecked();
4364
4201
 
4365
- auto value = args[1];
4366
- if (value->IsFloat32Array()) {
4367
- auto buf = value.As<v8::Float32Array>();
4202
+ auto value = args[1];
4203
+ if (value->IsFloat32Array()) {
4204
+ auto buf = value.As<v8::Float32Array>();
4368
4205
 
4369
- auto array = buf->Buffer();
4370
- auto offset = buf->ByteOffset();
4371
- auto size = buf->Length();
4372
- auto data_ptr = static_cast<uint8_t*>(array->GetBackingStore()->Data()) + offset;
4373
- auto data = static_cast<float *>((void *) data_ptr);
4206
+ auto array = buf->Buffer();
4207
+ auto offset = buf->ByteOffset();
4208
+ auto size = buf->Length();
4209
+ auto data_ptr = static_cast<uint8_t *>(array->GetBackingStore()->Data()) + offset;
4210
+ auto data = static_cast<float *>((void *) data_ptr);
4374
4211
 
4375
4212
 
4376
- canvas_native_webgl_vertex_attrib2fv(
4377
- index, data, size,
4378
- ptr->GetState());
4379
- }
4213
+ canvas_native_webgl_vertex_attrib2fv(
4214
+ index, data, size,
4215
+ ptr->GetState());
4380
4216
  }
4381
4217
  }
4382
4218
 
@@ -4390,25 +4226,23 @@ WebGLRenderingContext::VertexAttrib3fv(const v8::FunctionCallbackInfo<v8::Value>
4390
4226
  auto isolate = args.GetIsolate();
4391
4227
  auto context = isolate->GetCurrentContext();
4392
4228
 
4393
- if (args.Length() > 1) {
4394
- auto index = (uint32_t) args[0]->NumberValue(
4395
- context).ToChecked();
4229
+ auto index = args[0]->Uint32Value(
4230
+ context).ToChecked();
4396
4231
 
4397
- auto value = args[1];
4398
- if (value->IsFloat32Array()) {
4399
- auto buf = value.As<v8::Float32Array>();
4232
+ auto value = args[1];
4233
+ if (value->IsFloat32Array()) {
4234
+ auto buf = value.As<v8::Float32Array>();
4400
4235
 
4401
- auto array = buf->Buffer();
4402
- auto offset = buf->ByteOffset();
4403
- auto size = buf->Length();
4404
- auto data_ptr = static_cast<uint8_t*>(array->GetBackingStore()->Data()) + offset;
4405
- auto data = static_cast<float *>((void *) data_ptr);
4236
+ auto array = buf->Buffer();
4237
+ auto offset = buf->ByteOffset();
4238
+ auto size = buf->Length();
4239
+ auto data_ptr = static_cast<uint8_t *>(array->GetBackingStore()->Data()) + offset;
4240
+ auto data = static_cast<float *>((void *) data_ptr);
4406
4241
 
4407
4242
 
4408
- canvas_native_webgl_vertex_attrib3fv(
4409
- index, data, size,
4410
- ptr->GetState());
4411
- }
4243
+ canvas_native_webgl_vertex_attrib3fv(
4244
+ index, data, size,
4245
+ ptr->GetState());
4412
4246
  }
4413
4247
  }
4414
4248
 
@@ -4422,25 +4256,23 @@ WebGLRenderingContext::VertexAttrib4fv(const v8::FunctionCallbackInfo<v8::Value>
4422
4256
  auto isolate = args.GetIsolate();
4423
4257
  auto context = isolate->GetCurrentContext();
4424
4258
 
4425
- if (args.Length() > 1) {
4426
- auto index = (uint32_t) args[0]->NumberValue(
4427
- context).ToChecked();
4259
+ auto index = args[0]->Uint32Value(
4260
+ context).ToChecked();
4428
4261
 
4429
- auto value = args[1];
4430
- if (value->IsFloat32Array()) {
4431
- auto buf = value.As<v8::Float32Array>();
4262
+ auto value = args[1];
4263
+ if (value->IsFloat32Array()) {
4264
+ auto buf = value.As<v8::Float32Array>();
4432
4265
 
4433
- auto array = buf->Buffer();
4434
- auto offset = buf->ByteOffset();
4435
- auto size = buf->Length();
4436
- auto data_ptr = static_cast<uint8_t*>(array->GetBackingStore()->Data()) + offset;
4437
- auto data = static_cast<float *>((void *) data_ptr);
4266
+ auto array = buf->Buffer();
4267
+ auto offset = buf->ByteOffset();
4268
+ auto size = buf->Length();
4269
+ auto data_ptr = static_cast<uint8_t *>(array->GetBackingStore()->Data()) + offset;
4270
+ auto data = static_cast<float *>((void *) data_ptr);
4438
4271
 
4439
4272
 
4440
- canvas_native_webgl_vertex_attrib4fv(
4441
- index, data, size,
4442
- ptr->GetState());
4443
- }
4273
+ canvas_native_webgl_vertex_attrib4fv(
4274
+ index, data, size,
4275
+ ptr->GetState());
4444
4276
  }
4445
4277
  }
4446
4278
 
@@ -4454,23 +4286,21 @@ WebGLRenderingContext::VertexAttribPointer(const v8::FunctionCallbackInfo<v8::Va
4454
4286
  auto isolate = args.GetIsolate();
4455
4287
  auto context = isolate->GetCurrentContext();
4456
4288
 
4457
- if (args.Length() > 5) {
4458
- auto index = (uint32_t) args[0]->NumberValue(
4459
- context).ToChecked();
4460
- auto size = (int32_t) args[1]->NumberValue(
4461
- context).ToChecked();
4462
- auto type = (uint32_t) args[2]->NumberValue(
4463
- context).ToChecked();
4464
- auto normalized = args[3]->BooleanValue(isolate);
4465
- auto stride = (int32_t) args[4]->NumberValue(
4466
- context).ToChecked();
4467
- auto offset = static_cast<ssize_t>(args[5]->NumberValue(
4468
- context).ToChecked());
4469
- canvas_native_webgl_vertex_attrib_pointer(
4470
- index, size, type, normalized,
4471
- stride, offset,
4472
- ptr->GetState());
4473
- }
4289
+ auto index = args[0]->Uint32Value(
4290
+ context).ToChecked();
4291
+ auto size = args[1]->Int32Value(
4292
+ context).ToChecked();
4293
+ auto type = args[2]->Uint32Value(
4294
+ context).ToChecked();
4295
+ auto normalized = args[3]->BooleanValue(isolate);
4296
+ auto stride = args[4]->Int32Value(
4297
+ context).ToChecked();
4298
+ auto offset = static_cast<ssize_t>(args[5]->NumberValue(
4299
+ context).ToChecked());
4300
+ canvas_native_webgl_vertex_attrib_pointer(
4301
+ index, size, type, normalized,
4302
+ stride, offset,
4303
+ ptr->GetState());
4474
4304
  }
4475
4305
 
4476
4306
  void
@@ -4484,8 +4314,7 @@ WebGLRenderingContext::Uniform1f(const v8::FunctionCallbackInfo<v8::Value> &args
4484
4314
  auto context = isolate->GetCurrentContext();
4485
4315
 
4486
4316
  auto value = args[0];
4487
- //if (count > 1) {
4488
- // if (args[0].isObject()) {
4317
+
4489
4318
  auto location = WebGLUniformLocation::GetPointer(value.As<v8::Object>());
4490
4319
  auto v0 = args[1]->NumberValue(
4491
4320
  context).ToChecked();
@@ -4496,8 +4325,6 @@ WebGLRenderingContext::Uniform1f(const v8::FunctionCallbackInfo<v8::Value> &args
4496
4325
  ptr->GetState()
4497
4326
  );
4498
4327
  }
4499
- // }
4500
- // }
4501
4328
  }
4502
4329
 
4503
4330
  void
@@ -4511,8 +4338,7 @@ WebGLRenderingContext::Uniform2f(const v8::FunctionCallbackInfo<v8::Value> &args
4511
4338
  auto context = isolate->GetCurrentContext();
4512
4339
 
4513
4340
  auto value = args[0];
4514
- //if (count > 1) {
4515
- // if (args[0].isObject()) {
4341
+
4516
4342
  auto location = WebGLUniformLocation::GetPointer(value.As<v8::Object>());
4517
4343
  auto v0 = args[1]->NumberValue(
4518
4344
  context).ToChecked();
@@ -4526,8 +4352,6 @@ WebGLRenderingContext::Uniform2f(const v8::FunctionCallbackInfo<v8::Value> &args
4526
4352
  ptr->GetState()
4527
4353
  );
4528
4354
  }
4529
- // }
4530
- // }
4531
4355
  }
4532
4356
 
4533
4357
  void
@@ -4541,8 +4365,6 @@ WebGLRenderingContext::Uniform3f(const v8::FunctionCallbackInfo<v8::Value> &args
4541
4365
  auto context = isolate->GetCurrentContext();
4542
4366
 
4543
4367
  auto value = args[0];
4544
- //if (count > 1) {
4545
- // if (args[0].isObject()) {
4546
4368
  auto location = WebGLUniformLocation::GetPointer(value.As<v8::Object>());
4547
4369
  auto v0 = args[1]->NumberValue(
4548
4370
  context).ToChecked();
@@ -4559,8 +4381,6 @@ WebGLRenderingContext::Uniform3f(const v8::FunctionCallbackInfo<v8::Value> &args
4559
4381
  ptr->GetState()
4560
4382
  );
4561
4383
  }
4562
- // }
4563
- // }
4564
4384
  }
4565
4385
 
4566
4386
  void
@@ -4574,8 +4394,6 @@ WebGLRenderingContext::Uniform4f(const v8::FunctionCallbackInfo<v8::Value> &args
4574
4394
  auto context = isolate->GetCurrentContext();
4575
4395
 
4576
4396
  auto value = args[0];
4577
- //if (count > 1) {
4578
- // if (args[0].isObject()) {
4579
4397
  auto location = WebGLUniformLocation::GetPointer(value.As<v8::Object>());
4580
4398
  auto v0 = args[1]->NumberValue(
4581
4399
  context).ToChecked();
@@ -4595,8 +4413,6 @@ WebGLRenderingContext::Uniform4f(const v8::FunctionCallbackInfo<v8::Value> &args
4595
4413
  ptr->GetState()
4596
4414
  );
4597
4415
  }
4598
- // }
4599
- // }
4600
4416
  }
4601
4417
 
4602
4418
  void
@@ -4624,7 +4440,7 @@ WebGLRenderingContext::Uniform1fv(const v8::FunctionCallbackInfo<v8::Value> &arg
4624
4440
  auto array = buf->Buffer();
4625
4441
  auto offset = buf->ByteOffset();
4626
4442
  auto size = buf->Length();
4627
- auto data_ptr = static_cast<uint8_t*>(array->GetBackingStore()->Data()) + offset;
4443
+ auto data_ptr = static_cast<uint8_t *>(array->GetBackingStore()->Data()) + offset;
4628
4444
  auto data = static_cast<float *>((void *) data_ptr);
4629
4445
 
4630
4446
 
@@ -4641,15 +4457,10 @@ WebGLRenderingContext::Uniform1fv(const v8::FunctionCallbackInfo<v8::Value> &arg
4641
4457
  i < len; ++i) {
4642
4458
  auto item = array->Get(
4643
4459
  context, i).ToLocalChecked();
4644
- if (!item->IsNumber()) {
4645
- buf.push_back(
4646
- nanf(""));
4647
- } else {
4648
- auto value = item->NumberValue(
4649
- context).ToChecked();
4650
- buf.push_back(
4651
- static_cast<float>(value));
4652
- }
4460
+ auto value = item->NumberValue(
4461
+ context).ToChecked();
4462
+ buf.push_back(
4463
+ static_cast<float>(value));
4653
4464
  }
4654
4465
 
4655
4466
  canvas_native_webgl_uniform1fv(
@@ -4686,7 +4497,7 @@ WebGLRenderingContext::Uniform2fv(const v8::FunctionCallbackInfo<v8::Value> &arg
4686
4497
  auto array = buf->Buffer();
4687
4498
  auto offset = buf->ByteOffset();
4688
4499
  auto size = buf->Length();
4689
- auto data_ptr = static_cast<uint8_t*>(array->GetBackingStore()->Data()) + offset;
4500
+ auto data_ptr = static_cast<uint8_t *>(array->GetBackingStore()->Data()) + offset;
4690
4501
  auto data = static_cast<float *>((void *) data_ptr);
4691
4502
 
4692
4503
 
@@ -4703,15 +4514,10 @@ WebGLRenderingContext::Uniform2fv(const v8::FunctionCallbackInfo<v8::Value> &arg
4703
4514
  i < len; ++i) {
4704
4515
  auto item = array->Get(
4705
4516
  context, i).ToLocalChecked();
4706
- if (!item->IsNumber()) {
4707
- buf.push_back(
4708
- nanf(""));
4709
- } else {
4710
- auto value = item->NumberValue(
4711
- context).ToChecked();
4712
- buf.push_back(
4713
- static_cast<float>(value));
4714
- }
4517
+ auto value = item->NumberValue(
4518
+ context).ToChecked();
4519
+ buf.push_back(
4520
+ static_cast<float>(value));
4715
4521
  }
4716
4522
 
4717
4523
  canvas_native_webgl_uniform2fv(
@@ -4748,7 +4554,7 @@ WebGLRenderingContext::Uniform3fv(const v8::FunctionCallbackInfo<v8::Value> &arg
4748
4554
  auto array = buf->Buffer();
4749
4555
  auto offset = buf->ByteOffset();
4750
4556
  auto size = buf->Length();
4751
- auto data_ptr = static_cast<uint8_t*>(array->GetBackingStore()->Data()) + offset;
4557
+ auto data_ptr = static_cast<uint8_t *>(array->GetBackingStore()->Data()) + offset;
4752
4558
  auto data = static_cast<float *>((void *) data_ptr);
4753
4559
 
4754
4560
 
@@ -4765,15 +4571,10 @@ WebGLRenderingContext::Uniform3fv(const v8::FunctionCallbackInfo<v8::Value> &arg
4765
4571
  i < len; ++i) {
4766
4572
  auto item = array->Get(
4767
4573
  context, i).ToLocalChecked();
4768
- if (!item->IsNumber()) {
4769
- buf.push_back(
4770
- nanf(""));
4771
- } else {
4772
- auto value = item->NumberValue(
4773
- context).ToChecked();
4774
- buf.push_back(
4775
- static_cast<float>(value));
4776
- }
4574
+ auto value = item->NumberValue(
4575
+ context).ToChecked();
4576
+ buf.push_back(
4577
+ static_cast<float>(value));
4777
4578
  }
4778
4579
  canvas_native_webgl_uniform3fv(
4779
4580
  location->GetUniformLocation(),
@@ -4809,7 +4610,7 @@ WebGLRenderingContext::Uniform4fv(const v8::FunctionCallbackInfo<v8::Value> &arg
4809
4610
  auto array = buf->Buffer();
4810
4611
  auto offset = buf->ByteOffset();
4811
4612
  auto size = buf->Length();
4812
- auto data_ptr = static_cast<uint8_t*>(array->GetBackingStore()->Data()) + offset;
4613
+ auto data_ptr = static_cast<uint8_t *>(array->GetBackingStore()->Data()) + offset;
4813
4614
  auto data = static_cast<float *>((void *) data_ptr);
4814
4615
 
4815
4616
 
@@ -4826,15 +4627,10 @@ WebGLRenderingContext::Uniform4fv(const v8::FunctionCallbackInfo<v8::Value> &arg
4826
4627
  i < len; ++i) {
4827
4628
  auto item = array->Get(
4828
4629
  context, i).ToLocalChecked();
4829
- if (!item->IsNumber()) {
4830
- buf.push_back(
4831
- nanf(""));
4832
- } else {
4833
- auto value = item->NumberValue(
4834
- context).ToChecked();
4835
- buf.push_back(
4836
- static_cast<float>(value));
4837
- }
4630
+ auto value = item->NumberValue(
4631
+ context).ToChecked();
4632
+ buf.push_back(
4633
+ static_cast<float>(value));
4838
4634
  }
4839
4635
  canvas_native_webgl_uniform4fv(
4840
4636
  location->GetUniformLocation(),
@@ -4857,20 +4653,16 @@ WebGLRenderingContext::Uniform1i(const v8::FunctionCallbackInfo<v8::Value> &args
4857
4653
  auto context = isolate->GetCurrentContext();
4858
4654
 
4859
4655
  auto value = args[0];
4860
- //if (count > 1) {
4861
- // if (args[0].isObject()) {
4862
4656
  auto location = WebGLUniformLocation::GetPointer(value.As<v8::Object>());
4863
- auto v0 = args[1]->NumberValue(
4657
+ auto v0 = args[1]->Int32Value(
4864
4658
  context).ToChecked();
4865
4659
  if (location != nullptr) {
4866
4660
  canvas_native_webgl_uniform1i(
4867
4661
  location->GetUniformLocation(),
4868
- static_cast<int32_t>(v0),
4662
+ v0,
4869
4663
  ptr->GetState()
4870
4664
  );
4871
4665
  }
4872
- // }
4873
- // }
4874
4666
  }
4875
4667
 
4876
4668
  void
@@ -4884,23 +4676,19 @@ WebGLRenderingContext::Uniform2i(const v8::FunctionCallbackInfo<v8::Value> &args
4884
4676
  auto context = isolate->GetCurrentContext();
4885
4677
 
4886
4678
  auto value = args[0];
4887
- //if (count > 1) {
4888
- // if (args[0].isObject()) {
4889
4679
  auto location = WebGLUniformLocation::GetPointer(value.As<v8::Object>());
4890
- auto v0 = args[1]->NumberValue(
4680
+ auto v0 = args[1]->Int32Value(
4891
4681
  context).ToChecked();
4892
- auto v1 = args[2]->NumberValue(
4682
+ auto v1 = args[2]->Int32Value(
4893
4683
  context).ToChecked();
4894
4684
  if (location != nullptr) {
4895
4685
  canvas_native_webgl_uniform2i(
4896
4686
  location->GetUniformLocation(),
4897
- static_cast<int32_t>(v0),
4898
- static_cast<int32_t>(v1),
4687
+ v0,
4688
+ v1,
4899
4689
  ptr->GetState()
4900
4690
  );
4901
4691
  }
4902
- // }
4903
- // }
4904
4692
  }
4905
4693
 
4906
4694
  void
@@ -4914,26 +4702,22 @@ WebGLRenderingContext::Uniform3i(const v8::FunctionCallbackInfo<v8::Value> &args
4914
4702
  auto context = isolate->GetCurrentContext();
4915
4703
 
4916
4704
  auto value = args[0];
4917
- //if (count > 1) {
4918
- // if (args[0].isObject()) {
4919
4705
  auto location = WebGLUniformLocation::GetPointer(value.As<v8::Object>());
4920
- auto v0 = args[1]->NumberValue(
4706
+ auto v0 = args[1]->Int32Value(
4921
4707
  context).ToChecked();
4922
- auto v1 = args[2]->NumberValue(
4708
+ auto v1 = args[2]->Int32Value(
4923
4709
  context).ToChecked();
4924
- auto v2 = args[3]->NumberValue(
4710
+ auto v2 = args[3]->Int32Value(
4925
4711
  context).ToChecked();
4926
4712
  if (location != nullptr) {
4927
4713
  canvas_native_webgl_uniform3i(
4928
4714
  location->GetUniformLocation(),
4929
- static_cast<int32_t>(v0),
4930
- static_cast<int32_t>(v1),
4931
- static_cast<int32_t>(v2),
4715
+ v0,
4716
+ v1,
4717
+ v2,
4932
4718
  ptr->GetState()
4933
4719
  );
4934
4720
  }
4935
- // }
4936
- // }
4937
4721
  }
4938
4722
 
4939
4723
  void
@@ -4947,29 +4731,25 @@ WebGLRenderingContext::Uniform4i(const v8::FunctionCallbackInfo<v8::Value> &args
4947
4731
  auto context = isolate->GetCurrentContext();
4948
4732
 
4949
4733
  auto value = args[0];
4950
- //if (count > 1) {
4951
- // if (args[0].isObject()) {
4952
4734
  auto location = WebGLUniformLocation::GetPointer(value.As<v8::Object>());
4953
- auto v0 = args[1]->NumberValue(
4735
+ auto v0 = args[1]->Int32Value(
4954
4736
  context).ToChecked();
4955
- auto v1 = args[2]->NumberValue(
4737
+ auto v1 = args[2]->Int32Value(
4956
4738
  context).ToChecked();
4957
- auto v2 = args[3]->NumberValue(
4739
+ auto v2 = args[3]->Int32Value(
4958
4740
  context).ToChecked();
4959
- auto v3 = args[4]->NumberValue(
4741
+ auto v3 = args[4]->Int32Value(
4960
4742
  context).ToChecked();
4961
4743
  if (location != nullptr) {
4962
4744
  canvas_native_webgl_uniform4i(
4963
4745
  location->GetUniformLocation(),
4964
- static_cast<int32_t>(v0),
4965
- static_cast<int32_t>(v1),
4966
- static_cast<int32_t>(v2),
4967
- static_cast<int32_t>(v3),
4746
+ v0,
4747
+ v1,
4748
+ v2,
4749
+ v3,
4968
4750
  ptr->GetState()
4969
4751
  );
4970
4752
  }
4971
- // }
4972
- // }
4973
4753
  }
4974
4754
 
4975
4755
  void
@@ -4997,7 +4777,7 @@ WebGLRenderingContext::Uniform1iv(const v8::FunctionCallbackInfo<v8::Value> &arg
4997
4777
  auto array = buf->Buffer();
4998
4778
  auto offset = buf->ByteOffset();
4999
4779
  auto size = buf->Length();
5000
- auto data_ptr = static_cast<uint8_t*>(array->GetBackingStore()->Data()) + offset;
4780
+ auto data_ptr = static_cast<uint8_t *>(array->GetBackingStore()->Data()) + offset;
5001
4781
  auto data = static_cast<int32_t *>((void *) data_ptr);
5002
4782
 
5003
4783
 
@@ -5055,7 +4835,7 @@ WebGLRenderingContext::Uniform2iv(const v8::FunctionCallbackInfo<v8::Value> &arg
5055
4835
  auto array = buf->Buffer();
5056
4836
  auto offset = buf->ByteOffset();
5057
4837
  auto size = buf->Length();
5058
- auto data_ptr = static_cast<uint8_t*>(array->GetBackingStore()->Data()) + offset;
4838
+ auto data_ptr = static_cast<uint8_t *>(array->GetBackingStore()->Data()) + offset;
5059
4839
  auto data = static_cast<int32_t *>((void *) data_ptr);
5060
4840
 
5061
4841
  canvas_native_webgl_uniform2iv(
@@ -5111,7 +4891,7 @@ WebGLRenderingContext::Uniform3iv(const v8::FunctionCallbackInfo<v8::Value> &arg
5111
4891
  auto array = buf->Buffer();
5112
4892
  auto offset = buf->ByteOffset();
5113
4893
  auto size = buf->Length();
5114
- auto data_ptr = static_cast<uint8_t*>(array->GetBackingStore()->Data()) + offset;
4894
+ auto data_ptr = static_cast<uint8_t *>(array->GetBackingStore()->Data()) + offset;
5115
4895
  auto data = static_cast<int32_t *>((void *) data_ptr);
5116
4896
 
5117
4897
 
@@ -5169,7 +4949,7 @@ WebGLRenderingContext::Uniform4iv(const v8::FunctionCallbackInfo<v8::Value> &arg
5169
4949
  auto array = buf->Buffer();
5170
4950
  auto offset = buf->ByteOffset();
5171
4951
  auto size = buf->Length();
5172
- auto data_ptr = static_cast<uint8_t*>(array->GetBackingStore()->Data()) + offset;
4952
+ auto data_ptr = static_cast<uint8_t *>(array->GetBackingStore()->Data()) + offset;
5173
4953
  auto data = static_cast<int32_t *>((void *) data_ptr);
5174
4954
 
5175
4955
 
@@ -5226,7 +5006,7 @@ WebGLRenderingContext::UniformMatrix2fv(const v8::FunctionCallbackInfo<v8::Value
5226
5006
  auto array = buf->Buffer();
5227
5007
  auto offset = buf->ByteOffset();
5228
5008
  auto size = buf->Length();
5229
- auto data_ptr = static_cast<uint8_t*>(array->GetBackingStore()->Data()) + offset;
5009
+ auto data_ptr = static_cast<uint8_t *>(array->GetBackingStore()->Data()) + offset;
5230
5010
  auto data = static_cast<float *>((void *) data_ptr);
5231
5011
 
5232
5012
  canvas_native_webgl_uniform_matrix2fv(
@@ -5242,15 +5022,9 @@ WebGLRenderingContext::UniformMatrix2fv(const v8::FunctionCallbackInfo<v8::Value
5242
5022
  for (int i = 0;
5243
5023
  i < len; i++) {
5244
5024
  auto item = array->Get(context, i).ToLocalChecked();
5245
- if (item->IsNumber()) {
5246
- buf.push_back(
5247
- static_cast<float>(item->NumberValue(
5248
- context).ToChecked()));
5249
- } else {
5250
- buf.push_back(
5251
- std::nanf(
5252
- ""));
5253
- }
5025
+ buf.push_back(
5026
+ static_cast<float>(item->NumberValue(
5027
+ context).ToChecked()));
5254
5028
  }
5255
5029
 
5256
5030
  canvas_native_webgl_uniform_matrix2fv(
@@ -5288,7 +5062,7 @@ WebGLRenderingContext::UniformMatrix3fv(const v8::FunctionCallbackInfo<v8::Value
5288
5062
  auto array = buf->Buffer();
5289
5063
  auto offset = buf->ByteOffset();
5290
5064
  auto size = buf->Length();
5291
- auto data_ptr = static_cast<uint8_t*>(array->GetBackingStore()->Data()) + offset;
5065
+ auto data_ptr = static_cast<uint8_t *>(array->GetBackingStore()->Data()) + offset;
5292
5066
  auto data = static_cast<float *>((void *) data_ptr);
5293
5067
 
5294
5068
  canvas_native_webgl_uniform_matrix3fv(
@@ -5304,15 +5078,9 @@ WebGLRenderingContext::UniformMatrix3fv(const v8::FunctionCallbackInfo<v8::Value
5304
5078
  for (int i = 0;
5305
5079
  i < len; i++) {
5306
5080
  auto item = array->Get(context, i).ToLocalChecked();
5307
- if (item->IsNumber()) {
5308
- buf.push_back(
5309
- static_cast<float>(item->NumberValue(
5310
- context).ToChecked()));
5311
- } else {
5312
- buf.push_back(
5313
- std::nanf(
5314
- ""));
5315
- }
5081
+ buf.push_back(
5082
+ static_cast<float>(item->NumberValue(
5083
+ context).ToChecked()));
5316
5084
  }
5317
5085
 
5318
5086
 
@@ -5351,7 +5119,7 @@ WebGLRenderingContext::UniformMatrix4fv(const v8::FunctionCallbackInfo<v8::Value
5351
5119
  auto array = buf->Buffer();
5352
5120
  auto offset = buf->ByteOffset();
5353
5121
  auto size = buf->Length();
5354
- auto data_ptr = static_cast<uint8_t*>(array->GetBackingStore()->Data()) + offset;
5122
+ auto data_ptr = static_cast<uint8_t *>(array->GetBackingStore()->Data()) + offset;
5355
5123
  auto data = static_cast<float *>((void *) data_ptr);
5356
5124
 
5357
5125
 
@@ -5368,15 +5136,9 @@ WebGLRenderingContext::UniformMatrix4fv(const v8::FunctionCallbackInfo<v8::Value
5368
5136
  for (int i = 0;
5369
5137
  i < len; i++) {
5370
5138
  auto item = array->Get(context, i).ToLocalChecked();
5371
- if (item->IsNumber()) {
5372
- buf.push_back(
5373
- static_cast<float>(item->NumberValue(
5374
- context).ToChecked()));
5375
- } else {
5376
- buf.push_back(
5377
- std::nanf(
5378
- ""));
5379
- }
5139
+ buf.push_back(
5140
+ static_cast<float>(item->NumberValue(
5141
+ context).ToChecked()));
5380
5142
  }
5381
5143
 
5382
5144
 
@@ -5399,24 +5161,22 @@ WebGLRenderingContext::UseProgram(const v8::FunctionCallbackInfo<v8::Value> &arg
5399
5161
 
5400
5162
  auto isolate = args.GetIsolate();
5401
5163
 
5402
- if (args.Length() > 0) {
5403
- auto value = args[0];
5404
- if (value->IsNull()) {
5405
- canvas_native_webgl_use_program(0,
5406
- ptr->GetState());
5164
+ auto value = args[0];
5165
+ if (value->IsNull()) {
5166
+ canvas_native_webgl_use_program(0,
5167
+ ptr->GetState());
5407
5168
 
5408
- return;
5409
- }
5169
+ return;
5170
+ }
5410
5171
 
5411
- auto type = GetNativeType(isolate, value);
5412
- if (type == NativeType::WebGLProgram) {
5413
- auto program = WebGLProgram::GetPointer(value.As<v8::Object>());
5414
- if (program != nullptr) {
5415
- canvas_native_webgl_use_program(
5416
- program->GetProgram(),
5417
- ptr->GetState()
5418
- );
5419
- }
5172
+ auto type = GetNativeType(isolate, value);
5173
+ if (type == NativeType::WebGLProgram) {
5174
+ auto program = WebGLProgram::GetPointer(value.As<v8::Object>());
5175
+ if (program != nullptr) {
5176
+ canvas_native_webgl_use_program(
5177
+ program->GetProgram(),
5178
+ ptr->GetState()
5179
+ );
5420
5180
  }
5421
5181
  }
5422
5182
 
@@ -5455,20 +5215,18 @@ WebGLRenderingContext::Viewport(const v8::FunctionCallbackInfo<v8::Value> &args)
5455
5215
  auto isolate = args.GetIsolate();
5456
5216
  auto context = isolate->GetCurrentContext();
5457
5217
 
5458
- if (args.Length() > 3) {
5459
- auto x = (int32_t) args[0]->NumberValue(
5460
- context).ToChecked();
5461
- auto y = (int32_t) args[1]->NumberValue(
5462
- context).ToChecked();
5463
- auto width = (int32_t) args[2]->NumberValue(
5464
- context).ToChecked();
5465
- auto height = (int32_t) args[3]->NumberValue(
5466
- context).ToChecked();
5467
- canvas_native_webgl_viewport(x, y,
5468
- width,
5469
- height,
5470
- ptr->GetState());
5471
- }
5218
+ auto x = args[0]->Int32Value(
5219
+ context).ToChecked();
5220
+ auto y = args[1]->Int32Value(
5221
+ context).ToChecked();
5222
+ auto width = args[2]->Int32Value(
5223
+ context).ToChecked();
5224
+ auto height = args[3]->Int32Value(
5225
+ context).ToChecked();
5226
+ canvas_native_webgl_viewport(x, y,
5227
+ width,
5228
+ height,
5229
+ ptr->GetState());
5472
5230
 
5473
5231
  }
5474
5232
 
@@ -5506,446 +5264,473 @@ WebGLRenderingContext::__ToDataURL(const v8::FunctionCallbackInfo<v8::Value> &ar
5506
5264
 
5507
5265
  void WebGLRenderingContext::SetConstants(v8::Isolate *isolate,
5508
5266
  const v8::Local<v8::ObjectTemplate> &tmpl) {
5509
- tmpl->Set(isolate, "DEPTH_BUFFER_BIT", v8::Uint32::New(isolate, 0x00000100));
5267
+ tmpl->Set(isolate, "DEPTH_BUFFER_BIT", v8::Integer::NewFromUnsigned(isolate, 0x00000100));
5510
5268
 
5511
- tmpl->Set(isolate, "STENCIL_BUFFER_BIT", v8::Uint32::New(isolate, 0x00000400));
5269
+ tmpl->Set(isolate, "STENCIL_BUFFER_BIT", v8::Integer::NewFromUnsigned(isolate, 0x00000400));
5512
5270
 
5513
- tmpl->Set(isolate, "COLOR_BUFFER_BIT", v8::Uint32::New(isolate, 0x00004000));
5271
+ tmpl->Set(isolate, "COLOR_BUFFER_BIT", v8::Integer::NewFromUnsigned(isolate, 0x00004000));
5514
5272
 
5515
- tmpl->Set(isolate, "POINTS", v8::Uint32::New(isolate, 0x0000));
5273
+ tmpl->Set(isolate, "POINTS", v8::Integer::NewFromUnsigned(isolate, 0x0000));
5516
5274
 
5517
- tmpl->Set(isolate, "LINES", v8::Uint32::New(isolate, 0x0001));
5275
+ tmpl->Set(isolate, "LINES", v8::Integer::NewFromUnsigned(isolate, 0x0001));
5518
5276
 
5519
- tmpl->Set(isolate, "LINE_LOOP", v8::Uint32::New(isolate, 0x0002));
5277
+ tmpl->Set(isolate, "LINE_LOOP", v8::Integer::NewFromUnsigned(isolate, 0x0002));
5520
5278
 
5521
- tmpl->Set(isolate, "LINE_STRIP", v8::Uint32::New(isolate, 0x0003));
5279
+ tmpl->Set(isolate, "LINE_STRIP", v8::Integer::NewFromUnsigned(isolate, 0x0003));
5522
5280
 
5523
- tmpl->Set(isolate, "TRIANGLES", v8::Uint32::New(isolate, 0x0004));
5281
+ tmpl->Set(isolate, "TRIANGLES", v8::Integer::NewFromUnsigned(isolate, 0x0004));
5524
5282
 
5525
- tmpl->Set(isolate, "TRIANGLE_STRIP", v8::Uint32::New(isolate, 0x0005));
5283
+ tmpl->Set(isolate, "TRIANGLE_STRIP", v8::Integer::NewFromUnsigned(isolate, 0x0005));
5526
5284
 
5527
- tmpl->Set(isolate, "TRIANGLE_FAN", v8::Uint32::New(isolate, 0x0006));
5285
+ tmpl->Set(isolate, "TRIANGLE_FAN", v8::Integer::NewFromUnsigned(isolate, 0x0006));
5528
5286
 
5529
- tmpl->Set(isolate, "ZERO", v8::Uint32::New(isolate, 0));
5287
+ tmpl->Set(isolate, "ZERO", v8::Integer::NewFromUnsigned(isolate, 0));
5530
5288
 
5531
- tmpl->Set(isolate, "ONE", v8::Uint32::New(isolate, 1));
5289
+ tmpl->Set(isolate, "ONE", v8::Integer::NewFromUnsigned(isolate, 1));
5532
5290
 
5533
- tmpl->Set(isolate, "SRC_COLOR", v8::Uint32::New(isolate, 0x0300));
5291
+ tmpl->Set(isolate, "SRC_COLOR", v8::Integer::NewFromUnsigned(isolate, 0x0300));
5534
5292
 
5535
- tmpl->Set(isolate, "ONE_MINUS_SRC_COLOR", v8::Uint32::New(isolate, 0x0301));
5293
+ tmpl->Set(isolate, "ONE_MINUS_SRC_COLOR", v8::Integer::NewFromUnsigned(isolate, 0x0301));
5536
5294
 
5537
- tmpl->Set(isolate, "SRC_ALPHA", v8::Uint32::New(isolate, 0x0302));
5295
+ tmpl->Set(isolate, "SRC_ALPHA", v8::Integer::NewFromUnsigned(isolate, 0x0302));
5538
5296
 
5539
- tmpl->Set(isolate, "ONE_MINUS_SRC_ALPHA", v8::Uint32::New(isolate, 0x0303));
5297
+ tmpl->Set(isolate, "ONE_MINUS_SRC_ALPHA", v8::Integer::NewFromUnsigned(isolate, 0x0303));
5540
5298
 
5541
- tmpl->Set(isolate, "DST_ALPHA", v8::Uint32::New(isolate, 0x0304));
5299
+ tmpl->Set(isolate, "DST_ALPHA", v8::Integer::NewFromUnsigned(isolate, 0x0304));
5542
5300
 
5543
- tmpl->Set(isolate, "ONE_MINUS_DST_ALPHA", v8::Uint32::New(isolate, 0x0305));
5301
+ tmpl->Set(isolate, "ONE_MINUS_DST_ALPHA", v8::Integer::NewFromUnsigned(isolate, 0x0305));
5544
5302
 
5545
- tmpl->Set(isolate, "DST_COLOR", v8::Uint32::New(isolate, 0x0306));
5303
+ tmpl->Set(isolate, "DST_COLOR", v8::Integer::NewFromUnsigned(isolate, 0x0306));
5546
5304
 
5547
- tmpl->Set(isolate, "ONE_MINUS_DST_COLOR", v8::Uint32::New(isolate, 0x0307));
5305
+ tmpl->Set(isolate, "ONE_MINUS_DST_COLOR", v8::Integer::NewFromUnsigned(isolate, 0x0307));
5548
5306
 
5549
- tmpl->Set(isolate, "SRC_ALPHA_SATURATE", v8::Uint32::New(isolate, 0x0308));
5307
+ tmpl->Set(isolate, "SRC_ALPHA_SATURATE", v8::Integer::NewFromUnsigned(isolate, 0x0308));
5550
5308
 
5551
5309
 
5552
- tmpl->Set(isolate, "CONSTANT_COLOR", v8::Uint32::New(isolate, 0x8001));
5553
- tmpl->Set(isolate, "ONE_MINUS_CONSTANT_COLOR", v8::Uint32::New(isolate, 0x8002));
5554
- tmpl->Set(isolate, "CONSTANT_ALPHA", v8::Uint32::New(isolate, 0x8003));
5555
- tmpl->Set(isolate, "ONE_MINUS_CONSTANT_ALPHA", v8::Uint32::New(isolate, 0x8004));
5310
+ tmpl->Set(isolate, "CONSTANT_COLOR", v8::Integer::NewFromUnsigned(isolate, 0x8001));
5311
+ tmpl->Set(isolate, "ONE_MINUS_CONSTANT_COLOR", v8::Integer::NewFromUnsigned(isolate, 0x8002));
5312
+ tmpl->Set(isolate, "CONSTANT_ALPHA", v8::Integer::NewFromUnsigned(isolate, 0x8003));
5313
+ tmpl->Set(isolate, "ONE_MINUS_CONSTANT_ALPHA", v8::Integer::NewFromUnsigned(isolate, 0x8004));
5556
5314
 
5557
5315
 
5558
5316
  /* Blending equations */
5559
5317
 
5560
- tmpl->Set(isolate, "FUNC_ADD", v8::Uint32::New(isolate, 0x8006));
5561
- tmpl->Set(isolate, "FUNC_SUBTRACT", v8::Uint32::New(isolate, 0x800A));
5562
- tmpl->Set(isolate, "FUNC_REVERSE_SUBTRACT", v8::Uint32::New(isolate, 0x800B));
5563
- tmpl->Set(isolate, "BLEND_EQUATION", v8::Uint32::New(isolate, 0x8009));
5564
- tmpl->Set(isolate, "BLEND_EQUATION_RGB", v8::Uint32::New(isolate, 0x8009));
5565
- tmpl->Set(isolate, "BLEND_EQUATION_ALPHA", v8::Uint32::New(isolate, 0x883D));
5566
-
5567
-
5568
- tmpl->Set(isolate, "BLEND_DST_RGB", v8::Uint32::New(isolate, 0x80C8));
5569
- tmpl->Set(isolate, "BLEND_SRC_RGB", v8::Uint32::New(isolate, 0x80C9));
5570
- tmpl->Set(isolate, "BLEND_DST_ALPHA", v8::Uint32::New(isolate, 0x80CA));
5571
-
5572
-
5573
- tmpl->Set(isolate, "BLEND_SRC_ALPHA", v8::Uint32::New(isolate, 0x80CB));
5574
- tmpl->Set(isolate, "BLEND_COLOR", v8::Uint32::New(isolate, 0x8005));
5575
- tmpl->Set(isolate, "ARRAY_BUFFER_BINDING", v8::Uint32::New(isolate, 0x8894));
5576
-
5577
-
5578
- tmpl->Set(isolate, "ELEMENT_ARRAY_BUFFER_BINDING", v8::Uint32::New(isolate, 0x8895));
5579
- tmpl->Set(isolate, "LINE_WIDTH", v8::Uint32::New(isolate, 0x0B21));
5580
- tmpl->Set(isolate, "ALIASED_POINT_SIZE_RANGE", v8::Uint32::New(isolate, 0x846D));
5581
-
5582
- tmpl->Set(isolate, "ALIASED_LINE_WIDTH_RANGE", v8::Uint32::New(isolate, 0x846E));
5583
- tmpl->Set(isolate, "CULL_FACE_MODE", v8::Uint32::New(isolate, 0x0B45));
5584
- tmpl->Set(isolate, "FRONT_FACE", v8::Uint32::New(isolate, 0x0B46));
5585
-
5586
- tmpl->Set(isolate, "DEPTH_RANGE", v8::Uint32::New(isolate, 0x0B70));
5587
- tmpl->Set(isolate, "DEPTH_WRITEMASK", v8::Uint32::New(isolate, 0x0B72));
5588
- tmpl->Set(isolate, "DEPTH_CLEAR_VALUE", v8::Uint32::New(isolate, 0x0B73));
5589
-
5590
- tmpl->Set(isolate, "DEPTH_FUNC", v8::Uint32::New(isolate, 0x0B74));
5591
- tmpl->Set(isolate, "STENCIL_CLEAR_VALUE", v8::Uint32::New(isolate, 0x0B91));
5592
- tmpl->Set(isolate, "STENCIL_FUNC", v8::Uint32::New(isolate, 0x0B92));
5593
-
5594
- tmpl->Set(isolate, "STENCIL_FAIL", v8::Uint32::New(isolate, 0x0B94));
5595
- tmpl->Set(isolate, "STENCIL_PASS_DEPTH_FAIL", v8::Uint32::New(isolate, 0x0B95));
5596
- tmpl->Set(isolate, "STENCIL_PASS_DEPTH_PASS", v8::Uint32::New(isolate, 0x0B96));
5597
-
5598
- tmpl->Set(isolate, "STENCIL_REF", v8::Uint32::New(isolate, 0x0B97));
5599
- tmpl->Set(isolate, "STENCIL_VALUE_MASK", v8::Uint32::New(isolate, 0x0B93));
5600
- tmpl->Set(isolate, "STENCIL_WRITEMASK", v8::Uint32::New(isolate, 0x0B98));
5601
-
5602
- tmpl->Set(isolate, "STENCIL_BACK_FUNC", v8::Uint32::New(isolate, 0x8800));
5603
- tmpl->Set(isolate, "STENCIL_BACK_FAIL", v8::Uint32::New(isolate, 0x8801));
5604
- tmpl->Set(isolate, "STENCIL_BACK_PASS_DEPTH_FAIL", v8::Uint32::New(isolate, 0x8802));
5605
-
5606
- tmpl->Set(isolate, "STENCIL_BACK_PASS_DEPTH_PASS", v8::Uint32::New(isolate, 0x8803));
5607
- tmpl->Set(isolate, "STENCIL_BACK_REF", v8::Uint32::New(isolate, 0x8CA3));
5608
- tmpl->Set(isolate, "STENCIL_BACK_VALUE_MASK", v8::Uint32::New(isolate, 0x8CA4));
5609
- tmpl->Set(isolate, "STENCIL_BACK_WRITEMASK", v8::Uint32::New(isolate, 0x8CA5));
5610
-
5611
- tmpl->Set(isolate, "VIEWPORT", v8::Uint32::New(isolate, 0x0BA2));
5612
- tmpl->Set(isolate, "SCISSOR_BOX", v8::Uint32::New(isolate, 0x0C10));
5613
- tmpl->Set(isolate, "COLOR_CLEAR_VALUE", v8::Uint32::New(isolate, 0x0C22));
5614
- tmpl->Set(isolate, "COLOR_WRITEMASK", v8::Uint32::New(isolate, 0x0C23));
5615
-
5616
- tmpl->Set(isolate, "UNPACK_ALIGNMENT", v8::Uint32::New(isolate, 0x0CF5));
5617
- tmpl->Set(isolate, "PACK_ALIGNMENT", v8::Uint32::New(isolate, 0x0D05));
5618
- tmpl->Set(isolate, "MAX_TEXTURE_SIZE", v8::Uint32::New(isolate, 0x0D33));
5619
-
5620
-
5621
- tmpl->Set(isolate, "MAX_VIEWPORT_DIMS", v8::Uint32::New(isolate, 0x0D3A));
5622
- tmpl->Set(isolate, "SUBPIXEL_BITS", v8::Uint32::New(isolate, 0x0D50));
5623
-
5624
- tmpl->Set(isolate, "RED_BITS", v8::Uint32::New(isolate, 0x0D52));
5625
- tmpl->Set(isolate, "GREEN_BITS", v8::Uint32::New(isolate, 0x0D53));
5626
- tmpl->Set(isolate, "BLUE_BITS", v8::Uint32::New(isolate, 0x0D54));
5627
- tmpl->Set(isolate, "ALPHA_BITS", v8::Uint32::New(isolate, 0x0D55));
5628
-
5629
- tmpl->Set(isolate, "STENCIL_BITS", v8::Uint32::New(isolate, 0x0D57));
5630
- tmpl->Set(isolate, "POLYGON_OFFSET_UNITS", v8::Uint32::New(isolate, 0x2A00));
5631
- tmpl->Set(isolate, "POLYGON_OFFSET_FACTOR", v8::Uint32::New(isolate, 0x8038));
5632
-
5633
- tmpl->Set(isolate, "TEXTURE_BINDING_2D", v8::Uint32::New(isolate, 0x8069));
5634
- tmpl->Set(isolate, "SAMPLE_BUFFERS", v8::Uint32::New(isolate, 0x80A8));
5635
- tmpl->Set(isolate, "SAMPLES", v8::Uint32::New(isolate, 0x80A9));
5636
- tmpl->Set(isolate, "SAMPLE_COVERAGE_VALUE", v8::Uint32::New(isolate, 0x80AA));
5637
-
5638
- tmpl->Set(isolate, "SAMPLE_COVERAGE_INVERT", v8::Uint32::New(isolate, 0x80AB));
5639
- tmpl->Set(isolate, "COMPRESSED_TEXTURE_FORMATS", v8::Uint32::New(isolate, 0x86A3));
5640
- tmpl->Set(isolate, "VENDOR", v8::Uint32::New(isolate, 0x1F00));
5641
- tmpl->Set(isolate, "RENDERER", v8::Uint32::New(isolate, 0x1F01));
5642
-
5643
- tmpl->Set(isolate, "VERSION", v8::Uint32::New(isolate, 0x1F02));
5644
- tmpl->Set(isolate, "IMPLEMENTATION_COLOR_READ_TYPE", v8::Uint32::New(isolate, 0x8B9A));
5645
- tmpl->Set(isolate, "IMPLEMENTATION_COLOR_READ_FORMAT", v8::Uint32::New(isolate, 0x8B9B));
5646
- tmpl->Set(isolate, "BROWSER_DEFAULT_WEBGL", v8::Uint32::New(isolate, 0x9244));
5647
-
5648
- tmpl->Set(isolate, "STATIC_DRAW", v8::Uint32::New(isolate, 0x88E4));
5649
- tmpl->Set(isolate, "STREAM_DRAW", v8::Uint32::New(isolate, 0x88E0));
5650
- tmpl->Set(isolate, "DYNAMIC_DRAW", v8::Uint32::New(isolate, 0x88E8));
5651
- tmpl->Set(isolate, "ARRAY_BUFFER", v8::Uint32::New(isolate, 0x8892));
5652
-
5653
- tmpl->Set(isolate, "ELEMENT_ARRAY_BUFFER", v8::Uint32::New(isolate, 0x8893));
5654
- tmpl->Set(isolate, "BUFFER_SIZE", v8::Uint32::New(isolate, 0x8764));
5655
- tmpl->Set(isolate, "BUFFER_USAGE", v8::Uint32::New(isolate, 0x8765));
5656
- tmpl->Set(isolate, "CURRENT_VERTEX_ATTRIB", v8::Uint32::New(isolate, 0x8626));
5657
-
5658
-
5659
- tmpl->Set(isolate, "VERTEX_ATTRIB_ARRAY_ENABLED", v8::Uint32::New(isolate, 0x8622));
5660
- tmpl->Set(isolate, "VERTEX_ATTRIB_ARRAY_SIZE", v8::Uint32::New(isolate, 0x8623));
5661
- tmpl->Set(isolate, "VERTEX_ATTRIB_ARRAY_STRIDE", v8::Uint32::New(isolate, 0x8624));
5662
- tmpl->Set(isolate, "VERTEX_ATTRIB_ARRAY_TYPE", v8::Uint32::New(isolate, 0x8625));
5663
- tmpl->Set(isolate, "VERTEX_ATTRIB_ARRAY_NORMALIZED", v8::Uint32::New(isolate, 0x886A));
5664
- tmpl->Set(isolate, "VERTEX_ATTRIB_ARRAY_POINTER", v8::Uint32::New(isolate, 0x8645));
5665
- tmpl->Set(isolate, "VERTEX_ATTRIB_ARRAY_BUFFER_BINDING", v8::Uint32::New(isolate, 0x889F));
5666
-
5667
- tmpl->Set(isolate, "CULL_FACE", v8::Uint32::New(isolate, 0x0B44));
5668
- tmpl->Set(isolate, "FRONT", v8::Uint32::New(isolate, 0x0404));
5669
- tmpl->Set(isolate, "BACK", v8::Uint32::New(isolate, 0x0405));
5670
- tmpl->Set(isolate, "FRONT_AND_BACK", v8::Uint32::New(isolate, 0x0408));
5318
+ tmpl->Set(isolate, "FUNC_ADD", v8::Integer::NewFromUnsigned(isolate, 0x8006));
5319
+ tmpl->Set(isolate, "FUNC_SUBTRACT", v8::Integer::NewFromUnsigned(isolate, 0x800A));
5320
+ tmpl->Set(isolate, "FUNC_REVERSE_SUBTRACT", v8::Integer::NewFromUnsigned(isolate, 0x800B));
5321
+ tmpl->Set(isolate, "BLEND_EQUATION", v8::Integer::NewFromUnsigned(isolate, 0x8009));
5322
+ tmpl->Set(isolate, "BLEND_EQUATION_RGB", v8::Integer::NewFromUnsigned(isolate, 0x8009));
5323
+ tmpl->Set(isolate, "BLEND_EQUATION_ALPHA", v8::Integer::NewFromUnsigned(isolate, 0x883D));
5671
5324
 
5672
- tmpl->Set(isolate, "BLEND", v8::Uint32::New(isolate, 0x0BE2));
5673
- tmpl->Set(isolate, "DEPTH_TEST", v8::Uint32::New(isolate, 0x0B71));
5674
- tmpl->Set(isolate, "DITHER", v8::Uint32::New(isolate, 0x0BD0));
5675
- tmpl->Set(isolate, "POLYGON_OFFSET_FILL", v8::Uint32::New(isolate, 0x8037));
5676
5325
 
5677
- tmpl->Set(isolate, "SAMPLE_ALPHA_TO_COVERAGE", v8::Uint32::New(isolate, 0x809E));
5678
- tmpl->Set(isolate, "SAMPLE_COVERAGE", v8::Uint32::New(isolate, 0x80A0));
5679
- tmpl->Set(isolate, "SCISSOR_TEST", v8::Uint32::New(isolate, 0x0C11));
5680
- tmpl->Set(isolate, "STENCIL_TEST", v8::Uint32::New(isolate, 0x0B90));
5326
+ tmpl->Set(isolate, "BLEND_DST_RGB", v8::Integer::NewFromUnsigned(isolate, 0x80C8));
5327
+ tmpl->Set(isolate, "BLEND_SRC_RGB", v8::Integer::NewFromUnsigned(isolate, 0x80C9));
5328
+ tmpl->Set(isolate, "BLEND_DST_ALPHA", v8::Integer::NewFromUnsigned(isolate, 0x80CA));
5329
+
5330
+
5331
+ tmpl->Set(isolate, "BLEND_SRC_ALPHA", v8::Integer::NewFromUnsigned(isolate, 0x80CB));
5332
+ tmpl->Set(isolate, "BLEND_COLOR", v8::Integer::NewFromUnsigned(isolate, 0x8005));
5333
+ tmpl->Set(isolate, "ARRAY_BUFFER_BINDING", v8::Integer::NewFromUnsigned(isolate, 0x8894));
5334
+
5335
+
5336
+ tmpl->Set(isolate, "ELEMENT_ARRAY_BUFFER_BINDING",
5337
+ v8::Integer::NewFromUnsigned(isolate, 0x8895));
5338
+ tmpl->Set(isolate, "LINE_WIDTH", v8::Integer::NewFromUnsigned(isolate, 0x0B21));
5339
+ tmpl->Set(isolate, "ALIASED_POINT_SIZE_RANGE", v8::Integer::NewFromUnsigned(isolate, 0x846D));
5340
+
5341
+ tmpl->Set(isolate, "ALIASED_LINE_WIDTH_RANGE", v8::Integer::NewFromUnsigned(isolate, 0x846E));
5342
+ tmpl->Set(isolate, "CULL_FACE_MODE", v8::Integer::NewFromUnsigned(isolate, 0x0B45));
5343
+ tmpl->Set(isolate, "FRONT_FACE", v8::Integer::NewFromUnsigned(isolate, 0x0B46));
5344
+
5345
+ tmpl->Set(isolate, "DEPTH_RANGE", v8::Integer::NewFromUnsigned(isolate, 0x0B70));
5346
+ tmpl->Set(isolate, "DEPTH_WRITEMASK", v8::Integer::NewFromUnsigned(isolate, 0x0B72));
5347
+ tmpl->Set(isolate, "DEPTH_CLEAR_VALUE", v8::Integer::NewFromUnsigned(isolate, 0x0B73));
5348
+
5349
+ tmpl->Set(isolate, "DEPTH_FUNC", v8::Integer::NewFromUnsigned(isolate, 0x0B74));
5350
+ tmpl->Set(isolate, "STENCIL_CLEAR_VALUE", v8::Integer::NewFromUnsigned(isolate, 0x0B91));
5351
+ tmpl->Set(isolate, "STENCIL_FUNC", v8::Integer::NewFromUnsigned(isolate, 0x0B92));
5352
+
5353
+ tmpl->Set(isolate, "STENCIL_FAIL", v8::Integer::NewFromUnsigned(isolate, 0x0B94));
5354
+ tmpl->Set(isolate, "STENCIL_PASS_DEPTH_FAIL", v8::Integer::NewFromUnsigned(isolate, 0x0B95));
5355
+ tmpl->Set(isolate, "STENCIL_PASS_DEPTH_PASS", v8::Integer::NewFromUnsigned(isolate, 0x0B96));
5356
+
5357
+ tmpl->Set(isolate, "STENCIL_REF", v8::Integer::NewFromUnsigned(isolate, 0x0B97));
5358
+ tmpl->Set(isolate, "STENCIL_VALUE_MASK", v8::Integer::NewFromUnsigned(isolate, 0x0B93));
5359
+ tmpl->Set(isolate, "STENCIL_WRITEMASK", v8::Integer::NewFromUnsigned(isolate, 0x0B98));
5360
+
5361
+ tmpl->Set(isolate, "STENCIL_BACK_FUNC", v8::Integer::NewFromUnsigned(isolate, 0x8800));
5362
+ tmpl->Set(isolate, "STENCIL_BACK_FAIL", v8::Integer::NewFromUnsigned(isolate, 0x8801));
5363
+ tmpl->Set(isolate, "STENCIL_BACK_PASS_DEPTH_FAIL",
5364
+ v8::Integer::NewFromUnsigned(isolate, 0x8802));
5365
+
5366
+ tmpl->Set(isolate, "STENCIL_BACK_PASS_DEPTH_PASS",
5367
+ v8::Integer::NewFromUnsigned(isolate, 0x8803));
5368
+ tmpl->Set(isolate, "STENCIL_BACK_REF", v8::Integer::NewFromUnsigned(isolate, 0x8CA3));
5369
+ tmpl->Set(isolate, "STENCIL_BACK_VALUE_MASK", v8::Integer::NewFromUnsigned(isolate, 0x8CA4));
5370
+ tmpl->Set(isolate, "STENCIL_BACK_WRITEMASK", v8::Integer::NewFromUnsigned(isolate, 0x8CA5));
5371
+
5372
+ tmpl->Set(isolate, "VIEWPORT", v8::Integer::NewFromUnsigned(isolate, 0x0BA2));
5373
+ tmpl->Set(isolate, "SCISSOR_BOX", v8::Integer::NewFromUnsigned(isolate, 0x0C10));
5374
+ tmpl->Set(isolate, "COLOR_CLEAR_VALUE", v8::Integer::NewFromUnsigned(isolate, 0x0C22));
5375
+ tmpl->Set(isolate, "COLOR_WRITEMASK", v8::Integer::NewFromUnsigned(isolate, 0x0C23));
5376
+
5377
+ tmpl->Set(isolate, "UNPACK_ALIGNMENT", v8::Integer::NewFromUnsigned(isolate, 0x0CF5));
5378
+ tmpl->Set(isolate, "PACK_ALIGNMENT", v8::Integer::NewFromUnsigned(isolate, 0x0D05));
5379
+ tmpl->Set(isolate, "MAX_TEXTURE_SIZE", v8::Integer::NewFromUnsigned(isolate, 0x0D33));
5380
+
5381
+
5382
+ tmpl->Set(isolate, "MAX_VIEWPORT_DIMS", v8::Integer::NewFromUnsigned(isolate, 0x0D3A));
5383
+ tmpl->Set(isolate, "SUBPIXEL_BITS", v8::Integer::NewFromUnsigned(isolate, 0x0D50));
5384
+
5385
+ tmpl->Set(isolate, "RED_BITS", v8::Integer::NewFromUnsigned(isolate, 0x0D52));
5386
+ tmpl->Set(isolate, "GREEN_BITS", v8::Integer::NewFromUnsigned(isolate, 0x0D53));
5387
+ tmpl->Set(isolate, "BLUE_BITS", v8::Integer::NewFromUnsigned(isolate, 0x0D54));
5388
+ tmpl->Set(isolate, "ALPHA_BITS", v8::Integer::NewFromUnsigned(isolate, 0x0D55));
5389
+
5390
+ tmpl->Set(isolate, "STENCIL_BITS", v8::Integer::NewFromUnsigned(isolate, 0x0D57));
5391
+ tmpl->Set(isolate, "POLYGON_OFFSET_UNITS", v8::Integer::NewFromUnsigned(isolate, 0x2A00));
5392
+ tmpl->Set(isolate, "POLYGON_OFFSET_FACTOR", v8::Integer::NewFromUnsigned(isolate, 0x8038));
5393
+
5394
+ tmpl->Set(isolate, "TEXTURE_BINDING_2D", v8::Integer::NewFromUnsigned(isolate, 0x8069));
5395
+ tmpl->Set(isolate, "SAMPLE_BUFFERS", v8::Integer::NewFromUnsigned(isolate, 0x80A8));
5396
+ tmpl->Set(isolate, "SAMPLES", v8::Integer::NewFromUnsigned(isolate, 0x80A9));
5397
+ tmpl->Set(isolate, "SAMPLE_COVERAGE_VALUE", v8::Integer::NewFromUnsigned(isolate, 0x80AA));
5398
+
5399
+ tmpl->Set(isolate, "SAMPLE_COVERAGE_INVERT", v8::Integer::NewFromUnsigned(isolate, 0x80AB));
5400
+ tmpl->Set(isolate, "COMPRESSED_TEXTURE_FORMATS", v8::Integer::NewFromUnsigned(isolate, 0x86A3));
5401
+ tmpl->Set(isolate, "VENDOR", v8::Integer::NewFromUnsigned(isolate, 0x1F00));
5402
+ tmpl->Set(isolate, "RENDERER", v8::Integer::NewFromUnsigned(isolate, 0x1F01));
5403
+
5404
+ tmpl->Set(isolate, "VERSION", v8::Integer::NewFromUnsigned(isolate, 0x1F02));
5405
+ tmpl->Set(isolate, "IMPLEMENTATION_COLOR_READ_TYPE",
5406
+ v8::Integer::NewFromUnsigned(isolate, 0x8B9A));
5407
+ tmpl->Set(isolate, "IMPLEMENTATION_COLOR_READ_FORMAT",
5408
+ v8::Integer::NewFromUnsigned(isolate, 0x8B9B));
5409
+ tmpl->Set(isolate, "BROWSER_DEFAULT_WEBGL", v8::Integer::NewFromUnsigned(isolate, 0x9244));
5410
+
5411
+ tmpl->Set(isolate, "STATIC_DRAW", v8::Integer::NewFromUnsigned(isolate, 0x88E4));
5412
+ tmpl->Set(isolate, "STREAM_DRAW", v8::Integer::NewFromUnsigned(isolate, 0x88E0));
5413
+ tmpl->Set(isolate, "DYNAMIC_DRAW", v8::Integer::NewFromUnsigned(isolate, 0x88E8));
5414
+ tmpl->Set(isolate, "ARRAY_BUFFER", v8::Integer::NewFromUnsigned(isolate, 0x8892));
5415
+
5416
+ tmpl->Set(isolate, "ELEMENT_ARRAY_BUFFER", v8::Integer::NewFromUnsigned(isolate, 0x8893));
5417
+ tmpl->Set(isolate, "BUFFER_SIZE", v8::Integer::NewFromUnsigned(isolate, 0x8764));
5418
+ tmpl->Set(isolate, "BUFFER_USAGE", v8::Integer::NewFromUnsigned(isolate, 0x8765));
5419
+ tmpl->Set(isolate, "CURRENT_VERTEX_ATTRIB", v8::Integer::NewFromUnsigned(isolate, 0x8626));
5420
+
5421
+
5422
+ tmpl->Set(isolate, "VERTEX_ATTRIB_ARRAY_ENABLED",
5423
+ v8::Integer::NewFromUnsigned(isolate, 0x8622));
5424
+ tmpl->Set(isolate, "VERTEX_ATTRIB_ARRAY_SIZE", v8::Integer::NewFromUnsigned(isolate, 0x8623));
5425
+ tmpl->Set(isolate, "VERTEX_ATTRIB_ARRAY_STRIDE", v8::Integer::NewFromUnsigned(isolate, 0x8624));
5426
+ tmpl->Set(isolate, "VERTEX_ATTRIB_ARRAY_TYPE", v8::Integer::NewFromUnsigned(isolate, 0x8625));
5427
+ tmpl->Set(isolate, "VERTEX_ATTRIB_ARRAY_NORMALIZED",
5428
+ v8::Integer::NewFromUnsigned(isolate, 0x886A));
5429
+ tmpl->Set(isolate, "VERTEX_ATTRIB_ARRAY_POINTER",
5430
+ v8::Integer::NewFromUnsigned(isolate, 0x8645));
5431
+ tmpl->Set(isolate, "VERTEX_ATTRIB_ARRAY_BUFFER_BINDING",
5432
+ v8::Integer::NewFromUnsigned(isolate, 0x889F));
5433
+
5434
+ tmpl->Set(isolate, "CULL_FACE", v8::Integer::NewFromUnsigned(isolate, 0x0B44));
5435
+ tmpl->Set(isolate, "FRONT", v8::Integer::NewFromUnsigned(isolate, 0x0404));
5436
+ tmpl->Set(isolate, "BACK", v8::Integer::NewFromUnsigned(isolate, 0x0405));
5437
+ tmpl->Set(isolate, "FRONT_AND_BACK", v8::Integer::NewFromUnsigned(isolate, 0x0408));
5438
+
5439
+ tmpl->Set(isolate, "BLEND", v8::Integer::NewFromUnsigned(isolate, 0x0BE2));
5440
+ tmpl->Set(isolate, "DEPTH_TEST", v8::Integer::NewFromUnsigned(isolate, 0x0B71));
5441
+ tmpl->Set(isolate, "DITHER", v8::Integer::NewFromUnsigned(isolate, 0x0BD0));
5442
+ tmpl->Set(isolate, "POLYGON_OFFSET_FILL", v8::Integer::NewFromUnsigned(isolate, 0x8037));
5443
+
5444
+ tmpl->Set(isolate, "SAMPLE_ALPHA_TO_COVERAGE", v8::Integer::NewFromUnsigned(isolate, 0x809E));
5445
+ tmpl->Set(isolate, "SAMPLE_COVERAGE", v8::Integer::NewFromUnsigned(isolate, 0x80A0));
5446
+ tmpl->Set(isolate, "SCISSOR_TEST", v8::Integer::NewFromUnsigned(isolate, 0x0C11));
5447
+ tmpl->Set(isolate, "STENCIL_TEST", v8::Integer::NewFromUnsigned(isolate, 0x0B90));
5681
5448
 
5682
5449
 
5683
5450
  /* Errors */
5684
5451
 
5685
- tmpl->Set(isolate, "NO_ERROR", v8::Uint32::New(isolate, 0));
5686
- tmpl->Set(isolate, "INVALID_ENUM", v8::Uint32::New(isolate, 0x0500));
5687
- tmpl->Set(isolate, "INVALID_VALUE", v8::Uint32::New(isolate, 0x0501));
5688
- tmpl->Set(isolate, "INVALID_OPERATION", v8::Uint32::New(isolate, 0x0502));
5452
+ tmpl->Set(isolate, "NO_ERROR", v8::Integer::NewFromUnsigned(isolate, 0));
5453
+ tmpl->Set(isolate, "INVALID_ENUM", v8::Integer::NewFromUnsigned(isolate, 0x0500));
5454
+ tmpl->Set(isolate, "INVALID_VALUE", v8::Integer::NewFromUnsigned(isolate, 0x0501));
5455
+ tmpl->Set(isolate, "INVALID_OPERATION", v8::Integer::NewFromUnsigned(isolate, 0x0502));
5689
5456
 
5690
- tmpl->Set(isolate, "OUT_OF_MEMORY", v8::Uint32::New(isolate, 0x0505));
5691
- tmpl->Set(isolate, "CONTEXT_LOST_WEBGL", v8::Uint32::New(isolate, 0x9242));
5692
- tmpl->Set(isolate, "CW", v8::Uint32::New(isolate, 0x0900));
5693
- tmpl->Set(isolate, "CCW", v8::Uint32::New(isolate, 0x0901));
5457
+ tmpl->Set(isolate, "OUT_OF_MEMORY", v8::Integer::NewFromUnsigned(isolate, 0x0505));
5458
+ tmpl->Set(isolate, "CONTEXT_LOST_WEBGL", v8::Integer::NewFromUnsigned(isolate, 0x9242));
5459
+ tmpl->Set(isolate, "CW", v8::Integer::NewFromUnsigned(isolate, 0x0900));
5460
+ tmpl->Set(isolate, "CCW", v8::Integer::NewFromUnsigned(isolate, 0x0901));
5694
5461
 
5695
- tmpl->Set(isolate, "DONT_CARE", v8::Uint32::New(isolate, 0x1100));
5696
- tmpl->Set(isolate, "FASTEST", v8::Uint32::New(isolate, 0x1101));
5697
- tmpl->Set(isolate, "NICEST", v8::Uint32::New(isolate, 0x1102));
5698
- tmpl->Set(isolate, "GENERATE_MIPMAP_HINT", v8::Uint32::New(isolate, 0x8192));
5462
+ tmpl->Set(isolate, "DONT_CARE", v8::Integer::NewFromUnsigned(isolate, 0x1100));
5463
+ tmpl->Set(isolate, "FASTEST", v8::Integer::NewFromUnsigned(isolate, 0x1101));
5464
+ tmpl->Set(isolate, "NICEST", v8::Integer::NewFromUnsigned(isolate, 0x1102));
5465
+ tmpl->Set(isolate, "GENERATE_MIPMAP_HINT", v8::Integer::NewFromUnsigned(isolate, 0x8192));
5699
5466
 
5700
- tmpl->Set(isolate, "BYTE", v8::Uint32::New(isolate, 0x1400));
5701
- tmpl->Set(isolate, "UNSIGNED_BYTE", v8::Uint32::New(isolate, 0x1401));
5702
- tmpl->Set(isolate, "SHORT", v8::Uint32::New(isolate, 0x1402));
5703
- tmpl->Set(isolate, "UNSIGNED_SHORT", v8::Uint32::New(isolate, 0x1403));
5467
+ tmpl->Set(isolate, "BYTE", v8::Integer::NewFromUnsigned(isolate, 0x1400));
5468
+ tmpl->Set(isolate, "UNSIGNED_BYTE", v8::Integer::NewFromUnsigned(isolate, 0x1401));
5469
+ tmpl->Set(isolate, "SHORT", v8::Integer::NewFromUnsigned(isolate, 0x1402));
5470
+ tmpl->Set(isolate, "UNSIGNED_SHORT", v8::Integer::NewFromUnsigned(isolate, 0x1403));
5704
5471
 
5705
- tmpl->Set(isolate, "BYTE", v8::Uint32::New(isolate, 0x1400));
5706
- tmpl->Set(isolate, "UNSIGNED_BYTE", v8::Uint32::New(isolate, 0x1401));
5707
- tmpl->Set(isolate, "SHORT", v8::Uint32::New(isolate, 0x1402));
5708
- tmpl->Set(isolate, "UNSIGNED_SHORT", v8::Uint32::New(isolate, 0x1403));
5472
+ tmpl->Set(isolate, "BYTE", v8::Integer::NewFromUnsigned(isolate, 0x1400));
5473
+ tmpl->Set(isolate, "UNSIGNED_BYTE", v8::Integer::NewFromUnsigned(isolate, 0x1401));
5474
+ tmpl->Set(isolate, "SHORT", v8::Integer::NewFromUnsigned(isolate, 0x1402));
5475
+ tmpl->Set(isolate, "UNSIGNED_SHORT", v8::Integer::NewFromUnsigned(isolate, 0x1403));
5709
5476
 
5710
- tmpl->Set(isolate, "INT", v8::Uint32::New(isolate, 0x1404));
5711
- tmpl->Set(isolate, "UNSIGNED_INT", v8::Uint32::New(isolate, 0x1405));
5712
- tmpl->Set(isolate, "FLOAT", v8::Uint32::New(isolate, 0x1406));
5713
- tmpl->Set(isolate, "DEPTH_COMPONENT", v8::Uint32::New(isolate, 0x1902));
5477
+ tmpl->Set(isolate, "INT", v8::Integer::NewFromUnsigned(isolate, 0x1404));
5478
+ tmpl->Set(isolate, "UNSIGNED_INT", v8::Integer::NewFromUnsigned(isolate, 0x1405));
5479
+ tmpl->Set(isolate, "FLOAT", v8::Integer::NewFromUnsigned(isolate, 0x1406));
5480
+ tmpl->Set(isolate, "DEPTH_COMPONENT", v8::Integer::NewFromUnsigned(isolate, 0x1902));
5714
5481
 
5715
- tmpl->Set(isolate, "ALPHA", v8::Uint32::New(isolate, 0x1906));
5716
- tmpl->Set(isolate, "RGB", v8::Uint32::New(isolate, 0x1907));
5482
+ tmpl->Set(isolate, "ALPHA", v8::Integer::NewFromUnsigned(isolate, 0x1906));
5483
+ tmpl->Set(isolate, "RGB", v8::Integer::NewFromUnsigned(isolate, 0x1907));
5717
5484
 
5718
5485
  /* Clearing buffers */
5719
5486
 
5720
- tmpl->Set(isolate, "RGBA", v8::Uint32::New(isolate, 0x1908));
5721
- tmpl->Set(isolate, "LUMINANCE", v8::Uint32::New(isolate, 0x1909));
5722
- tmpl->Set(isolate, "LUMINANCE_ALPHA", v8::Uint32::New(isolate, 0x190A));
5487
+ tmpl->Set(isolate, "RGBA", v8::Integer::NewFromUnsigned(isolate, 0x1908));
5488
+ tmpl->Set(isolate, "LUMINANCE", v8::Integer::NewFromUnsigned(isolate, 0x1909));
5489
+ tmpl->Set(isolate, "LUMINANCE_ALPHA", v8::Integer::NewFromUnsigned(isolate, 0x190A));
5723
5490
 
5724
5491
  /* Clearing buffers */
5725
5492
 
5726
5493
  /* Rendering primitives */
5727
5494
 
5728
- tmpl->Set(isolate, "UNSIGNED_SHORT_4_4_4_4", v8::Uint32::New(isolate, 0x8033));
5729
- tmpl->Set(isolate, "UNSIGNED_SHORT_5_5_5_1", v8::Uint32::New(isolate, 0x8034));
5730
- tmpl->Set(isolate, "UNSIGNED_SHORT_5_6_5", v8::Uint32::New(isolate, 0x8363));
5731
- tmpl->Set(isolate, "FRAGMENT_SHADER", v8::Uint32::New(isolate, 0x8B30));
5732
- tmpl->Set(isolate, "VERTEX_SHADER", v8::Uint32::New(isolate, 0x8B31));
5733
- tmpl->Set(isolate, "COMPILE_STATUS", v8::Uint32::New(isolate, 0x8B81));
5734
- tmpl->Set(isolate, "DELETE_STATUS", v8::Uint32::New(isolate, 0x8B80));
5495
+ tmpl->Set(isolate, "UNSIGNED_SHORT_4_4_4_4", v8::Integer::NewFromUnsigned(isolate, 0x8033));
5496
+ tmpl->Set(isolate, "UNSIGNED_SHORT_5_5_5_1", v8::Integer::NewFromUnsigned(isolate, 0x8034));
5497
+ tmpl->Set(isolate, "UNSIGNED_SHORT_5_6_5", v8::Integer::NewFromUnsigned(isolate, 0x8363));
5498
+ tmpl->Set(isolate, "FRAGMENT_SHADER", v8::Integer::NewFromUnsigned(isolate, 0x8B30));
5499
+ tmpl->Set(isolate, "VERTEX_SHADER", v8::Integer::NewFromUnsigned(isolate, 0x8B31));
5500
+ tmpl->Set(isolate, "COMPILE_STATUS", v8::Integer::NewFromUnsigned(isolate, 0x8B81));
5501
+ tmpl->Set(isolate, "DELETE_STATUS", v8::Integer::NewFromUnsigned(isolate, 0x8B80));
5735
5502
 
5736
5503
  /* Rendering primitives */
5737
5504
 
5738
5505
  /* Blending modes */
5739
5506
 
5740
- tmpl->Set(isolate, "LINK_STATUS", v8::Uint32::New(isolate, 0x8B82));
5741
- tmpl->Set(isolate, "VALIDATE_STATUS", v8::Uint32::New(isolate, 0x8B83));
5742
- tmpl->Set(isolate, "ATTACHED_SHADERS", v8::Uint32::New(isolate, 0x8B85));
5743
- tmpl->Set(isolate, "ACTIVE_ATTRIBUTES", v8::Uint32::New(isolate, 0x8B89));
5744
- tmpl->Set(isolate, "ACTIVE_UNIFORMS", v8::Uint32::New(isolate, 0x8B86));
5745
- tmpl->Set(isolate, "MAX_VERTEX_ATTRIBS", v8::Uint32::New(isolate, 0x8869));
5746
- tmpl->Set(isolate, "MAX_VERTEX_UNIFORM_VECTORS", v8::Uint32::New(isolate, 0x8DFB));
5747
- tmpl->Set(isolate, "MAX_VARYING_VECTORS", v8::Uint32::New(isolate, 0x8DFC));
5748
- tmpl->Set(isolate, "MAX_COMBINED_TEXTURE_IMAGE_UNITS", v8::Uint32::New(isolate, 0x8B4D));
5749
- tmpl->Set(isolate, "MAX_VERTEX_TEXTURE_IMAGE_UNITS", v8::Uint32::New(isolate, 0x8B4C));
5750
- tmpl->Set(isolate, "MAX_TEXTURE_IMAGE_UNITS", v8::Uint32::New(isolate, 0x8872));
5751
- tmpl->Set(isolate, "MAX_FRAGMENT_UNIFORM_VECTORS", v8::Uint32::New(isolate, 0x8DFD));
5752
- tmpl->Set(isolate, "SHADER_TYPE", v8::Uint32::New(isolate, 0x8B4F));
5753
- tmpl->Set(isolate, "SHADING_LANGUAGE_VERSION", v8::Uint32::New(isolate, 0x8B8C));
5754
- tmpl->Set(isolate, "CURRENT_PROGRAM", v8::Uint32::New(isolate, 0x8B8D));
5507
+ tmpl->Set(isolate, "LINK_STATUS", v8::Integer::NewFromUnsigned(isolate, 0x8B82));
5508
+ tmpl->Set(isolate, "VALIDATE_STATUS", v8::Integer::NewFromUnsigned(isolate, 0x8B83));
5509
+ tmpl->Set(isolate, "ATTACHED_SHADERS", v8::Integer::NewFromUnsigned(isolate, 0x8B85));
5510
+ tmpl->Set(isolate, "ACTIVE_ATTRIBUTES", v8::Integer::NewFromUnsigned(isolate, 0x8B89));
5511
+ tmpl->Set(isolate, "ACTIVE_UNIFORMS", v8::Integer::NewFromUnsigned(isolate, 0x8B86));
5512
+ tmpl->Set(isolate, "MAX_VERTEX_ATTRIBS", v8::Integer::NewFromUnsigned(isolate, 0x8869));
5513
+ tmpl->Set(isolate, "MAX_VERTEX_UNIFORM_VECTORS", v8::Integer::NewFromUnsigned(isolate, 0x8DFB));
5514
+ tmpl->Set(isolate, "MAX_VARYING_VECTORS", v8::Integer::NewFromUnsigned(isolate, 0x8DFC));
5515
+ tmpl->Set(isolate, "MAX_COMBINED_TEXTURE_IMAGE_UNITS",
5516
+ v8::Integer::NewFromUnsigned(isolate, 0x8B4D));
5517
+ tmpl->Set(isolate, "MAX_VERTEX_TEXTURE_IMAGE_UNITS",
5518
+ v8::Integer::NewFromUnsigned(isolate, 0x8B4C));
5519
+ tmpl->Set(isolate, "MAX_TEXTURE_IMAGE_UNITS", v8::Integer::NewFromUnsigned(isolate, 0x8872));
5520
+ tmpl->Set(isolate, "MAX_FRAGMENT_UNIFORM_VECTORS",
5521
+ v8::Integer::NewFromUnsigned(isolate, 0x8DFD));
5522
+ tmpl->Set(isolate, "SHADER_TYPE", v8::Integer::NewFromUnsigned(isolate, 0x8B4F));
5523
+ tmpl->Set(isolate, "SHADING_LANGUAGE_VERSION", v8::Integer::NewFromUnsigned(isolate, 0x8B8C));
5524
+ tmpl->Set(isolate, "CURRENT_PROGRAM", v8::Integer::NewFromUnsigned(isolate, 0x8B8D));
5755
5525
 
5756
5526
  /* Blending modes */
5757
5527
 
5758
- tmpl->Set(isolate, "NEVER", v8::Uint32::New(isolate, 0x0200));
5759
- tmpl->Set(isolate, "LESS", v8::Uint32::New(isolate, 0x0201));
5760
- tmpl->Set(isolate, "EQUAL", v8::Uint32::New(isolate, 0x0202));
5528
+ tmpl->Set(isolate, "NEVER", v8::Integer::NewFromUnsigned(isolate, 0x0200));
5529
+ tmpl->Set(isolate, "LESS", v8::Integer::NewFromUnsigned(isolate, 0x0201));
5530
+ tmpl->Set(isolate, "EQUAL", v8::Integer::NewFromUnsigned(isolate, 0x0202));
5761
5531
 
5762
5532
  /* Blending equations */
5763
5533
 
5764
5534
  /* Getting GL parameter information */
5765
5535
 
5766
- tmpl->Set(isolate, "LEQUAL", v8::Uint32::New(isolate, 0x0203));
5767
- tmpl->Set(isolate, "GREATER", v8::Uint32::New(isolate, 0x0204));
5768
- tmpl->Set(isolate, "NOTEQUAL", v8::Uint32::New(isolate, 0x0205));
5769
- tmpl->Set(isolate, "GEQUAL", v8::Uint32::New(isolate, 0x0206));
5770
- tmpl->Set(isolate, "ALWAYS", v8::Uint32::New(isolate, 0x0207));
5771
- tmpl->Set(isolate, "KEEP", v8::Uint32::New(isolate, 0x1E00));
5772
- tmpl->Set(isolate, "REPLACE", v8::Uint32::New(isolate, 0x1E01));
5773
- tmpl->Set(isolate, "INCR", v8::Uint32::New(isolate, 0x1E02));
5774
- tmpl->Set(isolate, "DECR", v8::Uint32::New(isolate, 0x1E03));
5775
- tmpl->Set(isolate, "INVERT", v8::Uint32::New(isolate, 0x150A));
5776
- tmpl->Set(isolate, "INCR_WRAP", v8::Uint32::New(isolate, 0x8507));
5777
- tmpl->Set(isolate, "DECR_WRAP", v8::Uint32::New(isolate, 0x8508));
5778
- tmpl->Set(isolate, "NEAREST", v8::Uint32::New(isolate, 0x2600));
5779
- tmpl->Set(isolate, "LINEAR", v8::Uint32::New(isolate, 0x2601));
5780
- tmpl->Set(isolate, "NEAREST_MIPMAP_NEAREST", v8::Uint32::New(isolate, 0x2700));
5781
- tmpl->Set(isolate, "LINEAR_MIPMAP_NEAREST", v8::Uint32::New(isolate, 0x2701));
5782
- tmpl->Set(isolate, "NEAREST_MIPMAP_LINEAR", v8::Uint32::New(isolate, 0x2702));
5783
- tmpl->Set(isolate, "LINEAR_MIPMAP_LINEAR", v8::Uint32::New(isolate, 0x2703));
5784
- tmpl->Set(isolate, "TEXTURE_MAG_FILTER", v8::Uint32::New(isolate, 0x2800));
5785
- tmpl->Set(isolate, "TEXTURE_MIN_FILTER", v8::Uint32::New(isolate, 0x2801));
5786
- tmpl->Set(isolate, "TEXTURE_WRAP_S", v8::Uint32::New(isolate, 0x2802));
5787
- tmpl->Set(isolate, "TEXTURE_WRAP_T", v8::Uint32::New(isolate, 0x2803));
5788
- tmpl->Set(isolate, "TEXTURE_2D", v8::Uint32::New(isolate, 0x0DE1));
5789
- tmpl->Set(isolate, "TEXTURE", v8::Uint32::New(isolate, 0x1702));
5790
- tmpl->Set(isolate, "TEXTURE_CUBE_MAP", v8::Uint32::New(isolate, 0x8513));
5791
- tmpl->Set(isolate, "TEXTURE_BINDING_CUBE_MAP", v8::Uint32::New(isolate, 0x8514));
5792
- tmpl->Set(isolate, "TEXTURE_CUBE_MAP_POSITIVE_X", v8::Uint32::New(isolate, 0x8515));
5793
- tmpl->Set(isolate, "TEXTURE_CUBE_MAP_NEGATIVE_X", v8::Uint32::New(isolate, 0x8516));
5794
- tmpl->Set(isolate, "TEXTURE_CUBE_MAP_POSITIVE_Y", v8::Uint32::New(isolate, 0x8517));
5795
- tmpl->Set(isolate, "TEXTURE_CUBE_MAP_NEGATIVE_Y", v8::Uint32::New(isolate, 0x8518));
5796
- tmpl->Set(isolate, "TEXTURE_CUBE_MAP_POSITIVE_Z", v8::Uint32::New(isolate, 0x8519));
5797
- tmpl->Set(isolate, "TEXTURE_CUBE_MAP_NEGATIVE_Z", v8::Uint32::New(isolate, 0x851A));
5798
- tmpl->Set(isolate, "MAX_CUBE_MAP_TEXTURE_SIZE", v8::Uint32::New(isolate, 0x851C));
5799
- tmpl->Set(isolate, "TEXTURE0", v8::Uint32::New(isolate, 0x84C0));
5800
- tmpl->Set(isolate, "TEXTURE1", v8::Uint32::New(isolate, 0x84C1));
5801
- tmpl->Set(isolate, "TEXTURE2", v8::Uint32::New(isolate, 0x84C2));
5802
- tmpl->Set(isolate, "TEXTURE3", v8::Uint32::New(isolate, 0x84C3));
5803
- tmpl->Set(isolate, "TEXTURE4", v8::Uint32::New(isolate, 0x84C4));
5804
- tmpl->Set(isolate, "TEXTURE5", v8::Uint32::New(isolate, 0x84C5));
5805
- tmpl->Set(isolate, "TEXTURE6", v8::Uint32::New(isolate, 0x84C6));
5806
- tmpl->Set(isolate, "TEXTURE7", v8::Uint32::New(isolate, 0x84C7));
5807
- tmpl->Set(isolate, "TEXTURE8", v8::Uint32::New(isolate, 0x84C8));
5808
- tmpl->Set(isolate, "TEXTURE9", v8::Uint32::New(isolate, 0x84C9));
5809
- tmpl->Set(isolate, "TEXTURE10", v8::Uint32::New(isolate, 0x84CA));
5810
- tmpl->Set(isolate, "TEXTURE11", v8::Uint32::New(isolate, 0x84CB));
5811
- tmpl->Set(isolate, "TEXTURE12", v8::Uint32::New(isolate, 0x84CC));
5812
- tmpl->Set(isolate, "TEXTURE13", v8::Uint32::New(isolate, 0x84CD));
5813
- tmpl->Set(isolate, "TEXTURE14", v8::Uint32::New(isolate, 0x84CE));
5814
- tmpl->Set(isolate, "TEXTURE15", v8::Uint32::New(isolate, 0x84CF));
5815
- tmpl->Set(isolate, "TEXTURE16", v8::Uint32::New(isolate, 0x84D0));
5816
- tmpl->Set(isolate, "TEXTURE17", v8::Uint32::New(isolate, 0x84D1));
5817
- tmpl->Set(isolate, "TEXTURE18", v8::Uint32::New(isolate, 0x84D2));
5818
- tmpl->Set(isolate, "TEXTURE19", v8::Uint32::New(isolate, 0x84D3));
5819
- tmpl->Set(isolate, "TEXTURE20", v8::Uint32::New(isolate, 0x84D4));
5820
- tmpl->Set(isolate, "TEXTURE21", v8::Uint32::New(isolate, 0x84D5));
5821
- tmpl->Set(isolate, "TEXTURE22", v8::Uint32::New(isolate, 0x84D6));
5822
- tmpl->Set(isolate, "TEXTURE23", v8::Uint32::New(isolate, 0x84D7));
5823
- tmpl->Set(isolate, "TEXTURE24", v8::Uint32::New(isolate, 0x84D8));
5824
- tmpl->Set(isolate, "TEXTURE25", v8::Uint32::New(isolate, 0x84D9));
5825
- tmpl->Set(isolate, "TEXTURE26", v8::Uint32::New(isolate, 0x84DA));
5826
- tmpl->Set(isolate, "TEXTURE27", v8::Uint32::New(isolate, 0x84DB));
5827
- tmpl->Set(isolate, "TEXTURE28", v8::Uint32::New(isolate, 0x84DC));
5828
- tmpl->Set(isolate, "TEXTURE29", v8::Uint32::New(isolate, 0x84DD));
5536
+ tmpl->Set(isolate, "LEQUAL", v8::Integer::NewFromUnsigned(isolate, 0x0203));
5537
+ tmpl->Set(isolate, "GREATER", v8::Integer::NewFromUnsigned(isolate, 0x0204));
5538
+ tmpl->Set(isolate, "NOTEQUAL", v8::Integer::NewFromUnsigned(isolate, 0x0205));
5539
+ tmpl->Set(isolate, "GEQUAL", v8::Integer::NewFromUnsigned(isolate, 0x0206));
5540
+ tmpl->Set(isolate, "ALWAYS", v8::Integer::NewFromUnsigned(isolate, 0x0207));
5541
+ tmpl->Set(isolate, "KEEP", v8::Integer::NewFromUnsigned(isolate, 0x1E00));
5542
+ tmpl->Set(isolate, "REPLACE", v8::Integer::NewFromUnsigned(isolate, 0x1E01));
5543
+ tmpl->Set(isolate, "INCR", v8::Integer::NewFromUnsigned(isolate, 0x1E02));
5544
+ tmpl->Set(isolate, "DECR", v8::Integer::NewFromUnsigned(isolate, 0x1E03));
5545
+ tmpl->Set(isolate, "INVERT", v8::Integer::NewFromUnsigned(isolate, 0x150A));
5546
+ tmpl->Set(isolate, "INCR_WRAP", v8::Integer::NewFromUnsigned(isolate, 0x8507));
5547
+ tmpl->Set(isolate, "DECR_WRAP", v8::Integer::NewFromUnsigned(isolate, 0x8508));
5548
+ tmpl->Set(isolate, "NEAREST", v8::Integer::NewFromUnsigned(isolate, 0x2600));
5549
+ tmpl->Set(isolate, "LINEAR", v8::Integer::NewFromUnsigned(isolate, 0x2601));
5550
+ tmpl->Set(isolate, "NEAREST_MIPMAP_NEAREST", v8::Integer::NewFromUnsigned(isolate, 0x2700));
5551
+ tmpl->Set(isolate, "LINEAR_MIPMAP_NEAREST", v8::Integer::NewFromUnsigned(isolate, 0x2701));
5552
+ tmpl->Set(isolate, "NEAREST_MIPMAP_LINEAR", v8::Integer::NewFromUnsigned(isolate, 0x2702));
5553
+ tmpl->Set(isolate, "LINEAR_MIPMAP_LINEAR", v8::Integer::NewFromUnsigned(isolate, 0x2703));
5554
+ tmpl->Set(isolate, "TEXTURE_MAG_FILTER", v8::Integer::NewFromUnsigned(isolate, 0x2800));
5555
+ tmpl->Set(isolate, "TEXTURE_MIN_FILTER", v8::Integer::NewFromUnsigned(isolate, 0x2801));
5556
+ tmpl->Set(isolate, "TEXTURE_WRAP_S", v8::Integer::NewFromUnsigned(isolate, 0x2802));
5557
+ tmpl->Set(isolate, "TEXTURE_WRAP_T", v8::Integer::NewFromUnsigned(isolate, 0x2803));
5558
+ tmpl->Set(isolate, "TEXTURE_2D", v8::Integer::NewFromUnsigned(isolate, 0x0DE1));
5559
+ tmpl->Set(isolate, "TEXTURE", v8::Integer::NewFromUnsigned(isolate, 0x1702));
5560
+ tmpl->Set(isolate, "TEXTURE_CUBE_MAP", v8::Integer::NewFromUnsigned(isolate, 0x8513));
5561
+ tmpl->Set(isolate, "TEXTURE_BINDING_CUBE_MAP", v8::Integer::NewFromUnsigned(isolate, 0x8514));
5562
+ tmpl->Set(isolate, "TEXTURE_CUBE_MAP_POSITIVE_X",
5563
+ v8::Integer::NewFromUnsigned(isolate, 0x8515));
5564
+ tmpl->Set(isolate, "TEXTURE_CUBE_MAP_NEGATIVE_X",
5565
+ v8::Integer::NewFromUnsigned(isolate, 0x8516));
5566
+ tmpl->Set(isolate, "TEXTURE_CUBE_MAP_POSITIVE_Y",
5567
+ v8::Integer::NewFromUnsigned(isolate, 0x8517));
5568
+ tmpl->Set(isolate, "TEXTURE_CUBE_MAP_NEGATIVE_Y",
5569
+ v8::Integer::NewFromUnsigned(isolate, 0x8518));
5570
+ tmpl->Set(isolate, "TEXTURE_CUBE_MAP_POSITIVE_Z",
5571
+ v8::Integer::NewFromUnsigned(isolate, 0x8519));
5572
+ tmpl->Set(isolate, "TEXTURE_CUBE_MAP_NEGATIVE_Z",
5573
+ v8::Integer::NewFromUnsigned(isolate, 0x851A));
5574
+ tmpl->Set(isolate, "MAX_CUBE_MAP_TEXTURE_SIZE", v8::Integer::NewFromUnsigned(isolate, 0x851C));
5575
+ tmpl->Set(isolate, "TEXTURE0", v8::Integer::NewFromUnsigned(isolate, 0x84C0));
5576
+ tmpl->Set(isolate, "TEXTURE1", v8::Integer::NewFromUnsigned(isolate, 0x84C1));
5577
+ tmpl->Set(isolate, "TEXTURE2", v8::Integer::NewFromUnsigned(isolate, 0x84C2));
5578
+ tmpl->Set(isolate, "TEXTURE3", v8::Integer::NewFromUnsigned(isolate, 0x84C3));
5579
+ tmpl->Set(isolate, "TEXTURE4", v8::Integer::NewFromUnsigned(isolate, 0x84C4));
5580
+ tmpl->Set(isolate, "TEXTURE5", v8::Integer::NewFromUnsigned(isolate, 0x84C5));
5581
+ tmpl->Set(isolate, "TEXTURE6", v8::Integer::NewFromUnsigned(isolate, 0x84C6));
5582
+ tmpl->Set(isolate, "TEXTURE7", v8::Integer::NewFromUnsigned(isolate, 0x84C7));
5583
+ tmpl->Set(isolate, "TEXTURE8", v8::Integer::NewFromUnsigned(isolate, 0x84C8));
5584
+ tmpl->Set(isolate, "TEXTURE9", v8::Integer::NewFromUnsigned(isolate, 0x84C9));
5585
+ tmpl->Set(isolate, "TEXTURE10", v8::Integer::NewFromUnsigned(isolate, 0x84CA));
5586
+ tmpl->Set(isolate, "TEXTURE11", v8::Integer::NewFromUnsigned(isolate, 0x84CB));
5587
+ tmpl->Set(isolate, "TEXTURE12", v8::Integer::NewFromUnsigned(isolate, 0x84CC));
5588
+ tmpl->Set(isolate, "TEXTURE13", v8::Integer::NewFromUnsigned(isolate, 0x84CD));
5589
+ tmpl->Set(isolate, "TEXTURE14", v8::Integer::NewFromUnsigned(isolate, 0x84CE));
5590
+ tmpl->Set(isolate, "TEXTURE15", v8::Integer::NewFromUnsigned(isolate, 0x84CF));
5591
+ tmpl->Set(isolate, "TEXTURE16", v8::Integer::NewFromUnsigned(isolate, 0x84D0));
5592
+ tmpl->Set(isolate, "TEXTURE17", v8::Integer::NewFromUnsigned(isolate, 0x84D1));
5593
+ tmpl->Set(isolate, "TEXTURE18", v8::Integer::NewFromUnsigned(isolate, 0x84D2));
5594
+ tmpl->Set(isolate, "TEXTURE19", v8::Integer::NewFromUnsigned(isolate, 0x84D3));
5595
+ tmpl->Set(isolate, "TEXTURE20", v8::Integer::NewFromUnsigned(isolate, 0x84D4));
5596
+ tmpl->Set(isolate, "TEXTURE21", v8::Integer::NewFromUnsigned(isolate, 0x84D5));
5597
+ tmpl->Set(isolate, "TEXTURE22", v8::Integer::NewFromUnsigned(isolate, 0x84D6));
5598
+ tmpl->Set(isolate, "TEXTURE23", v8::Integer::NewFromUnsigned(isolate, 0x84D7));
5599
+ tmpl->Set(isolate, "TEXTURE24", v8::Integer::NewFromUnsigned(isolate, 0x84D8));
5600
+ tmpl->Set(isolate, "TEXTURE25", v8::Integer::NewFromUnsigned(isolate, 0x84D9));
5601
+ tmpl->Set(isolate, "TEXTURE26", v8::Integer::NewFromUnsigned(isolate, 0x84DA));
5602
+ tmpl->Set(isolate, "TEXTURE27", v8::Integer::NewFromUnsigned(isolate, 0x84DB));
5603
+ tmpl->Set(isolate, "TEXTURE28", v8::Integer::NewFromUnsigned(isolate, 0x84DC));
5604
+ tmpl->Set(isolate, "TEXTURE29", v8::Integer::NewFromUnsigned(isolate, 0x84DD));
5829
5605
 
5830
5606
  /* Getting GL parameter information */
5831
5607
 
5832
5608
  /* Buffers */
5833
5609
 
5834
- tmpl->Set(isolate, "TEXTURE30", v8::Uint32::New(isolate, 0x84DE));
5835
- tmpl->Set(isolate, "TEXTURE31", v8::Uint32::New(isolate, 0x84DF));
5836
- tmpl->Set(isolate, "ACTIVE_TEXTURE", v8::Uint32::New(isolate, 0x84E0));
5837
- tmpl->Set(isolate, "REPEAT", v8::Uint32::New(isolate, 0x2901));
5838
- tmpl->Set(isolate, "CLAMP_TO_EDGE", v8::Uint32::New(isolate, 0x812F));
5839
- tmpl->Set(isolate, "MIRRORED_REPEAT", v8::Uint32::New(isolate, 0x8370));
5840
- tmpl->Set(isolate, "FLOAT_VEC2", v8::Uint32::New(isolate, 0x8B50));
5610
+ tmpl->Set(isolate, "TEXTURE30", v8::Integer::NewFromUnsigned(isolate, 0x84DE));
5611
+ tmpl->Set(isolate, "TEXTURE31", v8::Integer::NewFromUnsigned(isolate, 0x84DF));
5612
+ tmpl->Set(isolate, "ACTIVE_TEXTURE", v8::Integer::NewFromUnsigned(isolate, 0x84E0));
5613
+ tmpl->Set(isolate, "REPEAT", v8::Integer::NewFromUnsigned(isolate, 0x2901));
5614
+ tmpl->Set(isolate, "CLAMP_TO_EDGE", v8::Integer::NewFromUnsigned(isolate, 0x812F));
5615
+ tmpl->Set(isolate, "MIRRORED_REPEAT", v8::Integer::NewFromUnsigned(isolate, 0x8370));
5616
+ tmpl->Set(isolate, "FLOAT_VEC2", v8::Integer::NewFromUnsigned(isolate, 0x8B50));
5841
5617
 
5842
5618
  /* Buffers */
5843
5619
 
5844
5620
  /* Vertex attributes */
5845
5621
 
5846
- tmpl->Set(isolate, "FLOAT_VEC3", v8::Uint32::New(isolate, 0x8B51));
5847
- tmpl->Set(isolate, "FLOAT_VEC4", v8::Uint32::New(isolate, 0x8B52));
5848
- tmpl->Set(isolate, "INT_VEC2", v8::Uint32::New(isolate, 0x8B53));
5849
- tmpl->Set(isolate, "INT_VEC3", v8::Uint32::New(isolate, 0x8B54));
5850
- tmpl->Set(isolate, "INT_VEC4", v8::Uint32::New(isolate, 0x8B55));
5851
- tmpl->Set(isolate, "BOOL", v8::Uint32::New(isolate, 0x8B56));
5852
- tmpl->Set(isolate, "BOOL_VEC2", v8::Uint32::New(isolate, 0x8B57));
5853
- tmpl->Set(isolate, "BOOL_VEC3", v8::Uint32::New(isolate, 0x8B58));
5622
+ tmpl->Set(isolate, "FLOAT_VEC3", v8::Integer::NewFromUnsigned(isolate, 0x8B51));
5623
+ tmpl->Set(isolate, "FLOAT_VEC4", v8::Integer::NewFromUnsigned(isolate, 0x8B52));
5624
+ tmpl->Set(isolate, "INT_VEC2", v8::Integer::NewFromUnsigned(isolate, 0x8B53));
5625
+ tmpl->Set(isolate, "INT_VEC3", v8::Integer::NewFromUnsigned(isolate, 0x8B54));
5626
+ tmpl->Set(isolate, "INT_VEC4", v8::Integer::NewFromUnsigned(isolate, 0x8B55));
5627
+ tmpl->Set(isolate, "BOOL", v8::Integer::NewFromUnsigned(isolate, 0x8B56));
5628
+ tmpl->Set(isolate, "BOOL_VEC2", v8::Integer::NewFromUnsigned(isolate, 0x8B57));
5629
+ tmpl->Set(isolate, "BOOL_VEC3", v8::Integer::NewFromUnsigned(isolate, 0x8B58));
5854
5630
 
5855
5631
  /* Vertex attributes */
5856
5632
 
5857
5633
  /* Culling */
5858
5634
 
5859
- tmpl->Set(isolate, "BOOL_VEC4", v8::Uint32::New(isolate, 0x8B59));
5860
- tmpl->Set(isolate, "FLOAT_MAT2", v8::Uint32::New(isolate, 0x8B5A));
5861
- tmpl->Set(isolate, "FLOAT_MAT3", v8::Uint32::New(isolate, 0x8B5B));
5862
- tmpl->Set(isolate, "FLOAT_MAT4", v8::Uint32::New(isolate, 0x8B5C));
5635
+ tmpl->Set(isolate, "BOOL_VEC4", v8::Integer::NewFromUnsigned(isolate, 0x8B59));
5636
+ tmpl->Set(isolate, "FLOAT_MAT2", v8::Integer::NewFromUnsigned(isolate, 0x8B5A));
5637
+ tmpl->Set(isolate, "FLOAT_MAT3", v8::Integer::NewFromUnsigned(isolate, 0x8B5B));
5638
+ tmpl->Set(isolate, "FLOAT_MAT4", v8::Integer::NewFromUnsigned(isolate, 0x8B5C));
5863
5639
 
5864
5640
  /* Culling */
5865
5641
 
5866
5642
  /* Enabling and disabling */
5867
5643
 
5868
- tmpl->Set(isolate, "SAMPLER_2D", v8::Uint32::New(isolate, 0x8B5E));
5869
- tmpl->Set(isolate, "SAMPLER_CUBE", v8::Uint32::New(isolate, 0x8B60));
5870
- tmpl->Set(isolate, "LOW_FLOAT", v8::Uint32::New(isolate, 0x8DF0));
5871
- tmpl->Set(isolate, "MEDIUM_FLOAT", v8::Uint32::New(isolate, 0x8DF1));
5872
- tmpl->Set(isolate, "HIGH_FLOAT", v8::Uint32::New(isolate, 0x8DF2));
5873
- tmpl->Set(isolate, "LOW_INT", v8::Uint32::New(isolate, 0x8DF3));
5874
- tmpl->Set(isolate, "MEDIUM_INT", v8::Uint32::New(isolate, 0x8DF4));
5875
- tmpl->Set(isolate, "HIGH_INT", v8::Uint32::New(isolate, 0x8DF5));
5644
+ tmpl->Set(isolate, "SAMPLER_2D", v8::Integer::NewFromUnsigned(isolate, 0x8B5E));
5645
+ tmpl->Set(isolate, "SAMPLER_CUBE", v8::Integer::NewFromUnsigned(isolate, 0x8B60));
5646
+ tmpl->Set(isolate, "LOW_FLOAT", v8::Integer::NewFromUnsigned(isolate, 0x8DF0));
5647
+ tmpl->Set(isolate, "MEDIUM_FLOAT", v8::Integer::NewFromUnsigned(isolate, 0x8DF1));
5648
+ tmpl->Set(isolate, "HIGH_FLOAT", v8::Integer::NewFromUnsigned(isolate, 0x8DF2));
5649
+ tmpl->Set(isolate, "LOW_INT", v8::Integer::NewFromUnsigned(isolate, 0x8DF3));
5650
+ tmpl->Set(isolate, "MEDIUM_INT", v8::Integer::NewFromUnsigned(isolate, 0x8DF4));
5651
+ tmpl->Set(isolate, "HIGH_INT", v8::Integer::NewFromUnsigned(isolate, 0x8DF5));
5876
5652
 
5877
5653
  /* Enabling and disabling */
5878
5654
 
5879
- tmpl->Set(isolate, "FRAMEBUFFER", v8::Uint32::New(isolate, 0x8D40));
5880
- tmpl->Set(isolate, "RENDERBUFFER", v8::Uint32::New(isolate, 0x8D41));
5881
- tmpl->Set(isolate, "RGBA4", v8::Uint32::New(isolate, 0x8056));
5882
- tmpl->Set(isolate, "RGB5_A1", v8::Uint32::New(isolate, 0x8057));
5883
- tmpl->Set(isolate, "RGB565", v8::Uint32::New(isolate, 0x8D62));
5884
- tmpl->Set(isolate, "DEPTH_COMPONENT16", v8::Uint32::New(isolate, 0x81A5));
5885
- tmpl->Set(isolate, "STENCIL_INDEX8", v8::Uint32::New(isolate, 0x8D48));
5655
+ tmpl->Set(isolate, "FRAMEBUFFER", v8::Integer::NewFromUnsigned(isolate, 0x8D40));
5656
+ tmpl->Set(isolate, "RENDERBUFFER", v8::Integer::NewFromUnsigned(isolate, 0x8D41));
5657
+ tmpl->Set(isolate, "RGBA4", v8::Integer::NewFromUnsigned(isolate, 0x8056));
5658
+ tmpl->Set(isolate, "RGB5_A1", v8::Integer::NewFromUnsigned(isolate, 0x8057));
5659
+ tmpl->Set(isolate, "RGB565", v8::Integer::NewFromUnsigned(isolate, 0x8D62));
5660
+ tmpl->Set(isolate, "DEPTH_COMPONENT16", v8::Integer::NewFromUnsigned(isolate, 0x81A5));
5661
+ tmpl->Set(isolate, "STENCIL_INDEX8", v8::Integer::NewFromUnsigned(isolate, 0x8D48));
5886
5662
 
5887
5663
  /* Errors */
5888
5664
 
5889
5665
  /* Front face directions */
5890
5666
 
5891
- tmpl->Set(isolate, "DEPTH_STENCIL", v8::Uint32::New(isolate, 0x84F9));
5892
- tmpl->Set(isolate, "RENDERBUFFER_WIDTH", v8::Uint32::New(isolate, 0x8D42));
5667
+ tmpl->Set(isolate, "DEPTH_STENCIL", v8::Integer::NewFromUnsigned(isolate, 0x84F9));
5668
+ tmpl->Set(isolate, "RENDERBUFFER_WIDTH", v8::Integer::NewFromUnsigned(isolate, 0x8D42));
5893
5669
 
5894
5670
  /* Front face directions */
5895
5671
 
5896
5672
  /* Hints */
5897
5673
 
5898
- tmpl->Set(isolate, "RENDERBUFFER_HEIGHT", v8::Uint32::New(isolate, 0x8D43));
5899
- tmpl->Set(isolate, "RENDERBUFFER_INTERNAL_FORMAT", v8::Uint32::New(isolate, 0x8D44));
5900
- tmpl->Set(isolate, "RENDERBUFFER_RED_SIZE", v8::Uint32::New(isolate, 0x8D50));
5901
- tmpl->Set(isolate, "RENDERBUFFER_GREEN_SIZE", v8::Uint32::New(isolate, 0x8D51));
5674
+ tmpl->Set(isolate, "RENDERBUFFER_HEIGHT", v8::Integer::NewFromUnsigned(isolate, 0x8D43));
5675
+ tmpl->Set(isolate, "RENDERBUFFER_INTERNAL_FORMAT",
5676
+ v8::Integer::NewFromUnsigned(isolate, 0x8D44));
5677
+ tmpl->Set(isolate, "RENDERBUFFER_RED_SIZE", v8::Integer::NewFromUnsigned(isolate, 0x8D50));
5678
+ tmpl->Set(isolate, "RENDERBUFFER_GREEN_SIZE", v8::Integer::NewFromUnsigned(isolate, 0x8D51));
5902
5679
 
5903
5680
  /* Hints */
5904
5681
 
5905
5682
  /* Data types */
5906
5683
 
5907
- tmpl->Set(isolate, "RENDERBUFFER_BLUE_SIZE", v8::Uint32::New(isolate, 0x8D52));
5908
- tmpl->Set(isolate, "RENDERBUFFER_ALPHA_SIZE", v8::Uint32::New(isolate, 0x8D53));
5909
- tmpl->Set(isolate, "RENDERBUFFER_DEPTH_SIZE", v8::Uint32::New(isolate, 0x8D54));
5910
- tmpl->Set(isolate, "RENDERBUFFER_STENCIL_SIZE", v8::Uint32::New(isolate, 0x8D55));
5911
- tmpl->Set(isolate, "FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE", v8::Uint32::New(isolate, 0x8CD0));
5912
- tmpl->Set(isolate, "FRAMEBUFFER_ATTACHMENT_OBJECT_NAME", v8::Uint32::New(isolate, 0x8CD1));
5913
- tmpl->Set(isolate, "FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL", v8::Uint32::New(isolate, 0x8CD2));
5684
+ tmpl->Set(isolate, "RENDERBUFFER_BLUE_SIZE", v8::Integer::NewFromUnsigned(isolate, 0x8D52));
5685
+ tmpl->Set(isolate, "RENDERBUFFER_ALPHA_SIZE", v8::Integer::NewFromUnsigned(isolate, 0x8D53));
5686
+ tmpl->Set(isolate, "RENDERBUFFER_DEPTH_SIZE", v8::Integer::NewFromUnsigned(isolate, 0x8D54));
5687
+ tmpl->Set(isolate, "RENDERBUFFER_STENCIL_SIZE", v8::Integer::NewFromUnsigned(isolate, 0x8D55));
5688
+ tmpl->Set(isolate, "FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE",
5689
+ v8::Integer::NewFromUnsigned(isolate, 0x8CD0));
5690
+ tmpl->Set(isolate, "FRAMEBUFFER_ATTACHMENT_OBJECT_NAME",
5691
+ v8::Integer::NewFromUnsigned(isolate, 0x8CD1));
5692
+ tmpl->Set(isolate, "FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL",
5693
+ v8::Integer::NewFromUnsigned(isolate, 0x8CD2));
5914
5694
 
5915
5695
  /* Data types */
5916
5696
 
5917
5697
  /* Pixel formats */
5918
5698
 
5919
5699
  tmpl->Set(isolate, "FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE",
5920
- v8::Uint32::New(isolate, 0x8CD3));
5921
- tmpl->Set(isolate, "COLOR_ATTACHMENT0", v8::Uint32::New(isolate, 0x8CE0));
5922
- tmpl->Set(isolate, "DEPTH_ATTACHMENT", v8::Uint32::New(isolate, 0x8D00));
5923
- tmpl->Set(isolate, "STENCIL_ATTACHMENT", v8::Uint32::New(isolate, 0x8D20));
5924
- tmpl->Set(isolate, "DEPTH_STENCIL_ATTACHMENT", v8::Uint32::New(isolate, 0x821A));
5925
- tmpl->Set(isolate, "NONE", v8::Uint32::New(isolate, 0));
5700
+ v8::Integer::NewFromUnsigned(isolate, 0x8CD3));
5701
+ tmpl->Set(isolate, "COLOR_ATTACHMENT0", v8::Integer::NewFromUnsigned(isolate, 0x8CE0));
5702
+ tmpl->Set(isolate, "DEPTH_ATTACHMENT", v8::Integer::NewFromUnsigned(isolate, 0x8D00));
5703
+ tmpl->Set(isolate, "STENCIL_ATTACHMENT", v8::Integer::NewFromUnsigned(isolate, 0x8D20));
5704
+ tmpl->Set(isolate, "DEPTH_STENCIL_ATTACHMENT", v8::Integer::NewFromUnsigned(isolate, 0x821A));
5705
+ tmpl->Set(isolate, "NONE", v8::Integer::NewFromUnsigned(isolate, 0));
5926
5706
 
5927
5707
  /* Pixel formats */
5928
5708
 
5929
5709
  /* Pixel types */
5930
5710
 
5931
- tmpl->Set(isolate, "FRAMEBUFFER_COMPLETE", v8::Uint32::New(isolate, 0x8CD5));
5932
- tmpl->Set(isolate, "FRAMEBUFFER_INCOMPLETE_ATTACHMENT", v8::Uint32::New(isolate, 0x8CD6));
5711
+ tmpl->Set(isolate, "FRAMEBUFFER_COMPLETE", v8::Integer::NewFromUnsigned(isolate, 0x8CD5));
5712
+ tmpl->Set(isolate, "FRAMEBUFFER_INCOMPLETE_ATTACHMENT",
5713
+ v8::Integer::NewFromUnsigned(isolate, 0x8CD6));
5933
5714
  tmpl->Set(isolate, "FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT",
5934
- v8::Uint32::New(isolate, 0x8CD7));
5715
+ v8::Integer::NewFromUnsigned(isolate, 0x8CD7));
5935
5716
 
5936
5717
  /* Pixel types */
5937
5718
 
5938
5719
  /* Shaders */
5939
5720
 
5940
- tmpl->Set(isolate, "FRAMEBUFFER_INCOMPLETE_DIMENSIONS", v8::Uint32::New(isolate, 0x8CD9));
5941
- tmpl->Set(isolate, "FRAMEBUFFER_UNSUPPORTED", v8::Uint32::New(isolate, 0x8CDD));
5942
- tmpl->Set(isolate, "FRAMEBUFFER_BINDING", v8::Uint32::New(isolate, 0x8CA6));
5943
- tmpl->Set(isolate, "RENDERBUFFER_BINDING", v8::Uint32::New(isolate, 0x8CA7));
5944
- tmpl->Set(isolate, "MAX_RENDERBUFFER_SIZE", v8::Uint32::New(isolate, 0x84E8));
5945
- tmpl->Set(isolate, "INVALID_FRAMEBUFFER_OPERATION", v8::Uint32::New(isolate, 0x0506));
5946
- tmpl->Set(isolate, "UNPACK_FLIP_Y_WEBGL", v8::Uint32::New(isolate, 0x9240));
5947
- tmpl->Set(isolate, "UNPACK_PREMULTIPLY_ALPHA_WEBGL", v8::Uint32::New(isolate, 0x9241));
5948
- tmpl->Set(isolate, "UNPACK_COLORSPACE_CONVERSION_WEBGL", v8::Uint32::New(isolate, 0x9243));
5721
+ tmpl->Set(isolate, "FRAMEBUFFER_INCOMPLETE_DIMENSIONS",
5722
+ v8::Integer::NewFromUnsigned(isolate, 0x8CD9));
5723
+ tmpl->Set(isolate, "FRAMEBUFFER_UNSUPPORTED", v8::Integer::NewFromUnsigned(isolate, 0x8CDD));
5724
+ tmpl->Set(isolate, "FRAMEBUFFER_BINDING", v8::Integer::NewFromUnsigned(isolate, 0x8CA6));
5725
+ tmpl->Set(isolate, "RENDERBUFFER_BINDING", v8::Integer::NewFromUnsigned(isolate, 0x8CA7));
5726
+ tmpl->Set(isolate, "MAX_RENDERBUFFER_SIZE", v8::Integer::NewFromUnsigned(isolate, 0x84E8));
5727
+ tmpl->Set(isolate, "INVALID_FRAMEBUFFER_OPERATION",
5728
+ v8::Integer::NewFromUnsigned(isolate, 0x0506));
5729
+ tmpl->Set(isolate, "UNPACK_FLIP_Y_WEBGL", v8::Integer::NewFromUnsigned(isolate, 0x9240));
5730
+ tmpl->Set(isolate, "UNPACK_PREMULTIPLY_ALPHA_WEBGL",
5731
+ v8::Integer::NewFromUnsigned(isolate, 0x9241));
5732
+ tmpl->Set(isolate, "UNPACK_COLORSPACE_CONVERSION_WEBGL",
5733
+ v8::Integer::NewFromUnsigned(isolate, 0x9243));
5949
5734
  }
5950
5735
 
5951
5736
  void WebGLRenderingContext::SetProps(v8::Isolate *isolate,