@nativescript/canvas 2.0.0-alpha.21 → 2.0.0-alpha.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Canvas/index.android.js +1 -3
- package/Canvas/index.android.js.map +1 -1
- package/WebGL/WebGLRenderingContext/index.js.map +1 -1
- package/package.json +1 -1
- package/platforms/android/canvas-release.aar +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/dSYMs/CanvasNative.framework.dSYM/Contents/Resources/DWARF/CanvasNative +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/dSYMs/CanvasNative.framework.dSYM/Contents/Resources/DWARF/CanvasNative +0 -0
- package/platforms/ios/src/cpp/canvas2d/CanvasRenderingContext2DImpl.cpp +291 -302
- package/platforms/ios/src/cpp/webgl/WebGLRenderingContext.cpp +1059 -1293
- package/platforms/ios/src/cpp/webgl2/WebGL2RenderingContext.cpp +859 -996
|
@@ -359,23 +359,21 @@ void WebGLRenderingContext::BindAttribLocation(const v8::FunctionCallbackInfo<v8
|
|
|
359
359
|
auto isolate = args.GetIsolate();
|
|
360
360
|
auto context = isolate->GetCurrentContext();
|
|
361
361
|
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
);
|
|
362
|
+
auto programValue = args[0];
|
|
363
|
+
auto type = GetNativeType(isolate, programValue);
|
|
364
|
+
if (type == NativeType::WebGLProgram && args[1]->IsNumber() &&
|
|
365
|
+
args[2]->IsString()) {
|
|
366
|
+
auto program = WebGLProgram::GetPointer(programValue.As<v8::Object>());
|
|
367
|
+
|
|
368
|
+
auto index = (uint32_t) args[1]->NumberValue(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,32 +386,30 @@ 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
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
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 ?
|
|
389
|
+
if (args[0]->IsNumber()) {
|
|
390
|
+
auto target = (uint32_t) args[0]->NumberValue(context).ToChecked();
|
|
391
|
+
if (!args[1]->IsNull() &&
|
|
392
|
+
args[1]->IsObject()) {
|
|
393
|
+
auto type = GetNativeType(isolate, args[1].As<v8::Object>());
|
|
394
|
+
if (type == NativeType::WebGLBuffer) {
|
|
395
|
+
auto buffer = WebGLBuffer::GetPointer(args[1].As<v8::Object>());
|
|
396
|
+
if (buffer ==
|
|
397
|
+
nullptr) { return; }
|
|
411
398
|
canvas_native_webgl_bind_buffer(
|
|
412
399
|
target,
|
|
413
|
-
|
|
400
|
+
buffer->GetBuffer(),
|
|
414
401
|
ptr->GetState()
|
|
415
402
|
);
|
|
416
403
|
}
|
|
404
|
+
|
|
405
|
+
} else {
|
|
406
|
+
// unbind
|
|
407
|
+
// check for null or undefined ?
|
|
408
|
+
canvas_native_webgl_bind_buffer(
|
|
409
|
+
target,
|
|
410
|
+
0,
|
|
411
|
+
ptr->GetState()
|
|
412
|
+
);
|
|
417
413
|
}
|
|
418
414
|
}
|
|
419
415
|
}
|
|
@@ -427,28 +423,26 @@ void WebGLRenderingContext::BindFramebuffer(const v8::FunctionCallbackInfo<v8::V
|
|
|
427
423
|
auto isolate = args.GetIsolate();
|
|
428
424
|
auto context = isolate->GetCurrentContext();
|
|
429
425
|
|
|
430
|
-
if (args
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
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
|
|
426
|
+
if (args[0]->IsNumber()) {
|
|
427
|
+
auto target = (uint32_t) args[0]->NumberValue(context).ToChecked();
|
|
428
|
+
if (args[1]->IsObject()) {
|
|
429
|
+
auto type = GetNativeType(isolate, args[1].As<v8::Object>());
|
|
430
|
+
if (type == NativeType::WebGLFramebuffer) {
|
|
431
|
+
auto framebuffer = WebGLFramebuffer::GetPointer(args[1].As<v8::Object>());
|
|
446
432
|
canvas_native_webgl_bind_frame_buffer(
|
|
447
433
|
target,
|
|
448
|
-
|
|
434
|
+
framebuffer->GetFrameBuffer(),
|
|
449
435
|
ptr->GetState()
|
|
450
436
|
);
|
|
451
437
|
}
|
|
438
|
+
} else {
|
|
439
|
+
// null value
|
|
440
|
+
// unbind
|
|
441
|
+
canvas_native_webgl_bind_frame_buffer(
|
|
442
|
+
target,
|
|
443
|
+
0,
|
|
444
|
+
ptr->GetState()
|
|
445
|
+
);
|
|
452
446
|
}
|
|
453
447
|
}
|
|
454
448
|
}
|
|
@@ -462,29 +456,27 @@ void WebGLRenderingContext::BindRenderbuffer(const v8::FunctionCallbackInfo<v8::
|
|
|
462
456
|
auto isolate = args.GetIsolate();
|
|
463
457
|
auto context = isolate->GetCurrentContext();
|
|
464
458
|
|
|
465
|
-
if (args
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
nullptr) { return; }
|
|
475
|
-
canvas_native_webgl_bind_render_buffer(
|
|
476
|
-
target,
|
|
477
|
-
renderbuffer->GetRenderBuffer(),
|
|
478
|
-
ptr->GetState()
|
|
479
|
-
);
|
|
480
|
-
}
|
|
481
|
-
} else {
|
|
459
|
+
if (args[0]->IsNumber()) {
|
|
460
|
+
auto target = (uint32_t) args[0]->NumberValue(context).ToChecked();
|
|
461
|
+
if (args[1]->IsObject()) {
|
|
462
|
+
auto type = GetNativeType(isolate, args[1].As<v8::Object>());
|
|
463
|
+
if (type == NativeType::WebGLRenderbuffer) {
|
|
464
|
+
auto renderbuffer = WebGLRenderbuffer::GetPointer(args[1].As<v8::Object>());
|
|
465
|
+
|
|
466
|
+
if (renderbuffer ==
|
|
467
|
+
nullptr) { return; }
|
|
482
468
|
canvas_native_webgl_bind_render_buffer(
|
|
483
469
|
target,
|
|
484
|
-
|
|
470
|
+
renderbuffer->GetRenderBuffer(),
|
|
485
471
|
ptr->GetState()
|
|
486
472
|
);
|
|
487
473
|
}
|
|
474
|
+
} else {
|
|
475
|
+
canvas_native_webgl_bind_render_buffer(
|
|
476
|
+
target,
|
|
477
|
+
0,
|
|
478
|
+
ptr->GetState()
|
|
479
|
+
);
|
|
488
480
|
}
|
|
489
481
|
}
|
|
490
482
|
}
|
|
@@ -498,26 +490,24 @@ void WebGLRenderingContext::BindTexture(const v8::FunctionCallbackInfo<v8::Value
|
|
|
498
490
|
auto isolate = args.GetIsolate();
|
|
499
491
|
auto context = isolate->GetCurrentContext();
|
|
500
492
|
|
|
501
|
-
if (args
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
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 {
|
|
493
|
+
if (args[0]->IsNumber()) {
|
|
494
|
+
auto target = (uint32_t) args[0]->NumberValue(context).ToChecked();
|
|
495
|
+
if (args[1]->IsObject()) {
|
|
496
|
+
auto type = GetNativeType(isolate, args[1].As<v8::Object>());
|
|
497
|
+
if (type == NativeType::WebGLTexture) {
|
|
498
|
+
auto texture = WebGLTexture::GetPointer(args[1].As<v8::Object>());
|
|
515
499
|
canvas_native_webgl_bind_texture(
|
|
516
500
|
target,
|
|
517
|
-
|
|
501
|
+
texture->GetTexture(),
|
|
518
502
|
ptr->GetState()
|
|
519
503
|
);
|
|
520
504
|
}
|
|
505
|
+
} else {
|
|
506
|
+
canvas_native_webgl_bind_texture(
|
|
507
|
+
target,
|
|
508
|
+
0,
|
|
509
|
+
ptr->GetState()
|
|
510
|
+
);
|
|
521
511
|
}
|
|
522
512
|
}
|
|
523
513
|
}
|
|
@@ -531,20 +521,18 @@ void WebGLRenderingContext::BlendColor(const v8::FunctionCallbackInfo<v8::Value>
|
|
|
531
521
|
auto isolate = args.GetIsolate();
|
|
532
522
|
auto context = isolate->GetCurrentContext();
|
|
533
523
|
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
);
|
|
547
|
-
}
|
|
524
|
+
auto red = args[0]->NumberValue(context).ToChecked();
|
|
525
|
+
auto green = args[1]->NumberValue(context).ToChecked();
|
|
526
|
+
auto blue = args[2]->NumberValue(context).ToChecked();
|
|
527
|
+
auto alpha = args[3]->NumberValue(context).ToChecked();
|
|
528
|
+
|
|
529
|
+
canvas_native_webgl_blend_color(
|
|
530
|
+
static_cast<float>(red),
|
|
531
|
+
static_cast<float>(green),
|
|
532
|
+
static_cast<float>(blue),
|
|
533
|
+
static_cast<float>(alpha),
|
|
534
|
+
ptr->GetState()
|
|
535
|
+
);
|
|
548
536
|
}
|
|
549
537
|
|
|
550
538
|
void WebGLRenderingContext::BlendEquationSeparate(const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
@@ -556,16 +544,14 @@ void WebGLRenderingContext::BlendEquationSeparate(const v8::FunctionCallbackInfo
|
|
|
556
544
|
auto isolate = args.GetIsolate();
|
|
557
545
|
auto context = isolate->GetCurrentContext();
|
|
558
546
|
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
auto modeAlpha = (uint32_t) args[1]->NumberValue(context).ToChecked();
|
|
547
|
+
auto modeRGB = (uint32_t) args[0]->NumberValue(context).ToChecked();
|
|
548
|
+
auto modeAlpha = (uint32_t) args[1]->NumberValue(context).ToChecked();
|
|
562
549
|
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
}
|
|
550
|
+
canvas_native_webgl_blend_equation_separate(
|
|
551
|
+
modeRGB,
|
|
552
|
+
modeAlpha,
|
|
553
|
+
ptr->GetState()
|
|
554
|
+
);
|
|
569
555
|
}
|
|
570
556
|
|
|
571
557
|
void WebGLRenderingContext::BlendEquation(const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
@@ -577,13 +563,11 @@ void WebGLRenderingContext::BlendEquation(const v8::FunctionCallbackInfo<v8::Val
|
|
|
577
563
|
auto isolate = args.GetIsolate();
|
|
578
564
|
auto context = isolate->GetCurrentContext();
|
|
579
565
|
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
);
|
|
586
|
-
}
|
|
566
|
+
auto mode = (uint32_t) args[0]->NumberValue(context).ToChecked();
|
|
567
|
+
canvas_native_webgl_blend_equation(
|
|
568
|
+
mode,
|
|
569
|
+
ptr->GetState()
|
|
570
|
+
);
|
|
587
571
|
}
|
|
588
572
|
|
|
589
573
|
void WebGLRenderingContext::BlendFuncSeparate(const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
@@ -595,20 +579,18 @@ void WebGLRenderingContext::BlendFuncSeparate(const v8::FunctionCallbackInfo<v8:
|
|
|
595
579
|
auto isolate = args.GetIsolate();
|
|
596
580
|
auto context = isolate->GetCurrentContext();
|
|
597
581
|
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
);
|
|
611
|
-
}
|
|
582
|
+
auto srcRGB = (uint32_t) args[0]->NumberValue(context).ToChecked();
|
|
583
|
+
auto dstRGB = (uint32_t) args[1]->NumberValue(context).ToChecked();
|
|
584
|
+
auto srcAlpha = (uint32_t) args[2]->NumberValue(context).ToChecked();
|
|
585
|
+
auto dstAlpha = (uint32_t) args[3]->NumberValue(context).ToChecked();
|
|
586
|
+
|
|
587
|
+
canvas_native_webgl_blend_func_separate(
|
|
588
|
+
srcRGB,
|
|
589
|
+
dstRGB,
|
|
590
|
+
srcAlpha,
|
|
591
|
+
dstAlpha,
|
|
592
|
+
ptr->GetState()
|
|
593
|
+
);
|
|
612
594
|
}
|
|
613
595
|
|
|
614
596
|
void WebGLRenderingContext::BlendFunc(const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
@@ -620,16 +602,14 @@ void WebGLRenderingContext::BlendFunc(const v8::FunctionCallbackInfo<v8::Value>
|
|
|
620
602
|
auto isolate = args.GetIsolate();
|
|
621
603
|
auto context = isolate->GetCurrentContext();
|
|
622
604
|
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
auto dfactor = (uint32_t) args[1]->NumberValue(context).ToChecked();
|
|
605
|
+
auto sfactor = (uint32_t) args[0]->NumberValue(context).ToChecked();
|
|
606
|
+
auto dfactor = (uint32_t) args[1]->NumberValue(context).ToChecked();
|
|
626
607
|
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
}
|
|
608
|
+
canvas_native_webgl_blend_func(
|
|
609
|
+
sfactor,
|
|
610
|
+
dfactor,
|
|
611
|
+
ptr->GetState()
|
|
612
|
+
);
|
|
633
613
|
}
|
|
634
614
|
|
|
635
615
|
void WebGLRenderingContext::BufferData(const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
@@ -668,7 +648,8 @@ void WebGLRenderingContext::BufferData(const v8::FunctionCallbackInfo<v8::Value>
|
|
|
668
648
|
auto array = buf->Buffer();
|
|
669
649
|
auto offset = buf->ByteOffset();
|
|
670
650
|
auto size = buf->Length();
|
|
671
|
-
auto data_ptr =
|
|
651
|
+
auto data_ptr =
|
|
652
|
+
static_cast<uint8_t *>(array->GetBackingStore()->Data()) + offset;
|
|
672
653
|
auto data = static_cast<uint16_t *>((void *) data_ptr);
|
|
673
654
|
|
|
674
655
|
canvas_native_webgl_buffer_data_u16(
|
|
@@ -683,7 +664,8 @@ void WebGLRenderingContext::BufferData(const v8::FunctionCallbackInfo<v8::Value>
|
|
|
683
664
|
auto array = buf->Buffer();
|
|
684
665
|
auto offset = buf->ByteOffset();
|
|
685
666
|
auto size = buf->Length();
|
|
686
|
-
auto data_ptr =
|
|
667
|
+
auto data_ptr =
|
|
668
|
+
static_cast<uint8_t *>(array->GetBackingStore()->Data()) + offset;
|
|
687
669
|
auto data = static_cast<float *>((void *) data_ptr);
|
|
688
670
|
|
|
689
671
|
canvas_native_webgl_buffer_data_f32(
|
|
@@ -698,7 +680,8 @@ void WebGLRenderingContext::BufferData(const v8::FunctionCallbackInfo<v8::Value>
|
|
|
698
680
|
auto array = buf->Buffer();
|
|
699
681
|
auto offset = buf->ByteOffset();
|
|
700
682
|
auto size = buf->ByteLength();
|
|
701
|
-
auto data_ptr =
|
|
683
|
+
auto data_ptr =
|
|
684
|
+
static_cast<uint8_t *>(array->GetBackingStore()->Data()) + offset;
|
|
702
685
|
auto data = static_cast<uint8_t *>((void *) data_ptr);
|
|
703
686
|
|
|
704
687
|
|
|
@@ -809,19 +792,16 @@ WebGLRenderingContext::CheckFramebufferStatus(const v8::FunctionCallbackInfo<v8:
|
|
|
809
792
|
|
|
810
793
|
auto count = args.Length();
|
|
811
794
|
|
|
812
|
-
if (
|
|
813
|
-
|
|
814
|
-
if (args[0]->IsNumber()) {
|
|
815
|
-
auto target = (uint32_t) args[0]->NumberValue(context).ToChecked();
|
|
795
|
+
if (args[0]->IsNumber()) {
|
|
796
|
+
auto target = (uint32_t) args[0]->NumberValue(context).ToChecked();
|
|
816
797
|
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
798
|
+
auto ret = canvas_native_webgl_check_frame_buffer_status(
|
|
799
|
+
target,
|
|
800
|
+
ptr->GetState()
|
|
801
|
+
);
|
|
821
802
|
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
}
|
|
803
|
+
args.GetReturnValue().Set((int32_t) ret);
|
|
804
|
+
return;
|
|
825
805
|
}
|
|
826
806
|
|
|
827
807
|
args.GetReturnValue().Set(0);
|
|
@@ -836,20 +816,18 @@ void WebGLRenderingContext::ClearColor(const v8::FunctionCallbackInfo<v8::Value>
|
|
|
836
816
|
auto isolate = args.GetIsolate();
|
|
837
817
|
auto context = isolate->GetCurrentContext();
|
|
838
818
|
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
);
|
|
852
|
-
}
|
|
819
|
+
auto red = args[0]->NumberValue(context).ToChecked();
|
|
820
|
+
auto green = args[1]->NumberValue(context).ToChecked();
|
|
821
|
+
auto blue = args[2]->NumberValue(context).ToChecked();
|
|
822
|
+
auto alpha = args[3]->NumberValue(context).ToChecked();
|
|
823
|
+
|
|
824
|
+
canvas_native_webgl_clear_color(
|
|
825
|
+
static_cast<float>(red),
|
|
826
|
+
static_cast<float>(green),
|
|
827
|
+
static_cast<float>(blue),
|
|
828
|
+
static_cast<float>(alpha),
|
|
829
|
+
ptr->GetState()
|
|
830
|
+
);
|
|
853
831
|
}
|
|
854
832
|
|
|
855
833
|
void WebGLRenderingContext::ClearDepth(const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
@@ -861,14 +839,12 @@ void WebGLRenderingContext::ClearDepth(const v8::FunctionCallbackInfo<v8::Value>
|
|
|
861
839
|
auto isolate = args.GetIsolate();
|
|
862
840
|
auto context = isolate->GetCurrentContext();
|
|
863
841
|
|
|
864
|
-
|
|
865
|
-
auto depth = args[0]->NumberValue(context).ToChecked();
|
|
842
|
+
auto depth = args[0]->NumberValue(context).ToChecked();
|
|
866
843
|
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
}
|
|
844
|
+
canvas_native_webgl_clear_depth(
|
|
845
|
+
static_cast<float>(depth),
|
|
846
|
+
ptr->GetState()
|
|
847
|
+
);
|
|
872
848
|
}
|
|
873
849
|
|
|
874
850
|
void WebGLRenderingContext::ClearStencil(const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
@@ -880,13 +856,11 @@ void WebGLRenderingContext::ClearStencil(const v8::FunctionCallbackInfo<v8::Valu
|
|
|
880
856
|
auto isolate = args.GetIsolate();
|
|
881
857
|
auto context = isolate->GetCurrentContext();
|
|
882
858
|
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
);
|
|
889
|
-
}
|
|
859
|
+
auto stencil = (int32_t) args[0]->NumberValue(context).ToChecked();
|
|
860
|
+
canvas_native_webgl_clear_stencil(
|
|
861
|
+
stencil,
|
|
862
|
+
ptr->GetState()
|
|
863
|
+
);
|
|
890
864
|
}
|
|
891
865
|
|
|
892
866
|
void WebGLRenderingContext::Clear(const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
@@ -898,7 +872,6 @@ void WebGLRenderingContext::Clear(const v8::FunctionCallbackInfo<v8::Value> &arg
|
|
|
898
872
|
auto isolate = args.GetIsolate();
|
|
899
873
|
auto context = isolate->GetCurrentContext();
|
|
900
874
|
|
|
901
|
-
//if (count > 0) {
|
|
902
875
|
auto mask = (uint32_t) args[0]->NumberValue(context).ToChecked();
|
|
903
876
|
|
|
904
877
|
canvas_native_webgl_clear(
|
|
@@ -907,7 +880,6 @@ void WebGLRenderingContext::Clear(const v8::FunctionCallbackInfo<v8::Value> &arg
|
|
|
907
880
|
);
|
|
908
881
|
|
|
909
882
|
ptr->UpdateInvalidateState();
|
|
910
|
-
// }
|
|
911
883
|
}
|
|
912
884
|
|
|
913
885
|
void WebGLRenderingContext::ColorMask(const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
@@ -918,20 +890,18 @@ void WebGLRenderingContext::ColorMask(const v8::FunctionCallbackInfo<v8::Value>
|
|
|
918
890
|
|
|
919
891
|
auto isolate = args.GetIsolate();
|
|
920
892
|
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
auto alpha = args[3]->BooleanValue(isolate);
|
|
893
|
+
auto red = args[0]->BooleanValue(isolate);
|
|
894
|
+
auto green = args[1]->BooleanValue(isolate);
|
|
895
|
+
auto blue = args[2]->BooleanValue(isolate);
|
|
896
|
+
auto alpha = args[3]->BooleanValue(isolate);
|
|
926
897
|
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
}
|
|
898
|
+
canvas_native_webgl_color_mask(
|
|
899
|
+
red,
|
|
900
|
+
green,
|
|
901
|
+
blue,
|
|
902
|
+
alpha,
|
|
903
|
+
ptr->GetState()
|
|
904
|
+
);
|
|
935
905
|
}
|
|
936
906
|
|
|
937
907
|
void WebGLRenderingContext::Commit(const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
@@ -947,14 +917,12 @@ void WebGLRenderingContext::CompileShader(const v8::FunctionCallbackInfo<v8::Val
|
|
|
947
917
|
return;
|
|
948
918
|
}
|
|
949
919
|
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
);
|
|
957
|
-
}
|
|
920
|
+
auto shader = WebGLShader::GetPointer(args[0].As<v8::Object>());
|
|
921
|
+
if (shader != nullptr) {
|
|
922
|
+
canvas_native_webgl_compile_shader(
|
|
923
|
+
shader->GetShader(),
|
|
924
|
+
ptr->GetState()
|
|
925
|
+
);
|
|
958
926
|
}
|
|
959
927
|
}
|
|
960
928
|
|
|
@@ -1001,7 +969,7 @@ void WebGLRenderingContext::CompressedTexImage2D(const v8::FunctionCallbackInfo<
|
|
|
1001
969
|
auto array = buf->Buffer();
|
|
1002
970
|
auto offset = buf->ByteOffset();
|
|
1003
971
|
auto size = buf->ByteLength();
|
|
1004
|
-
auto data_ptr = static_cast<uint8_t*>(array->GetBackingStore()->Data()) + offset;
|
|
972
|
+
auto data_ptr = static_cast<uint8_t *>(array->GetBackingStore()->Data()) + offset;
|
|
1005
973
|
auto data = static_cast<uint8_t *>((void *) data_ptr);
|
|
1006
974
|
|
|
1007
975
|
|
|
@@ -1047,55 +1015,50 @@ WebGLRenderingContext::CompressedTexSubImage2D(const v8::FunctionCallbackInfo<v8
|
|
|
1047
1015
|
auto isolate = args.GetIsolate();
|
|
1048
1016
|
auto context = isolate->GetCurrentContext();
|
|
1049
1017
|
|
|
1050
|
-
auto
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
auto
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
auto
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
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);
|
|
1018
|
+
auto target = (uint32_t) args[0]->NumberValue(context).ToChecked();
|
|
1019
|
+
auto level = (int32_t) args[1]->NumberValue(context).ToChecked();
|
|
1020
|
+
auto xoffset = (int32_t) args[2]->NumberValue(context).ToChecked();
|
|
1021
|
+
auto yoffset = (int32_t) args[3]->NumberValue(context).ToChecked();
|
|
1022
|
+
auto width = (int32_t) args[4]->NumberValue(context).ToChecked();
|
|
1023
|
+
auto height = (int32_t) args[5]->NumberValue(context).ToChecked();
|
|
1024
|
+
auto format = (uint32_t) args[6]->NumberValue(context).ToChecked();
|
|
1025
|
+
if (args[7]->IsObject()) {
|
|
1026
|
+
auto pixels = args[7];
|
|
1027
|
+
if (pixels->IsArrayBufferView()) {
|
|
1028
|
+
auto buf = pixels.As<v8::ArrayBufferView>();
|
|
1029
|
+
auto array = buf->Buffer();
|
|
1030
|
+
auto offset = buf->ByteOffset();
|
|
1031
|
+
auto size = array->ByteLength();
|
|
1032
|
+
auto data_ptr = static_cast<uint8_t *>(array->GetBackingStore()->Data()) + offset;
|
|
1033
|
+
auto data = static_cast<uint8_t *>((void *) data_ptr);
|
|
1070
1034
|
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1035
|
+
canvas_native_webgl_compressed_tex_sub_image2d(
|
|
1036
|
+
target,
|
|
1037
|
+
level,
|
|
1038
|
+
xoffset,
|
|
1039
|
+
yoffset,
|
|
1040
|
+
width,
|
|
1041
|
+
height,
|
|
1042
|
+
format,
|
|
1043
|
+
data, size,
|
|
1044
|
+
ptr->GetState()
|
|
1045
|
+
);
|
|
1046
|
+
} else if (pixels->IsArrayBuffer()) {
|
|
1047
|
+
auto array = pixels.As<v8::ArrayBuffer>();
|
|
1048
|
+
auto size = array->ByteLength();
|
|
1049
|
+
auto data = (uint8_t *) array->GetBackingStore()->Data();
|
|
1086
1050
|
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
}
|
|
1051
|
+
canvas_native_webgl_compressed_tex_sub_image2d(
|
|
1052
|
+
target,
|
|
1053
|
+
level,
|
|
1054
|
+
xoffset,
|
|
1055
|
+
yoffset,
|
|
1056
|
+
width,
|
|
1057
|
+
height,
|
|
1058
|
+
format,
|
|
1059
|
+
data, size,
|
|
1060
|
+
ptr->GetState()
|
|
1061
|
+
);
|
|
1099
1062
|
}
|
|
1100
1063
|
}
|
|
1101
1064
|
|
|
@@ -1113,28 +1076,26 @@ void WebGLRenderingContext::CopyTexImage2D(const v8::FunctionCallbackInfo<v8::Va
|
|
|
1113
1076
|
auto count = args.Length();
|
|
1114
1077
|
|
|
1115
1078
|
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
);
|
|
1137
|
-
}
|
|
1079
|
+
auto target = (uint32_t) args[0]->NumberValue(context).ToChecked();
|
|
1080
|
+
auto level = (int32_t) args[1]->NumberValue(context).ToChecked();
|
|
1081
|
+
auto internalformat = (uint32_t) args[2]->NumberValue(context).ToChecked();
|
|
1082
|
+
auto x = (int32_t) args[3]->NumberValue(context).ToChecked();
|
|
1083
|
+
auto y = (int32_t) args[4]->NumberValue(context).ToChecked();
|
|
1084
|
+
auto width = (int32_t) args[5]->NumberValue(context).ToChecked();
|
|
1085
|
+
auto height = (int32_t) args[6]->NumberValue(context).ToChecked();
|
|
1086
|
+
auto border = (int32_t) args[7]->NumberValue(context).ToChecked();
|
|
1087
|
+
|
|
1088
|
+
canvas_native_webgl_copy_tex_image2d(
|
|
1089
|
+
target,
|
|
1090
|
+
level,
|
|
1091
|
+
internalformat,
|
|
1092
|
+
x,
|
|
1093
|
+
y,
|
|
1094
|
+
width,
|
|
1095
|
+
height,
|
|
1096
|
+
border,
|
|
1097
|
+
ptr->GetState()
|
|
1098
|
+
);
|
|
1138
1099
|
|
|
1139
1100
|
}
|
|
1140
1101
|
|
|
@@ -1150,28 +1111,26 @@ void WebGLRenderingContext::CopyTexSubImage2D(const v8::FunctionCallbackInfo<v8:
|
|
|
1150
1111
|
auto count = args.Length();
|
|
1151
1112
|
|
|
1152
1113
|
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
);
|
|
1174
|
-
}
|
|
1114
|
+
auto target = (uint32_t) args[0]->NumberValue(context).ToChecked();
|
|
1115
|
+
auto level = (int32_t) args[1]->NumberValue(context).ToChecked();
|
|
1116
|
+
auto xoffset = (int32_t) args[2]->NumberValue(context).ToChecked();
|
|
1117
|
+
auto yoffset = (int32_t) args[3]->NumberValue(context).ToChecked();
|
|
1118
|
+
auto x = (int32_t) args[4]->NumberValue(context).ToChecked();
|
|
1119
|
+
auto y = (int32_t) args[5]->NumberValue(context).ToChecked();
|
|
1120
|
+
auto width = (int32_t) args[6]->NumberValue(context).ToChecked();
|
|
1121
|
+
auto height = (int32_t) args[7]->NumberValue(context).ToChecked();
|
|
1122
|
+
|
|
1123
|
+
canvas_native_webgl_copy_tex_sub_image2d(
|
|
1124
|
+
target,
|
|
1125
|
+
level,
|
|
1126
|
+
xoffset,
|
|
1127
|
+
yoffset,
|
|
1128
|
+
x,
|
|
1129
|
+
y,
|
|
1130
|
+
width,
|
|
1131
|
+
height,
|
|
1132
|
+
ptr->GetState()
|
|
1133
|
+
);
|
|
1175
1134
|
|
|
1176
1135
|
}
|
|
1177
1136
|
|
|
@@ -1331,14 +1290,12 @@ void WebGLRenderingContext::CullFace(const v8::FunctionCallbackInfo<v8::Value> &
|
|
|
1331
1290
|
auto context = isolate->GetCurrentContext();
|
|
1332
1291
|
|
|
1333
1292
|
|
|
1334
|
-
|
|
1335
|
-
auto mode = (uint32_t) args[0]->NumberValue(context).ToChecked();
|
|
1293
|
+
auto mode = (uint32_t) args[0]->NumberValue(context).ToChecked();
|
|
1336
1294
|
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
}
|
|
1295
|
+
canvas_native_webgl_cull_face(
|
|
1296
|
+
mode,
|
|
1297
|
+
ptr->GetState()
|
|
1298
|
+
);
|
|
1342
1299
|
|
|
1343
1300
|
}
|
|
1344
1301
|
|
|
@@ -1351,19 +1308,15 @@ void WebGLRenderingContext::DeleteBuffer(const v8::FunctionCallbackInfo<v8::Valu
|
|
|
1351
1308
|
auto isolate = args.GetIsolate();
|
|
1352
1309
|
|
|
1353
1310
|
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
ptr->GetState()
|
|
1364
|
-
);
|
|
1365
|
-
}
|
|
1366
|
-
}
|
|
1311
|
+
auto value = args[0];
|
|
1312
|
+
auto type = GetNativeType(isolate, value.As<v8::Object>());
|
|
1313
|
+
if (type == NativeType::WebGLBuffer) {
|
|
1314
|
+
auto buffer = WebGLBuffer::GetPointer(value.As<v8::Object>());
|
|
1315
|
+
if (buffer != nullptr) {
|
|
1316
|
+
canvas_native_webgl_delete_buffer(
|
|
1317
|
+
buffer->GetBuffer(),
|
|
1318
|
+
ptr->GetState()
|
|
1319
|
+
);
|
|
1367
1320
|
}
|
|
1368
1321
|
}
|
|
1369
1322
|
|
|
@@ -1501,14 +1454,12 @@ void WebGLRenderingContext::DepthFunc(const v8::FunctionCallbackInfo<v8::Value>
|
|
|
1501
1454
|
|
|
1502
1455
|
auto value = args[0];
|
|
1503
1456
|
|
|
1504
|
-
|
|
1505
|
-
auto func = (uint32_t) value->NumberValue(context).ToChecked();
|
|
1457
|
+
auto func = (uint32_t) value->NumberValue(context).ToChecked();
|
|
1506
1458
|
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
}
|
|
1459
|
+
canvas_native_webgl_depth_func(
|
|
1460
|
+
func,
|
|
1461
|
+
ptr->GetState()
|
|
1462
|
+
);
|
|
1512
1463
|
}
|
|
1513
1464
|
|
|
1514
1465
|
void WebGLRenderingContext::DepthMask(const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
@@ -1521,15 +1472,13 @@ void WebGLRenderingContext::DepthMask(const v8::FunctionCallbackInfo<v8::Value>
|
|
|
1521
1472
|
|
|
1522
1473
|
auto value = args[0];
|
|
1523
1474
|
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
}
|
|
1532
|
-
}
|
|
1475
|
+
auto mask = value->BooleanValue(isolate);
|
|
1476
|
+
|
|
1477
|
+
canvas_native_webgl_depth_mask(
|
|
1478
|
+
mask,
|
|
1479
|
+
ptr->GetState()
|
|
1480
|
+
);
|
|
1481
|
+
}
|
|
1533
1482
|
|
|
1534
1483
|
void WebGLRenderingContext::DepthRange(const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
1535
1484
|
WebGLRenderingContext *ptr = GetPointer(args.This());
|
|
@@ -1543,14 +1492,11 @@ void WebGLRenderingContext::DepthRange(const v8::FunctionCallbackInfo<v8::Value>
|
|
|
1543
1492
|
auto zNear = args[0];
|
|
1544
1493
|
auto zFar = args[1];
|
|
1545
1494
|
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
ptr->GetState()
|
|
1552
|
-
);
|
|
1553
|
-
}
|
|
1495
|
+
canvas_native_webgl_depth_range(
|
|
1496
|
+
static_cast<float>(zNear->NumberValue(context).ToChecked()),
|
|
1497
|
+
static_cast<float>(zFar->NumberValue(context).ToChecked()),
|
|
1498
|
+
ptr->GetState()
|
|
1499
|
+
);
|
|
1554
1500
|
}
|
|
1555
1501
|
|
|
1556
1502
|
void WebGLRenderingContext::DetachShader(const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
@@ -1565,27 +1511,24 @@ void WebGLRenderingContext::DetachShader(const v8::FunctionCallbackInfo<v8::Valu
|
|
|
1565
1511
|
auto programValue = args[0];
|
|
1566
1512
|
auto shaderValue = args[1];
|
|
1567
1513
|
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
shader = WebGLShader::GetPointer(shaderValue.As<v8::Object>());
|
|
1579
|
-
}
|
|
1514
|
+
auto programType = GetNativeType(isolate, programValue);
|
|
1515
|
+
auto shaderType = GetNativeType(isolate, shaderValue);
|
|
1516
|
+
WebGLProgram *program = nullptr;
|
|
1517
|
+
WebGLShader *shader = nullptr;
|
|
1518
|
+
if (programType == NativeType::WebGLProgram) {
|
|
1519
|
+
program = WebGLProgram::GetPointer(programValue.As<v8::Object>());
|
|
1520
|
+
}
|
|
1521
|
+
if (shaderType == NativeType::WebGLShader) {
|
|
1522
|
+
shader = WebGLShader::GetPointer(shaderValue.As<v8::Object>());
|
|
1523
|
+
}
|
|
1580
1524
|
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
}
|
|
1525
|
+
if (program != nullptr &&
|
|
1526
|
+
shader != nullptr) {
|
|
1527
|
+
canvas_native_webgl_detach_shader(
|
|
1528
|
+
program->GetProgram(),
|
|
1529
|
+
shader->GetShader(),
|
|
1530
|
+
ptr->GetState()
|
|
1531
|
+
);
|
|
1589
1532
|
}
|
|
1590
1533
|
}
|
|
1591
1534
|
|
|
@@ -1963,23 +1906,18 @@ void WebGLRenderingContext::GetBufferParameter(const v8::FunctionCallbackInfo<v8
|
|
|
1963
1906
|
auto isolate = args.GetIsolate();
|
|
1964
1907
|
auto context = isolate->GetCurrentContext();
|
|
1965
1908
|
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
context).ToChecked();
|
|
1971
|
-
|
|
1972
|
-
auto param = canvas_native_webgl_get_buffer_parameter(
|
|
1973
|
-
target,
|
|
1974
|
-
pname,
|
|
1975
|
-
ptr->GetState()
|
|
1976
|
-
);
|
|
1909
|
+
auto target = (uint32_t) args[0]->NumberValue(
|
|
1910
|
+
context).ToChecked();
|
|
1911
|
+
auto pname = (uint32_t) args[1]->NumberValue(
|
|
1912
|
+
context).ToChecked();
|
|
1977
1913
|
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1914
|
+
auto param = canvas_native_webgl_get_buffer_parameter(
|
|
1915
|
+
target,
|
|
1916
|
+
pname,
|
|
1917
|
+
ptr->GetState()
|
|
1918
|
+
);
|
|
1981
1919
|
|
|
1982
|
-
args.GetReturnValue().
|
|
1920
|
+
args.GetReturnValue().Set(param);
|
|
1983
1921
|
|
|
1984
1922
|
}
|
|
1985
1923
|
|
|
@@ -2389,22 +2327,17 @@ void WebGLRenderingContext::GetParameter(const v8::FunctionCallbackInfo<v8::Valu
|
|
|
2389
2327
|
auto isolate = args.GetIsolate();
|
|
2390
2328
|
auto context = isolate->GetCurrentContext();
|
|
2391
2329
|
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
pname,
|
|
2398
|
-
ptr->GetState());
|
|
2330
|
+
auto pname = (uint32_t) args[0]->NumberValue(
|
|
2331
|
+
context).ToChecked();
|
|
2332
|
+
auto result = canvas_native_webgl_get_parameter(
|
|
2333
|
+
pname,
|
|
2334
|
+
ptr->GetState());
|
|
2399
2335
|
|
|
2400
|
-
|
|
2336
|
+
auto ret = ptr->GetParameterInternal(isolate, pname, result);
|
|
2401
2337
|
|
|
2402
|
-
|
|
2338
|
+
canvas_native_webgl_WebGLResult_destroy(result);
|
|
2403
2339
|
|
|
2404
|
-
|
|
2405
|
-
return;
|
|
2406
|
-
}
|
|
2407
|
-
args.GetReturnValue().SetNull();
|
|
2340
|
+
args.GetReturnValue().Set(ret);
|
|
2408
2341
|
}
|
|
2409
2342
|
|
|
2410
2343
|
void WebGLRenderingContext::GetProgramInfoLog(const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
@@ -2416,31 +2349,28 @@ void WebGLRenderingContext::GetProgramInfoLog(const v8::FunctionCallbackInfo<v8:
|
|
|
2416
2349
|
|
|
2417
2350
|
auto isolate = args.GetIsolate();
|
|
2418
2351
|
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
);
|
|
2352
|
+
auto programValue = args[0];
|
|
2353
|
+
auto type = GetNativeType(isolate, programValue);
|
|
2354
|
+
if (type == NativeType::WebGLProgram) {
|
|
2355
|
+
auto program = WebGLProgram::GetPointer(programValue.As<v8::Object>());
|
|
2356
|
+
if (program != nullptr) {
|
|
2357
|
+
auto log = canvas_native_webgl_get_program_info_log(
|
|
2358
|
+
program->GetProgram(),
|
|
2359
|
+
ptr->GetState()
|
|
2360
|
+
);
|
|
2429
2361
|
|
|
2430
2362
|
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
return;
|
|
2435
|
-
}
|
|
2436
|
-
|
|
2437
|
-
args.GetReturnValue().Set(ConvertToV8OneByteString(isolate, (char *) log));
|
|
2363
|
+
if (strlen(log) == 0) {
|
|
2364
|
+
args.GetReturnValue().SetEmptyString();
|
|
2365
|
+
canvas_native_string_destroy((char *) log);
|
|
2438
2366
|
return;
|
|
2439
2367
|
}
|
|
2368
|
+
|
|
2369
|
+
args.GetReturnValue().Set(ConvertToV8OneByteString(isolate, (char *) log));
|
|
2370
|
+
return;
|
|
2440
2371
|
}
|
|
2441
2372
|
}
|
|
2442
2373
|
|
|
2443
|
-
// todo check return
|
|
2444
2374
|
args.GetReturnValue().SetEmptyString();
|
|
2445
2375
|
}
|
|
2446
2376
|
|
|
@@ -2454,48 +2384,46 @@ void WebGLRenderingContext::GetProgramParameter(const v8::FunctionCallbackInfo<v
|
|
|
2454
2384
|
auto isolate = args.GetIsolate();
|
|
2455
2385
|
auto context = isolate->GetCurrentContext();
|
|
2456
2386
|
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
);
|
|
2387
|
+
auto programValue = args[0];
|
|
2388
|
+
auto type = GetNativeType(isolate, programValue);
|
|
2389
|
+
auto pname = (uint32_t) args[1]->NumberValue(
|
|
2390
|
+
context).ToChecked();
|
|
2391
|
+
if (type == NativeType::WebGLProgram) {
|
|
2392
|
+
auto program = WebGLProgram::GetPointer(programValue.As<v8::Object>());
|
|
2393
|
+
if (program != nullptr) {
|
|
2394
|
+
auto ret = canvas_native_webgl_get_program_parameter(
|
|
2395
|
+
program->GetProgram(),
|
|
2396
|
+
pname,
|
|
2397
|
+
ptr->GetState()
|
|
2398
|
+
);
|
|
2470
2399
|
|
|
2471
2400
|
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2401
|
+
if (canvas_native_webgl_result_get_is_none(
|
|
2402
|
+
ret)) {
|
|
2403
|
+
args.GetReturnValue().SetNull();
|
|
2404
|
+
|
|
2405
|
+
canvas_native_webgl_WebGLResult_destroy(ret);
|
|
2406
|
+
return;
|
|
2407
|
+
}
|
|
2408
|
+
switch (pname) {
|
|
2409
|
+
case GL_DELETE_STATUS:
|
|
2410
|
+
case GL_LINK_STATUS:
|
|
2411
|
+
case GL_VALIDATE_STATUS:
|
|
2412
|
+
args.GetReturnValue().Set(canvas_native_webgl_result_get_bool(
|
|
2413
|
+
ret));
|
|
2414
|
+
canvas_native_webgl_WebGLResult_destroy(ret);
|
|
2415
|
+
return;
|
|
2416
|
+
default:
|
|
2417
|
+
args.GetReturnValue().Set(canvas_native_webgl_result_get_i32(
|
|
2418
|
+
ret));
|
|
2475
2419
|
|
|
2476
2420
|
canvas_native_webgl_WebGLResult_destroy(ret);
|
|
2477
2421
|
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
2422
|
}
|
|
2495
2423
|
}
|
|
2496
2424
|
}
|
|
2497
2425
|
|
|
2498
|
-
|
|
2426
|
+
|
|
2499
2427
|
args.GetReturnValue().SetNull();
|
|
2500
2428
|
}
|
|
2501
2429
|
|
|
@@ -2537,31 +2465,28 @@ void WebGLRenderingContext::GetShaderInfoLog(const v8::FunctionCallbackInfo<v8::
|
|
|
2537
2465
|
|
|
2538
2466
|
auto isolate = args.GetIsolate();
|
|
2539
2467
|
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
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));
|
|
2468
|
+
auto value = args[0];
|
|
2469
|
+
auto type = GetNativeType(isolate, value);
|
|
2470
|
+
if (type == NativeType::WebGLShader) {
|
|
2471
|
+
auto shader = WebGLShader::GetPointer(value.As<v8::Object>());
|
|
2472
|
+
if (shader != nullptr) {
|
|
2473
|
+
auto log = canvas_native_webgl_get_shader_info_log(
|
|
2474
|
+
shader->GetShader(),
|
|
2475
|
+
ptr->GetState()
|
|
2476
|
+
);
|
|
2558
2477
|
|
|
2478
|
+
if (strlen(log) == 0) {
|
|
2479
|
+
args.GetReturnValue().SetEmptyString();
|
|
2480
|
+
canvas_native_string_destroy((char *) log);
|
|
2559
2481
|
return;
|
|
2560
2482
|
}
|
|
2483
|
+
|
|
2484
|
+
args.GetReturnValue().Set(ConvertToV8OneByteString(isolate, (char *) log));
|
|
2485
|
+
|
|
2486
|
+
return;
|
|
2561
2487
|
}
|
|
2562
2488
|
}
|
|
2563
2489
|
|
|
2564
|
-
// todo check return
|
|
2565
2490
|
args.GetReturnValue().SetEmptyString();
|
|
2566
2491
|
}
|
|
2567
2492
|
|
|
@@ -2575,50 +2500,48 @@ void WebGLRenderingContext::GetShaderParameter(const v8::FunctionCallbackInfo<v8
|
|
|
2575
2500
|
auto isolate = args.GetIsolate();
|
|
2576
2501
|
auto context = isolate->GetCurrentContext();
|
|
2577
2502
|
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
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
|
-
}
|
|
2503
|
+
auto value = args[0];
|
|
2504
|
+
auto type = GetNativeType(isolate, value);
|
|
2505
|
+
auto pname = (uint32_t) args[1]->NumberValue(
|
|
2506
|
+
context).ToChecked();
|
|
2507
|
+
if (type == NativeType::WebGLShader) {
|
|
2508
|
+
auto shader = WebGLShader::GetPointer(value.As<v8::Object>());
|
|
2509
|
+
if (shader != nullptr) {
|
|
2510
|
+
auto ret = canvas_native_webgl_get_shader_parameter(
|
|
2511
|
+
shader->GetShader(),
|
|
2512
|
+
pname,
|
|
2513
|
+
ptr->GetState()
|
|
2514
|
+
);
|
|
2599
2515
|
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
GL_COMPILE_STATUS) {
|
|
2604
|
-
args.GetReturnValue().Set(canvas_native_webgl_result_get_bool(
|
|
2605
|
-
ret));
|
|
2516
|
+
if (canvas_native_webgl_result_get_is_none(
|
|
2517
|
+
ret)) {
|
|
2518
|
+
args.GetReturnValue().SetNull();
|
|
2606
2519
|
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
|
|
2520
|
+
canvas_native_webgl_WebGLResult_destroy(ret);
|
|
2521
|
+
return;
|
|
2522
|
+
}
|
|
2610
2523
|
|
|
2611
|
-
|
|
2524
|
+
if (pname ==
|
|
2525
|
+
GL_DELETE_STATUS ||
|
|
2526
|
+
pname ==
|
|
2527
|
+
GL_COMPILE_STATUS) {
|
|
2528
|
+
args.GetReturnValue().Set(canvas_native_webgl_result_get_bool(
|
|
2612
2529
|
ret));
|
|
2613
2530
|
|
|
2614
2531
|
canvas_native_webgl_WebGLResult_destroy(ret);
|
|
2615
|
-
|
|
2616
2532
|
return;
|
|
2617
2533
|
}
|
|
2534
|
+
|
|
2535
|
+
args.GetReturnValue().Set(canvas_native_webgl_result_get_i32(
|
|
2536
|
+
ret));
|
|
2537
|
+
|
|
2538
|
+
canvas_native_webgl_WebGLResult_destroy(ret);
|
|
2539
|
+
|
|
2540
|
+
return;
|
|
2618
2541
|
}
|
|
2619
2542
|
}
|
|
2620
2543
|
|
|
2621
|
-
|
|
2544
|
+
|
|
2622
2545
|
args.GetReturnValue().SetNull();
|
|
2623
2546
|
}
|
|
2624
2547
|
|
|
@@ -2633,25 +2556,19 @@ WebGLRenderingContext::GetShaderPrecisionFormat(const v8::FunctionCallbackInfo<v
|
|
|
2633
2556
|
auto isolate = args.GetIsolate();
|
|
2634
2557
|
auto context = isolate->GetCurrentContext();
|
|
2635
2558
|
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
args.GetReturnValue().Set(shader);
|
|
2650
|
-
return;
|
|
2651
|
-
}
|
|
2652
|
-
|
|
2653
|
-
// todo check return
|
|
2654
|
-
args.GetReturnValue().SetNull();
|
|
2559
|
+
auto shaderType = (uint32_t) args[0]->NumberValue(
|
|
2560
|
+
context).ToChecked();
|
|
2561
|
+
auto precisionType = (uint32_t) args[1]->NumberValue(
|
|
2562
|
+
context).ToChecked();
|
|
2563
|
+
auto ret = canvas_native_webgl_get_shader_precision_format(
|
|
2564
|
+
shaderType,
|
|
2565
|
+
precisionType,
|
|
2566
|
+
ptr->GetState()
|
|
2567
|
+
);
|
|
2568
|
+
auto shader = WebGLShaderPrecisionFormatImpl::NewInstance(isolate,
|
|
2569
|
+
new WebGLShaderPrecisionFormatImpl(
|
|
2570
|
+
ret));
|
|
2571
|
+
args.GetReturnValue().Set(shader);
|
|
2655
2572
|
}
|
|
2656
2573
|
|
|
2657
2574
|
void WebGLRenderingContext::GetShaderSource(const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
@@ -2663,30 +2580,27 @@ void WebGLRenderingContext::GetShaderSource(const v8::FunctionCallbackInfo<v8::V
|
|
|
2663
2580
|
|
|
2664
2581
|
auto isolate = args.GetIsolate();
|
|
2665
2582
|
|
|
2666
|
-
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
|
|
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
|
-
);
|
|
2583
|
+
auto value = args[0];
|
|
2584
|
+
auto type = GetNativeType(isolate, value);
|
|
2585
|
+
if (type == NativeType::WebGLShader) {
|
|
2586
|
+
auto shader = WebGLShader::GetPointer(value.As<v8::Object>());
|
|
2677
2587
|
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2588
|
+
if (shader != nullptr) {
|
|
2589
|
+
auto source = canvas_native_webgl_get_shader_source(
|
|
2590
|
+
shader->GetShader(),
|
|
2591
|
+
ptr->GetState()
|
|
2592
|
+
);
|
|
2683
2593
|
|
|
2684
|
-
|
|
2594
|
+
if (strlen(source) == 0) {
|
|
2595
|
+
args.GetReturnValue().SetEmptyString();
|
|
2596
|
+
canvas_native_string_destroy((char *) source);
|
|
2685
2597
|
return;
|
|
2686
2598
|
}
|
|
2599
|
+
|
|
2600
|
+
args.GetReturnValue().Set(ConvertToV8OneByteString(isolate, (char *) source));
|
|
2601
|
+
return;
|
|
2687
2602
|
}
|
|
2688
2603
|
}
|
|
2689
|
-
|
|
2690
2604
|
// todo check return
|
|
2691
2605
|
args.GetReturnValue().SetEmptyString();
|
|
2692
2606
|
}
|
|
@@ -2751,22 +2665,16 @@ WebGLRenderingContext::GetTexParameter(const v8::FunctionCallbackInfo<v8::Value>
|
|
|
2751
2665
|
auto isolate = args.GetIsolate();
|
|
2752
2666
|
auto context = isolate->GetCurrentContext();
|
|
2753
2667
|
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
args.GetReturnValue().Set(ret);
|
|
2765
|
-
return;
|
|
2766
|
-
}
|
|
2767
|
-
|
|
2768
|
-
// todo check return
|
|
2769
|
-
args.GetReturnValue().SetNull();
|
|
2668
|
+
auto target = (uint32_t) args[0]->NumberValue(
|
|
2669
|
+
context).ToChecked();
|
|
2670
|
+
auto pname = (uint32_t) args[1]->NumberValue(
|
|
2671
|
+
context).ToChecked();
|
|
2672
|
+
auto ret = canvas_native_webgl_get_tex_parameter(
|
|
2673
|
+
target,
|
|
2674
|
+
pname,
|
|
2675
|
+
ptr->GetState()
|
|
2676
|
+
);
|
|
2677
|
+
args.GetReturnValue().Set(ret);
|
|
2770
2678
|
}
|
|
2771
2679
|
|
|
2772
2680
|
void
|
|
@@ -2779,27 +2687,25 @@ WebGLRenderingContext::GetUniformLocation(const v8::FunctionCallbackInfo<v8::Val
|
|
|
2779
2687
|
|
|
2780
2688
|
auto isolate = args.GetIsolate();
|
|
2781
2689
|
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
|
|
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
|
-
);
|
|
2690
|
+
auto programValue = args[0];
|
|
2691
|
+
auto type = GetNativeType(isolate, programValue);
|
|
2692
|
+
auto nameValue = args[1];
|
|
2693
|
+
if (type == NativeType::WebGLProgram && nameValue->IsString()) {
|
|
2694
|
+
auto program = WebGLProgram::GetPointer(programValue.As<v8::Object>());
|
|
2695
|
+
if (program != nullptr) {
|
|
2696
|
+
auto name = ConvertFromV8String(isolate, args[1]);
|
|
2796
2697
|
|
|
2797
|
-
|
|
2798
|
-
|
|
2698
|
+
auto ret = canvas_native_webgl_get_uniform_location(
|
|
2699
|
+
program->GetProgram(),
|
|
2700
|
+
name.c_str(),
|
|
2701
|
+
ptr->GetState()
|
|
2702
|
+
);
|
|
2799
2703
|
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
|
|
2704
|
+
auto location = WebGLUniformLocation::NewInstance(isolate, new WebGLUniformLocation(
|
|
2705
|
+
ret));
|
|
2706
|
+
|
|
2707
|
+
args.GetReturnValue().Set(location);
|
|
2708
|
+
return;
|
|
2803
2709
|
}
|
|
2804
2710
|
}
|
|
2805
2711
|
|
|
@@ -2818,183 +2724,181 @@ WebGLRenderingContext::GetUniform(const v8::FunctionCallbackInfo<v8::Value> &arg
|
|
|
2818
2724
|
auto isolate = args.GetIsolate();
|
|
2819
2725
|
auto context = isolate->GetCurrentContext();
|
|
2820
2726
|
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
locationType == NativeType::WebGLUniformLocation) {
|
|
2727
|
+
auto programValue = args[0];
|
|
2728
|
+
auto programType = GetNativeType(isolate, programValue);
|
|
2729
|
+
auto locationValue = args[1];
|
|
2730
|
+
auto locationType = GetNativeType(isolate, locationValue);
|
|
2731
|
+
if (programType == NativeType::WebGLProgram &&
|
|
2732
|
+
locationType == NativeType::WebGLUniformLocation) {
|
|
2828
2733
|
|
|
2829
|
-
|
|
2830
|
-
|
|
2734
|
+
auto program = WebGLProgram::GetPointer(programValue.As<v8::Object>());
|
|
2735
|
+
auto location = WebGLUniformLocation::GetPointer(locationValue.As<v8::Object>());
|
|
2831
2736
|
|
|
2832
2737
|
|
|
2833
|
-
|
|
2834
|
-
|
|
2738
|
+
if (program != nullptr &&
|
|
2739
|
+
location != nullptr) {
|
|
2835
2740
|
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2741
|
+
auto val = canvas_native_webgl_get_uniform(
|
|
2742
|
+
program->GetProgram(),
|
|
2743
|
+
location->GetUniformLocation(),
|
|
2744
|
+
ptr->GetState());
|
|
2840
2745
|
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
|
|
2856
|
-
|
|
2857
|
-
|
|
2858
|
-
|
|
2859
|
-
|
|
2860
|
-
|
|
2861
|
-
|
|
2862
|
-
|
|
2863
|
-
|
|
2864
|
-
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
|
|
2869
|
-
|
|
2870
|
-
|
|
2871
|
-
|
|
2872
|
-
|
|
2873
|
-
|
|
2874
|
-
|
|
2875
|
-
|
|
2876
|
-
}
|
|
2877
|
-
args.GetReturnValue().Set(array);
|
|
2878
|
-
canvas_native_webgl_WebGLResult_destroy(val);
|
|
2879
|
-
return;
|
|
2746
|
+
switch (canvas_native_webgl_result_get_type(
|
|
2747
|
+
val)) {
|
|
2748
|
+
case WebGLResultType::WebGLResultTypeBoolean:
|
|
2749
|
+
args.GetReturnValue().Set(canvas_native_webgl_result_get_bool(
|
|
2750
|
+
val));
|
|
2751
|
+
canvas_native_webgl_WebGLResult_destroy(val);
|
|
2752
|
+
return;
|
|
2753
|
+
case WebGLResultType::WebGLResultTypeNone:
|
|
2754
|
+
args.GetReturnValue().SetNull();
|
|
2755
|
+
canvas_native_webgl_WebGLResult_destroy(val);
|
|
2756
|
+
return;
|
|
2757
|
+
case WebGLResultType::WebGLResultTypeString: {
|
|
2758
|
+
auto str = canvas_native_webgl_result_get_string(
|
|
2759
|
+
val);
|
|
2760
|
+
|
|
2761
|
+
args.GetReturnValue().Set(
|
|
2762
|
+
ConvertToV8OneByteString(isolate, (char *) str));
|
|
2763
|
+
canvas_native_webgl_WebGLResult_destroy(val);
|
|
2764
|
+
return;
|
|
2765
|
+
}
|
|
2766
|
+
case WebGLResultType::WebGLResultTypeBooleanArray: {
|
|
2767
|
+
auto ret = canvas_native_webgl_result_get_bool_array(
|
|
2768
|
+
val);
|
|
2769
|
+
auto len = canvas_native_u8_buffer_get_length(ret);
|
|
2770
|
+
auto buf = canvas_native_u8_buffer_get_bytes(ret);
|
|
2771
|
+
auto array = v8::Array::New(
|
|
2772
|
+
isolate, (int) len);
|
|
2773
|
+
for (int i = 0;
|
|
2774
|
+
i < len; ++i) {
|
|
2775
|
+
auto item = buf[i];
|
|
2776
|
+
array->Set(
|
|
2777
|
+
context, i,
|
|
2778
|
+
v8::Boolean::New(isolate,
|
|
2779
|
+
item ==
|
|
2780
|
+
1));
|
|
2880
2781
|
}
|
|
2881
|
-
|
|
2882
|
-
|
|
2883
|
-
|
|
2782
|
+
args.GetReturnValue().Set(array);
|
|
2783
|
+
canvas_native_webgl_WebGLResult_destroy(val);
|
|
2784
|
+
return;
|
|
2785
|
+
}
|
|
2786
|
+
case WebGLResultType::WebGLResultTypeF32Array: {
|
|
2787
|
+
auto ret = canvas_native_webgl_result_get_f32_array(
|
|
2788
|
+
val);
|
|
2884
2789
|
|
|
2885
2790
|
|
|
2886
|
-
|
|
2887
|
-
|
|
2888
|
-
|
|
2791
|
+
auto buf = (uint8_t *) canvas_native_f32_buffer_get_bytes_mut(ret);
|
|
2792
|
+
auto size = canvas_native_f32_buffer_get_length(ret);
|
|
2793
|
+
auto bytes_size = size * sizeof(float);
|
|
2889
2794
|
|
|
2890
2795
|
|
|
2891
|
-
|
|
2892
|
-
|
|
2893
|
-
|
|
2894
|
-
|
|
2895
|
-
|
|
2896
|
-
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2796
|
+
auto store = v8::ArrayBuffer::NewBackingStore(buf,
|
|
2797
|
+
bytes_size,
|
|
2798
|
+
[](void *data, size_t length,
|
|
2799
|
+
void *deleter_data) {
|
|
2800
|
+
if (deleter_data !=
|
|
2801
|
+
nullptr) {
|
|
2802
|
+
canvas_native_f32_buffer_destroy(
|
|
2803
|
+
(F32Buffer *) deleter_data);
|
|
2804
|
+
}
|
|
2805
|
+
},
|
|
2806
|
+
ret);
|
|
2902
2807
|
|
|
2903
|
-
|
|
2808
|
+
auto arraybuffer = v8::ArrayBuffer::New(isolate, std::move(store));
|
|
2904
2809
|
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
2810
|
+
args.GetReturnValue().Set(
|
|
2811
|
+
v8::Float32Array::New(arraybuffer, 0, size)
|
|
2812
|
+
);
|
|
2908
2813
|
|
|
2909
|
-
|
|
2814
|
+
canvas_native_webgl_WebGLResult_destroy(val);
|
|
2910
2815
|
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
2816
|
+
return;
|
|
2817
|
+
}
|
|
2818
|
+
case WebGLResultType::WebGLResultTypeI32Array: {
|
|
2819
|
+
auto ret = canvas_native_webgl_result_get_i32_array(
|
|
2820
|
+
val);
|
|
2916
2821
|
|
|
2917
2822
|
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
|
|
2823
|
+
auto buf = (uint8_t *) canvas_native_i32_buffer_get_bytes_mut(ret);
|
|
2824
|
+
auto size = canvas_native_i32_buffer_get_length(ret);
|
|
2825
|
+
auto bytes_size = size * sizeof(int32_t);
|
|
2921
2826
|
|
|
2922
2827
|
|
|
2923
|
-
|
|
2924
|
-
|
|
2925
|
-
|
|
2926
|
-
|
|
2927
|
-
|
|
2928
|
-
|
|
2929
|
-
|
|
2930
|
-
|
|
2931
|
-
|
|
2932
|
-
|
|
2828
|
+
auto store = v8::ArrayBuffer::NewBackingStore(buf, bytes_size,
|
|
2829
|
+
[](void *data, size_t length,
|
|
2830
|
+
void *deleter_data) {
|
|
2831
|
+
if (deleter_data !=
|
|
2832
|
+
nullptr) {
|
|
2833
|
+
canvas_native_i32_buffer_destroy(
|
|
2834
|
+
(I32Buffer *) deleter_data);
|
|
2835
|
+
}
|
|
2836
|
+
},
|
|
2837
|
+
ret);
|
|
2933
2838
|
|
|
2934
|
-
|
|
2839
|
+
auto arraybuffer = v8::ArrayBuffer::New(isolate, std::move(store));
|
|
2935
2840
|
|
|
2936
2841
|
|
|
2937
|
-
|
|
2938
|
-
|
|
2939
|
-
|
|
2842
|
+
args.GetReturnValue().Set(
|
|
2843
|
+
v8::Int32Array::New(arraybuffer, 0, size)
|
|
2844
|
+
);
|
|
2940
2845
|
|
|
2941
|
-
|
|
2846
|
+
canvas_native_webgl_WebGLResult_destroy(val);
|
|
2942
2847
|
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
|
|
2848
|
+
return;
|
|
2849
|
+
}
|
|
2850
|
+
case WebGLResultType::WebGLResultTypeU32Array: {
|
|
2851
|
+
auto ret = canvas_native_webgl_result_get_u32_array(
|
|
2852
|
+
val);
|
|
2948
2853
|
|
|
2949
|
-
|
|
2950
|
-
|
|
2951
|
-
|
|
2854
|
+
auto buf = (uint8_t *) canvas_native_u32_buffer_get_bytes_mut(ret);
|
|
2855
|
+
auto size = canvas_native_u32_buffer_get_length(ret);
|
|
2856
|
+
auto bytes_size = size * sizeof(uint32_t);
|
|
2952
2857
|
|
|
2953
2858
|
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
|
|
2963
|
-
|
|
2859
|
+
auto store = v8::ArrayBuffer::NewBackingStore(buf, bytes_size,
|
|
2860
|
+
[](void *data, size_t length,
|
|
2861
|
+
void *deleter_data) {
|
|
2862
|
+
if (deleter_data !=
|
|
2863
|
+
nullptr) {
|
|
2864
|
+
canvas_native_u32_buffer_destroy(
|
|
2865
|
+
(U32Buffer *) deleter_data);
|
|
2866
|
+
}
|
|
2867
|
+
},
|
|
2868
|
+
ret);
|
|
2964
2869
|
|
|
2965
|
-
|
|
2870
|
+
auto arraybuffer = v8::ArrayBuffer::New(isolate, std::move(store));
|
|
2966
2871
|
|
|
2967
2872
|
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2873
|
+
args.GetReturnValue().Set(
|
|
2874
|
+
v8::Uint32Array::New(arraybuffer, 0, size)
|
|
2875
|
+
);
|
|
2971
2876
|
|
|
2972
2877
|
|
|
2973
|
-
|
|
2878
|
+
canvas_native_webgl_WebGLResult_destroy(val);
|
|
2974
2879
|
|
|
2975
|
-
|
|
2880
|
+
return;
|
|
2976
2881
|
|
|
2977
2882
|
|
|
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
2883
|
}
|
|
2884
|
+
case WebGLResultType::WebGLResultTypeF32:
|
|
2885
|
+
args.GetReturnValue().Set((double) canvas_native_webgl_result_get_f32(
|
|
2886
|
+
val));
|
|
2887
|
+
|
|
2888
|
+
canvas_native_webgl_WebGLResult_destroy(val);
|
|
2889
|
+
return;
|
|
2890
|
+
case WebGLResultType::WebGLResultTypeI32:
|
|
2891
|
+
args.GetReturnValue().Set(canvas_native_webgl_result_get_i32(
|
|
2892
|
+
val));
|
|
2893
|
+
|
|
2894
|
+
canvas_native_webgl_WebGLResult_destroy(val);
|
|
2895
|
+
return;
|
|
2896
|
+
case WebGLResultType::WebGLResultTypeU32:
|
|
2897
|
+
args.GetReturnValue().Set(canvas_native_webgl_result_get_u32(
|
|
2898
|
+
val));
|
|
2899
|
+
|
|
2900
|
+
canvas_native_webgl_WebGLResult_destroy(val);
|
|
2901
|
+
return;
|
|
2998
2902
|
}
|
|
2999
2903
|
}
|
|
3000
2904
|
}
|
|
@@ -3014,21 +2918,15 @@ WebGLRenderingContext::GetVertexAttribOffset(const v8::FunctionCallbackInfo<v8::
|
|
|
3014
2918
|
auto isolate = args.GetIsolate();
|
|
3015
2919
|
auto context = isolate->GetCurrentContext();
|
|
3016
2920
|
|
|
3017
|
-
|
|
3018
|
-
|
|
3019
|
-
|
|
3020
|
-
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
|
|
3024
|
-
|
|
3025
|
-
|
|
3026
|
-
args.GetReturnValue().Set(static_cast<double>(ret));
|
|
3027
|
-
return;
|
|
3028
|
-
}
|
|
3029
|
-
|
|
3030
|
-
// todo check return
|
|
3031
|
-
args.GetReturnValue().SetNull();
|
|
2921
|
+
auto index = (uint32_t) args[0]->NumberValue(
|
|
2922
|
+
context).ToChecked();
|
|
2923
|
+
auto pname = (uint32_t) args[1]->NumberValue(
|
|
2924
|
+
context).ToChecked();
|
|
2925
|
+
auto ret = canvas_native_webgl_get_vertex_attrib_offset(
|
|
2926
|
+
index,
|
|
2927
|
+
pname,
|
|
2928
|
+
ptr->GetState());
|
|
2929
|
+
args.GetReturnValue().Set(static_cast<double>(ret));
|
|
3032
2930
|
}
|
|
3033
2931
|
|
|
3034
2932
|
void
|
|
@@ -3043,63 +2941,58 @@ WebGLRenderingContext::GetVertexAttrib(const v8::FunctionCallbackInfo<v8::Value>
|
|
|
3043
2941
|
auto context = isolate->GetCurrentContext();
|
|
3044
2942
|
|
|
3045
2943
|
|
|
3046
|
-
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
ptr->GetState());
|
|
2944
|
+
auto index = (uint32_t) args[0]->NumberValue(
|
|
2945
|
+
context).ToChecked();
|
|
2946
|
+
auto pname = (uint32_t) args[1]->NumberValue(
|
|
2947
|
+
context).ToChecked();
|
|
2948
|
+
auto ret = canvas_native_webgl_get_vertex_attrib(
|
|
2949
|
+
index,
|
|
2950
|
+
pname,
|
|
2951
|
+
ptr->GetState());
|
|
3055
2952
|
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
|
|
3059
|
-
|
|
2953
|
+
if (pname ==
|
|
2954
|
+
GL_CURRENT_VERTEX_ATTRIB) {
|
|
2955
|
+
auto val = canvas_native_webgl_result_get_f32_array(
|
|
2956
|
+
ret);
|
|
3060
2957
|
|
|
3061
2958
|
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
|
|
2959
|
+
auto buf = (uint8_t *) canvas_native_f32_buffer_get_bytes_mut(val);
|
|
2960
|
+
auto size = canvas_native_f32_buffer_get_length(val);
|
|
2961
|
+
auto bytes_size = size * sizeof(float);
|
|
3065
2962
|
|
|
3066
|
-
|
|
3067
|
-
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
|
-
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
|
|
2963
|
+
auto store = v8::ArrayBuffer::NewBackingStore(buf, bytes_size,
|
|
2964
|
+
[](void *data, size_t length,
|
|
2965
|
+
void *deleter_data) {
|
|
2966
|
+
if (deleter_data != nullptr) {
|
|
2967
|
+
canvas_native_f32_buffer_destroy(
|
|
2968
|
+
(F32Buffer *) deleter_data);
|
|
2969
|
+
}
|
|
2970
|
+
},
|
|
2971
|
+
val);
|
|
3075
2972
|
|
|
3076
|
-
|
|
2973
|
+
auto arraybuffer = v8::ArrayBuffer::New(isolate, std::move(store));
|
|
3077
2974
|
|
|
3078
2975
|
|
|
3079
|
-
|
|
3080
|
-
|
|
3081
|
-
|
|
2976
|
+
args.GetReturnValue().Set(
|
|
2977
|
+
v8::Float32Array::New(arraybuffer, 0, size)
|
|
2978
|
+
);
|
|
3082
2979
|
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
}
|
|
2980
|
+
canvas_native_webgl_WebGLResult_destroy(ret);
|
|
2981
|
+
return;
|
|
2982
|
+
} else if (pname ==
|
|
2983
|
+
GL_VERTEX_ATTRIB_ARRAY_ENABLED ||
|
|
2984
|
+
pname ==
|
|
2985
|
+
GL_VERTEX_ATTRIB_ARRAY_NORMALIZED) {
|
|
2986
|
+
args.GetReturnValue().Set(canvas_native_webgl_result_get_bool(
|
|
2987
|
+
ret));
|
|
2988
|
+
canvas_native_webgl_WebGLResult_destroy(ret);
|
|
2989
|
+
return;
|
|
2990
|
+
} else {
|
|
2991
|
+
args.GetReturnValue().Set(canvas_native_webgl_result_get_i32(
|
|
2992
|
+
ret));
|
|
2993
|
+
canvas_native_webgl_WebGLResult_destroy(ret);
|
|
2994
|
+
return;
|
|
3099
2995
|
}
|
|
3100
|
-
|
|
3101
|
-
// todo check return
|
|
3102
|
-
args.GetReturnValue().SetNull();
|
|
3103
2996
|
}
|
|
3104
2997
|
|
|
3105
2998
|
void
|
|
@@ -3113,15 +3006,13 @@ WebGLRenderingContext::Hint(const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
|
3113
3006
|
auto isolate = args.GetIsolate();
|
|
3114
3007
|
auto context = isolate->GetCurrentContext();
|
|
3115
3008
|
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
ptr->GetState());
|
|
3124
|
-
}
|
|
3009
|
+
auto target = (uint32_t) args[0]->NumberValue(
|
|
3010
|
+
context).ToChecked();
|
|
3011
|
+
auto mode = (uint32_t) args[1]->NumberValue(
|
|
3012
|
+
context).ToChecked();
|
|
3013
|
+
canvas_native_webgl_hint(target,
|
|
3014
|
+
mode,
|
|
3015
|
+
ptr->GetState());
|
|
3125
3016
|
}
|
|
3126
3017
|
|
|
3127
3018
|
void
|
|
@@ -3176,15 +3067,11 @@ WebGLRenderingContext::IsEnabled(const v8::FunctionCallbackInfo<v8::Value> &args
|
|
|
3176
3067
|
auto isolate = args.GetIsolate();
|
|
3177
3068
|
auto context = isolate->GetCurrentContext();
|
|
3178
3069
|
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
args.GetReturnValue().Set(ret);
|
|
3185
|
-
return;
|
|
3186
|
-
}
|
|
3187
|
-
args.GetReturnValue().Set(false);
|
|
3070
|
+
auto cap = (uint32_t) args[0]->NumberValue(
|
|
3071
|
+
context).ToChecked();
|
|
3072
|
+
auto ret = canvas_native_webgl_is_enabled(
|
|
3073
|
+
cap, ptr->GetState());
|
|
3074
|
+
args.GetReturnValue().Set(ret);
|
|
3188
3075
|
}
|
|
3189
3076
|
|
|
3190
3077
|
void
|
|
@@ -3334,13 +3221,11 @@ WebGLRenderingContext::LineWidth(const v8::FunctionCallbackInfo<v8::Value> &args
|
|
|
3334
3221
|
auto isolate = args.GetIsolate();
|
|
3335
3222
|
auto context = isolate->GetCurrentContext();
|
|
3336
3223
|
|
|
3337
|
-
|
|
3338
|
-
|
|
3339
|
-
|
|
3340
|
-
|
|
3341
|
-
|
|
3342
|
-
ptr->GetState());
|
|
3343
|
-
}
|
|
3224
|
+
auto width = args[0]->NumberValue(
|
|
3225
|
+
context).ToChecked();
|
|
3226
|
+
canvas_native_webgl_line_width(
|
|
3227
|
+
static_cast<float>(width),
|
|
3228
|
+
ptr->GetState());
|
|
3344
3229
|
|
|
3345
3230
|
}
|
|
3346
3231
|
|
|
@@ -3374,26 +3259,23 @@ WebGLRenderingContext::PixelStorei(const v8::FunctionCallbackInfo<v8::Value> &ar
|
|
|
3374
3259
|
auto isolate = args.GetIsolate();
|
|
3375
3260
|
auto context = isolate->GetCurrentContext();
|
|
3376
3261
|
|
|
3377
|
-
|
|
3378
|
-
|
|
3262
|
+
auto pname = (uint32_t) args[0]->NumberValue(
|
|
3263
|
+
context).ToChecked();
|
|
3264
|
+
if (args[1]->IsBoolean()) {
|
|
3265
|
+
auto param = args[1]->BooleanValue(isolate);
|
|
3266
|
+
canvas_native_webgl_pixel_storei(
|
|
3267
|
+
pname,
|
|
3268
|
+
param ? 1 : 0,
|
|
3269
|
+
ptr->GetState()
|
|
3270
|
+
);
|
|
3271
|
+
} else {
|
|
3272
|
+
auto param = (int32_t) args[1]->NumberValue(
|
|
3379
3273
|
context).ToChecked();
|
|
3380
|
-
|
|
3381
|
-
|
|
3382
|
-
|
|
3383
|
-
|
|
3384
|
-
|
|
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
|
-
|
|
3274
|
+
canvas_native_webgl_pixel_storei(
|
|
3275
|
+
pname,
|
|
3276
|
+
param,
|
|
3277
|
+
ptr->GetState()
|
|
3278
|
+
);
|
|
3397
3279
|
}
|
|
3398
3280
|
}
|
|
3399
3281
|
|
|
@@ -3407,17 +3289,15 @@ WebGLRenderingContext::PolygonOffset(const v8::FunctionCallbackInfo<v8::Value> &
|
|
|
3407
3289
|
auto isolate = args.GetIsolate();
|
|
3408
3290
|
auto context = isolate->GetCurrentContext();
|
|
3409
3291
|
|
|
3410
|
-
|
|
3411
|
-
|
|
3412
|
-
|
|
3413
|
-
|
|
3414
|
-
|
|
3415
|
-
|
|
3416
|
-
|
|
3417
|
-
|
|
3418
|
-
|
|
3419
|
-
);
|
|
3420
|
-
}
|
|
3292
|
+
auto factor = args[0]->NumberValue(
|
|
3293
|
+
context).ToChecked();
|
|
3294
|
+
auto units = args[1]->NumberValue(
|
|
3295
|
+
context).ToChecked();
|
|
3296
|
+
canvas_native_webgl_polygon_offset(
|
|
3297
|
+
static_cast<float>(factor),
|
|
3298
|
+
static_cast<float>(units),
|
|
3299
|
+
ptr->GetState()
|
|
3300
|
+
);
|
|
3421
3301
|
|
|
3422
3302
|
}
|
|
3423
3303
|
|
|
@@ -3432,62 +3312,60 @@ WebGLRenderingContext::ReadPixels(const v8::FunctionCallbackInfo<v8::Value> &arg
|
|
|
3432
3312
|
auto context = isolate->GetCurrentContext();
|
|
3433
3313
|
|
|
3434
3314
|
|
|
3435
|
-
|
|
3436
|
-
|
|
3437
|
-
|
|
3438
|
-
|
|
3439
|
-
|
|
3440
|
-
|
|
3441
|
-
|
|
3442
|
-
|
|
3443
|
-
|
|
3444
|
-
|
|
3445
|
-
|
|
3446
|
-
|
|
3447
|
-
context).ToChecked();
|
|
3315
|
+
auto x = (int32_t) args[0]->NumberValue(
|
|
3316
|
+
context).ToChecked();
|
|
3317
|
+
auto y = (int32_t) args[1]->NumberValue(
|
|
3318
|
+
context).ToChecked();
|
|
3319
|
+
auto width = (int32_t) args[2]->NumberValue(
|
|
3320
|
+
context).ToChecked();
|
|
3321
|
+
auto height = (int32_t) args[3]->NumberValue(
|
|
3322
|
+
context).ToChecked();
|
|
3323
|
+
auto format = (uint32_t) args[4]->NumberValue(
|
|
3324
|
+
context).ToChecked();
|
|
3325
|
+
auto type = (uint32_t) args[5]->NumberValue(
|
|
3326
|
+
context).ToChecked();
|
|
3448
3327
|
|
|
3449
|
-
|
|
3450
|
-
|
|
3451
|
-
|
|
3328
|
+
auto pixels = args[6];
|
|
3329
|
+
if (pixels->IsArrayBufferView()) {
|
|
3330
|
+
auto buf = pixels.As<v8::ArrayBufferView>();
|
|
3452
3331
|
|
|
3453
|
-
|
|
3454
|
-
|
|
3455
|
-
|
|
3456
|
-
|
|
3457
|
-
|
|
3332
|
+
auto array = buf->Buffer();
|
|
3333
|
+
auto offset = buf->ByteOffset();
|
|
3334
|
+
auto size = array->ByteLength();
|
|
3335
|
+
auto data_ptr = static_cast<uint8_t *>(array->GetBackingStore()->Data()) + offset;
|
|
3336
|
+
auto data = static_cast<uint8_t *>((void *) data_ptr);
|
|
3458
3337
|
|
|
3459
3338
|
|
|
3460
|
-
|
|
3461
|
-
|
|
3462
|
-
|
|
3463
|
-
|
|
3464
|
-
|
|
3465
|
-
|
|
3466
|
-
|
|
3467
|
-
|
|
3468
|
-
|
|
3469
|
-
|
|
3470
|
-
|
|
3471
|
-
|
|
3339
|
+
canvas_native_webgl_read_pixels_u8(
|
|
3340
|
+
x,
|
|
3341
|
+
y,
|
|
3342
|
+
width,
|
|
3343
|
+
height,
|
|
3344
|
+
format,
|
|
3345
|
+
type,
|
|
3346
|
+
data, size,
|
|
3347
|
+
ptr->GetState()
|
|
3348
|
+
);
|
|
3349
|
+
return;
|
|
3350
|
+
}
|
|
3472
3351
|
|
|
3473
3352
|
|
|
3474
|
-
|
|
3475
|
-
|
|
3353
|
+
if (pixels->IsArrayBuffer()) {
|
|
3354
|
+
auto array = pixels.As<v8::ArrayBuffer>();
|
|
3476
3355
|
|
|
3477
|
-
|
|
3478
|
-
|
|
3356
|
+
auto size = array->ByteLength();
|
|
3357
|
+
auto data = (uint8_t *) array->GetBackingStore()->Data();
|
|
3479
3358
|
|
|
3480
|
-
|
|
3481
|
-
|
|
3482
|
-
|
|
3483
|
-
|
|
3484
|
-
|
|
3485
|
-
|
|
3486
|
-
|
|
3487
|
-
|
|
3488
|
-
|
|
3489
|
-
|
|
3490
|
-
}
|
|
3359
|
+
canvas_native_webgl_read_pixels_u8(
|
|
3360
|
+
x,
|
|
3361
|
+
y,
|
|
3362
|
+
width,
|
|
3363
|
+
height,
|
|
3364
|
+
format,
|
|
3365
|
+
type,
|
|
3366
|
+
data, size,
|
|
3367
|
+
ptr->GetState()
|
|
3368
|
+
);
|
|
3491
3369
|
}
|
|
3492
3370
|
|
|
3493
3371
|
}
|
|
@@ -3495,31 +3373,29 @@ WebGLRenderingContext::ReadPixels(const v8::FunctionCallbackInfo<v8::Value> &arg
|
|
|
3495
3373
|
void
|
|
3496
3374
|
WebGLRenderingContext::RenderbufferStorage(const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
3497
3375
|
WebGLRenderingContext *ptr = GetPointer(args.This());
|
|
3498
|
-
if (ptr == nullptr) {
|
|
3499
|
-
return;
|
|
3500
|
-
}
|
|
3501
|
-
|
|
3502
|
-
auto isolate = args.GetIsolate();
|
|
3503
|
-
auto context = isolate->GetCurrentContext();
|
|
3504
|
-
|
|
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
|
-
);
|
|
3376
|
+
if (ptr == nullptr) {
|
|
3377
|
+
return;
|
|
3521
3378
|
}
|
|
3522
3379
|
|
|
3380
|
+
auto isolate = args.GetIsolate();
|
|
3381
|
+
auto context = isolate->GetCurrentContext();
|
|
3382
|
+
|
|
3383
|
+
auto target = (uint32_t) args[0]->NumberValue(
|
|
3384
|
+
context).ToChecked();
|
|
3385
|
+
auto internalFormat = (uint32_t) args[1]->NumberValue(
|
|
3386
|
+
context).ToChecked();
|
|
3387
|
+
auto width = (int32_t) args[2]->NumberValue(
|
|
3388
|
+
context).ToChecked();
|
|
3389
|
+
auto height = (int32_t) args[3]->NumberValue(
|
|
3390
|
+
context).ToChecked();
|
|
3391
|
+
canvas_native_webgl_renderbuffer_storage(
|
|
3392
|
+
target,
|
|
3393
|
+
internalFormat,
|
|
3394
|
+
width,
|
|
3395
|
+
height,
|
|
3396
|
+
ptr->GetState()
|
|
3397
|
+
);
|
|
3398
|
+
|
|
3523
3399
|
}
|
|
3524
3400
|
|
|
3525
3401
|
void
|
|
@@ -3532,16 +3408,14 @@ WebGLRenderingContext::SampleCoverage(const v8::FunctionCallbackInfo<v8::Value>
|
|
|
3532
3408
|
auto isolate = args.GetIsolate();
|
|
3533
3409
|
auto context = isolate->GetCurrentContext();
|
|
3534
3410
|
|
|
3535
|
-
|
|
3536
|
-
|
|
3537
|
-
|
|
3538
|
-
|
|
3539
|
-
|
|
3540
|
-
|
|
3541
|
-
|
|
3542
|
-
|
|
3543
|
-
);
|
|
3544
|
-
}
|
|
3411
|
+
auto value = args[0]->NumberValue(
|
|
3412
|
+
context).ToChecked();
|
|
3413
|
+
auto invert = args[1]->BooleanValue(isolate);
|
|
3414
|
+
canvas_native_webgl_sample_coverage(
|
|
3415
|
+
static_cast<float>(value),
|
|
3416
|
+
invert,
|
|
3417
|
+
ptr->GetState()
|
|
3418
|
+
);
|
|
3545
3419
|
|
|
3546
3420
|
}
|
|
3547
3421
|
|
|
@@ -3555,23 +3429,21 @@ WebGLRenderingContext::Scissor(const v8::FunctionCallbackInfo<v8::Value> &args)
|
|
|
3555
3429
|
auto isolate = args.GetIsolate();
|
|
3556
3430
|
auto context = isolate->GetCurrentContext();
|
|
3557
3431
|
|
|
3558
|
-
|
|
3559
|
-
|
|
3560
|
-
|
|
3561
|
-
|
|
3562
|
-
|
|
3563
|
-
|
|
3564
|
-
|
|
3565
|
-
|
|
3566
|
-
|
|
3567
|
-
|
|
3568
|
-
|
|
3569
|
-
|
|
3570
|
-
|
|
3571
|
-
|
|
3572
|
-
|
|
3573
|
-
);
|
|
3574
|
-
}
|
|
3432
|
+
auto x = (int32_t) args[0]->NumberValue(
|
|
3433
|
+
context).ToChecked();
|
|
3434
|
+
auto y = (int32_t) args[1]->NumberValue(
|
|
3435
|
+
context).ToChecked();
|
|
3436
|
+
auto width = (int32_t) args[2]->NumberValue(
|
|
3437
|
+
context).ToChecked();
|
|
3438
|
+
auto height = (int32_t) args[3]->NumberValue(
|
|
3439
|
+
context).ToChecked();
|
|
3440
|
+
canvas_native_webgl_scissor(
|
|
3441
|
+
x,
|
|
3442
|
+
y,
|
|
3443
|
+
width,
|
|
3444
|
+
height,
|
|
3445
|
+
ptr->GetState()
|
|
3446
|
+
);
|
|
3575
3447
|
|
|
3576
3448
|
}
|
|
3577
3449
|
|
|
@@ -3610,23 +3482,21 @@ WebGLRenderingContext::StencilFuncSeparate(const v8::FunctionCallbackInfo<v8::Va
|
|
|
3610
3482
|
auto isolate = args.GetIsolate();
|
|
3611
3483
|
auto context = isolate->GetCurrentContext();
|
|
3612
3484
|
|
|
3613
|
-
|
|
3614
|
-
|
|
3615
|
-
|
|
3616
|
-
|
|
3617
|
-
|
|
3618
|
-
|
|
3619
|
-
|
|
3620
|
-
|
|
3621
|
-
|
|
3622
|
-
|
|
3623
|
-
|
|
3624
|
-
|
|
3625
|
-
|
|
3626
|
-
|
|
3627
|
-
|
|
3628
|
-
);
|
|
3629
|
-
}
|
|
3485
|
+
auto face = (uint32_t) args[0]->NumberValue(
|
|
3486
|
+
context).ToChecked();
|
|
3487
|
+
auto func = (uint32_t) args[1]->NumberValue(
|
|
3488
|
+
context).ToChecked();
|
|
3489
|
+
auto ref = (int32_t) args[2]->NumberValue(
|
|
3490
|
+
context).ToChecked();
|
|
3491
|
+
auto mask = (uint32_t) args[3]->NumberValue(
|
|
3492
|
+
context).ToChecked();
|
|
3493
|
+
canvas_native_webgl_stencil_func_separate(
|
|
3494
|
+
face,
|
|
3495
|
+
func,
|
|
3496
|
+
ref,
|
|
3497
|
+
mask,
|
|
3498
|
+
ptr->GetState()
|
|
3499
|
+
);
|
|
3630
3500
|
|
|
3631
3501
|
}
|
|
3632
3502
|
|
|
@@ -3640,20 +3510,18 @@ WebGLRenderingContext::StencilFunc(const v8::FunctionCallbackInfo<v8::Value> &ar
|
|
|
3640
3510
|
auto isolate = args.GetIsolate();
|
|
3641
3511
|
auto context = isolate->GetCurrentContext();
|
|
3642
3512
|
|
|
3643
|
-
|
|
3644
|
-
|
|
3645
|
-
|
|
3646
|
-
|
|
3647
|
-
|
|
3648
|
-
|
|
3649
|
-
|
|
3650
|
-
|
|
3651
|
-
|
|
3652
|
-
|
|
3653
|
-
|
|
3654
|
-
|
|
3655
|
-
);
|
|
3656
|
-
}
|
|
3513
|
+
auto func = (uint32_t) args[0]->NumberValue(
|
|
3514
|
+
context).ToChecked();
|
|
3515
|
+
auto ref = (int32_t) args[1]->NumberValue(
|
|
3516
|
+
context).ToChecked();
|
|
3517
|
+
auto mask = (uint32_t) args[2]->NumberValue(
|
|
3518
|
+
context).ToChecked();
|
|
3519
|
+
canvas_native_webgl_stencil_func(
|
|
3520
|
+
func,
|
|
3521
|
+
ref,
|
|
3522
|
+
mask,
|
|
3523
|
+
ptr->GetState()
|
|
3524
|
+
);
|
|
3657
3525
|
|
|
3658
3526
|
}
|
|
3659
3527
|
|
|
@@ -3667,17 +3535,15 @@ WebGLRenderingContext::StencilMaskSeparate(const v8::FunctionCallbackInfo<v8::Va
|
|
|
3667
3535
|
auto isolate = args.GetIsolate();
|
|
3668
3536
|
auto context = isolate->GetCurrentContext();
|
|
3669
3537
|
|
|
3670
|
-
|
|
3671
|
-
|
|
3672
|
-
|
|
3673
|
-
|
|
3674
|
-
|
|
3675
|
-
|
|
3676
|
-
|
|
3677
|
-
|
|
3678
|
-
|
|
3679
|
-
);
|
|
3680
|
-
}
|
|
3538
|
+
auto face = (uint32_t) args[0]->NumberValue(
|
|
3539
|
+
context).ToChecked();
|
|
3540
|
+
auto mask = (uint32_t) args[1]->NumberValue(
|
|
3541
|
+
context).ToChecked();
|
|
3542
|
+
canvas_native_webgl_stencil_mask_separate(
|
|
3543
|
+
face,
|
|
3544
|
+
mask,
|
|
3545
|
+
ptr->GetState()
|
|
3546
|
+
);
|
|
3681
3547
|
|
|
3682
3548
|
}
|
|
3683
3549
|
|
|
@@ -3691,14 +3557,12 @@ WebGLRenderingContext::StencilMask(const v8::FunctionCallbackInfo<v8::Value> &ar
|
|
|
3691
3557
|
auto isolate = args.GetIsolate();
|
|
3692
3558
|
auto context = isolate->GetCurrentContext();
|
|
3693
3559
|
|
|
3694
|
-
|
|
3695
|
-
|
|
3696
|
-
|
|
3697
|
-
|
|
3698
|
-
|
|
3699
|
-
|
|
3700
|
-
);
|
|
3701
|
-
}
|
|
3560
|
+
auto mask = (uint32_t) args[0]->NumberValue(
|
|
3561
|
+
context).ToChecked();
|
|
3562
|
+
canvas_native_webgl_stencil_mask(
|
|
3563
|
+
mask,
|
|
3564
|
+
ptr->GetState()
|
|
3565
|
+
);
|
|
3702
3566
|
|
|
3703
3567
|
}
|
|
3704
3568
|
|
|
@@ -3713,23 +3577,21 @@ WebGLRenderingContext::StencilOpSeparate(const v8::FunctionCallbackInfo<v8::Valu
|
|
|
3713
3577
|
auto context = isolate->GetCurrentContext();
|
|
3714
3578
|
|
|
3715
3579
|
|
|
3716
|
-
|
|
3717
|
-
|
|
3718
|
-
|
|
3719
|
-
|
|
3720
|
-
|
|
3721
|
-
|
|
3722
|
-
|
|
3723
|
-
|
|
3724
|
-
|
|
3725
|
-
|
|
3726
|
-
|
|
3727
|
-
|
|
3728
|
-
|
|
3729
|
-
|
|
3730
|
-
|
|
3731
|
-
);
|
|
3732
|
-
}
|
|
3580
|
+
auto face = (uint32_t) args[0]->NumberValue(
|
|
3581
|
+
context).ToChecked();
|
|
3582
|
+
auto fail = (uint32_t) args[1]->NumberValue(
|
|
3583
|
+
context).ToChecked();
|
|
3584
|
+
auto zfail = (uint32_t) args[2]->NumberValue(
|
|
3585
|
+
context).ToChecked();
|
|
3586
|
+
auto zpass = (uint32_t) args[3]->NumberValue(
|
|
3587
|
+
context).ToChecked();
|
|
3588
|
+
canvas_native_webgl_stencil_op_separate(
|
|
3589
|
+
face,
|
|
3590
|
+
fail,
|
|
3591
|
+
zfail,
|
|
3592
|
+
zpass,
|
|
3593
|
+
ptr->GetState()
|
|
3594
|
+
);
|
|
3733
3595
|
|
|
3734
3596
|
}
|
|
3735
3597
|
|
|
@@ -3743,20 +3605,18 @@ WebGLRenderingContext::StencilOp(const v8::FunctionCallbackInfo<v8::Value> &args
|
|
|
3743
3605
|
auto isolate = args.GetIsolate();
|
|
3744
3606
|
auto context = isolate->GetCurrentContext();
|
|
3745
3607
|
|
|
3746
|
-
|
|
3747
|
-
|
|
3748
|
-
|
|
3749
|
-
|
|
3750
|
-
|
|
3751
|
-
|
|
3752
|
-
|
|
3753
|
-
|
|
3754
|
-
|
|
3755
|
-
|
|
3756
|
-
|
|
3757
|
-
|
|
3758
|
-
);
|
|
3759
|
-
}
|
|
3608
|
+
auto fail = (uint32_t) args[0]->NumberValue(
|
|
3609
|
+
context).ToChecked();
|
|
3610
|
+
auto zfail = (uint32_t) args[1]->NumberValue(
|
|
3611
|
+
context).ToChecked();
|
|
3612
|
+
auto zpass = (uint32_t) args[2]->NumberValue(
|
|
3613
|
+
context).ToChecked();
|
|
3614
|
+
canvas_native_webgl_stencil_op(
|
|
3615
|
+
fail,
|
|
3616
|
+
zfail,
|
|
3617
|
+
zpass,
|
|
3618
|
+
ptr->GetState()
|
|
3619
|
+
);
|
|
3760
3620
|
|
|
3761
3621
|
}
|
|
3762
3622
|
|
|
@@ -3951,7 +3811,7 @@ WebGLRenderingContext::TexImage2D(const v8::FunctionCallbackInfo<v8::Value> &arg
|
|
|
3951
3811
|
auto array = buf->Buffer();
|
|
3952
3812
|
auto offset = buf->ByteOffset();
|
|
3953
3813
|
auto size = array->ByteLength();
|
|
3954
|
-
auto data_ptr = static_cast<uint8_t*>(array->GetBackingStore()->Data()) + offset;
|
|
3814
|
+
auto data_ptr = static_cast<uint8_t *>(array->GetBackingStore()->Data()) + offset;
|
|
3955
3815
|
auto data = static_cast<uint8_t *>((void *) data_ptr);
|
|
3956
3816
|
|
|
3957
3817
|
|
|
@@ -4003,20 +3863,18 @@ WebGLRenderingContext::TexParameterf(const v8::FunctionCallbackInfo<v8::Value> &
|
|
|
4003
3863
|
auto isolate = args.GetIsolate();
|
|
4004
3864
|
auto context = isolate->GetCurrentContext();
|
|
4005
3865
|
|
|
4006
|
-
|
|
4007
|
-
|
|
4008
|
-
|
|
4009
|
-
|
|
4010
|
-
|
|
4011
|
-
|
|
4012
|
-
|
|
4013
|
-
|
|
4014
|
-
|
|
4015
|
-
|
|
4016
|
-
|
|
4017
|
-
|
|
4018
|
-
);
|
|
4019
|
-
}
|
|
3866
|
+
auto target = (uint32_t) args[0]->NumberValue(
|
|
3867
|
+
context).ToChecked();
|
|
3868
|
+
auto pname = (uint32_t) args[1]->NumberValue(
|
|
3869
|
+
context).ToChecked();
|
|
3870
|
+
auto param = args[2]->NumberValue(
|
|
3871
|
+
context).ToChecked();
|
|
3872
|
+
canvas_native_webgl_tex_parameterf(
|
|
3873
|
+
target,
|
|
3874
|
+
pname,
|
|
3875
|
+
static_cast<float>(param),
|
|
3876
|
+
ptr->GetState()
|
|
3877
|
+
);
|
|
4020
3878
|
|
|
4021
3879
|
}
|
|
4022
3880
|
|
|
@@ -4030,20 +3888,18 @@ WebGLRenderingContext::TexParameteri(const v8::FunctionCallbackInfo<v8::Value> &
|
|
|
4030
3888
|
auto isolate = args.GetIsolate();
|
|
4031
3889
|
auto context = isolate->GetCurrentContext();
|
|
4032
3890
|
|
|
4033
|
-
|
|
4034
|
-
|
|
4035
|
-
|
|
4036
|
-
|
|
4037
|
-
|
|
4038
|
-
|
|
4039
|
-
|
|
4040
|
-
|
|
4041
|
-
|
|
4042
|
-
|
|
4043
|
-
|
|
4044
|
-
|
|
4045
|
-
);
|
|
4046
|
-
}
|
|
3891
|
+
auto target = (uint32_t) args[0]->NumberValue(
|
|
3892
|
+
context).ToChecked();
|
|
3893
|
+
auto pname = (uint32_t) args[1]->NumberValue(
|
|
3894
|
+
context).ToChecked();
|
|
3895
|
+
auto param = (int32_t) args[2]->NumberValue(
|
|
3896
|
+
context).ToChecked();
|
|
3897
|
+
canvas_native_webgl_tex_parameteri(
|
|
3898
|
+
target,
|
|
3899
|
+
pname,
|
|
3900
|
+
param,
|
|
3901
|
+
ptr->GetState()
|
|
3902
|
+
);
|
|
4047
3903
|
|
|
4048
3904
|
}
|
|
4049
3905
|
|
|
@@ -4176,7 +4032,7 @@ WebGLRenderingContext::TexSubImage2D(const v8::FunctionCallbackInfo<v8::Value> &
|
|
|
4176
4032
|
auto array = buf->Buffer();
|
|
4177
4033
|
auto offset = buf->ByteOffset();
|
|
4178
4034
|
auto size = array->ByteLength();
|
|
4179
|
-
auto data_ptr = static_cast<uint8_t*>(array->GetBackingStore()->Data()) + offset;
|
|
4035
|
+
auto data_ptr = static_cast<uint8_t *>(array->GetBackingStore()->Data()) + offset;
|
|
4180
4036
|
auto data = static_cast<uint8_t *>((void *) data_ptr);
|
|
4181
4037
|
|
|
4182
4038
|
|
|
@@ -4227,14 +4083,12 @@ WebGLRenderingContext::VertexAttrib1f(const v8::FunctionCallbackInfo<v8::Value>
|
|
|
4227
4083
|
auto isolate = args.GetIsolate();
|
|
4228
4084
|
auto context = isolate->GetCurrentContext();
|
|
4229
4085
|
|
|
4230
|
-
|
|
4231
|
-
|
|
4232
|
-
|
|
4233
|
-
|
|
4234
|
-
|
|
4235
|
-
|
|
4236
|
-
index, v0, ptr->GetState());
|
|
4237
|
-
}
|
|
4086
|
+
auto index = (uint32_t) args[0]->NumberValue(
|
|
4087
|
+
context).ToChecked();
|
|
4088
|
+
auto v0 = static_cast<float>(args[1]->NumberValue(
|
|
4089
|
+
context).ToChecked());
|
|
4090
|
+
canvas_native_webgl_vertex_attrib1f(
|
|
4091
|
+
index, v0, ptr->GetState());
|
|
4238
4092
|
|
|
4239
4093
|
}
|
|
4240
4094
|
|
|
@@ -4248,17 +4102,15 @@ WebGLRenderingContext::VertexAttrib2f(const v8::FunctionCallbackInfo<v8::Value>
|
|
|
4248
4102
|
auto isolate = args.GetIsolate();
|
|
4249
4103
|
auto context = isolate->GetCurrentContext();
|
|
4250
4104
|
|
|
4251
|
-
|
|
4252
|
-
|
|
4253
|
-
|
|
4254
|
-
|
|
4255
|
-
|
|
4256
|
-
|
|
4257
|
-
|
|
4258
|
-
|
|
4259
|
-
|
|
4260
|
-
ptr->GetState());
|
|
4261
|
-
}
|
|
4105
|
+
auto index = (uint32_t) args[0]->NumberValue(
|
|
4106
|
+
context).ToChecked();
|
|
4107
|
+
auto v0 = static_cast<float>(args[1]->NumberValue(
|
|
4108
|
+
context).ToChecked());
|
|
4109
|
+
auto v1 = static_cast<float>(args[2]->NumberValue(
|
|
4110
|
+
context).ToChecked());
|
|
4111
|
+
canvas_native_webgl_vertex_attrib2f(
|
|
4112
|
+
index, v0, v1,
|
|
4113
|
+
ptr->GetState());
|
|
4262
4114
|
|
|
4263
4115
|
}
|
|
4264
4116
|
|
|
@@ -4272,19 +4124,17 @@ WebGLRenderingContext::VertexAttrib3f(const v8::FunctionCallbackInfo<v8::Value>
|
|
|
4272
4124
|
auto isolate = args.GetIsolate();
|
|
4273
4125
|
auto context = isolate->GetCurrentContext();
|
|
4274
4126
|
|
|
4275
|
-
|
|
4276
|
-
|
|
4277
|
-
|
|
4278
|
-
|
|
4279
|
-
|
|
4280
|
-
|
|
4281
|
-
|
|
4282
|
-
|
|
4283
|
-
|
|
4284
|
-
|
|
4285
|
-
|
|
4286
|
-
ptr->GetState());
|
|
4287
|
-
}
|
|
4127
|
+
auto index = (uint32_t) args[0]->NumberValue(
|
|
4128
|
+
context).ToChecked();
|
|
4129
|
+
auto v0 = static_cast<float>(args[1]->NumberValue(
|
|
4130
|
+
context).ToChecked());
|
|
4131
|
+
auto v1 = static_cast<float>(args[2]->NumberValue(
|
|
4132
|
+
context).ToChecked());
|
|
4133
|
+
auto v2 = static_cast<float>(args[3]->NumberValue(
|
|
4134
|
+
context).ToChecked());
|
|
4135
|
+
canvas_native_webgl_vertex_attrib3f(
|
|
4136
|
+
index, v0, v1, v2,
|
|
4137
|
+
ptr->GetState());
|
|
4288
4138
|
|
|
4289
4139
|
}
|
|
4290
4140
|
|
|
@@ -4298,21 +4148,19 @@ WebGLRenderingContext::VertexAttrib4f(const v8::FunctionCallbackInfo<v8::Value>
|
|
|
4298
4148
|
auto isolate = args.GetIsolate();
|
|
4299
4149
|
auto context = isolate->GetCurrentContext();
|
|
4300
4150
|
|
|
4301
|
-
|
|
4302
|
-
|
|
4303
|
-
|
|
4304
|
-
|
|
4305
|
-
|
|
4306
|
-
|
|
4307
|
-
|
|
4308
|
-
|
|
4309
|
-
|
|
4310
|
-
|
|
4311
|
-
|
|
4312
|
-
|
|
4313
|
-
|
|
4314
|
-
ptr->GetState());
|
|
4315
|
-
}
|
|
4151
|
+
auto index = (uint32_t) args[0]->NumberValue(
|
|
4152
|
+
context).ToChecked();
|
|
4153
|
+
auto v0 = static_cast<float>(args[1]->NumberValue(
|
|
4154
|
+
context).ToChecked());
|
|
4155
|
+
auto v1 = static_cast<float>(args[2]->NumberValue(
|
|
4156
|
+
context).ToChecked());
|
|
4157
|
+
auto v2 = static_cast<float>(args[3]->NumberValue(
|
|
4158
|
+
context).ToChecked());
|
|
4159
|
+
auto v3 = static_cast<float>(args[4]->NumberValue(
|
|
4160
|
+
context).ToChecked());
|
|
4161
|
+
canvas_native_webgl_vertex_attrib4f(
|
|
4162
|
+
index, v0, v1, v2, v3,
|
|
4163
|
+
ptr->GetState());
|
|
4316
4164
|
|
|
4317
4165
|
}
|
|
4318
4166
|
|
|
@@ -4326,25 +4174,23 @@ WebGLRenderingContext::VertexAttrib1fv(const v8::FunctionCallbackInfo<v8::Value>
|
|
|
4326
4174
|
auto isolate = args.GetIsolate();
|
|
4327
4175
|
auto context = isolate->GetCurrentContext();
|
|
4328
4176
|
|
|
4329
|
-
|
|
4330
|
-
|
|
4331
|
-
context).ToChecked();
|
|
4177
|
+
auto index = (uint32_t) args[0]->NumberValue(
|
|
4178
|
+
context).ToChecked();
|
|
4332
4179
|
|
|
4333
|
-
|
|
4334
|
-
|
|
4335
|
-
|
|
4180
|
+
auto value = args[1];
|
|
4181
|
+
if (value->IsFloat32Array()) {
|
|
4182
|
+
auto buf = value.As<v8::Float32Array>();
|
|
4336
4183
|
|
|
4337
|
-
|
|
4338
|
-
|
|
4339
|
-
|
|
4340
|
-
|
|
4341
|
-
|
|
4184
|
+
auto array = buf->Buffer();
|
|
4185
|
+
auto offset = buf->ByteOffset();
|
|
4186
|
+
auto size = buf->Length();
|
|
4187
|
+
auto data_ptr = static_cast<uint8_t *>(array->GetBackingStore()->Data()) + offset;
|
|
4188
|
+
auto data = static_cast<float *>((void *) data_ptr);
|
|
4342
4189
|
|
|
4343
4190
|
|
|
4344
|
-
|
|
4345
|
-
|
|
4346
|
-
|
|
4347
|
-
}
|
|
4191
|
+
canvas_native_webgl_vertex_attrib1fv(
|
|
4192
|
+
index, data, size,
|
|
4193
|
+
ptr->GetState());
|
|
4348
4194
|
}
|
|
4349
4195
|
}
|
|
4350
4196
|
|
|
@@ -4358,25 +4204,23 @@ WebGLRenderingContext::VertexAttrib2fv(const v8::FunctionCallbackInfo<v8::Value>
|
|
|
4358
4204
|
auto isolate = args.GetIsolate();
|
|
4359
4205
|
auto context = isolate->GetCurrentContext();
|
|
4360
4206
|
|
|
4361
|
-
|
|
4362
|
-
|
|
4363
|
-
context).ToChecked();
|
|
4207
|
+
auto index = (uint32_t) args[0]->NumberValue(
|
|
4208
|
+
context).ToChecked();
|
|
4364
4209
|
|
|
4365
|
-
|
|
4366
|
-
|
|
4367
|
-
|
|
4210
|
+
auto value = args[1];
|
|
4211
|
+
if (value->IsFloat32Array()) {
|
|
4212
|
+
auto buf = value.As<v8::Float32Array>();
|
|
4368
4213
|
|
|
4369
|
-
|
|
4370
|
-
|
|
4371
|
-
|
|
4372
|
-
|
|
4373
|
-
|
|
4214
|
+
auto array = buf->Buffer();
|
|
4215
|
+
auto offset = buf->ByteOffset();
|
|
4216
|
+
auto size = buf->Length();
|
|
4217
|
+
auto data_ptr = static_cast<uint8_t *>(array->GetBackingStore()->Data()) + offset;
|
|
4218
|
+
auto data = static_cast<float *>((void *) data_ptr);
|
|
4374
4219
|
|
|
4375
4220
|
|
|
4376
|
-
|
|
4377
|
-
|
|
4378
|
-
|
|
4379
|
-
}
|
|
4221
|
+
canvas_native_webgl_vertex_attrib2fv(
|
|
4222
|
+
index, data, size,
|
|
4223
|
+
ptr->GetState());
|
|
4380
4224
|
}
|
|
4381
4225
|
}
|
|
4382
4226
|
|
|
@@ -4390,25 +4234,23 @@ WebGLRenderingContext::VertexAttrib3fv(const v8::FunctionCallbackInfo<v8::Value>
|
|
|
4390
4234
|
auto isolate = args.GetIsolate();
|
|
4391
4235
|
auto context = isolate->GetCurrentContext();
|
|
4392
4236
|
|
|
4393
|
-
|
|
4394
|
-
|
|
4395
|
-
context).ToChecked();
|
|
4237
|
+
auto index = (uint32_t) args[0]->NumberValue(
|
|
4238
|
+
context).ToChecked();
|
|
4396
4239
|
|
|
4397
|
-
|
|
4398
|
-
|
|
4399
|
-
|
|
4240
|
+
auto value = args[1];
|
|
4241
|
+
if (value->IsFloat32Array()) {
|
|
4242
|
+
auto buf = value.As<v8::Float32Array>();
|
|
4400
4243
|
|
|
4401
|
-
|
|
4402
|
-
|
|
4403
|
-
|
|
4404
|
-
|
|
4405
|
-
|
|
4244
|
+
auto array = buf->Buffer();
|
|
4245
|
+
auto offset = buf->ByteOffset();
|
|
4246
|
+
auto size = buf->Length();
|
|
4247
|
+
auto data_ptr = static_cast<uint8_t *>(array->GetBackingStore()->Data()) + offset;
|
|
4248
|
+
auto data = static_cast<float *>((void *) data_ptr);
|
|
4406
4249
|
|
|
4407
4250
|
|
|
4408
|
-
|
|
4409
|
-
|
|
4410
|
-
|
|
4411
|
-
}
|
|
4251
|
+
canvas_native_webgl_vertex_attrib3fv(
|
|
4252
|
+
index, data, size,
|
|
4253
|
+
ptr->GetState());
|
|
4412
4254
|
}
|
|
4413
4255
|
}
|
|
4414
4256
|
|
|
@@ -4422,25 +4264,23 @@ WebGLRenderingContext::VertexAttrib4fv(const v8::FunctionCallbackInfo<v8::Value>
|
|
|
4422
4264
|
auto isolate = args.GetIsolate();
|
|
4423
4265
|
auto context = isolate->GetCurrentContext();
|
|
4424
4266
|
|
|
4425
|
-
|
|
4426
|
-
|
|
4427
|
-
context).ToChecked();
|
|
4267
|
+
auto index = (uint32_t) args[0]->NumberValue(
|
|
4268
|
+
context).ToChecked();
|
|
4428
4269
|
|
|
4429
|
-
|
|
4430
|
-
|
|
4431
|
-
|
|
4270
|
+
auto value = args[1];
|
|
4271
|
+
if (value->IsFloat32Array()) {
|
|
4272
|
+
auto buf = value.As<v8::Float32Array>();
|
|
4432
4273
|
|
|
4433
|
-
|
|
4434
|
-
|
|
4435
|
-
|
|
4436
|
-
|
|
4437
|
-
|
|
4274
|
+
auto array = buf->Buffer();
|
|
4275
|
+
auto offset = buf->ByteOffset();
|
|
4276
|
+
auto size = buf->Length();
|
|
4277
|
+
auto data_ptr = static_cast<uint8_t *>(array->GetBackingStore()->Data()) + offset;
|
|
4278
|
+
auto data = static_cast<float *>((void *) data_ptr);
|
|
4438
4279
|
|
|
4439
4280
|
|
|
4440
|
-
|
|
4441
|
-
|
|
4442
|
-
|
|
4443
|
-
}
|
|
4281
|
+
canvas_native_webgl_vertex_attrib4fv(
|
|
4282
|
+
index, data, size,
|
|
4283
|
+
ptr->GetState());
|
|
4444
4284
|
}
|
|
4445
4285
|
}
|
|
4446
4286
|
|
|
@@ -4454,23 +4294,21 @@ WebGLRenderingContext::VertexAttribPointer(const v8::FunctionCallbackInfo<v8::Va
|
|
|
4454
4294
|
auto isolate = args.GetIsolate();
|
|
4455
4295
|
auto context = isolate->GetCurrentContext();
|
|
4456
4296
|
|
|
4457
|
-
|
|
4458
|
-
|
|
4459
|
-
|
|
4460
|
-
|
|
4461
|
-
|
|
4462
|
-
|
|
4463
|
-
|
|
4464
|
-
|
|
4465
|
-
|
|
4466
|
-
|
|
4467
|
-
|
|
4468
|
-
|
|
4469
|
-
|
|
4470
|
-
|
|
4471
|
-
|
|
4472
|
-
ptr->GetState());
|
|
4473
|
-
}
|
|
4297
|
+
auto index = (uint32_t) args[0]->NumberValue(
|
|
4298
|
+
context).ToChecked();
|
|
4299
|
+
auto size = (int32_t) args[1]->NumberValue(
|
|
4300
|
+
context).ToChecked();
|
|
4301
|
+
auto type = (uint32_t) args[2]->NumberValue(
|
|
4302
|
+
context).ToChecked();
|
|
4303
|
+
auto normalized = args[3]->BooleanValue(isolate);
|
|
4304
|
+
auto stride = (int32_t) args[4]->NumberValue(
|
|
4305
|
+
context).ToChecked();
|
|
4306
|
+
auto offset = static_cast<ssize_t>(args[5]->NumberValue(
|
|
4307
|
+
context).ToChecked());
|
|
4308
|
+
canvas_native_webgl_vertex_attrib_pointer(
|
|
4309
|
+
index, size, type, normalized,
|
|
4310
|
+
stride, offset,
|
|
4311
|
+
ptr->GetState());
|
|
4474
4312
|
}
|
|
4475
4313
|
|
|
4476
4314
|
void
|
|
@@ -4484,8 +4322,7 @@ WebGLRenderingContext::Uniform1f(const v8::FunctionCallbackInfo<v8::Value> &args
|
|
|
4484
4322
|
auto context = isolate->GetCurrentContext();
|
|
4485
4323
|
|
|
4486
4324
|
auto value = args[0];
|
|
4487
|
-
|
|
4488
|
-
// if (args[0].isObject()) {
|
|
4325
|
+
|
|
4489
4326
|
auto location = WebGLUniformLocation::GetPointer(value.As<v8::Object>());
|
|
4490
4327
|
auto v0 = args[1]->NumberValue(
|
|
4491
4328
|
context).ToChecked();
|
|
@@ -4496,8 +4333,6 @@ WebGLRenderingContext::Uniform1f(const v8::FunctionCallbackInfo<v8::Value> &args
|
|
|
4496
4333
|
ptr->GetState()
|
|
4497
4334
|
);
|
|
4498
4335
|
}
|
|
4499
|
-
// }
|
|
4500
|
-
// }
|
|
4501
4336
|
}
|
|
4502
4337
|
|
|
4503
4338
|
void
|
|
@@ -4511,8 +4346,7 @@ WebGLRenderingContext::Uniform2f(const v8::FunctionCallbackInfo<v8::Value> &args
|
|
|
4511
4346
|
auto context = isolate->GetCurrentContext();
|
|
4512
4347
|
|
|
4513
4348
|
auto value = args[0];
|
|
4514
|
-
|
|
4515
|
-
// if (args[0].isObject()) {
|
|
4349
|
+
|
|
4516
4350
|
auto location = WebGLUniformLocation::GetPointer(value.As<v8::Object>());
|
|
4517
4351
|
auto v0 = args[1]->NumberValue(
|
|
4518
4352
|
context).ToChecked();
|
|
@@ -4526,8 +4360,6 @@ WebGLRenderingContext::Uniform2f(const v8::FunctionCallbackInfo<v8::Value> &args
|
|
|
4526
4360
|
ptr->GetState()
|
|
4527
4361
|
);
|
|
4528
4362
|
}
|
|
4529
|
-
// }
|
|
4530
|
-
// }
|
|
4531
4363
|
}
|
|
4532
4364
|
|
|
4533
4365
|
void
|
|
@@ -4541,8 +4373,6 @@ WebGLRenderingContext::Uniform3f(const v8::FunctionCallbackInfo<v8::Value> &args
|
|
|
4541
4373
|
auto context = isolate->GetCurrentContext();
|
|
4542
4374
|
|
|
4543
4375
|
auto value = args[0];
|
|
4544
|
-
//if (count > 1) {
|
|
4545
|
-
// if (args[0].isObject()) {
|
|
4546
4376
|
auto location = WebGLUniformLocation::GetPointer(value.As<v8::Object>());
|
|
4547
4377
|
auto v0 = args[1]->NumberValue(
|
|
4548
4378
|
context).ToChecked();
|
|
@@ -4559,8 +4389,6 @@ WebGLRenderingContext::Uniform3f(const v8::FunctionCallbackInfo<v8::Value> &args
|
|
|
4559
4389
|
ptr->GetState()
|
|
4560
4390
|
);
|
|
4561
4391
|
}
|
|
4562
|
-
// }
|
|
4563
|
-
// }
|
|
4564
4392
|
}
|
|
4565
4393
|
|
|
4566
4394
|
void
|
|
@@ -4574,8 +4402,6 @@ WebGLRenderingContext::Uniform4f(const v8::FunctionCallbackInfo<v8::Value> &args
|
|
|
4574
4402
|
auto context = isolate->GetCurrentContext();
|
|
4575
4403
|
|
|
4576
4404
|
auto value = args[0];
|
|
4577
|
-
//if (count > 1) {
|
|
4578
|
-
// if (args[0].isObject()) {
|
|
4579
4405
|
auto location = WebGLUniformLocation::GetPointer(value.As<v8::Object>());
|
|
4580
4406
|
auto v0 = args[1]->NumberValue(
|
|
4581
4407
|
context).ToChecked();
|
|
@@ -4595,8 +4421,6 @@ WebGLRenderingContext::Uniform4f(const v8::FunctionCallbackInfo<v8::Value> &args
|
|
|
4595
4421
|
ptr->GetState()
|
|
4596
4422
|
);
|
|
4597
4423
|
}
|
|
4598
|
-
// }
|
|
4599
|
-
// }
|
|
4600
4424
|
}
|
|
4601
4425
|
|
|
4602
4426
|
void
|
|
@@ -4624,7 +4448,7 @@ WebGLRenderingContext::Uniform1fv(const v8::FunctionCallbackInfo<v8::Value> &arg
|
|
|
4624
4448
|
auto array = buf->Buffer();
|
|
4625
4449
|
auto offset = buf->ByteOffset();
|
|
4626
4450
|
auto size = buf->Length();
|
|
4627
|
-
auto data_ptr = static_cast<uint8_t*>(array->GetBackingStore()->Data()) + offset;
|
|
4451
|
+
auto data_ptr = static_cast<uint8_t *>(array->GetBackingStore()->Data()) + offset;
|
|
4628
4452
|
auto data = static_cast<float *>((void *) data_ptr);
|
|
4629
4453
|
|
|
4630
4454
|
|
|
@@ -4641,15 +4465,10 @@ WebGLRenderingContext::Uniform1fv(const v8::FunctionCallbackInfo<v8::Value> &arg
|
|
|
4641
4465
|
i < len; ++i) {
|
|
4642
4466
|
auto item = array->Get(
|
|
4643
4467
|
context, i).ToLocalChecked();
|
|
4644
|
-
|
|
4645
|
-
|
|
4646
|
-
|
|
4647
|
-
|
|
4648
|
-
auto value = item->NumberValue(
|
|
4649
|
-
context).ToChecked();
|
|
4650
|
-
buf.push_back(
|
|
4651
|
-
static_cast<float>(value));
|
|
4652
|
-
}
|
|
4468
|
+
auto value = item->NumberValue(
|
|
4469
|
+
context).ToChecked();
|
|
4470
|
+
buf.push_back(
|
|
4471
|
+
static_cast<float>(value));
|
|
4653
4472
|
}
|
|
4654
4473
|
|
|
4655
4474
|
canvas_native_webgl_uniform1fv(
|
|
@@ -4686,7 +4505,7 @@ WebGLRenderingContext::Uniform2fv(const v8::FunctionCallbackInfo<v8::Value> &arg
|
|
|
4686
4505
|
auto array = buf->Buffer();
|
|
4687
4506
|
auto offset = buf->ByteOffset();
|
|
4688
4507
|
auto size = buf->Length();
|
|
4689
|
-
auto data_ptr = static_cast<uint8_t*>(array->GetBackingStore()->Data()) + offset;
|
|
4508
|
+
auto data_ptr = static_cast<uint8_t *>(array->GetBackingStore()->Data()) + offset;
|
|
4690
4509
|
auto data = static_cast<float *>((void *) data_ptr);
|
|
4691
4510
|
|
|
4692
4511
|
|
|
@@ -4703,15 +4522,10 @@ WebGLRenderingContext::Uniform2fv(const v8::FunctionCallbackInfo<v8::Value> &arg
|
|
|
4703
4522
|
i < len; ++i) {
|
|
4704
4523
|
auto item = array->Get(
|
|
4705
4524
|
context, i).ToLocalChecked();
|
|
4706
|
-
|
|
4707
|
-
|
|
4708
|
-
|
|
4709
|
-
|
|
4710
|
-
auto value = item->NumberValue(
|
|
4711
|
-
context).ToChecked();
|
|
4712
|
-
buf.push_back(
|
|
4713
|
-
static_cast<float>(value));
|
|
4714
|
-
}
|
|
4525
|
+
auto value = item->NumberValue(
|
|
4526
|
+
context).ToChecked();
|
|
4527
|
+
buf.push_back(
|
|
4528
|
+
static_cast<float>(value));
|
|
4715
4529
|
}
|
|
4716
4530
|
|
|
4717
4531
|
canvas_native_webgl_uniform2fv(
|
|
@@ -4748,7 +4562,7 @@ WebGLRenderingContext::Uniform3fv(const v8::FunctionCallbackInfo<v8::Value> &arg
|
|
|
4748
4562
|
auto array = buf->Buffer();
|
|
4749
4563
|
auto offset = buf->ByteOffset();
|
|
4750
4564
|
auto size = buf->Length();
|
|
4751
|
-
auto data_ptr = static_cast<uint8_t*>(array->GetBackingStore()->Data()) + offset;
|
|
4565
|
+
auto data_ptr = static_cast<uint8_t *>(array->GetBackingStore()->Data()) + offset;
|
|
4752
4566
|
auto data = static_cast<float *>((void *) data_ptr);
|
|
4753
4567
|
|
|
4754
4568
|
|
|
@@ -4765,15 +4579,10 @@ WebGLRenderingContext::Uniform3fv(const v8::FunctionCallbackInfo<v8::Value> &arg
|
|
|
4765
4579
|
i < len; ++i) {
|
|
4766
4580
|
auto item = array->Get(
|
|
4767
4581
|
context, i).ToLocalChecked();
|
|
4768
|
-
|
|
4769
|
-
|
|
4770
|
-
|
|
4771
|
-
|
|
4772
|
-
auto value = item->NumberValue(
|
|
4773
|
-
context).ToChecked();
|
|
4774
|
-
buf.push_back(
|
|
4775
|
-
static_cast<float>(value));
|
|
4776
|
-
}
|
|
4582
|
+
auto value = item->NumberValue(
|
|
4583
|
+
context).ToChecked();
|
|
4584
|
+
buf.push_back(
|
|
4585
|
+
static_cast<float>(value));
|
|
4777
4586
|
}
|
|
4778
4587
|
canvas_native_webgl_uniform3fv(
|
|
4779
4588
|
location->GetUniformLocation(),
|
|
@@ -4809,7 +4618,7 @@ WebGLRenderingContext::Uniform4fv(const v8::FunctionCallbackInfo<v8::Value> &arg
|
|
|
4809
4618
|
auto array = buf->Buffer();
|
|
4810
4619
|
auto offset = buf->ByteOffset();
|
|
4811
4620
|
auto size = buf->Length();
|
|
4812
|
-
auto data_ptr = static_cast<uint8_t*>(array->GetBackingStore()->Data()) + offset;
|
|
4621
|
+
auto data_ptr = static_cast<uint8_t *>(array->GetBackingStore()->Data()) + offset;
|
|
4813
4622
|
auto data = static_cast<float *>((void *) data_ptr);
|
|
4814
4623
|
|
|
4815
4624
|
|
|
@@ -4826,15 +4635,10 @@ WebGLRenderingContext::Uniform4fv(const v8::FunctionCallbackInfo<v8::Value> &arg
|
|
|
4826
4635
|
i < len; ++i) {
|
|
4827
4636
|
auto item = array->Get(
|
|
4828
4637
|
context, i).ToLocalChecked();
|
|
4829
|
-
|
|
4830
|
-
|
|
4831
|
-
|
|
4832
|
-
|
|
4833
|
-
auto value = item->NumberValue(
|
|
4834
|
-
context).ToChecked();
|
|
4835
|
-
buf.push_back(
|
|
4836
|
-
static_cast<float>(value));
|
|
4837
|
-
}
|
|
4638
|
+
auto value = item->NumberValue(
|
|
4639
|
+
context).ToChecked();
|
|
4640
|
+
buf.push_back(
|
|
4641
|
+
static_cast<float>(value));
|
|
4838
4642
|
}
|
|
4839
4643
|
canvas_native_webgl_uniform4fv(
|
|
4840
4644
|
location->GetUniformLocation(),
|
|
@@ -4857,8 +4661,6 @@ WebGLRenderingContext::Uniform1i(const v8::FunctionCallbackInfo<v8::Value> &args
|
|
|
4857
4661
|
auto context = isolate->GetCurrentContext();
|
|
4858
4662
|
|
|
4859
4663
|
auto value = args[0];
|
|
4860
|
-
//if (count > 1) {
|
|
4861
|
-
// if (args[0].isObject()) {
|
|
4862
4664
|
auto location = WebGLUniformLocation::GetPointer(value.As<v8::Object>());
|
|
4863
4665
|
auto v0 = args[1]->NumberValue(
|
|
4864
4666
|
context).ToChecked();
|
|
@@ -4869,8 +4671,6 @@ WebGLRenderingContext::Uniform1i(const v8::FunctionCallbackInfo<v8::Value> &args
|
|
|
4869
4671
|
ptr->GetState()
|
|
4870
4672
|
);
|
|
4871
4673
|
}
|
|
4872
|
-
// }
|
|
4873
|
-
// }
|
|
4874
4674
|
}
|
|
4875
4675
|
|
|
4876
4676
|
void
|
|
@@ -4884,8 +4684,6 @@ WebGLRenderingContext::Uniform2i(const v8::FunctionCallbackInfo<v8::Value> &args
|
|
|
4884
4684
|
auto context = isolate->GetCurrentContext();
|
|
4885
4685
|
|
|
4886
4686
|
auto value = args[0];
|
|
4887
|
-
//if (count > 1) {
|
|
4888
|
-
// if (args[0].isObject()) {
|
|
4889
4687
|
auto location = WebGLUniformLocation::GetPointer(value.As<v8::Object>());
|
|
4890
4688
|
auto v0 = args[1]->NumberValue(
|
|
4891
4689
|
context).ToChecked();
|
|
@@ -4899,8 +4697,6 @@ WebGLRenderingContext::Uniform2i(const v8::FunctionCallbackInfo<v8::Value> &args
|
|
|
4899
4697
|
ptr->GetState()
|
|
4900
4698
|
);
|
|
4901
4699
|
}
|
|
4902
|
-
// }
|
|
4903
|
-
// }
|
|
4904
4700
|
}
|
|
4905
4701
|
|
|
4906
4702
|
void
|
|
@@ -4914,8 +4710,6 @@ WebGLRenderingContext::Uniform3i(const v8::FunctionCallbackInfo<v8::Value> &args
|
|
|
4914
4710
|
auto context = isolate->GetCurrentContext();
|
|
4915
4711
|
|
|
4916
4712
|
auto value = args[0];
|
|
4917
|
-
//if (count > 1) {
|
|
4918
|
-
// if (args[0].isObject()) {
|
|
4919
4713
|
auto location = WebGLUniformLocation::GetPointer(value.As<v8::Object>());
|
|
4920
4714
|
auto v0 = args[1]->NumberValue(
|
|
4921
4715
|
context).ToChecked();
|
|
@@ -4932,8 +4726,6 @@ WebGLRenderingContext::Uniform3i(const v8::FunctionCallbackInfo<v8::Value> &args
|
|
|
4932
4726
|
ptr->GetState()
|
|
4933
4727
|
);
|
|
4934
4728
|
}
|
|
4935
|
-
// }
|
|
4936
|
-
// }
|
|
4937
4729
|
}
|
|
4938
4730
|
|
|
4939
4731
|
void
|
|
@@ -4947,8 +4739,6 @@ WebGLRenderingContext::Uniform4i(const v8::FunctionCallbackInfo<v8::Value> &args
|
|
|
4947
4739
|
auto context = isolate->GetCurrentContext();
|
|
4948
4740
|
|
|
4949
4741
|
auto value = args[0];
|
|
4950
|
-
//if (count > 1) {
|
|
4951
|
-
// if (args[0].isObject()) {
|
|
4952
4742
|
auto location = WebGLUniformLocation::GetPointer(value.As<v8::Object>());
|
|
4953
4743
|
auto v0 = args[1]->NumberValue(
|
|
4954
4744
|
context).ToChecked();
|
|
@@ -4968,8 +4758,6 @@ WebGLRenderingContext::Uniform4i(const v8::FunctionCallbackInfo<v8::Value> &args
|
|
|
4968
4758
|
ptr->GetState()
|
|
4969
4759
|
);
|
|
4970
4760
|
}
|
|
4971
|
-
// }
|
|
4972
|
-
// }
|
|
4973
4761
|
}
|
|
4974
4762
|
|
|
4975
4763
|
void
|
|
@@ -4997,7 +4785,7 @@ WebGLRenderingContext::Uniform1iv(const v8::FunctionCallbackInfo<v8::Value> &arg
|
|
|
4997
4785
|
auto array = buf->Buffer();
|
|
4998
4786
|
auto offset = buf->ByteOffset();
|
|
4999
4787
|
auto size = buf->Length();
|
|
5000
|
-
auto data_ptr = static_cast<uint8_t*>(array->GetBackingStore()->Data()) + offset;
|
|
4788
|
+
auto data_ptr = static_cast<uint8_t *>(array->GetBackingStore()->Data()) + offset;
|
|
5001
4789
|
auto data = static_cast<int32_t *>((void *) data_ptr);
|
|
5002
4790
|
|
|
5003
4791
|
|
|
@@ -5055,7 +4843,7 @@ WebGLRenderingContext::Uniform2iv(const v8::FunctionCallbackInfo<v8::Value> &arg
|
|
|
5055
4843
|
auto array = buf->Buffer();
|
|
5056
4844
|
auto offset = buf->ByteOffset();
|
|
5057
4845
|
auto size = buf->Length();
|
|
5058
|
-
auto data_ptr = static_cast<uint8_t*>(array->GetBackingStore()->Data()) + offset;
|
|
4846
|
+
auto data_ptr = static_cast<uint8_t *>(array->GetBackingStore()->Data()) + offset;
|
|
5059
4847
|
auto data = static_cast<int32_t *>((void *) data_ptr);
|
|
5060
4848
|
|
|
5061
4849
|
canvas_native_webgl_uniform2iv(
|
|
@@ -5111,7 +4899,7 @@ WebGLRenderingContext::Uniform3iv(const v8::FunctionCallbackInfo<v8::Value> &arg
|
|
|
5111
4899
|
auto array = buf->Buffer();
|
|
5112
4900
|
auto offset = buf->ByteOffset();
|
|
5113
4901
|
auto size = buf->Length();
|
|
5114
|
-
auto data_ptr = static_cast<uint8_t*>(array->GetBackingStore()->Data()) + offset;
|
|
4902
|
+
auto data_ptr = static_cast<uint8_t *>(array->GetBackingStore()->Data()) + offset;
|
|
5115
4903
|
auto data = static_cast<int32_t *>((void *) data_ptr);
|
|
5116
4904
|
|
|
5117
4905
|
|
|
@@ -5169,7 +4957,7 @@ WebGLRenderingContext::Uniform4iv(const v8::FunctionCallbackInfo<v8::Value> &arg
|
|
|
5169
4957
|
auto array = buf->Buffer();
|
|
5170
4958
|
auto offset = buf->ByteOffset();
|
|
5171
4959
|
auto size = buf->Length();
|
|
5172
|
-
auto data_ptr = static_cast<uint8_t*>(array->GetBackingStore()->Data()) + offset;
|
|
4960
|
+
auto data_ptr = static_cast<uint8_t *>(array->GetBackingStore()->Data()) + offset;
|
|
5173
4961
|
auto data = static_cast<int32_t *>((void *) data_ptr);
|
|
5174
4962
|
|
|
5175
4963
|
|
|
@@ -5226,7 +5014,7 @@ WebGLRenderingContext::UniformMatrix2fv(const v8::FunctionCallbackInfo<v8::Value
|
|
|
5226
5014
|
auto array = buf->Buffer();
|
|
5227
5015
|
auto offset = buf->ByteOffset();
|
|
5228
5016
|
auto size = buf->Length();
|
|
5229
|
-
auto data_ptr = static_cast<uint8_t*>(array->GetBackingStore()->Data()) + offset;
|
|
5017
|
+
auto data_ptr = static_cast<uint8_t *>(array->GetBackingStore()->Data()) + offset;
|
|
5230
5018
|
auto data = static_cast<float *>((void *) data_ptr);
|
|
5231
5019
|
|
|
5232
5020
|
canvas_native_webgl_uniform_matrix2fv(
|
|
@@ -5242,15 +5030,9 @@ WebGLRenderingContext::UniformMatrix2fv(const v8::FunctionCallbackInfo<v8::Value
|
|
|
5242
5030
|
for (int i = 0;
|
|
5243
5031
|
i < len; i++) {
|
|
5244
5032
|
auto item = array->Get(context, i).ToLocalChecked();
|
|
5245
|
-
|
|
5246
|
-
|
|
5247
|
-
|
|
5248
|
-
context).ToChecked()));
|
|
5249
|
-
} else {
|
|
5250
|
-
buf.push_back(
|
|
5251
|
-
std::nanf(
|
|
5252
|
-
""));
|
|
5253
|
-
}
|
|
5033
|
+
buf.push_back(
|
|
5034
|
+
static_cast<float>(item->NumberValue(
|
|
5035
|
+
context).ToChecked()));
|
|
5254
5036
|
}
|
|
5255
5037
|
|
|
5256
5038
|
canvas_native_webgl_uniform_matrix2fv(
|
|
@@ -5288,7 +5070,7 @@ WebGLRenderingContext::UniformMatrix3fv(const v8::FunctionCallbackInfo<v8::Value
|
|
|
5288
5070
|
auto array = buf->Buffer();
|
|
5289
5071
|
auto offset = buf->ByteOffset();
|
|
5290
5072
|
auto size = buf->Length();
|
|
5291
|
-
auto data_ptr = static_cast<uint8_t*>(array->GetBackingStore()->Data()) + offset;
|
|
5073
|
+
auto data_ptr = static_cast<uint8_t *>(array->GetBackingStore()->Data()) + offset;
|
|
5292
5074
|
auto data = static_cast<float *>((void *) data_ptr);
|
|
5293
5075
|
|
|
5294
5076
|
canvas_native_webgl_uniform_matrix3fv(
|
|
@@ -5304,15 +5086,9 @@ WebGLRenderingContext::UniformMatrix3fv(const v8::FunctionCallbackInfo<v8::Value
|
|
|
5304
5086
|
for (int i = 0;
|
|
5305
5087
|
i < len; i++) {
|
|
5306
5088
|
auto item = array->Get(context, i).ToLocalChecked();
|
|
5307
|
-
|
|
5308
|
-
|
|
5309
|
-
|
|
5310
|
-
context).ToChecked()));
|
|
5311
|
-
} else {
|
|
5312
|
-
buf.push_back(
|
|
5313
|
-
std::nanf(
|
|
5314
|
-
""));
|
|
5315
|
-
}
|
|
5089
|
+
buf.push_back(
|
|
5090
|
+
static_cast<float>(item->NumberValue(
|
|
5091
|
+
context).ToChecked()));
|
|
5316
5092
|
}
|
|
5317
5093
|
|
|
5318
5094
|
|
|
@@ -5351,7 +5127,7 @@ WebGLRenderingContext::UniformMatrix4fv(const v8::FunctionCallbackInfo<v8::Value
|
|
|
5351
5127
|
auto array = buf->Buffer();
|
|
5352
5128
|
auto offset = buf->ByteOffset();
|
|
5353
5129
|
auto size = buf->Length();
|
|
5354
|
-
auto data_ptr = static_cast<uint8_t*>(array->GetBackingStore()->Data()) + offset;
|
|
5130
|
+
auto data_ptr = static_cast<uint8_t *>(array->GetBackingStore()->Data()) + offset;
|
|
5355
5131
|
auto data = static_cast<float *>((void *) data_ptr);
|
|
5356
5132
|
|
|
5357
5133
|
|
|
@@ -5368,15 +5144,9 @@ WebGLRenderingContext::UniformMatrix4fv(const v8::FunctionCallbackInfo<v8::Value
|
|
|
5368
5144
|
for (int i = 0;
|
|
5369
5145
|
i < len; i++) {
|
|
5370
5146
|
auto item = array->Get(context, i).ToLocalChecked();
|
|
5371
|
-
|
|
5372
|
-
|
|
5373
|
-
|
|
5374
|
-
context).ToChecked()));
|
|
5375
|
-
} else {
|
|
5376
|
-
buf.push_back(
|
|
5377
|
-
std::nanf(
|
|
5378
|
-
""));
|
|
5379
|
-
}
|
|
5147
|
+
buf.push_back(
|
|
5148
|
+
static_cast<float>(item->NumberValue(
|
|
5149
|
+
context).ToChecked()));
|
|
5380
5150
|
}
|
|
5381
5151
|
|
|
5382
5152
|
|
|
@@ -5399,24 +5169,22 @@ WebGLRenderingContext::UseProgram(const v8::FunctionCallbackInfo<v8::Value> &arg
|
|
|
5399
5169
|
|
|
5400
5170
|
auto isolate = args.GetIsolate();
|
|
5401
5171
|
|
|
5402
|
-
|
|
5403
|
-
|
|
5404
|
-
|
|
5405
|
-
|
|
5406
|
-
ptr->GetState());
|
|
5172
|
+
auto value = args[0];
|
|
5173
|
+
if (value->IsNull()) {
|
|
5174
|
+
canvas_native_webgl_use_program(0,
|
|
5175
|
+
ptr->GetState());
|
|
5407
5176
|
|
|
5408
|
-
|
|
5409
|
-
|
|
5177
|
+
return;
|
|
5178
|
+
}
|
|
5410
5179
|
|
|
5411
|
-
|
|
5412
|
-
|
|
5413
|
-
|
|
5414
|
-
|
|
5415
|
-
|
|
5416
|
-
|
|
5417
|
-
|
|
5418
|
-
|
|
5419
|
-
}
|
|
5180
|
+
auto type = GetNativeType(isolate, value);
|
|
5181
|
+
if (type == NativeType::WebGLProgram) {
|
|
5182
|
+
auto program = WebGLProgram::GetPointer(value.As<v8::Object>());
|
|
5183
|
+
if (program != nullptr) {
|
|
5184
|
+
canvas_native_webgl_use_program(
|
|
5185
|
+
program->GetProgram(),
|
|
5186
|
+
ptr->GetState()
|
|
5187
|
+
);
|
|
5420
5188
|
}
|
|
5421
5189
|
}
|
|
5422
5190
|
|
|
@@ -5455,20 +5223,18 @@ WebGLRenderingContext::Viewport(const v8::FunctionCallbackInfo<v8::Value> &args)
|
|
|
5455
5223
|
auto isolate = args.GetIsolate();
|
|
5456
5224
|
auto context = isolate->GetCurrentContext();
|
|
5457
5225
|
|
|
5458
|
-
|
|
5459
|
-
|
|
5460
|
-
|
|
5461
|
-
|
|
5462
|
-
|
|
5463
|
-
|
|
5464
|
-
|
|
5465
|
-
|
|
5466
|
-
|
|
5467
|
-
|
|
5468
|
-
|
|
5469
|
-
|
|
5470
|
-
ptr->GetState());
|
|
5471
|
-
}
|
|
5226
|
+
auto x = (int32_t) args[0]->NumberValue(
|
|
5227
|
+
context).ToChecked();
|
|
5228
|
+
auto y = (int32_t) args[1]->NumberValue(
|
|
5229
|
+
context).ToChecked();
|
|
5230
|
+
auto width = (int32_t) args[2]->NumberValue(
|
|
5231
|
+
context).ToChecked();
|
|
5232
|
+
auto height = (int32_t) args[3]->NumberValue(
|
|
5233
|
+
context).ToChecked();
|
|
5234
|
+
canvas_native_webgl_viewport(x, y,
|
|
5235
|
+
width,
|
|
5236
|
+
height,
|
|
5237
|
+
ptr->GetState());
|
|
5472
5238
|
|
|
5473
5239
|
}
|
|
5474
5240
|
|