@nativescript/canvas 1.0.0-debug.0 → 1.1.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (144) hide show
  1. package/Canvas/common.d.ts +35 -13
  2. package/Canvas/common.js +458 -204
  3. package/Canvas/common.js.map +1 -1
  4. package/Canvas/index.android.d.ts +2 -0
  5. package/Canvas/index.android.js +17 -7
  6. package/Canvas/index.android.js.map +1 -1
  7. package/Canvas/index.d.ts +14 -0
  8. package/Canvas/index.ios.d.ts +1 -0
  9. package/Canvas/index.ios.js +10 -2
  10. package/Canvas/index.ios.js.map +1 -1
  11. package/Canvas2D/CanvasGradient/CanvasGradient.android.js.map +1 -1
  12. package/Canvas2D/CanvasRenderingContext2D/index.android.d.ts +3 -0
  13. package/Canvas2D/CanvasRenderingContext2D/index.android.js +53 -35
  14. package/Canvas2D/CanvasRenderingContext2D/index.android.js.map +1 -1
  15. package/Canvas2D/CanvasRenderingContext2D/index.d.ts +6 -0
  16. package/Canvas2D/CanvasRenderingContext2D/index.ios.d.ts +4 -1
  17. package/Canvas2D/CanvasRenderingContext2D/index.ios.js +126 -113
  18. package/Canvas2D/CanvasRenderingContext2D/index.ios.js.map +1 -1
  19. package/Canvas2D/DOMMatrix/DOMMatrix.android.js +3 -0
  20. package/Canvas2D/DOMMatrix/DOMMatrix.android.js.map +1 -1
  21. package/Canvas2D/DOMMatrix/DOMMatrix.ios.js +3 -0
  22. package/Canvas2D/DOMMatrix/DOMMatrix.ios.js.map +1 -1
  23. package/Canvas2D/DOMMatrix/common.d.ts +1 -0
  24. package/Canvas2D/DOMMatrix/common.js +4 -0
  25. package/Canvas2D/DOMMatrix/common.js.map +1 -1
  26. package/Canvas2D/ImageData/ImageData.android.js +11 -0
  27. package/Canvas2D/ImageData/ImageData.android.js.map +1 -1
  28. package/Canvas2D/ImageData/ImageData.ios.js +11 -0
  29. package/Canvas2D/ImageData/ImageData.ios.js.map +1 -1
  30. package/Canvas2D/ImageData/common.d.ts +1 -0
  31. package/Canvas2D/ImageData/common.js +4 -0
  32. package/Canvas2D/ImageData/common.js.map +1 -1
  33. package/Canvas2D/Path2D/common.d.ts +1 -0
  34. package/Canvas2D/Path2D/common.js +4 -0
  35. package/Canvas2D/Path2D/common.js.map +1 -1
  36. package/Canvas2D/TextMetrics/common.d.ts +1 -0
  37. package/Canvas2D/TextMetrics/common.js +4 -0
  38. package/Canvas2D/TextMetrics/common.js.map +1 -1
  39. package/ImageAsset/common.d.ts +1 -0
  40. package/ImageAsset/common.js +4 -0
  41. package/ImageAsset/common.js.map +1 -1
  42. package/ImageBitmap/common.d.ts +1 -0
  43. package/ImageBitmap/common.js +4 -0
  44. package/ImageBitmap/common.js.map +1 -1
  45. package/ImageBitmap/index.android.js +32 -0
  46. package/ImageBitmap/index.android.js.map +1 -1
  47. package/ImageBitmap/index.ios.js +41 -9
  48. package/ImageBitmap/index.ios.js.map +1 -1
  49. package/SVG/Image.js +2 -0
  50. package/SVG/Image.js.map +1 -1
  51. package/SVG/SVG.js +9 -0
  52. package/SVG/SVG.js.map +1 -1
  53. package/TextDecoder/TextDecoder.android.d.ts +1 -0
  54. package/TextDecoder/TextDecoder.android.js +29 -20
  55. package/TextDecoder/TextDecoder.android.js.map +1 -1
  56. package/TextDecoder/TextDecoder.ios.js +12 -16
  57. package/TextDecoder/TextDecoder.ios.js.map +1 -1
  58. package/TextDecoder/common.d.ts +1 -0
  59. package/TextDecoder/common.js +4 -0
  60. package/TextDecoder/common.js.map +1 -1
  61. package/TextEncoder/common.d.ts +1 -0
  62. package/TextEncoder/common.js +4 -0
  63. package/TextEncoder/common.js.map +1 -1
  64. package/WebGL/WebGLExtensions/index.android.js +1 -0
  65. package/WebGL/WebGLExtensions/index.android.js.map +1 -1
  66. package/WebGL/WebGLExtensions/index.ios.js +1 -0
  67. package/WebGL/WebGLExtensions/index.ios.js.map +1 -1
  68. package/WebGL/WebGLRenderingContext/index.android.d.ts +1 -0
  69. package/WebGL/WebGLRenderingContext/index.android.js +394 -111
  70. package/WebGL/WebGLRenderingContext/index.android.js.map +1 -1
  71. package/WebGL/WebGLRenderingContext/index.ios.js +35 -24
  72. package/WebGL/WebGLRenderingContext/index.ios.js.map +1 -1
  73. package/WebGL2/WebGL2RenderingContext/index.android.js +2 -2
  74. package/WebGL2/WebGL2RenderingContext/index.android.js.map +1 -1
  75. package/WebGL2/WebGL2RenderingContext/index.ios.js +39 -29
  76. package/WebGL2/WebGL2RenderingContext/index.ios.js.map +1 -1
  77. package/angular/esm2020/index.mjs +17 -0
  78. package/angular/esm2020/nativescript-canvas-angular.mjs +5 -0
  79. package/angular/fesm2015/nativescript-canvas-angular.mjs +24 -0
  80. package/angular/fesm2015/nativescript-canvas-angular.mjs.map +1 -0
  81. package/angular/fesm2020/nativescript-canvas-angular.mjs +24 -0
  82. package/angular/fesm2020/nativescript-canvas-angular.mjs.map +1 -0
  83. package/angular/index.d.ts +4 -0
  84. package/angular/package.json +20 -8
  85. package/index.d.ts +3 -4
  86. package/index.js +54 -8
  87. package/index.js.map +1 -1
  88. package/package.json +2 -3
  89. package/platforms/android/include.gradle +21 -1
  90. package/platforms/ios/CanvasNative.xcframework/Info.plist +10 -5
  91. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/CanvasNative +0 -0
  92. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Headers/CanvasNative-Swift.h +120 -3
  93. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Headers/canvas_native.h +1122 -471
  94. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Info.plist +0 -0
  95. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/CanvasNative.swiftmodule/Project/arm64-apple-ios.swiftsourceinfo +0 -0
  96. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios.abi.json +74840 -0
  97. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/CanvasNative.swiftmodule/{arm64.swiftinterface → arm64-apple-ios.private.swiftinterface} +203 -121
  98. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
  99. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios.swiftinterface +203 -121
  100. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/module.modulemap +2 -2
  101. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/TNSCanvas.nib +0 -0
  102. package/platforms/ios/CanvasNative.xcframework/ios-arm64/dSYMs/CanvasNative.framework.dSYM/Contents/Info.plist +20 -0
  103. package/platforms/ios/CanvasNative.xcframework/ios-arm64/dSYMs/CanvasNative.framework.dSYM/Contents/Resources/DWARF/CanvasNative +0 -0
  104. package/platforms/ios/CanvasNative.xcframework/{ios-x86_64-simulator → ios-arm64_x86_64-simulator}/CanvasNative.framework/CanvasNative +0 -0
  105. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Headers/CanvasNative-Swift.h +4116 -0
  106. package/platforms/ios/CanvasNative.xcframework/{ios-x86_64-simulator → ios-arm64_x86_64-simulator}/CanvasNative.framework/Headers/CanvasNative.h +0 -0
  107. package/platforms/ios/CanvasNative.xcframework/{ios-x86_64-simulator → ios-arm64_x86_64-simulator}/CanvasNative.framework/Headers/Utils.h +0 -0
  108. package/platforms/ios/CanvasNative.xcframework/{ios-x86_64-simulator → ios-arm64_x86_64-simulator}/CanvasNative.framework/Headers/canvas_native.h +1122 -471
  109. package/platforms/ios/CanvasNative.xcframework/{ios-x86_64-simulator → ios-arm64_x86_64-simulator}/CanvasNative.framework/Info.plist +0 -0
  110. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/Project/arm64-apple-ios-simulator.swiftsourceinfo +0 -0
  111. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/Project/x86_64-apple-ios-simulator.swiftsourceinfo +0 -0
  112. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios-simulator.abi.json +74840 -0
  113. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +3270 -0
  114. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
  115. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios-simulator.swiftinterface +3270 -0
  116. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.abi.json +74840 -0
  117. package/platforms/ios/CanvasNative.xcframework/{ios-x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/x86_64.swiftinterface → ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface} +203 -121
  118. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
  119. package/platforms/ios/CanvasNative.xcframework/{ios-x86_64-simulator → ios-arm64_x86_64-simulator}/CanvasNative.framework/Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +203 -121
  120. package/platforms/ios/CanvasNative.xcframework/{ios-x86_64-simulator → ios-arm64_x86_64-simulator}/CanvasNative.framework/Modules/module.modulemap +2 -2
  121. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/TNSCanvas.nib +0 -0
  122. package/platforms/ios/CanvasNative.xcframework/{ios-x86_64-simulator → ios-arm64_x86_64-simulator}/CanvasNative.framework/_CodeSignature/CodeResources +87 -69
  123. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/dSYMs/CanvasNative.framework.dSYM/Contents/Info.plist +20 -0
  124. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/dSYMs/CanvasNative.framework.dSYM/Contents/Resources/DWARF/CanvasNative +0 -0
  125. package/platforms/ios/Podfile +1 -1
  126. package/typings/objc!CanvasNative.d.ts +2018 -0
  127. package/typings/objc!CanvasNative.js +1 -0
  128. package/typings/objc!CanvasNative.js.map +1 -0
  129. package/utils.d.ts +3 -0
  130. package/utils.js +27 -0
  131. package/utils.js.map +1 -1
  132. package/angular/bundles/nativescript-canvas-angular.umd.js +0 -29
  133. package/angular/bundles/nativescript-canvas-angular.umd.js.map +0 -1
  134. package/angular/esm2015/index.js +0 -12
  135. package/angular/esm2015/nativescript-canvas-angular.js +0 -5
  136. package/angular/fesm2015/nativescript-canvas-angular.js +0 -19
  137. package/angular/fesm2015/nativescript-canvas-angular.js.map +0 -1
  138. package/angular/nativescript-canvas-angular.d.ts +0 -4
  139. package/angular/nativescript-canvas-angular.metadata.json +0 -1
  140. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64.swiftdoc +0 -0
  141. package/platforms/ios/CanvasNative.xcframework/ios-x86_64-simulator/CanvasNative.framework/Headers/CanvasNative-Swift.h +0 -1943
  142. package/platforms/ios/CanvasNative.xcframework/ios-x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
  143. package/platforms/ios/CanvasNative.xcframework/ios-x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/x86_64.swiftdoc +0 -0
  144. package/platforms/ios/CanvasNative.xcframework/ios-x86_64-simulator/CanvasNative.framework/TNSCanvas.nib +0 -0
