@nativescript/canvas 2.0.0-alpha.49 → 2.0.0-alpha.50
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/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/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/dSYMs/CanvasNative.framework.dSYM/Contents/Resources/DWARF/CanvasNative +0 -0
- package/platforms/ios/src/cpp/webgl/WebGLRenderingContext.cpp +219 -166
- package/platforms/ios/src/cpp/webgl/WebGLRenderingContext.h +713 -1
- package/platforms/ios/src/cpp/webgl2/WebGL2RenderingContext.cpp +371 -217
- package/platforms/ios/src/cpp/webgl2/WebGL2RenderingContext.h +1270 -4
|
@@ -28,7 +28,60 @@ public:
|
|
|
28
28
|
|
|
29
29
|
WebGL2RenderingContext(WebGLState *state, WebGLRenderingVersion version);
|
|
30
30
|
|
|
31
|
+
static v8::CFunction fast_begin_query_;
|
|
32
|
+
static v8::CFunction fast_begin_transform_feedback_;
|
|
31
33
|
static v8::CFunction fast_bind_vertex_array_;
|
|
34
|
+
static v8::CFunction fast_bind_buffer_base_;
|
|
35
|
+
static v8::CFunction fast_bind_buffer_range_;
|
|
36
|
+
static v8::CFunction fast_bind_sampler_;
|
|
37
|
+
static v8::CFunction fast_bind_transform_feedback_;
|
|
38
|
+
static v8::CFunction fast_blit_framebuffer_;
|
|
39
|
+
static v8::CFunction fast_clear_buffer_fi_;
|
|
40
|
+
static v8::CFunction fast_clear_buffer_fv_;
|
|
41
|
+
static v8::CFunction fast_clear_buffer_fv_array_;
|
|
42
|
+
static v8::CFunction fast_clear_buffer_iv_;
|
|
43
|
+
static v8::CFunction fast_clear_buffer_iv_array_;
|
|
44
|
+
static v8::CFunction fast_clear_buffer_uiv_;
|
|
45
|
+
static v8::CFunction fast_clear_buffer_uiv_array_;
|
|
46
|
+
static v8::CFunction fast_draw_arrays_instanced_;
|
|
47
|
+
static v8::CFunction fast_draw_buffers_;
|
|
48
|
+
static v8::CFunction fast_draw_elements_instanced_;
|
|
49
|
+
static v8::CFunction fast_draw_range_elements_;
|
|
50
|
+
static v8::CFunction fast_resume_transform_feedback_;
|
|
51
|
+
static v8::CFunction fast_sampler_parameterf_;
|
|
52
|
+
static v8::CFunction fast_sampler_parameteri_;
|
|
53
|
+
static v8::CFunction fast_uniform_1ui_;
|
|
54
|
+
static v8::CFunction fast_uniform_1uiv_;
|
|
55
|
+
static v8::CFunction fast_uniform_2ui_;
|
|
56
|
+
static v8::CFunction fast_uniform_2uiv_;
|
|
57
|
+
static v8::CFunction fast_uniform_3ui_;
|
|
58
|
+
static v8::CFunction fast_uniform_3uiv_;
|
|
59
|
+
static v8::CFunction fast_uniform_4ui_;
|
|
60
|
+
static v8::CFunction fast_uniform_4uiv_;
|
|
61
|
+
static v8::CFunction fast_uniform_matrix_2x3fv_;
|
|
62
|
+
static v8::CFunction fast_uniform_matrix_2x3fv_array_;
|
|
63
|
+
static v8::CFunction fast_uniform_matrix_2x4fv_;
|
|
64
|
+
static v8::CFunction fast_uniform_matrix_2x4fv_array_;
|
|
65
|
+
static v8::CFunction fast_uniform_matrix_3x2fv_;
|
|
66
|
+
static v8::CFunction fast_uniform_matrix_3x2fv_array_;
|
|
67
|
+
static v8::CFunction fast_uniform_matrix_3x4fv_;
|
|
68
|
+
static v8::CFunction fast_uniform_matrix_3x4fv_array_;
|
|
69
|
+
static v8::CFunction fast_uniform_matrix_4x2fv_;
|
|
70
|
+
static v8::CFunction fast_uniform_matrix_4x2fv_array_;
|
|
71
|
+
static v8::CFunction fast_uniform_matrix_4x3fv_;
|
|
72
|
+
static v8::CFunction fast_uniform_matrix_4x3fv_array_;
|
|
73
|
+
static v8::CFunction fast_vertex_attrib_divisor_;
|
|
74
|
+
static v8::CFunction fast_vertex_attrib_i_4i_;
|
|
75
|
+
static v8::CFunction fast_vertex_attrib_i_4iv_;
|
|
76
|
+
static v8::CFunction fast_vertex_attrib_i_4iv_array_;
|
|
77
|
+
static v8::CFunction fast_vertex_attrib_i_4ui_;
|
|
78
|
+
static v8::CFunction fast_vertex_attrib_i_4uiv_;
|
|
79
|
+
static v8::CFunction fast_vertex_attrib_i_4uiv_array_;
|
|
80
|
+
static v8::CFunction fast_uniform_block_binding_;
|
|
81
|
+
|
|
82
|
+
static v8::CFunction fast_invalidate_framebuffer_;
|
|
83
|
+
static v8::CFunction fast_invalidate_sub_framebuffer_;
|
|
84
|
+
|
|
32
85
|
|
|
33
86
|
static v8::Local<v8::FunctionTemplate> GetCtor(v8::Isolate *isolate);
|
|
34
87
|
|
|
@@ -38,7 +91,7 @@ public:
|
|
|
38
91
|
v8::EscapableHandleScope scope(isolate);
|
|
39
92
|
auto object = WebGL2RenderingContext::GetCtor(isolate)->GetFunction(
|
|
40
93
|
context).ToLocalChecked()->NewInstance(context).ToLocalChecked();
|
|
41
|
-
SetNativeType(
|
|
94
|
+
SetNativeType(object, NativeType::WebGLRenderingContextBase);
|
|
42
95
|
object->SetAlignedPointerInInternalField(0, renderingContext);
|
|
43
96
|
renderingContext->BindFinalizer(isolate, object);
|
|
44
97
|
return scope.Escape(object);
|
|
@@ -56,16 +109,134 @@ public:
|
|
|
56
109
|
|
|
57
110
|
static void BeginQuery(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
58
111
|
|
|
112
|
+
static void FastBeginQuery(v8::Local<v8::Object> receiver_obj, uint32_t target,
|
|
113
|
+
v8::Local<v8::Object> query_obj) {
|
|
114
|
+
WebGL2RenderingContext *ptr = GetPointer(receiver_obj);
|
|
115
|
+
if (ptr == nullptr) {
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
auto type = GetNativeType(query_obj);
|
|
120
|
+
if (type == NativeType::WebGLQuery) {
|
|
121
|
+
auto query = WebGLQuery::GetPointer(query_obj);
|
|
122
|
+
|
|
123
|
+
if (query != nullptr) {
|
|
124
|
+
canvas_native_webgl2_begin_query(
|
|
125
|
+
target,
|
|
126
|
+
query->GetQuery(),
|
|
127
|
+
ptr->GetState()
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
59
133
|
static void BeginTransformFeedback(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
60
134
|
|
|
135
|
+
static void FastBeginTransformFeedback(v8::Local<v8::Object> receiver_obj, uint32_t value) {
|
|
136
|
+
WebGL2RenderingContext *ptr = GetPointer(receiver_obj);
|
|
137
|
+
if (ptr == nullptr) {
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
canvas_native_webgl2_begin_transform_feedback(
|
|
142
|
+
value,
|
|
143
|
+
ptr->GetState()
|
|
144
|
+
);
|
|
145
|
+
}
|
|
146
|
+
|
|
61
147
|
static void BindBufferBase(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
62
148
|
|
|
149
|
+
static void
|
|
150
|
+
FastBindBufferBase(v8::Local<v8::Object> receiver_obj, uint32_t target, uint32_t index,
|
|
151
|
+
v8::Local<v8::Object> buffer_obj) {
|
|
152
|
+
WebGL2RenderingContext *ptr = GetPointer(receiver_obj);
|
|
153
|
+
if (ptr == nullptr) {
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
auto type = GetNativeType(buffer_obj);
|
|
158
|
+
|
|
159
|
+
if (type == NativeType::WebGLBuffer) {
|
|
160
|
+
auto buffer = WebGLBuffer::GetPointer(buffer_obj);
|
|
161
|
+
|
|
162
|
+
canvas_native_webgl2_bind_buffer_base(
|
|
163
|
+
target,
|
|
164
|
+
index,
|
|
165
|
+
buffer->GetBuffer(),
|
|
166
|
+
ptr->GetState()
|
|
167
|
+
);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
63
171
|
static void BindBufferRange(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
64
172
|
|
|
173
|
+
static void
|
|
174
|
+
FastBindBufferRange(v8::Local<v8::Object> receiver_obj, uint32_t target, uint32_t index,
|
|
175
|
+
v8::Local<v8::Object> buffer_obj, int32_t offset, int32_t size) {
|
|
176
|
+
WebGL2RenderingContext *ptr = GetPointer(receiver_obj);
|
|
177
|
+
if (ptr == nullptr) {
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
auto type = GetNativeType(buffer_obj);
|
|
183
|
+
if (type == NativeType::WebGLBuffer) {
|
|
184
|
+
auto buffer = WebGLBuffer::GetPointer(buffer_obj);
|
|
185
|
+
canvas_native_webgl2_bind_buffer_range(
|
|
186
|
+
target,
|
|
187
|
+
index,
|
|
188
|
+
buffer->GetBuffer(),
|
|
189
|
+
static_cast<ssize_t>(offset),
|
|
190
|
+
static_cast<ssize_t>(size),
|
|
191
|
+
ptr->GetState()
|
|
192
|
+
);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
65
196
|
static void BindSampler(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
66
197
|
|
|
198
|
+
static void FastBindSampler(v8::Local<v8::Object> receiver_obj, uint32_t unit,
|
|
199
|
+
v8::Local<v8::Object> sampler_obj) {
|
|
200
|
+
WebGL2RenderingContext *ptr = GetPointer(receiver_obj);
|
|
201
|
+
if (ptr == nullptr) {
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
auto type = GetNativeType(sampler_obj);
|
|
206
|
+
if (type == NativeType::WebGLSampler) {
|
|
207
|
+
auto sampler = WebGLSampler::GetPointer(sampler_obj);
|
|
208
|
+
|
|
209
|
+
canvas_native_webgl2_bind_sampler(
|
|
210
|
+
unit,
|
|
211
|
+
sampler->GetSampler(),
|
|
212
|
+
ptr->GetState()
|
|
213
|
+
);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
|
|
67
217
|
static void BindTransformFeedback(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
68
218
|
|
|
219
|
+
static void FastBindTransformFeedback(v8::Local<v8::Object> receiver_obj, uint32_t target,
|
|
220
|
+
v8::Local<v8::Object> transformer_obj) {
|
|
221
|
+
WebGL2RenderingContext *ptr = GetPointer(receiver_obj);
|
|
222
|
+
if (ptr == nullptr) {
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
auto type = GetNativeType(transformer_obj);
|
|
228
|
+
|
|
229
|
+
if (type == NativeType::WebGLTransformFeedback) {
|
|
230
|
+
auto transformFeedback = WebGLTransformFeedback::GetPointer(transformer_obj);
|
|
231
|
+
|
|
232
|
+
canvas_native_webgl2_bind_transform_feedback(
|
|
233
|
+
target,
|
|
234
|
+
transformFeedback->GetFeedback(),
|
|
235
|
+
ptr->GetState()
|
|
236
|
+
);
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
|
|
69
240
|
static void BindVertexArray(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
70
241
|
|
|
71
242
|
static void
|
|
@@ -91,14 +262,206 @@ public:
|
|
|
91
262
|
|
|
92
263
|
static void BlitFramebuffer(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
93
264
|
|
|
265
|
+
static void
|
|
266
|
+
FastBlitFramebuffer(v8::Local<v8::Object> receiver_obj, int32_t srcX0, int32_t srcY0,
|
|
267
|
+
int32_t srcX1, int32_t srcY1, int32_t dstX0, int32_t dstY0, int32_t dstX1,
|
|
268
|
+
int32_t dstY1, uint32_t mask, uint32_t filter) {
|
|
269
|
+
WebGL2RenderingContext *ptr = GetPointer(receiver_obj);
|
|
270
|
+
if (ptr == nullptr) {
|
|
271
|
+
return;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
|
|
275
|
+
canvas_native_webgl2_blit_framebuffer(
|
|
276
|
+
srcX0,
|
|
277
|
+
srcY0,
|
|
278
|
+
srcX1,
|
|
279
|
+
srcY1,
|
|
280
|
+
dstX0,
|
|
281
|
+
dstY0,
|
|
282
|
+
dstX1,
|
|
283
|
+
dstY1,
|
|
284
|
+
mask,
|
|
285
|
+
filter,
|
|
286
|
+
ptr->GetState()
|
|
287
|
+
);
|
|
288
|
+
}
|
|
289
|
+
|
|
94
290
|
static void ClearBufferfi(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
95
291
|
|
|
292
|
+
static void
|
|
293
|
+
FastClearBufferfi(v8::Local<v8::Object> receiver_obj, uint32_t buffer, int32_t drawbuffer,
|
|
294
|
+
double depth, int32_t stencil) {
|
|
295
|
+
WebGL2RenderingContext *ptr = GetPointer(receiver_obj);
|
|
296
|
+
if (ptr == nullptr) {
|
|
297
|
+
return;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
|
|
301
|
+
canvas_native_webgl2_clear_bufferfi(
|
|
302
|
+
buffer,
|
|
303
|
+
drawbuffer,
|
|
304
|
+
static_cast<float>(depth),
|
|
305
|
+
stencil,
|
|
306
|
+
ptr->GetState()
|
|
307
|
+
);
|
|
308
|
+
}
|
|
309
|
+
|
|
96
310
|
static void ClearBufferfv(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
97
311
|
|
|
312
|
+
static void
|
|
313
|
+
FastClearBufferfv(v8::Local<v8::Object> receiver_obj, uint32_t buffer, int32_t drawbuffer,
|
|
314
|
+
const v8::FastApiTypedArray<float> &values) {
|
|
315
|
+
WebGL2RenderingContext *ptr = GetPointer(receiver_obj);
|
|
316
|
+
if (ptr == nullptr) {
|
|
317
|
+
return;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
auto size = values.length();
|
|
321
|
+
float *data;
|
|
322
|
+
values.getStorageIfAligned(&data);
|
|
323
|
+
|
|
324
|
+
|
|
325
|
+
canvas_native_webgl2_clear_bufferfv(
|
|
326
|
+
buffer,
|
|
327
|
+
drawbuffer,
|
|
328
|
+
data,
|
|
329
|
+
size,
|
|
330
|
+
ptr->GetState()
|
|
331
|
+
);
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
static void
|
|
335
|
+
FastClearBufferfvArray(v8::Local<v8::Object> receiver_obj, uint32_t buffer, int32_t drawbuffer,
|
|
336
|
+
v8::Local<v8::Array> values) {
|
|
337
|
+
WebGL2RenderingContext *ptr = GetPointer(receiver_obj);
|
|
338
|
+
if (ptr == nullptr) {
|
|
339
|
+
return;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
auto len = values->Length();
|
|
343
|
+
std::vector<float> buf;
|
|
344
|
+
buf.reserve(len);
|
|
345
|
+
|
|
346
|
+
auto copied = v8::TryToCopyAndConvertArrayToCppBuffer<v8::CTypeInfoBuilder<float>::Build().GetId(), float>(
|
|
347
|
+
values, buf.data(), len);
|
|
348
|
+
|
|
349
|
+
|
|
350
|
+
if (copied) {
|
|
351
|
+
canvas_native_webgl2_clear_bufferfv(
|
|
352
|
+
buffer,
|
|
353
|
+
drawbuffer,
|
|
354
|
+
buf.data(),
|
|
355
|
+
buf.size(),
|
|
356
|
+
ptr->GetState()
|
|
357
|
+
);
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
|
|
98
361
|
static void ClearBufferiv(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
99
362
|
|
|
363
|
+
static void
|
|
364
|
+
FastClearBufferiv(v8::Local<v8::Object> receiver_obj, uint32_t buffer, int32_t drawbuffer,
|
|
365
|
+
const v8::FastApiTypedArray<int32_t> &values) {
|
|
366
|
+
WebGL2RenderingContext *ptr = GetPointer(receiver_obj);
|
|
367
|
+
if (ptr == nullptr) {
|
|
368
|
+
return;
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
auto size = values.length();
|
|
372
|
+
int32_t *data;
|
|
373
|
+
values.getStorageIfAligned(&data);
|
|
374
|
+
|
|
375
|
+
|
|
376
|
+
canvas_native_webgl2_clear_bufferiv(
|
|
377
|
+
buffer,
|
|
378
|
+
drawbuffer,
|
|
379
|
+
data,
|
|
380
|
+
size,
|
|
381
|
+
ptr->GetState()
|
|
382
|
+
);
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
static void
|
|
386
|
+
FastClearBufferivArray(v8::Local<v8::Object> receiver_obj, uint32_t buffer, int32_t drawbuffer,
|
|
387
|
+
v8::Local<v8::Array> values) {
|
|
388
|
+
WebGL2RenderingContext *ptr = GetPointer(receiver_obj);
|
|
389
|
+
if (ptr == nullptr) {
|
|
390
|
+
return;
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
auto len = values->Length();
|
|
394
|
+
std::vector<int32_t> buf;
|
|
395
|
+
buf.reserve(len);
|
|
396
|
+
|
|
397
|
+
auto copied = v8::TryToCopyAndConvertArrayToCppBuffer<v8::CTypeInfoBuilder<int32_t>::Build().GetId(), int32_t>(
|
|
398
|
+
values, buf.data(), len);
|
|
399
|
+
|
|
400
|
+
|
|
401
|
+
if (copied) {
|
|
402
|
+
canvas_native_webgl2_clear_bufferiv(
|
|
403
|
+
buffer,
|
|
404
|
+
drawbuffer,
|
|
405
|
+
buf.data(),
|
|
406
|
+
buf.size(),
|
|
407
|
+
ptr->GetState()
|
|
408
|
+
);
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
|
|
100
413
|
static void ClearBufferuiv(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
101
414
|
|
|
415
|
+
|
|
416
|
+
static void
|
|
417
|
+
FastClearBufferuiv(v8::Local<v8::Object> receiver_obj, uint32_t buffer, int32_t drawbuffer,
|
|
418
|
+
const v8::FastApiTypedArray<uint32_t> &values) {
|
|
419
|
+
WebGL2RenderingContext *ptr = GetPointer(receiver_obj);
|
|
420
|
+
if (ptr == nullptr) {
|
|
421
|
+
return;
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
auto size = values.length();
|
|
425
|
+
uint32_t *data;
|
|
426
|
+
values.getStorageIfAligned(&data);
|
|
427
|
+
|
|
428
|
+
|
|
429
|
+
canvas_native_webgl2_clear_bufferuiv(
|
|
430
|
+
buffer,
|
|
431
|
+
drawbuffer,
|
|
432
|
+
data,
|
|
433
|
+
size,
|
|
434
|
+
ptr->GetState()
|
|
435
|
+
);
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
static void
|
|
439
|
+
FastClearBufferuivArray(v8::Local<v8::Object> receiver_obj, uint32_t buffer, int32_t drawbuffer,
|
|
440
|
+
v8::Local<v8::Array> values) {
|
|
441
|
+
WebGL2RenderingContext *ptr = GetPointer(receiver_obj);
|
|
442
|
+
if (ptr == nullptr) {
|
|
443
|
+
return;
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
auto len = values->Length();
|
|
447
|
+
std::vector<uint32_t> buf;
|
|
448
|
+
buf.reserve(len);
|
|
449
|
+
|
|
450
|
+
auto copied = v8::TryToCopyAndConvertArrayToCppBuffer<v8::CTypeInfoBuilder<uint32_t>::Build().GetId(), uint32_t>(
|
|
451
|
+
values, buf.data(), len);
|
|
452
|
+
|
|
453
|
+
|
|
454
|
+
if (copied) {
|
|
455
|
+
canvas_native_webgl2_clear_bufferuiv(
|
|
456
|
+
buffer,
|
|
457
|
+
drawbuffer,
|
|
458
|
+
buf.data(),
|
|
459
|
+
buf.size(),
|
|
460
|
+
ptr->GetState()
|
|
461
|
+
);
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
|
|
102
465
|
static void ClientWaitSync(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
103
466
|
|
|
104
467
|
static void CompressedTexSubImage3D(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
@@ -127,12 +490,97 @@ public:
|
|
|
127
490
|
|
|
128
491
|
static void DrawArraysInstanced(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
129
492
|
|
|
493
|
+
static void
|
|
494
|
+
FastDrawArraysInstanced(v8::Local<v8::Object> receiver_obj, uint32_t mode, int32_t first,
|
|
495
|
+
int32_t count, int32_t instanceCount) {
|
|
496
|
+
WebGL2RenderingContext *ptr = GetPointer(receiver_obj);
|
|
497
|
+
if (ptr == nullptr) {
|
|
498
|
+
return;
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
|
|
502
|
+
canvas_native_webgl2_draw_arrays_instanced(
|
|
503
|
+
mode,
|
|
504
|
+
first,
|
|
505
|
+
count,
|
|
506
|
+
instanceCount,
|
|
507
|
+
ptr->GetState()
|
|
508
|
+
);
|
|
509
|
+
|
|
510
|
+
ptr->UpdateInvalidateState();
|
|
511
|
+
}
|
|
512
|
+
|
|
130
513
|
static void DrawBuffers(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
131
514
|
|
|
515
|
+
static void FastDrawBuffers(v8::Local<v8::Object> receiver_obj, v8::Local<v8::Array> buffers) {
|
|
516
|
+
WebGL2RenderingContext *ptr = GetPointer(receiver_obj);
|
|
517
|
+
if (ptr == nullptr) {
|
|
518
|
+
return;
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
auto len = buffers->Length();
|
|
522
|
+
std::vector<uint32_t> buf;
|
|
523
|
+
buf.reserve(len);
|
|
524
|
+
|
|
525
|
+
auto copied = v8::TryToCopyAndConvertArrayToCppBuffer<v8::CTypeInfoBuilder<uint32_t>::Build().GetId(), uint32_t>(
|
|
526
|
+
buffers, buf.data(), len);
|
|
527
|
+
|
|
528
|
+
|
|
529
|
+
if (copied) {
|
|
530
|
+
canvas_native_webgl2_draw_buffers(
|
|
531
|
+
buf.data(), buf.size(),
|
|
532
|
+
ptr->GetState());
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
}
|
|
536
|
+
|
|
132
537
|
static void DrawElementsInstanced(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
133
538
|
|
|
539
|
+
static void
|
|
540
|
+
FastDrawElementsInstanced(v8::Local<v8::Object> receiver_obj, uint32_t mode, int32_t count,
|
|
541
|
+
uint32_t type, int32_t offset, int32_t instanceCount) {
|
|
542
|
+
WebGL2RenderingContext *ptr = GetPointer(receiver_obj);
|
|
543
|
+
if (ptr == nullptr) {
|
|
544
|
+
return;
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
|
|
548
|
+
canvas_native_webgl2_draw_elements_instanced(
|
|
549
|
+
mode,
|
|
550
|
+
count,
|
|
551
|
+
type,
|
|
552
|
+
static_cast<ssize_t>(offset),
|
|
553
|
+
instanceCount,
|
|
554
|
+
ptr->GetState()
|
|
555
|
+
);
|
|
556
|
+
|
|
557
|
+
ptr->UpdateInvalidateState();
|
|
558
|
+
}
|
|
559
|
+
|
|
134
560
|
static void DrawRangeElements(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
135
561
|
|
|
562
|
+
static void
|
|
563
|
+
FastDrawRangeElements(v8::Local<v8::Object> receiver_obj, uint32_t mode, uint32_t start,
|
|
564
|
+
uint32_t end, int32_t count, uint32_t type, int32_t offset) {
|
|
565
|
+
WebGL2RenderingContext *ptr = GetPointer(receiver_obj);
|
|
566
|
+
if (ptr == nullptr) {
|
|
567
|
+
return;
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
|
|
571
|
+
canvas_native_webgl2_draw_range_elements(
|
|
572
|
+
mode,
|
|
573
|
+
start,
|
|
574
|
+
end,
|
|
575
|
+
count,
|
|
576
|
+
type,
|
|
577
|
+
static_cast<ssize_t>(offset),
|
|
578
|
+
ptr->GetState()
|
|
579
|
+
);
|
|
580
|
+
|
|
581
|
+
ptr->UpdateInvalidateState();
|
|
582
|
+
}
|
|
583
|
+
|
|
136
584
|
static void EndQuery(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
137
585
|
|
|
138
586
|
static void EndTransformFeedback(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
@@ -173,8 +621,58 @@ public:
|
|
|
173
621
|
|
|
174
622
|
static void InvalidateFramebuffer(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
175
623
|
|
|
624
|
+
static void
|
|
625
|
+
FastInvalidateFramebuffer(v8::Local<v8::Object> receiver_obj, uint32_t target,
|
|
626
|
+
v8::Local<v8::Array> attachments) {
|
|
627
|
+
WebGL2RenderingContext *ptr = GetPointer(receiver_obj);
|
|
628
|
+
if (ptr == nullptr) {
|
|
629
|
+
return;
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
auto len = attachments->Length();
|
|
633
|
+
std::vector<uint32_t> buf;
|
|
634
|
+
buf.reserve(len);
|
|
635
|
+
|
|
636
|
+
auto copied = v8::TryToCopyAndConvertArrayToCppBuffer<v8::CTypeInfoBuilder<uint32_t>::Build().GetId(), uint32_t>(
|
|
637
|
+
attachments, buf.data(), len);
|
|
638
|
+
|
|
639
|
+
if (copied) {
|
|
640
|
+
canvas_native_webgl2_invalidate_framebuffer(
|
|
641
|
+
target, buf.data(), buf.size(),
|
|
642
|
+
ptr->GetState());
|
|
643
|
+
}
|
|
644
|
+
}
|
|
645
|
+
|
|
176
646
|
static void InvalidateSubFramebuffer(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
177
647
|
|
|
648
|
+
static void FastInvalidateSubFramebuffer(v8::Local<v8::Object> receiver_obj, uint32_t target,
|
|
649
|
+
v8::Local<v8::Array> attachments, int32_t x, int32_t y,
|
|
650
|
+
int32_t width, int32_t height) {
|
|
651
|
+
WebGL2RenderingContext *ptr = GetPointer(receiver_obj);
|
|
652
|
+
if (ptr == nullptr) {
|
|
653
|
+
return;
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
auto len = attachments->Length();
|
|
657
|
+
std::vector<uint32_t> buf;
|
|
658
|
+
buf.reserve(len);
|
|
659
|
+
|
|
660
|
+
auto copied = v8::TryToCopyAndConvertArrayToCppBuffer<v8::CTypeInfoBuilder<uint32_t>::Build().GetId(), uint32_t>(
|
|
661
|
+
attachments, buf.data(), len);
|
|
662
|
+
|
|
663
|
+
if (copied) {
|
|
664
|
+
|
|
665
|
+
canvas_native_webgl2_invalidate_sub_framebuffer(
|
|
666
|
+
target,
|
|
667
|
+
buf.data(), buf.size(),
|
|
668
|
+
x,
|
|
669
|
+
y,
|
|
670
|
+
width,
|
|
671
|
+
height,
|
|
672
|
+
ptr->GetState());
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
|
|
178
676
|
static void IsQuery(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
179
677
|
|
|
180
678
|
static void IsSampler(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
@@ -193,10 +691,65 @@ public:
|
|
|
193
691
|
|
|
194
692
|
static void ResumeTransformFeedback(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
195
693
|
|
|
694
|
+
static void FastResumeTransformFeedback(v8::Local<v8::Object> receiver_obj) {
|
|
695
|
+
WebGL2RenderingContext *ptr = GetPointer(receiver_obj);
|
|
696
|
+
if (ptr == nullptr) {
|
|
697
|
+
return;
|
|
698
|
+
}
|
|
699
|
+
|
|
700
|
+
canvas_native_webgl2_resume_transform_feedback(
|
|
701
|
+
ptr->GetState());
|
|
702
|
+
}
|
|
703
|
+
|
|
196
704
|
static void SamplerParameterf(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
197
705
|
|
|
706
|
+
static void
|
|
707
|
+
FastSamplerParameterf(v8::Local<v8::Object> receiver_obj, v8::Local<v8::Object> sampler_obj,
|
|
708
|
+
uint32_t pname, double param) {
|
|
709
|
+
WebGL2RenderingContext *ptr = GetPointer(receiver_obj);
|
|
710
|
+
if (ptr == nullptr) {
|
|
711
|
+
return;
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
auto type = GetNativeType(sampler_obj);
|
|
715
|
+
if (type == NativeType::WebGLSampler) {
|
|
716
|
+
auto sampler = WebGLSampler::GetPointer(sampler_obj);
|
|
717
|
+
if (sampler != nullptr) {
|
|
718
|
+
canvas_native_webgl2_sampler_parameterf(
|
|
719
|
+
sampler->GetSampler(),
|
|
720
|
+
pname,
|
|
721
|
+
static_cast<float>(param),
|
|
722
|
+
ptr->GetState());
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
}
|
|
727
|
+
|
|
198
728
|
static void SamplerParameteri(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
199
729
|
|
|
730
|
+
|
|
731
|
+
static void
|
|
732
|
+
FastSamplerParameteri(v8::Local<v8::Object> receiver_obj, v8::Local<v8::Object> sampler_obj,
|
|
733
|
+
uint32_t pname, int32_t param) {
|
|
734
|
+
WebGL2RenderingContext *ptr = GetPointer(receiver_obj);
|
|
735
|
+
if (ptr == nullptr) {
|
|
736
|
+
return;
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
auto type = GetNativeType(sampler_obj);
|
|
740
|
+
if (type == NativeType::WebGLSampler) {
|
|
741
|
+
auto sampler = WebGLSampler::GetPointer(sampler_obj);
|
|
742
|
+
if (sampler != nullptr) {
|
|
743
|
+
canvas_native_webgl2_sampler_parameteri(
|
|
744
|
+
sampler->GetSampler(),
|
|
745
|
+
pname,
|
|
746
|
+
param,
|
|
747
|
+
ptr->GetState());
|
|
748
|
+
}
|
|
749
|
+
}
|
|
750
|
+
|
|
751
|
+
}
|
|
752
|
+
|
|
200
753
|
static void TexImage3D(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
201
754
|
|
|
202
755
|
static void TexStorage2D(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
@@ -209,42 +762,755 @@ public:
|
|
|
209
762
|
|
|
210
763
|
static void Uniform1ui(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
211
764
|
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
765
|
+
|
|
766
|
+
static void
|
|
767
|
+
FastUniform1ui(v8::Local<v8::Object> receiver_obj, v8::Local<v8::Object> location_obj,
|
|
768
|
+
uint32_t v0) {
|
|
769
|
+
WebGL2RenderingContext *ptr = GetPointer(receiver_obj);
|
|
770
|
+
if (ptr == nullptr) {
|
|
771
|
+
return;
|
|
772
|
+
}
|
|
773
|
+
|
|
774
|
+
|
|
775
|
+
auto type = GetNativeType(location_obj);
|
|
776
|
+
|
|
777
|
+
if (type == NativeType::WebGLUniformLocation) {
|
|
778
|
+
|
|
779
|
+
auto location = WebGLUniformLocation::GetPointer(location_obj);
|
|
780
|
+
|
|
781
|
+
if (location != nullptr) {
|
|
782
|
+
canvas_native_webgl2_uniform1ui(
|
|
783
|
+
location->GetUniformLocation(),
|
|
784
|
+
v0,
|
|
785
|
+
ptr->GetState()
|
|
786
|
+
);
|
|
787
|
+
}
|
|
788
|
+
}
|
|
789
|
+
|
|
790
|
+
}
|
|
791
|
+
|
|
792
|
+
static void Uniform1uiv(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
793
|
+
|
|
794
|
+
static void
|
|
795
|
+
FastUniform1uiv(v8::Local<v8::Object> receiver_obj, v8::Local<v8::Object> location_obj,
|
|
796
|
+
const v8::FastApiTypedArray<uint32_t> &value) {
|
|
797
|
+
WebGLRenderingContext *ptr = GetPointer(receiver_obj);
|
|
798
|
+
if (ptr == nullptr) {
|
|
799
|
+
return;
|
|
800
|
+
}
|
|
801
|
+
|
|
802
|
+
auto location = WebGLUniformLocation::GetPointer(location_obj);
|
|
803
|
+
|
|
804
|
+
if (location != nullptr) {
|
|
805
|
+
auto size = value.length();
|
|
806
|
+
uint32_t *data;
|
|
807
|
+
value.getStorageIfAligned(&data);
|
|
808
|
+
|
|
809
|
+
canvas_native_webgl2_uniform1uiv(
|
|
810
|
+
location->GetUniformLocation(),
|
|
811
|
+
data, size,
|
|
812
|
+
ptr->GetState());
|
|
813
|
+
}
|
|
814
|
+
}
|
|
815
|
+
|
|
816
|
+
static void Uniform2ui(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
817
|
+
|
|
818
|
+
static void
|
|
819
|
+
FastUniform2ui(v8::Local<v8::Object> receiver_obj, v8::Local<v8::Object> location_obj,
|
|
820
|
+
uint32_t v0, uint32_t v1) {
|
|
821
|
+
WebGL2RenderingContext *ptr = GetPointer(receiver_obj);
|
|
822
|
+
if (ptr == nullptr) {
|
|
823
|
+
return;
|
|
824
|
+
}
|
|
825
|
+
|
|
826
|
+
|
|
827
|
+
auto type = GetNativeType(location_obj);
|
|
828
|
+
|
|
829
|
+
if (type == NativeType::WebGLUniformLocation) {
|
|
830
|
+
|
|
831
|
+
auto location = WebGLUniformLocation::GetPointer(location_obj);
|
|
832
|
+
|
|
833
|
+
if (location != nullptr) {
|
|
834
|
+
canvas_native_webgl2_uniform2ui(
|
|
835
|
+
location->GetUniformLocation(),
|
|
836
|
+
v0, v1,
|
|
837
|
+
ptr->GetState()
|
|
838
|
+
);
|
|
839
|
+
}
|
|
840
|
+
}
|
|
841
|
+
|
|
842
|
+
}
|
|
215
843
|
|
|
216
844
|
static void Uniform2uiv(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
217
845
|
|
|
846
|
+
static void
|
|
847
|
+
FastUniform2uiv(v8::Local<v8::Object> receiver_obj, v8::Local<v8::Object> location_obj,
|
|
848
|
+
const v8::FastApiTypedArray<uint32_t> &value) {
|
|
849
|
+
WebGLRenderingContext *ptr = GetPointer(receiver_obj);
|
|
850
|
+
if (ptr == nullptr) {
|
|
851
|
+
return;
|
|
852
|
+
}
|
|
853
|
+
|
|
854
|
+
auto location = WebGLUniformLocation::GetPointer(location_obj);
|
|
855
|
+
|
|
856
|
+
if (location != nullptr) {
|
|
857
|
+
auto size = value.length();
|
|
858
|
+
uint32_t *data;
|
|
859
|
+
value.getStorageIfAligned(&data);
|
|
860
|
+
|
|
861
|
+
canvas_native_webgl2_uniform2uiv(
|
|
862
|
+
location->GetUniformLocation(),
|
|
863
|
+
data, size,
|
|
864
|
+
ptr->GetState());
|
|
865
|
+
}
|
|
866
|
+
}
|
|
867
|
+
|
|
218
868
|
static void Uniform3ui(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
219
869
|
|
|
870
|
+
static void
|
|
871
|
+
FastUniform3ui(v8::Local<v8::Object> receiver_obj, v8::Local<v8::Object> location_obj,
|
|
872
|
+
uint32_t v0, uint32_t v1, uint32_t v2) {
|
|
873
|
+
WebGL2RenderingContext *ptr = GetPointer(receiver_obj);
|
|
874
|
+
if (ptr == nullptr) {
|
|
875
|
+
return;
|
|
876
|
+
}
|
|
877
|
+
|
|
878
|
+
|
|
879
|
+
auto type = GetNativeType(location_obj);
|
|
880
|
+
|
|
881
|
+
if (type == NativeType::WebGLUniformLocation) {
|
|
882
|
+
|
|
883
|
+
auto location = WebGLUniformLocation::GetPointer(location_obj);
|
|
884
|
+
|
|
885
|
+
if (location != nullptr) {
|
|
886
|
+
canvas_native_webgl2_uniform3ui(
|
|
887
|
+
location->GetUniformLocation(),
|
|
888
|
+
v0, v1, v2,
|
|
889
|
+
ptr->GetState()
|
|
890
|
+
);
|
|
891
|
+
}
|
|
892
|
+
}
|
|
893
|
+
|
|
894
|
+
}
|
|
895
|
+
|
|
220
896
|
static void Uniform3uiv(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
221
897
|
|
|
898
|
+
static void
|
|
899
|
+
FastUniform3uiv(v8::Local<v8::Object> receiver_obj, v8::Local<v8::Object> location_obj,
|
|
900
|
+
const v8::FastApiTypedArray<uint32_t> &value) {
|
|
901
|
+
WebGLRenderingContext *ptr = GetPointer(receiver_obj);
|
|
902
|
+
if (ptr == nullptr) {
|
|
903
|
+
return;
|
|
904
|
+
}
|
|
905
|
+
|
|
906
|
+
auto location = WebGLUniformLocation::GetPointer(location_obj);
|
|
907
|
+
|
|
908
|
+
if (location != nullptr) {
|
|
909
|
+
auto size = value.length();
|
|
910
|
+
uint32_t *data;
|
|
911
|
+
value.getStorageIfAligned(&data);
|
|
912
|
+
|
|
913
|
+
canvas_native_webgl2_uniform3uiv(
|
|
914
|
+
location->GetUniformLocation(),
|
|
915
|
+
data, size,
|
|
916
|
+
ptr->GetState());
|
|
917
|
+
}
|
|
918
|
+
}
|
|
919
|
+
|
|
222
920
|
static void Uniform4ui(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
223
921
|
|
|
922
|
+
static void
|
|
923
|
+
FastUniform4ui(v8::Local<v8::Object> receiver_obj, v8::Local<v8::Object> location_obj,
|
|
924
|
+
uint32_t v0, uint32_t v1, uint32_t v2, uint32_t v3) {
|
|
925
|
+
WebGL2RenderingContext *ptr = GetPointer(receiver_obj);
|
|
926
|
+
if (ptr == nullptr) {
|
|
927
|
+
return;
|
|
928
|
+
}
|
|
929
|
+
|
|
930
|
+
|
|
931
|
+
auto type = GetNativeType(location_obj);
|
|
932
|
+
|
|
933
|
+
if (type == NativeType::WebGLUniformLocation) {
|
|
934
|
+
|
|
935
|
+
auto location = WebGLUniformLocation::GetPointer(location_obj);
|
|
936
|
+
|
|
937
|
+
if (location != nullptr) {
|
|
938
|
+
canvas_native_webgl2_uniform4ui(
|
|
939
|
+
location->GetUniformLocation(),
|
|
940
|
+
v0, v1, v2, v3,
|
|
941
|
+
ptr->GetState()
|
|
942
|
+
);
|
|
943
|
+
}
|
|
944
|
+
}
|
|
945
|
+
|
|
946
|
+
}
|
|
947
|
+
|
|
224
948
|
static void Uniform4uiv(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
225
949
|
|
|
950
|
+
|
|
951
|
+
static void
|
|
952
|
+
FastUniform4uiv(v8::Local<v8::Object> receiver_obj, v8::Local<v8::Object> location_obj,
|
|
953
|
+
const v8::FastApiTypedArray<uint32_t> &value) {
|
|
954
|
+
WebGLRenderingContext *ptr = GetPointer(receiver_obj);
|
|
955
|
+
if (ptr == nullptr) {
|
|
956
|
+
return;
|
|
957
|
+
}
|
|
958
|
+
|
|
959
|
+
auto location = WebGLUniformLocation::GetPointer(location_obj);
|
|
960
|
+
|
|
961
|
+
if (location != nullptr) {
|
|
962
|
+
auto size = value.length();
|
|
963
|
+
uint32_t *data;
|
|
964
|
+
value.getStorageIfAligned(&data);
|
|
965
|
+
|
|
966
|
+
canvas_native_webgl2_uniform4uiv(
|
|
967
|
+
location->GetUniformLocation(),
|
|
968
|
+
data, size,
|
|
969
|
+
ptr->GetState());
|
|
970
|
+
}
|
|
971
|
+
}
|
|
972
|
+
|
|
226
973
|
static void UniformBlockBinding(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
227
974
|
|
|
975
|
+
static void
|
|
976
|
+
FastUniformBlockBinding(v8::Local<v8::Object> receiver_obj, v8::Local<v8::Object> program_obj,
|
|
977
|
+
uint32_t uniformBlockIndex, uint32_t uniformBlockBinding) {
|
|
978
|
+
WebGL2RenderingContext *ptr = GetPointer(receiver_obj);
|
|
979
|
+
if (ptr == nullptr) {
|
|
980
|
+
return;
|
|
981
|
+
}
|
|
982
|
+
|
|
983
|
+
|
|
984
|
+
auto type = GetNativeType(program_obj);
|
|
985
|
+
if (type == NativeType::WebGLProgram) {
|
|
986
|
+
|
|
987
|
+
auto program = WebGLProgram::GetPointer(program_obj);
|
|
988
|
+
|
|
989
|
+
if (program != nullptr) {
|
|
990
|
+
canvas_native_webgl2_uniform_block_binding(
|
|
991
|
+
program->GetProgram(),
|
|
992
|
+
uniformBlockIndex,
|
|
993
|
+
uniformBlockBinding,
|
|
994
|
+
ptr->GetState()
|
|
995
|
+
);
|
|
996
|
+
}
|
|
997
|
+
|
|
998
|
+
}
|
|
999
|
+
|
|
1000
|
+
}
|
|
1001
|
+
|
|
228
1002
|
static void UniformMatrix2x3fv(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
229
1003
|
|
|
1004
|
+
static void
|
|
1005
|
+
FastUniformMatrix2x3fv(v8::Local<v8::Object> receiver_obj, v8::Local<v8::Object> location_obj,
|
|
1006
|
+
bool transpose, const v8::FastApiTypedArray<float> &data_value) {
|
|
1007
|
+
WebGL2RenderingContext *ptr = GetPointer(receiver_obj);
|
|
1008
|
+
if (ptr == nullptr) {
|
|
1009
|
+
return;
|
|
1010
|
+
}
|
|
1011
|
+
|
|
1012
|
+
auto type = GetNativeType(location_obj);
|
|
1013
|
+
if (type == NativeType::WebGLUniformLocation) {
|
|
1014
|
+
auto location = WebGLUniformLocation::GetPointer(location_obj);
|
|
1015
|
+
auto size = data_value.length();
|
|
1016
|
+
float *data;
|
|
1017
|
+
data_value.getStorageIfAligned(&data);
|
|
1018
|
+
|
|
1019
|
+
canvas_native_webgl2_uniform_matrix2x3fv(
|
|
1020
|
+
location->GetUniformLocation(),
|
|
1021
|
+
transpose,
|
|
1022
|
+
data, size,
|
|
1023
|
+
ptr->GetState()
|
|
1024
|
+
);
|
|
1025
|
+
}
|
|
1026
|
+
|
|
1027
|
+
}
|
|
1028
|
+
|
|
1029
|
+
static void
|
|
1030
|
+
FastUniformMatrix2x3fvArray(v8::Local<v8::Object> receiver_obj,
|
|
1031
|
+
v8::Local<v8::Object> location_obj,
|
|
1032
|
+
bool transpose, v8::Local<v8::Array> data_value) {
|
|
1033
|
+
WebGL2RenderingContext *ptr = GetPointer(receiver_obj);
|
|
1034
|
+
if (ptr == nullptr) {
|
|
1035
|
+
return;
|
|
1036
|
+
}
|
|
1037
|
+
|
|
1038
|
+
auto type = GetNativeType(location_obj);
|
|
1039
|
+
if (type == NativeType::WebGLUniformLocation) {
|
|
1040
|
+
auto location = WebGLUniformLocation::GetPointer(location_obj);
|
|
1041
|
+
|
|
1042
|
+
auto len = data_value->Length();
|
|
1043
|
+
std::vector<float> buf;
|
|
1044
|
+
buf.reserve(len);
|
|
1045
|
+
|
|
1046
|
+
auto copied = v8::TryToCopyAndConvertArrayToCppBuffer<v8::CTypeInfoBuilder<float>::Build().GetId(), float>(
|
|
1047
|
+
data_value, buf.data(), len);
|
|
1048
|
+
|
|
1049
|
+
if (copied) {
|
|
1050
|
+
canvas_native_webgl2_uniform_matrix2x3fv(
|
|
1051
|
+
location->GetUniformLocation(),
|
|
1052
|
+
transpose,
|
|
1053
|
+
buf.data(), buf.size(),
|
|
1054
|
+
ptr->GetState()
|
|
1055
|
+
);
|
|
1056
|
+
}
|
|
1057
|
+
}
|
|
1058
|
+
|
|
1059
|
+
}
|
|
1060
|
+
|
|
230
1061
|
static void UniformMatrix2x4fv(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
231
1062
|
|
|
1063
|
+
|
|
1064
|
+
static void
|
|
1065
|
+
FastUniformMatrix2x4fv(v8::Local<v8::Object> receiver_obj, v8::Local<v8::Object> location_obj,
|
|
1066
|
+
bool transpose, const v8::FastApiTypedArray<float> &data_value) {
|
|
1067
|
+
WebGL2RenderingContext *ptr = GetPointer(receiver_obj);
|
|
1068
|
+
if (ptr == nullptr) {
|
|
1069
|
+
return;
|
|
1070
|
+
}
|
|
1071
|
+
|
|
1072
|
+
auto type = GetNativeType(location_obj);
|
|
1073
|
+
if (type == NativeType::WebGLUniformLocation) {
|
|
1074
|
+
auto location = WebGLUniformLocation::GetPointer(location_obj);
|
|
1075
|
+
auto size = data_value.length();
|
|
1076
|
+
float *data;
|
|
1077
|
+
data_value.getStorageIfAligned(&data);
|
|
1078
|
+
|
|
1079
|
+
canvas_native_webgl2_uniform_matrix2x4fv(
|
|
1080
|
+
location->GetUniformLocation(),
|
|
1081
|
+
transpose,
|
|
1082
|
+
data, size,
|
|
1083
|
+
ptr->GetState()
|
|
1084
|
+
);
|
|
1085
|
+
}
|
|
1086
|
+
|
|
1087
|
+
}
|
|
1088
|
+
|
|
1089
|
+
static void
|
|
1090
|
+
FastUniformMatrix2x4fvArray(v8::Local<v8::Object> receiver_obj,
|
|
1091
|
+
v8::Local<v8::Object> location_obj,
|
|
1092
|
+
bool transpose, v8::Local<v8::Array> data_value) {
|
|
1093
|
+
WebGL2RenderingContext *ptr = GetPointer(receiver_obj);
|
|
1094
|
+
if (ptr == nullptr) {
|
|
1095
|
+
return;
|
|
1096
|
+
}
|
|
1097
|
+
|
|
1098
|
+
auto type = GetNativeType(location_obj);
|
|
1099
|
+
if (type == NativeType::WebGLUniformLocation) {
|
|
1100
|
+
auto location = WebGLUniformLocation::GetPointer(location_obj);
|
|
1101
|
+
|
|
1102
|
+
auto len = data_value->Length();
|
|
1103
|
+
std::vector<float> buf;
|
|
1104
|
+
buf.reserve(len);
|
|
1105
|
+
|
|
1106
|
+
auto copied = v8::TryToCopyAndConvertArrayToCppBuffer<v8::CTypeInfoBuilder<float>::Build().GetId(), float>(
|
|
1107
|
+
data_value, buf.data(), len);
|
|
1108
|
+
|
|
1109
|
+
if (copied) {
|
|
1110
|
+
canvas_native_webgl2_uniform_matrix2x4fv(
|
|
1111
|
+
location->GetUniformLocation(),
|
|
1112
|
+
transpose,
|
|
1113
|
+
buf.data(), buf.size(),
|
|
1114
|
+
ptr->GetState()
|
|
1115
|
+
);
|
|
1116
|
+
}
|
|
1117
|
+
}
|
|
1118
|
+
|
|
1119
|
+
}
|
|
1120
|
+
|
|
232
1121
|
static void UniformMatrix3x2fv(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
233
1122
|
|
|
1123
|
+
|
|
1124
|
+
static void
|
|
1125
|
+
FastUniformMatrix3x2fv(v8::Local<v8::Object> receiver_obj, v8::Local<v8::Object> location_obj,
|
|
1126
|
+
bool transpose, const v8::FastApiTypedArray<float> &data_value) {
|
|
1127
|
+
WebGL2RenderingContext *ptr = GetPointer(receiver_obj);
|
|
1128
|
+
if (ptr == nullptr) {
|
|
1129
|
+
return;
|
|
1130
|
+
}
|
|
1131
|
+
|
|
1132
|
+
auto type = GetNativeType(location_obj);
|
|
1133
|
+
if (type == NativeType::WebGLUniformLocation) {
|
|
1134
|
+
auto location = WebGLUniformLocation::GetPointer(location_obj);
|
|
1135
|
+
auto size = data_value.length();
|
|
1136
|
+
float *data;
|
|
1137
|
+
data_value.getStorageIfAligned(&data);
|
|
1138
|
+
|
|
1139
|
+
canvas_native_webgl2_uniform_matrix3x2fv(
|
|
1140
|
+
location->GetUniformLocation(),
|
|
1141
|
+
transpose,
|
|
1142
|
+
data, size,
|
|
1143
|
+
ptr->GetState()
|
|
1144
|
+
);
|
|
1145
|
+
}
|
|
1146
|
+
|
|
1147
|
+
}
|
|
1148
|
+
|
|
1149
|
+
static void
|
|
1150
|
+
FastUniformMatrix3x2fvArray(v8::Local<v8::Object> receiver_obj,
|
|
1151
|
+
v8::Local<v8::Object> location_obj,
|
|
1152
|
+
bool transpose, v8::Local<v8::Array> data_value) {
|
|
1153
|
+
WebGL2RenderingContext *ptr = GetPointer(receiver_obj);
|
|
1154
|
+
if (ptr == nullptr) {
|
|
1155
|
+
return;
|
|
1156
|
+
}
|
|
1157
|
+
|
|
1158
|
+
auto type = GetNativeType(location_obj);
|
|
1159
|
+
if (type == NativeType::WebGLUniformLocation) {
|
|
1160
|
+
auto location = WebGLUniformLocation::GetPointer(location_obj);
|
|
1161
|
+
|
|
1162
|
+
auto len = data_value->Length();
|
|
1163
|
+
std::vector<float> buf;
|
|
1164
|
+
buf.reserve(len);
|
|
1165
|
+
|
|
1166
|
+
auto copied = v8::TryToCopyAndConvertArrayToCppBuffer<v8::CTypeInfoBuilder<float>::Build().GetId(), float>(
|
|
1167
|
+
data_value, buf.data(), len);
|
|
1168
|
+
|
|
1169
|
+
if (copied) {
|
|
1170
|
+
canvas_native_webgl2_uniform_matrix3x2fv(
|
|
1171
|
+
location->GetUniformLocation(),
|
|
1172
|
+
transpose,
|
|
1173
|
+
buf.data(), buf.size(),
|
|
1174
|
+
ptr->GetState()
|
|
1175
|
+
);
|
|
1176
|
+
}
|
|
1177
|
+
}
|
|
1178
|
+
|
|
1179
|
+
}
|
|
1180
|
+
|
|
234
1181
|
static void UniformMatrix3x4fv(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
235
1182
|
|
|
1183
|
+
|
|
1184
|
+
static void
|
|
1185
|
+
FastUniformMatrix3x4fv(v8::Local<v8::Object> receiver_obj, v8::Local<v8::Object> location_obj,
|
|
1186
|
+
bool transpose, const v8::FastApiTypedArray<float> &data_value) {
|
|
1187
|
+
WebGL2RenderingContext *ptr = GetPointer(receiver_obj);
|
|
1188
|
+
if (ptr == nullptr) {
|
|
1189
|
+
return;
|
|
1190
|
+
}
|
|
1191
|
+
|
|
1192
|
+
auto type = GetNativeType(location_obj);
|
|
1193
|
+
if (type == NativeType::WebGLUniformLocation) {
|
|
1194
|
+
auto location = WebGLUniformLocation::GetPointer(location_obj);
|
|
1195
|
+
auto size = data_value.length();
|
|
1196
|
+
float *data;
|
|
1197
|
+
data_value.getStorageIfAligned(&data);
|
|
1198
|
+
|
|
1199
|
+
canvas_native_webgl2_uniform_matrix3x4fv(
|
|
1200
|
+
location->GetUniformLocation(),
|
|
1201
|
+
transpose,
|
|
1202
|
+
data, size,
|
|
1203
|
+
ptr->GetState()
|
|
1204
|
+
);
|
|
1205
|
+
}
|
|
1206
|
+
|
|
1207
|
+
}
|
|
1208
|
+
|
|
1209
|
+
static void
|
|
1210
|
+
FastUniformMatrix3x4fvArray(v8::Local<v8::Object> receiver_obj,
|
|
1211
|
+
v8::Local<v8::Object> location_obj,
|
|
1212
|
+
bool transpose, v8::Local<v8::Array> data_value) {
|
|
1213
|
+
WebGL2RenderingContext *ptr = GetPointer(receiver_obj);
|
|
1214
|
+
if (ptr == nullptr) {
|
|
1215
|
+
return;
|
|
1216
|
+
}
|
|
1217
|
+
|
|
1218
|
+
auto type = GetNativeType(location_obj);
|
|
1219
|
+
if (type == NativeType::WebGLUniformLocation) {
|
|
1220
|
+
auto location = WebGLUniformLocation::GetPointer(location_obj);
|
|
1221
|
+
|
|
1222
|
+
auto len = data_value->Length();
|
|
1223
|
+
std::vector<float> buf;
|
|
1224
|
+
buf.reserve(len);
|
|
1225
|
+
|
|
1226
|
+
auto copied = v8::TryToCopyAndConvertArrayToCppBuffer<v8::CTypeInfoBuilder<float>::Build().GetId(), float>(
|
|
1227
|
+
data_value, buf.data(), len);
|
|
1228
|
+
|
|
1229
|
+
if (copied) {
|
|
1230
|
+
canvas_native_webgl2_uniform_matrix3x4fv(
|
|
1231
|
+
location->GetUniformLocation(),
|
|
1232
|
+
transpose,
|
|
1233
|
+
buf.data(), buf.size(),
|
|
1234
|
+
ptr->GetState()
|
|
1235
|
+
);
|
|
1236
|
+
}
|
|
1237
|
+
}
|
|
1238
|
+
|
|
1239
|
+
}
|
|
1240
|
+
|
|
1241
|
+
|
|
236
1242
|
static void UniformMatrix4x2fv(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
237
1243
|
|
|
1244
|
+
static void
|
|
1245
|
+
FastUniformMatrix4x2fv(v8::Local<v8::Object> receiver_obj, v8::Local<v8::Object> location_obj,
|
|
1246
|
+
bool transpose, const v8::FastApiTypedArray<float> &data_value) {
|
|
1247
|
+
WebGL2RenderingContext *ptr = GetPointer(receiver_obj);
|
|
1248
|
+
if (ptr == nullptr) {
|
|
1249
|
+
return;
|
|
1250
|
+
}
|
|
1251
|
+
|
|
1252
|
+
auto type = GetNativeType(location_obj);
|
|
1253
|
+
if (type == NativeType::WebGLUniformLocation) {
|
|
1254
|
+
auto location = WebGLUniformLocation::GetPointer(location_obj);
|
|
1255
|
+
auto size = data_value.length();
|
|
1256
|
+
float *data;
|
|
1257
|
+
data_value.getStorageIfAligned(&data);
|
|
1258
|
+
|
|
1259
|
+
canvas_native_webgl2_uniform_matrix4x2fv(
|
|
1260
|
+
location->GetUniformLocation(),
|
|
1261
|
+
transpose,
|
|
1262
|
+
data, size,
|
|
1263
|
+
ptr->GetState()
|
|
1264
|
+
);
|
|
1265
|
+
}
|
|
1266
|
+
|
|
1267
|
+
}
|
|
1268
|
+
|
|
1269
|
+
static void
|
|
1270
|
+
FastUniformMatrix4x2fvArray(v8::Local<v8::Object> receiver_obj,
|
|
1271
|
+
v8::Local<v8::Object> location_obj,
|
|
1272
|
+
bool transpose, v8::Local<v8::Array> data_value) {
|
|
1273
|
+
WebGL2RenderingContext *ptr = GetPointer(receiver_obj);
|
|
1274
|
+
if (ptr == nullptr) {
|
|
1275
|
+
return;
|
|
1276
|
+
}
|
|
1277
|
+
|
|
1278
|
+
auto type = GetNativeType(location_obj);
|
|
1279
|
+
if (type == NativeType::WebGLUniformLocation) {
|
|
1280
|
+
auto location = WebGLUniformLocation::GetPointer(location_obj);
|
|
1281
|
+
|
|
1282
|
+
auto len = data_value->Length();
|
|
1283
|
+
std::vector<float> buf;
|
|
1284
|
+
buf.reserve(len);
|
|
1285
|
+
|
|
1286
|
+
auto copied = v8::TryToCopyAndConvertArrayToCppBuffer<v8::CTypeInfoBuilder<float>::Build().GetId(), float>(
|
|
1287
|
+
data_value, buf.data(), len);
|
|
1288
|
+
|
|
1289
|
+
if (copied) {
|
|
1290
|
+
canvas_native_webgl2_uniform_matrix4x2fv(
|
|
1291
|
+
location->GetUniformLocation(),
|
|
1292
|
+
transpose,
|
|
1293
|
+
buf.data(), buf.size(),
|
|
1294
|
+
ptr->GetState()
|
|
1295
|
+
);
|
|
1296
|
+
}
|
|
1297
|
+
}
|
|
1298
|
+
|
|
1299
|
+
}
|
|
1300
|
+
|
|
238
1301
|
static void UniformMatrix4x3fv(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
239
1302
|
|
|
1303
|
+
|
|
1304
|
+
static void
|
|
1305
|
+
FastUniformMatrix4x3fv(v8::Local<v8::Object> receiver_obj, v8::Local<v8::Object> location_obj,
|
|
1306
|
+
bool transpose, const v8::FastApiTypedArray<float> &data_value) {
|
|
1307
|
+
WebGL2RenderingContext *ptr = GetPointer(receiver_obj);
|
|
1308
|
+
if (ptr == nullptr) {
|
|
1309
|
+
return;
|
|
1310
|
+
}
|
|
1311
|
+
|
|
1312
|
+
auto type = GetNativeType(location_obj);
|
|
1313
|
+
if (type == NativeType::WebGLUniformLocation) {
|
|
1314
|
+
auto location = WebGLUniformLocation::GetPointer(location_obj);
|
|
1315
|
+
auto size = data_value.length();
|
|
1316
|
+
float *data;
|
|
1317
|
+
data_value.getStorageIfAligned(&data);
|
|
1318
|
+
|
|
1319
|
+
canvas_native_webgl2_uniform_matrix4x3fv(
|
|
1320
|
+
location->GetUniformLocation(),
|
|
1321
|
+
transpose,
|
|
1322
|
+
data, size,
|
|
1323
|
+
ptr->GetState()
|
|
1324
|
+
);
|
|
1325
|
+
}
|
|
1326
|
+
|
|
1327
|
+
}
|
|
1328
|
+
|
|
1329
|
+
static void
|
|
1330
|
+
FastUniformMatrix4x3fvArray(v8::Local<v8::Object> receiver_obj,
|
|
1331
|
+
v8::Local<v8::Object> location_obj,
|
|
1332
|
+
bool transpose, v8::Local<v8::Array> data_value) {
|
|
1333
|
+
WebGL2RenderingContext *ptr = GetPointer(receiver_obj);
|
|
1334
|
+
if (ptr == nullptr) {
|
|
1335
|
+
return;
|
|
1336
|
+
}
|
|
1337
|
+
|
|
1338
|
+
auto type = GetNativeType(location_obj);
|
|
1339
|
+
if (type == NativeType::WebGLUniformLocation) {
|
|
1340
|
+
auto location = WebGLUniformLocation::GetPointer(location_obj);
|
|
1341
|
+
|
|
1342
|
+
auto len = data_value->Length();
|
|
1343
|
+
std::vector<float> buf;
|
|
1344
|
+
buf.reserve(len);
|
|
1345
|
+
|
|
1346
|
+
auto copied = v8::TryToCopyAndConvertArrayToCppBuffer<v8::CTypeInfoBuilder<float>::Build().GetId(), float>(
|
|
1347
|
+
data_value, buf.data(), len);
|
|
1348
|
+
|
|
1349
|
+
if (copied) {
|
|
1350
|
+
canvas_native_webgl2_uniform_matrix4x3fv(
|
|
1351
|
+
location->GetUniformLocation(),
|
|
1352
|
+
transpose,
|
|
1353
|
+
buf.data(), buf.size(),
|
|
1354
|
+
ptr->GetState()
|
|
1355
|
+
);
|
|
1356
|
+
}
|
|
1357
|
+
}
|
|
1358
|
+
|
|
1359
|
+
}
|
|
1360
|
+
|
|
240
1361
|
static void VertexAttribDivisor(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
241
1362
|
|
|
1363
|
+
static void
|
|
1364
|
+
FastVertexAttribDivisor(v8::Local<v8::Object> receiver_obj, uint32_t index, uint32_t divisor) {
|
|
1365
|
+
WebGL2RenderingContext *ptr = GetPointer(receiver_obj);
|
|
1366
|
+
if (ptr == nullptr) {
|
|
1367
|
+
return;
|
|
1368
|
+
}
|
|
1369
|
+
|
|
1370
|
+
canvas_native_webgl2_vertex_attrib_divisor(
|
|
1371
|
+
index,
|
|
1372
|
+
divisor,
|
|
1373
|
+
ptr->GetState()
|
|
1374
|
+
);
|
|
1375
|
+
|
|
1376
|
+
}
|
|
1377
|
+
|
|
242
1378
|
static void VertexAttribI4i(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
243
1379
|
|
|
1380
|
+
static void
|
|
1381
|
+
FastVertexAttribI4i(v8::Local<v8::Object> receiver_obj, int32_t index, int32_t v0, int32_t v1,
|
|
1382
|
+
int32_t v2, int32_t v3) {
|
|
1383
|
+
WebGL2RenderingContext *ptr = GetPointer(receiver_obj);
|
|
1384
|
+
if (ptr == nullptr) {
|
|
1385
|
+
return;
|
|
1386
|
+
}
|
|
1387
|
+
|
|
1388
|
+
|
|
1389
|
+
canvas_native_webgl2_vertex_attrib_i4i(
|
|
1390
|
+
index,
|
|
1391
|
+
v0,
|
|
1392
|
+
v1,
|
|
1393
|
+
v2,
|
|
1394
|
+
v3,
|
|
1395
|
+
ptr->GetState()
|
|
1396
|
+
);
|
|
1397
|
+
|
|
1398
|
+
}
|
|
1399
|
+
|
|
244
1400
|
static void VertexAttribI4iv(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
245
1401
|
|
|
1402
|
+
static void FastVertexAttribI4iv(v8::Local<v8::Object> receiver_obj, uint32_t index,
|
|
1403
|
+
const v8::FastApiTypedArray<int32_t> &data_value) {
|
|
1404
|
+
WebGL2RenderingContext *ptr = GetPointer(receiver_obj);
|
|
1405
|
+
if (ptr == nullptr) {
|
|
1406
|
+
return;
|
|
1407
|
+
}
|
|
1408
|
+
|
|
1409
|
+
auto size = data_value.length();
|
|
1410
|
+
int32_t *data;
|
|
1411
|
+
data_value.getStorageIfAligned(&data);
|
|
1412
|
+
|
|
1413
|
+
canvas_native_webgl2_vertex_attrib_i4iv(
|
|
1414
|
+
index,
|
|
1415
|
+
data, size,
|
|
1416
|
+
ptr->GetState()
|
|
1417
|
+
);
|
|
1418
|
+
|
|
1419
|
+
}
|
|
1420
|
+
|
|
1421
|
+
static void FastVertexAttribI4ivArray(v8::Local<v8::Object> receiver_obj, uint32_t index,
|
|
1422
|
+
v8::Local<v8::Array> data_value) {
|
|
1423
|
+
WebGL2RenderingContext *ptr = GetPointer(receiver_obj);
|
|
1424
|
+
if (ptr == nullptr) {
|
|
1425
|
+
return;
|
|
1426
|
+
}
|
|
1427
|
+
|
|
1428
|
+
auto len = data_value->Length();
|
|
1429
|
+
std::vector<int32_t> buf;
|
|
1430
|
+
buf.reserve(len);
|
|
1431
|
+
|
|
1432
|
+
auto copied = v8::TryToCopyAndConvertArrayToCppBuffer<v8::CTypeInfoBuilder<int32_t>::Build().GetId(), int32_t>(
|
|
1433
|
+
data_value, buf.data(), len);
|
|
1434
|
+
|
|
1435
|
+
|
|
1436
|
+
if (copied) {
|
|
1437
|
+
canvas_native_webgl2_vertex_attrib_i4iv(
|
|
1438
|
+
index,
|
|
1439
|
+
buf.data(), buf.size(),
|
|
1440
|
+
ptr->GetState()
|
|
1441
|
+
);
|
|
1442
|
+
}
|
|
1443
|
+
|
|
1444
|
+
}
|
|
1445
|
+
|
|
246
1446
|
static void VertexAttribI4ui(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
247
1447
|
|
|
1448
|
+
static void
|
|
1449
|
+
FastVertexAttribI4ui(v8::Local<v8::Object> receiver_obj, uint32_t index, uint32_t v0,
|
|
1450
|
+
uint32_t v1,
|
|
1451
|
+
uint32_t v2, uint32_t v3) {
|
|
1452
|
+
WebGL2RenderingContext *ptr = GetPointer(receiver_obj);
|
|
1453
|
+
if (ptr == nullptr) {
|
|
1454
|
+
return;
|
|
1455
|
+
}
|
|
1456
|
+
|
|
1457
|
+
|
|
1458
|
+
canvas_native_webgl2_vertex_attrib_i4ui(
|
|
1459
|
+
index,
|
|
1460
|
+
v0,
|
|
1461
|
+
v1,
|
|
1462
|
+
v2,
|
|
1463
|
+
v3,
|
|
1464
|
+
ptr->GetState()
|
|
1465
|
+
);
|
|
1466
|
+
|
|
1467
|
+
}
|
|
1468
|
+
|
|
248
1469
|
static void VertexAttribI4uiv(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
249
1470
|
|
|
1471
|
+
|
|
1472
|
+
static void FastVertexAttribI4uiv(v8::Local<v8::Object> receiver_obj, uint32_t index,
|
|
1473
|
+
const v8::FastApiTypedArray<uint32_t> &data_value) {
|
|
1474
|
+
WebGL2RenderingContext *ptr = GetPointer(receiver_obj);
|
|
1475
|
+
if (ptr == nullptr) {
|
|
1476
|
+
return;
|
|
1477
|
+
}
|
|
1478
|
+
|
|
1479
|
+
auto size = data_value.length();
|
|
1480
|
+
uint32_t *data;
|
|
1481
|
+
data_value.getStorageIfAligned(&data);
|
|
1482
|
+
|
|
1483
|
+
canvas_native_webgl2_vertex_attrib_i4uiv(
|
|
1484
|
+
index,
|
|
1485
|
+
data, size,
|
|
1486
|
+
ptr->GetState()
|
|
1487
|
+
);
|
|
1488
|
+
|
|
1489
|
+
}
|
|
1490
|
+
|
|
1491
|
+
static void FastVertexAttribI4uivArray(v8::Local<v8::Object> receiver_obj, uint32_t index,
|
|
1492
|
+
v8::Local<v8::Array> data_value) {
|
|
1493
|
+
WebGL2RenderingContext *ptr = GetPointer(receiver_obj);
|
|
1494
|
+
if (ptr == nullptr) {
|
|
1495
|
+
return;
|
|
1496
|
+
}
|
|
1497
|
+
|
|
1498
|
+
auto len = data_value->Length();
|
|
1499
|
+
std::vector<uint32_t> buf;
|
|
1500
|
+
buf.reserve(len);
|
|
1501
|
+
|
|
1502
|
+
auto copied = v8::TryToCopyAndConvertArrayToCppBuffer<v8::CTypeInfoBuilder<uint32_t>::Build().GetId(), uint32_t>(
|
|
1503
|
+
data_value, buf.data(), len);
|
|
1504
|
+
|
|
1505
|
+
|
|
1506
|
+
if (copied) {
|
|
1507
|
+
canvas_native_webgl2_vertex_attrib_i4uiv(
|
|
1508
|
+
index,
|
|
1509
|
+
buf.data(), buf.size(),
|
|
1510
|
+
ptr->GetState()
|
|
1511
|
+
);
|
|
1512
|
+
}
|
|
1513
|
+
|
|
1514
|
+
}
|
|
1515
|
+
|
|
250
1516
|
};
|