@nativescript/canvas 2.0.0-alpha.5 → 2.0.0-alpha.50

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (542) hide show
  1. package/Canvas/common.d.ts +213 -25
  2. package/Canvas/common.js +702 -452
  3. package/Canvas/common.js.map +1 -1
  4. package/Canvas/index.android.d.ts +12 -1
  5. package/Canvas/index.android.js +162 -49
  6. package/Canvas/index.android.js.map +1 -1
  7. package/Canvas/index.d.ts +13 -0
  8. package/Canvas/index.ios.d.ts +9 -4
  9. package/Canvas/index.ios.js +166 -103
  10. package/Canvas/index.ios.js.map +1 -1
  11. package/Canvas2D/CanvasGradient/index.d.ts +1 -3
  12. package/Canvas2D/CanvasGradient/index.js +1 -10
  13. package/Canvas2D/CanvasGradient/index.js.map +1 -1
  14. package/Canvas2D/CanvasPattern/index.d.ts +1 -3
  15. package/Canvas2D/CanvasPattern/index.js +1 -10
  16. package/Canvas2D/CanvasPattern/index.js.map +1 -1
  17. package/Canvas2D/CanvasRenderingContext2D/index.d.ts +7 -3
  18. package/Canvas2D/CanvasRenderingContext2D/index.js +132 -233
  19. package/Canvas2D/CanvasRenderingContext2D/index.js.map +1 -1
  20. package/Canvas2D/DOMMatrix/index.js +3 -3
  21. package/Canvas2D/DOMMatrix/index.js.map +1 -1
  22. package/Canvas2D/ImageData/index.js +6 -6
  23. package/Canvas2D/ImageData/index.js.map +1 -1
  24. package/Canvas2D/Path2D/index.d.ts +0 -2
  25. package/Canvas2D/Path2D/index.js +32 -42
  26. package/Canvas2D/Path2D/index.js.map +1 -1
  27. package/Dom/Paint.js +2 -3
  28. package/Dom/Paint.js.map +1 -1
  29. package/Dom/shapes/Circle.js +1 -2
  30. package/Dom/shapes/Circle.js.map +1 -1
  31. package/Dom/shapes/Points.js +1 -2
  32. package/Dom/shapes/Points.js.map +1 -1
  33. package/ImageAsset/index.d.ts +2 -2
  34. package/ImageAsset/index.js +33 -37
  35. package/ImageAsset/index.js.map +1 -1
  36. package/ImageBitmap/index.d.ts +0 -2
  37. package/ImageBitmap/index.js +47 -33
  38. package/ImageBitmap/index.js.map +1 -1
  39. package/LICENSE +201 -0
  40. package/SVG/SVG.js +1 -1
  41. package/SVG/SVG.js.map +1 -1
  42. package/TextDecoder/index.d.ts +0 -2
  43. package/TextDecoder/index.js +3 -12
  44. package/TextDecoder/index.js.map +1 -1
  45. package/TextEncoder/index.d.ts +0 -2
  46. package/TextEncoder/index.js +4 -13
  47. package/TextEncoder/index.js.map +1 -1
  48. package/WebGL/WebGLExtensions/index.d.ts +4 -12
  49. package/WebGL/WebGLExtensions/index.js +27 -77
  50. package/WebGL/WebGLExtensions/index.js.map +1 -1
  51. package/WebGL/WebGLProgram.d.ts +0 -1
  52. package/WebGL/WebGLProgram.js +0 -3
  53. package/WebGL/WebGLProgram.js.map +1 -1
  54. package/WebGL/WebGLRenderingContext/common.d.ts +1 -3
  55. package/WebGL/WebGLRenderingContext/common.js +3 -13
  56. package/WebGL/WebGLRenderingContext/common.js.map +1 -1
  57. package/WebGL/WebGLRenderingContext/index.d.ts +19 -17
  58. package/WebGL/WebGLRenderingContext/index.js +354 -728
  59. package/WebGL/WebGLRenderingContext/index.js.map +1 -1
  60. package/WebGL2/WebGL2RenderingContext/common.d.ts +2 -2
  61. package/WebGL2/WebGL2RenderingContext/common.js +2 -2
  62. package/WebGL2/WebGL2RenderingContext/common.js.map +1 -1
  63. package/WebGL2/WebGL2RenderingContext/index.d.ts +1 -1
  64. package/WebGL2/WebGL2RenderingContext/index.js +116 -285
  65. package/WebGL2/WebGL2RenderingContext/index.js.map +1 -1
  66. package/angular/esm2020/index.mjs +4 -4
  67. package/angular/fesm2015/nativescript-canvas-angular.mjs +4 -4
  68. package/angular/fesm2020/nativescript-canvas-angular.mjs +4 -4
  69. package/angular/package.json +2 -2
  70. package/index.js.map +1 -1
  71. package/package.json +3 -2
  72. package/platforms/android/canvas-release.aar +0 -0
  73. package/platforms/android/include.gradle +15 -0
  74. package/platforms/ios/CanvasNative.xcframework/Info.plist +5 -5
  75. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/CanvasNative +0 -0
  76. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Headers/CanvasNative-Swift.h +135 -68
  77. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Headers/CanvasNative.h +10 -0
  78. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Headers/canvas_ios.h +144 -0
  79. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Headers/canvas_native.h +2774 -70
  80. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Info.plist +0 -0
  81. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/CanvasNative.swiftmodule/Project/arm64-apple-ios.swiftsourceinfo +0 -0
  82. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios.abi.json +5851 -2555
  83. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios.private.swiftinterface +44 -24
  84. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
  85. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios.swiftinterface +44 -24
  86. package/platforms/ios/CanvasNative.xcframework/ios-arm64/dSYMs/CanvasNative.framework.dSYM/Contents/Resources/DWARF/CanvasNative +0 -0
  87. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/CanvasNative +0 -0
  88. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Headers/CanvasNative-Swift.h +270 -136
  89. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Headers/CanvasNative.h +10 -0
  90. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Headers/canvas_ios.h +144 -0
  91. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Headers/canvas_native.h +2774 -70
  92. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Info.plist +0 -0
  93. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/Project/arm64-apple-ios-simulator.swiftsourceinfo +0 -0
  94. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/Project/x86_64-apple-ios-simulator.swiftsourceinfo +0 -0
  95. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios-simulator.abi.json +5851 -2555
  96. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +44 -24
  97. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
  98. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios-simulator.swiftinterface +44 -24
  99. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.abi.json +5851 -2555
  100. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +44 -24
  101. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
  102. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +44 -24
  103. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/_CodeSignature/CodeResources +42 -31
  104. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/dSYMs/CanvasNative.framework.dSYM/Contents/Resources/DWARF/CanvasNative +0 -0
  105. package/platforms/ios/Podfile +5 -2
  106. package/platforms/ios/build.xcconfig +3 -3
  107. package/platforms/ios/src/CanvasModule.h +0 -2
  108. package/platforms/ios/src/CanvasModule.mm +4 -4
  109. package/platforms/ios/src/NSOperationQueueWrapper.h +11 -0
  110. package/platforms/ios/src/NSOperationQueueWrapper.mm +74 -0
  111. package/platforms/ios/src/cpp/Caches.cpp +35 -0
  112. package/platforms/ios/src/cpp/Caches.h +190 -0
  113. package/platforms/ios/src/cpp/CanvasJSIModule.cpp +1593 -0
  114. package/platforms/ios/src/cpp/CanvasJSIModule.h +16 -34
  115. package/platforms/ios/src/cpp/Common.h +30 -0
  116. package/platforms/ios/src/cpp/ConcurrentMap.h +54 -0
  117. package/platforms/ios/src/cpp/Helpers.h +336 -38
  118. package/platforms/ios/src/cpp/ImageAssetImpl.cpp +802 -0
  119. package/platforms/ios/src/cpp/ImageAssetImpl.h +46 -12
  120. package/platforms/ios/src/cpp/ImageBitmapImpl.cpp +189 -0
  121. package/platforms/ios/src/cpp/ImageBitmapImpl.h +42 -16
  122. package/platforms/ios/src/cpp/JSICallback.h +83 -5
  123. package/platforms/ios/src/cpp/JSIReadFileCallback.h +86 -6
  124. package/platforms/ios/src/cpp/JSIRuntime.cpp +21 -0
  125. package/platforms/ios/src/cpp/JSIRuntime.h +7 -0
  126. package/platforms/ios/src/cpp/ObjectWrapperImpl.h +31 -0
  127. package/platforms/ios/src/cpp/OneByteStringResource.cpp +55 -0
  128. package/platforms/ios/src/cpp/OneByteStringResource.h +36 -0
  129. package/platforms/ios/src/cpp/PerIsolateData.cpp +49 -0
  130. package/platforms/ios/src/cpp/PerIsolateData.h +54 -0
  131. package/platforms/ios/src/cpp/RafImpl.cpp +8 -0
  132. package/platforms/ios/src/cpp/RafImpl.h +11 -8
  133. package/platforms/ios/src/cpp/TextDecoderImpl.cpp +193 -0
  134. package/platforms/ios/src/cpp/TextDecoderImpl.h +23 -13
  135. package/platforms/ios/src/cpp/TextEncoderImpl.cpp +139 -0
  136. package/platforms/ios/src/cpp/TextEncoderImpl.h +21 -12
  137. package/platforms/ios/src/cpp/URLImpl.cpp +464 -0
  138. package/platforms/ios/src/cpp/URLImpl.h +121 -0
  139. package/platforms/ios/src/cpp/canvas2d/CanvasGradient.cpp +71 -0
  140. package/platforms/ios/src/cpp/canvas2d/CanvasGradient.h +29 -13
  141. package/platforms/ios/src/cpp/canvas2d/CanvasPattern.cpp +89 -0
  142. package/platforms/ios/src/cpp/canvas2d/CanvasPattern.h +49 -12
  143. package/platforms/ios/src/cpp/canvas2d/CanvasRenderingContext2DImpl.cpp +2841 -0
  144. package/platforms/ios/src/cpp/canvas2d/CanvasRenderingContext2DImpl.h +1331 -21
  145. package/platforms/ios/src/cpp/canvas2d/ImageDataImpl.cpp +207 -0
  146. package/platforms/ios/src/cpp/canvas2d/ImageDataImpl.h +27 -13
  147. package/platforms/ios/src/cpp/canvas2d/MatrixImpl.cpp +807 -0
  148. package/platforms/ios/src/cpp/canvas2d/MatrixImpl.h +173 -13
  149. package/platforms/ios/src/cpp/canvas2d/Path2D.cpp +499 -0
  150. package/platforms/ios/src/cpp/canvas2d/Path2D.h +422 -12
  151. package/platforms/ios/src/cpp/canvas2d/TextMetricsImpl.cpp +253 -0
  152. package/platforms/ios/src/cpp/canvas2d/TextMetricsImpl.h +51 -12
  153. package/platforms/ios/src/cpp/gl.h +57 -7
  154. package/platforms/ios/src/cpp/gl3stub.c +425 -0
  155. package/platforms/ios/src/cpp/gl3stub.h +665 -0
  156. package/platforms/ios/src/cpp/gles3jni.h +37 -0
  157. package/platforms/ios/src/cpp/include/robin_hood.h +2544 -0
  158. package/platforms/ios/src/cpp/webgl/WebGLActiveInfoImpl.cpp +91 -0
  159. package/platforms/ios/src/cpp/webgl/WebGLActiveInfoImpl.h +33 -13
  160. package/platforms/ios/src/cpp/webgl/WebGLBuffer.h +42 -7
  161. package/platforms/ios/src/cpp/webgl/WebGLFramebuffer.h +47 -11
  162. package/platforms/ios/src/cpp/webgl/WebGLProgram.h +41 -6
  163. package/platforms/ios/src/cpp/webgl/WebGLRenderbuffer.h +41 -7
  164. package/platforms/ios/src/cpp/webgl/WebGLRenderingContext.cpp +6845 -0
  165. package/platforms/ios/src/cpp/webgl/WebGLRenderingContext.h +3217 -388
  166. package/platforms/ios/src/cpp/webgl/{WebGLRenderingContextBase.mm → WebGLRenderingContextBase.cpp} +18 -17
  167. package/platforms/ios/src/cpp/webgl/WebGLRenderingContextBase.h +16 -36
  168. package/platforms/ios/src/cpp/webgl/WebGLShader.h +41 -7
  169. package/platforms/ios/src/cpp/webgl/WebGLShaderPrecisionFormatImpl.cpp +50 -0
  170. package/platforms/ios/src/cpp/webgl/WebGLShaderPrecisionFormatImpl.h +67 -12
  171. package/platforms/ios/src/cpp/webgl/WebGLTexture.h +41 -7
  172. package/platforms/ios/src/cpp/webgl/WebGLUniformLocation.h +45 -9
  173. package/platforms/ios/src/cpp/webgl/extensions/ANGLE_instanced_arraysImpl.cpp +126 -0
  174. package/platforms/ios/src/cpp/webgl/extensions/ANGLE_instanced_arraysImpl.h +26 -12
  175. package/platforms/ios/src/cpp/webgl/extensions/EXT_blend_minmaxImpl.cpp +35 -0
  176. package/platforms/ios/src/cpp/webgl/extensions/EXT_blend_minmaxImpl.h +26 -6
  177. package/platforms/ios/src/cpp/webgl/extensions/EXT_color_buffer_half_floatImpl.cpp +41 -0
  178. package/platforms/ios/src/cpp/webgl/extensions/EXT_color_buffer_half_floatImpl.h +26 -6
  179. package/platforms/ios/src/cpp/webgl/extensions/EXT_disjoint_timer_queryImpl.cpp +306 -0
  180. package/platforms/ios/src/cpp/webgl/extensions/EXT_disjoint_timer_queryImpl.h +47 -13
  181. package/platforms/ios/src/cpp/webgl/extensions/EXT_sRGBImpl.h +49 -6
  182. package/platforms/ios/src/cpp/webgl/extensions/EXT_shader_texture_lodImpl.h +37 -15
  183. package/platforms/ios/src/cpp/webgl/extensions/EXT_texture_filter_anisotropicImpl.h +47 -6
  184. package/platforms/ios/src/cpp/webgl/extensions/OES_element_index_uintImpl.h +49 -6
  185. package/platforms/ios/src/cpp/webgl/extensions/OES_fbo_render_mipmap.h +41 -16
  186. package/platforms/ios/src/cpp/webgl/extensions/OES_standard_derivativesImpl.h +44 -6
  187. package/platforms/ios/src/cpp/webgl/extensions/OES_texture_floatImpl.h +39 -16
  188. package/platforms/ios/src/cpp/webgl/extensions/OES_texture_float_linearImpl.h +37 -16
  189. package/platforms/ios/src/cpp/webgl/extensions/OES_texture_half_floatImpl.h +42 -6
  190. package/platforms/ios/src/cpp/webgl/extensions/OES_texture_half_float_linearImpl.h +40 -16
  191. package/platforms/ios/src/cpp/webgl/extensions/OES_vertex_array_objectImpl.cpp +102 -0
  192. package/platforms/ios/src/cpp/webgl/extensions/OES_vertex_array_objectImpl.h +69 -14
  193. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_color_buffer_floatImpl.h +51 -8
  194. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_compressed_texture_atcImpl.h +49 -6
  195. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_compressed_texture_etc1Impl.h +49 -8
  196. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_compressed_texture_etcImpl.h +76 -6
  197. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_compressed_texture_pvrtcImpl.h +57 -6
  198. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_compressed_texture_s3tcImpl.h +53 -6
  199. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_compressed_texture_s3tc_srgbImpl.h +59 -6
  200. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_depth_textureImpl.h +46 -6
  201. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_draw_buffersImpl.cpp +35 -0
  202. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_draw_buffersImpl.h +131 -14
  203. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_lose_contextImpl.cpp +32 -0
  204. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_lose_contextImpl.h +61 -13
  205. package/platforms/ios/src/cpp/webgl2/WebGL2RenderingContext.cpp +4533 -0
  206. package/platforms/ios/src/cpp/webgl2/WebGL2RenderingContext.h +1427 -342
  207. package/platforms/ios/src/cpp/webgl2/WebGLQuery.h +41 -4
  208. package/platforms/ios/src/cpp/webgl2/WebGLSampler.h +42 -3
  209. package/platforms/ios/src/cpp/webgl2/WebGLSyncImpl.h +45 -11
  210. package/platforms/ios/src/cpp/webgl2/WebGLTransformFeedback.h +43 -4
  211. package/platforms/ios/src/cpp/webgl2/WebGLVertexArrayObject.h +44 -4
  212. package/platforms/ios/src/module.modulemap +1 -0
  213. package/{pods → src-native/ios}/NativeScript.podspec +12 -25
  214. package/typings/objc!CanvasNative.d.ts +2038 -0
  215. package/typings/objc!CanvasNative.js +1 -0
  216. package/typings/objc!CanvasNative.js.map +1 -0
  217. package/utils.d.ts +3 -1
  218. package/utils.js +7 -20
  219. package/utils.js.map +1 -1
  220. package/angular/nativescript-canvas-angular.d.ts +0 -5
  221. package/platforms/ios/src/cpp/CanvasJSIModule.mm +0 -1105
  222. package/platforms/ios/src/cpp/ImageAssetImpl.mm +0 -417
  223. package/platforms/ios/src/cpp/ImageBitmapImpl.mm +0 -126
  224. package/platforms/ios/src/cpp/RafImpl.mm +0 -10
  225. package/platforms/ios/src/cpp/TextDecoderImpl.mm +0 -97
  226. package/platforms/ios/src/cpp/TextEncoderImpl.mm +0 -60
  227. package/platforms/ios/src/cpp/VecMutableBuffer.h +0 -46
  228. package/platforms/ios/src/cpp/canvas-cxx/src/lib.rs.cc +0 -6132
  229. package/platforms/ios/src/cpp/canvas-cxx/src/lib.rs.h +0 -2859
  230. package/platforms/ios/src/cpp/canvas2d/CanvasGradient.mm +0 -42
  231. package/platforms/ios/src/cpp/canvas2d/CanvasPattern.mm +0 -49
  232. package/platforms/ios/src/cpp/canvas2d/CanvasRenderingContext2DImpl.mm +0 -1975
  233. package/platforms/ios/src/cpp/canvas2d/ImageDataImpl.mm +0 -68
  234. package/platforms/ios/src/cpp/canvas2d/MatrixImpl.mm +0 -149
  235. package/platforms/ios/src/cpp/canvas2d/Path2D.mm +0 -335
  236. package/platforms/ios/src/cpp/canvas2d/TextMetricsImpl.mm +0 -68
  237. package/platforms/ios/src/cpp/rust/cxx.cc +0 -793
  238. package/platforms/ios/src/cpp/rust/cxx.h +0 -1111
  239. package/platforms/ios/src/cpp/webgl/WebGLActiveInfoImpl.mm +0 -39
  240. package/platforms/ios/src/cpp/webgl/WebGLRenderingContext.mm +0 -5958
  241. package/platforms/ios/src/cpp/webgl/WebGLShaderPrecisionFormatImpl.mm +0 -40
  242. package/platforms/ios/src/cpp/webgl/extensions/ANGLE_instanced_arraysImpl.mm +0 -108
  243. package/platforms/ios/src/cpp/webgl/extensions/EXT_blend_minmaxImpl.mm +0 -28
  244. package/platforms/ios/src/cpp/webgl/extensions/EXT_color_buffer_half_floatImpl.mm +0 -42
  245. package/platforms/ios/src/cpp/webgl/extensions/EXT_disjoint_timer_queryImpl.mm +0 -295
  246. package/platforms/ios/src/cpp/webgl/extensions/EXT_sRGBImpl.mm +0 -40
  247. package/platforms/ios/src/cpp/webgl/extensions/EXT_texture_filter_anisotropicImpl.mm +0 -37
  248. package/platforms/ios/src/cpp/webgl/extensions/OES_element_index_uintImpl.mm +0 -28
  249. package/platforms/ios/src/cpp/webgl/extensions/OES_standard_derivativesImpl.mm +0 -31
  250. package/platforms/ios/src/cpp/webgl/extensions/OES_texture_half_floatImpl.mm +0 -28
  251. package/platforms/ios/src/cpp/webgl/extensions/OES_vertex_array_objectImpl.mm +0 -127
  252. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_color_buffer_floatImpl.mm +0 -45
  253. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_compressed_texture_atcImpl.mm +0 -45
  254. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_compressed_texture_etc1Impl.mm +0 -31
  255. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_compressed_texture_etcImpl.mm +0 -70
  256. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_compressed_texture_pvrtcImpl.mm +0 -47
  257. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_compressed_texture_s3tcImpl.mm +0 -46
  258. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_compressed_texture_s3tc_srgbImpl.mm +0 -49
  259. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_depth_textureImpl.mm +0 -30
  260. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_draw_buffersImpl.mm +0 -177
  261. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_lose_contextImpl.mm +0 -64
  262. package/platforms/ios/src/cpp/webgl2/WebGL2RenderingContext.mm +0 -4556
  263. package/pods/Headers/jsi/decorator.h +0 -770
  264. package/pods/Headers/jsi/instrumentation.h +0 -117
  265. package/pods/Headers/jsi/jsi-inl.h +0 -338
  266. package/pods/Headers/jsi/jsi.h +0 -1571
  267. package/pods/Headers/jsi/jsilib.h +0 -59
  268. package/pods/Headers/jsi/threadsafe.h +0 -79
  269. package/pods/Headers/v8runtime/HostProxy.h +0 -71
  270. package/pods/Headers/v8runtime/JSIV8ValueConverter.h +0 -74
  271. package/pods/Headers/v8runtime/V8PointerValue.h +0 -44
  272. package/pods/Headers/v8runtime/V8Runtime.h +0 -240
  273. package/pods/Headers/v8runtime/V8RuntimeConfig.h +0 -26
  274. package/pods/Headers/v8runtime/V8RuntimeFactory.h +0 -21
  275. /package/platforms/ios/src/cpp/{OnRafCallback.mm → OnRafCallback.cpp} +0 -0
  276. /package/{pods → src-native/ios}/Headers/include/APIDesign.md +0 -0
  277. /package/{pods → src-native/ios}/Headers/include/DEPS +0 -0
  278. /package/{pods → src-native/ios}/Headers/include/DIR_METADATA +0 -0
  279. /package/{pods → src-native/ios}/Headers/include/OWNERS +0 -0
  280. /package/{pods → src-native/ios}/Headers/include/cppgc/DEPS +0 -0
  281. /package/{pods → src-native/ios}/Headers/include/cppgc/OWNERS +0 -0
  282. /package/{pods → src-native/ios}/Headers/include/cppgc/README.md +0 -0
  283. /package/{pods → src-native/ios}/Headers/include/cppgc/allocation.h +0 -0
  284. /package/{pods → src-native/ios}/Headers/include/cppgc/common.h +0 -0
  285. /package/{pods → src-native/ios}/Headers/include/cppgc/cross-thread-persistent.h +0 -0
  286. /package/{pods → src-native/ios}/Headers/include/cppgc/custom-space.h +0 -0
  287. /package/{pods → src-native/ios}/Headers/include/cppgc/default-platform.h +0 -0
  288. /package/{pods → src-native/ios}/Headers/include/cppgc/ephemeron-pair.h +0 -0
  289. /package/{pods → src-native/ios}/Headers/include/cppgc/explicit-management.h +0 -0
  290. /package/{pods → src-native/ios}/Headers/include/cppgc/garbage-collected.h +0 -0
  291. /package/{pods → src-native/ios}/Headers/include/cppgc/heap-consistency.h +0 -0
  292. /package/{pods → src-native/ios}/Headers/include/cppgc/heap-state.h +0 -0
  293. /package/{pods → src-native/ios}/Headers/include/cppgc/heap-statistics.h +0 -0
  294. /package/{pods → src-native/ios}/Headers/include/cppgc/heap.h +0 -0
  295. /package/{pods → src-native/ios}/Headers/include/cppgc/internal/api-constants.h +0 -0
  296. /package/{pods → src-native/ios}/Headers/include/cppgc/internal/atomic-entry-flag.h +0 -0
  297. /package/{pods → src-native/ios}/Headers/include/cppgc/internal/caged-heap-local-data.h +0 -0
  298. /package/{pods → src-native/ios}/Headers/include/cppgc/internal/compiler-specific.h +0 -0
  299. /package/{pods → src-native/ios}/Headers/include/cppgc/internal/finalizer-trait.h +0 -0
  300. /package/{pods → src-native/ios}/Headers/include/cppgc/internal/gc-info.h +0 -0
  301. /package/{pods → src-native/ios}/Headers/include/cppgc/internal/logging.h +0 -0
  302. /package/{pods → src-native/ios}/Headers/include/cppgc/internal/name-trait.h +0 -0
  303. /package/{pods → src-native/ios}/Headers/include/cppgc/internal/persistent-node.h +0 -0
  304. /package/{pods → src-native/ios}/Headers/include/cppgc/internal/pointer-policies.h +0 -0
  305. /package/{pods → src-native/ios}/Headers/include/cppgc/internal/write-barrier.h +0 -0
  306. /package/{pods → src-native/ios}/Headers/include/cppgc/liveness-broker.h +0 -0
  307. /package/{pods → src-native/ios}/Headers/include/cppgc/macros.h +0 -0
  308. /package/{pods → src-native/ios}/Headers/include/cppgc/member.h +0 -0
  309. /package/{pods → src-native/ios}/Headers/include/cppgc/name-provider.h +0 -0
  310. /package/{pods → src-native/ios}/Headers/include/cppgc/object-size-trait.h +0 -0
  311. /package/{pods → src-native/ios}/Headers/include/cppgc/persistent.h +0 -0
  312. /package/{pods → src-native/ios}/Headers/include/cppgc/platform.h +0 -0
  313. /package/{pods → src-native/ios}/Headers/include/cppgc/prefinalizer.h +0 -0
  314. /package/{pods → src-native/ios}/Headers/include/cppgc/process-heap-statistics.h +0 -0
  315. /package/{pods → src-native/ios}/Headers/include/cppgc/sentinel-pointer.h +0 -0
  316. /package/{pods → src-native/ios}/Headers/include/cppgc/source-location.h +0 -0
  317. /package/{pods → src-native/ios}/Headers/include/cppgc/testing.h +0 -0
  318. /package/{pods → src-native/ios}/Headers/include/cppgc/trace-trait.h +0 -0
  319. /package/{pods → src-native/ios}/Headers/include/cppgc/type-traits.h +0 -0
  320. /package/{pods → src-native/ios}/Headers/include/cppgc/visitor.h +0 -0
  321. /package/{pods → src-native/ios}/Headers/include/js_protocol-1.2.json +0 -0
  322. /package/{pods → src-native/ios}/Headers/include/js_protocol-1.3.json +0 -0
  323. /package/{pods → src-native/ios}/Headers/include/js_protocol.pdl +0 -0
  324. /package/{pods → src-native/ios}/Headers/include/libffi/arm64/ffi.h +0 -0
  325. /package/{pods → src-native/ios}/Headers/include/libffi/arm64/ffitarget.h +0 -0
  326. /package/{pods → src-native/ios}/Headers/include/libffi/x86_64/ffi.h +0 -0
  327. /package/{pods → src-native/ios}/Headers/include/libffi/x86_64/ffitarget.h +0 -0
  328. /package/{pods → src-native/ios}/Headers/include/libffi.h +0 -0
  329. /package/{pods → src-native/ios}/Headers/include/libplatform/DEPS +0 -0
  330. /package/{pods → src-native/ios}/Headers/include/libplatform/libplatform-export.h +0 -0
  331. /package/{pods → src-native/ios}/Headers/include/libplatform/libplatform.h +0 -0
  332. /package/{pods → src-native/ios}/Headers/include/libplatform/v8-tracing.h +0 -0
  333. /package/{pods → src-native/ios}/Headers/include/v8-array-buffer.h +0 -0
  334. /package/{pods → src-native/ios}/Headers/include/v8-callbacks.h +0 -0
  335. /package/{pods → src-native/ios}/Headers/include/v8-container.h +0 -0
  336. /package/{pods → src-native/ios}/Headers/include/v8-context.h +0 -0
  337. /package/{pods → src-native/ios}/Headers/include/v8-cppgc.h +0 -0
  338. /package/{pods → src-native/ios}/Headers/include/v8-data.h +0 -0
  339. /package/{pods → src-native/ios}/Headers/include/v8-date.h +0 -0
  340. /package/{pods → src-native/ios}/Headers/include/v8-debug.h +0 -0
  341. /package/{pods → src-native/ios}/Headers/include/v8-embedder-heap.h +0 -0
  342. /package/{pods → src-native/ios}/Headers/include/v8-embedder-state-scope.h +0 -0
  343. /package/{pods → src-native/ios}/Headers/include/v8-exception.h +0 -0
  344. /package/{pods → src-native/ios}/Headers/include/v8-extension.h +0 -0
  345. /package/{pods → src-native/ios}/Headers/include/v8-external.h +0 -0
  346. /package/{pods → src-native/ios}/Headers/include/v8-fast-api-calls.h +0 -0
  347. /package/{pods → src-native/ios}/Headers/include/v8-forward.h +0 -0
  348. /package/{pods → src-native/ios}/Headers/include/v8-function-callback.h +0 -0
  349. /package/{pods → src-native/ios}/Headers/include/v8-function.h +0 -0
  350. /package/{pods → src-native/ios}/Headers/include/v8-initialization.h +0 -0
  351. /package/{pods → src-native/ios}/Headers/include/v8-inspector-protocol.h +0 -0
  352. /package/{pods → src-native/ios}/Headers/include/v8-inspector.h +0 -0
  353. /package/{pods → src-native/ios}/Headers/include/v8-internal.h +0 -0
  354. /package/{pods → src-native/ios}/Headers/include/v8-isolate.h +0 -0
  355. /package/{pods → src-native/ios}/Headers/include/v8-json.h +0 -0
  356. /package/{pods → src-native/ios}/Headers/include/v8-local-handle.h +0 -0
  357. /package/{pods → src-native/ios}/Headers/include/v8-locker.h +0 -0
  358. /package/{pods → src-native/ios}/Headers/include/v8-maybe.h +0 -0
  359. /package/{pods → src-native/ios}/Headers/include/v8-memory-span.h +0 -0
  360. /package/{pods → src-native/ios}/Headers/include/v8-message.h +0 -0
  361. /package/{pods → src-native/ios}/Headers/include/v8-metrics.h +0 -0
  362. /package/{pods → src-native/ios}/Headers/include/v8-microtask-queue.h +0 -0
  363. /package/{pods → src-native/ios}/Headers/include/v8-microtask.h +0 -0
  364. /package/{pods → src-native/ios}/Headers/include/v8-object.h +0 -0
  365. /package/{pods → src-native/ios}/Headers/include/v8-persistent-handle.h +0 -0
  366. /package/{pods → src-native/ios}/Headers/include/v8-platform.h +0 -0
  367. /package/{pods → src-native/ios}/Headers/include/v8-primitive-object.h +0 -0
  368. /package/{pods → src-native/ios}/Headers/include/v8-primitive.h +0 -0
  369. /package/{pods → src-native/ios}/Headers/include/v8-profiler.h +0 -0
  370. /package/{pods → src-native/ios}/Headers/include/v8-promise.h +0 -0
  371. /package/{pods → src-native/ios}/Headers/include/v8-proxy.h +0 -0
  372. /package/{pods → src-native/ios}/Headers/include/v8-regexp.h +0 -0
  373. /package/{pods → src-native/ios}/Headers/include/v8-script.h +0 -0
  374. /package/{pods → src-native/ios}/Headers/include/v8-snapshot.h +0 -0
  375. /package/{pods → src-native/ios}/Headers/include/v8-statistics.h +0 -0
  376. /package/{pods → src-native/ios}/Headers/include/v8-template.h +0 -0
  377. /package/{pods → src-native/ios}/Headers/include/v8-traced-handle.h +0 -0
  378. /package/{pods → src-native/ios}/Headers/include/v8-typed-array.h +0 -0
  379. /package/{pods → src-native/ios}/Headers/include/v8-unwinder-state.h +0 -0
  380. /package/{pods → src-native/ios}/Headers/include/v8-unwinder.h +0 -0
  381. /package/{pods → src-native/ios}/Headers/include/v8-util.h +0 -0
  382. /package/{pods → src-native/ios}/Headers/include/v8-value-serializer-version.h +0 -0
  383. /package/{pods → src-native/ios}/Headers/include/v8-value-serializer.h +0 -0
  384. /package/{pods → src-native/ios}/Headers/include/v8-value.h +0 -0
  385. /package/{pods → src-native/ios}/Headers/include/v8-version-string.h +0 -0
  386. /package/{pods → src-native/ios}/Headers/include/v8-version.h +0 -0
  387. /package/{pods → src-native/ios}/Headers/include/v8-wasm-trap-handler-posix.h +0 -0
  388. /package/{pods → src-native/ios}/Headers/include/v8-wasm-trap-handler-win.h +0 -0
  389. /package/{pods → src-native/ios}/Headers/include/v8-wasm.h +0 -0
  390. /package/{pods → src-native/ios}/Headers/include/v8-weak-callback-info.h +0 -0
  391. /package/{pods → src-native/ios}/Headers/include/v8.h +0 -0
  392. /package/{pods → src-native/ios}/Headers/include/v8config.h +0 -0
  393. /package/{pods → src-native/ios}/Headers/inspector/InspectorServer.h +0 -0
  394. /package/{pods → src-native/ios}/Headers/inspector/JsV8InspectorClient.h +0 -0
  395. /package/{pods → src-native/ios}/Headers/inspector/base/trace_event/common/trace_event_common.h +0 -0
  396. /package/{pods → src-native/ios}/Headers/inspector/base64.h +0 -0
  397. /package/{pods → src-native/ios}/Headers/inspector/src/base/address-region.h +0 -0
  398. /package/{pods → src-native/ios}/Headers/inspector/src/base/atomic-utils.h +0 -0
  399. /package/{pods → src-native/ios}/Headers/inspector/src/base/atomicops.h +0 -0
  400. /package/{pods → src-native/ios}/Headers/inspector/src/base/atomicops_internals_atomicword_compat.h +0 -0
  401. /package/{pods → src-native/ios}/Headers/inspector/src/base/base-export.h +0 -0
  402. /package/{pods → src-native/ios}/Headers/inspector/src/base/bits.h +0 -0
  403. /package/{pods → src-native/ios}/Headers/inspector/src/base/build_config.h +0 -0
  404. /package/{pods → src-native/ios}/Headers/inspector/src/base/compiler-specific.h +0 -0
  405. /package/{pods → src-native/ios}/Headers/inspector/src/base/export-template.h +0 -0
  406. /package/{pods → src-native/ios}/Headers/inspector/src/base/flags.h +0 -0
  407. /package/{pods → src-native/ios}/Headers/inspector/src/base/immediate-crash.h +0 -0
  408. /package/{pods → src-native/ios}/Headers/inspector/src/base/lazy-instance.h +0 -0
  409. /package/{pods → src-native/ios}/Headers/inspector/src/base/logging.h +0 -0
  410. /package/{pods → src-native/ios}/Headers/inspector/src/base/macros.h +0 -0
  411. /package/{pods → src-native/ios}/Headers/inspector/src/base/memory.h +0 -0
  412. /package/{pods → src-native/ios}/Headers/inspector/src/base/once.h +0 -0
  413. /package/{pods → src-native/ios}/Headers/inspector/src/base/optional.h +0 -0
  414. /package/{pods → src-native/ios}/Headers/inspector/src/base/platform/mutex.h +0 -0
  415. /package/{pods → src-native/ios}/Headers/inspector/src/base/platform/platform.h +0 -0
  416. /package/{pods → src-native/ios}/Headers/inspector/src/base/platform/semaphore.h +0 -0
  417. /package/{pods → src-native/ios}/Headers/inspector/src/base/platform/v8-time.h +0 -0
  418. /package/{pods → src-native/ios}/Headers/inspector/src/base/platform/wrappers.h +0 -0
  419. /package/{pods → src-native/ios}/Headers/inspector/src/base/safe_conversions.h +0 -0
  420. /package/{pods → src-native/ios}/Headers/inspector/src/base/safe_conversions_impl.h +0 -0
  421. /package/{pods → src-native/ios}/Headers/inspector/src/base/template-utils.h +0 -0
  422. /package/{pods → src-native/ios}/Headers/inspector/src/base/v8-fallthrough.h +0 -0
  423. /package/{pods → src-native/ios}/Headers/inspector/src/common/checks.h +0 -0
  424. /package/{pods → src-native/ios}/Headers/inspector/src/common/globals.h +0 -0
  425. /package/{pods → src-native/ios}/Headers/inspector/src/debug/debug-interface.h +0 -0
  426. /package/{pods → src-native/ios}/Headers/inspector/src/debug/interface-types.h +0 -0
  427. /package/{pods → src-native/ios}/Headers/inspector/src/init/v8.h +0 -0
  428. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/custom-preview.h +0 -0
  429. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/injected-script.h +0 -0
  430. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/inspected-context.h +0 -0
  431. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/protocol/CSS.h +0 -0
  432. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/protocol/Console.h +0 -0
  433. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/protocol/DOM.h +0 -0
  434. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/protocol/Debugger.h +0 -0
  435. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/protocol/Forward.h +0 -0
  436. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/protocol/HeapProfiler.h +0 -0
  437. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/protocol/Log.h +0 -0
  438. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/protocol/Network.h +0 -0
  439. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/protocol/Overlay.h +0 -0
  440. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/protocol/Page.h +0 -0
  441. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/protocol/Profiler.h +0 -0
  442. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/protocol/Protocol.h +0 -0
  443. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/protocol/Runtime.h +0 -0
  444. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/protocol/Schema.h +0 -0
  445. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/protocol/Security.h +0 -0
  446. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/remote-object-id.h +0 -0
  447. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/search-util.h +0 -0
  448. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/string-16.h +0 -0
  449. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/string-util.h +0 -0
  450. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/v8-console-agent-impl.h +0 -0
  451. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/v8-console-message.h +0 -0
  452. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/v8-console.h +0 -0
  453. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/v8-css-agent-impl.h +0 -0
  454. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/v8-debugger-agent-impl.h +0 -0
  455. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/v8-debugger-id.h +0 -0
  456. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/v8-debugger-script.h +0 -0
  457. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/v8-debugger.h +0 -0
  458. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/v8-dom-agent-impl.h +0 -0
  459. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/v8-heap-profiler-agent-impl.h +0 -0
  460. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/v8-inspector-impl.h +0 -0
  461. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/v8-inspector-session-impl.h +0 -0
  462. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/v8-log-agent-impl.h +0 -0
  463. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/v8-network-agent-impl.h +0 -0
  464. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/v8-ns-debugger-agent-impl.h +0 -0
  465. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/v8-overlay-agent-impl.h +0 -0
  466. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/v8-page-agent-impl.h +0 -0
  467. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/v8-profiler-agent-impl.h +0 -0
  468. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/v8-regex.h +0 -0
  469. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/v8-runtime-agent-impl.h +0 -0
  470. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/v8-schema-agent-impl.h +0 -0
  471. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/v8-stack-trace-impl.h +0 -0
  472. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/v8-string-conversions.h +0 -0
  473. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/v8-value-utils.h +0 -0
  474. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/value-mirror.h +0 -0
  475. /package/{pods → src-native/ios}/Headers/inspector/src/libplatform/default-platform.h +0 -0
  476. /package/{pods → src-native/ios}/Headers/inspector/src/logging/tracing-flags.h +0 -0
  477. /package/{pods → src-native/ios}/Headers/inspector/src/numbers/conversions.h +0 -0
  478. /package/{pods → src-native/ios}/Headers/inspector/src/tracing/trace-event.h +0 -0
  479. /package/{pods → src-native/ios}/Headers/inspector/src/utils/allocation.h +0 -0
  480. /package/{pods → src-native/ios}/Headers/inspector/src/utils/vector.h +0 -0
  481. /package/{pods → src-native/ios}/Headers/inspector/third_party/inspector_protocol/crdtp/cbor.h +0 -0
  482. /package/{pods → src-native/ios}/Headers/inspector/third_party/inspector_protocol/crdtp/dispatch.h +0 -0
  483. /package/{pods → src-native/ios}/Headers/inspector/third_party/inspector_protocol/crdtp/error_support.h +0 -0
  484. /package/{pods → src-native/ios}/Headers/inspector/third_party/inspector_protocol/crdtp/export.h +0 -0
  485. /package/{pods → src-native/ios}/Headers/inspector/third_party/inspector_protocol/crdtp/find_by_first.h +0 -0
  486. /package/{pods → src-native/ios}/Headers/inspector/third_party/inspector_protocol/crdtp/frontend_channel.h +0 -0
  487. /package/{pods → src-native/ios}/Headers/inspector/third_party/inspector_protocol/crdtp/glue.h +0 -0
  488. /package/{pods → src-native/ios}/Headers/inspector/third_party/inspector_protocol/crdtp/json.h +0 -0
  489. /package/{pods → src-native/ios}/Headers/inspector/third_party/inspector_protocol/crdtp/json_platform.h +0 -0
  490. /package/{pods → src-native/ios}/Headers/inspector/third_party/inspector_protocol/crdtp/maybe.h +0 -0
  491. /package/{pods → src-native/ios}/Headers/inspector/third_party/inspector_protocol/crdtp/parser_handler.h +0 -0
  492. /package/{pods → src-native/ios}/Headers/inspector/third_party/inspector_protocol/crdtp/protocol_core.h +0 -0
  493. /package/{pods → src-native/ios}/Headers/inspector/third_party/inspector_protocol/crdtp/serializable.h +0 -0
  494. /package/{pods → src-native/ios}/Headers/inspector/third_party/inspector_protocol/crdtp/serializer_traits.h +0 -0
  495. /package/{pods → src-native/ios}/Headers/inspector/third_party/inspector_protocol/crdtp/span.h +0 -0
  496. /package/{pods → src-native/ios}/Headers/inspector/third_party/inspector_protocol/crdtp/status.h +0 -0
  497. /package/{pods → src-native/ios}/Headers/inspector/utils.h +0 -0
  498. /package/{pods → src-native/ios}/Headers/inspector/v8-inspector-platform.h +0 -0
  499. /package/{pods → src-native/ios}/Headers/runtime/ArgConverter.h +0 -0
  500. /package/{pods → src-native/ios}/Headers/runtime/ArrayAdapter.h +0 -0
  501. /package/{pods → src-native/ios}/Headers/runtime/Caches.h +0 -0
  502. /package/{pods → src-native/ios}/Headers/runtime/ClassBuilder.h +0 -0
  503. /package/{pods → src-native/ios}/Headers/runtime/Common.h +0 -0
  504. /package/{pods → src-native/ios}/Headers/runtime/ConcurrentMap.h +0 -0
  505. /package/{pods → src-native/ios}/Headers/runtime/ConcurrentQueue.h +0 -0
  506. /package/{pods → src-native/ios}/Headers/runtime/Console.h +0 -0
  507. /package/{pods → src-native/ios}/Headers/runtime/Constants.h +0 -0
  508. /package/{pods → src-native/ios}/Headers/runtime/DataWrapper.h +0 -0
  509. /package/{pods → src-native/ios}/Headers/runtime/DictionaryAdapter.h +0 -0
  510. /package/{pods → src-native/ios}/Headers/runtime/ExtVector.h +0 -0
  511. /package/{pods → src-native/ios}/Headers/runtime/FFICall.h +0 -0
  512. /package/{pods → src-native/ios}/Headers/runtime/FastEnumerationAdapter.h +0 -0
  513. /package/{pods → src-native/ios}/Headers/runtime/FunctionReference.h +0 -0
  514. /package/{pods → src-native/ios}/Headers/runtime/Helpers.h +0 -0
  515. /package/{pods → src-native/ios}/Headers/runtime/InlineFunctions.h +0 -0
  516. /package/{pods → src-native/ios}/Headers/runtime/Interop.h +0 -0
  517. /package/{pods → src-native/ios}/Headers/runtime/KnownUnknownClassPair.h +0 -0
  518. /package/{pods → src-native/ios}/Headers/runtime/Metadata.h +0 -0
  519. /package/{pods → src-native/ios}/Headers/runtime/MetadataBuilder.h +0 -0
  520. /package/{pods → src-native/ios}/Headers/runtime/MetadataInlines.h +0 -0
  521. /package/{pods → src-native/ios}/Headers/runtime/ModuleInternal.h +0 -0
  522. /package/{pods → src-native/ios}/Headers/runtime/NSDataAdapter.h +0 -0
  523. /package/{pods → src-native/ios}/Headers/runtime/NativeScriptException.h +0 -0
  524. /package/{pods → src-native/ios}/Headers/runtime/ObjectManager.h +0 -0
  525. /package/{pods → src-native/ios}/Headers/runtime/OneByteStringResource.h +0 -0
  526. /package/{pods → src-native/ios}/Headers/runtime/Pointer.h +0 -0
  527. /package/{pods → src-native/ios}/Headers/runtime/PromiseProxy.h +0 -0
  528. /package/{pods → src-native/ios}/Headers/runtime/Reference.h +0 -0
  529. /package/{pods → src-native/ios}/Headers/runtime/Runtime.h +0 -0
  530. /package/{pods → src-native/ios}/Headers/runtime/RuntimeConfig.h +0 -0
  531. /package/{pods → src-native/ios}/Headers/runtime/SetTimeout.h +0 -0
  532. /package/{pods → src-native/ios}/Headers/runtime/SimpleAllocator.h +0 -0
  533. /package/{pods → src-native/ios}/Headers/runtime/StringHasher.h +0 -0
  534. /package/{pods → src-native/ios}/Headers/runtime/SymbolIterator.h +0 -0
  535. /package/{pods → src-native/ios}/Headers/runtime/SymbolLoader.h +0 -0
  536. /package/{pods → src-native/ios}/Headers/runtime/TNSDerivedClass.h +0 -0
  537. /package/{pods → src-native/ios}/Headers/runtime/TSHelpers.h +0 -0
  538. /package/{pods → src-native/ios}/Headers/runtime/Tasks.h +0 -0
  539. /package/{pods → src-native/ios}/Headers/runtime/UnmanagedType.h +0 -0
  540. /package/{pods → src-native/ios}/Headers/runtime/WeakRef.h +0 -0
  541. /package/{pods → src-native/ios}/Headers/runtime/Worker.h +0 -0
  542. /package/{pods → src-native/ios}/Headers/runtime/robin_hood.h +0 -0