@@ -13,6 +13,7 @@ import { ANGLE_instanced_arrays, EXT_blend_minmax, EXT_color_buffer_half_float,
13
13
  import { ImageAsset } from '../../ImageAsset';
14
14
  import { Canvas } from '../../Canvas';
15
15
  import { ImageBitmap } from '../../ImageBitmap';
16
+ import { Utils } from '../../utils';
16
17
  export class WebGLRenderingContext extends WebGLRenderingContextBase {
17
18
  constructor(context) {
18
19
  super(context);
@@ -182,6 +183,9 @@ export class WebGLRenderingContext extends WebGLRenderingContextBase {
182
183
  }
183
184
  return [];
184
185
  }
186
+ get _isSupported() {
187
+ return Utils.IS_SUPPORTED_TYPED_ARRAYS_VERSION;
188
+ }
185
189
  bufferData(target, srcData, usage) {
186
190
  this._glCheckError('bufferData');
187
191
  this._checkArgs('bufferData', arguments);
@@ -195,7 +199,12 @@ export class WebGLRenderingContext extends WebGLRenderingContextBase {
195
199
  this.context.bufferData(target, srcData.nativeObject, usage);
196
200
  }
197
201
  else {
198
- this.context.bufferDataByte(target, Array.from(new Uint8Array(srcData)), usage);
202
+ if (this._isSupported) {
203
+ this.context.bufferDataByteBuffer(target, srcData, usage);
204
+ }
205
+ else {
206
+ this.context.bufferDataByte(target, Array.from(new Uint8Array(srcData)), usage);
207
+ }
199
208
  }
200
209
  //this.context.bufferData(target, this.toNativeArray(new Uint8Array(srcData as any) as any, 'byte'), usage);
201
210
  }
@@ -207,20 +216,36 @@ export class WebGLRenderingContext extends WebGLRenderingContextBase {
207
216
  }
208
217
  else {
209
218
  if (srcData instanceof Uint8Array || srcData instanceof Uint8ClampedArray) {
210
- //this.context.bufferData(target, this.toNativeArray(srcData as any, 'byte'), usage);
211
- this.context.bufferDataByte(target, Array.from(srcData), usage);
219
+ if (this._isSupported) {
220
+ this.context.bufferDataByteBuffer(target, srcData, usage);
221
+ }
222
+ else {
223
+ this.context.bufferDataByte(target, Array.from(srcData), usage);
224
+ }
212
225
  }
213
226
  else if (srcData instanceof Uint16Array || srcData instanceof Int16Array) {
214
- //this.context.bufferData(target, this.toNativeArray(srcData as any, 'short'), usage);
215
- this.context.bufferDataShort(target, Array.from(srcData), usage);
227
+ if (this._isSupported) {
228
+ this.context.bufferDataShortBuffer(target, srcData, usage);
229
+ }
230
+ else {
231
+ this.context.bufferDataShort(target, Array.from(srcData), usage);
232
+ }
216
233
  }
217
234
  else if (srcData instanceof Uint32Array || srcData instanceof Int32Array) {
218
- //this.context.bufferData(target, this.toNativeArray(srcData as any, 'int'), usage);
219
- this.context.bufferDataInt(target, Array.from(srcData), usage);
235
+ if (this._isSupported) {
236
+ this.context.bufferDataIntBuffer(target, srcData, usage);
237
+ }
238
+ else {
239
+ this.context.bufferDataInt(target, Array.from(srcData), usage);
240
+ }
220
241
  }
221
242
  else if (srcData instanceof Float32Array) {
222
- //this.context.bufferData(target, this.toNativeArray(srcData as any, 'float'), usage);
223
- this.context.bufferDataFloat(target, Array.from(srcData), usage);
243
+ if (this._isSupported) {
244
+ this.context.bufferDataFloatBuffer(target, srcData, usage);
245
+ }
246
+ else {
247
+ this.context.bufferDataFloat(target, Array.from(srcData), usage);
248
+ }
224
249
  }
225
250
  }
226
251
  }
@@ -239,7 +264,12 @@ export class WebGLRenderingContext extends WebGLRenderingContextBase {
239
264
  this.context.bufferSubData(target, offset, srcData.nativeObject);
240
265
  }
241
266
  else {
242
- this.context.bufferSubDataByte(target, offset, Array.from(new Uint8Array(srcData)));
267
+ if (this._isSupported) {
268
+ this.context.bufferSubDataByteBuffer(target, offset, srcData);
269
+ }
270
+ else {
271
+ this.context.bufferSubDataByte(target, offset, Array.from(new Uint8Array(srcData)));
272
+ }
243
273
  }
244
274
  }
