@nativescript/canvas 2.0.0-alpha.47 → 2.0.0-alpha.49
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.d.ts +1 -1
- package/Canvas/index.android.js +21 -14
- package/Canvas/index.android.js.map +1 -1
- package/Canvas/index.ios.d.ts +1 -1
- package/Canvas/index.ios.js +45 -32
- package/Canvas/index.ios.js.map +1 -1
- package/Canvas2D/CanvasRenderingContext2D/index.js +18 -8
- package/Canvas2D/CanvasRenderingContext2D/index.js.map +1 -1
- package/Canvas2D/Path2D/index.js +5 -10
- package/Canvas2D/Path2D/index.js.map +1 -1
- package/package.json +1 -1
- package/platforms/android/canvas-release.aar +0 -0
- package/platforms/ios/CanvasNative.xcframework/Info.plist +5 -5
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/CanvasNative +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Headers/canvas_native.h +72 -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/CanvasNative.framework/CanvasNative +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Headers/canvas_native.h +72 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/_CodeSignature/CodeResources +2 -2
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/dSYMs/CanvasNative.framework.dSYM/Contents/Resources/DWARF/CanvasNative +0 -0
- package/platforms/ios/Podfile +1 -1
- package/platforms/ios/src/cpp/canvas2d/CanvasPattern.cpp +10 -9
- package/platforms/ios/src/cpp/canvas2d/CanvasPattern.h +28 -5
- package/platforms/ios/src/cpp/canvas2d/CanvasRenderingContext2DImpl.cpp +300 -103
- package/platforms/ios/src/cpp/canvas2d/CanvasRenderingContext2DImpl.h +588 -90
- package/platforms/ios/src/cpp/webgl/WebGLRenderingContext.cpp +330 -289
- package/platforms/ios/src/cpp/webgl/WebGLRenderingContext.h +1127 -27
|
@@ -66,6 +66,12 @@ public:
|
|
|
66
66
|
|
|
67
67
|
static v8::Local<v8::FunctionTemplate> GetCtor(v8::Isolate *isolate);
|
|
68
68
|
|
|
69
|
+
static v8::CFunction fast_resized_;
|
|
70
|
+
|
|
71
|
+
static v8::CFunction fast_start_raf_;
|
|
72
|
+
|
|
73
|
+
static v8::CFunction fast_stop_raf_;
|
|
74
|
+
|
|
69
75
|
static v8::CFunction fast_active_texture_;
|
|
70
76
|
|
|
71
77
|
static v8::CFunction fast_attach_shader_;
|
|
@@ -74,6 +80,73 @@ public:
|
|
|
74
80
|
|
|
75
81
|
static v8::CFunction fast_bind_buffer_null_;
|
|
76
82
|
|
|
83
|
+
static v8::CFunction fast_bind_frame_buffer_;
|
|
84
|
+
|
|
85
|
+
static v8::CFunction fast_bind_frame_buffer_null_;
|
|
86
|
+
|
|
87
|
+
static v8::CFunction fast_bind_render_buffer_;
|
|
88
|
+
|
|
89
|
+
static v8::CFunction fast_bind_render_buffer_null_;
|
|
90
|
+
|
|
91
|
+
static v8::CFunction fast_bind_texture_;
|
|
92
|
+
|
|
93
|
+
static v8::CFunction fast_bind_texture_null_;
|
|
94
|
+
|
|
95
|
+
static v8::CFunction fast_blend_color_;
|
|
96
|
+
static v8::CFunction fast_blend_equation_separate_;
|
|
97
|
+
static v8::CFunction fast_blend_equation_;
|
|
98
|
+
static v8::CFunction fast_blend_func_separate_;
|
|
99
|
+
static v8::CFunction fast_blend_func_;
|
|
100
|
+
|
|
101
|
+
static v8::CFunction fast_buffer_data_os_;
|
|
102
|
+
static v8::CFunction fast_buffer_data_target_usage_;
|
|
103
|
+
static v8::CFunction fast_buffer_data_u8_;
|
|
104
|
+
static v8::CFunction fast_buffer_data_i8_;
|
|
105
|
+
static v8::CFunction fast_buffer_data_u16_;
|
|
106
|
+
static v8::CFunction fast_buffer_data_i16_;
|
|
107
|
+
static v8::CFunction fast_buffer_data_u32_;
|
|
108
|
+
static v8::CFunction fast_buffer_data_i32_;
|
|
109
|
+
static v8::CFunction fast_buffer_data_f32_;
|
|
110
|
+
static v8::CFunction fast_buffer_data_f64_;
|
|
111
|
+
static v8::CFunction fast_buffer_data_array_buffer_;
|
|
112
|
+
|
|
113
|
+
static v8::CFunction fast_buffer_sub_data_target_offset_;
|
|
114
|
+
|
|
115
|
+
static v8::CFunction fast_buffer_sub_data_u8_;
|
|
116
|
+
static v8::CFunction fast_buffer_sub_data_i8_;
|
|
117
|
+
|
|
118
|
+
static v8::CFunction fast_buffer_sub_data_u16_;
|
|
119
|
+
static v8::CFunction fast_buffer_sub_data_i16_;
|
|
120
|
+
|
|
121
|
+
static v8::CFunction fast_buffer_sub_data_u32_;
|
|
122
|
+
static v8::CFunction fast_buffer_sub_data_i32_;
|
|
123
|
+
|
|
124
|
+
static v8::CFunction fast_buffer_sub_data_f32_;
|
|
125
|
+
static v8::CFunction fast_buffer_sub_data_f64_;
|
|
126
|
+
|
|
127
|
+
static v8::CFunction fast_buffer_sub_data_array_buffer_;
|
|
128
|
+
|
|
129
|
+
static v8::CFunction fast_check_framebuffer_status_;
|
|
130
|
+
|
|
131
|
+
static v8::CFunction fast_draw_elements_;
|
|
132
|
+
|
|
133
|
+
static v8::CFunction fast_vertex_attrib_1f_;
|
|
134
|
+
|
|
135
|
+
static v8::CFunction fast_vertex_attrib_1fv_;
|
|
136
|
+
|
|
137
|
+
static v8::CFunction fast_vertex_attrib_2f_;
|
|
138
|
+
|
|
139
|
+
static v8::CFunction fast_vertex_attrib_2fv_;
|
|
140
|
+
|
|
141
|
+
static v8::CFunction fast_vertex_attrib_3f_;
|
|
142
|
+
|
|
143
|
+
static v8::CFunction fast_vertex_attrib_3fv_;
|
|
144
|
+
|
|
145
|
+
static v8::CFunction fast_vertex_attrib_4f_;
|
|
146
|
+
|
|
147
|
+
static v8::CFunction fast_vertex_attrib_4fv_;
|
|
148
|
+
|
|
149
|
+
|
|
77
150
|
static v8::CFunction fast_uniform1f_;
|
|
78
151
|
|
|
79
152
|
static v8::CFunction fast_uniform1i_;
|
|
@@ -90,6 +163,10 @@ public:
|
|
|
90
163
|
|
|
91
164
|
static v8::CFunction fast_uniform4i_;
|
|
92
165
|
|
|
166
|
+
static v8::CFunction fast_clear_depth_;
|
|
167
|
+
|
|
168
|
+
static v8::CFunction fast_clear_stencil_;
|
|
169
|
+
|
|
93
170
|
static v8::CFunction fast_clear_;
|
|
94
171
|
|
|
95
172
|
static v8::CFunction fast_clear_color_;
|
|
@@ -150,9 +227,24 @@ public:
|
|
|
150
227
|
|
|
151
228
|
static v8::CFunction fast_uniform_4iv_array_;
|
|
152
229
|
|
|
153
|
-
static v8::CFunction
|
|
230
|
+
static v8::CFunction fast_vertex_attrib_pointer_;
|
|
231
|
+
|
|
232
|
+
static v8::CFunction fast_validate_program_;
|
|
233
|
+
|
|
234
|
+
static v8::CFunction fast_delete_buffer_;
|
|
235
|
+
|
|
236
|
+
static v8::CFunction fast_delete_buffer_framebuffer_;
|
|
154
237
|
|
|
155
|
-
static v8::CFunction
|
|
238
|
+
static v8::CFunction fast_delete_program_;
|
|
239
|
+
static v8::CFunction fast_delete_renderbuffer_;
|
|
240
|
+
static v8::CFunction fast_delete_shader_;
|
|
241
|
+
static v8::CFunction fast_delete_texture_;
|
|
242
|
+
|
|
243
|
+
static v8::CFunction fast_disable_;
|
|
244
|
+
|
|
245
|
+
static v8::CFunction fast_compile_shader_;
|
|
246
|
+
|
|
247
|
+
static v8::CFunction fast_framebuffer_texture_2d_;
|
|
156
248
|
|
|
157
249
|
|
|
158
250
|
static v8::Local<v8::Object>
|
|
@@ -193,10 +285,41 @@ public:
|
|
|
193
285
|
|
|
194
286
|
static void __Resized(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
195
287
|
|
|
288
|
+
static void __FastResized(v8::Local<v8::Object> receiver_obj) {
|
|
289
|
+
WebGLRenderingContext *ptr = GetPointer(receiver_obj);
|
|
290
|
+
if (ptr == nullptr) {
|
|
291
|
+
return;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
canvas_native_webgl_resized(
|
|
295
|
+
ptr->GetState());
|
|
296
|
+
|
|
297
|
+
}
|
|
298
|
+
|
|
196
299
|
static void __StartRaf(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
197
300
|
|
|
301
|
+
static void __FastStartRaf(v8::Local<v8::Object> receiver_obj) {
|
|
302
|
+
WebGLRenderingContext *ptr = GetPointer(receiver_obj);
|
|
303
|
+
if (ptr == nullptr) {
|
|
304
|
+
return;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
ptr->StartRaf();
|
|
308
|
+
|
|
309
|
+
}
|
|
310
|
+
|
|
198
311
|
static void __StopRaf(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
199
312
|
|
|
313
|
+
static void __FastStopRaf(v8::Local<v8::Object> receiver_obj) {
|
|
314
|
+
WebGLRenderingContext *ptr = GetPointer(receiver_obj);
|
|
315
|
+
if (ptr == nullptr) {
|
|
316
|
+
return;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
ptr->StopRaf();
|
|
320
|
+
|
|
321
|
+
}
|
|
322
|
+
|
|
200
323
|
static void ActiveTexture(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
201
324
|
|
|
202
325
|
|
|
@@ -255,9 +378,34 @@ public:
|
|
|
255
378
|
|
|
256
379
|
static void BindAttribLocation(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
257
380
|
|
|
381
|
+
|
|
382
|
+
// todo with fast string
|
|
383
|
+
/*
|
|
384
|
+
static void FastBindAttribLocation(v8::Local<v8::Object> receiver_obj, v8::Local<v8::Object> program_obj, uint32_t index) {
|
|
385
|
+
WebGLRenderingContext *ptr = GetPointer(receiver_obj);
|
|
386
|
+
if (ptr == nullptr) {
|
|
387
|
+
return;
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
|
|
391
|
+
auto type = GetNativeType(program_obj);
|
|
392
|
+
if (type == NativeType::WebGLProgram) {
|
|
393
|
+
auto program = WebGLProgram::GetPointer(program_obj);
|
|
394
|
+
|
|
395
|
+
auto name = ConvertFromV8String(isolate, args[2]);
|
|
396
|
+
canvas_native_webgl_bind_attrib_location(
|
|
397
|
+
program->GetProgram(),
|
|
398
|
+
index,
|
|
399
|
+
name.c_str(),
|
|
400
|
+
ptr->GetState()
|
|
401
|
+
);
|
|
402
|
+
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
*/
|
|
258
406
|
static void BindBuffer(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
259
407
|
|
|
260
|
-
static void FastBindBuffer(v8::Local<v8::Object> receiver_obj,
|
|
408
|
+
static void FastBindBuffer(v8::Local<v8::Object> receiver_obj, uint32_t target,
|
|
261
409
|
v8::Local<v8::Object> buffer_obj) {
|
|
262
410
|
WebGLRenderingContext *ptr = GetPointer(receiver_obj);
|
|
263
411
|
if (ptr == nullptr) {
|
|
@@ -277,41 +425,630 @@ public:
|
|
|
277
425
|
}
|
|
278
426
|
}
|
|
279
427
|
|
|
280
|
-
static void
|
|
281
|
-
FastBindBufferNull(v8::Local<v8::Object> receiver_obj,
|
|
428
|
+
static void
|
|
429
|
+
FastBindBufferNull(v8::Local<v8::Object> receiver_obj, uint32_t target, int32_t buffer_obj) {
|
|
430
|
+
WebGLRenderingContext *ptr = GetPointer(receiver_obj);
|
|
431
|
+
if (ptr == nullptr) {
|
|
432
|
+
return;
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
canvas_native_webgl_bind_buffer(
|
|
436
|
+
target,
|
|
437
|
+
0,
|
|
438
|
+
ptr->GetState()
|
|
439
|
+
);
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
static void BindFramebuffer(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
443
|
+
|
|
444
|
+
static void FastBindFramebuffer(v8::Local<v8::Object> receiver_obj, uint32_t target,
|
|
445
|
+
v8::Local<v8::Object> buffer_obj) {
|
|
446
|
+
WebGLRenderingContext *ptr = GetPointer(receiver_obj);
|
|
447
|
+
if (ptr == nullptr) {
|
|
448
|
+
return;
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
auto type = GetNativeType(buffer_obj);
|
|
452
|
+
if (type == NativeType::WebGLFramebuffer) {
|
|
453
|
+
auto framebuffer = WebGLFramebuffer::GetPointer(buffer_obj);
|
|
454
|
+
canvas_native_webgl_bind_frame_buffer(
|
|
455
|
+
target,
|
|
456
|
+
framebuffer->GetFrameBuffer(),
|
|
457
|
+
ptr->GetState()
|
|
458
|
+
);
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
static void FastBindFramebufferNull(v8::Local<v8::Object> receiver_obj, uint32_t target,
|
|
463
|
+
int32_t buffer_obj) {
|
|
464
|
+
WebGLRenderingContext *ptr = GetPointer(receiver_obj);
|
|
465
|
+
if (ptr == nullptr) {
|
|
466
|
+
return;
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
// null value
|
|
470
|
+
// unbind
|
|
471
|
+
canvas_native_webgl_bind_frame_buffer(
|
|
472
|
+
target,
|
|
473
|
+
0,
|
|
474
|
+
ptr->GetState()
|
|
475
|
+
);
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
static void BindRenderbuffer(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
479
|
+
|
|
480
|
+
|
|
481
|
+
static void FastBindRenderbuffer(v8::Local<v8::Object> receiver_obj, uint32_t target,
|
|
482
|
+
v8::Local<v8::Object> buffer_obj) {
|
|
483
|
+
WebGLRenderingContext *ptr = GetPointer(receiver_obj);
|
|
484
|
+
if (ptr == nullptr) {
|
|
485
|
+
return;
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
|
|
489
|
+
auto type = GetNativeType(buffer_obj);
|
|
490
|
+
if (type == NativeType::WebGLRenderbuffer) {
|
|
491
|
+
auto renderbuffer = WebGLRenderbuffer::GetPointer(buffer_obj);
|
|
492
|
+
|
|
493
|
+
if (renderbuffer ==
|
|
494
|
+
nullptr) { return; }
|
|
495
|
+
canvas_native_webgl_bind_render_buffer(
|
|
496
|
+
target,
|
|
497
|
+
renderbuffer->GetRenderBuffer(),
|
|
498
|
+
ptr->GetState()
|
|
499
|
+
);
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
static void FastBindRenderbufferNull(v8::Local<v8::Object> receiver_obj, uint32_t target,
|
|
504
|
+
int32_t buffer_obj) {
|
|
505
|
+
WebGLRenderingContext *ptr = GetPointer(receiver_obj);
|
|
506
|
+
if (ptr == nullptr) {
|
|
507
|
+
return;
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
canvas_native_webgl_bind_render_buffer(
|
|
511
|
+
target,
|
|
512
|
+
0,
|
|
513
|
+
ptr->GetState()
|
|
514
|
+
);
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
static void BindTexture(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
518
|
+
|
|
519
|
+
static void FastBindTexture(v8::Local<v8::Object> receiver_obj, uint32_t target,
|
|
520
|
+
v8::Local<v8::Object> texture_obj) {
|
|
521
|
+
WebGLRenderingContext *ptr = GetPointer(receiver_obj);
|
|
522
|
+
if (ptr == nullptr) {
|
|
523
|
+
return;
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
auto type = GetNativeType(texture_obj);
|
|
527
|
+
if (type == NativeType::WebGLTexture) {
|
|
528
|
+
auto texture = WebGLTexture::GetPointer(texture_obj);
|
|
529
|
+
canvas_native_webgl_bind_texture(
|
|
530
|
+
target,
|
|
531
|
+
texture->GetTexture(),
|
|
532
|
+
ptr->GetState()
|
|
533
|
+
);
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
static void FastBindTextureNull(v8::Local<v8::Object> receiver_obj, uint32_t target,
|
|
538
|
+
int32_t texture_obj) {
|
|
539
|
+
WebGLRenderingContext *ptr = GetPointer(receiver_obj);
|
|
540
|
+
if (ptr == nullptr) {
|
|
541
|
+
return;
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
canvas_native_webgl_bind_texture(
|
|
545
|
+
target,
|
|
546
|
+
0,
|
|
547
|
+
ptr->GetState()
|
|
548
|
+
);
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
static void BlendColor(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
552
|
+
|
|
553
|
+
static void
|
|
554
|
+
FastBlendColor(v8::Local<v8::Object> receiver_obj, double red, double green, double blue,
|
|
555
|
+
double alpha) {
|
|
556
|
+
WebGLRenderingContext *ptr = GetPointer(receiver_obj);
|
|
557
|
+
if (ptr == nullptr) {
|
|
558
|
+
return;
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
canvas_native_webgl_blend_color(
|
|
562
|
+
static_cast<float>(red),
|
|
563
|
+
static_cast<float>(green),
|
|
564
|
+
static_cast<float>(blue),
|
|
565
|
+
static_cast<float>(alpha),
|
|
566
|
+
ptr->GetState()
|
|
567
|
+
);
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
static void BlendEquationSeparate(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
571
|
+
|
|
572
|
+
static void FastBlendEquationSeparate(v8::Local<v8::Object> receiver_obj, uint32_t modeRGB,
|
|
573
|
+
uint32_t modeAlpha) {
|
|
574
|
+
WebGLRenderingContext *ptr = GetPointer(receiver_obj);
|
|
575
|
+
if (ptr == nullptr) {
|
|
576
|
+
return;
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
canvas_native_webgl_blend_equation_separate(
|
|
580
|
+
modeRGB,
|
|
581
|
+
modeAlpha,
|
|
582
|
+
ptr->GetState()
|
|
583
|
+
);
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
static void BlendEquation(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
587
|
+
|
|
588
|
+
static void FastBlendEquation(v8::Local<v8::Object> receiver_obj, uint32_t mode) {
|
|
589
|
+
WebGLRenderingContext *ptr = GetPointer(receiver_obj);
|
|
590
|
+
if (ptr == nullptr) {
|
|
591
|
+
return;
|
|
592
|
+
}
|
|
593
|
+
canvas_native_webgl_blend_equation(
|
|
594
|
+
mode,
|
|
595
|
+
ptr->GetState()
|
|
596
|
+
);
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
static void BlendFuncSeparate(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
600
|
+
|
|
601
|
+
static void
|
|
602
|
+
FastBlendFuncSeparate(v8::Local<v8::Object> receiver_obj, uint32_t srcRGB, uint32_t dstRGB,
|
|
603
|
+
uint32_t srcAlpha, uint32_t dstAlpha) {
|
|
604
|
+
WebGLRenderingContext *ptr = GetPointer(receiver_obj);
|
|
605
|
+
if (ptr == nullptr) {
|
|
606
|
+
return;
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
canvas_native_webgl_blend_func_separate(
|
|
610
|
+
srcRGB,
|
|
611
|
+
dstRGB,
|
|
612
|
+
srcAlpha,
|
|
613
|
+
dstAlpha,
|
|
614
|
+
ptr->GetState()
|
|
615
|
+
);
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
static void BlendFunc(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
619
|
+
|
|
620
|
+
static void
|
|
621
|
+
FastBlendFunc(v8::Local<v8::Object> receiver_obj, uint32_t sfactor, uint32_t dfactor) {
|
|
622
|
+
WebGLRenderingContext *ptr = GetPointer(receiver_obj);
|
|
623
|
+
if (ptr == nullptr) {
|
|
624
|
+
return;
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
canvas_native_webgl_blend_func(
|
|
628
|
+
sfactor,
|
|
629
|
+
dfactor,
|
|
630
|
+
ptr->GetState()
|
|
631
|
+
);
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
static void BufferData(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
635
|
+
|
|
636
|
+
|
|
637
|
+
static void
|
|
638
|
+
FastBufferDataTargetUsage(v8::Local<v8::Object> receiver_obj, uint32_t target, uint32_t usage) {
|
|
639
|
+
WebGLRenderingContext *ptr = GetPointer(receiver_obj);
|
|
640
|
+
if (ptr == nullptr) {
|
|
641
|
+
return;
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
canvas_native_webgl_buffer_data_none(
|
|
645
|
+
target,
|
|
646
|
+
0,
|
|
647
|
+
usage,
|
|
648
|
+
ptr->GetState()
|
|
649
|
+
);
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
/*
|
|
653
|
+
*
|
|
654
|
+
static void FastBufferDataU8(v8::Local<v8::Object> receiver_obj, uint32_t target,
|
|
655
|
+
const v8::FastApiArrayBufferView &srcData, uint32_t usage) {
|
|
656
|
+
WebGLRenderingContext *ptr = GetPointer(receiver_obj);
|
|
657
|
+
if (ptr == nullptr) {
|
|
658
|
+
return;
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
|
|
662
|
+
canvas_native_webgl_buffer_data(
|
|
663
|
+
target,
|
|
664
|
+
(uint8_t *) srcData.data, srcData.byte_length,
|
|
665
|
+
usage,
|
|
666
|
+
ptr->GetState()
|
|
667
|
+
);
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
|
|
671
|
+
static void FastBufferDataI8(v8::Local<v8::Object> receiver_obj, uint32_t target,
|
|
672
|
+
const v8::FastApiArrayBufferView &srcData, uint32_t usage) {
|
|
673
|
+
WebGLRenderingContext *ptr = GetPointer(receiver_obj);
|
|
674
|
+
if (ptr == nullptr) {
|
|
675
|
+
return;
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
canvas_native_webgl_buffer_data_i8(
|
|
679
|
+
target,
|
|
680
|
+
(int8_t *)srcData.data, srcData.byte_length,
|
|
681
|
+
usage,
|
|
682
|
+
ptr->GetState()
|
|
683
|
+
);
|
|
684
|
+
}
|
|
685
|
+
|
|
686
|
+
static void FastBufferDataU16(v8::Local<v8::Object> receiver_obj, uint32_t target,
|
|
687
|
+
const v8::FastApiArrayBufferView &srcData, uint32_t usage) {
|
|
688
|
+
WebGLRenderingContext *ptr = GetPointer(receiver_obj);
|
|
689
|
+
if (ptr == nullptr) {
|
|
690
|
+
return;
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
canvas_native_webgl_buffer_data_u16(
|
|
694
|
+
target,
|
|
695
|
+
(uint16_t *)srcData.data, srcData.byte_length / sizeof(uint16_t),
|
|
696
|
+
usage,
|
|
697
|
+
ptr->GetState()
|
|
698
|
+
);
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
static void FastBufferDataI16(v8::Local<v8::Object> receiver_obj, uint32_t target,
|
|
702
|
+
const v8::FastApiArrayBufferView &srcData, uint32_t usage) {
|
|
703
|
+
WebGLRenderingContext *ptr = GetPointer(receiver_obj);
|
|
704
|
+
if (ptr == nullptr) {
|
|
705
|
+
return;
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
|
|
709
|
+
canvas_native_webgl_buffer_data_i16(
|
|
710
|
+
target,
|
|
711
|
+
(int16_t *)srcData.data, srcData.byte_length / sizeof(int16_t),
|
|
712
|
+
usage,
|
|
713
|
+
ptr->GetState()
|
|
714
|
+
);
|
|
715
|
+
}
|
|
716
|
+
|
|
717
|
+
*/
|
|
718
|
+
|
|
719
|
+
static void FastBufferDataF32(v8::Local<v8::Object> receiver_obj, uint32_t target,
|
|
720
|
+
const v8::FastApiTypedArray<float> &srcData, uint32_t usage) {
|
|
721
|
+
WebGLRenderingContext *ptr = GetPointer(receiver_obj);
|
|
722
|
+
if (ptr == nullptr) {
|
|
723
|
+
return;
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
auto size = srcData.length();
|
|
727
|
+
float *data;
|
|
728
|
+
srcData.getStorageIfAligned(&data);
|
|
729
|
+
|
|
730
|
+
|
|
731
|
+
canvas_native_webgl_buffer_data_f32(
|
|
732
|
+
target,
|
|
733
|
+
data, size,
|
|
734
|
+
usage,
|
|
735
|
+
ptr->GetState()
|
|
736
|
+
);
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
static void FastBufferDataF64(v8::Local<v8::Object> receiver_obj, uint32_t target,
|
|
740
|
+
const v8::FastApiTypedArray<double> &srcData, uint32_t usage) {
|
|
741
|
+
WebGLRenderingContext *ptr = GetPointer(receiver_obj);
|
|
742
|
+
if (ptr == nullptr) {
|
|
743
|
+
return;
|
|
744
|
+
}
|
|
745
|
+
|
|
746
|
+
auto size = srcData.length();
|
|
747
|
+
double *data;
|
|
748
|
+
srcData.getStorageIfAligned(&data);
|
|
749
|
+
|
|
750
|
+
|
|
751
|
+
canvas_native_webgl_buffer_data_f64(
|
|
752
|
+
target,
|
|
753
|
+
data, size,
|
|
754
|
+
usage,
|
|
755
|
+
ptr->GetState()
|
|
756
|
+
);
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
static void FastBufferDataU32(v8::Local<v8::Object> receiver_obj, uint32_t target,
|
|
760
|
+
const v8::FastApiTypedArray<uint32_t> &srcData, uint32_t usage) {
|
|
761
|
+
WebGLRenderingContext *ptr = GetPointer(receiver_obj);
|
|
762
|
+
if (ptr == nullptr) {
|
|
763
|
+
return;
|
|
764
|
+
}
|
|
765
|
+
|
|
766
|
+
auto size = srcData.length();
|
|
767
|
+
uint32_t *data;
|
|
768
|
+
srcData.getStorageIfAligned(&data);
|
|
769
|
+
|
|
770
|
+
|
|
771
|
+
canvas_native_webgl_buffer_data_u32(
|
|
772
|
+
target,
|
|
773
|
+
data, size,
|
|
774
|
+
usage,
|
|
775
|
+
ptr->GetState()
|
|
776
|
+
);
|
|
777
|
+
}
|
|
778
|
+
|
|
779
|
+
static void FastBufferDataI32(v8::Local<v8::Object> receiver_obj, uint32_t target,
|
|
780
|
+
const v8::FastApiTypedArray<int32_t> &srcData, uint32_t usage) {
|
|
781
|
+
WebGLRenderingContext *ptr = GetPointer(receiver_obj);
|
|
782
|
+
if (ptr == nullptr) {
|
|
783
|
+
return;
|
|
784
|
+
}
|
|
785
|
+
|
|
786
|
+
auto size = srcData.length();
|
|
787
|
+
int32_t *data;
|
|
788
|
+
srcData.getStorageIfAligned(&data);
|
|
789
|
+
|
|
790
|
+
|
|
791
|
+
canvas_native_webgl_buffer_data_i32(
|
|
792
|
+
target,
|
|
793
|
+
data, size,
|
|
794
|
+
usage,
|
|
795
|
+
ptr->GetState()
|
|
796
|
+
);
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
static void FastBufferDataArrayBuffer(v8::Local<v8::Object> receiver_obj, uint32_t target,
|
|
800
|
+
const v8::FastApiArrayBuffer &srcData, uint32_t usage) {
|
|
801
|
+
WebGLRenderingContext *ptr = GetPointer(receiver_obj);
|
|
802
|
+
if (ptr == nullptr) {
|
|
803
|
+
return;
|
|
804
|
+
}
|
|
805
|
+
|
|
806
|
+
|
|
807
|
+
canvas_native_webgl_buffer_data(
|
|
808
|
+
target,
|
|
809
|
+
(uint8_t *) srcData.data, srcData.byte_length,
|
|
810
|
+
usage,
|
|
811
|
+
ptr->GetState()
|
|
812
|
+
);
|
|
813
|
+
}
|
|
814
|
+
|
|
815
|
+
static void
|
|
816
|
+
FastBufferDataOS(v8::Local<v8::Object> receiver_obj, uint32_t target, uint32_t offset,
|
|
817
|
+
uint32_t usage) {
|
|
818
|
+
WebGLRenderingContext *ptr = GetPointer(receiver_obj);
|
|
819
|
+
if (ptr == nullptr) {
|
|
820
|
+
return;
|
|
821
|
+
}
|
|
822
|
+
|
|
823
|
+
|
|
824
|
+
canvas_native_webgl_buffer_data_none(
|
|
825
|
+
target,
|
|
826
|
+
static_cast<ssize_t>(offset),
|
|
827
|
+
usage,
|
|
828
|
+
ptr->GetState()
|
|
829
|
+
);
|
|
830
|
+
}
|
|
831
|
+
|
|
832
|
+
static void BufferSubData(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
833
|
+
|
|
834
|
+
static void FastBufferSubDataTargetOffset(v8::Local<v8::Object> receiver_obj, uint32_t target,
|
|
835
|
+
int32_t offset) {
|
|
836
|
+
WebGLRenderingContext *ptr = GetPointer(receiver_obj);
|
|
837
|
+
if (ptr == nullptr) {
|
|
838
|
+
return;
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
canvas_native_webgl_buffer_sub_data_none(
|
|
842
|
+
target,
|
|
843
|
+
static_cast<ssize_t>(offset),
|
|
844
|
+
ptr->GetState()
|
|
845
|
+
);
|
|
846
|
+
}
|
|
847
|
+
|
|
848
|
+
/*
|
|
849
|
+
static void
|
|
850
|
+
FastBufferSubDataU8(v8::Local<v8::Object> receiver_obj, uint32_t target, int32_t offset,
|
|
851
|
+
const v8::FastApiArrayBufferView &srcData) {
|
|
852
|
+
WebGLRenderingContext *ptr = GetPointer(receiver_obj);
|
|
853
|
+
if (ptr == nullptr) {
|
|
854
|
+
return;
|
|
855
|
+
}
|
|
856
|
+
|
|
857
|
+
|
|
858
|
+
canvas_native_webgl_buffer_sub_data(
|
|
859
|
+
target,
|
|
860
|
+
static_cast<ssize_t>(offset),
|
|
861
|
+
(uint8_t *) srcData.data, srcData.byte_length,
|
|
862
|
+
ptr->GetState()
|
|
863
|
+
);
|
|
864
|
+
}
|
|
865
|
+
|
|
866
|
+
|
|
867
|
+
static void
|
|
868
|
+
FastBufferSubDataI8(v8::Local<v8::Object> receiver_obj, uint32_t target, int32_t offset,
|
|
869
|
+
const v8::FastApiArrayBufferView &srcData) {
|
|
870
|
+
WebGLRenderingContext *ptr = GetPointer(receiver_obj);
|
|
871
|
+
if (ptr == nullptr) {
|
|
872
|
+
return;
|
|
873
|
+
}
|
|
874
|
+
|
|
875
|
+
auto size = srcData.length();
|
|
876
|
+
int8_t *data;
|
|
877
|
+
srcData.getStorageIfAligned(&data);
|
|
878
|
+
|
|
879
|
+
|
|
880
|
+
canvas_native_webgl_buffer_sub_data_i8(
|
|
881
|
+
target,
|
|
882
|
+
static_cast<ssize_t>(offset),
|
|
883
|
+
data, size,
|
|
884
|
+
ptr->GetState()
|
|
885
|
+
);
|
|
886
|
+
}
|
|
887
|
+
|
|
888
|
+
|
|
889
|
+
static void
|
|
890
|
+
FastBufferSubDataU16(v8::Local<v8::Object> receiver_obj, uint32_t target, int32_t offset,
|
|
891
|
+
const v8::FastApiArrayBufferView &srcData) {
|
|
892
|
+
WebGLRenderingContext *ptr = GetPointer(receiver_obj);
|
|
893
|
+
if (ptr == nullptr) {
|
|
894
|
+
return;
|
|
895
|
+
}
|
|
896
|
+
|
|
897
|
+
auto size = srcData.length();
|
|
898
|
+
uint16_t *data;
|
|
899
|
+
srcData.getStorageIfAligned(&data);
|
|
900
|
+
|
|
901
|
+
|
|
902
|
+
canvas_native_webgl_buffer_sub_data_u16(
|
|
903
|
+
target,
|
|
904
|
+
static_cast<ssize_t>(offset),
|
|
905
|
+
data, size,
|
|
906
|
+
ptr->GetState()
|
|
907
|
+
);
|
|
908
|
+
}
|
|
909
|
+
|
|
910
|
+
|
|
911
|
+
static void
|
|
912
|
+
FastBufferSubDataI16(v8::Local<v8::Object> receiver_obj, uint32_t target, int32_t offset,
|
|
913
|
+
const v8::FastApiArrayBufferView&srcData) {
|
|
914
|
+
WebGLRenderingContext *ptr = GetPointer(receiver_obj);
|
|
915
|
+
if (ptr == nullptr) {
|
|
916
|
+
return;
|
|
917
|
+
}
|
|
918
|
+
|
|
919
|
+
auto size = srcData.length();
|
|
920
|
+
int16_t *data;
|
|
921
|
+
srcData.getStorageIfAligned(&data);
|
|
922
|
+
|
|
923
|
+
|
|
924
|
+
canvas_native_webgl_buffer_sub_data_i16(
|
|
925
|
+
target,
|
|
926
|
+
static_cast<ssize_t>(offset),
|
|
927
|
+
data, size,
|
|
928
|
+
ptr->GetState()
|
|
929
|
+
);
|
|
930
|
+
}
|
|
931
|
+
|
|
932
|
+
|
|
933
|
+
*/
|
|
934
|
+
static void
|
|
935
|
+
FastBufferSubDataU32(v8::Local<v8::Object> receiver_obj, uint32_t target, int32_t offset,
|
|
936
|
+
const v8::FastApiTypedArray<uint32_t> &srcData) {
|
|
937
|
+
WebGLRenderingContext *ptr = GetPointer(receiver_obj);
|
|
938
|
+
if (ptr == nullptr) {
|
|
939
|
+
return;
|
|
940
|
+
}
|
|
941
|
+
|
|
942
|
+
auto size = srcData.length();
|
|
943
|
+
uint32_t *data;
|
|
944
|
+
srcData.getStorageIfAligned(&data);
|
|
945
|
+
|
|
946
|
+
|
|
947
|
+
canvas_native_webgl_buffer_sub_data_u32(
|
|
948
|
+
target,
|
|
949
|
+
static_cast<ssize_t>(offset),
|
|
950
|
+
data, size,
|
|
951
|
+
ptr->GetState()
|
|
952
|
+
);
|
|
953
|
+
}
|
|
954
|
+
|
|
955
|
+
|
|
956
|
+
static void
|
|
957
|
+
FastBufferSubDataI32(v8::Local<v8::Object> receiver_obj, uint32_t target, int32_t offset,
|
|
958
|
+
const v8::FastApiTypedArray<int32_t> &srcData) {
|
|
959
|
+
WebGLRenderingContext *ptr = GetPointer(receiver_obj);
|
|
960
|
+
if (ptr == nullptr) {
|
|
961
|
+
return;
|
|
962
|
+
}
|
|
963
|
+
|
|
964
|
+
auto size = srcData.length();
|
|
965
|
+
int32_t *data;
|
|
966
|
+
srcData.getStorageIfAligned(&data);
|
|
967
|
+
|
|
968
|
+
|
|
969
|
+
canvas_native_webgl_buffer_sub_data_i32(
|
|
970
|
+
target,
|
|
971
|
+
static_cast<ssize_t>(offset),
|
|
972
|
+
data, size,
|
|
973
|
+
ptr->GetState()
|
|
974
|
+
);
|
|
975
|
+
}
|
|
976
|
+
|
|
977
|
+
|
|
978
|
+
static void
|
|
979
|
+
FastBufferSubDataF32(v8::Local<v8::Object> receiver_obj, uint32_t target, int32_t offset,
|
|
980
|
+
const v8::FastApiTypedArray<float> &srcData) {
|
|
981
|
+
WebGLRenderingContext *ptr = GetPointer(receiver_obj);
|
|
982
|
+
if (ptr == nullptr) {
|
|
983
|
+
return;
|
|
984
|
+
}
|
|
985
|
+
|
|
986
|
+
auto size = srcData.length();
|
|
987
|
+
float *data;
|
|
988
|
+
srcData.getStorageIfAligned(&data);
|
|
989
|
+
|
|
990
|
+
|
|
991
|
+
canvas_native_webgl_buffer_sub_data_f32(
|
|
992
|
+
target,
|
|
993
|
+
static_cast<ssize_t>(offset),
|
|
994
|
+
data, size,
|
|
995
|
+
ptr->GetState()
|
|
996
|
+
);
|
|
997
|
+
}
|
|
998
|
+
|
|
999
|
+
|
|
1000
|
+
static void
|
|
1001
|
+
FastBufferSubDataF64(v8::Local<v8::Object> receiver_obj, uint32_t target, int32_t offset,
|
|
1002
|
+
const v8::FastApiTypedArray<double> &srcData) {
|
|
1003
|
+
WebGLRenderingContext *ptr = GetPointer(receiver_obj);
|
|
1004
|
+
if (ptr == nullptr) {
|
|
1005
|
+
return;
|
|
1006
|
+
}
|
|
1007
|
+
|
|
1008
|
+
auto size = srcData.length();
|
|
1009
|
+
double *data;
|
|
1010
|
+
srcData.getStorageIfAligned(&data);
|
|
1011
|
+
|
|
1012
|
+
|
|
1013
|
+
canvas_native_webgl_buffer_sub_data_f64(
|
|
1014
|
+
target,
|
|
1015
|
+
static_cast<ssize_t>(offset),
|
|
1016
|
+
data, size,
|
|
1017
|
+
ptr->GetState()
|
|
1018
|
+
);
|
|
1019
|
+
}
|
|
1020
|
+
|
|
1021
|
+
|
|
1022
|
+
static void FastBufferSubDataArrayBuffer(v8::Local<v8::Object> receiver_obj, uint32_t target,
|
|
1023
|
+
int32_t offset,
|
|
1024
|
+
const v8::FastApiArrayBuffer &srcData) {
|
|
282
1025
|
WebGLRenderingContext *ptr = GetPointer(receiver_obj);
|
|
283
1026
|
if (ptr == nullptr) {
|
|
284
1027
|
return;
|
|
285
1028
|
}
|
|
286
1029
|
|
|
287
|
-
|
|
1030
|
+
canvas_native_webgl_buffer_sub_data(
|
|
288
1031
|
target,
|
|
289
|
-
|
|
1032
|
+
static_cast<intptr_t>(offset),
|
|
1033
|
+
(uint8_t *) srcData.data, srcData.byte_length,
|
|
290
1034
|
ptr->GetState()
|
|
291
1035
|
);
|
|
292
1036
|
}
|
|
293
1037
|
|
|
294
|
-
static void
|
|
295
|
-
|
|
296
|
-
static void BindRenderbuffer(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
297
|
-
|
|
298
|
-
static void BindTexture(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
299
|
-
|
|
300
|
-
static void BlendColor(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
301
|
-
|
|
302
|
-
static void BlendEquationSeparate(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
303
|
-
|
|
304
|
-
static void BlendEquation(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
305
|
-
|
|
306
|
-
static void BlendFuncSeparate(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
307
|
-
|
|
308
|
-
static void BlendFunc(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
309
|
-
|
|
310
|
-
static void BufferData(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
1038
|
+
static void CheckFramebufferStatus(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
311
1039
|
|
|
312
|
-
static
|
|
1040
|
+
static uint32_t
|
|
1041
|
+
FastCheckFramebufferStatus(v8::Local<v8::Object> receiver_obj, uint32_t target) {
|
|
1042
|
+
WebGLRenderingContext *ptr = GetPointer(receiver_obj);
|
|
1043
|
+
if (ptr == nullptr) {
|
|
1044
|
+
return 0;
|
|
1045
|
+
}
|
|
313
1046
|
|
|
314
|
-
|
|
1047
|
+
return canvas_native_webgl_check_frame_buffer_status(
|
|
1048
|
+
target,
|
|
1049
|
+
ptr->GetState()
|
|
1050
|
+
);
|
|
1051
|
+
}
|
|
315
1052
|
|
|
316
1053
|
static void ClearColor(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
317
1054
|
|
|
@@ -341,8 +1078,32 @@ public:
|
|
|
341
1078
|
|
|
342
1079
|
static void ClearDepth(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
343
1080
|
|
|
1081
|
+
static void FastClearDepth(v8::Local<v8::Object> receiver_obj, double depth) {
|
|
1082
|
+
WebGLRenderingContext *ptr = GetPointer(receiver_obj);
|
|
1083
|
+
if (ptr == nullptr) {
|
|
1084
|
+
return;
|
|
1085
|
+
}
|
|
1086
|
+
|
|
1087
|
+
canvas_native_webgl_clear_depth(
|
|
1088
|
+
static_cast<float>(depth),
|
|
1089
|
+
ptr->GetState()
|
|
1090
|
+
);
|
|
1091
|
+
}
|
|
1092
|
+
|
|
344
1093
|
static void ClearStencil(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
345
1094
|
|
|
1095
|
+
static void FastClearStencil(v8::Local<v8::Object> receiver_obj, int32_t stencil) {
|
|
1096
|
+
WebGLRenderingContext *ptr = GetPointer(receiver_obj);
|
|
1097
|
+
if (ptr == nullptr) {
|
|
1098
|
+
return;
|
|
1099
|
+
}
|
|
1100
|
+
|
|
1101
|
+
canvas_native_webgl_clear_stencil(
|
|
1102
|
+
stencil,
|
|
1103
|
+
ptr->GetState()
|
|
1104
|
+
);
|
|
1105
|
+
}
|
|
1106
|
+
|
|
346
1107
|
static void Clear(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
347
1108
|
|
|
348
1109
|
static void ClearImpl(WebGLRenderingContext *ptr, uint32_t mask) {
|
|
@@ -367,13 +1128,31 @@ public:
|
|
|
367
1128
|
);
|
|
368
1129
|
}
|
|
369
1130
|
|
|
370
|
-
|
|
371
1131
|
static void ColorMask(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
372
1132
|
|
|
373
1133
|
static void Commit(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
374
1134
|
|
|
375
1135
|
static void CompileShader(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
376
1136
|
|
|
1137
|
+
static void
|
|
1138
|
+
FastCompileShader(v8::Local<v8::Object> receiver_obj, v8::Local<v8::Object> shader_obj) {
|
|
1139
|
+
WebGLRenderingContext *ptr = GetPointer(receiver_obj);
|
|
1140
|
+
if (ptr == nullptr) {
|
|
1141
|
+
return;
|
|
1142
|
+
}
|
|
1143
|
+
|
|
1144
|
+
if (GetNativeType(shader_obj) == NativeType::WebGLShader) {
|
|
1145
|
+
auto shader = WebGLShader::GetPointer(shader_obj);
|
|
1146
|
+
if (shader != nullptr) {
|
|
1147
|
+
canvas_native_webgl_compile_shader(
|
|
1148
|
+
shader->GetShader(),
|
|
1149
|
+
ptr->GetState()
|
|
1150
|
+
);
|
|
1151
|
+
}
|
|
1152
|
+
}
|
|
1153
|
+
|
|
1154
|
+
}
|
|
1155
|
+
|
|
377
1156
|
static void CompressedTexImage2D(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
378
1157
|
|
|
379
1158
|
static void CompressedTexSubImage2D(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
@@ -398,16 +1177,139 @@ public:
|
|
|
398
1177
|
|
|
399
1178
|
static void DeleteBuffer(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
400
1179
|
|
|
1180
|
+
static void FastDeleteBuffer(v8::Local<v8::Object> receiver_obj, v8::Local<v8::Object> value) {
|
|
1181
|
+
WebGLRenderingContext *ptr = GetPointer(receiver_obj);
|
|
1182
|
+
if (ptr == nullptr) {
|
|
1183
|
+
return;
|
|
1184
|
+
}
|
|
1185
|
+
|
|
1186
|
+
|
|
1187
|
+
auto type = GetNativeType(value);
|
|
1188
|
+
if (type == NativeType::WebGLBuffer) {
|
|
1189
|
+
auto buffer = WebGLBuffer::GetPointer(value);
|
|
1190
|
+
if (buffer != nullptr) {
|
|
1191
|
+
canvas_native_webgl_delete_buffer(
|
|
1192
|
+
buffer->GetBuffer(),
|
|
1193
|
+
ptr->GetState()
|
|
1194
|
+
);
|
|
1195
|
+
}
|
|
1196
|
+
}
|
|
1197
|
+
|
|
1198
|
+
}
|
|
1199
|
+
|
|
401
1200
|
static void DeleteFramebuffer(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
402
1201
|
|
|
1202
|
+
static void
|
|
1203
|
+
FastDeleteFramebuffer(v8::Local<v8::Object> receiver_obj, v8::Local<v8::Object> value) {
|
|
1204
|
+
WebGLRenderingContext *ptr = GetPointer(receiver_obj);
|
|
1205
|
+
if (ptr == nullptr) {
|
|
1206
|
+
return;
|
|
1207
|
+
}
|
|
1208
|
+
|
|
1209
|
+
auto type = GetNativeType(value);
|
|
1210
|
+
if (type == NativeType::WebGLFramebuffer) {
|
|
1211
|
+
auto buffer = WebGLFramebuffer::GetPointer(value);
|
|
1212
|
+
if (buffer != nullptr) {
|
|
1213
|
+
canvas_native_webgl_delete_framebuffer(
|
|
1214
|
+
buffer->GetFrameBuffer(),
|
|
1215
|
+
ptr->GetState()
|
|
1216
|
+
);
|
|
1217
|
+
}
|
|
1218
|
+
}
|
|
1219
|
+
|
|
1220
|
+
}
|
|
1221
|
+
|
|
403
1222
|
static void DeleteProgram(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
404
1223
|
|
|
1224
|
+
static void FastDeleteProgram(v8::Local<v8::Object> receiver_obj, v8::Local<v8::Object> value) {
|
|
1225
|
+
WebGLRenderingContext *ptr = GetPointer(receiver_obj);
|
|
1226
|
+
if (ptr == nullptr) {
|
|
1227
|
+
return;
|
|
1228
|
+
}
|
|
1229
|
+
|
|
1230
|
+
auto type = GetNativeType(value);
|
|
1231
|
+
|
|
1232
|
+
if (type == NativeType::WebGLProgram) {
|
|
1233
|
+
auto program = WebGLProgram::GetPointer(value);
|
|
1234
|
+
if (program != nullptr) {
|
|
1235
|
+
canvas_native_webgl_delete_framebuffer(
|
|
1236
|
+
program->GetProgram(),
|
|
1237
|
+
ptr->GetState()
|
|
1238
|
+
);
|
|
1239
|
+
}
|
|
1240
|
+
}
|
|
1241
|
+
|
|
1242
|
+
|
|
1243
|
+
}
|
|
1244
|
+
|
|
405
1245
|
static void DeleteRenderbuffer(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
406
1246
|
|
|
1247
|
+
static void
|
|
1248
|
+
FastDeleteRenderbuffer(v8::Local<v8::Object> receiver_obj, v8::Local<v8::Object> value) {
|
|
1249
|
+
WebGLRenderingContext *ptr = GetPointer(receiver_obj);
|
|
1250
|
+
if (ptr == nullptr) {
|
|
1251
|
+
return;
|
|
1252
|
+
}
|
|
1253
|
+
|
|
1254
|
+
|
|
1255
|
+
auto type = GetNativeType(value);
|
|
1256
|
+
|
|
1257
|
+
if (type == NativeType::WebGLRenderbuffer) {
|
|
1258
|
+
auto buffer = WebGLRenderbuffer::GetPointer(value);
|
|
1259
|
+
if (buffer != nullptr) {
|
|
1260
|
+
canvas_native_webgl_delete_renderbuffer(
|
|
1261
|
+
buffer->GetRenderBuffer(),
|
|
1262
|
+
ptr->GetState()
|
|
1263
|
+
);
|
|
1264
|
+
}
|
|
1265
|
+
}
|
|
1266
|
+
|
|
1267
|
+
|
|
1268
|
+
}
|
|
1269
|
+
|
|
407
1270
|
static void DeleteShader(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
408
1271
|
|
|
1272
|
+
static void FastDeleteShader(v8::Local<v8::Object> receiver_obj, v8::Local<v8::Object> value) {
|
|
1273
|
+
WebGLRenderingContext *ptr = GetPointer(receiver_obj);
|
|
1274
|
+
if (ptr == nullptr) {
|
|
1275
|
+
return;
|
|
1276
|
+
}
|
|
1277
|
+
|
|
1278
|
+
|
|
1279
|
+
auto type = GetNativeType(value);
|
|
1280
|
+
|
|
1281
|
+
if (type == NativeType::WebGLShader) {
|
|
1282
|
+
auto shader = WebGLShader::GetPointer(value);
|
|
1283
|
+
if (shader != nullptr) {
|
|
1284
|
+
canvas_native_webgl_delete_shader(
|
|
1285
|
+
shader->GetShader(),
|
|
1286
|
+
ptr->GetState()
|
|
1287
|
+
);
|
|
1288
|
+
}
|
|
1289
|
+
}
|
|
1290
|
+
}
|
|
1291
|
+
|
|
409
1292
|
static void DeleteTexture(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
410
1293
|
|
|
1294
|
+
static void FastDeleteTexture(v8::Local<v8::Object> receiver_obj, v8::Local<v8::Object> value) {
|
|
1295
|
+
WebGLRenderingContext *ptr = GetPointer(receiver_obj);
|
|
1296
|
+
if (ptr == nullptr) {
|
|
1297
|
+
return;
|
|
1298
|
+
}
|
|
1299
|
+
|
|
1300
|
+
auto type = GetNativeType(value);
|
|
1301
|
+
|
|
1302
|
+
if (type == NativeType::WebGLTexture) {
|
|
1303
|
+
auto texture = WebGLTexture::GetPointer(value);
|
|
1304
|
+
if (texture != nullptr) {
|
|
1305
|
+
canvas_native_webgl_delete_texture(
|
|
1306
|
+
texture->GetTexture(),
|
|
1307
|
+
ptr->GetState()
|
|
1308
|
+
);
|
|
1309
|
+
}
|
|
1310
|
+
}
|
|
1311
|
+
}
|
|
1312
|
+
|
|
411
1313
|
static void DepthFunc(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
412
1314
|
|
|
413
1315
|
static void DepthMask(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
@@ -420,6 +1322,18 @@ public:
|
|
|
420
1322
|
|
|
421
1323
|
static void Disable(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
422
1324
|
|
|
1325
|
+
static void FastDisable(v8::Local<v8::Object> receiver_obj, uint32_t cap) {
|
|
1326
|
+
WebGLRenderingContext *ptr = GetPointer(receiver_obj);
|
|
1327
|
+
if (ptr == nullptr) {
|
|
1328
|
+
return;
|
|
1329
|
+
}
|
|
1330
|
+
|
|
1331
|
+
canvas_native_webgl_disable(
|
|
1332
|
+
cap,
|
|
1333
|
+
ptr->GetState()
|
|
1334
|
+
);
|
|
1335
|
+
}
|
|
1336
|
+
|
|
423
1337
|
static void DrawArrays(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
424
1338
|
|
|
425
1339
|
static void
|
|
@@ -451,6 +1365,26 @@ public:
|
|
|
451
1365
|
|
|
452
1366
|
static void DrawElements(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
453
1367
|
|
|
1368
|
+
|
|
1369
|
+
static void
|
|
1370
|
+
FastDrawElements(v8::Local<v8::Object> receiver_obj, uint32_t mode, int32_t count, int32_t type,
|
|
1371
|
+
int32_t offset) {
|
|
1372
|
+
WebGLRenderingContext *ptr = GetPointer(receiver_obj);
|
|
1373
|
+
if (ptr == nullptr) {
|
|
1374
|
+
return;
|
|
1375
|
+
}
|
|
1376
|
+
|
|
1377
|
+
|
|
1378
|
+
canvas_native_webgl_draw_elements(
|
|
1379
|
+
mode,
|
|
1380
|
+
count,
|
|
1381
|
+
type,
|
|
1382
|
+
static_cast<ssize_t>(offset),
|
|
1383
|
+
ptr->GetState()
|
|
1384
|
+
);
|
|
1385
|
+
ptr->UpdateInvalidateState();
|
|
1386
|
+
}
|
|
1387
|
+
|
|
454
1388
|
static void EnableVertexAttribArray(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
455
1389
|
|
|
456
1390
|
static void FastEnableVertexAttribArray(v8::Local<v8::Object> receiver_obj, uint32_t index) {
|
|
@@ -494,6 +1428,30 @@ public:
|
|
|
494
1428
|
|
|
495
1429
|
static void FramebufferTexture2D(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
496
1430
|
|
|
1431
|
+
static void FastFramebufferTexture2D(v8::Local<v8::Object> receiver_obj, uint32_t target,
|
|
1432
|
+
uint32_t attachment, uint32_t textarget, int32_t level,
|
|
1433
|
+
v8::Local<v8::Object> texture_obj) {
|
|
1434
|
+
WebGLRenderingContext *ptr = GetPointer(receiver_obj);
|
|
1435
|
+
if (ptr == nullptr) {
|
|
1436
|
+
return;
|
|
1437
|
+
}
|
|
1438
|
+
|
|
1439
|
+
auto type = GetNativeType(texture_obj);
|
|
1440
|
+
if (type == NativeType::WebGLTexture) {
|
|
1441
|
+
auto texture = WebGLTexture::GetPointer(texture_obj);
|
|
1442
|
+
if (texture != nullptr) {
|
|
1443
|
+
canvas_native_webgl_framebuffer_texture2d(
|
|
1444
|
+
target,
|
|
1445
|
+
attachment,
|
|
1446
|
+
textarget,
|
|
1447
|
+
texture->GetTexture(),
|
|
1448
|
+
level,
|
|
1449
|
+
ptr->GetState()
|
|
1450
|
+
);
|
|
1451
|
+
}
|
|
1452
|
+
}
|
|
1453
|
+
}
|
|
1454
|
+
|
|
497
1455
|
static void FrontFace(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
498
1456
|
|
|
499
1457
|
static void GenerateMipmap(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
@@ -1467,22 +2425,164 @@ public:
|
|
|
1467
2425
|
|
|
1468
2426
|
static void ValidateProgram(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
1469
2427
|
|
|
2428
|
+
static void
|
|
2429
|
+
FastValidateProgram(v8::Local<v8::Object> receiver_obj, v8::Local<v8::Object> program_obj) {
|
|
2430
|
+
WebGLRenderingContext *ptr = GetPointer(receiver_obj);
|
|
2431
|
+
if (ptr == nullptr) {
|
|
2432
|
+
return;
|
|
2433
|
+
}
|
|
2434
|
+
|
|
2435
|
+
|
|
2436
|
+
auto type = GetNativeType(program_obj);
|
|
2437
|
+
if (type == NativeType::WebGLProgram) {
|
|
2438
|
+
auto program = WebGLProgram::GetPointer(program_obj);
|
|
2439
|
+
if (program != nullptr) {
|
|
2440
|
+
canvas_native_webgl_validate_program(
|
|
2441
|
+
program->GetProgram(),
|
|
2442
|
+
ptr->GetState()
|
|
2443
|
+
);
|
|
2444
|
+
}
|
|
2445
|
+
}
|
|
2446
|
+
|
|
2447
|
+
}
|
|
2448
|
+
|
|
1470
2449
|
static void VertexAttrib1f(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
1471
2450
|
|
|
2451
|
+
static void FastVertexAttrib1f(v8::Local<v8::Object> receiver_obj, uint32_t index, float v0) {
|
|
2452
|
+
WebGLRenderingContext *ptr = GetPointer(receiver_obj);
|
|
2453
|
+
if (ptr == nullptr) {
|
|
2454
|
+
return;
|
|
2455
|
+
}
|
|
2456
|
+
|
|
2457
|
+
canvas_native_webgl_vertex_attrib1f(
|
|
2458
|
+
index, v0, ptr->GetState());
|
|
2459
|
+
|
|
2460
|
+
}
|
|
2461
|
+
|
|
1472
2462
|
static void VertexAttrib1fv(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
1473
2463
|
|
|
2464
|
+
static void FastVertexAttrib1fv(v8::Local<v8::Object> receiver_obj, uint32_t index,
|
|
2465
|
+
const v8::FastApiTypedArray<float> &value) {
|
|
2466
|
+
WebGLRenderingContext *ptr = GetPointer(receiver_obj);
|
|
2467
|
+
if (ptr == nullptr) {
|
|
2468
|
+
return;
|
|
2469
|
+
}
|
|
2470
|
+
|
|
2471
|
+
|
|
2472
|
+
auto size = value.length();
|
|
2473
|
+
float *data;
|
|
2474
|
+
value.getStorageIfAligned(&data);
|
|
2475
|
+
|
|
2476
|
+
|
|
2477
|
+
canvas_native_webgl_vertex_attrib1fv(
|
|
2478
|
+
index, data, size,
|
|
2479
|
+
ptr->GetState());
|
|
2480
|
+
}
|
|
2481
|
+
|
|
1474
2482
|
static void VertexAttrib2f(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
1475
2483
|
|
|
2484
|
+
static void
|
|
2485
|
+
FastVertexAttrib2f(v8::Local<v8::Object> receiver_obj, uint32_t index, float v0, float v1) {
|
|
2486
|
+
WebGLRenderingContext *ptr = GetPointer(receiver_obj);
|
|
2487
|
+
if (ptr == nullptr) {
|
|
2488
|
+
return;
|
|
2489
|
+
}
|
|
2490
|
+
|
|
2491
|
+
canvas_native_webgl_vertex_attrib2f(
|
|
2492
|
+
index, v0, v1, ptr->GetState());
|
|
2493
|
+
|
|
2494
|
+
}
|
|
2495
|
+
|
|
1476
2496
|
static void VertexAttrib2fv(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
1477
2497
|
|
|
2498
|
+
static void FastVertexAttrib2fv(v8::Local<v8::Object> receiver_obj, uint32_t index,
|
|
2499
|
+
const v8::FastApiTypedArray<float> &value) {
|
|
2500
|
+
WebGLRenderingContext *ptr = GetPointer(receiver_obj);
|
|
2501
|
+
if (ptr == nullptr) {
|
|
2502
|
+
return;
|
|
2503
|
+
}
|
|
2504
|
+
|
|
2505
|
+
|
|
2506
|
+
auto size = value.length();
|
|
2507
|
+
float *data;
|
|
2508
|
+
value.getStorageIfAligned(&data);
|
|
2509
|
+
|
|
2510
|
+
|
|
2511
|
+
canvas_native_webgl_vertex_attrib2fv(
|
|
2512
|
+
index, data, size,
|
|
2513
|
+
ptr->GetState());
|
|
2514
|
+
}
|
|
2515
|
+
|
|
1478
2516
|
static void VertexAttrib3f(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
1479
2517
|
|
|
2518
|
+
static void
|
|
2519
|
+
FastVertexAttrib3f(v8::Local<v8::Object> receiver_obj, uint32_t index, float v0, float v1,
|
|
2520
|
+
float v2) {
|
|
2521
|
+
WebGLRenderingContext *ptr = GetPointer(receiver_obj);
|
|
2522
|
+
if (ptr == nullptr) {
|
|
2523
|
+
return;
|
|
2524
|
+
}
|
|
2525
|
+
|
|
2526
|
+
canvas_native_webgl_vertex_attrib3f(
|
|
2527
|
+
index, v0, v1, v2, ptr->GetState());
|
|
2528
|
+
|
|
2529
|
+
}
|
|
2530
|
+
|
|
1480
2531
|
static void VertexAttrib3fv(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
1481
2532
|
|
|
2533
|
+
static void FastVertexAttrib3fv(v8::Local<v8::Object> receiver_obj, uint32_t index,
|
|
2534
|
+
const v8::FastApiTypedArray<float> &value) {
|
|
2535
|
+
WebGLRenderingContext *ptr = GetPointer(receiver_obj);
|
|
2536
|
+
if (ptr == nullptr) {
|
|
2537
|
+
return;
|
|
2538
|
+
}
|
|
2539
|
+
|
|
2540
|
+
|
|
2541
|
+
auto size = value.length();
|
|
2542
|
+
float *data;
|
|
2543
|
+
value.getStorageIfAligned(&data);
|
|
2544
|
+
|
|
2545
|
+
|
|
2546
|
+
canvas_native_webgl_vertex_attrib3fv(
|
|
2547
|
+
index, data, size,
|
|
2548
|
+
ptr->GetState());
|
|
2549
|
+
}
|
|
2550
|
+
|
|
1482
2551
|
static void VertexAttrib4f(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
1483
2552
|
|
|
2553
|
+
static void
|
|
2554
|
+
FastVertexAttrib4f(v8::Local<v8::Object> receiver_obj, uint32_t index, float v0, float v1,
|
|
2555
|
+
float v2, float v3) {
|
|
2556
|
+
WebGLRenderingContext *ptr = GetPointer(receiver_obj);
|
|
2557
|
+
if (ptr == nullptr) {
|
|
2558
|
+
return;
|
|
2559
|
+
}
|
|
2560
|
+
|
|
2561
|
+
canvas_native_webgl_vertex_attrib4f(
|
|
2562
|
+
index, v0, v1, v2, v3, ptr->GetState());
|
|
2563
|
+
|
|
2564
|
+
}
|
|
2565
|
+
|
|
1484
2566
|
static void VertexAttrib4fv(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
1485
2567
|
|
|
2568
|
+
static void FastVertexAttrib4fv(v8::Local<v8::Object> receiver_obj, uint32_t index,
|
|
2569
|
+
const v8::FastApiTypedArray<float> &value) {
|
|
2570
|
+
WebGLRenderingContext *ptr = GetPointer(receiver_obj);
|
|
2571
|
+
if (ptr == nullptr) {
|
|
2572
|
+
return;
|
|
2573
|
+
}
|
|
2574
|
+
|
|
2575
|
+
|
|
2576
|
+
auto size = value.length();
|
|
2577
|
+
float *data;
|
|
2578
|
+
value.getStorageIfAligned(&data);
|
|
2579
|
+
|
|
2580
|
+
|
|
2581
|
+
canvas_native_webgl_vertex_attrib4fv(
|
|
2582
|
+
index, data, size,
|
|
2583
|
+
ptr->GetState());
|
|
2584
|
+
}
|
|
2585
|
+
|
|
1486
2586
|
static void VertexAttribPointer(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
1487
2587
|
|
|
1488
2588
|
static void
|