@@ -0,0 +1,4533 @@
1
+ //
2
+ // Created by Osei Fortune on 22/03/2022.
3
+ //
4
+
5
+ #include "WebGL2RenderingContext.h"
6
+
7
+ v8::CFunction WebGL2RenderingContext::fast_begin_query_(
8
+ v8::CFunction::Make(WebGL2RenderingContext::FastBeginQuery));
9
+
10
+ v8::CFunction WebGL2RenderingContext::fast_begin_transform_feedback_(
11
+ v8::CFunction::Make(WebGL2RenderingContext::FastBeginTransformFeedback));
12
+
13
+ v8::CFunction WebGL2RenderingContext::fast_bind_vertex_array_(
14
+ v8::CFunction::Make(WebGL2RenderingContext::FastBindVertexArray));
15
+
16
+
17
+ v8::CFunction WebGL2RenderingContext::fast_bind_buffer_base_(
18
+ v8::CFunction::Make(WebGL2RenderingContext::FastBindBufferBase));
19
+
20
+ v8::CFunction WebGL2RenderingContext::fast_bind_buffer_range_(
21
+ v8::CFunction::Make(WebGL2RenderingContext::FastBindBufferRange));
22
+
23
+ v8::CFunction WebGL2RenderingContext::fast_bind_sampler_(
24
+ v8::CFunction::Make(WebGL2RenderingContext::FastBindSampler));
25
+
26
+ v8::CFunction WebGL2RenderingContext::fast_bind_transform_feedback_(
27
+ v8::CFunction::Make(WebGL2RenderingContext::FastBindTransformFeedback));
28
+
29
+ v8::CFunction WebGL2RenderingContext::fast_blit_framebuffer_(
30
+ v8::CFunction::Make(WebGL2RenderingContext::FastBlitFramebuffer));
31
+
32
+ v8::CFunction WebGL2RenderingContext::fast_clear_buffer_fi_(
33
+ v8::CFunction::Make(WebGL2RenderingContext::FastClearBufferfi));
34
+
35
+ v8::CFunction WebGL2RenderingContext::fast_clear_buffer_fv_(
36
+ v8::CFunction::Make(WebGL2RenderingContext::FastClearBufferfv));
37
+
38
+ v8::CFunction WebGL2RenderingContext::fast_clear_buffer_fv_array_(
39
+ v8::CFunction::Make(WebGL2RenderingContext::FastClearBufferfvArray));
40
+
41
+ const v8::CFunction fast_clear_buffer_fv_overloads_[] = {
42
+ WebGL2RenderingContext::fast_clear_buffer_fv_,
43
+ WebGL2RenderingContext::fast_clear_buffer_fv_array_
44
+ };
45
+
46
+ v8::CFunction WebGL2RenderingContext::fast_clear_buffer_iv_(
47
+ v8::CFunction::Make(WebGL2RenderingContext::FastClearBufferiv));
48
+
49
+ v8::CFunction WebGL2RenderingContext::fast_clear_buffer_iv_array_(
50
+ v8::CFunction::Make(WebGL2RenderingContext::FastClearBufferivArray));
51
+
52
+ const v8::CFunction fast_clear_buffer_iv_overloads_[] = {
53
+ WebGL2RenderingContext::fast_clear_buffer_iv_,
54
+ WebGL2RenderingContext::fast_clear_buffer_iv_array_
55
+ };
56
+
57
+
58
+ v8::CFunction WebGL2RenderingContext::fast_clear_buffer_uiv_(
59
+ v8::CFunction::Make(WebGL2RenderingContext::FastClearBufferuiv));
60
+
61
+ v8::CFunction WebGL2RenderingContext::fast_clear_buffer_uiv_array_(
62
+ v8::CFunction::Make(WebGL2RenderingContext::FastClearBufferuivArray));
63
+
64
+ const v8::CFunction fast_clear_buffer_uiv_overloads_[] = {
65
+ WebGL2RenderingContext::fast_clear_buffer_uiv_,
66
+ WebGL2RenderingContext::fast_clear_buffer_uiv_array_
67
+ };
68
+
69
+ v8::CFunction WebGL2RenderingContext::fast_draw_arrays_instanced_(
70
+ v8::CFunction::Make(WebGL2RenderingContext::FastDrawArraysInstanced));
71
+
72
+ v8::CFunction WebGL2RenderingContext::fast_draw_buffers_(
73
+ v8::CFunction::Make(WebGL2RenderingContext::FastDrawBuffers));
74
+
75
+
76
+ v8::CFunction WebGL2RenderingContext::fast_draw_elements_instanced_(
77
+ v8::CFunction::Make(WebGL2RenderingContext::FastDrawElementsInstanced));
78
+
79
+ v8::CFunction WebGL2RenderingContext::fast_draw_range_elements_(
80
+ v8::CFunction::Make(WebGL2RenderingContext::FastDrawRangeElements));
81
+
82
+ v8::CFunction WebGL2RenderingContext::fast_resume_transform_feedback_(
83
+ v8::CFunction::Make(WebGL2RenderingContext::FastResumeTransformFeedback));
84
+
85
+ v8::CFunction WebGL2RenderingContext::fast_sampler_parameterf_(
86
+ v8::CFunction::Make(WebGL2RenderingContext::FastSamplerParameterf));
87
+
88
+ v8::CFunction WebGL2RenderingContext::fast_sampler_parameteri_(
89
+ v8::CFunction::Make(WebGL2RenderingContext::FastSamplerParameteri));
90
+
91
+
92
+ v8::CFunction WebGL2RenderingContext::fast_uniform_1ui_(
93
+ v8::CFunction::Make(WebGL2RenderingContext::FastUniform1ui));
94
+
95
+ v8::CFunction WebGL2RenderingContext::fast_uniform_1uiv_(
96
+ v8::CFunction::Make(WebGL2RenderingContext::FastUniform1uiv));
97
+
98
+ v8::CFunction WebGL2RenderingContext::fast_uniform_2ui_(
99
+ v8::CFunction::Make(WebGL2RenderingContext::FastUniform2ui));
100
+
101
+ v8::CFunction WebGL2RenderingContext::fast_uniform_2uiv_(
102
+ v8::CFunction::Make(WebGL2RenderingContext::FastUniform2uiv));
103
+
104
+ v8::CFunction WebGL2RenderingContext::fast_uniform_3ui_(
105
+ v8::CFunction::Make(WebGL2RenderingContext::FastUniform3ui));
106
+
107
+ v8::CFunction WebGL2RenderingContext::fast_uniform_3uiv_(
108
+ v8::CFunction::Make(WebGL2RenderingContext::FastUniform3uiv));
109
+
110
+ v8::CFunction WebGL2RenderingContext::fast_uniform_4ui_(
111
+ v8::CFunction::Make(WebGL2RenderingContext::FastUniform4ui));
112
+
113
+ v8::CFunction WebGL2RenderingContext::fast_uniform_4uiv_(
114
+ v8::CFunction::Make(WebGL2RenderingContext::FastUniform4uiv));
115
+
116
+
117
+ v8::CFunction WebGL2RenderingContext::fast_uniform_matrix_2x3fv_(
118
+ v8::CFunction::Make(WebGL2RenderingContext::FastUniformMatrix2x3fv));
119
+
120
+ v8::CFunction WebGL2RenderingContext::fast_uniform_matrix_2x3fv_array_(
121
+ v8::CFunction::Make(WebGL2RenderingContext::FastUniformMatrix2x3fvArray));
122
+
123
+ const v8::CFunction fast_uniform_matrix_2x3fv_overloads_[] = {
124
+ WebGL2RenderingContext::fast_uniform_matrix_2x3fv_,
125
+ WebGL2RenderingContext::fast_uniform_matrix_2x3fv_array_
126
+ };
127
+
128
+
129
+ v8::CFunction WebGL2RenderingContext::fast_uniform_matrix_2x4fv_(
130
+ v8::CFunction::Make(WebGL2RenderingContext::FastUniformMatrix2x4fv));
131
+
132
+ v8::CFunction WebGL2RenderingContext::fast_uniform_matrix_2x4fv_array_(
133
+ v8::CFunction::Make(WebGL2RenderingContext::FastUniformMatrix2x4fvArray));
134
+
135
+ const v8::CFunction fast_uniform_matrix_2x4fv_overloads_[] = {
136
+ WebGL2RenderingContext::fast_uniform_matrix_2x4fv_,
137
+ WebGL2RenderingContext::fast_uniform_matrix_2x4fv_array_
138
+ };
139
+
140
+
141
+ v8::CFunction WebGL2RenderingContext::fast_uniform_matrix_3x2fv_(
142
+ v8::CFunction::Make(WebGL2RenderingContext::FastUniformMatrix3x2fv));
143
+
144
+ v8::CFunction WebGL2RenderingContext::fast_uniform_matrix_3x2fv_array_(
145
+ v8::CFunction::Make(WebGL2RenderingContext::FastUniformMatrix3x2fvArray));
146
+
147
+ const v8::CFunction fast_uniform_matrix_3x2fv_overloads_[] = {
148
+ WebGL2RenderingContext::fast_uniform_matrix_3x2fv_,
149
+ WebGL2RenderingContext::fast_uniform_matrix_3x2fv_array_
150
+ };
151
+
152
+ v8::CFunction WebGL2RenderingContext::fast_uniform_matrix_3x4fv_(
153
+ v8::CFunction::Make(WebGL2RenderingContext::FastUniformMatrix3x4fv));
154
+
155
+ v8::CFunction WebGL2RenderingContext::fast_uniform_matrix_3x4fv_array_(
156
+ v8::CFunction::Make(WebGL2RenderingContext::FastUniformMatrix3x4fvArray));
157
+
158
+ const v8::CFunction fast_uniform_matrix_3x4fv_overloads_[] = {
159
+ WebGL2RenderingContext::fast_uniform_matrix_3x4fv_,
160
+ WebGL2RenderingContext::fast_uniform_matrix_3x4fv_array_
161
+ };
162
+
163
+
164
+ v8::CFunction WebGL2RenderingContext::fast_uniform_matrix_4x2fv_(
165
+ v8::CFunction::Make(WebGL2RenderingContext::FastUniformMatrix4x2fv));
166
+
167
+ v8::CFunction WebGL2RenderingContext::fast_uniform_matrix_4x2fv_array_(
168
+ v8::CFunction::Make(WebGL2RenderingContext::FastUniformMatrix4x2fvArray));
169
+
170
+ const v8::CFunction fast_uniform_matrix_4x2fv_overloads_[] = {
171
+ WebGL2RenderingContext::fast_uniform_matrix_4x2fv_,
172
+ WebGL2RenderingContext::fast_uniform_matrix_4x2fv_array_
173
+ };
174
+
175
+
176
+ v8::CFunction WebGL2RenderingContext::fast_uniform_matrix_4x3fv_(
177
+ v8::CFunction::Make(WebGL2RenderingContext::FastUniformMatrix4x3fv));
178
+
179
+ v8::CFunction WebGL2RenderingContext::fast_uniform_matrix_4x3fv_array_(
180
+ v8::CFunction::Make(WebGL2RenderingContext::FastUniformMatrix4x3fvArray));
181
+
182
+ const v8::CFunction fast_uniform_matrix_4x3fv_overloads_[] = {
183
+ WebGL2RenderingContext::fast_uniform_matrix_4x3fv_,
184
+ WebGL2RenderingContext::fast_uniform_matrix_4x3fv_array_
185
+ };
186
+
187
+ v8::CFunction WebGL2RenderingContext::fast_vertex_attrib_divisor_(
188
+ v8::CFunction::Make(WebGL2RenderingContext::FastVertexAttribDivisor));
189
+
190
+
191
+ v8::CFunction WebGL2RenderingContext::fast_vertex_attrib_i_4i_(
192
+ v8::CFunction::Make(WebGL2RenderingContext::FastVertexAttribI4i));
193
+
194
+
195
+ v8::CFunction WebGL2RenderingContext::fast_vertex_attrib_i_4iv_(
196
+ v8::CFunction::Make(WebGL2RenderingContext::FastVertexAttribI4iv));
197
+
198
+ v8::CFunction WebGL2RenderingContext::fast_vertex_attrib_i_4iv_array_(
199
+ v8::CFunction::Make(WebGL2RenderingContext::FastVertexAttribI4ivArray));
200
+
201
+ const v8::CFunction fast_vertex_attrib_i_4iv_overloads_[] = {
202
+ WebGL2RenderingContext::fast_vertex_attrib_i_4iv_,
203
+ WebGL2RenderingContext::fast_vertex_attrib_i_4iv_array_
204
+ };
205
+
206
+
207
+ v8::CFunction WebGL2RenderingContext::fast_vertex_attrib_i_4ui_(
208
+ v8::CFunction::Make(WebGL2RenderingContext::FastVertexAttribI4ui));
209
+
210
+
211
+ v8::CFunction WebGL2RenderingContext::fast_vertex_attrib_i_4uiv_(
212
+ v8::CFunction::Make(WebGL2RenderingContext::FastVertexAttribI4uiv));
213
+
214
+ v8::CFunction WebGL2RenderingContext::fast_vertex_attrib_i_4uiv_array_(
215
+ v8::CFunction::Make(WebGL2RenderingContext::FastVertexAttribI4uivArray));
216
+
217
+ const v8::CFunction fast_vertex_attrib_i_4uiv_overloads_[] = {
218
+ WebGL2RenderingContext::fast_vertex_attrib_i_4uiv_,
219
+ WebGL2RenderingContext::fast_vertex_attrib_i_4uiv_array_
220
+ };
221
+
222
+ v8::CFunction WebGL2RenderingContext::fast_uniform_block_binding_(
223
+ v8::CFunction::Make(WebGL2RenderingContext::FastUniformBlockBinding));
224
+
225
+
226
+ v8::CFunction WebGL2RenderingContext::fast_invalidate_framebuffer_(
227
+ v8::CFunction::Make(WebGL2RenderingContext::FastInvalidateFramebuffer));
228
+
229
+ v8::CFunction WebGL2RenderingContext::fast_invalidate_sub_framebuffer_(
230
+ v8::CFunction::Make(WebGL2RenderingContext::FastInvalidateSubFramebuffer));
231
+
232
+
233
+ WebGL2RenderingContext::WebGL2RenderingContext(WebGLState *state) : WebGLRenderingContext(
234
+ state, WebGLRenderingVersion::V2) {
235
+ }
236
+
237
+
238
+ WebGL2RenderingContext::WebGL2RenderingContext(WebGLState *state,
239
+ WebGLRenderingVersion version)
240
+ : WebGLRenderingContext(state, version) {
241
+ }
242
+
243
+
244
+ v8::Local<v8::FunctionTemplate> WebGL2RenderingContext::GetCtor(v8::Isolate *isolate) {
245
+ auto cache = Caches::Get(isolate);
246
+ auto ctor = cache->WebGL2RenderingContextTmpl.get();
247
+ if (ctor != nullptr) {
248
+ return ctor->Get(isolate);
249
+ }
250
+
251
+ v8::Local<v8::FunctionTemplate> ctorTmpl = v8::FunctionTemplate::New(isolate);
252
+ ctorTmpl->InstanceTemplate()->SetInternalFieldCount(2);
253
+ ctorTmpl->SetClassName(ConvertToV8String(isolate, "WebGL2RenderingContext"));
254
+
255
+ auto tmpl = ctorTmpl->InstanceTemplate();
256
+ tmpl->SetInternalFieldCount(2);
257
+ WebGLRenderingContext::SetConstants(isolate, tmpl);
258
+ SetConstants(isolate, tmpl);
259
+
260
+ WebGLRenderingContext::SetMethods(isolate, tmpl);
261
+ SetMethods(isolate, tmpl);
262
+
263
+ WebGLRenderingContext::SetProps(isolate, tmpl);
264
+ SetProps(isolate, tmpl);
265
+ cache->WebGL2RenderingContextTmpl =
266
+ std::make_unique<v8::Persistent<v8::FunctionTemplate>>(isolate, ctorTmpl);
267
+ return ctorTmpl;
268
+ }
269
+
270
+ WebGL2RenderingContext *WebGL2RenderingContext::GetPointer(const v8::Local<v8::Object> &object) {
271
+ auto ptr = object->GetAlignedPointerFromInternalField(0);
272
+ if (ptr == nullptr) {
273
+ return nullptr;
274
+ }
275
+ return static_cast<WebGL2RenderingContext *>(ptr);
276
+ }
277
+
278
+ void WebGL2RenderingContext::BeginQuery(const v8::FunctionCallbackInfo<v8::Value> &args) {
279
+ WebGL2RenderingContext *ptr = GetPointer(args.This());
280
+ if (ptr == nullptr) {
281
+ return;
282
+ }
283
+
284
+ auto isolate = args.GetIsolate();
285
+ auto context = isolate->GetCurrentContext();
286
+
287
+ auto value = args[1];
288
+ auto type = GetNativeType(value);
289
+ if (type == NativeType::WebGLQuery) {
290
+ auto target = args[0]->Uint32Value(context).ToChecked();
291
+ auto query = WebGLQuery::GetPointer(value.As<v8::Object>());
292
+
293
+ if (query != nullptr) {
294
+ canvas_native_webgl2_begin_query(
295
+ target,
296
+ query->GetQuery(),
297
+ ptr->GetState()
298
+ );
299
+ }
300
+ }
301
+ }
302
+
303
+ void
304
+ WebGL2RenderingContext::BeginTransformFeedback(const v8::FunctionCallbackInfo<v8::Value> &args) {
305
+ WebGL2RenderingContext *ptr = GetPointer(args.This());
306
+ if (ptr == nullptr) {
307
+ return;
308
+ }
309
+
310
+ auto isolate = args.GetIsolate();
311
+ auto context = isolate->GetCurrentContext();
312
+
313
+ auto value = args[0]->Uint32Value(context).ToChecked();
314
+ canvas_native_webgl2_begin_transform_feedback(
315
+ value,
316
+ ptr->GetState()
317
+ );
318
+ }
319
+
320
+ void WebGL2RenderingContext::BindBufferBase(const v8::FunctionCallbackInfo<v8::Value> &args) {
321
+ WebGL2RenderingContext *ptr = GetPointer(args.This());
322
+ if (ptr == nullptr) {
323
+ return;
324
+ }
325
+
326
+ auto isolate = args.GetIsolate();
327
+ auto context = isolate->GetCurrentContext();
328
+
329
+ auto bufferValue = args[2];
330
+ auto type = GetNativeType(bufferValue);
331
+
332
+ if (type == NativeType::WebGLBuffer) {
333
+ auto target = args[0]->Uint32Value(context).ToChecked();
334
+ auto index = args[1]->Uint32Value(context).ToChecked();
335
+
336
+ auto buffer = WebGLBuffer::GetPointer(bufferValue.As<v8::Object>());
337
+
338
+ canvas_native_webgl2_bind_buffer_base(
339
+ target,
340
+ index,
341
+ buffer->GetBuffer(),
342
+ ptr->GetState()
343
+ );
344
+ }
345
+ }
346
+
347
+ void WebGL2RenderingContext::BindBufferRange(const v8::FunctionCallbackInfo<v8::Value> &args) {
348
+ WebGL2RenderingContext *ptr = GetPointer(args.This());
349
+ if (ptr == nullptr) {
350
+ return;
351
+ }
352
+
353
+ auto isolate = args.GetIsolate();
354
+ auto context = isolate->GetCurrentContext();
355
+
356
+ auto bufferValue = args[2];
357
+ auto type = GetNativeType(bufferValue);
358
+ if (type == NativeType::WebGLBuffer) {
359
+ auto target = args[0]->Uint32Value(context).ToChecked();
360
+ auto index = args[1]->Uint32Value(context).ToChecked();
361
+ auto offset = args[3]->NumberValue(context).ToChecked();
362
+ auto size = args[4]->NumberValue(context).ToChecked();
363
+ auto buffer = WebGLBuffer::GetPointer(bufferValue.As<v8::Object>());
364
+ canvas_native_webgl2_bind_buffer_range(
365
+ target,
366
+ index,
367
+ buffer->GetBuffer(),
368
+ static_cast<ssize_t>(offset),
369
+ static_cast<ssize_t>(size),
370
+ ptr->GetState()
371
+ );
372
+ }
373
+ }
374
+
375
+ void WebGL2RenderingContext::BindSampler(const v8::FunctionCallbackInfo<v8::Value> &args) {
376
+ WebGL2RenderingContext *ptr = GetPointer(args.This());
377
+ if (ptr == nullptr) {
378
+ return;
379
+ }
380
+
381
+ auto isolate = args.GetIsolate();
382
+ auto context = isolate->GetCurrentContext();
383
+
384
+ auto samplerValue = args[1];
385
+ auto type = GetNativeType(samplerValue);
386
+ if (type == NativeType::WebGLSampler) {
387
+ auto unit = args[0]->Uint32Value(context).ToChecked();
388
+ auto sampler = WebGLSampler::GetPointer(samplerValue.As<v8::Object>());
389
+
390
+ canvas_native_webgl2_bind_sampler(
391
+ unit,
392
+ sampler->GetSampler(),
393
+ ptr->GetState()
394
+ );
395
+ }
396
+ }
397
+
398
+ void
399
+ WebGL2RenderingContext::BindTransformFeedback(const v8::FunctionCallbackInfo<v8::Value> &args) {
400
+ WebGL2RenderingContext *ptr = GetPointer(args.This());
401
+ if (ptr == nullptr) {
402
+ return;
403
+ }
404
+
405
+ auto isolate = args.GetIsolate();
406
+ auto context = isolate->GetCurrentContext();
407
+
408
+ auto transformFeedbackValue = args[1];
409
+ auto type = GetNativeType(transformFeedbackValue);
410
+
411
+ if (type == NativeType::WebGLTransformFeedback) {
412
+ auto target = args[0]->Uint32Value(context).ToChecked();
413
+ auto transformFeedback = WebGLTransformFeedback::GetPointer(
414
+ transformFeedbackValue.As<v8::Object>());
415
+
416
+ canvas_native_webgl2_bind_transform_feedback(
417
+ target,
418
+ transformFeedback->GetFeedback(),
419
+ ptr->GetState()
420
+ );
421
+ }
422
+ }
423
+
424
+ void WebGL2RenderingContext::BindVertexArray(const v8::FunctionCallbackInfo<v8::Value> &args) {
425
+ WebGL2RenderingContext *ptr = GetPointer(args.This());
426
+ if (ptr == nullptr) {
427
+ return;
428
+ }
429
+
430
+ auto isolate = args.GetIsolate();
431
+
432
+ auto value = args[0];
433
+ if (value->IsNull()) {
434
+ canvas_native_webgl2_bind_vertex_array(
435
+ 0,
436
+ ptr->GetState()
437
+ );
438
+ return;
439
+ }
440
+
441
+ auto type = GetNativeType(value);
442
+ if (type == NativeType::WebGLVertexArrayObject) {
443
+ auto vertexArray = WebGLVertexArrayObject::GetPointer(value.As<v8::Object>());
444
+
445
+ if (vertexArray != nullptr) {
446
+ canvas_native_webgl2_bind_vertex_array(
447
+ vertexArray->GetVertexArrayObject(),
448
+ ptr->GetState()
449
+ );
450
+ }
451
+ }
452
+ }
453
+
454
+ void WebGL2RenderingContext::BlitFramebuffer(const v8::FunctionCallbackInfo<v8::Value> &args) {
455
+ WebGL2RenderingContext *ptr = GetPointer(args.This());
456
+ if (ptr == nullptr) {
457
+ return;
458
+ }
459
+
460
+ auto isolate = args.GetIsolate();
461
+ auto context = isolate->GetCurrentContext();
462
+
463
+ auto srcX0 = args[0]->Int32Value(context).ToChecked();
464
+ auto srcY0 = args[1]->Int32Value(context).ToChecked();
465
+
466
+ auto srcX1 = args[2]->Int32Value(context).ToChecked();
467
+ auto srcY1 = args[3]->Int32Value(context).ToChecked();
468
+
469
+ auto dstX0 = args[4]->Int32Value(context).ToChecked();
470
+ auto dstY0 = args[5]->Int32Value(context).ToChecked();
471
+
472
+ auto dstX1 = args[6]->Int32Value(context).ToChecked();
473
+ auto dstY1 = args[7]->Int32Value(context).ToChecked();
474
+
475
+ auto mask = args[8]->Uint32Value(context).ToChecked();
476
+ auto filter = args[9]->Uint32Value(context).ToChecked();
477
+ canvas_native_webgl2_blit_framebuffer(
478
+ srcX0,
479
+ srcY0,
480
+ srcX1,
481
+ srcY1,
482
+ dstX0,
483
+ dstY0,
484
+ dstX1,
485
+ dstY1,
486
+ mask,
487
+ filter,
488
+ ptr->GetState()
489
+ );
490
+ }
491
+
492
+ void WebGL2RenderingContext::ClearBufferfv(const v8::FunctionCallbackInfo<v8::Value> &args) {
493
+ WebGL2RenderingContext *ptr = GetPointer(args.This());
494
+ if (ptr == nullptr) {
495
+ return;
496
+ }
497
+
498
+ auto isolate = args.GetIsolate();
499
+ auto context = isolate->GetCurrentContext();
500
+
501
+ auto values = args[2];
502
+ auto buffer = args[0]->Uint32Value(context).ToChecked();
503
+ auto drawbuffer = args[1]->Int32Value(context).ToChecked();
504
+ if (values->IsArray()) {
505
+ auto array = values.As<v8::Array>();
506
+ auto len = array->Length();
507
+ std::vector<float> buf;
508
+ buf.reserve(len);
509
+ for (int j = 0; j < len; ++j) {
510
+ auto item = array->Get(
511
+ context, j).ToLocalChecked();
512
+ buf.push_back(
513
+ static_cast<float>(item->NumberValue(context).ToChecked())
514
+ );
515
+ }
516
+
517
+ canvas_native_webgl2_clear_bufferfv(
518
+ buffer,
519
+ drawbuffer,
520
+ buf.data(),
521
+ buf.size(),
522
+ ptr->GetState()
523
+ );
524
+
525
+ } else if (values->IsFloat32Array()) {
526
+ auto buf = values.As<v8::Float32Array>();
527
+ auto array = buf->Buffer();
528
+ auto offset = buf->ByteOffset();
529
+ auto size = buf->Length();
530
+ auto data_ptr = static_cast<uint8_t *>(array->GetBackingStore()->Data()) + offset;
531
+ auto data = static_cast<float *>((void *) data_ptr);
532
+
533
+
534
+ canvas_native_webgl2_clear_bufferfv(
535
+ buffer,
536
+ drawbuffer,
537
+ data,
538
+ size,
539
+ ptr->GetState()
540
+ );
541
+ }
542
+ }
543
+
544
+ void WebGL2RenderingContext::ClearBufferiv(const v8::FunctionCallbackInfo<v8::Value> &args) {
545
+ WebGL2RenderingContext *ptr = GetPointer(args.This());
546
+ if (ptr == nullptr) {
547
+ return;
548
+ }
549
+
550
+ auto isolate = args.GetIsolate();
551
+ auto context = isolate->GetCurrentContext();
552
+
553
+ auto values = args[2];
554
+
555
+ auto buffer = args[0]->Uint32Value(context).ToChecked();
556
+ auto drawbuffer = args[1]->Int32Value(context).ToChecked();
557
+ if (values->IsArray()) {
558
+ auto array = values.As<v8::Array>();
559
+ auto len = array->Length();
560
+ std::vector<int32_t> buf;
561
+ buf.reserve(len);
562
+ for (int j = 0; j < len; ++j) {
563
+ auto item = array->Get(
564
+ context, j).ToLocalChecked();
565
+ buf.push_back(
566
+ item->Int32Value(context).ToChecked()
567
+ );
568
+ }
569
+
570
+
571
+ canvas_native_webgl2_clear_bufferiv(
572
+ buffer,
573
+ drawbuffer,
574
+ buf.data(),
575
+ buf.size(),
576
+ ptr->GetState()
577
+ );
578
+
579
+ } else if (values->IsInt32Array()) {
580
+ auto buf = values.As<v8::Int32Array>();
581
+
582
+ auto array = buf->Buffer();
583
+ auto offset = buf->ByteOffset();
584
+ auto size = buf->Length();
585
+ auto data_ptr = static_cast<uint8_t *>(array->GetBackingStore()->Data()) + offset;
586
+ auto data = static_cast<int32_t *>((void *) data_ptr);
587
+
588
+
589
+ canvas_native_webgl2_clear_bufferiv(
590
+ buffer,
591
+ drawbuffer,
592
+ data,
593
+ size,
594
+ ptr->GetState()
595
+ );
596
+ }
597
+ }
598
+
599
+ void WebGL2RenderingContext::ClearBufferfi(const v8::FunctionCallbackInfo<v8::Value> &args) {
600
+ WebGL2RenderingContext *ptr = GetPointer(args.This());
601
+ if (ptr == nullptr) {
602
+ return;
603
+ }
604
+
605
+ auto isolate = args.GetIsolate();
606
+ auto context = isolate->GetCurrentContext();
607
+
608
+ auto buffer = args[0]->Uint32Value(context).ToChecked();
609
+ auto drawbuffer = args[1]->Int32Value(context).ToChecked();
610
+ auto depth = args[2]->NumberValue(context).ToChecked();
611
+ auto stencil = args[3]->Int32Value(context).ToChecked();
612
+ canvas_native_webgl2_clear_bufferfi(
613
+ buffer,
614
+ drawbuffer,
615
+ static_cast<float>(depth),
616
+ stencil,
617
+ ptr->GetState()
618
+ );
619
+ }
620
+
621
+ void WebGL2RenderingContext::ClearBufferuiv(const v8::FunctionCallbackInfo<v8::Value> &args) {
622
+ WebGL2RenderingContext *ptr = GetPointer(args.This());
623
+ if (ptr == nullptr) {
624
+ return;
625
+ }
626
+
627
+ auto isolate = args.GetIsolate();
628
+ auto context = isolate->GetCurrentContext();
629
+
630
+
631
+ auto values = args[2];
632
+
633
+ auto buffer = args[0]->Uint32Value(context).ToChecked();
634
+ auto drawbuffer = args[1]->Int32Value(context).ToChecked();
635
+ if (values->IsArray()) {
636
+ auto array = values.As<v8::Array>();
637
+ auto len = array->Length();
638
+ std::vector<uint32_t> buf;
639
+ buf.reserve(len);
640
+ for (int j = 0; j < len; ++j) {
641
+ auto item = array->Get(
642
+ context, j).ToLocalChecked();
643
+ buf.push_back(
644
+ item->Uint32Value(context).ToChecked()
645
+ );
646
+ }
647
+
648
+
649
+ canvas_native_webgl2_clear_bufferuiv(
650
+ buffer,
651
+ drawbuffer,
652
+ buf.data(),
653
+ buf.size(),
654
+ ptr->GetState()
655
+ );
656
+
657
+ } else if (values->IsUint32Array()) {
658
+ auto buf = values.As<v8::Uint32Array>();
659
+ auto array = buf->Buffer();
660
+ auto offset = buf->ByteOffset();
661
+ auto size = buf->Length();
662
+ auto data_ptr = static_cast<uint8_t *>(array->GetBackingStore()->Data()) + offset;
663
+ auto data = static_cast<uint32_t *>((void *) data_ptr);
664
+
665
+
666
+ canvas_native_webgl2_clear_bufferuiv(
667
+ buffer,
668
+ drawbuffer,
669
+ data, size,
670
+ ptr->GetState()
671
+ );
672
+ }
673
+ }
674
+
675
+ void WebGL2RenderingContext::ClientWaitSync(const v8::FunctionCallbackInfo<v8::Value> &args) {
676
+ WebGL2RenderingContext *ptr = GetPointer(args.This());
677
+ if (ptr == nullptr) {
678
+ return;
679
+ }
680
+
681
+ auto isolate = args.GetIsolate();
682
+ auto context = isolate->GetCurrentContext();
683
+
684
+ auto syncValue = args[0];
685
+ auto type = GetNativeType(syncValue);
686
+ if (args.Length() > 2 && type == NativeType::WebGLSync) {
687
+ auto sync = WebGLSyncImpl::GetPointer(syncValue.As<v8::Object>());
688
+ if (sync != nullptr) {
689
+ auto flags = args[1]->Uint32Value(context).ToChecked();
690
+ auto timeout = args[2]->NumberValue(context).ToChecked();
691
+ auto ret = canvas_native_webgl2_client_wait_sync(
692
+ sync->GetSync(),
693
+ flags,
694
+ static_cast<ssize_t>(timeout),
695
+ ptr->GetState()
696
+ );
697
+
698
+ args.GetReturnValue().Set(ret);
699
+ return;
700
+ }
701
+ }
702
+ // todo decide if WAIT_FAILED should be returned here
703
+ args.GetReturnValue().SetUndefined();
704
+ }
705
+
706
+ void
707
+ WebGL2RenderingContext::CompressedTexSubImage3D(const v8::FunctionCallbackInfo<v8::Value> &args) {
708
+ WebGL2RenderingContext *ptr = GetPointer(args.This());
709
+ if (ptr == nullptr) {
710
+ return;
711
+ }
712
+
713
+ auto isolate = args.GetIsolate();
714
+ auto context = isolate->GetCurrentContext();
715
+
716
+ if (args.Length() > 8) {
717
+ auto target = args[0]->Uint32Value(context).ToChecked();
718
+ auto level = args[1]->Int32Value(context).ToChecked();
719
+ auto xoffset = args[2]->Int32Value(context).ToChecked();
720
+ auto yoffset = args[3]->Int32Value(context).ToChecked();
721
+ auto zoffset = args[4]->Int32Value(context).ToChecked();
722
+ auto width = args[5]->Int32Value(context).ToChecked();
723
+ auto height = args[6]->Int32Value(context).ToChecked();
724
+ auto depth = args[7]->Int32Value(context).ToChecked();
725
+ auto format = args[8]->Uint32Value(context).ToChecked();
726
+
727
+ auto imageSizeOrBufValue = args[0];
728
+ if (args[9]->IsObject()) {
729
+ if (imageSizeOrBufValue->IsArrayBufferView()) {
730
+ auto buf = imageSizeOrBufValue.As<v8::ArrayBufferView>();
731
+ auto array = buf->Buffer();
732
+ auto offset = buf->ByteOffset();
733
+ auto size = buf->ByteLength();
734
+ auto data_ptr = static_cast<uint8_t *>(array->GetBackingStore()->Data()) + offset;
735
+ auto data = static_cast<uint8_t *>((void *) data_ptr);
736
+
737
+ size_t srcOffset = 0;
738
+ if (args[10]->IsNumber()) {
739
+ srcOffset = static_cast<size_t>(args[10]->NumberValue(context).ToChecked());
740
+ }
741
+ size_t srcLengthOverride = 0;
742
+ if (args[11]->IsNumber()) {
743
+ srcLengthOverride = static_cast<size_t>(args[11]->NumberValue(
744
+ context).ToChecked());
745
+ }
746
+
747
+
748
+ canvas_native_webgl2_compressed_tex_sub_image3d(
749
+ target,
750
+ level,
751
+ xoffset,
752
+ yoffset,
753
+ zoffset,
754
+ width,
755
+ height,
756
+ depth,
757
+ format,
758
+ data,
759
+ size,
760
+ srcOffset,
761
+ srcLengthOverride,
762
+ ptr->GetState()
763
+ );
764
+ }
765
+ } else {
766
+ auto imageSizeOrBuf = imageSizeOrBufValue->Int32Value(context).ToChecked();
767
+ auto offset = 0;
768
+ if (args[10]->IsNumber()) {
769
+ offset = args[10]->Int32Value(context).ToChecked();
770
+ }
771
+ canvas_native_webgl2_compressed_tex_sub_image3d_none(
772
+ target,
773
+ level,
774
+ xoffset,
775
+ yoffset,
776
+ zoffset,
777
+ width,
778
+ height,
779
+ depth,
780
+ format,
781
+ imageSizeOrBuf,
782
+ offset,
783
+ ptr->GetState()
784
+ );
785
+ }
786
+ }
787
+ }
788
+
789
+ void WebGL2RenderingContext::CopyBufferSubData(const v8::FunctionCallbackInfo<v8::Value> &args) {
790
+ WebGL2RenderingContext *ptr = GetPointer(args.This());
791
+ if (ptr == nullptr) {
792
+ return;
793
+ }
794
+
795
+ auto isolate = args.GetIsolate();
796
+ auto context = isolate->GetCurrentContext();
797
+
798
+ auto readTarget = args[0]->Uint32Value(context).ToChecked();
799
+ auto writeTarget = args[1]->Uint32Value(context).ToChecked();
800
+ auto readOffset = args[2]->NumberValue(context).ToChecked();
801
+ auto writeOffset = args[3]->NumberValue(context).ToChecked();
802
+ auto size = args[4]->NumberValue(context).ToChecked();
803
+ canvas_native_webgl2_copy_buffer_sub_data(
804
+ readTarget,
805
+ writeTarget,
806
+ static_cast<ssize_t>(readOffset),
807
+ static_cast<ssize_t>(writeOffset),
808
+ static_cast<ssize_t>(size),
809
+ ptr->GetState()
810
+ );
811
+ }
812
+
813
+ void WebGL2RenderingContext::CopyTexSubImage3D(const v8::FunctionCallbackInfo<v8::Value> &args) {
814
+ WebGL2RenderingContext *ptr = GetPointer(args.This());
815
+ if (ptr == nullptr) {
816
+ return;
817
+ }
818
+
819
+ auto isolate = args.GetIsolate();
820
+ auto context = isolate->GetCurrentContext();
821
+
822
+ auto target = args[0]->Uint32Value(context).ToChecked();
823
+ auto level = args[1]->Int32Value(context).ToChecked();
824
+ auto xoffset = args[2]->Int32Value(context).ToChecked();
825
+ auto yoffset = args[3]->Int32Value(context).ToChecked();
826
+ auto zoffset = args[4]->Int32Value(context).ToChecked();
827
+ auto x = args[5]->Int32Value(context).ToChecked();
828
+ auto y = args[6]->Int32Value(context).ToChecked();
829
+ auto width = args[7]->Int32Value(context).ToChecked();
830
+ auto height = args[8]->Int32Value(context).ToChecked();
831
+ canvas_native_webgl2_copy_tex_sub_image3d(
832
+ target,
833
+ level,
834
+ xoffset,
835
+ yoffset,
836
+ zoffset,
837
+ x,
838
+ y,
839
+ width,
840
+ height,
841
+ ptr->GetState()
842
+ );
843
+ }
844
+
845
+ void WebGL2RenderingContext::CreateQuery(const v8::FunctionCallbackInfo<v8::Value> &args) {
846
+ WebGL2RenderingContext *ptr = GetPointer(args.This());
847
+ if (ptr == nullptr) {
848
+ args.GetReturnValue().SetUndefined();
849
+ return;
850
+ }
851
+
852
+ auto isolate = args.GetIsolate();
853
+
854
+ auto ret = canvas_native_webgl2_create_query(
855
+ ptr->GetState());
856
+ auto query = WebGLQuery::NewInstance(isolate, new WebGLQuery(ret));
857
+
858
+ args.GetReturnValue().Set(query);
859
+ }
860
+
861
+ void WebGL2RenderingContext::CreateSampler(const v8::FunctionCallbackInfo<v8::Value> &args) {
862
+ WebGL2RenderingContext *ptr = GetPointer(args.This());
863
+ if (ptr == nullptr) {
864
+ args.GetReturnValue().SetUndefined();
865
+ return;
866
+ }
867
+
868
+ auto isolate = args.GetIsolate();
869
+
870
+ auto ret = canvas_native_webgl2_create_sampler(
871
+ ptr->GetState());
872
+ auto sampler = WebGLSampler::NewInstance(isolate, new WebGLSampler(ret));
873
+
874
+ args.GetReturnValue().Set(sampler);
875
+ }
876
+
877
+ void
878
+ WebGL2RenderingContext::CreateTransformFeedback(const v8::FunctionCallbackInfo<v8::Value> &args) {
879
+ WebGL2RenderingContext *ptr = GetPointer(args.This());
880
+ if (ptr == nullptr) {
881
+ args.GetReturnValue().SetUndefined();
882
+ return;
883
+ }
884
+
885
+ auto isolate = args.GetIsolate();
886
+
887
+ auto ret = canvas_native_webgl2_create_transform_feedback(
888
+ ptr->GetState());
889
+
890
+ auto feedback = WebGLTransformFeedback::NewInstance(isolate, new WebGLTransformFeedback(
891
+ ret));
892
+
893
+ args.GetReturnValue().Set(feedback);
894
+ }
895
+
896
+ void WebGL2RenderingContext::CreateVertexArray(const v8::FunctionCallbackInfo<v8::Value> &args) {
897
+ WebGL2RenderingContext *ptr = GetPointer(args.This());
898
+ if (ptr == nullptr) {
899
+ args.GetReturnValue().SetUndefined();
900
+ return;
901
+ }
902
+
903
+ auto isolate = args.GetIsolate();
904
+
905
+ auto ret = canvas_native_webgl2_create_vertex_array(
906
+ ptr->GetState());
907
+
908
+ auto vertexArrayObject = WebGLVertexArrayObject::NewInstance(isolate,
909
+ new WebGLVertexArrayObject(ret));
910
+
911
+ args.GetReturnValue().Set(vertexArrayObject);
912
+ }
913
+
914
+ void WebGL2RenderingContext::DeleteQuery(const v8::FunctionCallbackInfo<v8::Value> &args) {
915
+ WebGL2RenderingContext *ptr = GetPointer(args.This());
916
+ if (ptr == nullptr) {
917
+ return;
918
+ }
919
+
920
+ auto isolate = args.GetIsolate();
921
+
922
+ auto queryValue = args[0];
923
+ auto type = GetNativeType(queryValue);
924
+ if (type == NativeType::WebGLQuery) {
925
+ auto query = WebGLQuery::GetPointer(queryValue.As<v8::Object>());
926
+
927
+ if (query != nullptr) {
928
+ canvas_native_webgl2_delete_query_with_query(
929
+ query->GetQuery(),
930
+ ptr->GetState()
931
+ );
932
+ }
933
+ }
934
+ }
935
+
936
+ void WebGL2RenderingContext::DeleteSampler(const v8::FunctionCallbackInfo<v8::Value> &args) {
937
+ WebGL2RenderingContext *ptr = GetPointer(args.This());
938
+ if (ptr == nullptr) {
939
+ return;
940
+ }
941
+
942
+ auto isolate = args.GetIsolate();
943
+
944
+
945
+ auto samplerValue = args[0];
946
+ auto type = GetNativeType(samplerValue);
947
+
948
+ if (type == NativeType::WebGLSampler) {
949
+ auto sampler = WebGLSampler::GetPointer(samplerValue.As<v8::Object>());
950
+
951
+ if (sampler != nullptr) {
952
+ canvas_native_webgl2_delete_sampler_with_sampler(
953
+ sampler->GetSampler(),
954
+ ptr->GetState()
955
+ );
956
+ }
957
+ }
958
+ }
959
+
960
+ void WebGL2RenderingContext::DeleteSync(const v8::FunctionCallbackInfo<v8::Value> &args) {
961
+ WebGL2RenderingContext *ptr = GetPointer(args.This());
962
+ if (ptr == nullptr) {
963
+ return;
964
+ }
965
+
966
+ auto isolate = args.GetIsolate();
967
+
968
+
969
+ auto syncValue = args[0];
970
+ auto type = GetNativeType(syncValue);
971
+ if (type == NativeType::WebGLSync) {
972
+ auto sync = WebGLSyncImpl::GetPointer(syncValue.As<v8::Object>());
973
+
974
+ if (sync != nullptr) {
975
+ canvas_native_webgl2_delete_sync_with_sync(
976
+ sync->GetSync(),
977
+ ptr->GetState()
978
+ );
979
+ }
980
+ }
981
+ }
982
+
983
+ void
984
+ WebGL2RenderingContext::DeleteTransformFeedback(const v8::FunctionCallbackInfo<v8::Value> &args) {
985
+ WebGL2RenderingContext *ptr = GetPointer(args.This());
986
+ if (ptr == nullptr) {
987
+ return;
988
+ }
989
+
990
+ auto isolate = args.GetIsolate();
991
+
992
+
993
+ auto transformFeedbackValue = args[0];
994
+ auto type = GetNativeType(transformFeedbackValue);
995
+ if (type == NativeType::WebGLTransformFeedback) {
996
+ auto transformFeedback = WebGLTransformFeedback::GetPointer(
997
+ transformFeedbackValue.As<v8::Object>());
998
+
999
+ if (transformFeedback != nullptr) {
1000
+ canvas_native_webgl2_delete_transform_feedback(
1001
+ transformFeedback->GetFeedback(),
1002
+ ptr->GetState()
1003
+ );
1004
+ }
1005
+ }
1006
+ }
1007
+
1008
+ void WebGL2RenderingContext::DeleteVertexArray(const v8::FunctionCallbackInfo<v8::Value> &args) {
1009
+ WebGL2RenderingContext *ptr = GetPointer(args.This());
1010
+ if (ptr == nullptr) {
1011
+ return;
1012
+ }
1013
+
1014
+ auto isolate = args.GetIsolate();
1015
+
1016
+
1017
+ auto vertexArrayValue = args[0];
1018
+ auto type = GetNativeType(vertexArrayValue);
1019
+ if (type == NativeType::WebGLVertexArrayObject) {
1020
+
1021
+ auto vertexArray = WebGLVertexArrayObject::GetPointer(vertexArrayValue.As<v8::Object>());
1022
+ if (vertexArray != nullptr) {
1023
+ canvas_native_webgl2_delete_vertex_array_with_vertex_array(
1024
+ vertexArray->GetVertexArrayObject(),
1025
+ ptr->GetState()
1026
+ );
1027
+ }
1028
+ }
1029
+ }
1030
+
1031
+ void WebGL2RenderingContext::DrawArraysInstanced(const v8::FunctionCallbackInfo<v8::Value> &args) {
1032
+ WebGL2RenderingContext *ptr = GetPointer(args.This());
1033
+ if (ptr == nullptr) {
1034
+ return;
1035
+ }
1036
+
1037
+ auto isolate = args.GetIsolate();
1038
+ auto context = isolate->GetCurrentContext();
1039
+
1040
+ auto mode = args[0]->Uint32Value(context).ToChecked();
1041
+ auto first = args[1]->Int32Value(context).ToChecked();
1042
+ auto count_ = args[2]->Int32Value(context).ToChecked();
1043
+ auto instanceCount = args[3]->Int32Value(context).ToChecked();
1044
+ canvas_native_webgl2_draw_arrays_instanced(
1045
+ mode,
1046
+ first,
1047
+ count_,
1048
+ instanceCount,
1049
+ ptr->GetState()
1050
+ );
1051
+
1052
+ ptr->UpdateInvalidateState();
1053
+ }
1054
+
1055
+ void WebGL2RenderingContext::DrawBuffers(const v8::FunctionCallbackInfo<v8::Value> &args) {
1056
+ WebGL2RenderingContext *ptr = GetPointer(args.This());
1057
+ if (ptr == nullptr) {
1058
+ return;
1059
+ }
1060
+
1061
+ auto isolate = args.GetIsolate();
1062
+ auto context = isolate->GetCurrentContext();
1063
+
1064
+ auto buffersObject = args[0];
1065
+ if (buffersObject->IsArray()) {
1066
+ auto array = buffersObject.As<v8::Array>();
1067
+ auto len = array->Length();
1068
+ std::vector<uint32_t> buf;
1069
+ buf.reserve(len);
1070
+ for (int j = 0; j < len; ++j) {
1071
+ auto item = array->Get(
1072
+ context, j).ToLocalChecked();
1073
+ buf.emplace_back(item->Uint32Value(context).ToChecked());
1074
+ }
1075
+
1076
+ canvas_native_webgl2_draw_buffers(
1077
+ buf.data(), buf.size(),
1078
+ ptr->GetState());
1079
+ }
1080
+ }
1081
+
1082
+ void
1083
+ WebGL2RenderingContext::DrawElementsInstanced(const v8::FunctionCallbackInfo<v8::Value> &args) {
1084
+ WebGL2RenderingContext *ptr = GetPointer(args.This());
1085
+ if (ptr == nullptr) {
1086
+ return;
1087
+ }
1088
+
1089
+ auto isolate = args.GetIsolate();
1090
+ auto context = isolate->GetCurrentContext();
1091
+
1092
+ auto mode = args[0]->Uint32Value(context).ToChecked();
1093
+ auto count_ = args[1]->Int32Value(context).ToChecked();
1094
+ auto type = args[2]->Uint32Value(context).ToChecked();
1095
+ auto offset = args[3]->NumberValue(context).ToChecked();
1096
+ auto instanceCount = args[4]->Int32Value(context).ToChecked();
1097
+ canvas_native_webgl2_draw_elements_instanced(
1098
+ mode,
1099
+ count_,
1100
+ type,
1101
+ static_cast<ssize_t>(offset),
1102
+ instanceCount,
1103
+ ptr->GetState()
1104
+ );
1105
+
1106
+ ptr->UpdateInvalidateState();
1107
+ }
1108
+
1109
+ void WebGL2RenderingContext::DrawRangeElements(const v8::FunctionCallbackInfo<v8::Value> &args) {
1110
+ WebGL2RenderingContext *ptr = GetPointer(args.This());
1111
+ if (ptr == nullptr) {
1112
+ return;
1113
+ }
1114
+
1115
+ auto isolate = args.GetIsolate();
1116
+ auto context = isolate->GetCurrentContext();
1117
+
1118
+ auto mode = args[0]->Uint32Value(context).ToChecked();
1119
+ auto start = args[1]->Uint32Value(context).ToChecked();
1120
+ auto end = args[2]->Uint32Value(context).ToChecked();
1121
+ auto count = args[3]->Int32Value(context).ToChecked();
1122
+ auto type = args[4]->Uint32Value(context).ToChecked();
1123
+ auto offset = args[5]->NumberValue(context).ToChecked();
1124
+ canvas_native_webgl2_draw_range_elements(
1125
+ mode,
1126
+ start,
1127
+ end,
1128
+ count,
1129
+ type,
1130
+ static_cast<ssize_t>(offset),
1131
+ ptr->GetState()
1132
+ );
1133
+
1134
+ ptr->UpdateInvalidateState();
1135
+ }
1136
+
1137
+ void WebGL2RenderingContext::EndQuery(const v8::FunctionCallbackInfo<v8::Value> &args) {
1138
+ WebGL2RenderingContext *ptr = GetPointer(args.This());
1139
+ if (ptr == nullptr) {
1140
+ return;
1141
+ }
1142
+
1143
+ auto isolate = args.GetIsolate();
1144
+ auto context = isolate->GetCurrentContext();
1145
+
1146
+ auto target = args[0]->Uint32Value(context).ToChecked();
1147
+ canvas_native_webgl2_end_query(target,
1148
+ ptr->GetState());
1149
+ }
1150
+
1151
+ void WebGL2RenderingContext::EndTransformFeedback(const v8::FunctionCallbackInfo<v8::Value> &args) {
1152
+ WebGL2RenderingContext *ptr = GetPointer(args.This());
1153
+ if (ptr == nullptr) {
1154
+ return;
1155
+ }
1156
+
1157
+ auto isolate = args.GetIsolate();
1158
+
1159
+
1160
+ canvas_native_webgl2_end_transform_feedback(
1161
+ ptr->GetState());
1162
+ }
1163
+
1164
+ void WebGL2RenderingContext::FenceSync(const v8::FunctionCallbackInfo<v8::Value> &args) {
1165
+ WebGL2RenderingContext *ptr = GetPointer(args.This());
1166
+ if (ptr == nullptr) {
1167
+ args.GetReturnValue().SetUndefined();
1168
+ return;
1169
+ }
1170
+
1171
+ auto isolate = args.GetIsolate();
1172
+ auto context = isolate->GetCurrentContext();
1173
+
1174
+ auto condition = args[0]->Uint32Value(context).ToChecked();
1175
+ auto flags = args[1]->Uint32Value(context).ToChecked();
1176
+ auto sync = canvas_native_webgl2_fence_sync(
1177
+ condition,
1178
+ flags,
1179
+ ptr->GetState()
1180
+ );
1181
+ auto ret = WebGLSyncImpl::NewInstance(isolate, new WebGLSyncImpl(sync));
1182
+
1183
+ args.GetReturnValue().Set(ret);
1184
+ }
1185
+
1186
+ void
1187
+ WebGL2RenderingContext::FramebufferTextureLayer(const v8::FunctionCallbackInfo<v8::Value> &args) {
1188
+ WebGL2RenderingContext *ptr = GetPointer(args.This());
1189
+ if (ptr == nullptr) {
1190
+ args.GetReturnValue().SetUndefined();
1191
+ return;
1192
+ }
1193
+
1194
+ auto isolate = args.GetIsolate();
1195
+ auto context = isolate->GetCurrentContext();
1196
+
1197
+
1198
+ auto textureValue = args[2];
1199
+ auto type = GetNativeType(textureValue);
1200
+ if (type == NativeType::WebGLTexture) {
1201
+ auto target = args[0]->Uint32Value(context).ToChecked();
1202
+ auto attachment = args[1]->Uint32Value(context).ToChecked();
1203
+ auto texture = WebGLTexture::GetPointer(textureValue.As<v8::Object>());
1204
+ auto level = args[3]->Int32Value(context).ToChecked();
1205
+ auto layer = args[4]->Int32Value(context).ToChecked();
1206
+ if (texture != nullptr) {
1207
+ canvas_native_webgl2_framebuffer_texture_layer(
1208
+ target,
1209
+ attachment,
1210
+ texture->GetTexture(),
1211
+ level,
1212
+ layer,
1213
+ ptr->GetState()
1214
+ );
1215
+ }
1216
+
1217
+ }
1218
+ }
1219
+
1220
+ void
1221
+ WebGL2RenderingContext::GetActiveUniformBlockName(const v8::FunctionCallbackInfo<v8::Value> &args) {
1222
+ WebGL2RenderingContext *ptr = GetPointer(args.This());
1223
+ if (ptr == nullptr) {
1224
+ args.GetReturnValue().SetEmptyString();
1225
+ return;
1226
+ }
1227
+
1228
+ auto isolate = args.GetIsolate();
1229
+ auto context = isolate->GetCurrentContext();
1230
+
1231
+ auto programValue = args[0];
1232
+ auto type = GetNativeType(programValue);
1233
+ if (type == NativeType::WebGLProgram) {
1234
+ auto program = WebGLProgram::GetPointer(programValue.As<v8::Object>());
1235
+ if (program != nullptr) {
1236
+ auto uniformBlockIndex = args[1]->Uint32Value(context).ToChecked();
1237
+ auto name = canvas_native_webgl2_get_active_uniform_block_name(
1238
+ program->GetProgram(),
1239
+ uniformBlockIndex,
1240
+ ptr->GetState()
1241
+ );
1242
+ args.GetReturnValue().Set(ConvertToV8OneByteString(isolate, (char *) name));
1243
+ return;
1244
+ }
1245
+
1246
+ }
1247
+
1248
+ args.GetReturnValue().SetEmptyString();
1249
+ }
1250
+
1251
+ void WebGL2RenderingContext::GetActiveUniformBlockParameter(
1252
+ const v8::FunctionCallbackInfo<v8::Value> &args) {
1253
+ WebGL2RenderingContext *ptr = GetPointer(args.This());
1254
+ if (ptr == nullptr) {
1255
+ args.GetReturnValue().SetNull();
1256
+ return;
1257
+ }
1258
+
1259
+ auto isolate = args.GetIsolate();
1260
+ auto context = isolate->GetCurrentContext();
1261
+
1262
+ auto programValue = args[0];
1263
+ auto type = GetNativeType(programValue);
1264
+
1265
+ if (type == NativeType::WebGLProgram) {
1266
+ auto program = WebGLProgram::GetPointer(programValue.As<v8::Object>());
1267
+
1268
+ if (program != nullptr) {
1269
+ auto uniformBlockIndex = args[1]->Uint32Value(context).ToChecked();
1270
+ auto pname = args[2]->Uint32Value(context).ToChecked();
1271
+ auto ret = canvas_native_webgl2_get_active_uniform_block_parameter(
1272
+ program->GetProgram(),
1273
+ uniformBlockIndex,
1274
+ pname,
1275
+ ptr->GetState()
1276
+ );
1277
+
1278
+ switch (pname) {
1279
+ case GL_UNIFORM_BLOCK_BINDING:
1280
+ case GL_UNIFORM_BLOCK_DATA_SIZE:
1281
+ case GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS:
1282
+ args.GetReturnValue().Set(canvas_native_webgl_result_get_i32(
1283
+ ret));
1284
+ canvas_native_webgl_WebGLResult_destroy(ret);
1285
+ return;
1286
+ case GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES: {
1287
+ auto value = canvas_native_webgl_result_get_u32_array(
1288
+ ret);
1289
+
1290
+ auto buf = (uint8_t *) canvas_native_u32_buffer_get_bytes(value);
1291
+ auto size = canvas_native_u32_buffer_get_length(value);
1292
+ auto bytes_size = size * sizeof(uint32_t);
1293
+
1294
+ auto store = v8::ArrayBuffer::NewBackingStore(buf, bytes_size,
1295
+ [](void *data, size_t length,
1296
+ void *deleter_data) {
1297
+ if (deleter_data != nullptr) {
1298
+ canvas_native_u32_buffer_destroy(
1299
+ (U32Buffer *) deleter_data);
1300
+ }
1301
+ },
1302
+ value);
1303
+
1304
+ auto arraybuffer = v8::ArrayBuffer::New(isolate, std::move(store));
1305
+ args.GetReturnValue().Set(v8::Uint32Array::New(arraybuffer, 0, size));
1306
+
1307
+ canvas_native_webgl_WebGLResult_destroy(ret);
1308
+
1309
+ return;
1310
+ }
1311
+ case GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER:
1312
+ case GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER:
1313
+ args.GetReturnValue().Set(canvas_native_webgl_result_get_bool(
1314
+ ret));
1315
+
1316
+ canvas_native_webgl_WebGLResult_destroy(ret);
1317
+ return;
1318
+ default:
1319
+ args.GetReturnValue().SetNull();
1320
+ canvas_native_webgl_WebGLResult_destroy(ret);
1321
+ return;
1322
+ }
1323
+ }
1324
+ }
1325
+ }
1326
+
1327
+ void WebGL2RenderingContext::GetActiveUniforms(const v8::FunctionCallbackInfo<v8::Value> &args) {
1328
+ WebGL2RenderingContext *ptr = GetPointer(args.This());
1329
+ if (ptr == nullptr) {
1330
+ args.GetReturnValue().SetNull();
1331
+ return;
1332
+ }
1333
+
1334
+ auto isolate = args.GetIsolate();
1335
+ auto context = isolate->GetCurrentContext();
1336
+
1337
+ auto programValue = args[0];
1338
+ auto type = GetNativeType(programValue);
1339
+ if (type == NativeType::WebGLProgram) {
1340
+
1341
+ auto program = WebGLProgram::GetPointer(programValue.As<v8::Object>());
1342
+ auto uniformIndicesObject = args[1];
1343
+ auto pname = args[2]->Uint32Value(context).ToChecked();
1344
+
1345
+ if (uniformIndicesObject->IsArray()) {
1346
+ auto uniformIndices = uniformIndicesObject.As<v8::Array>();
1347
+ auto size = uniformIndices->Length();
1348
+ std::vector<uint32_t> buf;
1349
+ buf.reserve(size);
1350
+ for (int j = 0; j < size; j++) {
1351
+ auto item = uniformIndices->Get(
1352
+ context, j).ToLocalChecked()->Uint32Value(context).ToChecked();
1353
+ buf.emplace_back(item);
1354
+ }
1355
+
1356
+ auto ret = canvas_native_webgl2_get_active_uniforms(
1357
+ program->GetProgram(),
1358
+ buf.data(), buf.size(),
1359
+ pname,
1360
+ ptr->GetState()
1361
+ );
1362
+
1363
+ switch (pname) {
1364
+ case GL_UNIFORM_TYPE:
1365
+ case GL_UNIFORM_SIZE: {
1366
+ auto value = canvas_native_webgl_result_get_u32_array(
1367
+ ret);
1368
+ auto len = canvas_native_u32_buffer_get_length(value);
1369
+ auto buffer = canvas_native_u32_buffer_get_bytes(value);
1370
+
1371
+ auto array = v8::Array::New(
1372
+ isolate, (int) len);
1373
+
1374
+ for (int j = 0;
1375
+ j < len; ++j) {
1376
+ auto item = buffer[j];
1377
+ array->Set(
1378
+ context, j,
1379
+ v8::Integer::NewFromUnsigned(isolate, item));
1380
+ }
1381
+ args.GetReturnValue().Set(array);
1382
+ canvas_native_u32_buffer_destroy(value);
1383
+ canvas_native_webgl_WebGLResult_destroy(ret);
1384
+ return;
1385
+ }
1386
+ case GL_UNIFORM_BLOCK_INDEX:
1387
+ case GL_UNIFORM_OFFSET:
1388
+ case GL_UNIFORM_ARRAY_STRIDE:
1389
+ case GL_UNIFORM_MATRIX_STRIDE: {
1390
+ auto value = canvas_native_webgl_result_get_i32_array(
1391
+ ret);
1392
+ auto len = canvas_native_i32_buffer_get_length(value);
1393
+ auto buffer = canvas_native_i32_buffer_get_bytes(value);
1394
+ auto array = v8::Array::New(
1395
+ isolate, (int) len);
1396
+ for (int j = 0;
1397
+ j < len; ++j) {
1398
+ auto item = buffer[j];
1399
+ array->Set(
1400
+ context, j,
1401
+ v8::Integer::New(isolate, item));
1402
+ }
1403
+ args.GetReturnValue().Set(array);
1404
+ canvas_native_i32_buffer_destroy(value);
1405
+ canvas_native_webgl_WebGLResult_destroy(ret);
1406
+ return;
1407
+ }
1408
+ case GL_UNIFORM_IS_ROW_MAJOR: {
1409
+ auto value = canvas_native_webgl_result_get_bool_array(
1410
+ ret);
1411
+ auto len = canvas_native_u8_buffer_get_length(value);
1412
+ auto buffer = canvas_native_u8_buffer_get_bytes(value);
1413
+ auto array = v8::Array::New(
1414
+ isolate,
1415
+ (int) len);
1416
+ for (int j = 0;
1417
+ j < len; ++j) {
1418
+ bool item =
1419
+ buffer[j] == 1;
1420
+ array->Set(
1421
+ context, j,
1422
+ v8::Boolean::New(isolate, item));
1423
+ }
1424
+ args.GetReturnValue().Set(array);
1425
+ canvas_native_u8_buffer_destroy(value);
1426
+ canvas_native_webgl_WebGLResult_destroy(ret);
1427
+ return;
1428
+ }
1429
+ default:
1430
+ args.GetReturnValue().SetNull();
1431
+ canvas_native_webgl_WebGLResult_destroy(ret);
1432
+ return;
1433
+ }
1434
+ }
1435
+
1436
+
1437
+ }
1438
+ }
1439
+
1440
+ void WebGL2RenderingContext::GetBufferSubData(const v8::FunctionCallbackInfo<v8::Value> &args) {
1441
+ WebGL2RenderingContext *ptr = GetPointer(args.This());
1442
+ if (ptr == nullptr) {
1443
+ args.GetReturnValue().SetNull();
1444
+ return;
1445
+ }
1446
+
1447
+ auto isolate = args.GetIsolate();
1448
+ auto context = isolate->GetCurrentContext();
1449
+
1450
+ auto dstDataObject = args[2];
1451
+ if (dstDataObject->IsArrayBufferView()) {
1452
+ auto target = args[0]->Uint32Value(context).ToChecked();
1453
+ auto srcByteOffset = args[1]->NumberValue(context).ToChecked();
1454
+
1455
+ auto array = dstDataObject.As<v8::ArrayBufferView>();
1456
+
1457
+ auto buf = array->Buffer();
1458
+ auto offset = array->ByteOffset();
1459
+ auto size = buf->ByteLength();
1460
+ auto data = reinterpret_cast<uint8_t *>(buf->GetBackingStore()->Data()) + offset;
1461
+
1462
+
1463
+ auto BYTES_PER_ELEMENT = (ssize_t) array->Get(
1464
+ context,
1465
+ ConvertToV8String(isolate, "BYTES_PER_ELEMENT")).ToLocalChecked()->NumberValue(
1466
+ context).ToChecked();
1467
+
1468
+ ssize_t dstOffsetValue = 0;
1469
+ if (args[3]->IsNumber()) {
1470
+ dstOffsetValue =
1471
+ static_cast<ssize_t>(args[3]->NumberValue(context).ToChecked()) *
1472
+ BYTES_PER_ELEMENT;
1473
+ }
1474
+
1475
+ ssize_t lengthValue = 0;
1476
+ if (args[4]->IsNumber()) {
1477
+ lengthValue =
1478
+ static_cast<ssize_t>(args[4]->NumberValue(context).ToChecked()) *
1479
+ BYTES_PER_ELEMENT;
1480
+ }
1481
+
1482
+ canvas_native_webgl2_get_buffer_sub_data(
1483
+ target,
1484
+ static_cast<ssize_t>(srcByteOffset),
1485
+ data, size,
1486
+ dstOffsetValue,
1487
+ lengthValue,
1488
+ ptr->GetState()
1489
+ );
1490
+ }
1491
+ }
1492
+
1493
+ void WebGL2RenderingContext::GetFragDataLocation(const v8::FunctionCallbackInfo<v8::Value> &args) {
1494
+ WebGL2RenderingContext *ptr = GetPointer(args.This());
1495
+ if (ptr == nullptr) {
1496
+ args.GetReturnValue().SetNull();
1497
+ return;
1498
+ }
1499
+
1500
+ auto isolate = args.GetIsolate();
1501
+ auto context = isolate->GetCurrentContext();
1502
+
1503
+ auto programValue = args[0];
1504
+ auto nameValue = args[1];
1505
+ auto type = GetNativeType(programValue);
1506
+ if (type == NativeType::WebGLProgram && nameValue->IsString()) {
1507
+ auto program = WebGLProgram::GetPointer(programValue.As<v8::Object>());
1508
+
1509
+ if (program != nullptr) {
1510
+ auto name = ConvertFromV8String(isolate, nameValue);
1511
+
1512
+ auto ret = canvas_native_webgl2_get_frag_data_location(
1513
+ program->GetProgram(),
1514
+ name.c_str(),
1515
+ ptr->GetState()
1516
+ );
1517
+
1518
+ args.GetReturnValue().Set(ret);
1519
+
1520
+ return;
1521
+ }
1522
+ }
1523
+ args.GetReturnValue().SetNull();
1524
+ }
1525
+
1526
+ void WebGL2RenderingContext::GetIndexedParameter(const v8::FunctionCallbackInfo<v8::Value> &args) {
1527
+ WebGL2RenderingContext *ptr = GetPointer(args.This());
1528
+ if (ptr == nullptr) {
1529
+ args.GetReturnValue().SetNull();
1530
+ return;
1531
+ }
1532
+
1533
+ auto isolate = args.GetIsolate();
1534
+ auto context = isolate->GetCurrentContext();
1535
+
1536
+ auto target = args[0]->Uint32Value(context).ToChecked();
1537
+ auto index = args[1]->Uint32Value(context).ToChecked();
1538
+ auto ret = canvas_native_webgl2_get_indexed_parameter(
1539
+ target,
1540
+ index,
1541
+ ptr->GetState()
1542
+ );
1543
+
1544
+ switch (target) {
1545
+ case GL_UNIFORM_BUFFER_BINDING:
1546
+ case GL_TRANSFORM_FEEDBACK_BUFFER_BINDING: {
1547
+ auto buffer = canvas_native_webgl2_indexed_parameter_get_buffer_value(
1548
+ ret);
1549
+
1550
+ args.GetReturnValue().Set(
1551
+ WebGLBuffer::NewInstance(isolate, new WebGLBuffer(buffer)));
1552
+ }
1553
+ return;
1554
+ case GL_TRANSFORM_FEEDBACK_BUFFER_SIZE:
1555
+ case GL_TRANSFORM_FEEDBACK_BUFFER_START:
1556
+ case GL_UNIFORM_BUFFER_SIZE:
1557
+ case GL_UNIFORM_BUFFER_START: {
1558
+ auto value = canvas_native_webgl2_indexed_parameter_get_value(
1559
+ ret);
1560
+ args.GetReturnValue().Set(static_cast<double>(value));
1561
+ return;
1562
+ }
1563
+ break;
1564
+ default:
1565
+ args.GetReturnValue().SetNull();
1566
+ return;
1567
+ }
1568
+ }
1569
+
1570
+ void WebGL2RenderingContext::GetInternalformatParameter(
1571
+ const v8::FunctionCallbackInfo<v8::Value> &args) {
1572
+ WebGL2RenderingContext *ptr = GetPointer(args.This());
1573
+ if (ptr == nullptr) {
1574
+ args.GetReturnValue().SetNull();
1575
+ return;
1576
+ }
1577
+
1578
+ auto isolate = args.GetIsolate();
1579
+ auto context = isolate->GetCurrentContext();
1580
+
1581
+ auto target = args[0]->Uint32Value(context).ToChecked();
1582
+ auto internalformat = args[1]->Uint32Value(context).ToChecked();
1583
+ auto pname = args[2]->Uint32Value(context).ToChecked();
1584
+ switch (internalformat) {
1585
+ case GL_RGB:
1586
+ case GL_RGBA:
1587
+ case GL_R8UI:
1588
+ case GL_R8I:
1589
+ case GL_R16UI:
1590
+ case GL_R16I:
1591
+ case GL_R32UI:
1592
+ case GL_R32I:
1593
+ case GL_RG8UI:
1594
+ case GL_RG8I:
1595
+ case GL_RG16UI:
1596
+ case GL_RG16I:
1597
+ case GL_RG32UI:
1598
+ case GL_RG32I:
1599
+ case GL_RGBA8UI:
1600
+ case GL_RGBA8I:
1601
+ case GL_RGB10_A2UI:
1602
+ case GL_RGBA16UI:
1603
+ case GL_RGBA16I:
1604
+ case GL_RGBA32UI:
1605
+ case GL_RGBA32I: {
1606
+ // empty
1607
+ auto arraybuffer = v8::ArrayBuffer::New(isolate, 0);
1608
+
1609
+ args.GetReturnValue().Set(v8::Int32Array::New(arraybuffer, 0, 0));
1610
+ return;
1611
+ }
1612
+ case GL_R8:
1613
+ case GL_RG8:
1614
+ case GL_RGB565:
1615
+ case GL_RGBA8:
1616
+ case GL_SRGB8_ALPHA8:
1617
+ case GL_RGB5_A1:
1618
+ case GL_RGBA4:
1619
+ case GL_RGB10_A2:
1620
+ case GL_DEPTH_COMPONENT16:
1621
+ case GL_DEPTH_COMPONENT24:
1622
+ case GL_DEPTH_COMPONENT32F:
1623
+ case GL_DEPTH24_STENCIL8:
1624
+ case GL_DEPTH32F_STENCIL8:
1625
+ case GL_STENCIL_INDEX8:
1626
+ // noop
1627
+ break;
1628
+ case GL_R16F:
1629
+ case GL_RG16F:
1630
+ case GL_R32F:
1631
+ case GL_RG32F:
1632
+ case GL_RGBA32F:
1633
+ case GL_R11F_G11F_B10F:
1634
+ // noop
1635
+ break;
1636
+ default:
1637
+ args.GetReturnValue().SetNull();
1638
+ return;
1639
+ }
1640
+
1641
+
1642
+ auto ret = canvas_native_webgl2_get_internalformat_parameter(
1643
+ target,
1644
+ internalformat,
1645
+ pname,
1646
+ ptr->GetState()
1647
+ );
1648
+
1649
+ if (pname == GL_SAMPLES) {
1650
+ auto value = canvas_native_webgl_result_get_i32_array(ret);
1651
+
1652
+ auto buf = (uint8_t *) canvas_native_i32_buffer_get_bytes(value);
1653
+ auto size = canvas_native_i32_buffer_get_length(value);
1654
+ auto bytes_size = size * sizeof(int32_t);
1655
+
1656
+ auto store = v8::ArrayBuffer::NewBackingStore(buf, bytes_size,
1657
+ [](void *data, size_t length,
1658
+ void *deleter_data) {
1659
+ if (deleter_data != nullptr) {
1660
+ canvas_native_i32_buffer_destroy(
1661
+ (I32Buffer *) deleter_data);
1662
+ }
1663
+ },
1664
+ value);
1665
+
1666
+ auto arraybuffer = v8::ArrayBuffer::New(isolate, std::move(store));
1667
+ args.GetReturnValue().Set(v8::Int32Array::New(arraybuffer, 0, size));
1668
+ canvas_native_webgl_WebGLResult_destroy(ret);
1669
+ return;
1670
+ } else {
1671
+ args.GetReturnValue().SetNull();
1672
+ canvas_native_webgl_WebGLResult_destroy(ret);
1673
+ return;
1674
+ }
1675
+ }
1676
+
1677
+ void WebGL2RenderingContext::GetParameter(const v8::FunctionCallbackInfo<v8::Value> &args) {
1678
+ WebGL2RenderingContext *ptr = GetPointer(args.This());
1679
+ if (ptr == nullptr) {
1680
+ args.GetReturnValue().SetNull();
1681
+ return;
1682
+ }
1683
+
1684
+ auto isolate = args.GetIsolate();
1685
+ auto context = isolate->GetCurrentContext();
1686
+
1687
+ auto pname = args[0]->Uint32Value(context).ToChecked();
1688
+ auto result = canvas_native_webgl2_get_parameter(
1689
+ pname,
1690
+ ptr->GetState());
1691
+ switch (pname) {
1692
+ case GL_COPY_READ_BUFFER_BINDING:
1693
+ case GL_COPY_WRITE_BUFFER_BINDING:
1694
+ case GL_DRAW_FRAMEBUFFER_BINDING:
1695
+ args.GetReturnValue().Set(canvas_native_webgl_result_get_i32(
1696
+ result));
1697
+
1698
+ canvas_native_webgl_WebGLResult_destroy(result);
1699
+ return;
1700
+ default: {
1701
+ auto ret = ptr->GetParameterInternal(
1702
+ isolate, pname, result);
1703
+
1704
+ canvas_native_webgl_WebGLResult_destroy(result);
1705
+
1706
+ args.GetReturnValue().Set(ret);
1707
+ return;
1708
+ }
1709
+ }
1710
+ }
1711
+
1712
+ void WebGL2RenderingContext::GetQueryParameter(const v8::FunctionCallbackInfo<v8::Value> &args) {
1713
+ WebGL2RenderingContext *ptr = GetPointer(args.This());
1714
+ if (ptr == nullptr) {
1715
+ args.GetReturnValue().SetNull();
1716
+ return;
1717
+ }
1718
+
1719
+ auto isolate = args.GetIsolate();
1720
+ auto context = isolate->GetCurrentContext();
1721
+
1722
+ auto queryValue = args[0];
1723
+ auto type = GetNativeType(queryValue);
1724
+ if (type == NativeType::WebGLQuery) {
1725
+ auto query = WebGLQuery::GetPointer(queryValue.As<v8::Object>());
1726
+ if (query != nullptr) {
1727
+ auto pname = args[1]->Uint32Value(context).ToChecked();
1728
+
1729
+
1730
+ auto ret = canvas_native_webgl2_get_query_parameter(
1731
+ query->GetQuery(),
1732
+ pname,
1733
+ ptr->GetState());
1734
+ if (pname == GL_QUERY_RESULT) {
1735
+ args.GetReturnValue().Set(canvas_native_webgl_result_get_bool(
1736
+ ret));
1737
+ canvas_native_webgl_WebGLResult_destroy(ret);
1738
+ return;
1739
+ } else if (pname ==
1740
+ GL_QUERY_RESULT_AVAILABLE) {
1741
+ args.GetReturnValue().Set(canvas_native_webgl_result_get_u32(
1742
+ ret));
1743
+ canvas_native_webgl_WebGLResult_destroy(ret);
1744
+ return;
1745
+ }
1746
+ //clean up
1747
+ canvas_native_webgl_WebGLResult_destroy(ret);
1748
+
1749
+ }
1750
+ }
1751
+
1752
+ args.GetReturnValue().SetNull();
1753
+ }
1754
+
1755
+ void WebGL2RenderingContext::GetQuery(const v8::FunctionCallbackInfo<v8::Value> &args) {
1756
+ WebGL2RenderingContext *ptr = GetPointer(args.This());
1757
+ if (ptr == nullptr) {
1758
+ args.GetReturnValue().SetNull();
1759
+ return;
1760
+ }
1761
+
1762
+ auto isolate = args.GetIsolate();
1763
+ auto context = isolate->GetCurrentContext();
1764
+
1765
+ auto target = args[0]->Uint32Value(context).ToChecked();
1766
+ auto pname = args[1]->Uint32Value(context).ToChecked();
1767
+ auto ret = canvas_native_webgl2_get_query(
1768
+ target,
1769
+ pname,
1770
+ ptr->GetState());
1771
+ if (pname == GL_CURRENT_QUERY) {
1772
+ args.GetReturnValue().Set(canvas_native_webgl_result_get_i32(
1773
+ ret));
1774
+ canvas_native_webgl_WebGLResult_destroy(ret);
1775
+ return;
1776
+ }
1777
+ // clean up
1778
+ canvas_native_webgl_WebGLResult_destroy(ret);
1779
+ }
1780
+
1781
+ void WebGL2RenderingContext::GetSamplerParameter(const v8::FunctionCallbackInfo<v8::Value> &args) {
1782
+ WebGL2RenderingContext *ptr = GetPointer(args.This());
1783
+ if (ptr == nullptr) {
1784
+ args.GetReturnValue().SetNull();
1785
+ return;
1786
+ }
1787
+
1788
+ auto isolate = args.GetIsolate();
1789
+ auto context = isolate->GetCurrentContext();
1790
+
1791
+ auto samplerValue = args[0];
1792
+ auto type = GetNativeType(samplerValue);
1793
+ if (type == NativeType::WebGLSampler) {
1794
+ auto sampler = WebGLSampler::GetPointer(samplerValue.As<v8::Object>());
1795
+ if (sampler != nullptr) {
1796
+ auto pname = args[1]->Uint32Value(context).ToChecked();
1797
+ auto ret = canvas_native_webgl2_get_sampler_parameter(
1798
+ sampler->GetSampler(),
1799
+ pname,
1800
+ ptr->GetState());
1801
+
1802
+ switch (pname) {
1803
+ case GL_TEXTURE_MAX_LOD:
1804
+ case GL_TEXTURE_MIN_LOD:
1805
+ args.GetReturnValue().Set(
1806
+ static_cast<double>(canvas_native_webgl_result_get_f32(
1807
+ ret)));
1808
+ canvas_native_webgl_WebGLResult_destroy(ret);
1809
+ return;
1810
+ case GL_TEXTURE_COMPARE_FUNC:
1811
+ case GL_TEXTURE_COMPARE_MODE:
1812
+ case GL_TEXTURE_MAG_FILTER:
1813
+ case GL_TEXTURE_MIN_FILTER:
1814
+ case GL_TEXTURE_WRAP_R:
1815
+ case GL_TEXTURE_WRAP_S:
1816
+ case GL_TEXTURE_WRAP_T:
1817
+ args.GetReturnValue().Set(canvas_native_webgl_result_get_i32(
1818
+ ret));
1819
+ canvas_native_webgl_WebGLResult_destroy(ret);
1820
+ return;
1821
+ default:
1822
+ args.GetReturnValue().SetNull();
1823
+ canvas_native_webgl_WebGLResult_destroy(ret);
1824
+ return;
1825
+ }
1826
+ }
1827
+ }
1828
+
1829
+ args.GetReturnValue().SetNull();
1830
+ }
1831
+
1832
+ void WebGL2RenderingContext::GetSyncParameter(const v8::FunctionCallbackInfo<v8::Value> &args) {
1833
+ WebGL2RenderingContext *ptr = GetPointer(args.This());
1834
+ if (ptr == nullptr) {
1835
+ args.GetReturnValue().SetNull();
1836
+ return;
1837
+ }
1838
+
1839
+ auto isolate = args.GetIsolate();
1840
+ auto context = isolate->GetCurrentContext();
1841
+
1842
+ auto syncValue = args[0];
1843
+ auto sync = WebGLSyncImpl::GetPointer(syncValue.As<v8::Object>());
1844
+ if (sync != nullptr) {
1845
+ auto pname = args[1]->Uint32Value(context).ToChecked();
1846
+ auto ret = canvas_native_webgl2_get_sync_parameter(
1847
+ sync->GetSync(),
1848
+ pname,
1849
+ ptr->GetState());
1850
+
1851
+ switch (pname) {
1852
+ case GL_OBJECT_TYPE:
1853
+ case GL_SYNC_STATUS:
1854
+ case GL_SYNC_CONDITION:
1855
+ case GL_SYNC_FLAGS:
1856
+ args.GetReturnValue().Set(canvas_native_webgl_result_get_i32(
1857
+ ret));
1858
+
1859
+ canvas_native_webgl_WebGLResult_destroy(ret);
1860
+ return;
1861
+ default:
1862
+ args.GetReturnValue().SetNull();
1863
+ canvas_native_webgl_WebGLResult_destroy(ret);
1864
+ return;
1865
+ }
1866
+ }
1867
+ args.GetReturnValue().SetNull();
1868
+ }
1869
+
1870
+ void WebGL2RenderingContext::GetTransformFeedbackVarying(
1871
+ const v8::FunctionCallbackInfo<v8::Value> &args) {
1872
+ WebGL2RenderingContext *ptr = GetPointer(args.This());
1873
+ if (ptr == nullptr) {
1874
+ args.GetReturnValue().SetNull();
1875
+ return;
1876
+ }
1877
+
1878
+ auto isolate = args.GetIsolate();
1879
+ auto context = isolate->GetCurrentContext();
1880
+
1881
+ auto programValue = args[0];
1882
+ auto type = GetNativeType(programValue);
1883
+ if (type == NativeType::WebGLProgram) {
1884
+ auto program = WebGLProgram::GetPointer(programValue.As<v8::Object>());
1885
+ auto index = args[1]->Uint32Value(context).ToChecked();
1886
+ if (program != nullptr) {
1887
+ auto ret = canvas_native_webgl2_get_transform_feedback_varying(
1888
+ program->GetProgram(),
1889
+ index,
1890
+ ptr->GetState()
1891
+ );
1892
+
1893
+ if (canvas_native_webgl_active_info_get_is_empty(
1894
+ ret)) {
1895
+ canvas_native_webgl_active_info_destroy(ret);
1896
+ args.GetReturnValue().SetNull();
1897
+ return;
1898
+ }
1899
+
1900
+ auto info = WebGLActiveInfoImpl::NewInstance(isolate, new WebGLActiveInfoImpl(ret));
1901
+ args.GetReturnValue().Set(info);
1902
+ return;
1903
+ }
1904
+ }
1905
+
1906
+ args.GetReturnValue().SetNull();
1907
+ }
1908
+
1909
+ void WebGL2RenderingContext::GetUniformBlockIndex(const v8::FunctionCallbackInfo<v8::Value> &args) {
1910
+ WebGL2RenderingContext *ptr = GetPointer(args.This());
1911
+ if (ptr == nullptr) {
1912
+ args.GetReturnValue().SetNull();
1913
+ return;
1914
+ }
1915
+
1916
+ auto isolate = args.GetIsolate();
1917
+ auto context = isolate->GetCurrentContext();
1918
+
1919
+ auto programValue = args[0];
1920
+ auto type = GetNativeType(programValue);
1921
+ if (type == NativeType::WebGLProgram) {
1922
+ auto program = WebGLProgram::GetPointer(programValue.As<v8::Object>());
1923
+ auto index = ConvertFromV8String(isolate, args[1]);
1924
+ if (program != nullptr) {
1925
+ auto ret = canvas_native_webgl2_get_uniform_block_index(
1926
+ program->GetProgram(),
1927
+ index.c_str(),
1928
+ ptr->GetState());
1929
+ args.GetReturnValue().Set((int) ret);
1930
+ return;
1931
+ }
1932
+ }
1933
+
1934
+ args.GetReturnValue().SetNull();
1935
+ }
1936
+
1937
+ void WebGL2RenderingContext::GetUniformIndices(const v8::FunctionCallbackInfo<v8::Value> &args) {
1938
+ WebGL2RenderingContext *ptr = GetPointer(args.This());
1939
+ if (ptr == nullptr) {
1940
+ args.GetReturnValue().SetNull();
1941
+ return;
1942
+ }
1943
+
1944
+ auto isolate = args.GetIsolate();
1945
+ auto context = isolate->GetCurrentContext();
1946
+
1947
+ auto programValue = args[0];
1948
+ auto type = GetNativeType(programValue);
1949
+ if (type == NativeType::WebGLProgram) {
1950
+ auto program = WebGLProgram::GetPointer(programValue.As<v8::Object>());
1951
+ auto uniformNamesObject = args[1];
1952
+ if (program != nullptr &&
1953
+ uniformNamesObject->IsArray()) {
1954
+ auto uniformNames = uniformNamesObject.As<v8::Array>();
1955
+ auto len = uniformNames->Length();
1956
+
1957
+ std::vector<std::string> store;
1958
+ store.reserve(len);
1959
+
1960
+ for (int j = 0; j < len; ++j) {
1961
+ auto name = ConvertFromV8String(isolate, uniformNames->Get(
1962
+ context, j).ToLocalChecked());
1963
+
1964
+ store.push_back(name);
1965
+ }
1966
+
1967
+
1968
+ const char *cStrings[store.size()];
1969
+ for (size_t i = 0; i < store.size(); ++i) {
1970
+ cStrings[i] = store[i].c_str();
1971
+ }
1972
+
1973
+
1974
+ auto ret = canvas_native_webgl2_get_uniform_indices(
1975
+ program->GetProgram(),
1976
+ cStrings,
1977
+ store.size(),
1978
+ ptr->GetState());
1979
+
1980
+
1981
+ auto retSize = canvas_native_u32_buffer_get_length(ret);
1982
+ auto buf = canvas_native_u32_buffer_get_bytes(ret);
1983
+ auto result = v8::Array::New(isolate, (int) retSize);
1984
+ for (int j = 0; j < retSize; ++j) {
1985
+ auto item = buf[j];
1986
+ result->Set(context,
1987
+ j,
1988
+ v8::Integer::NewFromUnsigned(isolate, item));
1989
+ }
1990
+
1991
+ args.GetReturnValue().Set(result);
1992
+ canvas_native_u32_buffer_destroy(ret);
1993
+ return;
1994
+ }
1995
+ }
1996
+
1997
+ args.GetReturnValue().SetNull();
1998
+ }
1999
+
2000
+ void
2001
+ WebGL2RenderingContext::InvalidateFramebuffer(const v8::FunctionCallbackInfo<v8::Value> &args) {
2002
+ WebGL2RenderingContext *ptr = GetPointer(args.This());
2003
+ if (ptr == nullptr) {
2004
+ return;
2005
+ }
2006
+
2007
+ auto isolate = args.GetIsolate();
2008
+ auto context = isolate->GetCurrentContext();
2009
+
2010
+ auto attachments = args[1];
2011
+ auto target = args[0]->Uint32Value(context).ToChecked();
2012
+
2013
+ if (attachments->IsArray()) {
2014
+ auto array = attachments.As<v8::Array>();
2015
+ auto len = array->Length();
2016
+ std::vector<uint32_t> buf;
2017
+ buf.reserve(len);
2018
+ for (int j = 0; j < len; ++j) {
2019
+ auto item = array->Get(
2020
+ context, j).ToLocalChecked()->Uint32Value(context).ToChecked();
2021
+ buf.push_back(item);
2022
+ }
2023
+
2024
+ canvas_native_webgl2_invalidate_framebuffer(
2025
+ target, buf.data(), buf.size(),
2026
+ ptr->GetState());
2027
+ }
2028
+ }
2029
+
2030
+ void
2031
+ WebGL2RenderingContext::InvalidateSubFramebuffer(const v8::FunctionCallbackInfo<v8::Value> &args) {
2032
+ WebGL2RenderingContext *ptr = GetPointer(args.This());
2033
+ if (ptr == nullptr) {
2034
+ return;
2035
+ }
2036
+
2037
+ auto isolate = args.GetIsolate();
2038
+ auto context = isolate->GetCurrentContext();
2039
+
2040
+ auto attachments = args[1];
2041
+ if (attachments->IsArray()) {
2042
+ auto target = args[0]->Uint32Value(context).ToChecked();
2043
+ auto x = args[2]->Int32Value(context).ToChecked();
2044
+ auto y = args[3]->Int32Value(context).ToChecked();
2045
+ auto width = args[4]->Int32Value(context).ToChecked();
2046
+ auto height = args[5]->Int32Value(context).ToChecked();
2047
+
2048
+ auto array = attachments.As<v8::Array>();
2049
+ auto len = array->Length();
2050
+ std::vector<uint32_t> buf;
2051
+ buf.reserve(len);
2052
+ for (int j = 0; j < len; ++j) {
2053
+ auto item = array->Get(
2054
+ context, j).ToLocalChecked()->Uint32Value(context).ToChecked();
2055
+ buf.push_back(item);
2056
+ }
2057
+
2058
+ canvas_native_webgl2_invalidate_sub_framebuffer(
2059
+ target,
2060
+ buf.data(), buf.size(),
2061
+ x,
2062
+ y,
2063
+ width,
2064
+ height,
2065
+ ptr->GetState());
2066
+ }
2067
+ }
2068
+
2069
+ void WebGL2RenderingContext::IsQuery(const v8::FunctionCallbackInfo<v8::Value> &args) {
2070
+ WebGL2RenderingContext *ptr = GetPointer(args.This());
2071
+ if (ptr == nullptr) {
2072
+ return;
2073
+ }
2074
+
2075
+ auto isolate = args.GetIsolate();
2076
+ auto context = isolate->GetCurrentContext();
2077
+
2078
+ auto value = args[0];
2079
+ auto type = GetNativeType(value);
2080
+ if (type == NativeType::WebGLQuery) {
2081
+ auto query = WebGLQuery::GetPointer(value.As<v8::Object>());
2082
+ if (query != nullptr) {
2083
+ auto ret = canvas_native_webgl2_is_query(
2084
+ query->GetQuery(),
2085
+ ptr->GetState());
2086
+ args.GetReturnValue().Set(ret);
2087
+ return;
2088
+ }
2089
+ }
2090
+ // todo check return
2091
+ args.GetReturnValue().Set(false);
2092
+ }
2093
+
2094
+ void WebGL2RenderingContext::IsSampler(const v8::FunctionCallbackInfo<v8::Value> &args) {
2095
+ WebGL2RenderingContext *ptr = GetPointer(args.This());
2096
+ if (ptr == nullptr) {
2097
+ return;
2098
+ }
2099
+
2100
+ auto isolate = args.GetIsolate();
2101
+ auto context = isolate->GetCurrentContext();
2102
+
2103
+ auto value = args[0];
2104
+ auto type = GetNativeType(value);
2105
+ if (type == NativeType::WebGLSampler) {
2106
+ auto query = WebGLSampler::GetPointer(value.As<v8::Object>());
2107
+ if (query != nullptr) {
2108
+ auto ret = canvas_native_webgl2_is_sampler(
2109
+ query->GetSampler(),
2110
+ ptr->GetState());
2111
+ args.GetReturnValue().Set(ret);
2112
+ return;
2113
+ }
2114
+ }
2115
+ // todo check return
2116
+ args.GetReturnValue().Set(false);
2117
+ }
2118
+
2119
+ void WebGL2RenderingContext::IsSync(const v8::FunctionCallbackInfo<v8::Value> &args) {
2120
+ WebGL2RenderingContext *ptr = GetPointer(args.This());
2121
+ if (ptr == nullptr) {
2122
+ return;
2123
+ }
2124
+
2125
+ auto isolate = args.GetIsolate();
2126
+ auto context = isolate->GetCurrentContext();
2127
+
2128
+ auto value = args[0];
2129
+ auto type = GetNativeType(value);
2130
+ if (type == NativeType::WebGLSync) {
2131
+ auto query = WebGLSyncImpl::GetPointer(value.As<v8::Object>());
2132
+ if (query != nullptr) {
2133
+ auto ret = canvas_native_webgl2_is_sync(
2134
+ query->GetSync(),
2135
+ ptr->GetState());
2136
+ args.GetReturnValue().Set(ret);
2137
+ return;
2138
+ }
2139
+ }
2140
+ // todo check return
2141
+ args.GetReturnValue().Set(false);
2142
+ }
2143
+
2144
+ void WebGL2RenderingContext::IsTransformFeedback(const v8::FunctionCallbackInfo<v8::Value> &args) {
2145
+ WebGL2RenderingContext *ptr = GetPointer(args.This());
2146
+ if (ptr == nullptr) {
2147
+ return;
2148
+ }
2149
+
2150
+ auto isolate = args.GetIsolate();
2151
+ auto context = isolate->GetCurrentContext();
2152
+
2153
+ auto value = args[0];
2154
+ auto type = GetNativeType(value);
2155
+ if (type == NativeType::WebGLTransformFeedback) {
2156
+ auto query = WebGLTransformFeedback::GetPointer(value.As<v8::Object>());
2157
+ if (query != nullptr) {
2158
+ auto ret = canvas_native_webgl2_is_transform_feedback(
2159
+ query->GetFeedback(),
2160
+ ptr->GetState());
2161
+ args.GetReturnValue().Set(ret);
2162
+ return;
2163
+ }
2164
+ }
2165
+ // todo check return
2166
+ args.GetReturnValue().Set(false);
2167
+ }
2168
+
2169
+ void WebGL2RenderingContext::IsVertexArray(const v8::FunctionCallbackInfo<v8::Value> &args) {
2170
+ WebGL2RenderingContext *ptr = GetPointer(args.This());
2171
+ if (ptr == nullptr) {
2172
+ return;
2173
+ }
2174
+
2175
+ auto isolate = args.GetIsolate();
2176
+ auto context = isolate->GetCurrentContext();
2177
+
2178
+ auto value = args[0];
2179
+ auto type = GetNativeType(value);
2180
+ if (type == NativeType::WebGLVertexArrayObject) {
2181
+ auto query = WebGLVertexArrayObject::GetPointer(value.As<v8::Object>());
2182
+ if (query != nullptr) {
2183
+ auto ret = canvas_native_webgl2_is_vertex_array(
2184
+ query->GetVertexArrayObject(),
2185
+ ptr->GetState());
2186
+ args.GetReturnValue().Set(ret);
2187
+ return;
2188
+ }
2189
+ }
2190
+ // todo check return
2191
+ args.GetReturnValue().Set(false);
2192
+ }
2193
+
2194
+ void
2195
+ WebGL2RenderingContext::PauseTransformFeedback(const v8::FunctionCallbackInfo<v8::Value> &args) {
2196
+ WebGL2RenderingContext *ptr = GetPointer(args.This());
2197
+ if (ptr == nullptr) {
2198
+ return;
2199
+ }
2200
+ canvas_native_webgl2_pause_transform_feedback(
2201
+ ptr->GetState());
2202
+ }
2203
+
2204
+ void WebGL2RenderingContext::ReadBuffer(const v8::FunctionCallbackInfo<v8::Value> &args) {
2205
+ WebGL2RenderingContext *ptr = GetPointer(args.This());
2206
+ if (ptr == nullptr) {
2207
+ return;
2208
+ }
2209
+
2210
+ auto isolate = args.GetIsolate();
2211
+ auto context = isolate->GetCurrentContext();
2212
+
2213
+ auto src = args[0]->Uint32Value(context).ToChecked();
2214
+ canvas_native_webgl2_read_buffer(
2215
+ src,
2216
+ ptr->GetState()
2217
+ );
2218
+ }
2219
+
2220
+ void WebGL2RenderingContext::RenderbufferStorageMultisample(
2221
+ const v8::FunctionCallbackInfo<v8::Value> &args) {
2222
+ WebGL2RenderingContext *ptr = GetPointer(args.This());
2223
+ if (ptr == nullptr) {
2224
+ return;
2225
+ }
2226
+
2227
+ auto isolate = args.GetIsolate();
2228
+ auto context = isolate->GetCurrentContext();
2229
+
2230
+ auto target = args[0]->Uint32Value(context).ToChecked();
2231
+ auto samples = args[1]->Int32Value(context).ToChecked();
2232
+ auto internalFormat = args[2]->Uint32Value(context).ToChecked();
2233
+ auto width = args[3]->Int32Value(context).ToChecked();
2234
+ auto height = args[4]->Int32Value(context).ToChecked();
2235
+ canvas_native_webgl2_renderbuffer_storage_multisample(
2236
+ target,
2237
+ samples,
2238
+ internalFormat,
2239
+ width,
2240
+ height,
2241
+ ptr->GetState()
2242
+ );
2243
+ }
2244
+
2245
+ void
2246
+ WebGL2RenderingContext::ResumeTransformFeedback(const v8::FunctionCallbackInfo<v8::Value> &args) {
2247
+ WebGL2RenderingContext *ptr = GetPointer(args.This());
2248
+ if (ptr == nullptr) {
2249
+ return;
2250
+ }
2251
+
2252
+ canvas_native_webgl2_resume_transform_feedback(
2253
+ ptr->GetState());
2254
+ }
2255
+
2256
+ void WebGL2RenderingContext::SamplerParameterf(const v8::FunctionCallbackInfo<v8::Value> &args) {
2257
+ WebGL2RenderingContext *ptr = GetPointer(args.This());
2258
+ if (ptr == nullptr) {
2259
+ return;
2260
+ }
2261
+
2262
+ auto isolate = args.GetIsolate();
2263
+ auto context = isolate->GetCurrentContext();
2264
+
2265
+ auto samplerValue = args[0];
2266
+ auto type = GetNativeType(samplerValue);
2267
+ if (type == NativeType::WebGLSampler) {
2268
+ auto sampler = WebGLSampler::GetPointer(samplerValue.As<v8::Object>());
2269
+ auto pname = args[1]->Uint32Value(context).ToChecked();
2270
+ auto param = args[2]->NumberValue(context).ToChecked();
2271
+ if (sampler != nullptr) {
2272
+ canvas_native_webgl2_sampler_parameterf(
2273
+ sampler->GetSampler(),
2274
+ pname,
2275
+ static_cast<float>(param),
2276
+ ptr->GetState());
2277
+ }
2278
+ }
2279
+
2280
+ }
2281
+
2282
+ void WebGL2RenderingContext::SamplerParameteri(const v8::FunctionCallbackInfo<v8::Value> &args) {
2283
+ WebGL2RenderingContext *ptr = GetPointer(args.This());
2284
+ if (ptr == nullptr) {
2285
+ return;
2286
+ }
2287
+
2288
+ auto isolate = args.GetIsolate();
2289
+ auto context = isolate->GetCurrentContext();
2290
+
2291
+ auto samplerValue = args[0];
2292
+ auto type = GetNativeType(samplerValue);
2293
+ if (type == NativeType::WebGLSampler) {
2294
+ auto sampler = WebGLSampler::GetPointer(samplerValue.As<v8::Object>());
2295
+ auto pname = args[1]->Uint32Value(context).ToChecked();
2296
+ auto param = args[2]->Int32Value(context).ToChecked();
2297
+ if (sampler != nullptr) {
2298
+ canvas_native_webgl2_sampler_parameteri(
2299
+ sampler->GetSampler(),
2300
+ pname,
2301
+ param,
2302
+ ptr->GetState());
2303
+ }
2304
+ }
2305
+
2306
+ }
2307
+
2308
+ void WebGL2RenderingContext::TexImage3D(const v8::FunctionCallbackInfo<v8::Value> &args) {
2309
+ WebGL2RenderingContext *ptr = GetPointer(args.This());
2310
+ if (ptr == nullptr) {
2311
+ return;
2312
+ }
2313
+
2314
+ auto isolate = args.GetIsolate();
2315
+ auto context = isolate->GetCurrentContext();
2316
+
2317
+ auto count = args.Length();
2318
+
2319
+
2320
+ if (count == 10) {
2321
+ auto target = args[0]->Int32Value(
2322
+ context).ToChecked();
2323
+ auto level = args[1]->Int32Value(
2324
+ context).ToChecked();
2325
+ auto internalformat = args[2]->Int32Value(
2326
+ context).ToChecked();
2327
+ auto width = args[3]->Int32Value(
2328
+ context).ToChecked();
2329
+ auto height = args[4]->Int32Value(
2330
+ context).ToChecked();
2331
+ auto depth = args[5]->Int32Value(
2332
+ context).ToChecked();
2333
+ auto border = args[6]->Int32Value(
2334
+ context).ToChecked();
2335
+ auto format = args[7]->Int32Value(
2336
+ context).ToChecked();
2337
+ auto type = args[8]->Uint32Value(
2338
+ context).ToChecked();
2339
+
2340
+ auto imageOrPixelsOrOffset = args[9];
2341
+
2342
+ if (imageOrPixelsOrOffset->IsNumber()) {
2343
+ auto offset = imageOrPixelsOrOffset->NumberValue(
2344
+ context).ToChecked();
2345
+ canvas_native_webgl2_tex_image3d_none(
2346
+ target,
2347
+ level,
2348
+ internalformat,
2349
+ width,
2350
+ height,
2351
+ depth,
2352
+ border,
2353
+ format,
2354
+ type,
2355
+ static_cast<ssize_t>(offset),
2356
+ ptr->GetState()
2357
+ );
2358
+ return;
2359
+ }
2360
+
2361
+
2362
+ if (imageOrPixelsOrOffset->IsArrayBufferView()) {
2363
+ auto buf = imageOrPixelsOrOffset.As<v8::ArrayBufferView>();
2364
+
2365
+ auto array = buf->Buffer();
2366
+ auto offset = buf->ByteOffset();
2367
+ auto size = buf->ByteLength();
2368
+ auto data_ptr = static_cast<uint8_t *>(array->GetBackingStore()->Data()) + offset;
2369
+ auto data = static_cast<uint8_t *>((void *) data_ptr);
2370
+
2371
+
2372
+ canvas_native_webgl2_tex_image3d(
2373
+ target,
2374
+ level,
2375
+ internalformat,
2376
+ width,
2377
+ height,
2378
+ depth,
2379
+ border,
2380
+ format,
2381
+ type,
2382
+ data,
2383
+ size,
2384
+ ptr->GetState()
2385
+ );
2386
+ return;
2387
+ }
2388
+
2389
+ auto imageType = GetNativeType(imageOrPixelsOrOffset);
2390
+
2391
+ switch (imageType) {
2392
+ case NativeType::ImageAsset: {
2393
+ auto image_asset = ImageAssetImpl::GetPointer(
2394
+ imageOrPixelsOrOffset.As<v8::Object>());
2395
+ if (image_asset != nullptr) {
2396
+ canvas_native_webgl2_tex_image3d_asset(
2397
+ target,
2398
+ level,
2399
+ internalformat,
2400
+ width,
2401
+ height,
2402
+ depth,
2403
+ border,
2404
+ format,
2405
+ type,
2406
+ image_asset->GetImageAsset(),
2407
+ ptr->GetState()
2408
+ );
2409
+
2410
+ return;
2411
+ }
2412
+ return;
2413
+ }
2414
+ case NativeType::ImageBitmap: {
2415
+ auto image_bitmap = ImageBitmapImpl::GetPointer(
2416
+ imageOrPixelsOrOffset.As<v8::Object>());
2417
+ if (image_bitmap != nullptr) {
2418
+ canvas_native_webgl2_tex_image3d_asset(
2419
+ target,
2420
+ level,
2421
+ internalformat,
2422
+ width,
2423
+ height,
2424
+ depth,
2425
+ border,
2426
+ format,
2427
+ type,
2428
+ image_bitmap->GetImageAsset(),
2429
+ ptr->GetState()
2430
+ );
2431
+
2432
+ return;
2433
+ }
2434
+ return;
2435
+ }
2436
+ default:
2437
+ return;
2438
+ }
2439
+ } else if (args.Length() > 10) {
2440
+
2441
+ auto target = args[0]->Int32Value(
2442
+ context).ToChecked();
2443
+ auto level = args[1]->Int32Value(
2444
+ context).ToChecked();
2445
+ auto internalformat = args[2]->Int32Value(
2446
+ context).ToChecked();
2447
+ auto width = args[3]->Int32Value(
2448
+ context).ToChecked();
2449
+ auto height = args[4]->Int32Value(
2450
+ context).ToChecked();
2451
+ auto depth = args[5]->Int32Value(
2452
+ context).ToChecked();
2453
+ auto border = args[6]->Int32Value(
2454
+ context).ToChecked();
2455
+ auto format = args[7]->Int32Value(
2456
+ context).ToChecked();
2457
+ auto type = args[8]->Uint32Value(
2458
+ context).ToChecked();
2459
+
2460
+ auto imageOrPixelsOrOffset = args[9];
2461
+
2462
+ size_t srcOffsetValue = 0;
2463
+ if (args[9]->IsNumber()) {
2464
+ srcOffsetValue = static_cast<size_t>(args[9]->NumberValue(
2465
+ context).ToChecked());
2466
+ }
2467
+
2468
+ if (imageOrPixelsOrOffset->IsArrayBufferView()) {
2469
+ auto buf = imageOrPixelsOrOffset.As<v8::ArrayBufferView>();
2470
+
2471
+ auto array = buf->Buffer();
2472
+ auto offset = buf->ByteOffset();
2473
+ auto size = buf->ByteLength();
2474
+ auto data_ptr = static_cast<uint8_t *>(array->GetBackingStore()->Data()) + offset;
2475
+ auto data = static_cast<uint8_t *>((void *) data_ptr);
2476
+
2477
+ srcOffsetValue =
2478
+ srcOffsetValue * size;
2479
+ if (srcOffsetValue >
2480
+ size) {
2481
+ return;
2482
+ }
2483
+
2484
+ canvas_native_webgl2_tex_image3d_offset(
2485
+ target,
2486
+ level,
2487
+ internalformat,
2488
+ width,
2489
+ height,
2490
+ depth,
2491
+ border,
2492
+ format,
2493
+ type,
2494
+ data, size,
2495
+ srcOffsetValue,
2496
+ ptr->GetState()
2497
+ );
2498
+ return;
2499
+ }
2500
+
2501
+ }
2502
+ }
2503
+
2504
+ void WebGL2RenderingContext::TexStorage2D(const v8::FunctionCallbackInfo<v8::Value> &args) {
2505
+ WebGL2RenderingContext *ptr = GetPointer(args.This());
2506
+ if (ptr == nullptr) {
2507
+ return;
2508
+ }
2509
+
2510
+ auto isolate = args.GetIsolate();
2511
+ auto context = isolate->GetCurrentContext();
2512
+
2513
+ auto target = args[0]->Uint32Value(
2514
+ context).ToChecked();
2515
+ auto levels = args[1]->Int32Value(
2516
+ context).ToChecked();
2517
+ auto internalFormat = args[2]->Uint32Value(
2518
+ context).ToChecked();
2519
+ auto width = args[3]->Int32Value(
2520
+ context).ToChecked();
2521
+ auto height = args[4]->Int32Value(
2522
+ context).ToChecked();
2523
+ canvas_native_webgl2_tex_storage2d(
2524
+ target,
2525
+ levels,
2526
+ internalFormat,
2527
+ width,
2528
+ height,
2529
+ ptr->GetState()
2530
+ );
2531
+ }
2532
+
2533
+ void WebGL2RenderingContext::TexStorage3D(const v8::FunctionCallbackInfo<v8::Value> &args) {
2534
+ WebGL2RenderingContext *ptr = GetPointer(args.This());
2535
+ if (ptr == nullptr) {
2536
+ return;
2537
+ }
2538
+
2539
+ auto isolate = args.GetIsolate();
2540
+ auto context = isolate->GetCurrentContext();
2541
+
2542
+ auto target = args[0]->Uint32Value(
2543
+ context).ToChecked();
2544
+ auto levels = args[1]->Int32Value(
2545
+ context).ToChecked();
2546
+ auto internalFormat = args[2]->Uint32Value(
2547
+ context).ToChecked();
2548
+ auto width = args[3]->Int32Value(
2549
+ context).ToChecked();
2550
+ auto height = args[4]->Int32Value(
2551
+ context).ToChecked();
2552
+ auto depth = args[5]->Int32Value(
2553
+ context).ToChecked();
2554
+ canvas_native_webgl2_tex_storage3d(
2555
+ target,
2556
+ levels,
2557
+ internalFormat,
2558
+ width,
2559
+ height,
2560
+ depth,
2561
+ ptr->GetState()
2562
+ );
2563
+ }
2564
+
2565
+ void WebGL2RenderingContext::TexSubImage3D(const v8::FunctionCallbackInfo<v8::Value> &args) {
2566
+ WebGL2RenderingContext *ptr = GetPointer(args.This());
2567
+ if (ptr == nullptr) {
2568
+ return;
2569
+ }
2570
+
2571
+ auto isolate = args.GetIsolate();
2572
+ auto context = isolate->GetCurrentContext();
2573
+
2574
+ auto count = args.Length();
2575
+ if (count == 11) {
2576
+ auto target = args[0]->Uint32Value(
2577
+ context).ToChecked();
2578
+ auto level = args[1]->Int32Value(
2579
+ context).ToChecked();
2580
+ auto xoffset = args[2]->Int32Value(
2581
+ context).ToChecked();
2582
+ auto yoffset = args[3]->Int32Value(
2583
+ context).ToChecked();
2584
+ auto zoffset = args[4]->Int32Value(
2585
+ context).ToChecked();
2586
+ auto width = args[5]->Int32Value(
2587
+ context).ToChecked();
2588
+ auto height = args[6]->Int32Value(
2589
+ context).ToChecked();
2590
+ auto depth = args[7]->Int32Value(
2591
+ context).ToChecked();
2592
+ auto format = args[8]->Uint32Value(
2593
+ context).ToChecked();
2594
+ auto type = args[9]->Uint32Value(
2595
+ context).ToChecked();
2596
+
2597
+ if (args[10]->IsNumber()) {
2598
+ auto imageOrPixelsOrOffset = args[10]->NumberValue(
2599
+ context).ToChecked();
2600
+ canvas_native_webgl2_tex_sub_image3d_none(
2601
+ target,
2602
+ level,
2603
+ xoffset,
2604
+ yoffset,
2605
+ zoffset,
2606
+ width,
2607
+ height,
2608
+ depth,
2609
+ format,
2610
+ type,
2611
+ static_cast<ssize_t>(imageOrPixelsOrOffset),
2612
+ ptr->GetState()
2613
+ );
2614
+ return;
2615
+ }
2616
+
2617
+ auto imageOrPixelsOrOffsetObject = args[10];
2618
+
2619
+ if (imageOrPixelsOrOffsetObject->IsArrayBufferView()) {
2620
+ auto buf = imageOrPixelsOrOffsetObject.As<v8::ArrayBufferView>();
2621
+
2622
+ auto array = buf->Buffer();
2623
+ auto offset = buf->ByteOffset();
2624
+ auto size = buf->ByteLength();
2625
+ auto data_ptr = static_cast<uint8_t *>(array->GetBackingStore()->Data()) + offset;
2626
+ auto data = static_cast<uint8_t *>((void *) data_ptr);
2627
+
2628
+
2629
+ canvas_native_webgl2_tex_sub_image3d(
2630
+ target,
2631
+ level,
2632
+ xoffset,
2633
+ yoffset,
2634
+ zoffset,
2635
+ width,
2636
+ height,
2637
+ depth,
2638
+ format,
2639
+ type,
2640
+ data, size,
2641
+ ptr->GetState()
2642
+ );
2643
+
2644
+ return;
2645
+ }
2646
+
2647
+
2648
+ auto imageType = GetNativeType(imageOrPixelsOrOffsetObject);
2649
+
2650
+ if (imageType == NativeType::ImageAsset) {
2651
+ auto asset = ImageAssetImpl::GetPointer(imageOrPixelsOrOffsetObject.As<v8::Object>());
2652
+ if (asset != nullptr) {
2653
+
2654
+ canvas_native_webgl2_tex_sub_image3d_asset(
2655
+ target,
2656
+ level,
2657
+ xoffset,
2658
+ yoffset,
2659
+ zoffset,
2660
+ width,
2661
+ height,
2662
+ depth,
2663
+ format,
2664
+ type,
2665
+ asset->GetImageAsset(),
2666
+ ptr->GetState()
2667
+ );
2668
+ }
2669
+ }
2670
+
2671
+ } else if (count > 11) {
2672
+ auto target = args[0]->Uint32Value(
2673
+ context).ToChecked();
2674
+ auto level = args[1]->Int32Value(
2675
+ context).ToChecked();
2676
+ auto xoffset = args[2]->Int32Value(
2677
+ context).ToChecked();
2678
+ auto yoffset = args[3]->Int32Value(
2679
+ context).ToChecked();
2680
+ auto zoffset = args[4]->Int32Value(
2681
+ context).ToChecked();
2682
+ auto width = args[5]->Int32Value(
2683
+ context).ToChecked();
2684
+ auto height = args[6]->Int32Value(
2685
+ context).ToChecked();
2686
+ auto depth = args[7]->Int32Value(
2687
+ context).ToChecked();
2688
+ auto format = args[8]->Uint32Value(
2689
+ context).ToChecked();
2690
+ auto type = args[9]->Uint32Value(
2691
+ context).ToChecked();
2692
+
2693
+ size_t srcOffsetValue = 0;
2694
+
2695
+ if (args[11]->IsNumber()) {
2696
+ srcOffsetValue = static_cast<size_t>(args[11]->NumberValue(
2697
+ context).ToChecked());
2698
+ }
2699
+
2700
+ auto imageOrPixelsOrOffsetObject = args[10];
2701
+
2702
+
2703
+ if (imageOrPixelsOrOffsetObject->IsArrayBufferView()) {
2704
+ auto buf = imageOrPixelsOrOffsetObject.As<v8::ArrayBufferView>();
2705
+
2706
+ auto array = buf->Buffer();
2707
+ auto offset = buf->ByteOffset();
2708
+ auto size = buf->ByteLength();
2709
+ auto data_ptr = static_cast<uint8_t *>(array->GetBackingStore()->Data()) + offset;
2710
+ auto data = static_cast<uint8_t *>((void *) data_ptr);
2711
+
2712
+
2713
+ srcOffsetValue =
2714
+ srcOffsetValue * size;
2715
+ if (srcOffsetValue > size) {
2716
+ return;
2717
+ }
2718
+
2719
+
2720
+ canvas_native_webgl2_tex_sub_image3d_offset(
2721
+ target,
2722
+ level,
2723
+ xoffset,
2724
+ yoffset,
2725
+ zoffset,
2726
+ width,
2727
+ height,
2728
+ depth,
2729
+ format,
2730
+ type,
2731
+ data, size,
2732
+ srcOffsetValue,
2733
+ ptr->GetState()
2734
+ );
2735
+ }
2736
+ }
2737
+ }
2738
+
2739
+ void
2740
+ WebGL2RenderingContext::TransformFeedbackVaryings(const v8::FunctionCallbackInfo<v8::Value> &args) {
2741
+ WebGL2RenderingContext *ptr = GetPointer(args.This());
2742
+ if (ptr == nullptr) {
2743
+ return;
2744
+ }
2745
+
2746
+ auto isolate = args.GetIsolate();
2747
+ auto context = isolate->GetCurrentContext();
2748
+
2749
+ auto programValue = args[0];
2750
+ auto type = GetNativeType(programValue);
2751
+ if (type == NativeType::WebGLProgram) {
2752
+ auto program = WebGLProgram::GetPointer(programValue.As<v8::Object>());
2753
+ auto varyingsObject = args[1];
2754
+ auto bufferMode = args[2]->Uint32Value(
2755
+ context).ToChecked();
2756
+
2757
+ if (program != nullptr &&
2758
+ varyingsObject->IsArray()) {
2759
+ auto varyings = varyingsObject.As<v8::Array>();
2760
+ auto len = varyings->Length();
2761
+
2762
+
2763
+ std::vector<std::string> store;
2764
+ store.reserve(len);
2765
+
2766
+ for (int j = 0; j < len; ++j) {
2767
+ auto name = ConvertFromV8String(isolate, varyings->Get(
2768
+ context, j).ToLocalChecked());
2769
+
2770
+ store.push_back(name);
2771
+ }
2772
+
2773
+
2774
+ const char *cStrings[store.size()];
2775
+ for (size_t i = 0; i < store.size(); ++i) {
2776
+ cStrings[i] = store[i].c_str();
2777
+ }
2778
+
2779
+ canvas_native_webgl2_transform_feedback_varyings(
2780
+ program->GetProgram(),
2781
+ cStrings, store.size(),
2782
+ bufferMode,
2783
+ ptr->GetState()
2784
+ );
2785
+ }
2786
+ }
2787
+
2788
+ }
2789
+
2790
+ void WebGL2RenderingContext::Uniform1ui(const v8::FunctionCallbackInfo<v8::Value> &args) {
2791
+ WebGL2RenderingContext *ptr = GetPointer(args.This());
2792
+ if (ptr == nullptr) {
2793
+ return;
2794
+ }
2795
+
2796
+ auto isolate = args.GetIsolate();
2797
+ auto context = isolate->GetCurrentContext();
2798
+
2799
+ auto locationValue = args[0];
2800
+ auto type = GetNativeType(locationValue);
2801
+
2802
+ auto v0Value = args[1];
2803
+ if (type == NativeType::WebGLUniformLocation) {
2804
+
2805
+ auto location = WebGLUniformLocation::GetPointer(locationValue.As<v8::Object>());
2806
+ auto v0 = v0Value->Uint32Value(
2807
+ context).ToChecked();
2808
+
2809
+ if (location != nullptr) {
2810
+ canvas_native_webgl2_uniform1ui(
2811
+ location->GetUniformLocation(),
2812
+ v0,
2813
+ ptr->GetState()
2814
+ );
2815
+ }
2816
+ }
2817
+
2818
+ }
2819
+
2820
+ void WebGL2RenderingContext::Uniform2ui(const v8::FunctionCallbackInfo<v8::Value> &args) {
2821
+ WebGL2RenderingContext *ptr = GetPointer(args.This());
2822
+ if (ptr == nullptr) {
2823
+ return;
2824
+ }
2825
+
2826
+ auto isolate = args.GetIsolate();
2827
+ auto context = isolate->GetCurrentContext();
2828
+
2829
+ auto locationValue = args[0];
2830
+ auto type = GetNativeType(locationValue);
2831
+
2832
+ if (type == NativeType::WebGLUniformLocation) {
2833
+
2834
+ auto location = WebGLUniformLocation::GetPointer(locationValue.As<v8::Object>());
2835
+ auto v0 = args[1]->Uint32Value(
2836
+ context).ToChecked();
2837
+ auto v1 = args[2]->Uint32Value(
2838
+ context).ToChecked();
2839
+
2840
+ if (location != nullptr) {
2841
+ canvas_native_webgl2_uniform2ui(
2842
+ location->GetUniformLocation(),
2843
+ v0,
2844
+ v1,
2845
+ ptr->GetState()
2846
+ );
2847
+ }
2848
+ }
2849
+
2850
+ }
2851
+
2852
+ void WebGL2RenderingContext::Uniform3ui(const v8::FunctionCallbackInfo<v8::Value> &args) {
2853
+ WebGL2RenderingContext *ptr = GetPointer(args.This());
2854
+ if (ptr == nullptr) {
2855
+ return;
2856
+ }
2857
+
2858
+ auto isolate = args.GetIsolate();
2859
+ auto context = isolate->GetCurrentContext();
2860
+
2861
+ auto locationValue = args[0];
2862
+ auto type = GetNativeType(locationValue);
2863
+
2864
+ if (type == NativeType::WebGLUniformLocation) {
2865
+
2866
+ auto location = WebGLUniformLocation::GetPointer(locationValue.As<v8::Object>());
2867
+ auto v0 = args[1]->Uint32Value(
2868
+ context).ToChecked();
2869
+
2870
+ auto v1 = args[2]->Uint32Value(
2871
+ context).ToChecked();
2872
+
2873
+ auto v2 = args[3]->Uint32Value(
2874
+ context).ToChecked();
2875
+
2876
+ if (location != nullptr) {
2877
+ canvas_native_webgl2_uniform3ui(
2878
+ location->GetUniformLocation(),
2879
+ v0,
2880
+ v1,
2881
+ v2,
2882
+ ptr->GetState()
2883
+ );
2884
+ }
2885
+ }
2886
+
2887
+ }
2888
+
2889
+ void WebGL2RenderingContext::Uniform4ui(const v8::FunctionCallbackInfo<v8::Value> &args) {
2890
+ WebGL2RenderingContext *ptr = GetPointer(args.This());
2891
+ if (ptr == nullptr) {
2892
+ return;
2893
+ }
2894
+
2895
+ auto isolate = args.GetIsolate();
2896
+ auto context = isolate->GetCurrentContext();
2897
+
2898
+ auto locationValue = args[0];
2899
+ auto type = GetNativeType(locationValue);
2900
+
2901
+ if (type == NativeType::WebGLUniformLocation) {
2902
+
2903
+ auto location = WebGLUniformLocation::GetPointer(locationValue.As<v8::Object>());
2904
+ auto v0 = args[1]->Uint32Value(
2905
+ context).ToChecked();
2906
+
2907
+ auto v1 = args[2]->Uint32Value(
2908
+ context).ToChecked();
2909
+
2910
+ auto v2 = args[3]->Uint32Value(
2911
+ context).ToChecked();
2912
+ auto v3 = args[4]->Uint32Value(
2913
+ context).ToChecked();
2914
+
2915
+
2916
+ if (location != nullptr) {
2917
+ canvas_native_webgl2_uniform4ui(
2918
+ location->GetUniformLocation(),
2919
+ v0,
2920
+ v1,
2921
+ v2,
2922
+ v3,
2923
+ ptr->GetState()
2924
+ );
2925
+ }
2926
+ }
2927
+
2928
+ }
2929
+
2930
+ void WebGL2RenderingContext::Uniform1uiv(const v8::FunctionCallbackInfo<v8::Value> &args) {
2931
+ WebGL2RenderingContext *ptr = GetPointer(args.This());
2932
+ if (ptr == nullptr) {
2933
+ return;
2934
+ }
2935
+
2936
+ auto isolate = args.GetIsolate();
2937
+ auto context = isolate->GetCurrentContext();
2938
+
2939
+
2940
+ auto locationValue = args[0];
2941
+ auto type = GetNativeType(locationValue);
2942
+
2943
+
2944
+ if (type == NativeType::WebGLUniformLocation) {
2945
+ auto location = WebGLUniformLocation::GetPointer(locationValue.As<v8::Object>());
2946
+ auto dataValue = args[1];
2947
+ if (location != nullptr &&
2948
+ dataValue->IsUint32Array()) {
2949
+ auto buf = dataValue.As<v8::Uint32Array>();
2950
+ auto array = buf->Buffer();
2951
+ auto offset = buf->ByteOffset();
2952
+ auto size = buf->Length();
2953
+ auto data_ptr = static_cast<uint8_t *>(array->GetBackingStore()->Data()) + offset;
2954
+ auto data = static_cast<uint32_t *>((void *) data_ptr);
2955
+
2956
+
2957
+ canvas_native_webgl2_uniform1uiv(
2958
+ location->GetUniformLocation(),
2959
+ data, size,
2960
+ ptr->GetState()
2961
+ );
2962
+ } else {
2963
+ std::vector<uint32_t> buf;
2964
+ auto array = dataValue.As<v8::Array>();
2965
+ auto len = array->Length();
2966
+ buf.reserve(len);
2967
+ for (int i = 0; i < len; i++) {
2968
+ auto item = array->Get(
2969
+ context,
2970
+ i).ToLocalChecked()->Uint32Value(
2971
+ context).ToChecked();
2972
+ buf.push_back(item);
2973
+ }
2974
+
2975
+ canvas_native_webgl2_uniform1uiv(
2976
+ location->GetUniformLocation(),
2977
+ buf.data(), buf.size(),
2978
+ ptr->GetState()
2979
+ );
2980
+ }
2981
+
2982
+
2983
+ }
2984
+
2985
+ }
2986
+
2987
+ void WebGL2RenderingContext::Uniform2uiv(const v8::FunctionCallbackInfo<v8::Value> &args) {
2988
+ WebGL2RenderingContext *ptr = GetPointer(args.This());
2989
+ if (ptr == nullptr) {
2990
+ return;
2991
+ }
2992
+
2993
+ auto isolate = args.GetIsolate();
2994
+ auto context = isolate->GetCurrentContext();
2995
+
2996
+
2997
+ auto locationValue = args[0];
2998
+ auto type = GetNativeType(locationValue);
2999
+
3000
+
3001
+ if (type == NativeType::WebGLUniformLocation) {
3002
+ auto location = WebGLUniformLocation::GetPointer(locationValue.As<v8::Object>());
3003
+ auto dataValue = args[1];
3004
+ if (location != nullptr &&
3005
+ dataValue->IsUint32Array()) {
3006
+ auto buf = dataValue.As<v8::Uint32Array>();
3007
+ auto array = buf->Buffer();
3008
+ auto offset = buf->ByteOffset();
3009
+ auto size = buf->Length();
3010
+ auto data_ptr = static_cast<uint8_t *>(array->GetBackingStore()->Data()) + offset;
3011
+ auto data = static_cast<uint32_t *>((void *) data_ptr);
3012
+
3013
+
3014
+ canvas_native_webgl2_uniform2uiv(
3015
+ location->GetUniformLocation(),
3016
+ data, size,
3017
+ ptr->GetState()
3018
+ );
3019
+ } else {
3020
+ std::vector<uint32_t> buf;
3021
+ auto array = dataValue.As<v8::Array>();
3022
+ auto len = array->Length();
3023
+ buf.reserve(len);
3024
+ for (int i = 0; i < len; i++) {
3025
+ auto item = array->Get(
3026
+ context,
3027
+ i).ToLocalChecked()->Uint32Value(
3028
+ context).ToChecked();
3029
+ buf.push_back(item);
3030
+ }
3031
+ canvas_native_webgl2_uniform2uiv(
3032
+ location->GetUniformLocation(),
3033
+ buf.data(), buf.size(),
3034
+ ptr->GetState()
3035
+ );
3036
+ }
3037
+
3038
+
3039
+ }
3040
+
3041
+ }
3042
+
3043
+ void WebGL2RenderingContext::Uniform3uiv(const v8::FunctionCallbackInfo<v8::Value> &args) {
3044
+ WebGL2RenderingContext *ptr = GetPointer(args.This());
3045
+ if (ptr == nullptr) {
3046
+ return;
3047
+ }
3048
+
3049
+ auto isolate = args.GetIsolate();
3050
+ auto context = isolate->GetCurrentContext();
3051
+
3052
+
3053
+ auto locationValue = args[0];
3054
+ auto type = GetNativeType(locationValue);
3055
+
3056
+
3057
+ if (type == NativeType::WebGLUniformLocation) {
3058
+ auto location = WebGLUniformLocation::GetPointer(locationValue.As<v8::Object>());
3059
+ auto dataValue = args[1];
3060
+ if (location != nullptr &&
3061
+ dataValue->IsUint32Array()) {
3062
+ auto buf = dataValue.As<v8::Uint32Array>();
3063
+
3064
+ auto array = buf->Buffer();
3065
+ auto offset = buf->ByteOffset();
3066
+ auto size = buf->Length();
3067
+ auto data_ptr = static_cast<uint8_t *>(array->GetBackingStore()->Data()) + offset;
3068
+ auto data = static_cast<uint32_t *>((void *) data_ptr);
3069
+
3070
+
3071
+ canvas_native_webgl2_uniform3uiv(
3072
+ location->GetUniformLocation(),
3073
+ data, size,
3074
+ ptr->GetState()
3075
+ );
3076
+ } else {
3077
+ std::vector<uint32_t> buf;
3078
+ auto array = dataValue.As<v8::Array>();
3079
+ auto len = array->Length();
3080
+ buf.reserve(len);
3081
+ for (int i = 0; i < len; i++) {
3082
+ auto item = array->Get(
3083
+ context,
3084
+ i).ToLocalChecked()->Uint32Value(
3085
+ context).ToChecked();
3086
+ buf.push_back(item);
3087
+ }
3088
+ canvas_native_webgl2_uniform3uiv(
3089
+ location->GetUniformLocation(),
3090
+ buf.data(), buf.size(),
3091
+ ptr->GetState()
3092
+ );
3093
+ }
3094
+
3095
+
3096
+ }
3097
+
3098
+ }
3099
+
3100
+ void WebGL2RenderingContext::Uniform4uiv(const v8::FunctionCallbackInfo<v8::Value> &args) {
3101
+ WebGL2RenderingContext *ptr = GetPointer(args.This());
3102
+ if (ptr == nullptr) {
3103
+ return;
3104
+ }
3105
+
3106
+ auto isolate = args.GetIsolate();
3107
+ auto context = isolate->GetCurrentContext();
3108
+
3109
+
3110
+ auto locationValue = args[0];
3111
+ auto type = GetNativeType(locationValue);
3112
+
3113
+
3114
+ if (type == NativeType::WebGLUniformLocation) {
3115
+ auto location = WebGLUniformLocation::GetPointer(locationValue.As<v8::Object>());
3116
+ auto dataValue = args[1];
3117
+ if (location != nullptr) {
3118
+ if (dataValue->IsUint32Array()) {
3119
+ auto buf = dataValue.As<v8::Uint32Array>();
3120
+
3121
+ auto array = buf->Buffer();
3122
+ auto offset = buf->ByteOffset();
3123
+ auto size = buf->Length();
3124
+ auto data_ptr = static_cast<uint8_t *>(array->GetBackingStore()->Data()) + offset;
3125
+ auto data = static_cast<uint32_t *>((void *) data_ptr);
3126
+
3127
+
3128
+ canvas_native_webgl2_uniform4uiv(
3129
+ location->GetUniformLocation(),
3130
+ data, size,
3131
+ ptr->GetState()
3132
+ );
3133
+ } else {
3134
+ std::vector<uint32_t> buf;
3135
+ auto array = dataValue.As<v8::Array>();
3136
+ auto len = array->Length();
3137
+ buf.reserve(len);
3138
+ for (int i = 0; i < len; i++) {
3139
+ auto item = array->Get(
3140
+ context,
3141
+ i).ToLocalChecked()->Uint32Value(
3142
+ context).ToChecked();
3143
+ buf.push_back(item);
3144
+ }
3145
+
3146
+ canvas_native_webgl2_uniform4uiv(
3147
+ location->GetUniformLocation(),
3148
+ buf.data(), buf.size(),
3149
+ ptr->GetState()
3150
+ );
3151
+ }
3152
+ }
3153
+ }
3154
+
3155
+ }
3156
+
3157
+ void WebGL2RenderingContext::UniformBlockBinding(const v8::FunctionCallbackInfo<v8::Value> &args) {
3158
+ WebGL2RenderingContext *ptr = GetPointer(args.This());
3159
+ if (ptr == nullptr) {
3160
+ return;
3161
+ }
3162
+
3163
+ auto isolate = args.GetIsolate();
3164
+ auto context = isolate->GetCurrentContext();
3165
+
3166
+
3167
+ auto programValue = args[0];
3168
+ auto type = GetNativeType(programValue);
3169
+ if (type == NativeType::WebGLProgram) {
3170
+
3171
+ auto program = WebGLProgram::GetPointer(programValue.As<v8::Object>());
3172
+ auto uniformBlockIndex = args[1]->Uint32Value(
3173
+ context).ToChecked();
3174
+ auto uniformBlockBinding = args[2]->Uint32Value(
3175
+ context).ToChecked();
3176
+
3177
+ if (program != nullptr) {
3178
+ canvas_native_webgl2_uniform_block_binding(
3179
+ program->GetProgram(),
3180
+ uniformBlockIndex,
3181
+ uniformBlockBinding,
3182
+ ptr->GetState()
3183
+ );
3184
+ }
3185
+
3186
+ }
3187
+
3188
+ }
3189
+
3190
+ void WebGL2RenderingContext::UniformMatrix2x3fv(const v8::FunctionCallbackInfo<v8::Value> &args) {
3191
+ WebGL2RenderingContext *ptr = GetPointer(args.This());
3192
+ if (ptr == nullptr) {
3193
+ return;
3194
+ }
3195
+
3196
+ auto isolate = args.GetIsolate();
3197
+ auto context = isolate->GetCurrentContext();
3198
+
3199
+
3200
+ auto locationValue = args[0];
3201
+ auto type = GetNativeType(locationValue);
3202
+ if (type == NativeType::WebGLUniformLocation) {
3203
+ auto location = WebGLUniformLocation::GetPointer(locationValue.As<v8::Object>());
3204
+ auto transpose = args[1]->BooleanValue(isolate);
3205
+ auto dataValue = args[2];
3206
+
3207
+ if (dataValue->IsFloat32Array()) {
3208
+ auto buf = dataValue.As<v8::Float32Array>();
3209
+ auto array = buf->Buffer();
3210
+ auto offset = buf->ByteOffset();
3211
+ auto size = buf->Length();
3212
+ auto data_ptr = static_cast<uint8_t *>(array->GetBackingStore()->Data()) + offset;
3213
+ auto data = static_cast<float *>((void *) data_ptr);
3214
+
3215
+
3216
+ canvas_native_webgl2_uniform_matrix2x3fv(
3217
+ location->GetUniformLocation(),
3218
+ transpose,
3219
+ data, size,
3220
+ ptr->GetState()
3221
+ );
3222
+ } else if (dataValue->IsArray()) {
3223
+ std::vector<float> buf;
3224
+ auto array = dataValue.As<v8::Array>();
3225
+ auto len = array->Length();
3226
+ for (int i = 0; i < len; i++) {
3227
+ auto item = array->Get(
3228
+ context, i).ToLocalChecked();
3229
+ buf.push_back(
3230
+ static_cast<float>(item->NumberValue(
3231
+ context).ToChecked()));
3232
+ }
3233
+
3234
+
3235
+ canvas_native_webgl2_uniform_matrix2x3fv(
3236
+ location->GetUniformLocation(),
3237
+ transpose,
3238
+ buf.data(), buf.size(),
3239
+ ptr->GetState()
3240
+ );
3241
+ }
3242
+ }
3243
+
3244
+ }
3245
+
3246
+ void WebGL2RenderingContext::UniformMatrix2x4fv(const v8::FunctionCallbackInfo<v8::Value> &args) {
3247
+ WebGL2RenderingContext *ptr = GetPointer(args.This());
3248
+ if (ptr == nullptr) {
3249
+ return;
3250
+ }
3251
+
3252
+ auto isolate = args.GetIsolate();
3253
+ auto context = isolate->GetCurrentContext();
3254
+
3255
+
3256
+ auto locationValue = args[0];
3257
+ auto type = GetNativeType(locationValue);
3258
+ if (type == NativeType::WebGLUniformLocation) {
3259
+ auto location = WebGLUniformLocation::GetPointer(locationValue.As<v8::Object>());
3260
+ auto transpose = args[1]->BooleanValue(isolate);
3261
+ auto dataValue = args[2];
3262
+
3263
+ if (dataValue->IsFloat32Array()) {
3264
+ auto buf = dataValue.As<v8::Float32Array>();
3265
+
3266
+ auto array = buf->Buffer();
3267
+ auto offset = buf->ByteOffset();
3268
+ auto size = buf->Length();
3269
+ auto data_ptr = static_cast<uint8_t *>(array->GetBackingStore()->Data()) + offset;
3270
+ auto data = static_cast<float *>((void *) data_ptr);
3271
+
3272
+
3273
+ canvas_native_webgl2_uniform_matrix2x4fv(
3274
+ location->GetUniformLocation(),
3275
+ transpose,
3276
+ data, size,
3277
+ ptr->GetState()
3278
+ );
3279
+ } else if (dataValue->IsArray()) {
3280
+ std::vector<float> buf;
3281
+ auto array = dataValue.As<v8::Array>();
3282
+ auto len = array->Length();
3283
+ for (int i = 0; i < len; i++) {
3284
+ auto item = array->Get(
3285
+ context, i).ToLocalChecked();
3286
+ buf.push_back(
3287
+ static_cast<float>(item->NumberValue(
3288
+ context).ToChecked()));
3289
+ }
3290
+
3291
+
3292
+ canvas_native_webgl2_uniform_matrix2x4fv(
3293
+ location->GetUniformLocation(),
3294
+ transpose,
3295
+ buf.data(), buf.size(),
3296
+ ptr->GetState()
3297
+ );
3298
+ }
3299
+ }
3300
+
3301
+ }
3302
+
3303
+ void WebGL2RenderingContext::UniformMatrix3x2fv(const v8::FunctionCallbackInfo<v8::Value> &args) {
3304
+ WebGL2RenderingContext *ptr = GetPointer(args.This());
3305
+ if (ptr == nullptr) {
3306
+ return;
3307
+ }
3308
+
3309
+ auto isolate = args.GetIsolate();
3310
+ auto context = isolate->GetCurrentContext();
3311
+
3312
+
3313
+ auto locationValue = args[0];
3314
+ auto type = GetNativeType(locationValue);
3315
+ if (type == NativeType::WebGLUniformLocation) {
3316
+ auto location = WebGLUniformLocation::GetPointer(locationValue.As<v8::Object>());
3317
+ auto transpose = args[1]->BooleanValue(isolate);
3318
+ auto dataValue = args[2];
3319
+
3320
+ if (dataValue->IsFloat32Array()) {
3321
+ auto buf = dataValue.As<v8::Float32Array>();
3322
+
3323
+
3324
+ auto array = buf->Buffer();
3325
+ auto offset = buf->ByteOffset();
3326
+ auto size = buf->Length();
3327
+ auto data_ptr = static_cast<uint8_t *>(array->GetBackingStore()->Data()) + offset;
3328
+ auto data = static_cast<float *>((void *) data_ptr);
3329
+
3330
+
3331
+ canvas_native_webgl2_uniform_matrix3x2fv(
3332
+ location->GetUniformLocation(),
3333
+ transpose,
3334
+ data, size,
3335
+ ptr->GetState()
3336
+ );
3337
+ } else if (dataValue->IsArray()) {
3338
+ std::vector<float> buf;
3339
+ auto array = dataValue.As<v8::Array>();
3340
+ auto len = array->Length();
3341
+ for (int i = 0; i < len; i++) {
3342
+ auto item = array->Get(
3343
+ context, i).ToLocalChecked();
3344
+ buf.push_back(
3345
+ static_cast<float>(item->NumberValue(
3346
+ context).ToChecked()));
3347
+ }
3348
+
3349
+
3350
+ canvas_native_webgl2_uniform_matrix3x2fv(
3351
+ location->GetUniformLocation(),
3352
+ transpose,
3353
+ buf.data(), buf.size(),
3354
+ ptr->GetState()
3355
+ );
3356
+ }
3357
+ }
3358
+
3359
+ }
3360
+
3361
+ void WebGL2RenderingContext::UniformMatrix3x4fv(const v8::FunctionCallbackInfo<v8::Value> &args) {
3362
+ WebGL2RenderingContext *ptr = GetPointer(args.This());
3363
+ if (ptr == nullptr) {
3364
+ return;
3365
+ }
3366
+
3367
+ auto isolate = args.GetIsolate();
3368
+ auto context = isolate->GetCurrentContext();
3369
+
3370
+
3371
+ auto locationValue = args[0];
3372
+ auto type = GetNativeType(locationValue);
3373
+ if (type == NativeType::WebGLUniformLocation) {
3374
+ auto location = WebGLUniformLocation::GetPointer(locationValue.As<v8::Object>());
3375
+ auto transpose = args[1]->BooleanValue(isolate);
3376
+ auto dataValue = args[2];
3377
+
3378
+ if (dataValue->IsFloat32Array()) {
3379
+ auto buf = dataValue.As<v8::Float32Array>();
3380
+ auto array = buf->Buffer();
3381
+ auto offset = buf->ByteOffset();
3382
+ auto size = buf->Length();
3383
+ auto data_ptr = static_cast<uint8_t *>(array->GetBackingStore()->Data()) + offset;
3384
+ auto data = static_cast<float *>((void *) data_ptr);
3385
+
3386
+
3387
+ canvas_native_webgl2_uniform_matrix3x4fv(
3388
+ location->GetUniformLocation(),
3389
+ transpose,
3390
+ data, size,
3391
+ ptr->GetState()
3392
+ );
3393
+ } else if (dataValue->IsArray()) {
3394
+ std::vector<float> buf;
3395
+ auto array = dataValue.As<v8::Array>();
3396
+ auto len = array->Length();
3397
+ for (int i = 0; i < len; i++) {
3398
+ auto item = array->Get(
3399
+ context, i).ToLocalChecked();
3400
+ buf.push_back(
3401
+ static_cast<float>(item->NumberValue(
3402
+ context).ToChecked()));
3403
+ }
3404
+
3405
+
3406
+ canvas_native_webgl2_uniform_matrix3x4fv(
3407
+ location->GetUniformLocation(),
3408
+ transpose,
3409
+ buf.data(), buf.size(),
3410
+ ptr->GetState()
3411
+ );
3412
+ }
3413
+ }
3414
+
3415
+ }
3416
+
3417
+ void WebGL2RenderingContext::UniformMatrix4x2fv(const v8::FunctionCallbackInfo<v8::Value> &args) {
3418
+ WebGL2RenderingContext *ptr = GetPointer(args.This());
3419
+ if (ptr == nullptr) {
3420
+ return;
3421
+ }
3422
+
3423
+ auto isolate = args.GetIsolate();
3424
+ auto context = isolate->GetCurrentContext();
3425
+
3426
+
3427
+ auto locationValue = args[0];
3428
+ auto type = GetNativeType(locationValue);
3429
+ if (type == NativeType::WebGLUniformLocation) {
3430
+ auto location = WebGLUniformLocation::GetPointer(locationValue.As<v8::Object>());
3431
+ auto transpose = args[1]->BooleanValue(isolate);
3432
+ auto dataValue = args[2];
3433
+
3434
+ if (dataValue->IsFloat32Array()) {
3435
+ auto buf = dataValue.As<v8::Float32Array>();
3436
+
3437
+ auto array = buf->Buffer();
3438
+ auto offset = buf->ByteOffset();
3439
+ auto size = buf->Length();
3440
+ auto data_ptr = static_cast<uint8_t *>(array->GetBackingStore()->Data()) + offset;
3441
+ auto data = static_cast<float *>((void *) data_ptr);
3442
+
3443
+ canvas_native_webgl2_uniform_matrix4x2fv(
3444
+ location->GetUniformLocation(),
3445
+ transpose,
3446
+ data, size,
3447
+ ptr->GetState()
3448
+ );
3449
+ } else if (dataValue->IsArray()) {
3450
+ std::vector<float> buf;
3451
+ auto array = dataValue.As<v8::Array>();
3452
+ auto len = array->Length();
3453
+ for (int i = 0; i < len; i++) {
3454
+ auto item = array->Get(
3455
+ context, i).ToLocalChecked();
3456
+ buf.push_back(
3457
+ static_cast<float>(item->NumberValue(
3458
+ context).ToChecked()));
3459
+ }
3460
+
3461
+
3462
+ canvas_native_webgl2_uniform_matrix4x2fv(
3463
+ location->GetUniformLocation(),
3464
+ transpose,
3465
+ buf.data(), buf.size(),
3466
+ ptr->GetState()
3467
+ );
3468
+ }
3469
+ }
3470
+
3471
+ }
3472
+
3473
+ void WebGL2RenderingContext::UniformMatrix4x3fv(const v8::FunctionCallbackInfo<v8::Value> &args) {
3474
+ WebGL2RenderingContext *ptr = GetPointer(args.This());
3475
+ if (ptr == nullptr) {
3476
+ return;
3477
+ }
3478
+
3479
+ auto isolate = args.GetIsolate();
3480
+ auto context = isolate->GetCurrentContext();
3481
+
3482
+
3483
+ auto locationValue = args[0];
3484
+ auto type = GetNativeType(locationValue);
3485
+ if (type == NativeType::WebGLUniformLocation) {
3486
+ auto location = WebGLUniformLocation::GetPointer(locationValue.As<v8::Object>());
3487
+ auto transpose = args[1]->BooleanValue(isolate);
3488
+ auto dataValue = args[2];
3489
+
3490
+ if (dataValue->IsFloat32Array()) {
3491
+ auto buf = dataValue.As<v8::Float32Array>();
3492
+ auto array = buf->Buffer();
3493
+ auto offset = buf->ByteOffset();
3494
+ auto size = buf->Length();
3495
+ auto data_ptr = static_cast<uint8_t *>(array->GetBackingStore()->Data()) + offset;
3496
+ auto data = static_cast<float *>((void *) data_ptr);
3497
+
3498
+ canvas_native_webgl2_uniform_matrix4x3fv(
3499
+ location->GetUniformLocation(),
3500
+ transpose,
3501
+ data, size,
3502
+ ptr->GetState()
3503
+ );
3504
+ } else if (dataValue->IsArray()) {
3505
+ std::vector<float> buf;
3506
+ auto array = dataValue.As<v8::Array>();
3507
+ auto len = array->Length();
3508
+ for (int i = 0; i < len; i++) {
3509
+ auto item = array->Get(
3510
+ context, i).ToLocalChecked();
3511
+ buf.push_back(
3512
+ static_cast<float>(item->NumberValue(
3513
+ context).ToChecked()));
3514
+ }
3515
+
3516
+
3517
+ canvas_native_webgl2_uniform_matrix4x3fv(
3518
+ location->GetUniformLocation(),
3519
+ transpose,
3520
+ buf.data(), buf.size(),
3521
+ ptr->GetState()
3522
+ );
3523
+ }
3524
+ }
3525
+
3526
+ }
3527
+
3528
+ void WebGL2RenderingContext::VertexAttribDivisor(const v8::FunctionCallbackInfo<v8::Value> &args) {
3529
+ WebGL2RenderingContext *ptr = GetPointer(args.This());
3530
+ if (ptr == nullptr) {
3531
+ return;
3532
+ }
3533
+
3534
+ auto isolate = args.GetIsolate();
3535
+ auto context = isolate->GetCurrentContext();
3536
+
3537
+
3538
+ auto index = args[0]->Uint32Value(
3539
+ context).ToChecked();
3540
+ auto divisor = args[1]->Uint32Value(
3541
+ context).ToChecked();
3542
+ canvas_native_webgl2_vertex_attrib_divisor(
3543
+ index,
3544
+ divisor,
3545
+ ptr->GetState()
3546
+ );
3547
+
3548
+ }
3549
+
3550
+ void WebGL2RenderingContext::VertexAttribI4i(const v8::FunctionCallbackInfo<v8::Value> &args) {
3551
+ WebGL2RenderingContext *ptr = GetPointer(args.This());
3552
+ if (ptr == nullptr) {
3553
+ return;
3554
+ }
3555
+
3556
+ auto isolate = args.GetIsolate();
3557
+ auto context = isolate->GetCurrentContext();
3558
+
3559
+
3560
+ auto index = args[0]->Int32Value(
3561
+ context).ToChecked();
3562
+ auto v0 = args[1]->Int32Value(
3563
+ context).ToChecked();
3564
+ auto v1 = args[2]->Int32Value(
3565
+ context).ToChecked();
3566
+ auto v2 = args[3]->Int32Value(
3567
+ context).ToChecked();
3568
+ auto v3 = args[4]->Int32Value(
3569
+ context).ToChecked();
3570
+ canvas_native_webgl2_vertex_attrib_i4i(
3571
+ index,
3572
+ v0,
3573
+ v1,
3574
+ v2,
3575
+ v3,
3576
+ ptr->GetState()
3577
+ );
3578
+
3579
+ }
3580
+
3581
+ void WebGL2RenderingContext::VertexAttribI4iv(const v8::FunctionCallbackInfo<v8::Value> &args) {
3582
+ WebGL2RenderingContext *ptr = GetPointer(args.This());
3583
+ if (ptr == nullptr) {
3584
+ return;
3585
+ }
3586
+
3587
+ auto isolate = args.GetIsolate();
3588
+ auto context = isolate->GetCurrentContext();
3589
+
3590
+
3591
+ auto index = args[0]->Uint32Value(
3592
+ context).ToChecked();
3593
+ auto value = args[1];
3594
+ if (value->IsInt32Array()) {
3595
+ auto buf = value.As<v8::Int32Array>();
3596
+
3597
+ auto array = buf->Buffer();
3598
+ auto offset = buf->ByteOffset();
3599
+ auto size = buf->Length();
3600
+ auto data_ptr = static_cast<uint8_t *>(array->GetBackingStore()->Data()) + offset;
3601
+ auto data = static_cast<int32_t *>((void *) data_ptr);
3602
+
3603
+
3604
+ canvas_native_webgl2_vertex_attrib_i4iv(
3605
+ index,
3606
+ data, size,
3607
+ ptr->GetState()
3608
+ );
3609
+ } else if (value->IsArray()) {
3610
+ auto array = value.As<v8::Array>();
3611
+ auto len = array->Length();
3612
+ std::vector<int32_t> buf;
3613
+ buf.reserve(len);
3614
+ for (int i = 0; i < len; i++) {
3615
+ auto item = array->Get(
3616
+ context,
3617
+ i).ToLocalChecked()->Int32Value(
3618
+ context).ToChecked();
3619
+ buf.push_back(item);
3620
+ }
3621
+
3622
+
3623
+ canvas_native_webgl2_vertex_attrib_i4iv(
3624
+ index,
3625
+ buf.data(), buf.size(),
3626
+ ptr->GetState()
3627
+ );
3628
+ }
3629
+
3630
+ }
3631
+
3632
+ void WebGL2RenderingContext::VertexAttribI4ui(const v8::FunctionCallbackInfo<v8::Value> &args) {
3633
+ WebGL2RenderingContext *ptr = GetPointer(args.This());
3634
+ if (ptr == nullptr) {
3635
+ return;
3636
+ }
3637
+
3638
+ auto isolate = args.GetIsolate();
3639
+ auto context = isolate->GetCurrentContext();
3640
+
3641
+
3642
+ auto index = args[0]->Uint32Value(
3643
+ context).ToChecked();
3644
+ auto v0 = args[1]->Uint32Value(
3645
+ context).ToChecked();
3646
+ auto v1 = args[2]->Uint32Value(
3647
+ context).ToChecked();
3648
+ auto v2 = args[3]->Uint32Value(
3649
+ context).ToChecked();
3650
+ auto v3 = args[4]->Uint32Value(
3651
+ context).ToChecked();
3652
+
3653
+ canvas_native_webgl2_vertex_attrib_i4ui(
3654
+ index,
3655
+ v0,
3656
+ v1,
3657
+ v2,
3658
+ v3,
3659
+ ptr->GetState()
3660
+ );
3661
+
3662
+ }
3663
+
3664
+ void WebGL2RenderingContext::VertexAttribI4uiv(const v8::FunctionCallbackInfo<v8::Value> &args) {
3665
+ WebGL2RenderingContext *ptr = GetPointer(args.This());
3666
+ if (ptr == nullptr) {
3667
+ return;
3668
+ }
3669
+
3670
+ auto isolate = args.GetIsolate();
3671
+ auto context = isolate->GetCurrentContext();
3672
+
3673
+ auto index = args[0]->Uint32Value(
3674
+ context).ToChecked();
3675
+ auto value = args[1];
3676
+ if (value->IsUint32Array()) {
3677
+ auto buf = value.As<v8::Uint32Array>();
3678
+ auto array = buf->Buffer();
3679
+ auto offset = buf->ByteOffset();
3680
+ auto size = buf->Length();
3681
+ auto data_ptr = static_cast<uint8_t *>(array->GetBackingStore()->Data()) + offset;
3682
+ auto data = static_cast<uint32_t *>((void *) data_ptr);
3683
+
3684
+
3685
+ canvas_native_webgl2_vertex_attrib_i4uiv(
3686
+ index,
3687
+ data, size,
3688
+ ptr->GetState()
3689
+ );
3690
+ } else if (value->IsArray()) {
3691
+ auto array = value.As<v8::Array>();
3692
+ auto len = array->Length();
3693
+ std::vector<uint32_t> buf;
3694
+ buf.reserve(len);
3695
+ for (int i = 0; i < len; i++) {
3696
+ auto item = array->Get(
3697
+ context,
3698
+ i).ToLocalChecked()->Uint32Value(
3699
+ context).ToChecked();
3700
+ buf.push_back(item);
3701
+ }
3702
+
3703
+
3704
+ canvas_native_webgl2_vertex_attrib_i4uiv(
3705
+ index,
3706
+ buf.data(), buf.size(),
3707
+ ptr->GetState()
3708
+ );
3709
+ }
3710
+
3711
+ }
3712
+
3713
+ void WebGL2RenderingContext::SetConstants(v8::Isolate *isolate,
3714
+ const v8::Local<v8::ObjectTemplate> &tmpl) {
3715
+ /* Getting GL parameter information */
3716
+
3717
+ tmpl->Set(isolate, "READ_BUFFER", v8::Integer::NewFromUnsigned(isolate, 0x0C02));
3718
+
3719
+ tmpl->Set(isolate, "UNPACK_ROW_LENGTH", v8::Integer::NewFromUnsigned(isolate, 0x0CF2));
3720
+
3721
+ tmpl->Set(isolate, "UNPACK_SKIP_ROWS", v8::Integer::NewFromUnsigned(isolate, 0x0CF3));
3722
+
3723
+ tmpl->Set(isolate, "UNPACK_SKIP_PIXELS", v8::Integer::NewFromUnsigned(isolate, 0x0CF4));
3724
+
3725
+ tmpl->Set(isolate, "PACK_ROW_LENGTH", v8::Integer::NewFromUnsigned(isolate, 0x0D02));
3726
+
3727
+ tmpl->Set(isolate, "PACK_SKIP_ROWS", v8::Integer::NewFromUnsigned(isolate, 0x0D03));
3728
+
3729
+ tmpl->Set(isolate, "PACK_SKIP_PIXELS", v8::Integer::NewFromUnsigned(isolate, 0x0D04));
3730
+
3731
+ tmpl->Set(isolate, "TEXTURE_BINDING_3D", v8::Integer::NewFromUnsigned(isolate, 0x806A));
3732
+
3733
+ tmpl->Set(isolate, "UNPACK_SKIP_IMAGES", v8::Integer::NewFromUnsigned(isolate, 0x806D));
3734
+
3735
+ tmpl->Set(isolate, "UNPACK_IMAGE_HEIGHT", v8::Integer::NewFromUnsigned(isolate, 0x806E));
3736
+
3737
+ tmpl->Set(isolate, "MAX_3D_TEXTURE_SIZE", v8::Integer::NewFromUnsigned(isolate, 0x8073));
3738
+
3739
+ tmpl->Set(isolate, "MAX_ELEMENTS_VERTICES", v8::Integer::NewFromUnsigned(isolate, 0x80E8));
3740
+
3741
+ tmpl->Set(isolate, "MAX_ELEMENTS_INDICES", v8::Integer::NewFromUnsigned(isolate, 0x80E9));
3742
+
3743
+ tmpl->Set(isolate, "MAX_TEXTURE_LOD_BIAS", v8::Integer::NewFromUnsigned(isolate, 0x84FD));
3744
+
3745
+ tmpl->Set(isolate, "MAX_FRAGMENT_UNIFORM_COMPONENTS",
3746
+ v8::Integer::NewFromUnsigned(isolate, 0x8B49));
3747
+
3748
+ tmpl->Set(isolate, "MAX_VERTEX_UNIFORM_COMPONENTS",
3749
+ v8::Integer::NewFromUnsigned(isolate, 0x8B4A));
3750
+
3751
+ tmpl->Set(isolate, "MAX_ARRAY_TEXTURE_LAYERS", v8::Integer::NewFromUnsigned(isolate, 0x88FF));
3752
+
3753
+ tmpl->Set(isolate, "MIN_PROGRAM_TEXEL_OFFSET", v8::Integer::NewFromUnsigned(isolate, 0x8904));
3754
+
3755
+ tmpl->Set(isolate, "MAX_PROGRAM_TEXEL_OFFSET", v8::Integer::NewFromUnsigned(isolate, 0x8905));
3756
+
3757
+ tmpl->Set(isolate, "MAX_VARYING_COMPONENTS", v8::Integer::NewFromUnsigned(isolate, 0x8B4B));
3758
+
3759
+ tmpl->Set(isolate, "FRAGMENT_SHADER_DERIVATIVE_HINT",
3760
+ v8::Integer::NewFromUnsigned(isolate, 0x8B8B));
3761
+
3762
+ tmpl->Set(isolate, "RASTERIZER_DISCARD", v8::Integer::NewFromUnsigned(isolate, 0x8C89));
3763
+
3764
+ tmpl->Set(isolate, "VERTEX_ARRAY_BINDING", v8::Integer::NewFromUnsigned(isolate, 0x85B5));
3765
+ tmpl->Set(isolate, "MAX_VERTEX_OUTPUT_COMPONENTS",
3766
+ v8::Integer::NewFromUnsigned(isolate, 0x9122));
3767
+ tmpl->Set(isolate, "MAX_FRAGMENT_INPUT_COMPONENTS",
3768
+ v8::Integer::NewFromUnsigned(isolate, 0x9125));
3769
+ tmpl->Set(isolate, "MAX_SERVER_WAIT_TIMEOUT", v8::Integer::NewFromUnsigned(isolate, 0x9111));
3770
+ tmpl->Set(isolate, "MAX_ELEMENT_INDEX", v8::Integer::NewFromUnsigned(isolate, 0x8D6B));
3771
+
3772
+ tmpl->Set(isolate, "RED", v8::Integer::NewFromUnsigned(isolate, 0x1903));
3773
+ tmpl->Set(isolate, "RGB8", v8::Integer::NewFromUnsigned(isolate, 0x8051));
3774
+ tmpl->Set(isolate, "RGBA8", v8::Integer::NewFromUnsigned(isolate, 0x8058));
3775
+ tmpl->Set(isolate, "RGB10_A2", v8::Integer::NewFromUnsigned(isolate, 0x8059));
3776
+ tmpl->Set(isolate, "TEXTURE_3D", v8::Integer::NewFromUnsigned(isolate, 0x806F));
3777
+
3778
+ tmpl->Set(isolate, "TEXTURE_WRAP_R", v8::Integer::NewFromUnsigned(isolate, 0x8072));
3779
+ tmpl->Set(isolate, "TEXTURE_MIN_LOD", v8::Integer::NewFromUnsigned(isolate, 0x813A));
3780
+ tmpl->Set(isolate, "TEXTURE_MAX_LOD", v8::Integer::NewFromUnsigned(isolate, 0x813B));
3781
+ tmpl->Set(isolate, "TEXTURE_BASE_LEVEL", v8::Integer::NewFromUnsigned(isolate, 0x813C));
3782
+ tmpl->Set(isolate, "TEXTURE_MAX_LEVEL", v8::Integer::NewFromUnsigned(isolate, 0x813D));
3783
+
3784
+
3785
+ tmpl->Set(isolate, "TEXTURE_COMPARE_MODE", v8::Integer::NewFromUnsigned(isolate, 0x884C));
3786
+ tmpl->Set(isolate, "TEXTURE_COMPARE_FUNC", v8::Integer::NewFromUnsigned(isolate, 0x884D));
3787
+ tmpl->Set(isolate, "SRGB", v8::Integer::NewFromUnsigned(isolate, 0x8C40));
3788
+ tmpl->Set(isolate, "SRGB8", v8::Integer::NewFromUnsigned(isolate, 0x8C41));
3789
+ tmpl->Set(isolate, "SRGB8_ALPHA8", v8::Integer::NewFromUnsigned(isolate, 0x8C43));
3790
+
3791
+ tmpl->Set(isolate, "COMPARE_REF_TO_TEXTURE", v8::Integer::NewFromUnsigned(isolate, 0x884E));
3792
+ tmpl->Set(isolate, "RGBA32F", v8::Integer::NewFromUnsigned(isolate, 0x8814));
3793
+ tmpl->Set(isolate, "RGB32F", v8::Integer::NewFromUnsigned(isolate, 0x8815));
3794
+ tmpl->Set(isolate, "RGBA16F", v8::Integer::NewFromUnsigned(isolate, 0x881A));
3795
+ tmpl->Set(isolate, "RGB16F", v8::Integer::NewFromUnsigned(isolate, 0x881B));
3796
+
3797
+ tmpl->Set(isolate, "TEXTURE_2D_ARRAY", v8::Integer::NewFromUnsigned(isolate, 0x8C1A));
3798
+ tmpl->Set(isolate, "TEXTURE_BINDING_2D_ARRAY", v8::Integer::NewFromUnsigned(isolate, 0x8C1D));
3799
+ tmpl->Set(isolate, "R11F_G11F_B10F", v8::Integer::NewFromUnsigned(isolate, 0x8C3A));
3800
+ tmpl->Set(isolate, "RGB9_E5", v8::Integer::NewFromUnsigned(isolate, 0x8C3D));
3801
+ tmpl->Set(isolate, "RGBA32UI", v8::Integer::NewFromUnsigned(isolate, 0x8D70));
3802
+
3803
+
3804
+ tmpl->Set(isolate, "RGB32UI", v8::Integer::NewFromUnsigned(isolate, 0x8D71));
3805
+ tmpl->Set(isolate, "RGBA16UI", v8::Integer::NewFromUnsigned(isolate, 0x8D76));
3806
+ tmpl->Set(isolate, "RGB16UI", v8::Integer::NewFromUnsigned(isolate, 0x8D77));
3807
+ tmpl->Set(isolate, "RGBA8UI", v8::Integer::NewFromUnsigned(isolate, 0x8D7C));
3808
+ tmpl->Set(isolate, "RGB8UI", v8::Integer::NewFromUnsigned(isolate, 0x8D7D));
3809
+
3810
+
3811
+ tmpl->Set(isolate, "RGBA32I", v8::Integer::NewFromUnsigned(isolate, 0x8D82));
3812
+ tmpl->Set(isolate, "RGB32I", v8::Integer::NewFromUnsigned(isolate, 0x8D83));
3813
+ tmpl->Set(isolate, "RGBA16I", v8::Integer::NewFromUnsigned(isolate, 0x8D88));
3814
+ tmpl->Set(isolate, "RGB16I", v8::Integer::NewFromUnsigned(isolate, 0x8D89));
3815
+ tmpl->Set(isolate, "RGBA8I", v8::Integer::NewFromUnsigned(isolate, 0x8D8E));
3816
+
3817
+
3818
+ tmpl->Set(isolate, "RGB8I", v8::Integer::NewFromUnsigned(isolate, 0x8D8F));
3819
+ tmpl->Set(isolate, "RED_INTEGER", v8::Integer::NewFromUnsigned(isolate, 0x8D94));
3820
+ tmpl->Set(isolate, "RGB_INTEGER", v8::Integer::NewFromUnsigned(isolate, 0x8D98));
3821
+ tmpl->Set(isolate, "RGBA_INTEGER", v8::Integer::NewFromUnsigned(isolate, 0x8D99));
3822
+ tmpl->Set(isolate, "R8", v8::Integer::NewFromUnsigned(isolate, 0x8229));
3823
+
3824
+
3825
+ tmpl->Set(isolate, "RG8", v8::Integer::NewFromUnsigned(isolate, 0x822B));
3826
+ tmpl->Set(isolate, "R16F", v8::Integer::NewFromUnsigned(isolate, 0x822D));
3827
+ tmpl->Set(isolate, "R32F", v8::Integer::NewFromUnsigned(isolate, 0x822E));
3828
+ tmpl->Set(isolate, "RG16F", v8::Integer::NewFromUnsigned(isolate, 0x822F));
3829
+ tmpl->Set(isolate, "RG32F", v8::Integer::NewFromUnsigned(isolate, 0x8230));
3830
+
3831
+
3832
+ tmpl->Set(isolate, "R8I", v8::Integer::NewFromUnsigned(isolate, 0x8231));
3833
+ tmpl->Set(isolate, "R8UI", v8::Integer::NewFromUnsigned(isolate, 0x8232));
3834
+ tmpl->Set(isolate, "R16I", v8::Integer::NewFromUnsigned(isolate, 0x8233));
3835
+ tmpl->Set(isolate, "R16UI", v8::Integer::NewFromUnsigned(isolate, 0x8234));
3836
+ tmpl->Set(isolate, "R32I", v8::Integer::NewFromUnsigned(isolate, 0x8235));
3837
+
3838
+
3839
+ tmpl->Set(isolate, "R32UI", v8::Integer::NewFromUnsigned(isolate, 0x8236));
3840
+ tmpl->Set(isolate, "RG8I", v8::Integer::NewFromUnsigned(isolate, 0x8237));
3841
+ tmpl->Set(isolate, "RG8UI", v8::Integer::NewFromUnsigned(isolate, 0x8238));
3842
+ tmpl->Set(isolate, "RG16I", v8::Integer::NewFromUnsigned(isolate, 0x8239));
3843
+ tmpl->Set(isolate, "RG16UI", v8::Integer::NewFromUnsigned(isolate, 0x823A));
3844
+
3845
+ tmpl->Set(isolate, "RG32I", v8::Integer::NewFromUnsigned(isolate, 0x823B));
3846
+ tmpl->Set(isolate, "RG32UI", v8::Integer::NewFromUnsigned(isolate, 0x823C));
3847
+ tmpl->Set(isolate, "R8_SNORM", v8::Integer::NewFromUnsigned(isolate, 0x8F94));
3848
+ tmpl->Set(isolate, "RG8_SNORM", v8::Integer::NewFromUnsigned(isolate, 0x8F95));
3849
+ tmpl->Set(isolate, "RGB8_SNORM", v8::Integer::NewFromUnsigned(isolate, 0x8F96));
3850
+
3851
+
3852
+ tmpl->Set(isolate, "RGBA8_SNORM", v8::Integer::NewFromUnsigned(isolate, 0x8F97));
3853
+ tmpl->Set(isolate, "RGB10_A2UI", v8::Integer::NewFromUnsigned(isolate, 0x906F));
3854
+ tmpl->Set(isolate, "TEXTURE_IMMUTABLE_FORMAT", v8::Integer::NewFromUnsigned(isolate, 0x912F));
3855
+ tmpl->Set(isolate, "TEXTURE_IMMUTABLE_LEVELS", v8::Integer::NewFromUnsigned(isolate, 0x82DF));
3856
+ tmpl->Set(isolate, "UNSIGNED_INT_2_10_10_10_REV",
3857
+ v8::Integer::NewFromUnsigned(isolate, 0x8368));
3858
+
3859
+
3860
+ tmpl->Set(isolate, "UNSIGNED_INT_10F_11F_11F_REV",
3861
+ v8::Integer::NewFromUnsigned(isolate, 0x8C3B));
3862
+ tmpl->Set(isolate, "UNSIGNED_INT_5_9_9_9_REV", v8::Integer::NewFromUnsigned(isolate, 0x8C3E));
3863
+ tmpl->Set(isolate, "FLOAT_32_UNSIGNED_INT_24_8_REV",
3864
+ v8::Integer::NewFromUnsigned(isolate, 0x8DAD));
3865
+ tmpl->Set(isolate, "UNSIGNED_INT_24_8", v8::Integer::NewFromUnsigned(isolate, 0x84FA));
3866
+ tmpl->Set(isolate, "HALF_FLOAT", v8::Integer::NewFromUnsigned(isolate, 0x140B));
3867
+
3868
+
3869
+ tmpl->Set(isolate, "RG", v8::Integer::NewFromUnsigned(isolate, 0x8227));
3870
+ tmpl->Set(isolate, "RG_INTEGER", v8::Integer::NewFromUnsigned(isolate, 0x8228));
3871
+ tmpl->Set(isolate, "INT_2_10_10_10_REV", v8::Integer::NewFromUnsigned(isolate, 0x8D9F));
3872
+ tmpl->Set(isolate, "QUERY_RESULT_AVAILABLE", v8::Integer::NewFromUnsigned(isolate, 0x8865));
3873
+ tmpl->Set(isolate, "QUERY_RESULT", v8::Integer::NewFromUnsigned(isolate, 0x8866));
3874
+
3875
+
3876
+ tmpl->Set(isolate, "CURRENT_QUERY", v8::Integer::NewFromUnsigned(isolate, 0x8867));
3877
+ tmpl->Set(isolate, "ANY_SAMPLES_PASSED", v8::Integer::NewFromUnsigned(isolate, 0x8C2F));
3878
+ tmpl->Set(isolate, "ANY_SAMPLES_PASSED_CONSERVATIVE",
3879
+ v8::Integer::NewFromUnsigned(isolate, 0x8D6A));
3880
+ tmpl->Set(isolate, "MAX_DRAW_BUFFERS", v8::Integer::NewFromUnsigned(isolate, 0x8824));
3881
+
3882
+ tmpl->Set(isolate, "DRAW_BUFFER0", v8::Integer::NewFromUnsigned(isolate, 0x8825));
3883
+ tmpl->Set(isolate, "DRAW_BUFFER1", v8::Integer::NewFromUnsigned(isolate, 0x8826));
3884
+ tmpl->Set(isolate, "DRAW_BUFFER2", v8::Integer::NewFromUnsigned(isolate, 0x8827));
3885
+ tmpl->Set(isolate, "DRAW_BUFFER3", v8::Integer::NewFromUnsigned(isolate, 0x8828));
3886
+ tmpl->Set(isolate, "DRAW_BUFFER4", v8::Integer::NewFromUnsigned(isolate, 0x8829));
3887
+ tmpl->Set(isolate, "DRAW_BUFFER5", v8::Integer::NewFromUnsigned(isolate, 0x882A));
3888
+ tmpl->Set(isolate, "DRAW_BUFFER6", v8::Integer::NewFromUnsigned(isolate, 0x882B));
3889
+ tmpl->Set(isolate, "DRAW_BUFFER7", v8::Integer::NewFromUnsigned(isolate, 0x882C));
3890
+ tmpl->Set(isolate, "DRAW_BUFFER8", v8::Integer::NewFromUnsigned(isolate, 0x882D));
3891
+ tmpl->Set(isolate, "DRAW_BUFFER9", v8::Integer::NewFromUnsigned(isolate, 0x882E));
3892
+ tmpl->Set(isolate, "DRAW_BUFFER10", v8::Integer::NewFromUnsigned(isolate, 0x882F));
3893
+
3894
+ /* Getting GL parameter information */
3895
+
3896
+ /* Textures */
3897
+
3898
+ tmpl->Set(isolate, "DRAW_BUFFER11", v8::Integer::NewFromUnsigned(isolate, 0x8830));
3899
+ tmpl->Set(isolate, "DRAW_BUFFER12", v8::Integer::NewFromUnsigned(isolate, 0x8831));
3900
+ tmpl->Set(isolate, "DRAW_BUFFER13", v8::Integer::NewFromUnsigned(isolate, 0x8832));
3901
+ tmpl->Set(isolate, "DRAW_BUFFER14", v8::Integer::NewFromUnsigned(isolate, 0x8833));
3902
+ tmpl->Set(isolate, "DRAW_BUFFER15", v8::Integer::NewFromUnsigned(isolate, 0x8834));
3903
+
3904
+ tmpl->Set(isolate, "MAX_COLOR_ATTACHMENTS", v8::Integer::NewFromUnsigned(isolate, 0x8CDF));
3905
+ tmpl->Set(isolate, "COLOR_ATTACHMENT1", v8::Integer::NewFromUnsigned(isolate, 0x8CE1));
3906
+ tmpl->Set(isolate, "COLOR_ATTACHMENT2", v8::Integer::NewFromUnsigned(isolate, 0x8CE2));
3907
+ tmpl->Set(isolate, "COLOR_ATTACHMENT3", v8::Integer::NewFromUnsigned(isolate, 0x8CE3));
3908
+ tmpl->Set(isolate, "COLOR_ATTACHMENT4", v8::Integer::NewFromUnsigned(isolate, 0x8CE4));
3909
+ tmpl->Set(isolate, "COLOR_ATTACHMENT5", v8::Integer::NewFromUnsigned(isolate, 0x8CE5));
3910
+ tmpl->Set(isolate, "COLOR_ATTACHMENT6", v8::Integer::NewFromUnsigned(isolate, 0x8CE6));
3911
+ tmpl->Set(isolate, "COLOR_ATTACHMENT7", v8::Integer::NewFromUnsigned(isolate, 0x8CE7));
3912
+ tmpl->Set(isolate, "COLOR_ATTACHMENT8", v8::Integer::NewFromUnsigned(isolate, 0x8CE8));
3913
+ tmpl->Set(isolate, "COLOR_ATTACHMENT9", v8::Integer::NewFromUnsigned(isolate, 0x8CE9));
3914
+ tmpl->Set(isolate, "COLOR_ATTACHMENT10", v8::Integer::NewFromUnsigned(isolate, 0x8CEA));
3915
+ tmpl->Set(isolate, "COLOR_ATTACHMENT11", v8::Integer::NewFromUnsigned(isolate, 0x8CEB));
3916
+ tmpl->Set(isolate, "COLOR_ATTACHMENT12", v8::Integer::NewFromUnsigned(isolate, 0x8CEC));
3917
+ tmpl->Set(isolate, "COLOR_ATTACHMENT13", v8::Integer::NewFromUnsigned(isolate, 0x8CED));
3918
+ tmpl->Set(isolate, "COLOR_ATTACHMENT14", v8::Integer::NewFromUnsigned(isolate, 0x8CEE));
3919
+ tmpl->Set(isolate, "COLOR_ATTACHMENT15", v8::Integer::NewFromUnsigned(isolate, 0x8CEF));
3920
+
3921
+ tmpl->Set(isolate, "SAMPLER_3D", v8::Integer::NewFromUnsigned(isolate, 0x8B5F));
3922
+ tmpl->Set(isolate, "SAMPLER_2D_SHADOW", v8::Integer::NewFromUnsigned(isolate, 0x8B62));
3923
+ tmpl->Set(isolate, "SAMPLER_2D_ARRAY", v8::Integer::NewFromUnsigned(isolate, 0x8DC1));
3924
+ tmpl->Set(isolate, "SAMPLER_2D_ARRAY_SHADOW", v8::Integer::NewFromUnsigned(isolate, 0x8DC4));
3925
+ tmpl->Set(isolate, "SAMPLER_CUBE_SHADOW", v8::Integer::NewFromUnsigned(isolate, 0x8DC5));
3926
+
3927
+ tmpl->Set(isolate, "INT_SAMPLER_2D", v8::Integer::NewFromUnsigned(isolate, 0x8DCA));
3928
+ tmpl->Set(isolate, "INT_SAMPLER_3D", v8::Integer::NewFromUnsigned(isolate, 0x8DCB));
3929
+ tmpl->Set(isolate, "INT_SAMPLER_CUBE", v8::Integer::NewFromUnsigned(isolate, 0x8DCC));
3930
+ tmpl->Set(isolate, "INT_SAMPLER_2D_ARRAY", v8::Integer::NewFromUnsigned(isolate, 0x8DCF));
3931
+ tmpl->Set(isolate, "UNSIGNED_INT_SAMPLER_2D", v8::Integer::NewFromUnsigned(isolate, 0x8DD2));
3932
+
3933
+ tmpl->Set(isolate, "UNSIGNED_INT_SAMPLER_3D", v8::Integer::NewFromUnsigned(isolate, 0x8DD3));
3934
+ tmpl->Set(isolate, "UNSIGNED_INT_SAMPLER_CUBE", v8::Integer::NewFromUnsigned(isolate, 0x8DD4));
3935
+ tmpl->Set(isolate, "UNSIGNED_INT_SAMPLER_2D_ARRAY",
3936
+ v8::Integer::NewFromUnsigned(isolate, 0x8DD7));
3937
+ tmpl->Set(isolate, "MAX_SAMPLES", v8::Integer::NewFromUnsigned(isolate, 0x8D57));
3938
+ tmpl->Set(isolate, "SAMPLER_BINDING", v8::Integer::NewFromUnsigned(isolate, 0x8919));
3939
+
3940
+ tmpl->Set(isolate, "PIXEL_PACK_BUFFER", v8::Integer::NewFromUnsigned(isolate, 0x88EB));
3941
+ tmpl->Set(isolate, "PIXEL_UNPACK_BUFFER", v8::Integer::NewFromUnsigned(isolate, 0x88EC));
3942
+ tmpl->Set(isolate, "PIXEL_PACK_BUFFER_BINDING", v8::Integer::NewFromUnsigned(isolate, 0x88ED));
3943
+ tmpl->Set(isolate, "PIXEL_UNPACK_BUFFER_BINDING",
3944
+ v8::Integer::NewFromUnsigned(isolate, 0x88EF));
3945
+ tmpl->Set(isolate, "COPY_READ_BUFFER", v8::Integer::NewFromUnsigned(isolate, 0x8F36));
3946
+
3947
+ tmpl->Set(isolate, "COPY_WRITE_BUFFER", v8::Integer::NewFromUnsigned(isolate, 0x8F37));
3948
+ tmpl->Set(isolate, "COPY_READ_BUFFER_BINDING", v8::Integer::NewFromUnsigned(isolate, 0x8F36));
3949
+ tmpl->Set(isolate, "COPY_WRITE_BUFFER_BINDING", v8::Integer::NewFromUnsigned(isolate, 0x8F37));
3950
+ tmpl->Set(isolate, "FLOAT_MAT2x3", v8::Integer::NewFromUnsigned(isolate, 0x8B65));
3951
+ tmpl->Set(isolate, "FLOAT_MAT2x4", v8::Integer::NewFromUnsigned(isolate, 0x8B66));
3952
+
3953
+ tmpl->Set(isolate, "FLOAT_MAT3x2", v8::Integer::NewFromUnsigned(isolate, 0x8B67));
3954
+ tmpl->Set(isolate, "FLOAT_MAT3x4", v8::Integer::NewFromUnsigned(isolate, 0x8B68));
3955
+ tmpl->Set(isolate, "FLOAT_MAT4x2", v8::Integer::NewFromUnsigned(isolate, 0x8B69));
3956
+ tmpl->Set(isolate, "FLOAT_MAT4x3", v8::Integer::NewFromUnsigned(isolate, 0x8B6A));
3957
+ tmpl->Set(isolate, "UNSIGNED_INT_VEC2", v8::Integer::NewFromUnsigned(isolate, 0x8DC6));
3958
+
3959
+ tmpl->Set(isolate, "UNSIGNED_INT_VEC3", v8::Integer::NewFromUnsigned(isolate, 0x8DC7));
3960
+ tmpl->Set(isolate, "UNSIGNED_INT_VEC4", v8::Integer::NewFromUnsigned(isolate, 0x8DC8));
3961
+ tmpl->Set(isolate, "UNSIGNED_NORMALIZED", v8::Integer::NewFromUnsigned(isolate, 0x8C17));
3962
+ tmpl->Set(isolate, "SIGNED_NORMALIZED", v8::Integer::NewFromUnsigned(isolate, 0x8F9C));
3963
+
3964
+ /* Vertex attributes */
3965
+
3966
+ tmpl->Set(isolate, "VERTEX_ATTRIB_ARRAY_INTEGER",
3967
+ v8::Integer::NewFromUnsigned(isolate, 0x88FD));
3968
+ tmpl->Set(isolate, "VERTEX_ATTRIB_ARRAY_DIVISOR",
3969
+ v8::Integer::NewFromUnsigned(isolate, 0x88FE));
3970
+ tmpl->Set(isolate, "TRANSFORM_FEEDBACK_BUFFER_MODE",
3971
+ v8::Integer::NewFromUnsigned(isolate, 0x8C7F));
3972
+ tmpl->Set(isolate, "MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS",
3973
+ v8::Integer::NewFromUnsigned(isolate, 0x8C80));
3974
+ tmpl->Set(isolate, "TRANSFORM_FEEDBACK_VARYINGS",
3975
+ v8::Integer::NewFromUnsigned(isolate, 0x8C83));
3976
+
3977
+ tmpl->Set(isolate, "TRANSFORM_FEEDBACK_BUFFER_START",
3978
+ v8::Integer::NewFromUnsigned(isolate, 0x8C84));
3979
+ tmpl->Set(isolate, "TRANSFORM_FEEDBACK_BUFFER_SIZE",
3980
+ v8::Integer::NewFromUnsigned(isolate, 0x8C85));
3981
+ tmpl->Set(isolate, "TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN",
3982
+ v8::Integer::NewFromUnsigned(isolate, 0x8C88));
3983
+ tmpl->Set(isolate, "MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS",
3984
+ v8::Integer::NewFromUnsigned(isolate, 0x8C8A));
3985
+
3986
+ /* Textures */
3987
+
3988
+ /* Pixel types */
3989
+
3990
+ tmpl->Set(isolate, "MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS",
3991
+ v8::Integer::NewFromUnsigned(isolate, 0x8C8B));
3992
+ tmpl->Set(isolate, "INTERLEAVED_ATTRIBS", v8::Integer::NewFromUnsigned(isolate, 0x8C8C));
3993
+ tmpl->Set(isolate, "SEPARATE_ATTRIBS", v8::Integer::NewFromUnsigned(isolate, 0x8C8D));
3994
+ tmpl->Set(isolate, "TRANSFORM_FEEDBACK_BUFFER", v8::Integer::NewFromUnsigned(isolate, 0x8C8E));
3995
+ tmpl->Set(isolate, "TRANSFORM_FEEDBACK_BUFFER_BINDING",
3996
+ v8::Integer::NewFromUnsigned(isolate, 0x8C8F));
3997
+
3998
+ tmpl->Set(isolate, "TRANSFORM_FEEDBACK", v8::Integer::NewFromUnsigned(isolate, 0x8E22));
3999
+ tmpl->Set(isolate, "TRANSFORM_FEEDBACK_PAUSED", v8::Integer::NewFromUnsigned(isolate, 0x8E23));
4000
+ tmpl->Set(isolate, "TRANSFORM_FEEDBACK_ACTIVE", v8::Integer::NewFromUnsigned(isolate, 0x8E24));
4001
+ tmpl->Set(isolate, "TRANSFORM_FEEDBACK_BINDING", v8::Integer::NewFromUnsigned(isolate, 0x8E25));
4002
+
4003
+ /* Pixel types */
4004
+
4005
+ /* Queries */
4006
+
4007
+ tmpl->Set(isolate, "FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING",
4008
+ v8::Integer::NewFromUnsigned(isolate, 0x8210));
4009
+ tmpl->Set(isolate, "FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE",
4010
+ v8::Integer::NewFromUnsigned(isolate, 0x8211));
4011
+ tmpl->Set(isolate, "FRAMEBUFFER_ATTACHMENT_RED_SIZE",
4012
+ v8::Integer::NewFromUnsigned(isolate, 0x8212));
4013
+ tmpl->Set(isolate, "FRAMEBUFFER_ATTACHMENT_GREEN_SIZE",
4014
+ v8::Integer::NewFromUnsigned(isolate, 0x8213));
4015
+ tmpl->Set(isolate, "FRAMEBUFFER_ATTACHMENT_BLUE_SIZE",
4016
+ v8::Integer::NewFromUnsigned(isolate, 0x8214));
4017
+
4018
+ /* Queries */
4019
+
4020
+ /* Draw buffers */
4021
+
4022
+ tmpl->Set(isolate, "FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE",
4023
+ v8::Integer::NewFromUnsigned(isolate, 0x8215));
4024
+ tmpl->Set(isolate, "FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE",
4025
+ v8::Integer::NewFromUnsigned(isolate, 0x8216));
4026
+ tmpl->Set(isolate, "FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE",
4027
+ v8::Integer::NewFromUnsigned(isolate, 0x8217));
4028
+ tmpl->Set(isolate, "FRAMEBUFFER_DEFAULT", v8::Integer::NewFromUnsigned(isolate, 0x8218));
4029
+ tmpl->Set(isolate, "DEPTH_STENCIL_ATTACHMENT", v8::Integer::NewFromUnsigned(isolate, 0x821A));
4030
+
4031
+ tmpl->Set(isolate, "DEPTH_STENCIL", v8::Integer::NewFromUnsigned(isolate, 0x84F9));
4032
+ tmpl->Set(isolate, "DEPTH24_STENCIL8", v8::Integer::NewFromUnsigned(isolate, 0x88F0));
4033
+ tmpl->Set(isolate, "DRAW_FRAMEBUFFER_BINDING", v8::Integer::NewFromUnsigned(isolate, 0x8CA6));
4034
+ tmpl->Set(isolate, "READ_FRAMEBUFFER", v8::Integer::NewFromUnsigned(isolate, 0x8CA8));
4035
+ tmpl->Set(isolate, "DRAW_FRAMEBUFFER", v8::Integer::NewFromUnsigned(isolate, 0x8CA9));
4036
+
4037
+ tmpl->Set(isolate, "READ_FRAMEBUFFER_BINDING", v8::Integer::NewFromUnsigned(isolate, 0x8CAA));
4038
+ tmpl->Set(isolate, "RENDERBUFFER_SAMPLES", v8::Integer::NewFromUnsigned(isolate, 0x8CAB));
4039
+ tmpl->Set(isolate, "FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER",
4040
+ v8::Integer::NewFromUnsigned(isolate, 0x8CD4));
4041
+ tmpl->Set(isolate, "FRAMEBUFFER_INCOMPLETE_MULTISAMPLE",
4042
+ v8::Integer::NewFromUnsigned(isolate, 0x8D56));
4043
+ tmpl->Set(isolate, "UNIFORM_BUFFER", v8::Integer::NewFromUnsigned(isolate, 0x8A11));
4044
+
4045
+ tmpl->Set(isolate, "UNIFORM_BUFFER_BINDING", v8::Integer::NewFromUnsigned(isolate, 0x8A28));
4046
+ tmpl->Set(isolate, "UNIFORM_BUFFER_START", v8::Integer::NewFromUnsigned(isolate, 0x8A29));
4047
+ tmpl->Set(isolate, "UNIFORM_BUFFER_SIZE", v8::Integer::NewFromUnsigned(isolate, 0x8A2A));
4048
+ tmpl->Set(isolate, "MAX_VERTEX_UNIFORM_BLOCKS", v8::Integer::NewFromUnsigned(isolate, 0x8A2B));
4049
+ tmpl->Set(isolate, "MAX_FRAGMENT_UNIFORM_BLOCKS",
4050
+ v8::Integer::NewFromUnsigned(isolate, 0x8A2D));
4051
+
4052
+ tmpl->Set(isolate, "MAX_COMBINED_UNIFORM_BLOCKS",
4053
+ v8::Integer::NewFromUnsigned(isolate, 0x8A2E));
4054
+ tmpl->Set(isolate, "MAX_UNIFORM_BUFFER_BINDINGS",
4055
+ v8::Integer::NewFromUnsigned(isolate, 0x8A2F));
4056
+ tmpl->Set(isolate, "MAX_UNIFORM_BLOCK_SIZE", v8::Integer::NewFromUnsigned(isolate, 0x8A30));
4057
+ tmpl->Set(isolate, "MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS",
4058
+ v8::Integer::NewFromUnsigned(isolate, 0x8A31));
4059
+ tmpl->Set(isolate, "MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS",
4060
+ v8::Integer::NewFromUnsigned(isolate, 0x8A33));
4061
+
4062
+ tmpl->Set(isolate, "UNIFORM_BUFFER_OFFSET_ALIGNMENT",
4063
+ v8::Integer::NewFromUnsigned(isolate, 0x8A34));
4064
+ tmpl->Set(isolate, "ACTIVE_UNIFORM_BLOCKS", v8::Integer::NewFromUnsigned(isolate, 0x8A36));
4065
+ tmpl->Set(isolate, "UNIFORM_TYPE", v8::Integer::NewFromUnsigned(isolate, 0x8A37));
4066
+ tmpl->Set(isolate, "UNIFORM_SIZE", v8::Integer::NewFromUnsigned(isolate, 0x8A38));
4067
+ tmpl->Set(isolate, "UNIFORM_BLOCK_INDEX", v8::Integer::NewFromUnsigned(isolate, 0x8A3A));
4068
+
4069
+ tmpl->Set(isolate, "UNIFORM_OFFSET", v8::Integer::NewFromUnsigned(isolate, 0x8A3B));
4070
+ tmpl->Set(isolate, "UNIFORM_ARRAY_STRIDE", v8::Integer::NewFromUnsigned(isolate, 0x8A3C));
4071
+ tmpl->Set(isolate, "UNIFORM_MATRIX_STRIDE", v8::Integer::NewFromUnsigned(isolate, 0x8A3D));
4072
+
4073
+ /* Draw buffers */
4074
+
4075
+ /* Samplers */
4076
+
4077
+ tmpl->Set(isolate, "UNIFORM_IS_ROW_MAJOR", v8::Integer::NewFromUnsigned(isolate, 0x8A3E));
4078
+ tmpl->Set(isolate, "UNIFORM_BLOCK_BINDING", v8::Integer::NewFromUnsigned(isolate, 0x8A3F));
4079
+ tmpl->Set(isolate, "UNIFORM_BLOCK_DATA_SIZE", v8::Integer::NewFromUnsigned(isolate, 0x8A40));
4080
+ tmpl->Set(isolate, "UNIFORM_BLOCK_ACTIVE_UNIFORMS",
4081
+ v8::Integer::NewFromUnsigned(isolate, 0x8A42));
4082
+ tmpl->Set(isolate, "UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES",
4083
+ v8::Integer::NewFromUnsigned(isolate, 0x8A43));
4084
+
4085
+ tmpl->Set(isolate, "UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER",
4086
+ v8::Integer::NewFromUnsigned(isolate, 0x8A44));
4087
+ tmpl->Set(isolate, "UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER",
4088
+ v8::Integer::NewFromUnsigned(isolate, 0x8A46));
4089
+ tmpl->Set(isolate, "OBJECT_TYPE", v8::Integer::NewFromUnsigned(isolate, 0x9112));
4090
+ tmpl->Set(isolate, "SYNC_CONDITION", v8::Integer::NewFromUnsigned(isolate, 0x9113));
4091
+ tmpl->Set(isolate, "SYNC_STATUS", v8::Integer::NewFromUnsigned(isolate, 0x9114));
4092
+
4093
+ tmpl->Set(isolate, "SYNC_FLAGS", v8::Integer::NewFromUnsigned(isolate, 0x9115));
4094
+ tmpl->Set(isolate, "SYNC_FENCE", v8::Integer::NewFromUnsigned(isolate, 0x9116));
4095
+ tmpl->Set(isolate, "SYNC_GPU_COMMANDS_COMPLETE", v8::Integer::NewFromUnsigned(isolate, 0x9117));
4096
+ tmpl->Set(isolate, "UNSIGNALED", v8::Integer::NewFromUnsigned(isolate, 0x9118));
4097
+ tmpl->Set(isolate, "SIGNALED", v8::Integer::NewFromUnsigned(isolate, 0x9119));
4098
+
4099
+ /* Samplers */
4100
+
4101
+ /* Buffers */
4102
+
4103
+ tmpl->Set(isolate, "ALREADY_SIGNALED", v8::Integer::NewFromUnsigned(isolate, 0x911A));
4104
+ tmpl->Set(isolate, "TIMEOUT_EXPIRED", v8::Integer::NewFromUnsigned(isolate, 0x911B));
4105
+ tmpl->Set(isolate, "CONDITION_SATISFIED", v8::Integer::NewFromUnsigned(isolate, 0x911C));
4106
+ tmpl->Set(isolate, "WAIT_FAILED", v8::Integer::NewFromUnsigned(isolate, 0x911D));
4107
+ tmpl->Set(isolate, "SYNC_FLUSH_COMMANDS_BIT",
4108
+ v8::Integer::NewFromUnsigned(isolate, 0x00000001));
4109
+
4110
+ tmpl->Set(isolate, "COLOR", v8::Integer::NewFromUnsigned(isolate, 0x1800));
4111
+ tmpl->Set(isolate, "DEPTH", v8::Integer::NewFromUnsigned(isolate, 0x1801));
4112
+ tmpl->Set(isolate, "STENCIL", v8::Integer::NewFromUnsigned(isolate, 0x1802));
4113
+
4114
+ /* Buffers */
4115
+
4116
+ /* Data types */
4117
+
4118
+ tmpl->Set(isolate, "MIN", v8::Integer::NewFromUnsigned(isolate, 0x8007));
4119
+ tmpl->Set(isolate, "MAX", v8::Integer::NewFromUnsigned(isolate, 0x8008));
4120
+ tmpl->Set(isolate, "DEPTH_COMPONENT24", v8::Integer::NewFromUnsigned(isolate, 0x81A6));
4121
+ tmpl->Set(isolate, "STREAM_READ", v8::Integer::NewFromUnsigned(isolate, 0x88E1));
4122
+ tmpl->Set(isolate, "STREAM_COPY", v8::Integer::NewFromUnsigned(isolate, 0x88E2));
4123
+
4124
+ tmpl->Set(isolate, "STATIC_READ", v8::Integer::NewFromUnsigned(isolate, 0x88E5));
4125
+ tmpl->Set(isolate, "STATIC_COPY", v8::Integer::NewFromUnsigned(isolate, 0x88E6));
4126
+ tmpl->Set(isolate, "DYNAMIC_READ", v8::Integer::NewFromUnsigned(isolate, 0x88E9));
4127
+ tmpl->Set(isolate, "DYNAMIC_COPY", v8::Integer::NewFromUnsigned(isolate, 0x88EA));
4128
+ tmpl->Set(isolate, "DEPTH_COMPONENT32F", v8::Integer::NewFromUnsigned(isolate, 0x8CAC));
4129
+ tmpl->Set(isolate, "DEPTH32F_STENCIL8", v8::Integer::NewFromUnsigned(isolate, 0x8CAD));
4130
+
4131
+ /* Data types */
4132
+
4133
+ tmpl->Set(isolate, "INVALID_INDEX", v8::Integer::NewFromUnsigned(isolate, 0xFFFFFFFF));
4134
+ tmpl->Set(isolate, "TIMEOUT_IGNORED", v8::Int32::New(isolate, -1));
4135
+
4136
+ /* Vertex attributes */
4137
+
4138
+ /* Transform feedback */
4139
+
4140
+ tmpl->Set(isolate, "MAX_CLIENT_WAIT_TIMEOUT_WEBGL",
4141
+ v8::Integer::NewFromUnsigned(isolate, 0x9247));
4142
+
4143
+ /* Transform feedback */
4144
+
4145
+ }
4146
+
4147
+
4148
+ void WebGL2RenderingContext::SetMethods(v8::Isolate *isolate,
4149
+ const v8::Local<v8::ObjectTemplate> &tmpl) {
4150
+
4151
+ SetFastMethod(isolate, tmpl, "beginQuery", BeginQuery, &fast_begin_query_,
4152
+ v8::Local<v8::Value>());
4153
+
4154
+ SetFastMethod(isolate, tmpl, "beginTransformFeedback", BeginTransformFeedback,
4155
+ &fast_begin_transform_feedback_, v8::Local<v8::Value>());
4156
+
4157
+ SetFastMethod(isolate, tmpl, "bindBufferBase", BindBufferBase, &fast_bind_buffer_base_,
4158
+ v8::Local<v8::Value>());
4159
+
4160
+ SetFastMethod(isolate, tmpl, "bindBufferRange", BindBufferRange, &fast_bind_buffer_range_,
4161
+ v8::Local<v8::Value>());
4162
+
4163
+ SetFastMethod(isolate, tmpl, "bindSampler", BindSampler, &fast_bind_sampler_,
4164
+ v8::Local<v8::Value>());
4165
+
4166
+ SetFastMethod(isolate, tmpl, "bindTransformFeedback", BindTransformFeedback,
4167
+ &fast_bind_transform_feedback_, v8::Local<v8::Value>());
4168
+
4169
+
4170
+ SetFastMethod(isolate, tmpl, "bindVertexArray", BindVertexArray, &fast_bind_vertex_array_,
4171
+ v8::Local<v8::Value>());
4172
+
4173
+
4174
+ SetFastMethod(isolate, tmpl, "blitFramebuffer", BlitFramebuffer, &fast_blit_framebuffer_,
4175
+ v8::Local<v8::Value>());
4176
+
4177
+ SetFastMethod(isolate, tmpl, "clearBufferfi", ClearBufferfi, &fast_clear_buffer_fi_,
4178
+ v8::Local<v8::Value>());
4179
+
4180
+ SetFastMethodWithOverLoads(isolate, tmpl, "clearBufferfv", ClearBufferfv,
4181
+ fast_clear_buffer_fv_overloads_, v8::Local<v8::Value>());
4182
+
4183
+
4184
+ SetFastMethodWithOverLoads(isolate, tmpl, "clearBufferiv", ClearBufferiv,
4185
+ fast_clear_buffer_iv_overloads_, v8::Local<v8::Value>());
4186
+
4187
+ SetFastMethodWithOverLoads(isolate, tmpl, "clearBufferuiv", ClearBufferuiv,
4188
+ fast_clear_buffer_uiv_overloads_, v8::Local<v8::Value>());
4189
+
4190
+
4191
+ tmpl->Set(
4192
+ ConvertToV8String(isolate, "clientWaitSync"),
4193
+ v8::FunctionTemplate::New(isolate, &ClientWaitSync)
4194
+ );
4195
+
4196
+ tmpl->Set(
4197
+ ConvertToV8String(isolate, "compressedTexSubImage3D"),
4198
+ v8::FunctionTemplate::New(isolate, &CompressedTexSubImage3D)
4199
+ );
4200
+
4201
+ tmpl->Set(
4202
+ ConvertToV8String(isolate, "copyBufferSubData"),
4203
+ v8::FunctionTemplate::New(isolate, &CopyBufferSubData)
4204
+ );
4205
+
4206
+ tmpl->Set(
4207
+ ConvertToV8String(isolate, "copyTexSubImage3D"),
4208
+ v8::FunctionTemplate::New(isolate, &CopyTexSubImage3D)
4209
+ );
4210
+
4211
+ tmpl->Set(
4212
+ ConvertToV8String(isolate, "createQuery"),
4213
+ v8::FunctionTemplate::New(isolate, &CreateQuery)
4214
+ );
4215
+
4216
+ tmpl->Set(
4217
+ ConvertToV8String(isolate, "createSampler"),
4218
+ v8::FunctionTemplate::New(isolate, &CreateSampler)
4219
+ );
4220
+
4221
+ tmpl->Set(
4222
+ ConvertToV8String(isolate, "createTransformFeedback"),
4223
+ v8::FunctionTemplate::New(isolate, &CreateTransformFeedback)
4224
+ );
4225
+
4226
+ tmpl->Set(
4227
+ ConvertToV8String(isolate, "createVertexArray"),
4228
+ v8::FunctionTemplate::New(isolate, &CreateVertexArray)
4229
+ );
4230
+
4231
+ tmpl->Set(
4232
+ ConvertToV8String(isolate, "deleteQuery"),
4233
+ v8::FunctionTemplate::New(isolate, &DeleteQuery)
4234
+ );
4235
+
4236
+
4237
+ tmpl->Set(
4238
+ ConvertToV8String(isolate, "deleteSampler"),
4239
+ v8::FunctionTemplate::New(isolate, &DeleteSampler)
4240
+ );
4241
+
4242
+ tmpl->Set(
4243
+ ConvertToV8String(isolate, "deleteSync"),
4244
+ v8::FunctionTemplate::New(isolate, &DeleteSync)
4245
+ );
4246
+
4247
+ tmpl->Set(
4248
+ ConvertToV8String(isolate, "deleteTransformFeedback"),
4249
+ v8::FunctionTemplate::New(isolate, &DeleteTransformFeedback)
4250
+ );
4251
+
4252
+ tmpl->Set(
4253
+ ConvertToV8String(isolate, "deleteVertexArray"),
4254
+ v8::FunctionTemplate::New(isolate, &DeleteVertexArray)
4255
+ );
4256
+
4257
+
4258
+ SetFastMethod(isolate, tmpl, "drawArraysInstanced", DrawArraysInstanced,
4259
+ &fast_draw_arrays_instanced_, v8::Local<v8::Value>());
4260
+
4261
+
4262
+ SetFastMethod(isolate, tmpl, "drawBuffers", DrawBuffers, &fast_draw_buffers_,
4263
+ v8::Local<v8::Value>());
4264
+
4265
+
4266
+ SetFastMethod(isolate, tmpl, "drawElementsInstanced", DrawElementsInstanced,
4267
+ &fast_draw_elements_instanced_, v8::Local<v8::Value>());
4268
+
4269
+
4270
+ SetFastMethod(isolate, tmpl, "drawRangeElements", DrawRangeElements, &fast_draw_range_elements_,
4271
+ v8::Local<v8::Value>());
4272
+
4273
+
4274
+ tmpl->Set(
4275
+ ConvertToV8String(isolate, "endQuery"),
4276
+ v8::FunctionTemplate::New(isolate, &EndQuery)
4277
+ );
4278
+
4279
+ tmpl->Set(
4280
+ ConvertToV8String(isolate, "endTransformFeedback"),
4281
+ v8::FunctionTemplate::New(isolate, &EndTransformFeedback)
4282
+ );
4283
+
4284
+ tmpl->Set(
4285
+ ConvertToV8String(isolate, "fenceSync"),
4286
+ v8::FunctionTemplate::New(isolate, &FenceSync)
4287
+ );
4288
+
4289
+ tmpl->Set(
4290
+ ConvertToV8String(isolate, "framebufferTextureLayer"),
4291
+ v8::FunctionTemplate::New(isolate, &FramebufferTextureLayer)
4292
+ );
4293
+
4294
+
4295
+ SetFastMethod(isolate, tmpl, "uniform1ui", Uniform1ui, &fast_uniform_1ui_,
4296
+ v8::Local<v8::Value>());
4297
+
4298
+ SetFastMethod(isolate, tmpl, "uniform1uiv", Uniform1uiv, &fast_uniform_1uiv_,
4299
+ v8::Local<v8::Value>());
4300
+
4301
+ SetFastMethod(isolate, tmpl, "uniform2ui", Uniform2ui, &fast_uniform_2ui_,
4302
+ v8::Local<v8::Value>());
4303
+
4304
+ SetFastMethod(isolate, tmpl, "uniform2uiv", Uniform2uiv, &fast_uniform_2uiv_,
4305
+ v8::Local<v8::Value>());
4306
+
4307
+ SetFastMethod(isolate, tmpl, "uniform3ui", Uniform3ui, &fast_uniform_3ui_,
4308
+ v8::Local<v8::Value>());
4309
+
4310
+ SetFastMethod(isolate, tmpl, "uniform3uiv", Uniform3uiv, &fast_uniform_3uiv_,
4311
+ v8::Local<v8::Value>());
4312
+
4313
+ SetFastMethod(isolate, tmpl, "uniform4ui", Uniform4ui, &fast_uniform_4ui_,
4314
+ v8::Local<v8::Value>());
4315
+
4316
+ SetFastMethod(isolate, tmpl, "uniform4uiv", Uniform4uiv, &fast_uniform_4uiv_,
4317
+ v8::Local<v8::Value>());
4318
+
4319
+ SetFastMethod(isolate, tmpl, "uniformBlockBinding", UniformBlockBinding,
4320
+ &fast_uniform_block_binding_, v8::Local<v8::Value>());
4321
+
4322
+
4323
+ SetFastMethodWithOverLoads(isolate, tmpl, "uniformMatrix2x3fv", UniformMatrix2x3fv,
4324
+ fast_uniform_matrix_2x3fv_overloads_, v8::Local<v8::Value>());
4325
+
4326
+
4327
+ SetFastMethodWithOverLoads(isolate, tmpl, "uniformMatrix2x4fv", UniformMatrix2x4fv,
4328
+ fast_uniform_matrix_2x4fv_overloads_, v8::Local<v8::Value>());
4329
+
4330
+
4331
+ SetFastMethodWithOverLoads(isolate, tmpl, "uniformMatrix3x2fv", UniformMatrix3x2fv,
4332
+ fast_uniform_matrix_3x2fv_overloads_, v8::Local<v8::Value>());
4333
+
4334
+ SetFastMethodWithOverLoads(isolate, tmpl, "uniformMatrix3x4fv", UniformMatrix3x4fv,
4335
+ fast_uniform_matrix_3x4fv_overloads_, v8::Local<v8::Value>());
4336
+
4337
+
4338
+ SetFastMethodWithOverLoads(isolate, tmpl, "uniformMatrix4x2fv", UniformMatrix4x2fv,
4339
+ fast_uniform_matrix_4x2fv_overloads_, v8::Local<v8::Value>());
4340
+
4341
+
4342
+ SetFastMethodWithOverLoads(isolate, tmpl, "uniformMatrix4x3fv", UniformMatrix4x3fv,
4343
+ fast_uniform_matrix_4x3fv_overloads_, v8::Local<v8::Value>());
4344
+
4345
+
4346
+ SetFastMethod(isolate, tmpl, "vertexAttribDivisor", VertexAttribDivisor,
4347
+ &fast_vertex_attrib_divisor_, v8::Local<v8::Value>());
4348
+
4349
+
4350
+ SetFastMethod(isolate, tmpl, "vertexAttribI4i", VertexAttribI4i, &fast_vertex_attrib_i_4i_,
4351
+ v8::Local<v8::Value>());
4352
+
4353
+ SetFastMethodWithOverLoads(isolate, tmpl, "vertexAttribI4iv", VertexAttribI4iv,
4354
+ fast_vertex_attrib_i_4iv_overloads_, v8::Local<v8::Value>());
4355
+
4356
+
4357
+ SetFastMethod(isolate, tmpl, "vertexAttribI4ui", VertexAttribI4ui, &fast_vertex_attrib_i_4ui_,
4358
+ v8::Local<v8::Value>());
4359
+
4360
+
4361
+ SetFastMethodWithOverLoads(isolate, tmpl, "vertexAttribI4uiv", VertexAttribI4uiv,
4362
+ fast_vertex_attrib_i_4uiv_overloads_, v8::Local<v8::Value>());
4363
+
4364
+
4365
+ tmpl->Set(
4366
+ ConvertToV8String(isolate, "getActiveUniformBlockName"),
4367
+ v8::FunctionTemplate::New(isolate, &GetActiveUniformBlockName)
4368
+ );
4369
+
4370
+ tmpl->Set(
4371
+ ConvertToV8String(isolate, "getActiveUniformBlockParameter"),
4372
+ v8::FunctionTemplate::New(isolate, &GetActiveUniformBlockParameter)
4373
+ );
4374
+
4375
+ tmpl->Set(
4376
+ ConvertToV8String(isolate, "getActiveUniforms"),
4377
+ v8::FunctionTemplate::New(isolate, &GetActiveUniforms)
4378
+ );
4379
+
4380
+ tmpl->Set(
4381
+ ConvertToV8String(isolate, "getBufferSubData"),
4382
+ v8::FunctionTemplate::New(isolate, &GetBufferSubData)
4383
+ );
4384
+
4385
+
4386
+ tmpl->Set(
4387
+ ConvertToV8String(isolate, "getFragDataLocation"),
4388
+ v8::FunctionTemplate::New(isolate, &GetFragDataLocation)
4389
+ );
4390
+
4391
+
4392
+ tmpl->Set(
4393
+ ConvertToV8String(isolate, "getIndexedParameter"),
4394
+ v8::FunctionTemplate::New(isolate, &GetIndexedParameter)
4395
+ );
4396
+
4397
+ tmpl->Set(
4398
+ ConvertToV8String(isolate, "getInternalformatParameter"),
4399
+ v8::FunctionTemplate::New(isolate, &GetInternalformatParameter)
4400
+ );
4401
+
4402
+ tmpl->Set(
4403
+ ConvertToV8String(isolate, "getParameter"),
4404
+ v8::FunctionTemplate::New(isolate, &GetParameter)
4405
+ );
4406
+
4407
+ tmpl->Set(
4408
+ ConvertToV8String(isolate, "getQueryParameter"),
4409
+ v8::FunctionTemplate::New(isolate, &GetQueryParameter)
4410
+ );
4411
+
4412
+
4413
+ tmpl->Set(
4414
+ ConvertToV8String(isolate, "getQuery"),
4415
+ v8::FunctionTemplate::New(isolate, &GetQuery)
4416
+ );
4417
+
4418
+ tmpl->Set(
4419
+ ConvertToV8String(isolate, "getSamplerParameter"),
4420
+ v8::FunctionTemplate::New(isolate, &GetSamplerParameter)
4421
+ );
4422
+
4423
+ tmpl->Set(
4424
+ ConvertToV8String(isolate, "getSyncParameter"),
4425
+ v8::FunctionTemplate::New(isolate, &GetSyncParameter)
4426
+ );
4427
+
4428
+ tmpl->Set(
4429
+ ConvertToV8String(isolate, "getTransformFeedbackVarying"),
4430
+ v8::FunctionTemplate::New(isolate, &GetTransformFeedbackVarying)
4431
+ );
4432
+
4433
+ tmpl->Set(
4434
+ ConvertToV8String(isolate, "getUniformBlockIndex"),
4435
+ v8::FunctionTemplate::New(isolate, &GetUniformBlockIndex)
4436
+ );
4437
+
4438
+ tmpl->Set(
4439
+ ConvertToV8String(isolate, "getUniformIndices"),
4440
+ v8::FunctionTemplate::New(isolate, &GetUniformIndices)
4441
+ );
4442
+
4443
+ SetFastMethod(isolate, tmpl, "invalidateFramebuffer", InvalidateFramebuffer,
4444
+ &fast_invalidate_framebuffer_, v8::Local<v8::Value>());
4445
+
4446
+
4447
+ SetFastMethod(isolate, tmpl, "invalidateSubFramebuffer", InvalidateSubFramebuffer,
4448
+ &fast_invalidate_sub_framebuffer_, v8::Local<v8::Value>());
4449
+
4450
+
4451
+ tmpl->Set(
4452
+ ConvertToV8String(isolate, "isQuery"),
4453
+ v8::FunctionTemplate::New(isolate, &IsQuery)
4454
+ );
4455
+
4456
+ tmpl->Set(
4457
+ ConvertToV8String(isolate, "isSampler"),
4458
+ v8::FunctionTemplate::New(isolate, &IsSampler)
4459
+ );
4460
+
4461
+ tmpl->Set(
4462
+ ConvertToV8String(isolate, "isSync"),
4463
+ v8::FunctionTemplate::New(isolate, &IsSync)
4464
+ );
4465
+
4466
+ tmpl->Set(
4467
+ ConvertToV8String(isolate, "isTransformFeedback"),
4468
+ v8::FunctionTemplate::New(isolate, &IsTransformFeedback)
4469
+ );
4470
+
4471
+ tmpl->Set(
4472
+ ConvertToV8String(isolate, "isVertexArray"),
4473
+ v8::FunctionTemplate::New(isolate, &IsVertexArray)
4474
+ );
4475
+
4476
+
4477
+ tmpl->Set(
4478
+ ConvertToV8String(isolate, "pauseTransformFeedback"),
4479
+ v8::FunctionTemplate::New(isolate, &PauseTransformFeedback)
4480
+ );
4481
+
4482
+ tmpl->Set(
4483
+ ConvertToV8String(isolate, "readBuffer"),
4484
+ v8::FunctionTemplate::New(isolate, &ReadBuffer)
4485
+ );
4486
+
4487
+ tmpl->Set(
4488
+ ConvertToV8String(isolate, "renderbufferStorageMultisample"),
4489
+ v8::FunctionTemplate::New(isolate, &RenderbufferStorageMultisample)
4490
+ );
4491
+
4492
+
4493
+ SetFastMethod(isolate, tmpl, "resumeTransformFeedback", ResumeTransformFeedback,
4494
+ &fast_resume_transform_feedback_, v8::Local<v8::Value>());
4495
+
4496
+ SetFastMethod(isolate, tmpl, "samplerParameterf", SamplerParameterf, &fast_sampler_parameterf_,
4497
+ v8::Local<v8::Value>());
4498
+
4499
+ SetFastMethod(isolate, tmpl, "samplerParameteri", SamplerParameteri, &fast_sampler_parameteri_,
4500
+ v8::Local<v8::Value>());
4501
+
4502
+
4503
+ tmpl->Set(
4504
+ ConvertToV8String(isolate, "texImage3D"),
4505
+ v8::FunctionTemplate::New(isolate, &TexImage3D)
4506
+ );
4507
+
4508
+
4509
+ tmpl->Set(
4510
+ ConvertToV8String(isolate, "texStorage2D"),
4511
+ v8::FunctionTemplate::New(isolate, &TexStorage2D)
4512
+ );
4513
+
4514
+ tmpl->Set(
4515
+ ConvertToV8String(isolate, "texStorage3D"),
4516
+ v8::FunctionTemplate::New(isolate, &TexStorage3D)
4517
+ );
4518
+
4519
+ tmpl->Set(
4520
+ ConvertToV8String(isolate, "texSubImage3D"),
4521
+ v8::FunctionTemplate::New(isolate, &TexSubImage3D)
4522
+ );
4523
+
4524
+ tmpl->Set(
4525
+ ConvertToV8String(isolate, "transformFeedbackVaryings"),
4526
+ v8::FunctionTemplate::New(isolate, &TransformFeedbackVaryings)
4527
+ );
4528
+ }
4529
+
4530
+ void WebGL2RenderingContext::SetProps(v8::Isolate *isolate,
4531
+ const v8::Local<v8::ObjectTemplate> &webgl2RenderingContextTpl) {
4532
+
4533
+ }