245
275
  else if (srcData && srcData.buffer instanceof ArrayBuffer) {
@@ -250,20 +280,36 @@ export class WebGLRenderingContext extends WebGLRenderingContextBase {
250
280
  }
251
281
  else {
252
282
  if (srcData instanceof Uint8Array || srcData instanceof Uint8ClampedArray) {
253
- //this.context.bufferSubData(target, offset, this.toNativeArray(srcData as any, 'byte'));
254
- this.context.bufferSubDataByte(target, offset, Array.from(srcData));
283
+ if (this._isSupported) {
284
+ this.context.bufferSubDataByteBuffer(target, offset, srcData);
285
+ }
286
+ else {
287
+ this.context.bufferSubDataByte(target, offset, Array.from(srcData));
288
+ }
255
289
  }
256
290
  else if (srcData instanceof Uint16Array || srcData instanceof Int16Array) {
257
- // this.context.bufferSubData(target, offset, this.toNativeArray(srcData as any, 'short'));
258
- this.context.bufferSubDataShort(target, offset, Array.from(srcData));
291
+ if (this._isSupported) {
292
+ this.context.bufferSubDataShortBuffer(target, offset, srcData);
293
+ }
294
+ else {
295
+ this.context.bufferSubDataShort(target, offset, Array.from(srcData));
296
+ }
259
297
  }
260
298
  else if (srcData instanceof Uint32Array || srcData instanceof Int32Array) {
261
- // this.context.bufferSubData(target, offset, this.toNativeArray(srcData as any, 'int'));
262
- this.context.bufferSubDataInt(target, offset, Array.from(srcData));
299
+ if (this._isSupported) {
300
+ this.context.bufferSubDataIntBuffer(target, offset, srcData);
301
+ }
302
+ else {
303
+ this.context.bufferSubDataInt(target, offset, Array.from(srcData));
304
+ }
263
305
  }
264
306
  else if (srcData instanceof Float32Array) {
265
- // this.context.bufferSubData(target, offset, this.toNativeArray(srcData as any, 'float'));
266
- this.context.bufferSubDataFloat(target, offset, Array.from(srcData));
307
+ if (this._isSupported) {
308
+ this.context.bufferSubDataFloatBuffer(target, offset, srcData);
309
+ }
310
+ else {
311
+ this.context.bufferSubDataFloat(target, offset, Array.from(srcData));
312
+ }
267
313
  }
268
314
  }
269
315
  }
@@ -907,32 +953,52 @@ export class WebGLRenderingContext extends WebGLRenderingContextBase {
907
953
  }
