@nativescript/canvas 2.0.0-alpha.21 → 2.0.0-alpha.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Canvas/index.android.js +1 -3
- package/Canvas/index.android.js.map +1 -1
- package/WebGL/WebGLRenderingContext/index.js.map +1 -1
- package/package.json +1 -1
- package/platforms/android/canvas-release.aar +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/dSYMs/CanvasNative.framework.dSYM/Contents/Resources/DWARF/CanvasNative +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/dSYMs/CanvasNative.framework.dSYM/Contents/Resources/DWARF/CanvasNative +0 -0
- package/platforms/ios/src/cpp/canvas2d/CanvasRenderingContext2DImpl.cpp +291 -302
- package/platforms/ios/src/cpp/webgl/WebGLRenderingContext.cpp +1059 -1293
- package/platforms/ios/src/cpp/webgl2/WebGL2RenderingContext.cpp +859 -996
|
@@ -748,7 +748,7 @@ void WebGL2RenderingContext::DeleteSampler(const v8::FunctionCallbackInfo<v8::Va
|
|
|
748
748
|
}
|
|
749
749
|
|
|
750
750
|
auto isolate = args.GetIsolate();
|
|
751
|
-
|
|
751
|
+
|
|
752
752
|
|
|
753
753
|
auto samplerValue = args[0];
|
|
754
754
|
auto type = GetNativeType(isolate, samplerValue);
|
|
@@ -772,7 +772,7 @@ void WebGL2RenderingContext::DeleteSync(const v8::FunctionCallbackInfo<v8::Value
|
|
|
772
772
|
}
|
|
773
773
|
|
|
774
774
|
auto isolate = args.GetIsolate();
|
|
775
|
-
|
|
775
|
+
|
|
776
776
|
|
|
777
777
|
auto syncValue = args[0];
|
|
778
778
|
auto type = GetNativeType(isolate, syncValue);
|
|
@@ -796,7 +796,7 @@ WebGL2RenderingContext::DeleteTransformFeedback(const v8::FunctionCallbackInfo<v
|
|
|
796
796
|
}
|
|
797
797
|
|
|
798
798
|
auto isolate = args.GetIsolate();
|
|
799
|
-
|
|
799
|
+
|
|
800
800
|
|
|
801
801
|
auto transformFeedbackValue = args[0];
|
|
802
802
|
auto type = GetNativeType(isolate, transformFeedbackValue);
|
|
@@ -820,7 +820,7 @@ void WebGL2RenderingContext::DeleteVertexArray(const v8::FunctionCallbackInfo<v8
|
|
|
820
820
|
}
|
|
821
821
|
|
|
822
822
|
auto isolate = args.GetIsolate();
|
|
823
|
-
|
|
823
|
+
|
|
824
824
|
|
|
825
825
|
auto vertexArrayValue = args[0];
|
|
826
826
|
auto type = GetNativeType(isolate, vertexArrayValue);
|
|
@@ -845,21 +845,19 @@ void WebGL2RenderingContext::DrawArraysInstanced(const v8::FunctionCallbackInfo<
|
|
|
845
845
|
auto isolate = args.GetIsolate();
|
|
846
846
|
auto context = isolate->GetCurrentContext();
|
|
847
847
|
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
);
|
|
848
|
+
auto mode = (uint32_t) args[0]->NumberValue(context).ToChecked();
|
|
849
|
+
auto first = (int32_t) args[1]->NumberValue(context).ToChecked();
|
|
850
|
+
auto count_ = (int32_t) args[2]->NumberValue(context).ToChecked();
|
|
851
|
+
auto instanceCount = (int32_t) args[3]->NumberValue(context).ToChecked();
|
|
852
|
+
canvas_native_webgl2_draw_arrays_instanced(
|
|
853
|
+
mode,
|
|
854
|
+
first,
|
|
855
|
+
count_,
|
|
856
|
+
instanceCount,
|
|
857
|
+
ptr->GetState()
|
|
858
|
+
);
|
|
860
859
|
|
|
861
|
-
|
|
862
|
-
}
|
|
860
|
+
ptr->UpdateInvalidateState();
|
|
863
861
|
}
|
|
864
862
|
|
|
865
863
|
void WebGL2RenderingContext::DrawBuffers(const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
@@ -900,23 +898,21 @@ WebGL2RenderingContext::DrawElementsInstanced(const v8::FunctionCallbackInfo<v8:
|
|
|
900
898
|
auto isolate = args.GetIsolate();
|
|
901
899
|
auto context = isolate->GetCurrentContext();
|
|
902
900
|
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
);
|
|
901
|
+
auto mode = (uint32_t) args[0]->NumberValue(context).ToChecked();
|
|
902
|
+
auto count_ = (int32_t) args[1]->NumberValue(context).ToChecked();
|
|
903
|
+
auto type = (uint32_t) args[2]->NumberValue(context).ToChecked();
|
|
904
|
+
auto offset = args[3]->NumberValue(context).ToChecked();
|
|
905
|
+
auto instanceCount = (int32_t) args[4]->NumberValue(context).ToChecked();
|
|
906
|
+
canvas_native_webgl2_draw_elements_instanced(
|
|
907
|
+
mode,
|
|
908
|
+
count_,
|
|
909
|
+
type,
|
|
910
|
+
static_cast<ssize_t>(offset),
|
|
911
|
+
instanceCount,
|
|
912
|
+
ptr->GetState()
|
|
913
|
+
);
|
|
917
914
|
|
|
918
|
-
|
|
919
|
-
}
|
|
915
|
+
ptr->UpdateInvalidateState();
|
|
920
916
|
}
|
|
921
917
|
|
|
922
918
|
void WebGL2RenderingContext::DrawRangeElements(const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
@@ -928,25 +924,23 @@ void WebGL2RenderingContext::DrawRangeElements(const v8::FunctionCallbackInfo<v8
|
|
|
928
924
|
auto isolate = args.GetIsolate();
|
|
929
925
|
auto context = isolate->GetCurrentContext();
|
|
930
926
|
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
);
|
|
927
|
+
auto mode = (uint32_t) args[0]->NumberValue(context).ToChecked();
|
|
928
|
+
auto start = (uint32_t) args[1]->NumberValue(context).ToChecked();
|
|
929
|
+
auto end = (uint32_t) args[2]->NumberValue(context).ToChecked();
|
|
930
|
+
auto count_ = (int32_t) args[3]->NumberValue(context).ToChecked();
|
|
931
|
+
auto type = (uint32_t) args[4]->NumberValue(context).ToChecked();
|
|
932
|
+
auto offset = args[5]->NumberValue(context).ToChecked();
|
|
933
|
+
canvas_native_webgl2_draw_range_elements(
|
|
934
|
+
mode,
|
|
935
|
+
start,
|
|
936
|
+
end,
|
|
937
|
+
count_,
|
|
938
|
+
type,
|
|
939
|
+
static_cast<ssize_t>(offset),
|
|
940
|
+
ptr->GetState()
|
|
941
|
+
);
|
|
947
942
|
|
|
948
|
-
|
|
949
|
-
}
|
|
943
|
+
ptr->UpdateInvalidateState();
|
|
950
944
|
}
|
|
951
945
|
|
|
952
946
|
void WebGL2RenderingContext::EndQuery(const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
@@ -972,7 +966,7 @@ void WebGL2RenderingContext::EndTransformFeedback(const v8::FunctionCallbackInfo
|
|
|
972
966
|
}
|
|
973
967
|
|
|
974
968
|
auto isolate = args.GetIsolate();
|
|
975
|
-
|
|
969
|
+
|
|
976
970
|
|
|
977
971
|
canvas_native_webgl2_end_transform_feedback(
|
|
978
972
|
ptr->GetState());
|
|
@@ -988,18 +982,16 @@ void WebGL2RenderingContext::FenceSync(const v8::FunctionCallbackInfo<v8::Value>
|
|
|
988
982
|
auto isolate = args.GetIsolate();
|
|
989
983
|
auto context = isolate->GetCurrentContext();
|
|
990
984
|
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
auto ret = WebGLSyncImpl::NewInstance(isolate, new WebGLSyncImpl(std::move(sync)));
|
|
985
|
+
auto condition = (uint32_t) args[0]->NumberValue(context).ToChecked();
|
|
986
|
+
auto flags = (uint32_t) args[1]->NumberValue(context).ToChecked();
|
|
987
|
+
auto sync = canvas_native_webgl2_fence_sync(
|
|
988
|
+
condition,
|
|
989
|
+
flags,
|
|
990
|
+
ptr->GetState()
|
|
991
|
+
);
|
|
992
|
+
auto ret = WebGLSyncImpl::NewInstance(isolate, new WebGLSyncImpl(sync));
|
|
1000
993
|
|
|
1001
|
-
|
|
1002
|
-
}
|
|
994
|
+
args.GetReturnValue().Set(ret);
|
|
1003
995
|
}
|
|
1004
996
|
|
|
1005
997
|
void
|
|
@@ -1016,7 +1008,7 @@ WebGL2RenderingContext::FramebufferTextureLayer(const v8::FunctionCallbackInfo<v
|
|
|
1016
1008
|
|
|
1017
1009
|
auto textureValue = args[2];
|
|
1018
1010
|
auto type = GetNativeType(isolate, textureValue);
|
|
1019
|
-
if (
|
|
1011
|
+
if (type == NativeType::WebGLTexture) {
|
|
1020
1012
|
auto target = (uint32_t) args[0]->NumberValue(context).ToChecked();
|
|
1021
1013
|
auto attachment = (uint32_t) args[1]->NumberValue(context).ToChecked();
|
|
1022
1014
|
auto texture = WebGLTexture::GetPointer(textureValue.As<v8::Object>());
|
|
@@ -1081,7 +1073,7 @@ void WebGL2RenderingContext::GetActiveUniformBlockParameter(
|
|
|
1081
1073
|
auto programValue = args[0];
|
|
1082
1074
|
auto type = GetNativeType(isolate, programValue);
|
|
1083
1075
|
|
|
1084
|
-
if (
|
|
1076
|
+
if (type == NativeType::WebGLProgram) {
|
|
1085
1077
|
auto program = WebGLProgram::GetPointer(programValue.As<v8::Object>());
|
|
1086
1078
|
|
|
1087
1079
|
if (program != nullptr) {
|
|
@@ -1154,7 +1146,7 @@ void WebGL2RenderingContext::GetActiveUniforms(const v8::FunctionCallbackInfo<v8
|
|
|
1154
1146
|
|
|
1155
1147
|
auto programValue = args[0];
|
|
1156
1148
|
auto type = GetNativeType(isolate, programValue);
|
|
1157
|
-
if (
|
|
1149
|
+
if (type == NativeType::WebGLProgram) {
|
|
1158
1150
|
|
|
1159
1151
|
auto program = WebGLProgram::GetPointer(programValue.As<v8::Object>());
|
|
1160
1152
|
auto uniformIndicesObject = args[1];
|
|
@@ -1184,14 +1176,14 @@ void WebGL2RenderingContext::GetActiveUniforms(const v8::FunctionCallbackInfo<v8
|
|
|
1184
1176
|
auto value = canvas_native_webgl_result_get_u32_array(
|
|
1185
1177
|
ret);
|
|
1186
1178
|
auto len = canvas_native_u32_buffer_get_length(value);
|
|
1187
|
-
auto
|
|
1179
|
+
auto buffer = canvas_native_u32_buffer_get_bytes(value);
|
|
1188
1180
|
|
|
1189
1181
|
auto array = v8::Array::New(
|
|
1190
1182
|
isolate, (int) len);
|
|
1191
1183
|
|
|
1192
1184
|
for (int j = 0;
|
|
1193
1185
|
j < len; ++j) {
|
|
1194
|
-
auto item =
|
|
1186
|
+
auto item = buffer[j];
|
|
1195
1187
|
array->Set(
|
|
1196
1188
|
context, j,
|
|
1197
1189
|
v8::Number::New(isolate, (double) item));
|
|
@@ -1208,12 +1200,12 @@ void WebGL2RenderingContext::GetActiveUniforms(const v8::FunctionCallbackInfo<v8
|
|
|
1208
1200
|
auto value = canvas_native_webgl_result_get_i32_array(
|
|
1209
1201
|
ret);
|
|
1210
1202
|
auto len = canvas_native_i32_buffer_get_length(value);
|
|
1211
|
-
auto
|
|
1203
|
+
auto buffer = canvas_native_i32_buffer_get_bytes(value);
|
|
1212
1204
|
auto array = v8::Array::New(
|
|
1213
1205
|
isolate, (int) len);
|
|
1214
1206
|
for (int j = 0;
|
|
1215
1207
|
j < len; ++j) {
|
|
1216
|
-
auto item =
|
|
1208
|
+
auto item = buffer[j];
|
|
1217
1209
|
array->Set(
|
|
1218
1210
|
context, j,
|
|
1219
1211
|
v8::Number::New(isolate,
|
|
@@ -1228,14 +1220,14 @@ void WebGL2RenderingContext::GetActiveUniforms(const v8::FunctionCallbackInfo<v8
|
|
|
1228
1220
|
auto value = canvas_native_webgl_result_get_bool_array(
|
|
1229
1221
|
ret);
|
|
1230
1222
|
auto len = canvas_native_u8_buffer_get_length(value);
|
|
1231
|
-
auto
|
|
1223
|
+
auto buffer = canvas_native_u8_buffer_get_bytes(value);
|
|
1232
1224
|
auto array = v8::Array::New(
|
|
1233
1225
|
isolate,
|
|
1234
1226
|
(int) len);
|
|
1235
1227
|
for (int j = 0;
|
|
1236
1228
|
j < len; ++j) {
|
|
1237
1229
|
bool item =
|
|
1238
|
-
|
|
1230
|
+
buffer[j] == 1;
|
|
1239
1231
|
array->Set(
|
|
1240
1232
|
context, j,
|
|
1241
1233
|
v8::Boolean::New(isolate, item));
|
|
@@ -1267,50 +1259,46 @@ void WebGL2RenderingContext::GetBufferSubData(const v8::FunctionCallbackInfo<v8:
|
|
|
1267
1259
|
auto context = isolate->GetCurrentContext();
|
|
1268
1260
|
|
|
1269
1261
|
auto dstDataObject = args[2];
|
|
1270
|
-
if (
|
|
1271
|
-
dstDataObject->IsObject()) {
|
|
1262
|
+
if (dstDataObject->IsArrayBufferView()) {
|
|
1272
1263
|
auto target = (uint32_t) args[0]->NumberValue(context).ToChecked();
|
|
1273
1264
|
auto srcByteOffset = args[1]->NumberValue(context).ToChecked();
|
|
1274
1265
|
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
auto array = dstDataObject.As<v8::ArrayBufferView>();
|
|
1278
|
-
|
|
1279
|
-
auto buf = array->Buffer();
|
|
1280
|
-
auto offset = array->ByteOffset();
|
|
1281
|
-
auto size = buf->ByteLength();
|
|
1282
|
-
auto data = reinterpret_cast<uint8_t *>(buf->GetBackingStore()->Data()) + offset;
|
|
1266
|
+
auto array = dstDataObject.As<v8::ArrayBufferView>();
|
|
1283
1267
|
|
|
1268
|
+
auto buf = array->Buffer();
|
|
1269
|
+
auto offset = array->ByteOffset();
|
|
1270
|
+
auto size = buf->ByteLength();
|
|
1271
|
+
auto data = reinterpret_cast<uint8_t *>(buf->GetBackingStore()->Data()) + offset;
|
|
1284
1272
|
|
|
1285
1273
|
|
|
1286
|
-
auto BYTES_PER_ELEMENT = (ssize_t) array->Get(
|
|
1287
|
-
context,
|
|
1288
|
-
ConvertToV8String(isolate, "BYTES_PER_ELEMENT")).ToLocalChecked()->NumberValue(
|
|
1289
|
-
context).ToChecked();
|
|
1290
1274
|
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
BYTES_PER_ELEMENT;
|
|
1296
|
-
}
|
|
1275
|
+
auto BYTES_PER_ELEMENT = (ssize_t) array->Get(
|
|
1276
|
+
context,
|
|
1277
|
+
ConvertToV8String(isolate, "BYTES_PER_ELEMENT")).ToLocalChecked()->NumberValue(
|
|
1278
|
+
context).ToChecked();
|
|
1297
1279
|
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1280
|
+
ssize_t dstOffsetValue = 0;
|
|
1281
|
+
if (args[3]->IsNumber()) {
|
|
1282
|
+
dstOffsetValue =
|
|
1283
|
+
static_cast<ssize_t>(args[3]->NumberValue(context).ToChecked()) *
|
|
1284
|
+
BYTES_PER_ELEMENT;
|
|
1285
|
+
}
|
|
1304
1286
|
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
lengthValue,
|
|
1311
|
-
ptr->GetState()
|
|
1312
|
-
);
|
|
1287
|
+
ssize_t lengthValue = 0;
|
|
1288
|
+
if (args[4]->IsNumber()) {
|
|
1289
|
+
lengthValue =
|
|
1290
|
+
static_cast<ssize_t>(args[4]->NumberValue(context).ToChecked()) *
|
|
1291
|
+
BYTES_PER_ELEMENT;
|
|
1313
1292
|
}
|
|
1293
|
+
|
|
1294
|
+
canvas_native_webgl2_get_buffer_sub_data(
|
|
1295
|
+
target,
|
|
1296
|
+
static_cast<ssize_t>(srcByteOffset),
|
|
1297
|
+
data, size,
|
|
1298
|
+
dstOffsetValue,
|
|
1299
|
+
lengthValue,
|
|
1300
|
+
ptr->GetState()
|
|
1301
|
+
);
|
|
1314
1302
|
}
|
|
1315
1303
|
}
|
|
1316
1304
|
|
|
@@ -1357,41 +1345,38 @@ void WebGL2RenderingContext::GetIndexedParameter(const v8::FunctionCallbackInfo<
|
|
|
1357
1345
|
auto isolate = args.GetIsolate();
|
|
1358
1346
|
auto context = isolate->GetCurrentContext();
|
|
1359
1347
|
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
);
|
|
1348
|
+
auto target = (uint32_t) args[0]->NumberValue(context).ToChecked();
|
|
1349
|
+
auto index = (uint32_t) args[1]->NumberValue(context).ToChecked();
|
|
1350
|
+
auto ret = canvas_native_webgl2_get_indexed_parameter(
|
|
1351
|
+
target,
|
|
1352
|
+
index,
|
|
1353
|
+
ptr->GetState()
|
|
1354
|
+
);
|
|
1368
1355
|
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1356
|
+
switch (target) {
|
|
1357
|
+
case GL_UNIFORM_BUFFER_BINDING:
|
|
1358
|
+
case GL_TRANSFORM_FEEDBACK_BUFFER_BINDING: {
|
|
1359
|
+
auto buffer = canvas_native_webgl2_indexed_parameter_get_buffer_value(
|
|
1360
|
+
ret);
|
|
1374
1361
|
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
}
|
|
1388
|
-
break;
|
|
1389
|
-
default:
|
|
1390
|
-
args.GetReturnValue().SetNull();
|
|
1391
|
-
return;
|
|
1362
|
+
args.GetReturnValue().Set(
|
|
1363
|
+
WebGLBuffer::NewInstance(isolate, new WebGLBuffer(buffer)));
|
|
1364
|
+
}
|
|
1365
|
+
return;
|
|
1366
|
+
case GL_TRANSFORM_FEEDBACK_BUFFER_SIZE:
|
|
1367
|
+
case GL_TRANSFORM_FEEDBACK_BUFFER_START:
|
|
1368
|
+
case GL_UNIFORM_BUFFER_SIZE:
|
|
1369
|
+
case GL_UNIFORM_BUFFER_START: {
|
|
1370
|
+
auto value = canvas_native_webgl2_indexed_parameter_get_value(
|
|
1371
|
+
ret);
|
|
1372
|
+
args.GetReturnValue().Set(static_cast<double>(value));
|
|
1373
|
+
return;
|
|
1392
1374
|
}
|
|
1375
|
+
break;
|
|
1376
|
+
default:
|
|
1377
|
+
args.GetReturnValue().SetNull();
|
|
1378
|
+
return;
|
|
1393
1379
|
}
|
|
1394
|
-
args.GetReturnValue().SetNull();
|
|
1395
1380
|
}
|
|
1396
1381
|
|
|
1397
1382
|
void WebGL2RenderingContext::GetInternalformatParameter(
|
|
@@ -1405,102 +1390,99 @@ void WebGL2RenderingContext::GetInternalformatParameter(
|
|
|
1405
1390
|
auto isolate = args.GetIsolate();
|
|
1406
1391
|
auto context = isolate->GetCurrentContext();
|
|
1407
1392
|
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
return;
|
|
1439
|
-
}
|
|
1440
|
-
case GL_R8:
|
|
1441
|
-
case GL_RG8:
|
|
1442
|
-
case GL_RGB565:
|
|
1443
|
-
case GL_RGBA8:
|
|
1444
|
-
case GL_SRGB8_ALPHA8:
|
|
1445
|
-
case GL_RGB5_A1:
|
|
1446
|
-
case GL_RGBA4:
|
|
1447
|
-
case GL_RGB10_A2:
|
|
1448
|
-
case GL_DEPTH_COMPONENT16:
|
|
1449
|
-
case GL_DEPTH_COMPONENT24:
|
|
1450
|
-
case GL_DEPTH_COMPONENT32F:
|
|
1451
|
-
case GL_DEPTH24_STENCIL8:
|
|
1452
|
-
case GL_DEPTH32F_STENCIL8:
|
|
1453
|
-
case GL_STENCIL_INDEX8:
|
|
1454
|
-
// noop
|
|
1455
|
-
break;
|
|
1456
|
-
case GL_R16F:
|
|
1457
|
-
case GL_RG16F:
|
|
1458
|
-
case GL_R32F:
|
|
1459
|
-
case GL_RG32F:
|
|
1460
|
-
case GL_RGBA32F:
|
|
1461
|
-
case GL_R11F_G11F_B10F:
|
|
1462
|
-
// noop
|
|
1463
|
-
break;
|
|
1464
|
-
default:
|
|
1465
|
-
args.GetReturnValue().SetNull();
|
|
1466
|
-
return;
|
|
1393
|
+
auto target = (uint32_t) args[0]->NumberValue(context).ToChecked();
|
|
1394
|
+
auto internalformat = (uint32_t) args[1]->NumberValue(context).ToChecked();
|
|
1395
|
+
auto pname = (uint32_t) args[2]->NumberValue(context).ToChecked();
|
|
1396
|
+
switch (internalformat) {
|
|
1397
|
+
case GL_RGB:
|
|
1398
|
+
case GL_RGBA:
|
|
1399
|
+
case GL_R8UI:
|
|
1400
|
+
case GL_R8I:
|
|
1401
|
+
case GL_R16UI:
|
|
1402
|
+
case GL_R16I:
|
|
1403
|
+
case GL_R32UI:
|
|
1404
|
+
case GL_R32I:
|
|
1405
|
+
case GL_RG8UI:
|
|
1406
|
+
case GL_RG8I:
|
|
1407
|
+
case GL_RG16UI:
|
|
1408
|
+
case GL_RG16I:
|
|
1409
|
+
case GL_RG32UI:
|
|
1410
|
+
case GL_RG32I:
|
|
1411
|
+
case GL_RGBA8UI:
|
|
1412
|
+
case GL_RGBA8I:
|
|
1413
|
+
case GL_RGB10_A2UI:
|
|
1414
|
+
case GL_RGBA16UI:
|
|
1415
|
+
case GL_RGBA16I:
|
|
1416
|
+
case GL_RGBA32UI:
|
|
1417
|
+
case GL_RGBA32I: {
|
|
1418
|
+
// empty
|
|
1419
|
+
auto arraybuffer = v8::ArrayBuffer::New(isolate, 0);
|
|
1420
|
+
|
|
1421
|
+
args.GetReturnValue().Set(v8::Int32Array::New(arraybuffer, 0, 0));
|
|
1422
|
+
return;
|
|
1467
1423
|
}
|
|
1424
|
+
case GL_R8:
|
|
1425
|
+
case GL_RG8:
|
|
1426
|
+
case GL_RGB565:
|
|
1427
|
+
case GL_RGBA8:
|
|
1428
|
+
case GL_SRGB8_ALPHA8:
|
|
1429
|
+
case GL_RGB5_A1:
|
|
1430
|
+
case GL_RGBA4:
|
|
1431
|
+
case GL_RGB10_A2:
|
|
1432
|
+
case GL_DEPTH_COMPONENT16:
|
|
1433
|
+
case GL_DEPTH_COMPONENT24:
|
|
1434
|
+
case GL_DEPTH_COMPONENT32F:
|
|
1435
|
+
case GL_DEPTH24_STENCIL8:
|
|
1436
|
+
case GL_DEPTH32F_STENCIL8:
|
|
1437
|
+
case GL_STENCIL_INDEX8:
|
|
1438
|
+
// noop
|
|
1439
|
+
break;
|
|
1440
|
+
case GL_R16F:
|
|
1441
|
+
case GL_RG16F:
|
|
1442
|
+
case GL_R32F:
|
|
1443
|
+
case GL_RG32F:
|
|
1444
|
+
case GL_RGBA32F:
|
|
1445
|
+
case GL_R11F_G11F_B10F:
|
|
1446
|
+
// noop
|
|
1447
|
+
break;
|
|
1448
|
+
default:
|
|
1449
|
+
args.GetReturnValue().SetNull();
|
|
1450
|
+
return;
|
|
1451
|
+
}
|
|
1468
1452
|
|
|
1469
1453
|
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1454
|
+
auto ret = canvas_native_webgl2_get_internalformat_parameter(
|
|
1455
|
+
target,
|
|
1456
|
+
internalformat,
|
|
1457
|
+
pname,
|
|
1458
|
+
ptr->GetState()
|
|
1459
|
+
);
|
|
1476
1460
|
|
|
1477
|
-
|
|
1478
|
-
|
|
1461
|
+
if (pname == GL_SAMPLES) {
|
|
1462
|
+
auto value = canvas_native_webgl_result_get_i32_array(ret);
|
|
1479
1463
|
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1464
|
+
auto buf = (uint8_t*)canvas_native_i32_buffer_get_bytes(value);
|
|
1465
|
+
auto size = canvas_native_i32_buffer_get_length(value);
|
|
1466
|
+
auto bytes_size = size * sizeof(int32_t);
|
|
1483
1467
|
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1468
|
+
auto store = v8::ArrayBuffer::NewBackingStore(buf, bytes_size,
|
|
1469
|
+
[](void *data, size_t length,
|
|
1470
|
+
void *deleter_data) {
|
|
1471
|
+
if (deleter_data != nullptr) {
|
|
1472
|
+
canvas_native_i32_buffer_destroy((I32Buffer *) deleter_data);
|
|
1473
|
+
}
|
|
1474
|
+
},
|
|
1475
|
+
value);
|
|
1492
1476
|
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
}
|
|
1477
|
+
auto arraybuffer = v8::ArrayBuffer::New(isolate, std::move(store));
|
|
1478
|
+
args.GetReturnValue().Set(v8::Int32Array::New(arraybuffer, 0, size));
|
|
1479
|
+
canvas_native_webgl_WebGLResult_destroy(ret);
|
|
1480
|
+
return;
|
|
1481
|
+
} else {
|
|
1482
|
+
args.GetReturnValue().SetNull();
|
|
1483
|
+
canvas_native_webgl_WebGLResult_destroy(ret);
|
|
1484
|
+
return;
|
|
1502
1485
|
}
|
|
1503
|
-
args.GetReturnValue().SetNull();
|
|
1504
1486
|
}
|
|
1505
1487
|
|
|
1506
1488
|
void WebGL2RenderingContext::GetParameter(const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
@@ -1513,33 +1495,29 @@ void WebGL2RenderingContext::GetParameter(const v8::FunctionCallbackInfo<v8::Val
|
|
|
1513
1495
|
auto isolate = args.GetIsolate();
|
|
1514
1496
|
auto context = isolate->GetCurrentContext();
|
|
1515
1497
|
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
result));
|
|
1498
|
+
auto pname = (uint32_t) args[0]->NumberValue(context).ToChecked();
|
|
1499
|
+
auto result = canvas_native_webgl2_get_parameter(
|
|
1500
|
+
pname,
|
|
1501
|
+
ptr->GetState());
|
|
1502
|
+
switch (pname) {
|
|
1503
|
+
case GL_COPY_READ_BUFFER_BINDING:
|
|
1504
|
+
case GL_COPY_WRITE_BUFFER_BINDING:
|
|
1505
|
+
case GL_DRAW_FRAMEBUFFER_BINDING:
|
|
1506
|
+
args.GetReturnValue().Set(canvas_native_webgl_result_get_i32(
|
|
1507
|
+
result));
|
|
1527
1508
|
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1509
|
+
canvas_native_webgl_WebGLResult_destroy(result);
|
|
1510
|
+
return;
|
|
1511
|
+
default: {
|
|
1512
|
+
auto ret = ptr->GetParameterInternal(
|
|
1513
|
+
isolate, pname,result);
|
|
1533
1514
|
|
|
1534
|
-
|
|
1515
|
+
canvas_native_webgl_WebGLResult_destroy(result);
|
|
1535
1516
|
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
}
|
|
1517
|
+
args.GetReturnValue().Set(ret);
|
|
1518
|
+
return;
|
|
1539
1519
|
}
|
|
1540
1520
|
}
|
|
1541
|
-
|
|
1542
|
-
args.GetReturnValue().SetNull();
|
|
1543
1521
|
}
|
|
1544
1522
|
|
|
1545
1523
|
void WebGL2RenderingContext::GetQueryParameter(const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
@@ -1552,37 +1530,34 @@ void WebGL2RenderingContext::GetQueryParameter(const v8::FunctionCallbackInfo<v8
|
|
|
1552
1530
|
auto isolate = args.GetIsolate();
|
|
1553
1531
|
auto context = isolate->GetCurrentContext();
|
|
1554
1532
|
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
auto pname = (uint32_t) args[1]->NumberValue(context).ToChecked();
|
|
1533
|
+
auto queryValue = args[0];
|
|
1534
|
+
auto type = GetNativeType(isolate, queryValue);
|
|
1535
|
+
if (type == NativeType::WebGLQuery) {
|
|
1536
|
+
auto query = WebGLQuery::GetPointer(queryValue.As<v8::Object>());
|
|
1537
|
+
if (query != nullptr) {
|
|
1538
|
+
auto pname = (uint32_t) args[1]->NumberValue(context).ToChecked();
|
|
1562
1539
|
|
|
1563
1540
|
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
canvas_native_webgl_WebGLResult_destroy(ret);
|
|
1572
|
-
return;
|
|
1573
|
-
} else if (pname ==
|
|
1574
|
-
GL_QUERY_RESULT_AVAILABLE) {
|
|
1575
|
-
args.GetReturnValue().Set((int32_t) canvas_native_webgl_result_get_u32(
|
|
1576
|
-
ret));
|
|
1577
|
-
canvas_native_webgl_WebGLResult_destroy(ret);
|
|
1578
|
-
return;
|
|
1579
|
-
}
|
|
1580
|
-
//clean up
|
|
1541
|
+
auto ret = canvas_native_webgl2_get_query_parameter(
|
|
1542
|
+
query->GetQuery(),
|
|
1543
|
+
pname,
|
|
1544
|
+
ptr->GetState());
|
|
1545
|
+
if (pname == GL_QUERY_RESULT) {
|
|
1546
|
+
args.GetReturnValue().Set(canvas_native_webgl_result_get_bool(
|
|
1547
|
+
ret));
|
|
1581
1548
|
canvas_native_webgl_WebGLResult_destroy(ret);
|
|
1582
|
-
|
|
1549
|
+
return;
|
|
1550
|
+
} else if (pname ==
|
|
1551
|
+
GL_QUERY_RESULT_AVAILABLE) {
|
|
1552
|
+
args.GetReturnValue().Set((int32_t) canvas_native_webgl_result_get_u32(
|
|
1553
|
+
ret));
|
|
1554
|
+
canvas_native_webgl_WebGLResult_destroy(ret);
|
|
1555
|
+
return;
|
|
1583
1556
|
}
|
|
1584
|
-
|
|
1557
|
+
//clean up
|
|
1558
|
+
canvas_native_webgl_WebGLResult_destroy(ret);
|
|
1585
1559
|
|
|
1560
|
+
}
|
|
1586
1561
|
}
|
|
1587
1562
|
|
|
1588
1563
|
args.GetReturnValue().SetNull();
|
|
@@ -1598,24 +1573,20 @@ void WebGL2RenderingContext::GetQuery(const v8::FunctionCallbackInfo<v8::Value>
|
|
|
1598
1573
|
auto isolate = args.GetIsolate();
|
|
1599
1574
|
auto context = isolate->GetCurrentContext();
|
|
1600
1575
|
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
ret));
|
|
1611
|
-
canvas_native_webgl_WebGLResult_destroy(ret);
|
|
1612
|
-
return;
|
|
1613
|
-
}
|
|
1614
|
-
// clean up
|
|
1576
|
+
auto target = (uint32_t) args[0]->NumberValue(context).ToChecked();
|
|
1577
|
+
auto pname = (uint32_t) args[1]->NumberValue(context).ToChecked();
|
|
1578
|
+
auto ret = canvas_native_webgl2_get_query(
|
|
1579
|
+
target,
|
|
1580
|
+
pname,
|
|
1581
|
+
ptr->GetState());
|
|
1582
|
+
if (pname == GL_CURRENT_QUERY) {
|
|
1583
|
+
args.GetReturnValue().Set(canvas_native_webgl_result_get_i32(
|
|
1584
|
+
ret));
|
|
1615
1585
|
canvas_native_webgl_WebGLResult_destroy(ret);
|
|
1586
|
+
return;
|
|
1616
1587
|
}
|
|
1617
|
-
|
|
1618
|
-
|
|
1588
|
+
// clean up
|
|
1589
|
+
canvas_native_webgl_WebGLResult_destroy(ret);
|
|
1619
1590
|
}
|
|
1620
1591
|
|
|
1621
1592
|
void WebGL2RenderingContext::GetSamplerParameter(const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
@@ -1628,45 +1599,42 @@ void WebGL2RenderingContext::GetSamplerParameter(const v8::FunctionCallbackInfo<
|
|
|
1628
1599
|
auto isolate = args.GetIsolate();
|
|
1629
1600
|
auto context = isolate->GetCurrentContext();
|
|
1630
1601
|
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
return;
|
|
1666
|
-
}
|
|
1602
|
+
auto samplerValue = args[0];
|
|
1603
|
+
auto type = GetNativeType(isolate, samplerValue);
|
|
1604
|
+
if (type == NativeType::WebGLSampler) {
|
|
1605
|
+
auto sampler = WebGLSampler::GetPointer(samplerValue.As<v8::Object>());
|
|
1606
|
+
if (sampler != nullptr) {
|
|
1607
|
+
auto pname = (uint32_t) args[1]->NumberValue(context).ToChecked();
|
|
1608
|
+
auto ret = canvas_native_webgl2_get_sampler_parameter(
|
|
1609
|
+
sampler->GetSampler(),
|
|
1610
|
+
pname,
|
|
1611
|
+
ptr->GetState());
|
|
1612
|
+
|
|
1613
|
+
switch (pname) {
|
|
1614
|
+
case GL_TEXTURE_MAX_LOD:
|
|
1615
|
+
case GL_TEXTURE_MIN_LOD:
|
|
1616
|
+
args.GetReturnValue().Set(
|
|
1617
|
+
static_cast<double>(canvas_native_webgl_result_get_f32(
|
|
1618
|
+
ret)));
|
|
1619
|
+
canvas_native_webgl_WebGLResult_destroy(ret);
|
|
1620
|
+
return;
|
|
1621
|
+
case GL_TEXTURE_COMPARE_FUNC:
|
|
1622
|
+
case GL_TEXTURE_COMPARE_MODE:
|
|
1623
|
+
case GL_TEXTURE_MAG_FILTER:
|
|
1624
|
+
case GL_TEXTURE_MIN_FILTER:
|
|
1625
|
+
case GL_TEXTURE_WRAP_R:
|
|
1626
|
+
case GL_TEXTURE_WRAP_S:
|
|
1627
|
+
case GL_TEXTURE_WRAP_T:
|
|
1628
|
+
args.GetReturnValue().Set(canvas_native_webgl_result_get_i32(
|
|
1629
|
+
ret));
|
|
1630
|
+
canvas_native_webgl_WebGLResult_destroy(ret);
|
|
1631
|
+
return;
|
|
1632
|
+
default:
|
|
1633
|
+
args.GetReturnValue().SetNull();
|
|
1634
|
+
canvas_native_webgl_WebGLResult_destroy(ret);
|
|
1635
|
+
return;
|
|
1667
1636
|
}
|
|
1668
1637
|
}
|
|
1669
|
-
|
|
1670
1638
|
}
|
|
1671
1639
|
|
|
1672
1640
|
args.GetReturnValue().SetNull();
|
|
@@ -1682,34 +1650,31 @@ void WebGL2RenderingContext::GetSyncParameter(const v8::FunctionCallbackInfo<v8:
|
|
|
1682
1650
|
auto isolate = args.GetIsolate();
|
|
1683
1651
|
auto context = isolate->GetCurrentContext();
|
|
1684
1652
|
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
ptr->GetState());
|
|
1653
|
+
auto syncValue = args[0];
|
|
1654
|
+
auto sync = WebGLSyncImpl::GetPointer(syncValue.As<v8::Object>());
|
|
1655
|
+
if (sync != nullptr) {
|
|
1656
|
+
auto pname = (uint32_t) args[1]->NumberValue(context).ToChecked();
|
|
1657
|
+
auto ret = canvas_native_webgl2_get_sync_parameter(
|
|
1658
|
+
sync->GetSync(),
|
|
1659
|
+
pname,
|
|
1660
|
+
ptr->GetState());
|
|
1694
1661
|
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1662
|
+
switch (pname) {
|
|
1663
|
+
case GL_OBJECT_TYPE:
|
|
1664
|
+
case GL_SYNC_STATUS:
|
|
1665
|
+
case GL_SYNC_CONDITION:
|
|
1666
|
+
case GL_SYNC_FLAGS:
|
|
1667
|
+
args.GetReturnValue().Set(canvas_native_webgl_result_get_i32(
|
|
1668
|
+
ret));
|
|
1702
1669
|
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
}
|
|
1670
|
+
canvas_native_webgl_WebGLResult_destroy(ret);
|
|
1671
|
+
return;
|
|
1672
|
+
default:
|
|
1673
|
+
args.GetReturnValue().SetNull();
|
|
1674
|
+
canvas_native_webgl_WebGLResult_destroy(ret);
|
|
1675
|
+
return;
|
|
1710
1676
|
}
|
|
1711
1677
|
}
|
|
1712
|
-
|
|
1713
1678
|
args.GetReturnValue().SetNull();
|
|
1714
1679
|
}
|
|
1715
1680
|
|
|
@@ -1724,30 +1689,28 @@ void WebGL2RenderingContext::GetTransformFeedbackVarying(
|
|
|
1724
1689
|
auto isolate = args.GetIsolate();
|
|
1725
1690
|
auto context = isolate->GetCurrentContext();
|
|
1726
1691
|
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
);
|
|
1739
|
-
|
|
1740
|
-
if (canvas_native_webgl_active_info_get_is_empty(
|
|
1741
|
-
ret)) {
|
|
1742
|
-
canvas_native_webgl_active_info_destroy(ret);
|
|
1743
|
-
args.GetReturnValue().SetNull();
|
|
1744
|
-
return;
|
|
1745
|
-
}
|
|
1692
|
+
auto programValue = args[0];
|
|
1693
|
+
auto type = GetNativeType(isolate, programValue);
|
|
1694
|
+
if (type == NativeType::WebGLProgram) {
|
|
1695
|
+
auto program = WebGLProgram::GetPointer(programValue.As<v8::Object>());
|
|
1696
|
+
auto index = (uint32_t) args[1]->NumberValue(context).ToChecked();
|
|
1697
|
+
if (program != nullptr) {
|
|
1698
|
+
auto ret = canvas_native_webgl2_get_transform_feedback_varying(
|
|
1699
|
+
program->GetProgram(),
|
|
1700
|
+
index,
|
|
1701
|
+
ptr->GetState()
|
|
1702
|
+
);
|
|
1746
1703
|
|
|
1747
|
-
|
|
1748
|
-
|
|
1704
|
+
if (canvas_native_webgl_active_info_get_is_empty(
|
|
1705
|
+
ret)) {
|
|
1706
|
+
canvas_native_webgl_active_info_destroy(ret);
|
|
1707
|
+
args.GetReturnValue().SetNull();
|
|
1749
1708
|
return;
|
|
1750
1709
|
}
|
|
1710
|
+
|
|
1711
|
+
auto info = WebGLActiveInfoImpl::NewInstance(isolate, new WebGLActiveInfoImpl(ret));
|
|
1712
|
+
args.GetReturnValue().Set(info);
|
|
1713
|
+
return;
|
|
1751
1714
|
}
|
|
1752
1715
|
}
|
|
1753
1716
|
|
|
@@ -1764,22 +1727,19 @@ void WebGL2RenderingContext::GetUniformBlockIndex(const v8::FunctionCallbackInfo
|
|
|
1764
1727
|
auto isolate = args.GetIsolate();
|
|
1765
1728
|
auto context = isolate->GetCurrentContext();
|
|
1766
1729
|
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
return;
|
|
1780
|
-
}
|
|
1730
|
+
auto programValue = args[0];
|
|
1731
|
+
auto type = GetNativeType(isolate, programValue);
|
|
1732
|
+
if (type == NativeType::WebGLProgram) {
|
|
1733
|
+
auto program = WebGLProgram::GetPointer(programValue.As<v8::Object>());
|
|
1734
|
+
auto index = ConvertFromV8String(isolate, args[1]);
|
|
1735
|
+
if (program != nullptr) {
|
|
1736
|
+
auto ret = canvas_native_webgl2_get_uniform_block_index(
|
|
1737
|
+
program->GetProgram(),
|
|
1738
|
+
index.c_str(),
|
|
1739
|
+
ptr->GetState());
|
|
1740
|
+
args.GetReturnValue().Set((int) ret);
|
|
1741
|
+
return;
|
|
1781
1742
|
}
|
|
1782
|
-
|
|
1783
1743
|
}
|
|
1784
1744
|
|
|
1785
1745
|
args.GetReturnValue().SetNull();
|
|
@@ -1795,58 +1755,55 @@ void WebGL2RenderingContext::GetUniformIndices(const v8::FunctionCallbackInfo<v8
|
|
|
1795
1755
|
auto isolate = args.GetIsolate();
|
|
1796
1756
|
auto context = isolate->GetCurrentContext();
|
|
1797
1757
|
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
auto len = uniformNames->Length();
|
|
1808
|
-
|
|
1809
|
-
std::vector<std::string> store;
|
|
1810
|
-
store.reserve(len);
|
|
1811
|
-
|
|
1812
|
-
for (int j = 0; j < len; ++j) {
|
|
1813
|
-
auto name = ConvertFromV8String(isolate, uniformNames->Get(
|
|
1814
|
-
context, j).ToLocalChecked());
|
|
1815
|
-
|
|
1816
|
-
store.push_back(name);
|
|
1817
|
-
}
|
|
1758
|
+
auto programValue = args[0];
|
|
1759
|
+
auto type = GetNativeType(isolate, programValue);
|
|
1760
|
+
if (type == NativeType::WebGLProgram) {
|
|
1761
|
+
auto program = WebGLProgram::GetPointer(programValue.As<v8::Object>());
|
|
1762
|
+
auto uniformNamesObject = args[1];
|
|
1763
|
+
if (program != nullptr &&
|
|
1764
|
+
uniformNamesObject->IsArray()) {
|
|
1765
|
+
auto uniformNames = uniformNamesObject.As<v8::Array>();
|
|
1766
|
+
auto len = uniformNames->Length();
|
|
1818
1767
|
|
|
1768
|
+
std::vector<std::string> store;
|
|
1769
|
+
store.reserve(len);
|
|
1819
1770
|
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1771
|
+
for (int j = 0; j < len; ++j) {
|
|
1772
|
+
auto name = ConvertFromV8String(isolate, uniformNames->Get(
|
|
1773
|
+
context, j).ToLocalChecked());
|
|
1774
|
+
|
|
1775
|
+
store.push_back(name);
|
|
1776
|
+
}
|
|
1824
1777
|
|
|
1825
1778
|
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
ptr->GetState());
|
|
1779
|
+
const char* cStrings[store.size()];
|
|
1780
|
+
for (size_t i = 0; i < store.size(); ++i) {
|
|
1781
|
+
cStrings[i] = store[i].c_str();
|
|
1782
|
+
}
|
|
1831
1783
|
|
|
1832
1784
|
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
result->Set(context,
|
|
1839
|
-
j,
|
|
1840
|
-
v8::Number::New(isolate,
|
|
1841
|
-
(int32_t) item));
|
|
1842
|
-
}
|
|
1785
|
+
auto ret = canvas_native_webgl2_get_uniform_indices(
|
|
1786
|
+
program->GetProgram(),
|
|
1787
|
+
cStrings,
|
|
1788
|
+
store.size(),
|
|
1789
|
+
ptr->GetState());
|
|
1843
1790
|
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1791
|
+
|
|
1792
|
+
auto retSize = canvas_native_u32_buffer_get_length(ret);
|
|
1793
|
+
auto buf = canvas_native_u32_buffer_get_bytes(ret);
|
|
1794
|
+
auto result = v8::Array::New(isolate, (int) retSize);
|
|
1795
|
+
for (int j = 0; j < retSize; ++j) {
|
|
1796
|
+
auto item = buf[j];
|
|
1797
|
+
result->Set(context,
|
|
1798
|
+
j,
|
|
1799
|
+
v8::Number::New(isolate,
|
|
1800
|
+
(int32_t) item));
|
|
1847
1801
|
}
|
|
1848
|
-
}
|
|
1849
1802
|
|
|
1803
|
+
args.GetReturnValue().Set(result);
|
|
1804
|
+
canvas_native_u32_buffer_destroy(ret);
|
|
1805
|
+
return;
|
|
1806
|
+
}
|
|
1850
1807
|
}
|
|
1851
1808
|
|
|
1852
1809
|
args.GetReturnValue().SetNull();
|
|
@@ -1863,24 +1820,22 @@ WebGL2RenderingContext::InvalidateFramebuffer(const v8::FunctionCallbackInfo<v8:
|
|
|
1863
1820
|
auto context = isolate->GetCurrentContext();
|
|
1864
1821
|
|
|
1865
1822
|
auto attachments = args[1];
|
|
1866
|
-
|
|
1867
|
-
auto target = (uint32_t) args[0]->NumberValue(context).ToChecked();
|
|
1823
|
+
auto target = (uint32_t) args[0]->NumberValue(context).ToChecked();
|
|
1868
1824
|
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
}
|
|
1879
|
-
|
|
1880
|
-
canvas_native_webgl2_invalidate_framebuffer(
|
|
1881
|
-
target, buf.data(), buf.size(),
|
|
1882
|
-
ptr->GetState());
|
|
1825
|
+
if (attachments->IsArray()) {
|
|
1826
|
+
auto array = attachments.As<v8::Array>();
|
|
1827
|
+
auto len = array->Length();
|
|
1828
|
+
std::vector<uint32_t> buf;
|
|
1829
|
+
buf.reserve(len);
|
|
1830
|
+
for (int j = 0; j < len; ++j) {
|
|
1831
|
+
auto item = (uint32_t) array->Get(
|
|
1832
|
+
context, j).ToLocalChecked()->NumberValue(context).ToChecked();
|
|
1833
|
+
buf.push_back(item);
|
|
1883
1834
|
}
|
|
1835
|
+
|
|
1836
|
+
canvas_native_webgl2_invalidate_framebuffer(
|
|
1837
|
+
target, buf.data(), buf.size(),
|
|
1838
|
+
ptr->GetState());
|
|
1884
1839
|
}
|
|
1885
1840
|
}
|
|
1886
1841
|
|
|
@@ -1894,36 +1849,32 @@ WebGL2RenderingContext::InvalidateSubFramebuffer(const v8::FunctionCallbackInfo<
|
|
|
1894
1849
|
auto isolate = args.GetIsolate();
|
|
1895
1850
|
auto context = isolate->GetCurrentContext();
|
|
1896
1851
|
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
auto height = (int32_t) args[5]->NumberValue(context).ToChecked();
|
|
1905
|
-
|
|
1906
|
-
auto array = attachments.As<v8::Array>();
|
|
1907
|
-
auto len = array->Length();
|
|
1908
|
-
std::vector<uint32_t> buf;
|
|
1909
|
-
buf.reserve(len);
|
|
1910
|
-
for (int j = 0; j < len; ++j) {
|
|
1911
|
-
auto item = (uint32_t) array->Get(
|
|
1912
|
-
context, j).ToLocalChecked()->NumberValue(context).ToChecked();
|
|
1913
|
-
buf.push_back(item);
|
|
1914
|
-
}
|
|
1852
|
+
auto attachments = args[1];
|
|
1853
|
+
if (attachments->IsArray()) {
|
|
1854
|
+
auto target = (uint32_t) args[0]->NumberValue(context).ToChecked();
|
|
1855
|
+
auto x = (int32_t) args[2]->NumberValue(context).ToChecked();
|
|
1856
|
+
auto y = (int32_t) args[3]->NumberValue(context).ToChecked();
|
|
1857
|
+
auto width = (int32_t) args[4]->NumberValue(context).ToChecked();
|
|
1858
|
+
auto height = (int32_t) args[5]->NumberValue(context).ToChecked();
|
|
1915
1859
|
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1860
|
+
auto array = attachments.As<v8::Array>();
|
|
1861
|
+
auto len = array->Length();
|
|
1862
|
+
std::vector<uint32_t> buf;
|
|
1863
|
+
buf.reserve(len);
|
|
1864
|
+
for (int j = 0; j < len; ++j) {
|
|
1865
|
+
auto item = (uint32_t) array->Get(
|
|
1866
|
+
context, j).ToLocalChecked()->NumberValue(context).ToChecked();
|
|
1867
|
+
buf.push_back(item);
|
|
1924
1868
|
}
|
|
1925
1869
|
|
|
1926
|
-
|
|
1870
|
+
canvas_native_webgl2_invalidate_sub_framebuffer(
|
|
1871
|
+
target,
|
|
1872
|
+
buf.data(), buf.size(),
|
|
1873
|
+
x,
|
|
1874
|
+
y,
|
|
1875
|
+
width,
|
|
1876
|
+
height,
|
|
1877
|
+
ptr->GetState());
|
|
1927
1878
|
}
|
|
1928
1879
|
}
|
|
1929
1880
|
|
|
@@ -2071,13 +2022,11 @@ void WebGL2RenderingContext::ReadBuffer(const v8::FunctionCallbackInfo<v8::Value
|
|
|
2071
2022
|
auto isolate = args.GetIsolate();
|
|
2072
2023
|
auto context = isolate->GetCurrentContext();
|
|
2073
2024
|
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
);
|
|
2080
|
-
}
|
|
2025
|
+
auto src = (uint32_t) args[0]->NumberValue(context).ToChecked();
|
|
2026
|
+
canvas_native_webgl2_read_buffer(
|
|
2027
|
+
src,
|
|
2028
|
+
ptr->GetState()
|
|
2029
|
+
);
|
|
2081
2030
|
}
|
|
2082
2031
|
|
|
2083
2032
|
void WebGL2RenderingContext::RenderbufferStorageMultisample(
|
|
@@ -2090,21 +2039,19 @@ void WebGL2RenderingContext::RenderbufferStorageMultisample(
|
|
|
2090
2039
|
auto isolate = args.GetIsolate();
|
|
2091
2040
|
auto context = isolate->GetCurrentContext();
|
|
2092
2041
|
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
);
|
|
2107
|
-
}
|
|
2042
|
+
auto target = (uint32_t) args[0]->NumberValue(context).ToChecked();
|
|
2043
|
+
auto samples = (int32_t) args[1]->NumberValue(context).ToChecked();
|
|
2044
|
+
auto internalFormat = (uint32_t) args[2]->NumberValue(context).ToChecked();
|
|
2045
|
+
auto width = (int32_t) args[3]->NumberValue(context).ToChecked();
|
|
2046
|
+
auto height = (int32_t) args[4]->NumberValue(context).ToChecked();
|
|
2047
|
+
canvas_native_webgl2_renderbuffer_storage_multisample(
|
|
2048
|
+
target,
|
|
2049
|
+
samples,
|
|
2050
|
+
internalFormat,
|
|
2051
|
+
width,
|
|
2052
|
+
height,
|
|
2053
|
+
ptr->GetState()
|
|
2054
|
+
);
|
|
2108
2055
|
}
|
|
2109
2056
|
|
|
2110
2057
|
void
|
|
@@ -2127,22 +2074,19 @@ void WebGL2RenderingContext::SamplerParameterf(const v8::FunctionCallbackInfo<v8
|
|
|
2127
2074
|
auto isolate = args.GetIsolate();
|
|
2128
2075
|
auto context = isolate->GetCurrentContext();
|
|
2129
2076
|
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
ptr->GetState());
|
|
2143
|
-
}
|
|
2077
|
+
auto samplerValue = args[0];
|
|
2078
|
+
auto type = GetNativeType(isolate, samplerValue);
|
|
2079
|
+
if (type == NativeType::WebGLSampler) {
|
|
2080
|
+
auto sampler = WebGLSampler::GetPointer(samplerValue.As<v8::Object>());
|
|
2081
|
+
auto pname = (uint32_t) args[1]->NumberValue(context).ToChecked();
|
|
2082
|
+
auto param = args[2]->NumberValue(context).ToChecked();
|
|
2083
|
+
if (sampler != nullptr) {
|
|
2084
|
+
canvas_native_webgl2_sampler_parameterf(
|
|
2085
|
+
sampler->GetSampler(),
|
|
2086
|
+
pname,
|
|
2087
|
+
static_cast<float>(param),
|
|
2088
|
+
ptr->GetState());
|
|
2144
2089
|
}
|
|
2145
|
-
|
|
2146
2090
|
}
|
|
2147
2091
|
|
|
2148
2092
|
}
|
|
@@ -2156,22 +2100,19 @@ void WebGL2RenderingContext::SamplerParameteri(const v8::FunctionCallbackInfo<v8
|
|
|
2156
2100
|
auto isolate = args.GetIsolate();
|
|
2157
2101
|
auto context = isolate->GetCurrentContext();
|
|
2158
2102
|
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
ptr->GetState());
|
|
2172
|
-
}
|
|
2103
|
+
auto samplerValue = args[0];
|
|
2104
|
+
auto type = GetNativeType(isolate, samplerValue);
|
|
2105
|
+
if (type == NativeType::WebGLSampler) {
|
|
2106
|
+
auto sampler = WebGLSampler::GetPointer(samplerValue.As<v8::Object>());
|
|
2107
|
+
auto pname = (uint32_t) args[1]->NumberValue(context).ToChecked();
|
|
2108
|
+
auto param = (int32_t) args[2]->NumberValue(context).ToChecked();
|
|
2109
|
+
if (sampler != nullptr) {
|
|
2110
|
+
canvas_native_webgl2_sampler_parameteri(
|
|
2111
|
+
sampler->GetSampler(),
|
|
2112
|
+
pname,
|
|
2113
|
+
param,
|
|
2114
|
+
ptr->GetState());
|
|
2173
2115
|
}
|
|
2174
|
-
|
|
2175
2116
|
}
|
|
2176
2117
|
|
|
2177
2118
|
}
|
|
@@ -2381,26 +2322,24 @@ void WebGL2RenderingContext::TexStorage2D(const v8::FunctionCallbackInfo<v8::Val
|
|
|
2381
2322
|
auto isolate = args.GetIsolate();
|
|
2382
2323
|
auto context = isolate->GetCurrentContext();
|
|
2383
2324
|
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
);
|
|
2403
|
-
}
|
|
2325
|
+
auto target = (uint32_t) args[0]->NumberValue(
|
|
2326
|
+
context).ToChecked();
|
|
2327
|
+
auto levels = (int32_t) args[1]->NumberValue(
|
|
2328
|
+
context).ToChecked();
|
|
2329
|
+
auto internalFormat = (uint32_t) args[2]->NumberValue(
|
|
2330
|
+
context).ToChecked();
|
|
2331
|
+
auto width = (int32_t) args[3]->NumberValue(
|
|
2332
|
+
context).ToChecked();
|
|
2333
|
+
auto height = (int32_t) args[4]->NumberValue(
|
|
2334
|
+
context).ToChecked();
|
|
2335
|
+
canvas_native_webgl2_tex_storage2d(
|
|
2336
|
+
target,
|
|
2337
|
+
levels,
|
|
2338
|
+
internalFormat,
|
|
2339
|
+
width,
|
|
2340
|
+
height,
|
|
2341
|
+
ptr->GetState()
|
|
2342
|
+
);
|
|
2404
2343
|
}
|
|
2405
2344
|
|
|
2406
2345
|
void WebGL2RenderingContext::TexStorage3D(const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
@@ -2412,29 +2351,27 @@ void WebGL2RenderingContext::TexStorage3D(const v8::FunctionCallbackInfo<v8::Val
|
|
|
2412
2351
|
auto isolate = args.GetIsolate();
|
|
2413
2352
|
auto context = isolate->GetCurrentContext();
|
|
2414
2353
|
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
);
|
|
2437
|
-
}
|
|
2354
|
+
auto target = (uint32_t) args[0]->NumberValue(
|
|
2355
|
+
context).ToChecked();
|
|
2356
|
+
auto levels = (int32_t) args[1]->NumberValue(
|
|
2357
|
+
context).ToChecked();
|
|
2358
|
+
auto internalFormat = (uint32_t) args[2]->NumberValue(
|
|
2359
|
+
context).ToChecked();
|
|
2360
|
+
auto width = (int32_t) args[3]->NumberValue(
|
|
2361
|
+
context).ToChecked();
|
|
2362
|
+
auto height = (int32_t) args[4]->NumberValue(
|
|
2363
|
+
context).ToChecked();
|
|
2364
|
+
auto depth = (int32_t) args[5]->NumberValue(
|
|
2365
|
+
context).ToChecked();
|
|
2366
|
+
canvas_native_webgl2_tex_storage3d(
|
|
2367
|
+
target,
|
|
2368
|
+
levels,
|
|
2369
|
+
internalFormat,
|
|
2370
|
+
width,
|
|
2371
|
+
height,
|
|
2372
|
+
depth,
|
|
2373
|
+
ptr->GetState()
|
|
2374
|
+
);
|
|
2438
2375
|
}
|
|
2439
2376
|
|
|
2440
2377
|
void WebGL2RenderingContext::TexSubImage3D(const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
@@ -2624,7 +2561,7 @@ WebGL2RenderingContext::TransformFeedbackVaryings(const v8::FunctionCallbackInfo
|
|
|
2624
2561
|
|
|
2625
2562
|
auto programValue = args[0];
|
|
2626
2563
|
auto type = GetNativeType(isolate, programValue);
|
|
2627
|
-
if (
|
|
2564
|
+
if (type == NativeType::WebGLProgram) {
|
|
2628
2565
|
auto program = WebGLProgram::GetPointer(programValue.As<v8::Object>());
|
|
2629
2566
|
auto varyingsObject = args[1];
|
|
2630
2567
|
auto bufferMode = (uint32_t) args[2]->NumberValue(
|
|
@@ -2675,11 +2612,11 @@ void WebGL2RenderingContext::Uniform1ui(const v8::FunctionCallbackInfo<v8::Value
|
|
|
2675
2612
|
auto locationValue = args[0];
|
|
2676
2613
|
auto type = GetNativeType(isolate, locationValue);
|
|
2677
2614
|
|
|
2678
|
-
|
|
2679
|
-
|
|
2615
|
+
auto v0Value = args[1];
|
|
2616
|
+
if (type == NativeType::WebGLUniformLocation) {
|
|
2680
2617
|
|
|
2681
2618
|
auto location = WebGLUniformLocation::GetPointer(locationValue.As<v8::Object>());
|
|
2682
|
-
auto v0 = (uint32_t)
|
|
2619
|
+
auto v0 = (uint32_t) v0Value->NumberValue(
|
|
2683
2620
|
context).ToChecked();
|
|
2684
2621
|
|
|
2685
2622
|
if (location != nullptr) {
|
|
@@ -2705,8 +2642,7 @@ void WebGL2RenderingContext::Uniform2ui(const v8::FunctionCallbackInfo<v8::Value
|
|
|
2705
2642
|
auto locationValue = args[0];
|
|
2706
2643
|
auto type = GetNativeType(isolate, locationValue);
|
|
2707
2644
|
|
|
2708
|
-
if (
|
|
2709
|
-
args[1]->IsNumber() && type == NativeType::WebGLUniformLocation) {
|
|
2645
|
+
if (type == NativeType::WebGLUniformLocation) {
|
|
2710
2646
|
|
|
2711
2647
|
auto location = WebGLUniformLocation::GetPointer(locationValue.As<v8::Object>());
|
|
2712
2648
|
auto v0 = (uint32_t) args[1]->NumberValue(
|
|
@@ -2738,8 +2674,7 @@ void WebGL2RenderingContext::Uniform3ui(const v8::FunctionCallbackInfo<v8::Value
|
|
|
2738
2674
|
auto locationValue = args[0];
|
|
2739
2675
|
auto type = GetNativeType(isolate, locationValue);
|
|
2740
2676
|
|
|
2741
|
-
if (
|
|
2742
|
-
args[1]->IsNumber() && type == NativeType::WebGLUniformLocation) {
|
|
2677
|
+
if (type == NativeType::WebGLUniformLocation) {
|
|
2743
2678
|
|
|
2744
2679
|
auto location = WebGLUniformLocation::GetPointer(locationValue.As<v8::Object>());
|
|
2745
2680
|
auto v0 = (uint32_t) args[1]->NumberValue(
|
|
@@ -2776,8 +2711,7 @@ void WebGL2RenderingContext::Uniform4ui(const v8::FunctionCallbackInfo<v8::Value
|
|
|
2776
2711
|
auto locationValue = args[0];
|
|
2777
2712
|
auto type = GetNativeType(isolate, locationValue);
|
|
2778
2713
|
|
|
2779
|
-
if (
|
|
2780
|
-
args[1]->IsNumber() && type == NativeType::WebGLUniformLocation) {
|
|
2714
|
+
if (type == NativeType::WebGLUniformLocation) {
|
|
2781
2715
|
|
|
2782
2716
|
auto location = WebGLUniformLocation::GetPointer(locationValue.As<v8::Object>());
|
|
2783
2717
|
auto v0 = (uint32_t) args[1]->NumberValue(
|
|
@@ -2820,13 +2754,12 @@ void WebGL2RenderingContext::Uniform1uiv(const v8::FunctionCallbackInfo<v8::Valu
|
|
|
2820
2754
|
auto type = GetNativeType(isolate, locationValue);
|
|
2821
2755
|
|
|
2822
2756
|
|
|
2823
|
-
if (
|
|
2824
|
-
args[1]->IsObject() && type == NativeType::WebGLUniformLocation) {
|
|
2757
|
+
if (type == NativeType::WebGLUniformLocation) {
|
|
2825
2758
|
auto location = WebGLUniformLocation::GetPointer(locationValue.As<v8::Object>());
|
|
2826
|
-
auto
|
|
2759
|
+
auto dataValue = args[1];
|
|
2827
2760
|
if (location != nullptr &&
|
|
2828
|
-
|
|
2829
|
-
auto buf =
|
|
2761
|
+
dataValue->IsUint32Array()) {
|
|
2762
|
+
auto buf = dataValue.As<v8::Uint32Array>();
|
|
2830
2763
|
auto array = buf->Buffer();
|
|
2831
2764
|
auto offset = buf->ByteOffset();
|
|
2832
2765
|
auto size = buf->Length();
|
|
@@ -2841,7 +2774,7 @@ void WebGL2RenderingContext::Uniform1uiv(const v8::FunctionCallbackInfo<v8::Valu
|
|
|
2841
2774
|
);
|
|
2842
2775
|
} else {
|
|
2843
2776
|
std::vector<uint32_t> buf;
|
|
2844
|
-
auto array =
|
|
2777
|
+
auto array = dataValue.As<v8::Array>();
|
|
2845
2778
|
auto len = array->Length();
|
|
2846
2779
|
buf.reserve(len);
|
|
2847
2780
|
for (int i = 0; i < len; i++) {
|
|
@@ -2878,13 +2811,12 @@ void WebGL2RenderingContext::Uniform2uiv(const v8::FunctionCallbackInfo<v8::Valu
|
|
|
2878
2811
|
auto type = GetNativeType(isolate, locationValue);
|
|
2879
2812
|
|
|
2880
2813
|
|
|
2881
|
-
if (
|
|
2882
|
-
args[1]->IsObject() && type == NativeType::WebGLUniformLocation) {
|
|
2814
|
+
if (type == NativeType::WebGLUniformLocation) {
|
|
2883
2815
|
auto location = WebGLUniformLocation::GetPointer(locationValue.As<v8::Object>());
|
|
2884
|
-
auto
|
|
2816
|
+
auto dataValue = args[1];
|
|
2885
2817
|
if (location != nullptr &&
|
|
2886
|
-
|
|
2887
|
-
auto buf =
|
|
2818
|
+
dataValue->IsUint32Array()) {
|
|
2819
|
+
auto buf = dataValue.As<v8::Uint32Array>();
|
|
2888
2820
|
auto array = buf->Buffer();
|
|
2889
2821
|
auto offset = buf->ByteOffset();
|
|
2890
2822
|
auto size = buf->Length();
|
|
@@ -2900,7 +2832,7 @@ void WebGL2RenderingContext::Uniform2uiv(const v8::FunctionCallbackInfo<v8::Valu
|
|
|
2900
2832
|
);
|
|
2901
2833
|
} else {
|
|
2902
2834
|
std::vector<uint32_t> buf;
|
|
2903
|
-
auto array =
|
|
2835
|
+
auto array = dataValue.As<v8::Array>();
|
|
2904
2836
|
auto len = array->Length();
|
|
2905
2837
|
buf.reserve(len);
|
|
2906
2838
|
for (int i = 0; i < len; i++) {
|
|
@@ -2936,13 +2868,12 @@ void WebGL2RenderingContext::Uniform3uiv(const v8::FunctionCallbackInfo<v8::Valu
|
|
|
2936
2868
|
auto type = GetNativeType(isolate, locationValue);
|
|
2937
2869
|
|
|
2938
2870
|
|
|
2939
|
-
if (
|
|
2940
|
-
args[1]->IsObject() && type == NativeType::WebGLUniformLocation) {
|
|
2871
|
+
if (type == NativeType::WebGLUniformLocation) {
|
|
2941
2872
|
auto location = WebGLUniformLocation::GetPointer(locationValue.As<v8::Object>());
|
|
2942
|
-
auto
|
|
2873
|
+
auto dataValue = args[1];
|
|
2943
2874
|
if (location != nullptr &&
|
|
2944
|
-
|
|
2945
|
-
auto buf =
|
|
2875
|
+
dataValue->IsUint32Array()) {
|
|
2876
|
+
auto buf = dataValue.As<v8::Uint32Array>();
|
|
2946
2877
|
|
|
2947
2878
|
auto array = buf->Buffer();
|
|
2948
2879
|
auto offset = buf->ByteOffset();
|
|
@@ -2958,7 +2889,7 @@ void WebGL2RenderingContext::Uniform3uiv(const v8::FunctionCallbackInfo<v8::Valu
|
|
|
2958
2889
|
);
|
|
2959
2890
|
} else {
|
|
2960
2891
|
std::vector<uint32_t> buf;
|
|
2961
|
-
auto array =
|
|
2892
|
+
auto array = dataValue.As<v8::Array>();
|
|
2962
2893
|
auto len = array->Length();
|
|
2963
2894
|
buf.reserve(len);
|
|
2964
2895
|
for (int i = 0; i < len; i++) {
|
|
@@ -2994,13 +2925,12 @@ void WebGL2RenderingContext::Uniform4uiv(const v8::FunctionCallbackInfo<v8::Valu
|
|
|
2994
2925
|
auto type = GetNativeType(isolate, locationValue);
|
|
2995
2926
|
|
|
2996
2927
|
|
|
2997
|
-
if (
|
|
2998
|
-
args[1]->IsObject() && type == NativeType::WebGLUniformLocation) {
|
|
2928
|
+
if (type == NativeType::WebGLUniformLocation) {
|
|
2999
2929
|
auto location = WebGLUniformLocation::GetPointer(locationValue.As<v8::Object>());
|
|
3000
|
-
auto
|
|
2930
|
+
auto dataValue = args[1];
|
|
3001
2931
|
if (location != nullptr &&
|
|
3002
|
-
|
|
3003
|
-
auto buf =
|
|
2932
|
+
dataValue->IsUint32Array()) {
|
|
2933
|
+
auto buf = dataValue.As<v8::Uint32Array>();
|
|
3004
2934
|
|
|
3005
2935
|
auto array = buf->Buffer();
|
|
3006
2936
|
auto offset = buf->ByteOffset();
|
|
@@ -3016,7 +2946,7 @@ void WebGL2RenderingContext::Uniform4uiv(const v8::FunctionCallbackInfo<v8::Valu
|
|
|
3016
2946
|
);
|
|
3017
2947
|
} else {
|
|
3018
2948
|
std::vector<uint32_t> buf;
|
|
3019
|
-
auto array =
|
|
2949
|
+
auto array = dataValue.As<v8::Array>();
|
|
3020
2950
|
auto len = array->Length();
|
|
3021
2951
|
buf.reserve(len);
|
|
3022
2952
|
for (int i = 0; i < len; i++) {
|
|
@@ -3050,7 +2980,7 @@ void WebGL2RenderingContext::UniformBlockBinding(const v8::FunctionCallbackInfo<
|
|
|
3050
2980
|
|
|
3051
2981
|
auto programValue = args[0];
|
|
3052
2982
|
auto type = GetNativeType(isolate, programValue);
|
|
3053
|
-
if (
|
|
2983
|
+
if (type == NativeType::WebGLProgram) {
|
|
3054
2984
|
|
|
3055
2985
|
auto program = WebGLProgram::GetPointer(programValue.As<v8::Object>());
|
|
3056
2986
|
auto uniformBlockIndex = args[1]->NumberValue(
|
|
@@ -3081,57 +3011,48 @@ void WebGL2RenderingContext::UniformMatrix2x3fv(const v8::FunctionCallbackInfo<v
|
|
|
3081
3011
|
auto context = isolate->GetCurrentContext();
|
|
3082
3012
|
|
|
3083
3013
|
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
auto
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
auto transpose = args[1]->BooleanValue(isolate);
|
|
3091
|
-
auto data = args[2];
|
|
3014
|
+
auto locationValue = args[0];
|
|
3015
|
+
auto type = GetNativeType(isolate, locationValue);
|
|
3016
|
+
if (type == NativeType::WebGLUniformLocation) {
|
|
3017
|
+
auto location = WebGLUniformLocation::GetPointer(locationValue.As<v8::Object>());
|
|
3018
|
+
auto transpose = args[1]->BooleanValue(isolate);
|
|
3019
|
+
auto dataValue = args[2];
|
|
3092
3020
|
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3021
|
+
if (dataValue->IsFloat32Array()) {
|
|
3022
|
+
auto buf = dataValue.As<v8::Float32Array>();
|
|
3023
|
+
auto array = buf->Buffer();
|
|
3024
|
+
auto offset = buf->ByteOffset();
|
|
3025
|
+
auto size = buf->Length();
|
|
3026
|
+
auto data_ptr = static_cast<uint8_t*>(array->GetBackingStore()->Data()) + offset;
|
|
3027
|
+
auto data = static_cast<float *>((void*) data_ptr);
|
|
3100
3028
|
|
|
3101
3029
|
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
} else {
|
|
3120
|
-
buf.push_back(
|
|
3121
|
-
std::nanf(""));
|
|
3122
|
-
}
|
|
3123
|
-
}
|
|
3030
|
+
canvas_native_webgl2_uniform_matrix2x3fv(
|
|
3031
|
+
location->GetUniformLocation(),
|
|
3032
|
+
transpose,
|
|
3033
|
+
data, size,
|
|
3034
|
+
ptr->GetState()
|
|
3035
|
+
);
|
|
3036
|
+
} else if (dataValue->IsArray()) {
|
|
3037
|
+
std::vector<float> buf;
|
|
3038
|
+
auto array = dataValue.As<v8::Array>();
|
|
3039
|
+
auto len = array->Length();
|
|
3040
|
+
for (int i = 0; i < len; i++) {
|
|
3041
|
+
auto item = array->Get(
|
|
3042
|
+
context, i).ToLocalChecked();
|
|
3043
|
+
buf.push_back(
|
|
3044
|
+
static_cast<float>(item->NumberValue(
|
|
3045
|
+
context).ToChecked()));
|
|
3046
|
+
}
|
|
3124
3047
|
|
|
3125
3048
|
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
}
|
|
3049
|
+
canvas_native_webgl2_uniform_matrix2x3fv(
|
|
3050
|
+
location->GetUniformLocation(),
|
|
3051
|
+
transpose,
|
|
3052
|
+
buf.data(), buf.size(),
|
|
3053
|
+
ptr->GetState()
|
|
3054
|
+
);
|
|
3133
3055
|
}
|
|
3134
|
-
|
|
3135
3056
|
}
|
|
3136
3057
|
|
|
3137
3058
|
}
|
|
@@ -3146,59 +3067,50 @@ void WebGL2RenderingContext::UniformMatrix2x4fv(const v8::FunctionCallbackInfo<v
|
|
|
3146
3067
|
auto context = isolate->GetCurrentContext();
|
|
3147
3068
|
|
|
3148
3069
|
|
|
3149
|
-
|
|
3150
|
-
|
|
3151
|
-
|
|
3152
|
-
auto
|
|
3153
|
-
|
|
3154
|
-
|
|
3155
|
-
auto transpose = args[1]->BooleanValue(isolate);
|
|
3156
|
-
auto data = args[2];
|
|
3070
|
+
auto locationValue = args[0];
|
|
3071
|
+
auto type = GetNativeType(isolate, locationValue);
|
|
3072
|
+
if (type == NativeType::WebGLUniformLocation) {
|
|
3073
|
+
auto location = WebGLUniformLocation::GetPointer(locationValue.As<v8::Object>());
|
|
3074
|
+
auto transpose = args[1]->BooleanValue(isolate);
|
|
3075
|
+
auto dataValue = args[2];
|
|
3157
3076
|
|
|
3158
|
-
|
|
3159
|
-
|
|
3077
|
+
if (dataValue->IsFloat32Array()) {
|
|
3078
|
+
auto buf = dataValue.As<v8::Float32Array>();
|
|
3160
3079
|
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
|
|
3164
|
-
|
|
3165
|
-
|
|
3080
|
+
auto array = buf->Buffer();
|
|
3081
|
+
auto offset = buf->ByteOffset();
|
|
3082
|
+
auto size = buf->Length();
|
|
3083
|
+
auto data_ptr = static_cast<uint8_t*>(array->GetBackingStore()->Data()) + offset;
|
|
3084
|
+
auto data = static_cast<float *>((void*) data_ptr);
|
|
3166
3085
|
|
|
3167
3086
|
|
|
3168
|
-
|
|
3169
|
-
|
|
3170
|
-
|
|
3171
|
-
|
|
3172
|
-
|
|
3173
|
-
|
|
3174
|
-
|
|
3175
|
-
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
} else {
|
|
3186
|
-
buf.push_back(
|
|
3187
|
-
std::nanf(""));
|
|
3188
|
-
}
|
|
3189
|
-
}
|
|
3087
|
+
canvas_native_webgl2_uniform_matrix2x4fv(
|
|
3088
|
+
location->GetUniformLocation(),
|
|
3089
|
+
transpose,
|
|
3090
|
+
data, size,
|
|
3091
|
+
ptr->GetState()
|
|
3092
|
+
);
|
|
3093
|
+
} else if (dataValue->IsArray()) {
|
|
3094
|
+
std::vector<float> buf;
|
|
3095
|
+
auto array = dataValue.As<v8::Array>();
|
|
3096
|
+
auto len = array->Length();
|
|
3097
|
+
for (int i = 0; i < len; i++) {
|
|
3098
|
+
auto item = array->Get(
|
|
3099
|
+
context, i).ToLocalChecked();
|
|
3100
|
+
buf.push_back(
|
|
3101
|
+
static_cast<float>(item->NumberValue(
|
|
3102
|
+
context).ToChecked()));
|
|
3103
|
+
}
|
|
3190
3104
|
|
|
3191
3105
|
|
|
3192
3106
|
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
}
|
|
3107
|
+
canvas_native_webgl2_uniform_matrix2x4fv(
|
|
3108
|
+
location->GetUniformLocation(),
|
|
3109
|
+
transpose,
|
|
3110
|
+
buf.data(), buf.size(),
|
|
3111
|
+
ptr->GetState()
|
|
3112
|
+
);
|
|
3200
3113
|
}
|
|
3201
|
-
|
|
3202
3114
|
}
|
|
3203
3115
|
|
|
3204
3116
|
}
|
|
@@ -3213,60 +3125,51 @@ void WebGL2RenderingContext::UniformMatrix3x2fv(const v8::FunctionCallbackInfo<v
|
|
|
3213
3125
|
auto context = isolate->GetCurrentContext();
|
|
3214
3126
|
|
|
3215
3127
|
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
auto
|
|
3220
|
-
|
|
3221
|
-
|
|
3222
|
-
auto transpose = args[1]->BooleanValue(isolate);
|
|
3223
|
-
auto data = args[2];
|
|
3128
|
+
auto locationValue = args[0];
|
|
3129
|
+
auto type = GetNativeType(isolate, locationValue);
|
|
3130
|
+
if (type == NativeType::WebGLUniformLocation) {
|
|
3131
|
+
auto location = WebGLUniformLocation::GetPointer(locationValue.As<v8::Object>());
|
|
3132
|
+
auto transpose = args[1]->BooleanValue(isolate);
|
|
3133
|
+
auto dataValue = args[2];
|
|
3224
3134
|
|
|
3225
|
-
|
|
3226
|
-
|
|
3135
|
+
if (dataValue->IsFloat32Array()) {
|
|
3136
|
+
auto buf = dataValue.As<v8::Float32Array>();
|
|
3227
3137
|
|
|
3228
3138
|
|
|
3229
|
-
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
|
|
3233
|
-
|
|
3139
|
+
auto array = buf->Buffer();
|
|
3140
|
+
auto offset = buf->ByteOffset();
|
|
3141
|
+
auto size = buf->Length();
|
|
3142
|
+
auto data_ptr = static_cast<uint8_t*>(array->GetBackingStore()->Data()) + offset;
|
|
3143
|
+
auto data = static_cast<float *>((void*) data_ptr);
|
|
3234
3144
|
|
|
3235
3145
|
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
} else {
|
|
3254
|
-
buf.push_back(
|
|
3255
|
-
std::nanf(""));
|
|
3256
|
-
}
|
|
3257
|
-
}
|
|
3146
|
+
canvas_native_webgl2_uniform_matrix3x2fv(
|
|
3147
|
+
location->GetUniformLocation(),
|
|
3148
|
+
transpose,
|
|
3149
|
+
data, size,
|
|
3150
|
+
ptr->GetState()
|
|
3151
|
+
);
|
|
3152
|
+
} else if (dataValue->IsArray()) {
|
|
3153
|
+
std::vector<float> buf;
|
|
3154
|
+
auto array = dataValue.As<v8::Array>();
|
|
3155
|
+
auto len = array->Length();
|
|
3156
|
+
for (int i = 0; i < len; i++) {
|
|
3157
|
+
auto item = array->Get(
|
|
3158
|
+
context, i).ToLocalChecked();
|
|
3159
|
+
buf.push_back(
|
|
3160
|
+
static_cast<float>(item->NumberValue(
|
|
3161
|
+
context).ToChecked()));
|
|
3162
|
+
}
|
|
3258
3163
|
|
|
3259
3164
|
|
|
3260
3165
|
|
|
3261
|
-
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
}
|
|
3166
|
+
canvas_native_webgl2_uniform_matrix3x2fv(
|
|
3167
|
+
location->GetUniformLocation(),
|
|
3168
|
+
transpose,
|
|
3169
|
+
buf.data(), buf.size(),
|
|
3170
|
+
ptr->GetState()
|
|
3171
|
+
);
|
|
3268
3172
|
}
|
|
3269
|
-
|
|
3270
3173
|
}
|
|
3271
3174
|
|
|
3272
3175
|
}
|
|
@@ -3281,58 +3184,49 @@ void WebGL2RenderingContext::UniformMatrix3x4fv(const v8::FunctionCallbackInfo<v
|
|
|
3281
3184
|
auto context = isolate->GetCurrentContext();
|
|
3282
3185
|
|
|
3283
3186
|
|
|
3284
|
-
|
|
3285
|
-
|
|
3286
|
-
|
|
3287
|
-
auto
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
auto transpose = args[1]->BooleanValue(isolate);
|
|
3291
|
-
auto data = args[2];
|
|
3187
|
+
auto locationValue = args[0];
|
|
3188
|
+
auto type = GetNativeType(isolate, locationValue);
|
|
3189
|
+
if (type == NativeType::WebGLUniformLocation) {
|
|
3190
|
+
auto location = WebGLUniformLocation::GetPointer(locationValue.As<v8::Object>());
|
|
3191
|
+
auto transpose = args[1]->BooleanValue(isolate);
|
|
3192
|
+
auto dataValue = args[2];
|
|
3292
3193
|
|
|
3293
|
-
|
|
3294
|
-
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
|
|
3299
|
-
|
|
3194
|
+
if (dataValue->IsFloat32Array()) {
|
|
3195
|
+
auto buf = dataValue.As<v8::Float32Array>();
|
|
3196
|
+
auto array = buf->Buffer();
|
|
3197
|
+
auto offset = buf->ByteOffset();
|
|
3198
|
+
auto size = buf->Length();
|
|
3199
|
+
auto data_ptr = static_cast<uint8_t*>(array->GetBackingStore()->Data()) + offset;
|
|
3200
|
+
auto data = static_cast<float *>((void*) data_ptr);
|
|
3300
3201
|
|
|
3301
3202
|
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
|
|
3318
|
-
|
|
3319
|
-
} else {
|
|
3320
|
-
buf.push_back(
|
|
3321
|
-
std::nanf(""));
|
|
3322
|
-
}
|
|
3323
|
-
}
|
|
3203
|
+
canvas_native_webgl2_uniform_matrix3x4fv(
|
|
3204
|
+
location->GetUniformLocation(),
|
|
3205
|
+
transpose,
|
|
3206
|
+
data, size,
|
|
3207
|
+
ptr->GetState()
|
|
3208
|
+
);
|
|
3209
|
+
} else if (dataValue->IsArray()) {
|
|
3210
|
+
std::vector<float> buf;
|
|
3211
|
+
auto array = dataValue.As<v8::Array>();
|
|
3212
|
+
auto len = array->Length();
|
|
3213
|
+
for (int i = 0; i < len; i++) {
|
|
3214
|
+
auto item = array->Get(
|
|
3215
|
+
context, i).ToLocalChecked();
|
|
3216
|
+
buf.push_back(
|
|
3217
|
+
static_cast<float>(item->NumberValue(
|
|
3218
|
+
context).ToChecked()));
|
|
3219
|
+
}
|
|
3324
3220
|
|
|
3325
3221
|
|
|
3326
3222
|
|
|
3327
|
-
|
|
3328
|
-
|
|
3329
|
-
|
|
3330
|
-
|
|
3331
|
-
|
|
3332
|
-
|
|
3333
|
-
}
|
|
3223
|
+
canvas_native_webgl2_uniform_matrix3x4fv(
|
|
3224
|
+
location->GetUniformLocation(),
|
|
3225
|
+
transpose,
|
|
3226
|
+
buf.data(), buf.size(),
|
|
3227
|
+
ptr->GetState()
|
|
3228
|
+
);
|
|
3334
3229
|
}
|
|
3335
|
-
|
|
3336
3230
|
}
|
|
3337
3231
|
|
|
3338
3232
|
}
|
|
@@ -3347,58 +3241,49 @@ void WebGL2RenderingContext::UniformMatrix4x2fv(const v8::FunctionCallbackInfo<v
|
|
|
3347
3241
|
auto context = isolate->GetCurrentContext();
|
|
3348
3242
|
|
|
3349
3243
|
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
|
|
3353
|
-
auto
|
|
3354
|
-
|
|
3355
|
-
|
|
3356
|
-
auto transpose = args[1]->BooleanValue(isolate);
|
|
3357
|
-
auto data = args[2];
|
|
3244
|
+
auto locationValue = args[0];
|
|
3245
|
+
auto type = GetNativeType(isolate, locationValue);
|
|
3246
|
+
if (type == NativeType::WebGLUniformLocation) {
|
|
3247
|
+
auto location = WebGLUniformLocation::GetPointer(locationValue.As<v8::Object>());
|
|
3248
|
+
auto transpose = args[1]->BooleanValue(isolate);
|
|
3249
|
+
auto dataValue = args[2];
|
|
3358
3250
|
|
|
3359
|
-
|
|
3360
|
-
|
|
3251
|
+
if (dataValue->IsFloat32Array()) {
|
|
3252
|
+
auto buf = dataValue.As<v8::Float32Array>();
|
|
3361
3253
|
|
|
3362
|
-
|
|
3363
|
-
|
|
3364
|
-
|
|
3365
|
-
|
|
3366
|
-
|
|
3254
|
+
auto array = buf->Buffer();
|
|
3255
|
+
auto offset = buf->ByteOffset();
|
|
3256
|
+
auto size = buf->Length();
|
|
3257
|
+
auto data_ptr = static_cast<uint8_t*>(array->GetBackingStore()->Data()) + offset;
|
|
3258
|
+
auto data = static_cast<float *>((void*) data_ptr);
|
|
3367
3259
|
|
|
3368
|
-
|
|
3369
|
-
|
|
3370
|
-
|
|
3371
|
-
|
|
3372
|
-
|
|
3373
|
-
|
|
3374
|
-
|
|
3375
|
-
|
|
3376
|
-
|
|
3377
|
-
|
|
3378
|
-
|
|
3379
|
-
|
|
3380
|
-
|
|
3381
|
-
|
|
3382
|
-
|
|
3383
|
-
|
|
3384
|
-
|
|
3385
|
-
} else {
|
|
3386
|
-
buf.push_back(
|
|
3387
|
-
std::nanf(""));
|
|
3388
|
-
}
|
|
3389
|
-
}
|
|
3260
|
+
canvas_native_webgl2_uniform_matrix4x2fv(
|
|
3261
|
+
location->GetUniformLocation(),
|
|
3262
|
+
transpose,
|
|
3263
|
+
data, size,
|
|
3264
|
+
ptr->GetState()
|
|
3265
|
+
);
|
|
3266
|
+
} else if (dataValue->IsArray()) {
|
|
3267
|
+
std::vector<float> buf;
|
|
3268
|
+
auto array = dataValue.As<v8::Array>();
|
|
3269
|
+
auto len = array->Length();
|
|
3270
|
+
for (int i = 0; i < len; i++) {
|
|
3271
|
+
auto item = array->Get(
|
|
3272
|
+
context, i).ToLocalChecked();
|
|
3273
|
+
buf.push_back(
|
|
3274
|
+
static_cast<float>(item->NumberValue(
|
|
3275
|
+
context).ToChecked()));
|
|
3276
|
+
}
|
|
3390
3277
|
|
|
3391
3278
|
|
|
3392
3279
|
|
|
3393
|
-
|
|
3394
|
-
|
|
3395
|
-
|
|
3396
|
-
|
|
3397
|
-
|
|
3398
|
-
|
|
3399
|
-
}
|
|
3280
|
+
canvas_native_webgl2_uniform_matrix4x2fv(
|
|
3281
|
+
location->GetUniformLocation(),
|
|
3282
|
+
transpose,
|
|
3283
|
+
buf.data(), buf.size(),
|
|
3284
|
+
ptr->GetState()
|
|
3285
|
+
);
|
|
3400
3286
|
}
|
|
3401
|
-
|
|
3402
3287
|
}
|
|
3403
3288
|
|
|
3404
3289
|
}
|
|
@@ -3413,56 +3298,47 @@ void WebGL2RenderingContext::UniformMatrix4x3fv(const v8::FunctionCallbackInfo<v
|
|
|
3413
3298
|
auto context = isolate->GetCurrentContext();
|
|
3414
3299
|
|
|
3415
3300
|
|
|
3416
|
-
|
|
3417
|
-
|
|
3418
|
-
|
|
3419
|
-
auto
|
|
3420
|
-
|
|
3421
|
-
|
|
3422
|
-
auto transpose = args[1]->BooleanValue(isolate);
|
|
3423
|
-
auto data = args[2];
|
|
3301
|
+
auto locationValue = args[0];
|
|
3302
|
+
auto type = GetNativeType(isolate, locationValue);
|
|
3303
|
+
if (type == NativeType::WebGLUniformLocation) {
|
|
3304
|
+
auto location = WebGLUniformLocation::GetPointer(locationValue.As<v8::Object>());
|
|
3305
|
+
auto transpose = args[1]->BooleanValue(isolate);
|
|
3306
|
+
auto dataValue = args[2];
|
|
3424
3307
|
|
|
3425
|
-
|
|
3426
|
-
|
|
3427
|
-
|
|
3428
|
-
|
|
3429
|
-
|
|
3430
|
-
|
|
3431
|
-
|
|
3308
|
+
if (dataValue->IsFloat32Array()) {
|
|
3309
|
+
auto buf = dataValue.As<v8::Float32Array>();
|
|
3310
|
+
auto array = buf->Buffer();
|
|
3311
|
+
auto offset = buf->ByteOffset();
|
|
3312
|
+
auto size = buf->Length();
|
|
3313
|
+
auto data_ptr = static_cast<uint8_t*>(array->GetBackingStore()->Data()) + offset;
|
|
3314
|
+
auto data = static_cast<float *>((void*) data_ptr);
|
|
3432
3315
|
|
|
3433
|
-
|
|
3434
|
-
|
|
3435
|
-
|
|
3436
|
-
|
|
3437
|
-
|
|
3438
|
-
|
|
3439
|
-
|
|
3440
|
-
|
|
3441
|
-
|
|
3442
|
-
|
|
3443
|
-
|
|
3444
|
-
|
|
3445
|
-
|
|
3446
|
-
|
|
3447
|
-
|
|
3448
|
-
|
|
3449
|
-
|
|
3450
|
-
} else {
|
|
3451
|
-
buf.push_back(
|
|
3452
|
-
std::nanf(""));
|
|
3453
|
-
}
|
|
3454
|
-
}
|
|
3316
|
+
canvas_native_webgl2_uniform_matrix4x3fv(
|
|
3317
|
+
location->GetUniformLocation(),
|
|
3318
|
+
transpose,
|
|
3319
|
+
data, size,
|
|
3320
|
+
ptr->GetState()
|
|
3321
|
+
);
|
|
3322
|
+
} else if (dataValue->IsArray()) {
|
|
3323
|
+
std::vector<float> buf;
|
|
3324
|
+
auto array = dataValue.As<v8::Array>();
|
|
3325
|
+
auto len = array->Length();
|
|
3326
|
+
for (int i = 0; i < len; i++) {
|
|
3327
|
+
auto item = array->Get(
|
|
3328
|
+
context, i).ToLocalChecked();
|
|
3329
|
+
buf.push_back(
|
|
3330
|
+
static_cast<float>(item->NumberValue(
|
|
3331
|
+
context).ToChecked()));
|
|
3332
|
+
}
|
|
3455
3333
|
|
|
3456
3334
|
|
|
3457
|
-
|
|
3458
|
-
|
|
3459
|
-
|
|
3460
|
-
|
|
3461
|
-
|
|
3462
|
-
|
|
3463
|
-
}
|
|
3335
|
+
canvas_native_webgl2_uniform_matrix4x3fv(
|
|
3336
|
+
location->GetUniformLocation(),
|
|
3337
|
+
transpose,
|
|
3338
|
+
buf.data(), buf.size(),
|
|
3339
|
+
ptr->GetState()
|
|
3340
|
+
);
|
|
3464
3341
|
}
|
|
3465
|
-
|
|
3466
3342
|
}
|
|
3467
3343
|
|
|
3468
3344
|
}
|
|
@@ -3477,17 +3353,15 @@ void WebGL2RenderingContext::VertexAttribDivisor(const v8::FunctionCallbackInfo<
|
|
|
3477
3353
|
auto context = isolate->GetCurrentContext();
|
|
3478
3354
|
|
|
3479
3355
|
|
|
3480
|
-
|
|
3481
|
-
|
|
3482
|
-
|
|
3483
|
-
|
|
3484
|
-
|
|
3485
|
-
|
|
3486
|
-
|
|
3487
|
-
|
|
3488
|
-
|
|
3489
|
-
);
|
|
3490
|
-
}
|
|
3356
|
+
auto index = args[0]->NumberValue(
|
|
3357
|
+
context).ToChecked();
|
|
3358
|
+
auto divisor = args[1]->NumberValue(
|
|
3359
|
+
context).ToChecked();
|
|
3360
|
+
canvas_native_webgl2_vertex_attrib_divisor(
|
|
3361
|
+
(uint32_t) index,
|
|
3362
|
+
(uint32_t) divisor,
|
|
3363
|
+
ptr->GetState()
|
|
3364
|
+
);
|
|
3491
3365
|
|
|
3492
3366
|
}
|
|
3493
3367
|
|
|
@@ -3501,26 +3375,24 @@ void WebGL2RenderingContext::VertexAttribI4i(const v8::FunctionCallbackInfo<v8::
|
|
|
3501
3375
|
auto context = isolate->GetCurrentContext();
|
|
3502
3376
|
|
|
3503
3377
|
|
|
3504
|
-
|
|
3505
|
-
|
|
3506
|
-
|
|
3507
|
-
|
|
3508
|
-
|
|
3509
|
-
|
|
3510
|
-
|
|
3511
|
-
|
|
3512
|
-
|
|
3513
|
-
|
|
3514
|
-
|
|
3515
|
-
|
|
3516
|
-
|
|
3517
|
-
|
|
3518
|
-
|
|
3519
|
-
|
|
3520
|
-
|
|
3521
|
-
|
|
3522
|
-
);
|
|
3523
|
-
}
|
|
3378
|
+
auto index = args[0]->NumberValue(
|
|
3379
|
+
context).ToChecked();
|
|
3380
|
+
auto v0 = args[1]->NumberValue(
|
|
3381
|
+
context).ToChecked();
|
|
3382
|
+
auto v1 = args[2]->NumberValue(
|
|
3383
|
+
context).ToChecked();
|
|
3384
|
+
auto v2 = args[3]->NumberValue(
|
|
3385
|
+
context).ToChecked();
|
|
3386
|
+
auto v3 = args[4]->NumberValue(
|
|
3387
|
+
context).ToChecked();
|
|
3388
|
+
canvas_native_webgl2_vertex_attrib_i4i(
|
|
3389
|
+
(uint32_t) index,
|
|
3390
|
+
(int32_t) v0,
|
|
3391
|
+
(int32_t) v1,
|
|
3392
|
+
(int32_t) v2,
|
|
3393
|
+
(int32_t) v3,
|
|
3394
|
+
ptr->GetState()
|
|
3395
|
+
);
|
|
3524
3396
|
|
|
3525
3397
|
}
|
|
3526
3398
|
|
|
@@ -3534,46 +3406,43 @@ void WebGL2RenderingContext::VertexAttribI4iv(const v8::FunctionCallbackInfo<v8:
|
|
|
3534
3406
|
auto context = isolate->GetCurrentContext();
|
|
3535
3407
|
|
|
3536
3408
|
|
|
3537
|
-
|
|
3538
|
-
|
|
3539
|
-
|
|
3540
|
-
|
|
3541
|
-
auto
|
|
3542
|
-
if (value->IsInt32Array()) {
|
|
3543
|
-
auto buf = value.As<v8::Int32Array>();
|
|
3409
|
+
auto index = (uint32_t) args[0]->NumberValue(
|
|
3410
|
+
context).ToChecked();
|
|
3411
|
+
auto value = args[1];
|
|
3412
|
+
if (value->IsInt32Array()) {
|
|
3413
|
+
auto buf = value.As<v8::Int32Array>();
|
|
3544
3414
|
|
|
3545
|
-
|
|
3546
|
-
|
|
3547
|
-
|
|
3548
|
-
|
|
3549
|
-
|
|
3415
|
+
auto array = buf->Buffer();
|
|
3416
|
+
auto offset = buf->ByteOffset();
|
|
3417
|
+
auto size = buf->Length();
|
|
3418
|
+
auto data_ptr = static_cast<uint8_t*>(array->GetBackingStore()->Data()) + offset;
|
|
3419
|
+
auto data = static_cast<int32_t *>((void*) data_ptr);
|
|
3550
3420
|
|
|
3551
3421
|
|
|
3552
|
-
|
|
3553
|
-
|
|
3554
|
-
|
|
3555
|
-
|
|
3556
|
-
|
|
3557
|
-
|
|
3558
|
-
|
|
3559
|
-
|
|
3560
|
-
|
|
3561
|
-
|
|
3562
|
-
|
|
3563
|
-
|
|
3564
|
-
|
|
3565
|
-
|
|
3566
|
-
|
|
3567
|
-
|
|
3568
|
-
|
|
3422
|
+
canvas_native_webgl2_vertex_attrib_i4iv(
|
|
3423
|
+
index,
|
|
3424
|
+
data, size,
|
|
3425
|
+
ptr->GetState()
|
|
3426
|
+
);
|
|
3427
|
+
} else if (value->IsArray()) {
|
|
3428
|
+
auto array = value.As<v8::Array>();
|
|
3429
|
+
auto len = array->Length();
|
|
3430
|
+
std::vector<int32_t> buf;
|
|
3431
|
+
buf.reserve(len);
|
|
3432
|
+
for (int i = 0; i < len; i++) {
|
|
3433
|
+
auto item = (int32_t) array->Get(
|
|
3434
|
+
context,
|
|
3435
|
+
i).ToLocalChecked()->NumberValue(
|
|
3436
|
+
context).ToChecked();
|
|
3437
|
+
buf.push_back(item);
|
|
3438
|
+
}
|
|
3569
3439
|
|
|
3570
3440
|
|
|
3571
|
-
|
|
3572
|
-
|
|
3573
|
-
|
|
3574
|
-
|
|
3575
|
-
|
|
3576
|
-
}
|
|
3441
|
+
canvas_native_webgl2_vertex_attrib_i4iv(
|
|
3442
|
+
index,
|
|
3443
|
+
buf.data(), buf.size(),
|
|
3444
|
+
ptr->GetState()
|
|
3445
|
+
);
|
|
3577
3446
|
}
|
|
3578
3447
|
|
|
3579
3448
|
}
|
|
@@ -3588,27 +3457,25 @@ void WebGL2RenderingContext::VertexAttribI4ui(const v8::FunctionCallbackInfo<v8:
|
|
|
3588
3457
|
auto context = isolate->GetCurrentContext();
|
|
3589
3458
|
|
|
3590
3459
|
|
|
3591
|
-
|
|
3592
|
-
|
|
3593
|
-
|
|
3594
|
-
|
|
3595
|
-
|
|
3596
|
-
|
|
3597
|
-
|
|
3598
|
-
|
|
3599
|
-
|
|
3600
|
-
|
|
3601
|
-
|
|
3602
|
-
|
|
3603
|
-
|
|
3604
|
-
|
|
3605
|
-
|
|
3606
|
-
|
|
3607
|
-
|
|
3608
|
-
|
|
3609
|
-
|
|
3610
|
-
);
|
|
3611
|
-
}
|
|
3460
|
+
auto index = (uint32_t) args[0]->NumberValue(
|
|
3461
|
+
context).ToChecked();
|
|
3462
|
+
auto v0 = (uint32_t) args[1]->NumberValue(
|
|
3463
|
+
context).ToChecked();
|
|
3464
|
+
auto v1 = (uint32_t) args[2]->NumberValue(
|
|
3465
|
+
context).ToChecked();
|
|
3466
|
+
auto v2 = (uint32_t) args[3]->NumberValue(
|
|
3467
|
+
context).ToChecked();
|
|
3468
|
+
auto v3 = (uint32_t) args[4]->NumberValue(
|
|
3469
|
+
context).ToChecked();
|
|
3470
|
+
|
|
3471
|
+
canvas_native_webgl2_vertex_attrib_i4ui(
|
|
3472
|
+
index,
|
|
3473
|
+
v0,
|
|
3474
|
+
v1,
|
|
3475
|
+
v2,
|
|
3476
|
+
v3,
|
|
3477
|
+
ptr->GetState()
|
|
3478
|
+
);
|
|
3612
3479
|
|
|
3613
3480
|
}
|
|
3614
3481
|
|
|
@@ -3621,46 +3488,42 @@ void WebGL2RenderingContext::VertexAttribI4uiv(const v8::FunctionCallbackInfo<v8
|
|
|
3621
3488
|
auto isolate = args.GetIsolate();
|
|
3622
3489
|
auto context = isolate->GetCurrentContext();
|
|
3623
3490
|
|
|
3624
|
-
|
|
3625
|
-
|
|
3626
|
-
|
|
3627
|
-
|
|
3628
|
-
|
|
3629
|
-
auto
|
|
3630
|
-
|
|
3631
|
-
|
|
3632
|
-
|
|
3633
|
-
|
|
3634
|
-
auto size = buf->Length();
|
|
3635
|
-
auto data_ptr = static_cast<uint8_t*>(array->GetBackingStore()->Data()) + offset;
|
|
3636
|
-
auto data = static_cast<uint32_t *>((void*) data_ptr);
|
|
3491
|
+
auto index = (uint32_t) args[0]->NumberValue(
|
|
3492
|
+
context).ToChecked();
|
|
3493
|
+
auto value = args[1];
|
|
3494
|
+
if (value->IsUint32Array()) {
|
|
3495
|
+
auto buf = value.As<v8::Uint32Array>();
|
|
3496
|
+
auto array = buf->Buffer();
|
|
3497
|
+
auto offset = buf->ByteOffset();
|
|
3498
|
+
auto size = buf->Length();
|
|
3499
|
+
auto data_ptr = static_cast<uint8_t*>(array->GetBackingStore()->Data()) + offset;
|
|
3500
|
+
auto data = static_cast<uint32_t *>((void*) data_ptr);
|
|
3637
3501
|
|
|
3638
3502
|
|
|
3639
|
-
|
|
3640
|
-
|
|
3641
|
-
|
|
3642
|
-
|
|
3643
|
-
|
|
3644
|
-
|
|
3645
|
-
|
|
3646
|
-
|
|
3647
|
-
|
|
3648
|
-
|
|
3649
|
-
|
|
3650
|
-
|
|
3651
|
-
|
|
3652
|
-
|
|
3653
|
-
|
|
3654
|
-
|
|
3655
|
-
|
|
3503
|
+
canvas_native_webgl2_vertex_attrib_i4uiv(
|
|
3504
|
+
index,
|
|
3505
|
+
data, size,
|
|
3506
|
+
ptr->GetState()
|
|
3507
|
+
);
|
|
3508
|
+
} else if (value->IsArray()) {
|
|
3509
|
+
auto array = value.As<v8::Array>();
|
|
3510
|
+
auto len = array->Length();
|
|
3511
|
+
std::vector<uint32_t> buf;
|
|
3512
|
+
buf.reserve(len);
|
|
3513
|
+
for (int i = 0; i < len; i++) {
|
|
3514
|
+
auto item = (uint32_t) array->Get(
|
|
3515
|
+
context,
|
|
3516
|
+
i).ToLocalChecked()->NumberValue(
|
|
3517
|
+
context).ToChecked();
|
|
3518
|
+
buf.push_back(item);
|
|
3519
|
+
}
|
|
3656
3520
|
|
|
3657
3521
|
|
|
3658
|
-
|
|
3659
|
-
|
|
3660
|
-
|
|
3661
|
-
|
|
3662
|
-
|
|
3663
|
-
}
|
|
3522
|
+
canvas_native_webgl2_vertex_attrib_i4uiv(
|
|
3523
|
+
index,
|
|
3524
|
+
buf.data(), buf.size(),
|
|
3525
|
+
ptr->GetState()
|
|
3526
|
+
);
|
|
3664
3527
|
}
|
|
3665
3528
|
|
|
3666
3529
|
}
|