908
954
  else {
909
955
  if (pixels instanceof Uint8Array) {
910
- // this.context.readPixels(x, y, width, height, format, type, this.toNativeArray(pixels as any, 'byte'));
911
- this.context.readPixelsByte(x, y, width, height, format, type, Array.from(pixels));
956
+ if (this._isSupported) {
957
+ this.context.readPixelsByteBuffer(x, y, width, height, format, type, pixels);
958
+ }
959
+ else {
960
+ this.context.readPixelsByte(x, y, width, height, format, type, Array.from(pixels));
961
+ }
912
962
  }
913
963
  else if (pixels instanceof Uint16Array || pixels instanceof Int16Array) {
914
- // this.context.readPixels(x, y, width, height, format, type, this.toNativeArray(pixels as any, 'short'));
915
- this.context.readPixelsShort(x, y, width, height, format, type, Array.from(pixels));
964
+ if (this._isSupported) {
965
+ this.context.readPixelsShortBuffer(x, y, width, height, format, type, pixels);
966
+ }
967
+ else {
968
+ this.context.readPixelsShort(x, y, width, height, format, type, Array.from(pixels));
969
+ }
916
970
  }
917
971
  else if (pixels instanceof Uint32Array || pixels instanceof Int32Array) {
918
- // this.context.readPixels(x, y, width, height, format, type, this.toNativeArray(pixels as any, 'int'));
919
- this.context.readPixelsInt(x, y, width, height, format, type, Array.from(pixels));
972
+ if (this._isSupported) {
973
+ this.context.readPixelsIntBuffer(x, y, width, height, format, type, pixels);
974
+ }
975
+ else {
976
+ this.context.readPixelsInt(x, y, width, height, format, type, Array.from(pixels));
977
+ }
920
978
  }
921
979
  else if (pixels instanceof Float32Array) {
922
- // this.context.readPixels(x, y, width, height, format, type, this.toNativeArray(pixels as any, 'float'));
923
- this.context.readPixelsFloat(x, y, width, height, format, type, Array.from(pixels));
980
+ if (this._isSupported) {
981
+ this.context.readPixelsFloatBuffer(x, y, width, height, format, type, pixels);
982
+ }
983
+ else {
984
+ this.context.readPixelsFloat(x, y, width, height, format, type, Array.from(pixels));
985
+ }
924
986
  }
925
987
  }
926
988
  }
927
989
  else if (pixels instanceof ArrayBuffer) {
928
- // this.context.readPixels(x, y, width, height, format, type, this.toNativeArray(new Uint8Array(pixels as any) as any, 'byte'));
929
990
  // @ts-ignore
930
991
  if (pixels.nativeObject) {
931
992
  // @ts-ignore
932
993
  this.context.readPixels(x, y, width, height, format, type, pixels.nativeObject);
933
994
  }
934
995
  else {
935
- this.context.readPixelsByte(x, y, width, height, format, type, Array.from(new Uint8Array(pixels)));
996
+ if (this._isSupported) {
997
+ this.context.readPixelsByteBuffer(x, y, width, height, format, type, pixels);
998
+ }
999
+ else {
1000
+ this.context.readPixelsByte(x, y, width, height, format, type, Array.from(new Uint8Array(pixels)));
1001
+ }
936
1002
  }
937
1003
  }
938
1004
  }
@@ -995,10 +1061,6 @@ export class WebGLRenderingContext extends WebGLRenderingContextBase {
995
1061
  texImage2D(target, level, internalformat, width, height, border, format, type, pixels) {
996
1062
  this._glCheckError('texImage2D');
997
1063
  this._checkArgs('texImage2D', arguments);
998
- /* TODO */
999
- // this.blendFunc(this.SRC_ALPHA, this.ONE_MINUS_SRC_ALPHA);
1000
- // this.enable(this.BLEND);
1001
- /* TODO */
1002
1064
  if (arguments.length === 9) {
1003
1065
  if (pixels && pixels.buffer instanceof ArrayBuffer) {
1004
1066
  if (pixels.buffer.nativeObject) {
@@ -1007,20 +1069,36 @@ export class WebGLRenderingContext extends WebGLRenderingContextBase {
1007
1069
  }
1008
1070
  else {
1009
1071
  if (pixels instanceof Uint8Array) {
1010
- // this.context.texImage2D(target, level, internalformat, width, height, border, format, type, this.toNativeArray(pixels as any, 'byte'));
1011
- this.context.texImage2DByte(target, level, internalformat, width, height, border, format, type, Array.from(pixels));
1072
+ if (this._isSupported) {
1073
+ this.context.texImage2DByteBuffer(target, level, internalformat, width, height, border, format, type, pixels);
1074
+ }
1075
+ else {
1076
+ this.context.texImage2DByte(target, level, internalformat, width, height, border, format, type, Array.from(pixels));
1077
+ }
1012
1078
  }
1013
1079
  else if (pixels instanceof Uint16Array || pixels instanceof Int16Array) {
1014
- // this.context.texImage2D(target, level, internalformat, width, height, border, format, type, this.toNativeArray(pixels as any, 'short'));
1015
- this.context.texSubImage2DShort(target, level, internalformat, width, height, border, format, type, Array.from(pixels));
1080
+ if (this._isSupported) {
1081
+ this.context.texSubImage2DShortBuffer(target, level, internalformat, width, height, border, format, type, pixels);
1082
+ }
1083
+ else {
1084
+ this.context.texSubImage2DShort(target, level, internalformat, width, height, border, format, type, Array.from(pixels));
1085
+ }
1016
1086
  }
1017
1087
  else if (pixels instanceof Uint32Array || pixels instanceof Int32Array) {
1018
- // this.context.texImage2D(target, level, internalformat, width, height, border, format, type, this.toNativeArray(pixels as any, 'int'));
1019
- this.context.texImage2DInt(target, level, internalformat, width, height, border, format, type, Array.from(pixels));
1088
+ if (this._isSupported) {
1089
+ this.context.texImage2DIntBuffer(target, level, internalformat, width, height, border, format, type, pixels);
1090
+ }
1091
+ else {
1092
+ this.context.texImage2DInt(target, level, internalformat, width, height, border, format, type, Array.from(pixels));
1093
+ }
1020
1094
  }
1021
1095
  else if (pixels instanceof Float32Array) {
1022
- // this.context.texImage2D(target, level, internalformat, width, height, border, format, type, this.toNativeArray(pixels as any, 'float'));
1023
- this.context.texImage2DFloat(target, level, internalformat, width, height, border, format, type, Array.from(pixels));
1096
+ if (this._isSupported) {
1097
+ this.context.texImage2DFloatBuffer(target, level, internalformat, width, height, border, format, type, pixels);
1098
+ }
1099
+ else {
1100
+ this.context.texImage2DFloat(target, level, internalformat, width, height, border, format, type, Array.from(pixels));
1101
+ }
1024
1102
  }
1025
1103
  }
1026
1104
  }
@@ -1031,8 +1109,12 @@ export class WebGLRenderingContext extends WebGLRenderingContextBase {
1031
1109
  this.context.texImage2D(target, level, internalformat, width, height, border, format, type, pixels.nativeObject);
1032
1110
  }
1033
1111
  else {
1034
- // this.context.texImage2D(target, level, internalformat, width, height, border, format, type, this.toNativeArray(new Uint8Array(pixels as any) as any, 'byte'));
1035
- this.context.texImage2DByte(target, level, internalformat, width, height, border, format, type, Array.from(new Uint8Array(pixels)));
1112
+ if (this._isSupported) {
1113
+ this.context.texImage2DByteBuffer(target, level, internalformat, width, height, border, format, type, pixels);
1114
+ }
1115
+ else {
1116
+ this.context.texImage2DByte(target, level, internalformat, width, height, border, format, type, Array.from(new Uint8Array(pixels)));
1117
+ }
1036
1118
  }
1037
1119
  }
1038
1120
  else {
@@ -1049,7 +1131,7 @@ export class WebGLRenderingContext extends WebGLRenderingContextBase {
1049
1131
  else if (border instanceof ImageAsset) {
1050
1132
  this.context.texImage2D(target, level, internalformat, width, height, border.native);
1051
1133
  }
1052
- else if (border instanceof ImageBitmap) {
1134
+ else if (border instanceof ImageBitmap || (border === null || border === void 0 ? void 0 : border.native) instanceof org.nativescript.canvas.TNSImageBitmap) {
1053
1135
  this.context.texImage2D(target, level, internalformat, width, height, border.native);
1054
1136
  }
1055
1137
  else if (border instanceof android.graphics.Bitmap) {
@@ -1076,8 +1158,6 @@ export class WebGLRenderingContext extends WebGLRenderingContextBase {
1076
1158
  this.context.texImage2D(target, level, internalformat, width, height, border._canvas.android);
1077
1159
  }
1078
1160
  }
1079
- // this.blendFunc(this.SRC_ALPHA, this.ZERO);
1080
- // this.disable(this.BLEND);
1081
1161
  }
1082
1162
  texParameterf(target, pname, param) {
1083
1163
  this._glCheckError('texParameterf');
@@ -1099,32 +1179,52 @@ export class WebGLRenderingContext extends WebGLRenderingContextBase {
1099
1179
  }
1100
1180
  else {
1101
1181
  if (pixels instanceof Uint8Array) {
1102
- // this.context.texSubImage2D(target, level, xoffset, yoffset, width, height, format, type, this.toNativeArray(pixels as any, 'byte'));
1103
- this.context.texSubImage2DByte(target, level, xoffset, yoffset, width, height, format, type, Array.from(pixels));
1182
+ if (this._isSupported) {
1183
+ this.context.texSubImage2DByteBuffer(target, level, xoffset, yoffset, width, height, format, type, pixels);
1184
+ }
1185
+ else {
1186
+ this.context.texSubImage2DByte(target, level, xoffset, yoffset, width, height, format, type, Array.from(pixels));
1187
+ }
1104
1188
  }
1105
1189
  else if (pixels instanceof Uint16Array || pixels instanceof Int16Array) {
1106
- // this.context.texSubImage2D(target, level, xoffset, yoffset, width, height, format, type, this.toNativeArray(pixels as any, 'short'));
1107
- this.context.texSubImage2DShort(target, level, xoffset, yoffset, width, height, format, type, Array.from(pixels));
1190
+ if (this._isSupported) {
1191
+ this.context.texSubImage2DShortBuffer(target, level, xoffset, yoffset, width, height, format, type, pixels);
1192
+ }
1193
+ else {
1194
+ this.context.texSubImage2DShort(target, level, xoffset, yoffset, width, height, format, type, Array.from(pixels));
1195
+ }
1108
1196
  }
1109
1197
  else if (pixels instanceof Uint32Array || pixels instanceof Int32Array) {
1110
- // this.context.texSubImage2D(target, level, xoffset, yoffset, width, height, format, type, this.toNativeArray(pixels as any, 'int'));
1111
- this.context.texSubImage2DInt(target, level, xoffset, yoffset, width, height, format, type, Array.from(pixels));
1198
+ if (this._isSupported) {
1199
+ this.context.texSubImage2DIntBuffer(target, level, xoffset, yoffset, width, height, format, type, pixels);
1200
+ }
1201
+ else {
1202
+ this.context.texSubImage2DInt(target, level, xoffset, yoffset, width, height, format, type, Array.from(pixels));
1203
+ }
1112
1204
  }
1113
1205
  else if (pixels instanceof Float32Array) {
1114
- // this.context.texSubImage2D(target, level, xoffset, yoffset, width, height, format, type, this.toNativeArray(pixels as any, 'float'));
1115
- this.context.texSubImage2D(target, level, xoffset, yoffset, width, height, format, type, Array.from(pixels));
1206
+ if (this._isSupported) {
1207
+ this.context.texSubImage2DByte(target, level, xoffset, yoffset, width, height, format, type, pixels);
1208
+ }
1209
+ else {
1210
+ this.context.texSubImage2D(target, level, xoffset, yoffset, width, height, format, type, Array.from(pixels));
1211
+ }
1116
1212
  }
1117
1213
  }
1118
1214
  }
1119
1215
  else if (pixels instanceof ArrayBuffer) {
1120
- // this.context.texSubImage2D(target, level, xoffset, yoffset, width, height, format, type, this.toNativeArray(new Uint8Array(pixels as any) as any, 'byte'));
1121
1216
  // @ts-ignore
1122
1217
  if (pixels.nativeObject) {
1123
1218
  // @ts-ignore
1124
1219
  this.context.texSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels.nativeObject);
1125
1220
  }
1126
1221
  else {
1127
- this.context.texSubImage2DByte(target, level, xoffset, yoffset, width, height, format, type, Array.from(new Uint8Array(pixels)));
1222
+ if (this._isSupported) {
1223
+ this.context.texSubImage2DByteBuffer(target, level, xoffset, yoffset, width, height, format, type, pixels);
1224
+ }
1225
+ else {
1226
+ this.context.texSubImage2DByte(target, level, xoffset, yoffset, width, height, format, type, Array.from(new Uint8Array(pixels)));
1227
+ }
1128
1228
  }
1129
1229
  }
1130
1230
  }
@@ -1138,6 +1238,9 @@ export class WebGLRenderingContext extends WebGLRenderingContextBase {
1138
1238
  else if (format instanceof ImageAsset) {
1139
1239
  this.context.texSubImage2D(target, level, xoffset, yoffset, width, height, format.native);
1140
1240
  }
1241
+ else if (format instanceof ImageBitmap || (format === null || format === void 0 ? void 0 : format.native) instanceof org.nativescript.canvas.TNSImageBitmap) {
1242
+ this.context.texSubImage2D(target, level, xoffset, yoffset, width, height, format.native);
1243
+ }
1141
1244
  else if (format && typeof format.tagName === 'string' && (format.tagName === 'IMG' || format.tagName === 'IMAGE')) {
1142
1245
  if (format._imageSource instanceof ImageSource) {
1143
1246
  this.context.texSubImage2D(target, level, xoffset, yoffset, width, height, format._imageSource.android);
@@ -1167,20 +1270,44 @@ export class WebGLRenderingContext extends WebGLRenderingContextBase {
1167
1270
  uniform1iv(location, value) {
1168
1271
  this._glCheckError('uniform1iv');
1169
1272
  this._checkArgs('uniform1iv', arguments);
1170
- if (!Array.isArray(value)) {
1171
- value = Array.from(value);
1172
- }
1173
1273
  const loc = location ? location.native : 0;
1174
- this.context.uniform1iv(loc, value);
1274
+ if (this._isSupported) {
1275
+ if (!Array.isArray(value)) {
1276
+ this.context.uniform1ivBuffer(loc, value);
1277
+ }
1278
+ else {
1279
+ this.context.uniform1iv(loc, value);
1280
+ }
1281
+ }
1282
+ else {
1283
+ if (!Array.isArray(value)) {
1284
+ this.context.uniform1iv(loc, Array.from(value));
1285
+ }
1286
+ else {
1287
+ this.context.uniform1iv(loc, value);
1288
+ }
1289
+ }
1175
1290
  }
1176
1291
  uniform1fv(location, value) {
1177
1292
  this._glCheckError('uniform1fv');
1178
1293
  this._checkArgs('uniform1fv', arguments);
1179
- if (!Array.isArray(value)) {
1180
- value = Array.from(value);
1181
- }
1182
1294
  const loc = location ? location.native : 0;
1183
- this.context.uniform1fv(loc, value);
1295
+ if (this._isSupported) {
1296
+ if (!Array.isArray(value)) {
1297
+ this.context.uniform1fvBuffer(loc, value);
1298
+ }
1299
+ else {
1300
+ this.context.uniform1fv(loc, value);
1301
+ }
1302
+ }
1303
+ else {
1304
+ if (!Array.isArray(value)) {
1305
+ this.context.uniform1fv(loc, Array.from(value));
1306
+ }
1307
+ else {
1308
+ this.context.uniform1fv(loc, value);
1309
+ }
1310
+ }
1184
1311
  }
1185
1312
  uniform1i(location, v0) {
1186
1313
  this._glCheckError('uniform1i');
@@ -1197,20 +1324,44 @@ export class WebGLRenderingContext extends WebGLRenderingContextBase {
1197
1324
  uniform2iv(location, value) {
1198
1325
  this._glCheckError('uniform2iv');
1199
1326
  this._checkArgs('uniform2iv', arguments);
1200
- if (!Array.isArray(value)) {
1201
- value = Array.from(value);
1202
- }
1203
1327
  const loc = location ? location.native : 0;
1204
- this.context.uniform2iv(loc, value);
1328
+ if (this._isSupported) {
1329
+ if (!Array.isArray(value)) {
1330
+ this.context.uniform2ivBuffer(loc, value);
1331
+ }
1332
+ else {
1333
+ this.context.uniform2iv(loc, value);
1334
+ }
1335
+ }
1336
+ else {
1337
+ if (!Array.isArray(value)) {
1338
+ this.context.uniform2iv(loc, Array.from(value));
1339
+ }
1340
+ else {
1341
+ this.context.uniform2iv(loc, value);
1342
+ }
1343
+ }
1205
1344
  }
1206
1345
  uniform2fv(location, value) {
1207
1346
  this._glCheckError('uniform2fv');
1208
1347
  this._checkArgs('uniform2fv', arguments);
1209
- if (!Array.isArray(value)) {
1210
- value = Array.from(value);
1211
- }
1212
1348
  const loc = location ? location.native : 0;
1213
- this.context.uniform2fv(loc, value);
1349
+ if (this._isSupported) {
1350
+ if (!Array.isArray(value)) {
1351
+ this.context.uniform2fvBuffer(loc, value);
1352
+ }
1353
+ else {
1354
+ this.context.uniform2fv(loc, value);
1355
+ }
1356
+ }
1357
+ else {
1358
+ if (!Array.isArray(value)) {
1359
+ this.context.uniform2fv(loc, Array.from(value));
1360
+ }
1361
+ else {
1362
+ this.context.uniform2fv(loc, value);
1363
+ }
1364
+ }
1214
1365
  }
1215
1366
  uniform2i(location, v0, v1) {
1216
1367
  this._glCheckError('uniform2i');
@@ -1227,20 +1378,44 @@ export class WebGLRenderingContext extends WebGLRenderingContextBase {
1227
1378
  uniform3iv(location, value) {
1228
1379
  this._glCheckError('uniform3iv');
1229
1380
  this._checkArgs('uniform3iv', arguments);
1230
- if (!Array.isArray(value)) {
1231
- value = Array.from(value);
1232
- }
1233
1381
  const loc = location ? location.native : 0;
1234
- this.context.uniform3iv(loc, value);
1382
+ if (this._isSupported) {
1383
+ if (!Array.isArray(value)) {
1384
+ this.context.uniform3ivBuffer(loc, value);
1385
+ }
1386
+ else {
1387
+ this.context.uniform3iv(loc, value);
1388
+ }
1389
+ }
1390
+ else {
1391
+ if (!Array.isArray(value)) {
1392
+ this.context.uniform3iv(loc, Array.from(value));
1393
+ }
1394
+ else {
1395
+ this.context.uniform3iv(loc, value);
1396
+ }
1397
+ }
1235
1398
  }
1236
1399
  uniform3fv(location, value) {
1237
1400
  this._glCheckError('uniform3fv');
1238
1401
  this._checkArgs('uniform3fv', arguments);
1239
- if (!Array.isArray(value)) {
1240
- value = Array.from(value);
1241
- }
1242
1402
  const loc = location ? location.native : 0;
1243
- this.context.uniform3fv(loc, value);
1403
+ if (this._isSupported) {
1404
+ if (!Array.isArray(value)) {
1405
+ this.context.uniform3fvBuffer(loc, value);
1406
+ }
1407
+ else {
1408
+ this.context.uniform3fv(loc, value);
1409
+ }
1410
+ }
1411
+ else {
1412
+ if (!Array.isArray(value)) {
1413
+ this.context.uniform3fv(loc, Array.from(value));
1414
+ }
1415
+ else {
1416
+ this.context.uniform3fv(loc, value);
1417
+ }
1418
+ }
1244
1419
  }
1245
1420
  uniform3i(location, v0, v1, v2) {
1246
1421
  this._glCheckError('uniform3i');
@@ -1257,20 +1432,44 @@ export class WebGLRenderingContext extends WebGLRenderingContextBase {
1257
1432
  uniform4iv(location, value) {
1258
1433
  this._glCheckError('uniform4iv');
1259
1434
  this._checkArgs('uniform4iv', arguments);
1260
- if (!Array.isArray(value)) {
1261
- value = Array.from(value);
1262
- }
1263
1435
  const loc = location ? location.native : 0;
1264
- this.context.uniform4iv(loc, value);
1436
+ if (this._isSupported) {
1437
+ if (!Array.isArray(value)) {
1438
+ this.context.uniform4ivBuffer(loc, value);
1439
+ }
1440
+ else {
1441
+ this.context.uniform4iv(loc, value);
1442
+ }
1443
+ }
1444
+ else {
1445
+ if (!Array.isArray(value)) {
1446
+ this.context.uniform4iv(loc, Array.from(value));
1447
+ }
1448
+ else {
1449
+ this.context.uniform4iv(loc, value);
1450
+ }
1451
+ }
1265
1452
  }
1266
1453
  uniform4fv(location, value) {
1267
1454
  this._glCheckError('uniform4fv');
1268
1455
  this._checkArgs('uniform4fv', arguments);
1269
- if (!Array.isArray(value)) {
1270
- value = Array.from(value);
1271
- }
1272
1456
  const loc = location ? location.native : 0;
1273
- this.context.uniform4fv(loc, value);
1457
+ if (this._isSupported) {
1458
+ if (!Array.isArray(value)) {
1459
+ this.context.uniform4fvBuffer(loc, value);
1460
+ }
1461
+ else {
1462
+ this.context.uniform4fv(loc, value);
1463
+ }
1464
+ }
1465
+ else {
1466
+ if (!Array.isArray(value)) {
1467
+ this.context.uniform4fv(loc, Array.from(value));
1468
+ }
1469
+ else {
1470
+ this.context.uniform4fv(loc, value);
1471
+ }
1472
+ }
1274
1473
  }
1275
1474
  uniform4i(location, v0, v1, v2, v3) {
1276
1475
  this._glCheckError('uniform4i');
@@ -1281,29 +1480,65 @@ export class WebGLRenderingContext extends WebGLRenderingContextBase {
1281
1480
  uniformMatrix2fv(location, transpose, value) {
1282
1481
  this._glCheckError('uniformMatrix2fv');
1283
1482
  this._checkArgs('uniformMatrix2fv', arguments);
1284
- if (!Array.isArray(value)) {
1285
- value = Array.from(value);
1286
- }
1287
1483
  const loc = location ? location.native : 0;
1288
- this.context.uniformMatrix2fv(loc, transpose, value);
1484
+ if (this._isSupported) {
1485
+ if (!Array.isArray(value)) {
1486
+ this.context.uniformMatrix2fvBuffer(loc, transpose, value);
1487
+ }
1488
+ else {
1489
+ this.context.uniformMatrix2fv(loc, transpose, value);
1490
+ }
1491
+ }
1492
+ else {
1493
+ if (!Array.isArray(value)) {
1494
+ this.context.uniformMatrix2fv(loc, transpose, Array.from(value));
1495
+ }
1496
+ else {
1497
+ this.context.uniformMatrix2fv(loc, transpose, value);
1498
+ }
1499
+ }
1289
1500
  }
1290
1501
  uniformMatrix3fv(location, transpose, value) {
1291
1502
  this._glCheckError('uniformMatrix3fv');
1292
1503
  this._checkArgs('uniformMatrix3fv', arguments);
1293
- if (!Array.isArray(value)) {
1294
- value = Array.from(value);
1295
- }
1296
1504
  const loc = location ? location.native : 0;
1297
- this.context.uniformMatrix3fv(loc, transpose, value);
1505
+ if (this._isSupported) {
1506
+ if (!Array.isArray(value)) {
1507
+ this.context.uniformMatrix3fvBuffer(loc, transpose, value);
1508
+ }
1509
+ else {
1510
+ this.context.uniformMatrix3fv(loc, transpose, value);
1511
+ }
1512
+ }
1513
+ else {
1514
+ if (!Array.isArray(value)) {
1515
+ this.context.uniformMatrix3fv(loc, transpose, Array.from(value));
1516
+ }
1517
+ else {
1518
+ this.context.uniformMatrix3fv(loc, transpose, value);
1519
+ }
1520
+ }
1298
1521
  }
1299
1522
  uniformMatrix4fv(location, transpose, value) {
1300
1523
  this._glCheckError('uniformMatrix4fv');
1301
1524
  this._checkArgs('uniformMatrix4fv', arguments);
1302
- if (!Array.isArray(value)) {
1303
- value = Array.from(value);
1304
- }
1305
1525
  const loc = location ? location.native : 0;
1306
- this.context.uniformMatrix4fv(loc, transpose, value);
1526
+ if (this._isSupported) {
1527
+ if (!Array.isArray(value)) {
1528
+ this.context.uniformMatrix4fvBuffer(loc, transpose, value);
1529
+ }
1530
+ else {
1531
+ this.context.uniformMatrix4fv(loc, transpose, value);
1532
+ }
1533
+ }
1534
+ else {
1535
+ if (!Array.isArray(value)) {
1536
+ this.context.uniformMatrix4fv(loc, transpose, Array.from(value));
1537
+ }
1538
+ else {
1539
+ this.context.uniformMatrix4fv(loc, transpose, value);
1540
+ }
1541
+ }
1307
1542
  }
1308
1543
  useProgram(program) {
1309
1544
  this._glCheckError('useProgram');
@@ -1325,10 +1560,22 @@ export class WebGLRenderingContext extends WebGLRenderingContextBase {
1325
1560
  vertexAttrib1fv(index, value) {
1326
1561
  this._glCheckError('vertexAttrib1fv');
1327
1562
  this._checkArgs('vertexAttrib1fv', arguments);
1328
- if (!Array.isArray(value)) {
1329
- value = Array.from(value);
1563
+ if (this._isSupported) {
1564
+ if (!Array.isArray(value)) {
1565
+ this.context.vertexAttrib1fvBuffer(index, value);
1566
+ }
1567
+ else {
1568
+ this.context.vertexAttrib1fv(index, value);
1569
+ }
1570
+ }
1571
+ else {
1572
+ if (!Array.isArray(value)) {
1573
+ this.context.vertexAttrib1fv(index, Array.from(value));
1574
+ }
1575
+ else {
1576
+ this.context.vertexAttrib1fv(index, value);
1577
+ }
1330
1578
  }
1331
- this.context.vertexAttrib1fv(index, value);
1332
1579
  }
1333
1580
  vertexAttrib2f(index, v0, v1) {
1334
1581
  this._glCheckError('vertexAttrib2f');
@@ -1338,10 +1585,22 @@ export class WebGLRenderingContext extends WebGLRenderingContextBase {
1338
1585
  vertexAttrib2fv(index, value) {
1339
1586
  this._glCheckError('vertexAttrib2fv');
1340
1587
  this._checkArgs('vertexAttrib2fv', arguments);
1341
- if (!Array.isArray(value)) {
1342
- value = Array.from(value);
1588
+ if (this._isSupported) {
1589
+ if (!Array.isArray(value)) {
1590
+ this.context.vertexAttrib2fvBuffer(index, value);
1591
+ }
1592
+ else {
1593
+ this.context.vertexAttrib2fv(index, value);
1594
+ }
1595
+ }
1596
+ else {
1597
+ if (!Array.isArray(value)) {
1598
+ this.context.vertexAttrib2fv(index, Array.from(value));
1599
+ }
1600
+ else {
1601
+ this.context.vertexAttrib2fv(index, value);
1602
+ }
1343
1603
  }
1344
- this.context.vertexAttrib2fv(index, value);
1345
1604
  }
1346
1605
  vertexAttrib3f(index, v0, v1, v2) {
1347
1606
  this._glCheckError('vertexAttrib3f');
@@ -1351,10 +1610,22 @@ export class WebGLRenderingContext extends WebGLRenderingContextBase {
1351
1610
  vertexAttrib3fv(index, value) {
1352
1611
  this._glCheckError('vertexAttrib3fv');
1353
1612
  this._checkArgs('vertexAttrib3fv', arguments);
1354
- if (!Array.isArray(value)) {
1355
- value = Array.from(value);
1613
+ if (this._isSupported) {
1614
+ if (!Array.isArray(value)) {
1615
+ this.context.vertexAttrib3fvBuffer(index, value);
1616
+ }
1617
+ else {
1618
+ this.context.vertexAttrib3fv(index, value);
1619
+ }
1620
+ }
1621
+ else {
1622
+ if (!Array.isArray(value)) {
1623
+ this.context.vertexAttrib3fv(index, Array.from(value));
1624
+ }
1625
+ else {
1626
+ this.context.vertexAttrib3fv(index, value);
1627
+ }
1356
1628
  }
1357
- this.context.vertexAttrib3fv(index, value);
1358
1629
  }
1359
1630
  vertexAttrib4f(index, v0, v1, v2, v3) {
1360
1631
  this._glCheckError('vertexAttrib4f');
@@ -1364,10 +1635,22 @@ export class WebGLRenderingContext extends WebGLRenderingContextBase {
1364
1635
  vertexAttrib4fv(index, value) {
1365
1636
  this._glCheckError('vertexAttrib4fv');
1366
1637
  this._checkArgs('vertexAttrib4fv', arguments);
1367
- if (!Array.isArray(value)) {
1368
- value = Array.from(value);
1638
+ if (this._isSupported) {
1639
+ if (!Array.isArray(value)) {
1640
+ this.context.vertexAttrib4fvBuffer(index, value);
1641
+ }
1642
+ else {
1643
+ this.context.vertexAttrib4fv(index, value);
1644
+ }
1645
+ }
1646
+ else {
1647
+ if (!Array.isArray(value)) {
1648
+ this.context.vertexAttrib4fv(index, Array.from(value));
1649
+ }
1650
+ else {
1651
+ this.context.vertexAttrib4fv(index, value);
1652
+ }
1369
1653
  }
1370
- this.context.vertexAttrib4fv(index, value);
1371
1654
  }
1372
1655
  vertexAttribPointer(index, size, type, normalized, stride, offset) {
1373
1656
  this._glCheckError('vertexAttribPointer');