@nativescript/canvas 2.0.0-beta.9 → 2.0.0-webgpu.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (285) hide show
  1. package/Canvas/common.d.ts +23 -15
  2. package/Canvas/common.js +125 -56
  3. package/Canvas/common.js.map +1 -1
  4. package/Canvas/index.android.d.ts +5 -7
  5. package/Canvas/index.android.js +61 -133
  6. package/Canvas/index.android.js.map +1 -1
  7. package/Canvas/index.d.ts +4 -1
  8. package/Canvas/index.ios.d.ts +4 -5
  9. package/Canvas/index.ios.js +72 -82
  10. package/Canvas/index.ios.js.map +1 -1
  11. package/Canvas2D/CanvasRenderingContext2D/index.d.ts +1 -1
  12. package/Canvas2D/CanvasRenderingContext2D/index.js +8 -11
  13. package/Canvas2D/CanvasRenderingContext2D/index.js.map +1 -1
  14. package/Canvas2D/DOMMatrix/index.d.ts +14 -0
  15. package/Canvas2D/DOMMatrix/index.js +62 -0
  16. package/Canvas2D/DOMMatrix/index.js.map +1 -1
  17. package/Canvas2D/ImageData/index.js +4 -6
  18. package/Canvas2D/ImageData/index.js.map +1 -1
  19. package/ImageAsset/index.d.ts +1 -0
  20. package/ImageAsset/index.js +49 -0
  21. package/ImageAsset/index.js.map +1 -1
  22. package/WebGL/WebGLRenderingContext/index.d.ts +1 -0
  23. package/WebGL/WebGLRenderingContext/index.js +86 -32
  24. package/WebGL/WebGLRenderingContext/index.js.map +1 -1
  25. package/WebGL2/WebGL2RenderingContext/index.d.ts +1 -0
  26. package/WebGL2/WebGL2RenderingContext/index.js +2 -3
  27. package/WebGL2/WebGL2RenderingContext/index.js.map +1 -1
  28. package/WebGPU/Constants.d.ts +36 -0
  29. package/WebGPU/Constants.js +42 -0
  30. package/WebGPU/Constants.js.map +1 -0
  31. package/WebGPU/Errors.d.ts +18 -0
  32. package/WebGPU/Errors.js +21 -0
  33. package/WebGPU/Errors.js.map +1 -0
  34. package/WebGPU/GPU.d.ts +13 -0
  35. package/WebGPU/GPU.js +35 -0
  36. package/WebGPU/GPU.js.map +1 -0
  37. package/WebGPU/GPUAdapter.d.ts +23 -0
  38. package/WebGPU/GPUAdapter.js +62 -0
  39. package/WebGPU/GPUAdapter.js.map +1 -0
  40. package/WebGPU/GPUAdapterInfo.d.ts +9 -0
  41. package/WebGPU/GPUAdapterInfo.js +24 -0
  42. package/WebGPU/GPUAdapterInfo.js.map +1 -0
  43. package/WebGPU/GPUBindGroup.d.ts +5 -0
  44. package/WebGPU/GPUBindGroup.js +12 -0
  45. package/WebGPU/GPUBindGroup.js.map +1 -0
  46. package/WebGPU/GPUBindGroupLayout.d.ts +5 -0
  47. package/WebGPU/GPUBindGroupLayout.js +12 -0
  48. package/WebGPU/GPUBindGroupLayout.js.map +1 -0
  49. package/WebGPU/GPUBuffer.d.ts +15 -0
  50. package/WebGPU/GPUBuffer.js +54 -0
  51. package/WebGPU/GPUBuffer.js.map +1 -0
  52. package/WebGPU/GPUCanvasContext.d.ts +33 -0
  53. package/WebGPU/GPUCanvasContext.js +67 -0
  54. package/WebGPU/GPUCanvasContext.js.map +1 -0
  55. package/WebGPU/GPUCommandBuffer.d.ts +5 -0
  56. package/WebGPU/GPUCommandBuffer.js +12 -0
  57. package/WebGPU/GPUCommandBuffer.js.map +1 -0
  58. package/WebGPU/GPUCommandEncoder.d.ts +41 -0
  59. package/WebGPU/GPUCommandEncoder.js +105 -0
  60. package/WebGPU/GPUCommandEncoder.js.map +1 -0
  61. package/WebGPU/GPUComputePassEncoder.d.ts +16 -0
  62. package/WebGPU/GPUComputePassEncoder.js +50 -0
  63. package/WebGPU/GPUComputePassEncoder.js.map +1 -0
  64. package/WebGPU/GPUComputePipeline.d.ts +7 -0
  65. package/WebGPU/GPUComputePipeline.js +16 -0
  66. package/WebGPU/GPUComputePipeline.js.map +1 -0
  67. package/WebGPU/GPUDevice.d.ts +173 -0
  68. package/WebGPU/GPUDevice.js +381 -0
  69. package/WebGPU/GPUDevice.js.map +1 -0
  70. package/WebGPU/GPUDeviceLostInfo.d.ts +1 -0
  71. package/WebGPU/GPUDeviceLostInfo.js +10 -0
  72. package/WebGPU/GPUDeviceLostInfo.js.map +1 -0
  73. package/WebGPU/GPUExternalTexture.d.ts +5 -0
  74. package/WebGPU/GPUExternalTexture.js +12 -0
  75. package/WebGPU/GPUExternalTexture.js.map +1 -0
  76. package/WebGPU/GPUPipelineLayout.d.ts +5 -0
  77. package/WebGPU/GPUPipelineLayout.js +12 -0
  78. package/WebGPU/GPUPipelineLayout.js.map +1 -0
  79. package/WebGPU/GPUQuerySet.d.ts +5 -0
  80. package/WebGPU/GPUQuerySet.js +12 -0
  81. package/WebGPU/GPUQuerySet.js.map +1 -0
  82. package/WebGPU/GPUQueue.d.ts +14 -0
  83. package/WebGPU/GPUQueue.js +77 -0
  84. package/WebGPU/GPUQueue.js.map +1 -0
  85. package/WebGPU/GPURenderBundle.d.ts +5 -0
  86. package/WebGPU/GPURenderBundle.js +12 -0
  87. package/WebGPU/GPURenderBundle.js.map +1 -0
  88. package/WebGPU/GPURenderBundleEncoder.d.ts +20 -0
  89. package/WebGPU/GPURenderBundleEncoder.js +61 -0
  90. package/WebGPU/GPURenderBundleEncoder.js.map +1 -0
  91. package/WebGPU/GPURenderPassEncoder.d.ts +29 -0
  92. package/WebGPU/GPURenderPassEncoder.js +94 -0
  93. package/WebGPU/GPURenderPassEncoder.js.map +1 -0
  94. package/WebGPU/GPURenderPipeline.d.ts +7 -0
  95. package/WebGPU/GPURenderPipeline.js +16 -0
  96. package/WebGPU/GPURenderPipeline.js.map +1 -0
  97. package/WebGPU/GPUSampler.d.ts +5 -0
  98. package/WebGPU/GPUSampler.js +12 -0
  99. package/WebGPU/GPUSampler.js.map +1 -0
  100. package/WebGPU/GPUShaderModule.d.ts +6 -0
  101. package/WebGPU/GPUShaderModule.js +15 -0
  102. package/WebGPU/GPUShaderModule.js.map +1 -0
  103. package/WebGPU/GPUTexture.d.ts +16 -0
  104. package/WebGPU/GPUTexture.js +41 -0
  105. package/WebGPU/GPUTexture.js.map +1 -0
  106. package/WebGPU/GPUTextureView.d.ts +5 -0
  107. package/WebGPU/GPUTextureView.js +12 -0
  108. package/WebGPU/GPUTextureView.js.map +1 -0
  109. package/WebGPU/Interfaces.d.ts +155 -0
  110. package/WebGPU/Interfaces.js +2 -0
  111. package/WebGPU/Interfaces.js.map +1 -0
  112. package/WebGPU/Types.d.ts +39 -0
  113. package/WebGPU/Types.js +2 -0
  114. package/WebGPU/Types.js.map +1 -0
  115. package/WebGPU/Utils.d.ts +1 -0
  116. package/WebGPU/Utils.js +75 -0
  117. package/WebGPU/Utils.js.map +1 -0
  118. package/WebGPU/index.d.ts +28 -0
  119. package/WebGPU/index.js +29 -0
  120. package/WebGPU/index.js.map +1 -0
  121. package/index.d.ts +1 -1
  122. package/index.js +22 -1
  123. package/index.js.map +1 -1
  124. package/package.json +1 -4
  125. package/platforms/android/canvas-release.aar +0 -0
  126. package/platforms/ios/CanvasNative.xcframework/Info.plist +5 -5
  127. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/CanvasNative +0 -0
  128. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Headers/CanvasNative-Swift.h +23 -23
  129. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Headers/canvas_ios.h +41 -8
  130. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Headers/canvas_native.h +2280 -103
  131. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Info.plist +0 -0
  132. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/CanvasNative.swiftmodule/Project/arm64-apple-ios.swiftsourceinfo +0 -0
  133. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios.abi.json +1563 -3729
  134. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios.private.swiftinterface +27 -34
  135. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
  136. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios.swiftinterface +27 -34
  137. package/platforms/ios/CanvasNative.xcframework/ios-arm64/dSYMs/CanvasNative.framework.dSYM/Contents/Resources/DWARF/CanvasNative +0 -0
  138. package/platforms/ios/CanvasNative.xcframework/ios-arm64/dSYMs/CanvasNative.framework.dSYM/Contents/Resources/Relocations/aarch64/CanvasNative.yml +602 -663
  139. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/CanvasNative +0 -0
  140. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Headers/CanvasNative-Swift.h +46 -46
  141. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Headers/canvas_ios.h +41 -8
  142. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Headers/canvas_native.h +2280 -103
  143. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Info.plist +0 -0
  144. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/Project/arm64-apple-ios-simulator.swiftsourceinfo +0 -0
  145. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/Project/x86_64-apple-ios-simulator.swiftsourceinfo +0 -0
  146. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios-simulator.abi.json +1563 -3729
  147. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +27 -34
  148. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
  149. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios-simulator.swiftinterface +27 -34
  150. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.abi.json +1563 -3729
  151. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +27 -34
  152. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
  153. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +27 -34
  154. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/_CodeSignature/CodeResources +31 -31
  155. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/dSYMs/CanvasNative.framework.dSYM/Contents/Resources/DWARF/CanvasNative +0 -0
  156. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/dSYMs/CanvasNative.framework.dSYM/Contents/Resources/Relocations/aarch64/CanvasNative.yml +604 -662
  157. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/dSYMs/CanvasNative.framework.dSYM/Contents/Resources/Relocations/x86_64/CanvasNative.yml +638 -641
  158. package/platforms/ios/build.xcconfig +3 -1
  159. package/platforms/ios/src/cpp/Caches.h +69 -1
  160. package/platforms/ios/src/cpp/CanvasJSIModule.cpp +320 -395
  161. package/platforms/ios/src/cpp/CanvasJSIModule.h +7 -1
  162. package/platforms/ios/src/cpp/Helpers.h +43 -8
  163. package/platforms/ios/src/cpp/ImageAssetImpl.cpp +35 -37
  164. package/platforms/ios/src/cpp/ImageAssetImpl.h +14 -10
  165. package/platforms/ios/src/cpp/ImageBitmapImpl.cpp +2 -2
  166. package/platforms/ios/src/cpp/ImageBitmapImpl.h +1 -1
  167. package/platforms/ios/src/cpp/canvas2d/CanvasPattern.cpp +0 -10
  168. package/platforms/ios/src/cpp/canvas2d/CanvasRenderingContext2DImpl.cpp +41 -4
  169. package/platforms/ios/src/cpp/canvas2d/MatrixImpl.cpp +409 -3
  170. package/platforms/ios/src/cpp/canvas2d/MatrixImpl.h +27 -0
  171. package/platforms/ios/src/cpp/webgl/WebGLRenderingContext.cpp +131 -149
  172. package/platforms/ios/src/cpp/webgl2/WebGL2RenderingContext.cpp +1766 -1659
  173. package/platforms/ios/src/cpp/webgpu/GPUAdapterImpl.cpp +302 -0
  174. package/platforms/ios/src/cpp/webgpu/GPUAdapterImpl.h +63 -0
  175. package/platforms/ios/src/cpp/webgpu/GPUAdapterInfoImpl.cpp +174 -0
  176. package/platforms/ios/src/cpp/webgpu/GPUAdapterInfoImpl.h +58 -0
  177. package/platforms/ios/src/cpp/webgpu/GPUBindGroupImpl.cpp +53 -0
  178. package/platforms/ios/src/cpp/webgpu/GPUBindGroupImpl.h +45 -0
  179. package/platforms/ios/src/cpp/webgpu/GPUBindGroupLayoutImpl.cpp +53 -0
  180. package/platforms/ios/src/cpp/webgpu/GPUBindGroupLayoutImpl.h +45 -0
  181. package/platforms/ios/src/cpp/webgpu/GPUBufferImpl.cpp +229 -0
  182. package/platforms/ios/src/cpp/webgpu/GPUBufferImpl.h +59 -0
  183. package/platforms/ios/src/cpp/webgpu/GPUCanvasContextImpl.cpp +317 -0
  184. package/platforms/ios/src/cpp/webgpu/GPUCanvasContextImpl.h +55 -0
  185. package/platforms/ios/src/cpp/webgpu/GPUCommandBufferImpl.cpp +54 -0
  186. package/platforms/ios/src/cpp/webgpu/GPUCommandBufferImpl.h +45 -0
  187. package/platforms/ios/src/cpp/webgpu/GPUCommandEncoderImpl.cpp +1087 -0
  188. package/platforms/ios/src/cpp/webgpu/GPUCommandEncoderImpl.h +69 -0
  189. package/platforms/ios/src/cpp/webgpu/GPUComputePassEncoderImpl.cpp +260 -0
  190. package/platforms/ios/src/cpp/webgpu/GPUComputePassEncoderImpl.h +62 -0
  191. package/platforms/ios/src/cpp/webgpu/GPUComputePipelineImpl.cpp +84 -0
  192. package/platforms/ios/src/cpp/webgpu/GPUComputePipelineImpl.h +49 -0
  193. package/platforms/ios/src/cpp/webgpu/GPUDeviceImpl.cpp +2741 -0
  194. package/platforms/ios/src/cpp/webgpu/GPUDeviceImpl.h +95 -0
  195. package/platforms/ios/src/cpp/webgpu/GPUImpl.cpp +186 -0
  196. package/platforms/ios/src/cpp/webgpu/GPUImpl.h +55 -0
  197. package/platforms/ios/src/cpp/webgpu/GPUPipelineLayoutImpl.cpp +54 -0
  198. package/platforms/ios/src/cpp/webgpu/GPUPipelineLayoutImpl.h +46 -0
  199. package/platforms/ios/src/cpp/webgpu/GPUQuerySetImpl.cpp +137 -0
  200. package/platforms/ios/src/cpp/webgpu/GPUQuerySetImpl.h +55 -0
  201. package/platforms/ios/src/cpp/webgpu/GPUQueueImpl.cpp +521 -0
  202. package/platforms/ios/src/cpp/webgpu/GPUQueueImpl.h +56 -0
  203. package/platforms/ios/src/cpp/webgpu/GPURenderBundleEncoderImpl.cpp +469 -0
  204. package/platforms/ios/src/cpp/webgpu/GPURenderBundleEncoderImpl.h +71 -0
  205. package/platforms/ios/src/cpp/webgpu/GPURenderBundleImpl.cpp +53 -0
  206. package/platforms/ios/src/cpp/webgpu/GPURenderBundleImpl.h +45 -0
  207. package/platforms/ios/src/cpp/webgpu/GPURenderPassEncoderImpl.cpp +653 -0
  208. package/platforms/ios/src/cpp/webgpu/GPURenderPassEncoderImpl.h +85 -0
  209. package/platforms/ios/src/cpp/webgpu/GPURenderPipelineImpl.cpp +84 -0
  210. package/platforms/ios/src/cpp/webgpu/GPURenderPipelineImpl.h +49 -0
  211. package/platforms/ios/src/cpp/webgpu/GPUSamplerImpl.cpp +53 -0
  212. package/platforms/ios/src/cpp/webgpu/GPUSamplerImpl.h +45 -0
  213. package/platforms/ios/src/cpp/webgpu/GPUShaderModuleImpl.cpp +56 -0
  214. package/platforms/ios/src/cpp/webgpu/GPUShaderModuleImpl.h +45 -0
  215. package/platforms/ios/src/cpp/webgpu/GPUSupportedLimitsImpl.cpp +1304 -0
  216. package/platforms/ios/src/cpp/webgpu/GPUSupportedLimitsImpl.h +288 -0
  217. package/platforms/ios/src/cpp/webgpu/GPUTextureImpl.cpp +360 -0
  218. package/platforms/ios/src/cpp/webgpu/GPUTextureImpl.h +75 -0
  219. package/platforms/ios/src/cpp/webgpu/GPUTextureViewImpl.cpp +53 -0
  220. package/platforms/ios/src/cpp/webgpu/GPUTextureViewImpl.h +45 -0
  221. package/platforms/ios/src/cpp/webgpu/GPUUtils.h +178 -0
  222. package/SVG/Circle.d.ts +0 -11
  223. package/SVG/Circle.js +0 -21
  224. package/SVG/Circle.js.map +0 -1
  225. package/SVG/ClipPath.d.ts +0 -4
  226. package/SVG/ClipPath.js +0 -9
  227. package/SVG/ClipPath.js.map +0 -1
  228. package/SVG/Defs.d.ts +0 -4
  229. package/SVG/Defs.js +0 -9
  230. package/SVG/Defs.js.map +0 -1
  231. package/SVG/Ellipse.d.ts +0 -13
  232. package/SVG/Ellipse.js +0 -26
  233. package/SVG/Ellipse.js.map +0 -1
  234. package/SVG/G.d.ts +0 -7
  235. package/SVG/G.js +0 -9
  236. package/SVG/G.js.map +0 -1
  237. package/SVG/Image.d.ts +0 -11
  238. package/SVG/Image.js +0 -40
  239. package/SVG/Image.js.map +0 -1
  240. package/SVG/Line.d.ts +0 -13
  241. package/SVG/Line.js +0 -26
  242. package/SVG/Line.js.map +0 -1
  243. package/SVG/LinearGradient.d.ts +0 -10
  244. package/SVG/LinearGradient.js +0 -13
  245. package/SVG/LinearGradient.js.map +0 -1
  246. package/SVG/Path.d.ts +0 -7
  247. package/SVG/Path.js +0 -14
  248. package/SVG/Path.js.map +0 -1
  249. package/SVG/Pattern.d.ts +0 -4
  250. package/SVG/Pattern.js +0 -9
  251. package/SVG/Pattern.js.map +0 -1
  252. package/SVG/Polygon.d.ts +0 -7
  253. package/SVG/Polygon.js +0 -14
  254. package/SVG/Polygon.js.map +0 -1
  255. package/SVG/Polyline.d.ts +0 -7
  256. package/SVG/Polyline.js +0 -14
  257. package/SVG/Polyline.js.map +0 -1
  258. package/SVG/Rect.d.ts +0 -8
  259. package/SVG/Rect.js +0 -13
  260. package/SVG/Rect.js.map +0 -1
  261. package/SVG/SVG.d.ts +0 -32
  262. package/SVG/SVG.js +0 -204
  263. package/SVG/SVG.js.map +0 -1
  264. package/SVG/SVGItem.d.ts +0 -5
  265. package/SVG/SVGItem.js +0 -8
  266. package/SVG/SVGItem.js.map +0 -1
  267. package/SVG/Stop.d.ts +0 -5
  268. package/SVG/Stop.js +0 -9
  269. package/SVG/Stop.js.map +0 -1
  270. package/SVG/Symbol.d.ts +0 -4
  271. package/SVG/Symbol.js +0 -9
  272. package/SVG/Symbol.js.map +0 -1
  273. package/SVG/Text.d.ts +0 -14
  274. package/SVG/Text.js +0 -26
  275. package/SVG/Text.js.map +0 -1
  276. package/SVG/Use.d.ts +0 -4
  277. package/SVG/Use.js +0 -9
  278. package/SVG/Use.js.map +0 -1
  279. package/SVG/index.d.ts +0 -18
  280. package/SVG/index.js +0 -19
  281. package/SVG/index.js.map +0 -1
  282. package/platforms/ios/src/cpp/PerIsolateData.cpp +0 -49
  283. package/platforms/ios/src/cpp/PerIsolateData.h +0 -54
  284. package/platforms/ios/src/cpp/URLImpl.cpp +0 -464
  285. package/platforms/ios/src/cpp/URLImpl.h +0 -121
@@ -0,0 +1,1304 @@
1
+ //
2
+ // Created by Osei Fortune on 17/06/2024.
3
+ //
4
+
5
+ #include "GPUSupportedLimitsImpl.h"
6
+ #include "Caches.h"
7
+
8
+ GPUSupportedLimitsImpl::GPUSupportedLimitsImpl(CanvasGPUSupportedLimits *limits) : limits_(
9
+ limits) {}
10
+
11
+ CanvasGPUSupportedLimits *GPUSupportedLimitsImpl::GetLimits() {
12
+ return this->limits_;
13
+ }
14
+
15
+
16
+ void GPUSupportedLimitsImpl::Init(v8::Local<v8::Object> canvasModule, v8::Isolate *isolate) {
17
+ v8::Locker locker(isolate);
18
+ v8::Isolate::Scope isolate_scope(isolate);
19
+ v8::HandleScope handle_scope(isolate);
20
+
21
+ auto ctor = GetCtor(isolate);
22
+ auto context = isolate->GetCurrentContext();
23
+ auto func = ctor->GetFunction(context).ToLocalChecked();
24
+
25
+ canvasModule->Set(context, ConvertToV8String(isolate, "GPUSupportedLimits"), func).FromJust();;
26
+ }
27
+
28
+ GPUSupportedLimitsImpl *GPUSupportedLimitsImpl::GetPointer(v8::Local<v8::Object> object) {
29
+ auto ptr = object->GetAlignedPointerFromInternalField(0);
30
+ if (ptr == nullptr) {
31
+ return nullptr;
32
+ }
33
+ return static_cast<GPUSupportedLimitsImpl *>(ptr);
34
+ }
35
+
36
+ v8::Local<v8::FunctionTemplate> GPUSupportedLimitsImpl::GetCtor(v8::Isolate *isolate) {
37
+ auto cache = Caches::Get(isolate);
38
+ auto ctor = cache->GPUSupportedLimitsTmpl.get();
39
+ if (ctor != nullptr) {
40
+ return ctor->Get(isolate);
41
+ }
42
+
43
+ v8::Local<v8::FunctionTemplate> ctorTmpl = v8::FunctionTemplate::New(isolate, Ctor);
44
+ ctorTmpl->InstanceTemplate()->SetInternalFieldCount(2);
45
+ ctorTmpl->SetClassName(ConvertToV8String(isolate, "GPUSupportedLimits"));
46
+
47
+ auto tmpl = ctorTmpl->InstanceTemplate();
48
+ tmpl->SetInternalFieldCount(2);
49
+
50
+ tmpl->SetAccessor(
51
+ ConvertToV8String(isolate, "maxTextureDimension1D"),
52
+ GetMaxTextureDimension1D,
53
+ SetMaxTextureDimension1D
54
+ );
55
+
56
+ tmpl->SetAccessor(
57
+ ConvertToV8String(isolate, "maxTextureDimension2D"),
58
+ GetMaxTextureDimension2D,
59
+ SetMaxTextureDimension2D
60
+ );
61
+
62
+ tmpl->SetAccessor(
63
+ ConvertToV8String(isolate, "maxTextureDimension3D"),
64
+ GetMaxTextureDimension3D,
65
+ SetMaxTextureDimension3D
66
+ );
67
+
68
+ tmpl->SetAccessor(
69
+ ConvertToV8String(isolate, "maxTextureArrayLayers"),
70
+ GetMaxTextureArrayLayers,
71
+ SetMaxTextureArrayLayers
72
+ );
73
+
74
+ tmpl->SetAccessor(
75
+ ConvertToV8String(isolate, "maxBindGroups"),
76
+ GetMaxBindGroups,
77
+ SetMaxBindGroups
78
+ );
79
+
80
+ tmpl->SetAccessor(
81
+ ConvertToV8String(isolate, "maxBindingsPerBindGroup"),
82
+ GetMaxBindingsPerBindGroup,
83
+ SetMaxBindingsPerBindGroup
84
+ );
85
+
86
+ tmpl->SetAccessor(
87
+ ConvertToV8String(isolate, "maxDynamicUniformBuffersPerPipelineLayout"),
88
+ GetMaxDynamicUniformBuffersPerPipelineLayout,
89
+ SetMaxDynamicUniformBuffersPerPipelineLayout
90
+ );
91
+
92
+
93
+ tmpl->SetAccessor(
94
+ ConvertToV8String(isolate, "maxDynamicStorageBuffersPerPipelineLayout"),
95
+ GetMaxDynamicStorageBuffersPerPipelineLayout,
96
+ SetMaxDynamicStorageBuffersPerPipelineLayout
97
+ );
98
+
99
+
100
+ tmpl->SetAccessor(
101
+ ConvertToV8String(isolate, "maxSampledTexturesPerShaderStage"),
102
+ GetMaxSampledTexturesPerShaderStage,
103
+ SetMaxSampledTexturesPerShaderStage
104
+ );
105
+
106
+
107
+ tmpl->SetAccessor(
108
+ ConvertToV8String(isolate, "maxSamplersPerShaderStage"),
109
+ GetMaxSamplersPerShaderStage,
110
+ SetMaxSamplersPerShaderStage
111
+ );
112
+
113
+ tmpl->SetAccessor(
114
+ ConvertToV8String(isolate, "maxStorageBuffersPerShaderStage"),
115
+ GetMaxStorageBuffersPerShaderStage,
116
+ SetMaxStorageBuffersPerShaderStage
117
+ );
118
+
119
+
120
+ tmpl->SetAccessor(
121
+ ConvertToV8String(isolate, "maxStorageTexturesPerShaderStage"),
122
+ GetMaxStorageTexturesPerShaderStage,
123
+ SetMaxStorageTexturesPerShaderStage
124
+ );
125
+
126
+
127
+ tmpl->SetAccessor(
128
+ ConvertToV8String(isolate, "maxUniformBuffersPerShaderStage"),
129
+ GetMaxUniformBuffersPerShaderStage,
130
+ SetMaxUniformBuffersPerShaderStage
131
+ );
132
+
133
+ tmpl->SetAccessor(
134
+ ConvertToV8String(isolate, "maxUniformBufferBindingSize"),
135
+ GetMaxUniformBufferBindingSize,
136
+ SetMaxUniformBufferBindingSize
137
+ );
138
+
139
+ tmpl->SetAccessor(
140
+ ConvertToV8String(isolate, "maxStorageBufferBindingSize"),
141
+ GetMaxStorageBufferBindingSize,
142
+ SetMaxStorageBufferBindingSize
143
+ );
144
+
145
+
146
+ tmpl->SetAccessor(
147
+ ConvertToV8String(isolate, "maxVertexBuffers"),
148
+ GetMaxVertexBuffers,
149
+ SetMaxVertexBuffers
150
+ );
151
+
152
+
153
+ tmpl->SetAccessor(
154
+ ConvertToV8String(isolate, "maxBufferSize"),
155
+ GetMaxBufferSize,
156
+ SetMaxBufferSize
157
+ );
158
+
159
+ tmpl->SetAccessor(
160
+ ConvertToV8String(isolate, "maxVertexAttributes"),
161
+ GetMaxVertexAttributes,
162
+ SetMaxVertexAttributes
163
+ );
164
+
165
+ tmpl->SetAccessor(
166
+ ConvertToV8String(isolate, "maxVertexBufferArrayStride"),
167
+ GetMaxVertexBufferArrayStride,
168
+ SetMaxVertexBufferArrayStride
169
+ );
170
+
171
+
172
+ tmpl->SetAccessor(
173
+ ConvertToV8String(isolate, "minUniformBufferOffsetAlignment"),
174
+ GetMinUniformBufferOffsetAlignment,
175
+ SetMinUniformBufferOffsetAlignment
176
+ );
177
+
178
+
179
+ tmpl->SetAccessor(
180
+ ConvertToV8String(isolate, "minStorageBufferOffsetAlignment"),
181
+ GetMinStorageBufferOffsetAlignment,
182
+ SetMinStorageBufferOffsetAlignment
183
+ );
184
+
185
+ tmpl->SetAccessor(
186
+ ConvertToV8String(isolate, "maxInterStageShaderComponents"),
187
+ GetMaxInterStageShaderComponents,
188
+ SetMaxInterStageShaderComponents
189
+ );
190
+
191
+ tmpl->SetAccessor(
192
+ ConvertToV8String(isolate, "maxColorAttachments"),
193
+ GetMaxColorAttachments,
194
+ SetMaxColorAttachments
195
+ );
196
+
197
+ tmpl->SetAccessor(
198
+ ConvertToV8String(isolate, "maxColorAttachmentBytesPerSample"),
199
+ GetMaxColorAttachmentBytesPerSample,
200
+ SetMaxColorAttachmentBytesPerSample
201
+ );
202
+
203
+ tmpl->SetAccessor(
204
+ ConvertToV8String(isolate, "maxComputeWorkgroupStorageSize"),
205
+ GetMaxComputeWorkgroupStorageSize,
206
+ SetMaxComputeWorkgroupStorageSize
207
+ );
208
+
209
+ tmpl->SetAccessor(
210
+ ConvertToV8String(isolate, "maxComputeInvocationsPerWorkgroup"),
211
+ GetMaxComputeInvocationsPerWorkgroup,
212
+ SetMaxComputeInvocationsPerWorkgroup
213
+ );
214
+
215
+ tmpl->SetAccessor(
216
+ ConvertToV8String(isolate, "maxComputeWorkgroupSizeX"),
217
+ GetMaxComputeWorkgroupSizeX,
218
+ SetMaxComputeWorkgroupSizeX
219
+ );
220
+
221
+
222
+ tmpl->SetAccessor(
223
+ ConvertToV8String(isolate, "maxComputeWorkgroupSizeY"),
224
+ GetMaxComputeWorkgroupSizeY,
225
+ SetMaxComputeWorkgroupSizeY
226
+ );
227
+
228
+
229
+ tmpl->SetAccessor(
230
+ ConvertToV8String(isolate, "maxComputeWorkgroupSizeZ"),
231
+ GetMaxComputeWorkgroupSizeZ,
232
+ SetMaxComputeWorkgroupSizeZ
233
+ );
234
+
235
+ tmpl->SetAccessor(
236
+ ConvertToV8String(isolate, "maxComputeWorkgroupsPerDimension"),
237
+ GetMaxComputeWorkgroupsPerDimension,
238
+ SetMaxComputeWorkgroupsPerDimension
239
+ );
240
+
241
+
242
+ tmpl->SetAccessor(
243
+ ConvertToV8String(isolate, "minSubgroupSize"),
244
+ GetMinSubgroupSize,
245
+ SetMinSubgroupSize
246
+ );
247
+
248
+ tmpl->SetAccessor(
249
+ ConvertToV8String(isolate, "maxSubgroupSize"),
250
+ GetMaxSubgroupSize,
251
+ SetMaxSubgroupSize
252
+ );
253
+
254
+
255
+ tmpl->SetAccessor(
256
+ ConvertToV8String(isolate, "maxPushConstantSize"),
257
+ GetMaxPushConstantSize,
258
+ SetMaxPushConstantSize
259
+ );
260
+
261
+
262
+ tmpl->SetAccessor(
263
+ ConvertToV8String(isolate, "maxNonSamplerBindings"),
264
+ GetMaxNonSamplerBindings,
265
+ SetMaxNonSamplerBindings
266
+ );
267
+
268
+
269
+ cache->GPUSupportedLimitsTmpl =
270
+ std::make_unique<v8::Persistent<v8::FunctionTemplate>>(isolate, ctorTmpl);
271
+ return ctorTmpl;
272
+ }
273
+
274
+ void GPUSupportedLimitsImpl::Ctor(const v8::FunctionCallbackInfo<v8::Value> &args) {
275
+ auto isolate = args.GetIsolate();
276
+
277
+ auto ret = args.This();
278
+
279
+ auto limits = canvas_native_webgpu_create_limits();
280
+ auto object = new GPUSupportedLimitsImpl(limits);
281
+
282
+ ret->SetAlignedPointerInInternalField(0, object);
283
+
284
+ SetNativeType(ret, NativeType::GPUSupportedLimits);
285
+
286
+ object->BindFinalizer(isolate, ret);
287
+
288
+ args.GetReturnValue().Set(ret);
289
+ return;
290
+ }
291
+
292
+ void GPUSupportedLimitsImpl::GetMaxTextureDimension1D(v8::Local<v8::String> property,
293
+ const v8::PropertyCallbackInfo<v8::Value> &info) {
294
+ GPUSupportedLimitsImpl *ptr = GetPointer(info.This());
295
+ if (ptr == nullptr) {
296
+ // return default ??
297
+ info.GetReturnValue().Set(8192);
298
+ return;
299
+ }
300
+
301
+ auto limits = ptr->GetLimits();
302
+
303
+ info.GetReturnValue().Set(limits->max_texture_dimension_1d);
304
+ }
305
+
306
+
307
+ void GPUSupportedLimitsImpl::SetMaxTextureDimension1D(v8::Local<v8::String> property,
308
+ v8::Local<v8::Value> value,
309
+ const v8::PropertyCallbackInfo<void> &info) {
310
+ GPUSupportedLimitsImpl *ptr = GetPointer(info.This());
311
+ if (ptr == nullptr) {
312
+ return;
313
+ }
314
+ auto isolate = info.GetIsolate();
315
+ auto context = isolate->GetCurrentContext();
316
+ if (value->IsInt32()) {
317
+ ptr->limits_->max_texture_dimension_1d = value->Int32Value(context).ToChecked();
318
+ }
319
+ }
320
+
321
+ void GPUSupportedLimitsImpl::GetMaxTextureDimension2D(v8::Local<v8::String> property,
322
+ const v8::PropertyCallbackInfo<v8::Value> &info) {
323
+ GPUSupportedLimitsImpl *ptr = GetPointer(info.This());
324
+ if (ptr == nullptr) {
325
+ // return default ??
326
+ info.GetReturnValue().Set(8192);
327
+ return;
328
+ }
329
+
330
+ auto limits = ptr->GetLimits();
331
+
332
+ info.GetReturnValue().Set(limits->max_texture_dimension_2d);
333
+ }
334
+
335
+
336
+ void GPUSupportedLimitsImpl::SetMaxTextureDimension2D(v8::Local<v8::String> property,
337
+ v8::Local<v8::Value> value,
338
+ const v8::PropertyCallbackInfo<void> &info) {
339
+ GPUSupportedLimitsImpl *ptr = GetPointer(info.This());
340
+ if (ptr == nullptr) {
341
+ return;
342
+ }
343
+ auto isolate = info.GetIsolate();
344
+ auto context = isolate->GetCurrentContext();
345
+ if (value->IsInt32()) {
346
+ ptr->limits_->max_texture_dimension_2d = value->Int32Value(context).ToChecked();
347
+ }
348
+ }
349
+
350
+ void GPUSupportedLimitsImpl::GetMaxTextureDimension3D(v8::Local<v8::String> property,
351
+ const v8::PropertyCallbackInfo<v8::Value> &info) {
352
+ GPUSupportedLimitsImpl *ptr = GetPointer(info.This());
353
+ if (ptr == nullptr) {
354
+ // return default ??
355
+ info.GetReturnValue().Set(2048);
356
+ return;
357
+ }
358
+
359
+ auto limits = ptr->GetLimits();
360
+
361
+ info.GetReturnValue().Set(limits->max_texture_dimension_3d);
362
+ }
363
+
364
+ void GPUSupportedLimitsImpl::SetMaxTextureDimension3D(v8::Local<v8::String> property,
365
+ v8::Local<v8::Value> value,
366
+ const v8::PropertyCallbackInfo<void> &info) {
367
+ GPUSupportedLimitsImpl *ptr = GetPointer(info.This());
368
+ if (ptr == nullptr) {
369
+ return;
370
+ }
371
+ auto isolate = info.GetIsolate();
372
+ auto context = isolate->GetCurrentContext();
373
+ if (value->IsInt32()) {
374
+ ptr->limits_->max_texture_dimension_3d = value->Int32Value(context).ToChecked();
375
+ }
376
+ }
377
+
378
+ void GPUSupportedLimitsImpl::GetMaxTextureArrayLayers(v8::Local<v8::String> property,
379
+ const v8::PropertyCallbackInfo<v8::Value> &info) {
380
+ GPUSupportedLimitsImpl *ptr = GetPointer(info.This());
381
+ if (ptr == nullptr) {
382
+ // return default ??
383
+ info.GetReturnValue().Set(256);
384
+ return;
385
+ }
386
+
387
+ auto limits = ptr->GetLimits();
388
+
389
+ info.GetReturnValue().Set(limits->max_texture_array_layers);
390
+ }
391
+
392
+
393
+ void GPUSupportedLimitsImpl::SetMaxTextureArrayLayers(v8::Local<v8::String> property,
394
+ v8::Local<v8::Value> value,
395
+ const v8::PropertyCallbackInfo<void> &info) {
396
+ GPUSupportedLimitsImpl *ptr = GetPointer(info.This());
397
+ if (ptr == nullptr) {
398
+ return;
399
+ }
400
+ auto isolate = info.GetIsolate();
401
+ auto context = isolate->GetCurrentContext();
402
+ if (value->IsInt32()) {
403
+ ptr->limits_->max_texture_array_layers = value->Int32Value(context).ToChecked();
404
+ }
405
+ }
406
+
407
+ void GPUSupportedLimitsImpl::GetMaxBindGroups(v8::Local<v8::String> property,
408
+ const v8::PropertyCallbackInfo<v8::Value> &info) {
409
+ GPUSupportedLimitsImpl *ptr = GetPointer(info.This());
410
+ if (ptr == nullptr) {
411
+ // return default ??
412
+ info.GetReturnValue().Set(4);
413
+ return;
414
+ }
415
+
416
+ auto limits = ptr->GetLimits();
417
+
418
+ info.GetReturnValue().Set(limits->max_bind_groups);
419
+ }
420
+
421
+
422
+ void GPUSupportedLimitsImpl::SetMaxBindGroups(v8::Local<v8::String> property,
423
+ v8::Local<v8::Value> value,
424
+ const v8::PropertyCallbackInfo<void> &info) {
425
+ GPUSupportedLimitsImpl *ptr = GetPointer(info.This());
426
+ if (ptr == nullptr) {
427
+ return;
428
+ }
429
+ auto isolate = info.GetIsolate();
430
+ auto context = isolate->GetCurrentContext();
431
+ if (value->IsInt32()) {
432
+ ptr->limits_->max_bind_groups = value->Int32Value(context).ToChecked();
433
+ }
434
+ }
435
+
436
+ void GPUSupportedLimitsImpl::GetMaxBindingsPerBindGroup(v8::Local<v8::String> property,
437
+ const v8::PropertyCallbackInfo<v8::Value> &info) {
438
+ GPUSupportedLimitsImpl *ptr = GetPointer(info.This());
439
+ if (ptr == nullptr) {
440
+ // return default ??
441
+ info.GetReturnValue().Set(1000);
442
+ return;
443
+ }
444
+
445
+ auto limits = ptr->GetLimits();
446
+
447
+ info.GetReturnValue().Set(limits->max_bindings_per_bind_group);
448
+
449
+ }
450
+
451
+
452
+ void GPUSupportedLimitsImpl::SetMaxBindingsPerBindGroup(v8::Local<v8::String> property,
453
+ v8::Local<v8::Value> value,
454
+ const v8::PropertyCallbackInfo<void> &info) {
455
+ GPUSupportedLimitsImpl *ptr = GetPointer(info.This());
456
+ if (ptr == nullptr) {
457
+ return;
458
+ }
459
+ auto isolate = info.GetIsolate();
460
+ auto context = isolate->GetCurrentContext();
461
+ if (value->IsInt32()) {
462
+ ptr->limits_->max_bindings_per_bind_group = value->Int32Value(context).ToChecked();
463
+ }
464
+ }
465
+
466
+ void
467
+ GPUSupportedLimitsImpl::GetMaxDynamicUniformBuffersPerPipelineLayout(v8::Local<v8::String> property,
468
+ const v8::PropertyCallbackInfo<v8::Value> &info) {
469
+ GPUSupportedLimitsImpl *ptr = GetPointer(info.This());
470
+ if (ptr == nullptr) {
471
+ // return default ??
472
+ info.GetReturnValue().Set(8);
473
+ return;
474
+ }
475
+
476
+ auto limits = ptr->GetLimits();
477
+
478
+ info.GetReturnValue().Set(limits->max_dynamic_uniform_buffers_per_pipeline_layout);
479
+ }
480
+
481
+ void
482
+ GPUSupportedLimitsImpl::SetMaxDynamicUniformBuffersPerPipelineLayout(v8::Local<v8::String> property,
483
+ v8::Local<v8::Value> value,
484
+ const v8::PropertyCallbackInfo<void> &info) {
485
+ GPUSupportedLimitsImpl *ptr = GetPointer(info.This());
486
+ if (ptr == nullptr) {
487
+ return;
488
+ }
489
+ auto isolate = info.GetIsolate();
490
+ auto context = isolate->GetCurrentContext();
491
+ if (value->IsInt32()) {
492
+ ptr->limits_->max_dynamic_uniform_buffers_per_pipeline_layout = value->Int32Value(
493
+ context).ToChecked();
494
+ }
495
+ }
496
+
497
+ void
498
+ GPUSupportedLimitsImpl::GetMaxDynamicStorageBuffersPerPipelineLayout(v8::Local<v8::String> property,
499
+ const v8::PropertyCallbackInfo<v8::Value> &info) {
500
+ GPUSupportedLimitsImpl *ptr = GetPointer(info.This());
501
+ if (ptr == nullptr) {
502
+ // return default ??
503
+ info.GetReturnValue().Set(4);
504
+ return;
505
+ }
506
+
507
+ auto limits = ptr->GetLimits();
508
+
509
+ info.GetReturnValue().Set(limits->max_dynamic_storage_buffers_per_pipeline_layout);
510
+ }
511
+
512
+ void
513
+ GPUSupportedLimitsImpl::SetMaxDynamicStorageBuffersPerPipelineLayout(v8::Local<v8::String> property,
514
+ v8::Local<v8::Value> value,
515
+ const v8::PropertyCallbackInfo<void> &info) {
516
+ GPUSupportedLimitsImpl *ptr = GetPointer(info.This());
517
+ if (ptr == nullptr) {
518
+ return;
519
+ }
520
+ auto isolate = info.GetIsolate();
521
+ auto context = isolate->GetCurrentContext();
522
+ if (value->IsInt32()) {
523
+ ptr->limits_->max_dynamic_storage_buffers_per_pipeline_layout = value->Int32Value(
524
+ context).ToChecked();
525
+ }
526
+ }
527
+
528
+ void GPUSupportedLimitsImpl::GetMaxSampledTexturesPerShaderStage(v8::Local<v8::String> property,
529
+ const v8::PropertyCallbackInfo<v8::Value> &info) {
530
+ GPUSupportedLimitsImpl *ptr = GetPointer(info.This());
531
+ if (ptr == nullptr) {
532
+ // return default ??
533
+ info.GetReturnValue().Set(16);
534
+ return;
535
+ }
536
+
537
+ auto limits = ptr->GetLimits();
538
+
539
+ info.GetReturnValue().Set(limits->max_sampled_textures_per_shader_stage);
540
+ }
541
+
542
+ void GPUSupportedLimitsImpl::SetMaxSampledTexturesPerShaderStage(v8::Local<v8::String> property,
543
+ v8::Local<v8::Value> value,
544
+ const v8::PropertyCallbackInfo<void> &info) {
545
+ GPUSupportedLimitsImpl *ptr = GetPointer(info.This());
546
+ if (ptr == nullptr) {
547
+ return;
548
+ }
549
+ auto isolate = info.GetIsolate();
550
+ auto context = isolate->GetCurrentContext();
551
+ if (value->IsInt32()) {
552
+ ptr->limits_->max_sampled_textures_per_shader_stage = value->Int32Value(
553
+ context).ToChecked();
554
+ }
555
+ }
556
+
557
+
558
+ void GPUSupportedLimitsImpl::GetMaxSamplersPerShaderStage(v8::Local<v8::String> property,
559
+ const v8::PropertyCallbackInfo<v8::Value> &info) {
560
+ GPUSupportedLimitsImpl *ptr = GetPointer(info.This());
561
+ if (ptr == nullptr) {
562
+ // return default ??
563
+ info.GetReturnValue().Set(16);
564
+ return;
565
+ }
566
+
567
+ auto limits = ptr->GetLimits();
568
+
569
+ info.GetReturnValue().Set(limits->max_samplers_per_shader_stage);
570
+
571
+ }
572
+
573
+ void GPUSupportedLimitsImpl::SetMaxSamplersPerShaderStage(v8::Local<v8::String> property,
574
+ v8::Local<v8::Value> value,
575
+ const v8::PropertyCallbackInfo<void> &info) {
576
+ GPUSupportedLimitsImpl *ptr = GetPointer(info.This());
577
+ if (ptr == nullptr) {
578
+ return;
579
+ }
580
+ auto isolate = info.GetIsolate();
581
+ auto context = isolate->GetCurrentContext();
582
+ if (value->IsInt32()) {
583
+ ptr->limits_->max_samplers_per_shader_stage = value->Int32Value(context).ToChecked();
584
+ }
585
+ }
586
+
587
+
588
+ void GPUSupportedLimitsImpl::GetMaxStorageBuffersPerShaderStage(v8::Local<v8::String> property,
589
+ const v8::PropertyCallbackInfo<v8::Value> &info) {
590
+ GPUSupportedLimitsImpl *ptr = GetPointer(info.This());
591
+ if (ptr == nullptr) {
592
+ // return default ??
593
+ info.GetReturnValue().Set(8);
594
+ return;
595
+ }
596
+
597
+ auto limits = ptr->GetLimits();
598
+
599
+ info.GetReturnValue().Set(limits->max_storage_buffers_per_shader_stage);
600
+ }
601
+
602
+ void GPUSupportedLimitsImpl::SetMaxStorageBuffersPerShaderStage(v8::Local<v8::String> property,
603
+ v8::Local<v8::Value> value,
604
+ const v8::PropertyCallbackInfo<void> &info) {
605
+ GPUSupportedLimitsImpl *ptr = GetPointer(info.This());
606
+ if (ptr == nullptr) {
607
+ return;
608
+ }
609
+ auto isolate = info.GetIsolate();
610
+ auto context = isolate->GetCurrentContext();
611
+ if (value->IsInt32()) {
612
+ ptr->limits_->max_storage_buffers_per_shader_stage = value->Int32Value(context).ToChecked();
613
+ }
614
+ }
615
+
616
+
617
+ void GPUSupportedLimitsImpl::GetMaxStorageTexturesPerShaderStage(v8::Local<v8::String> property,
618
+ const v8::PropertyCallbackInfo<v8::Value> &info) {
619
+ GPUSupportedLimitsImpl *ptr = GetPointer(info.This());
620
+ if (ptr == nullptr) {
621
+ // return default ??
622
+ info.GetReturnValue().Set(4);
623
+ return;
624
+ }
625
+
626
+ auto limits = ptr->GetLimits();
627
+
628
+ info.GetReturnValue().Set(limits->max_storage_textures_per_shader_stage);
629
+ }
630
+
631
+ void GPUSupportedLimitsImpl::SetMaxStorageTexturesPerShaderStage(v8::Local<v8::String> property,
632
+ v8::Local<v8::Value> value,
633
+ const v8::PropertyCallbackInfo<void> &info) {
634
+ GPUSupportedLimitsImpl *ptr = GetPointer(info.This());
635
+ if (ptr == nullptr) {
636
+ return;
637
+ }
638
+ auto isolate = info.GetIsolate();
639
+ auto context = isolate->GetCurrentContext();
640
+ if (value->IsInt32()) {
641
+ ptr->limits_->max_storage_textures_per_shader_stage = value->Int32Value(
642
+ context).ToChecked();
643
+ }
644
+ }
645
+
646
+
647
+ void GPUSupportedLimitsImpl::GetMaxUniformBuffersPerShaderStage(v8::Local<v8::String> property,
648
+ const v8::PropertyCallbackInfo<v8::Value> &info) {
649
+ GPUSupportedLimitsImpl *ptr = GetPointer(info.This());
650
+ if (ptr == nullptr) {
651
+ // return default ??
652
+ info.GetReturnValue().Set(12);
653
+ return;
654
+ }
655
+
656
+ auto limits = ptr->GetLimits();
657
+
658
+ info.GetReturnValue().Set(limits->max_uniform_buffers_per_shader_stage);
659
+ }
660
+
661
+
662
+ void GPUSupportedLimitsImpl::SetMaxUniformBuffersPerShaderStage(v8::Local<v8::String> property,
663
+ v8::Local<v8::Value> value,
664
+ const v8::PropertyCallbackInfo<void> &info) {
665
+ GPUSupportedLimitsImpl *ptr = GetPointer(info.This());
666
+ if (ptr == nullptr) {
667
+ return;
668
+ }
669
+ auto isolate = info.GetIsolate();
670
+ auto context = isolate->GetCurrentContext();
671
+ if (value->IsInt32()) {
672
+ ptr->limits_->max_uniform_buffers_per_shader_stage = value->Int32Value(context).ToChecked();
673
+ }
674
+ }
675
+
676
+ void GPUSupportedLimitsImpl::GetMaxUniformBufferBindingSize(v8::Local<v8::String> property,
677
+ const v8::PropertyCallbackInfo<v8::Value> &info) {
678
+ GPUSupportedLimitsImpl *ptr = GetPointer(info.This());
679
+ if (ptr == nullptr) {
680
+ // return default ??
681
+ info.GetReturnValue().Set(64);
682
+ return;
683
+ }
684
+
685
+ auto limits = ptr->GetLimits();
686
+
687
+ info.GetReturnValue().Set(limits->max_uniform_buffer_binding_size);
688
+ }
689
+
690
+
691
+ void GPUSupportedLimitsImpl::SetMaxUniformBufferBindingSize(v8::Local<v8::String> property,
692
+ v8::Local<v8::Value> value,
693
+ const v8::PropertyCallbackInfo<void> &info) {
694
+ GPUSupportedLimitsImpl *ptr = GetPointer(info.This());
695
+ if (ptr == nullptr) {
696
+ return;
697
+ }
698
+ auto isolate = info.GetIsolate();
699
+ auto context = isolate->GetCurrentContext();
700
+ if (value->IsInt32()) {
701
+ ptr->limits_->max_uniform_buffer_binding_size = value->Int32Value(context).ToChecked();
702
+ }
703
+ }
704
+
705
+ void GPUSupportedLimitsImpl::GetMaxStorageBufferBindingSize(v8::Local<v8::String> property,
706
+ const v8::PropertyCallbackInfo<v8::Value> &info) {
707
+ GPUSupportedLimitsImpl *ptr = GetPointer(info.This());
708
+ if (ptr == nullptr) {
709
+ // return default ??
710
+ info.GetReturnValue().Set(128);
711
+ return;
712
+ }
713
+
714
+ auto limits = ptr->GetLimits();
715
+
716
+ info.GetReturnValue().Set(limits->max_storage_buffer_binding_size);
717
+ }
718
+
719
+
720
+ void GPUSupportedLimitsImpl::SetMaxStorageBufferBindingSize(v8::Local<v8::String> property,
721
+ v8::Local<v8::Value> value,
722
+ const v8::PropertyCallbackInfo<void> &info) {
723
+ GPUSupportedLimitsImpl *ptr = GetPointer(info.This());
724
+ if (ptr == nullptr) {
725
+ return;
726
+ }
727
+ auto isolate = info.GetIsolate();
728
+ auto context = isolate->GetCurrentContext();
729
+ if (value->IsInt32()) {
730
+ ptr->limits_->max_storage_buffer_binding_size = value->Int32Value(context).ToChecked();
731
+ }
732
+ }
733
+
734
+ void GPUSupportedLimitsImpl::GetMaxVertexBuffers(v8::Local<v8::String> property,
735
+ const v8::PropertyCallbackInfo<v8::Value> &info) {
736
+ GPUSupportedLimitsImpl *ptr = GetPointer(info.This());
737
+ if (ptr == nullptr) {
738
+ // return default ??
739
+ info.GetReturnValue().Set(8);
740
+ return;
741
+ }
742
+
743
+ auto limits = ptr->GetLimits();
744
+
745
+ info.GetReturnValue().Set(limits->max_vertex_buffers);
746
+ }
747
+
748
+
749
+ void GPUSupportedLimitsImpl::SetMaxVertexBuffers(v8::Local<v8::String> property,
750
+ v8::Local<v8::Value> value,
751
+ const v8::PropertyCallbackInfo<void> &info) {
752
+ GPUSupportedLimitsImpl *ptr = GetPointer(info.This());
753
+ if (ptr == nullptr) {
754
+ return;
755
+ }
756
+ auto isolate = info.GetIsolate();
757
+ auto context = isolate->GetCurrentContext();
758
+ if (value->IsInt32()) {
759
+ ptr->limits_->max_vertex_buffers = value->Int32Value(context).ToChecked();
760
+ }
761
+ }
762
+
763
+ void GPUSupportedLimitsImpl::GetMaxBufferSize(v8::Local<v8::String> property,
764
+ const v8::PropertyCallbackInfo<v8::Value> &info) {
765
+ GPUSupportedLimitsImpl *ptr = GetPointer(info.This());
766
+ if (ptr == nullptr) {
767
+ // return default ??
768
+ info.GetReturnValue().Set(256);
769
+ return;
770
+ }
771
+
772
+ auto limits = ptr->GetLimits();
773
+
774
+ info.GetReturnValue().Set(v8::Number::New(info.GetIsolate(), (double) limits->max_buffer_size));
775
+
776
+ }
777
+
778
+
779
+ void GPUSupportedLimitsImpl::SetMaxBufferSize(v8::Local<v8::String> property,
780
+ v8::Local<v8::Value> value,
781
+ const v8::PropertyCallbackInfo<void> &info) {
782
+ GPUSupportedLimitsImpl *ptr = GetPointer(info.This());
783
+ if (ptr == nullptr) {
784
+ return;
785
+ }
786
+ auto isolate = info.GetIsolate();
787
+ auto context = isolate->GetCurrentContext();
788
+ if (value->IsNumber()) {
789
+ ptr->limits_->max_buffer_size = (uint64_t) value->NumberValue(context).ToChecked();
790
+ }
791
+ }
792
+
793
+
794
+ void GPUSupportedLimitsImpl::GetMaxVertexAttributes(v8::Local<v8::String> property,
795
+ const v8::PropertyCallbackInfo<v8::Value> &info) {
796
+ GPUSupportedLimitsImpl *ptr = GetPointer(info.This());
797
+ if (ptr == nullptr) {
798
+ // return default ??
799
+ info.GetReturnValue().Set(16);
800
+ return;
801
+ }
802
+
803
+ auto limits = ptr->GetLimits();
804
+
805
+ info.GetReturnValue().Set(limits->max_vertex_attributes);
806
+ }
807
+
808
+
809
+ void GPUSupportedLimitsImpl::SetMaxVertexAttributes(v8::Local<v8::String> property,
810
+ v8::Local<v8::Value> value,
811
+ const v8::PropertyCallbackInfo<void> &info) {
812
+ GPUSupportedLimitsImpl *ptr = GetPointer(info.This());
813
+ if (ptr == nullptr) {
814
+ return;
815
+ }
816
+ auto isolate = info.GetIsolate();
817
+ auto context = isolate->GetCurrentContext();
818
+ if (value->IsInt32()) {
819
+ ptr->limits_->max_vertex_attributes = value->Int32Value(context).ToChecked();
820
+ }
821
+ }
822
+
823
+
824
+ void GPUSupportedLimitsImpl::GetMaxVertexBufferArrayStride(v8::Local<v8::String> property,
825
+ const v8::PropertyCallbackInfo<v8::Value> &info) {
826
+ GPUSupportedLimitsImpl *ptr = GetPointer(info.This());
827
+ if (ptr == nullptr) {
828
+ // return default ??
829
+ info.GetReturnValue().Set(2048);
830
+ return;
831
+ }
832
+
833
+ auto limits = ptr->GetLimits();
834
+
835
+ info.GetReturnValue().Set(limits->max_vertex_buffer_array_stride);
836
+
837
+ }
838
+
839
+
840
+ void GPUSupportedLimitsImpl::SetMaxVertexBufferArrayStride(v8::Local<v8::String> property,
841
+ v8::Local<v8::Value> value,
842
+ const v8::PropertyCallbackInfo<void> &info) {
843
+ GPUSupportedLimitsImpl *ptr = GetPointer(info.This());
844
+ if (ptr == nullptr) {
845
+ return;
846
+ }
847
+ auto isolate = info.GetIsolate();
848
+ auto context = isolate->GetCurrentContext();
849
+ if (value->IsInt32()) {
850
+ ptr->limits_->max_vertex_buffer_array_stride = value->Int32Value(context).ToChecked();
851
+ }
852
+ }
853
+
854
+
855
+ void GPUSupportedLimitsImpl::GetMinUniformBufferOffsetAlignment(v8::Local<v8::String> property,
856
+ const v8::PropertyCallbackInfo<v8::Value> &info) {
857
+ GPUSupportedLimitsImpl *ptr = GetPointer(info.This());
858
+ if (ptr == nullptr) {
859
+ // return default ??
860
+ info.GetReturnValue().Set(256);
861
+ return;
862
+ }
863
+
864
+ auto limits = ptr->GetLimits();
865
+
866
+ info.GetReturnValue().Set(limits->min_uniform_buffer_offset_alignment);
867
+
868
+ }
869
+
870
+
871
+ void GPUSupportedLimitsImpl::SetMinUniformBufferOffsetAlignment(v8::Local<v8::String> property,
872
+ v8::Local<v8::Value> value,
873
+ const v8::PropertyCallbackInfo<void> &info) {
874
+ GPUSupportedLimitsImpl *ptr = GetPointer(info.This());
875
+ if (ptr == nullptr) {
876
+ return;
877
+ }
878
+ auto isolate = info.GetIsolate();
879
+ auto context = isolate->GetCurrentContext();
880
+ if (value->IsInt32()) {
881
+ ptr->limits_->min_uniform_buffer_offset_alignment = value->Int32Value(context).ToChecked();
882
+ }
883
+ }
884
+
885
+
886
+ void GPUSupportedLimitsImpl::GetMinStorageBufferOffsetAlignment(v8::Local<v8::String> property,
887
+ const v8::PropertyCallbackInfo<v8::Value> &info) {
888
+ GPUSupportedLimitsImpl *ptr = GetPointer(info.This());
889
+ if (ptr == nullptr) {
890
+ // return default ??
891
+ info.GetReturnValue().Set(256);
892
+ return;
893
+ }
894
+
895
+ auto limits = ptr->GetLimits();
896
+
897
+ info.GetReturnValue().Set(limits->min_storage_buffer_offset_alignment);
898
+
899
+ }
900
+
901
+
902
+ void GPUSupportedLimitsImpl::SetMinStorageBufferOffsetAlignment(v8::Local<v8::String> property,
903
+ v8::Local<v8::Value> value,
904
+ const v8::PropertyCallbackInfo<void> &info) {
905
+ GPUSupportedLimitsImpl *ptr = GetPointer(info.This());
906
+ if (ptr == nullptr) {
907
+ return;
908
+ }
909
+ auto isolate = info.GetIsolate();
910
+ auto context = isolate->GetCurrentContext();
911
+ if (value->IsInt32()) {
912
+ ptr->limits_->min_storage_buffer_offset_alignment = value->Int32Value(context).ToChecked();
913
+ }
914
+ }
915
+
916
+
917
+ void GPUSupportedLimitsImpl::GetMaxInterStageShaderComponents(v8::Local<v8::String> property,
918
+ const v8::PropertyCallbackInfo<v8::Value> &info) {
919
+ GPUSupportedLimitsImpl *ptr = GetPointer(info.This());
920
+ if (ptr == nullptr) {
921
+ // return default ??
922
+ info.GetReturnValue().Set(60);
923
+ return;
924
+ }
925
+
926
+ auto limits = ptr->GetLimits();
927
+
928
+ info.GetReturnValue().Set(limits->max_inter_stage_shader_components);
929
+
930
+ }
931
+
932
+
933
+ void GPUSupportedLimitsImpl::SetMaxInterStageShaderComponents(v8::Local<v8::String> property,
934
+ v8::Local<v8::Value> value,
935
+ const v8::PropertyCallbackInfo<void> &info) {
936
+ GPUSupportedLimitsImpl *ptr = GetPointer(info.This());
937
+ if (ptr == nullptr) {
938
+ return;
939
+ }
940
+ auto isolate = info.GetIsolate();
941
+ auto context = isolate->GetCurrentContext();
942
+ if (value->IsInt32()) {
943
+ ptr->limits_->max_inter_stage_shader_components = value->Int32Value(context).ToChecked();
944
+ }
945
+ }
946
+
947
+
948
+ void GPUSupportedLimitsImpl::GetMaxColorAttachments(v8::Local<v8::String> property,
949
+ const v8::PropertyCallbackInfo<v8::Value> &info) {
950
+ GPUSupportedLimitsImpl *ptr = GetPointer(info.This());
951
+ if (ptr == nullptr) {
952
+ // return default ??
953
+ info.GetReturnValue().Set(8);
954
+ return;
955
+ }
956
+
957
+ auto limits = ptr->GetLimits();
958
+
959
+ info.GetReturnValue().Set(limits->max_color_attachments);
960
+
961
+ }
962
+
963
+
964
+ void GPUSupportedLimitsImpl::SetMaxColorAttachments(v8::Local<v8::String> property,
965
+ v8::Local<v8::Value> value,
966
+ const v8::PropertyCallbackInfo<void> &info) {
967
+ GPUSupportedLimitsImpl *ptr = GetPointer(info.This());
968
+ if (ptr == nullptr) {
969
+ return;
970
+ }
971
+ auto isolate = info.GetIsolate();
972
+ auto context = isolate->GetCurrentContext();
973
+ if (value->IsInt32()) {
974
+ ptr->limits_->max_color_attachments = value->Int32Value(context).ToChecked();
975
+ }
976
+ }
977
+
978
+
979
+ void GPUSupportedLimitsImpl::GetMaxColorAttachmentBytesPerSample(v8::Local<v8::String> property,
980
+ const v8::PropertyCallbackInfo<v8::Value> &info) {
981
+ GPUSupportedLimitsImpl *ptr = GetPointer(info.This());
982
+ if (ptr == nullptr) {
983
+ // return default ??
984
+ info.GetReturnValue().Set(32);
985
+ return;
986
+ }
987
+
988
+ auto limits = ptr->GetLimits();
989
+
990
+ info.GetReturnValue().Set(limits->max_color_attachment_bytes_per_sample);
991
+
992
+ }
993
+
994
+ void GPUSupportedLimitsImpl::SetMaxColorAttachmentBytesPerSample(v8::Local<v8::String> property,
995
+ v8::Local<v8::Value> value,
996
+ const v8::PropertyCallbackInfo<void> &info) {
997
+ GPUSupportedLimitsImpl *ptr = GetPointer(info.This());
998
+ if (ptr == nullptr) {
999
+ return;
1000
+ }
1001
+ auto isolate = info.GetIsolate();
1002
+ auto context = isolate->GetCurrentContext();
1003
+ if (value->IsInt32()) {
1004
+ ptr->limits_->max_color_attachment_bytes_per_sample = value->Int32Value(
1005
+ context).ToChecked();
1006
+ }
1007
+ }
1008
+
1009
+
1010
+ void GPUSupportedLimitsImpl::GetMaxComputeWorkgroupStorageSize(v8::Local<v8::String> property,
1011
+ const v8::PropertyCallbackInfo<v8::Value> &info) {
1012
+ GPUSupportedLimitsImpl *ptr = GetPointer(info.This());
1013
+ if (ptr == nullptr) {
1014
+ // return default ??
1015
+ info.GetReturnValue().Set(16384);
1016
+ return;
1017
+ }
1018
+
1019
+ auto limits = ptr->GetLimits();
1020
+
1021
+ info.GetReturnValue().Set(limits->max_compute_workgroup_storage_size);
1022
+ }
1023
+
1024
+
1025
+ void GPUSupportedLimitsImpl::SetMaxComputeWorkgroupStorageSize(v8::Local<v8::String> property,
1026
+ v8::Local<v8::Value> value,
1027
+ const v8::PropertyCallbackInfo<void> &info) {
1028
+ GPUSupportedLimitsImpl *ptr = GetPointer(info.This());
1029
+ if (ptr == nullptr) {
1030
+ return;
1031
+ }
1032
+ auto isolate = info.GetIsolate();
1033
+ auto context = isolate->GetCurrentContext();
1034
+ if (value->IsInt32()) {
1035
+ ptr->limits_->max_compute_workgroup_storage_size = value->Int32Value(context).ToChecked();
1036
+ }
1037
+ }
1038
+
1039
+
1040
+ void GPUSupportedLimitsImpl::GetMaxComputeInvocationsPerWorkgroup(v8::Local<v8::String> property,
1041
+ const v8::PropertyCallbackInfo<v8::Value> &info) {
1042
+ GPUSupportedLimitsImpl *ptr = GetPointer(info.This());
1043
+ if (ptr == nullptr) {
1044
+ // return default ??
1045
+ info.GetReturnValue().Set(256);
1046
+ return;
1047
+ }
1048
+
1049
+ auto limits = ptr->GetLimits();
1050
+
1051
+ info.GetReturnValue().Set(limits->max_compute_invocations_per_workgroup);
1052
+ }
1053
+
1054
+
1055
+ void GPUSupportedLimitsImpl::SetMaxComputeInvocationsPerWorkgroup(v8::Local<v8::String> property,
1056
+ v8::Local<v8::Value> value,
1057
+ const v8::PropertyCallbackInfo<void> &info) {
1058
+ GPUSupportedLimitsImpl *ptr = GetPointer(info.This());
1059
+ if (ptr == nullptr) {
1060
+ return;
1061
+ }
1062
+ auto isolate = info.GetIsolate();
1063
+ auto context = isolate->GetCurrentContext();
1064
+ if (value->IsInt32()) {
1065
+ ptr->limits_->max_compute_invocations_per_workgroup = value->Int32Value(
1066
+ context).ToChecked();
1067
+ }
1068
+ }
1069
+
1070
+ void GPUSupportedLimitsImpl::GetMaxComputeWorkgroupSizeX(v8::Local<v8::String> property,
1071
+ const v8::PropertyCallbackInfo<v8::Value> &info) {
1072
+ GPUSupportedLimitsImpl *ptr = GetPointer(info.This());
1073
+ if (ptr == nullptr) {
1074
+ // return default ??
1075
+ info.GetReturnValue().Set(256);
1076
+ return;
1077
+ }
1078
+
1079
+ auto limits = ptr->GetLimits();
1080
+
1081
+ info.GetReturnValue().Set(limits->max_compute_workgroup_size_x);
1082
+ }
1083
+
1084
+
1085
+ void GPUSupportedLimitsImpl::SetMaxComputeWorkgroupSizeX(v8::Local<v8::String> property,
1086
+ v8::Local<v8::Value> value,
1087
+ const v8::PropertyCallbackInfo<void> &info) {
1088
+ GPUSupportedLimitsImpl *ptr = GetPointer(info.This());
1089
+ if (ptr == nullptr) {
1090
+ return;
1091
+ }
1092
+ auto isolate = info.GetIsolate();
1093
+ auto context = isolate->GetCurrentContext();
1094
+ if (value->IsInt32()) {
1095
+ ptr->limits_->max_compute_workgroup_size_x = value->Int32Value(context).ToChecked();
1096
+ }
1097
+ }
1098
+
1099
+
1100
+ void GPUSupportedLimitsImpl::GetMaxComputeWorkgroupSizeY(v8::Local<v8::String> property,
1101
+ const v8::PropertyCallbackInfo<v8::Value> &info) {
1102
+ GPUSupportedLimitsImpl *ptr = GetPointer(info.This());
1103
+ if (ptr == nullptr) {
1104
+ // return default ??
1105
+ info.GetReturnValue().Set(256);
1106
+ return;
1107
+ }
1108
+
1109
+ auto limits = ptr->GetLimits();
1110
+
1111
+ info.GetReturnValue().Set(limits->max_compute_workgroup_size_y);
1112
+ }
1113
+
1114
+
1115
+ void GPUSupportedLimitsImpl::SetMaxComputeWorkgroupSizeY(v8::Local<v8::String> property,
1116
+ v8::Local<v8::Value> value,
1117
+ const v8::PropertyCallbackInfo<void> &info) {
1118
+ GPUSupportedLimitsImpl *ptr = GetPointer(info.This());
1119
+ if (ptr == nullptr) {
1120
+ return;
1121
+ }
1122
+ auto isolate = info.GetIsolate();
1123
+ auto context = isolate->GetCurrentContext();
1124
+ if (value->IsInt32()) {
1125
+ ptr->limits_->max_compute_workgroup_size_y = value->Int32Value(context).ToChecked();
1126
+ }
1127
+ }
1128
+
1129
+
1130
+ void GPUSupportedLimitsImpl::GetMaxComputeWorkgroupSizeZ(v8::Local<v8::String> property,
1131
+ const v8::PropertyCallbackInfo<v8::Value> &info) {
1132
+ GPUSupportedLimitsImpl *ptr = GetPointer(info.This());
1133
+ if (ptr == nullptr) {
1134
+ // return default ??
1135
+ info.GetReturnValue().Set(64);
1136
+ return;
1137
+ }
1138
+
1139
+ auto limits = ptr->GetLimits();
1140
+
1141
+ info.GetReturnValue().Set(limits->max_compute_workgroup_size_z);
1142
+ }
1143
+
1144
+
1145
+ void GPUSupportedLimitsImpl::SetMaxComputeWorkgroupSizeZ(v8::Local<v8::String> property,
1146
+ v8::Local<v8::Value> value,
1147
+ const v8::PropertyCallbackInfo<void> &info) {
1148
+ GPUSupportedLimitsImpl *ptr = GetPointer(info.This());
1149
+ if (ptr == nullptr) {
1150
+ return;
1151
+ }
1152
+ auto isolate = info.GetIsolate();
1153
+ auto context = isolate->GetCurrentContext();
1154
+ if (value->IsInt32()) {
1155
+ ptr->limits_->max_compute_workgroup_size_z = value->Int32Value(context).ToChecked();
1156
+ }
1157
+ }
1158
+
1159
+ void GPUSupportedLimitsImpl::GetMaxComputeWorkgroupsPerDimension(v8::Local<v8::String> property,
1160
+ const v8::PropertyCallbackInfo<v8::Value> &info) {
1161
+ GPUSupportedLimitsImpl *ptr = GetPointer(info.This());
1162
+ if (ptr == nullptr) {
1163
+ // return default ??
1164
+ info.GetReturnValue().Set(65535);
1165
+ return;
1166
+ }
1167
+
1168
+ auto limits = ptr->GetLimits();
1169
+
1170
+ info.GetReturnValue().Set(limits->max_compute_workgroups_per_dimension);
1171
+ }
1172
+
1173
+
1174
+ void GPUSupportedLimitsImpl::SetMaxComputeWorkgroupsPerDimension(v8::Local<v8::String> property,
1175
+ v8::Local<v8::Value> value,
1176
+ const v8::PropertyCallbackInfo<void> &info) {
1177
+ GPUSupportedLimitsImpl *ptr = GetPointer(info.This());
1178
+ if (ptr == nullptr) {
1179
+ return;
1180
+ }
1181
+ auto isolate = info.GetIsolate();
1182
+ auto context = isolate->GetCurrentContext();
1183
+ if (value->IsInt32()) {
1184
+ ptr->limits_->max_compute_workgroups_per_dimension = value->Int32Value(context).ToChecked();
1185
+ }
1186
+ }
1187
+
1188
+ void GPUSupportedLimitsImpl::GetMinSubgroupSize(v8::Local<v8::String> property,
1189
+ const v8::PropertyCallbackInfo<v8::Value> &info) {
1190
+ GPUSupportedLimitsImpl *ptr = GetPointer(info.This());
1191
+ if (ptr == nullptr) {
1192
+ // return default ??
1193
+ info.GetReturnValue().Set(0);
1194
+ return;
1195
+ }
1196
+
1197
+ auto limits = ptr->GetLimits();
1198
+
1199
+ info.GetReturnValue().Set(limits->min_subgroup_size);
1200
+ }
1201
+
1202
+
1203
+ void GPUSupportedLimitsImpl::SetMinSubgroupSize(v8::Local<v8::String> property,
1204
+ v8::Local<v8::Value> value,
1205
+ const v8::PropertyCallbackInfo<void> &info) {
1206
+ GPUSupportedLimitsImpl *ptr = GetPointer(info.This());
1207
+ if (ptr == nullptr) {
1208
+ return;
1209
+ }
1210
+ auto isolate = info.GetIsolate();
1211
+ auto context = isolate->GetCurrentContext();
1212
+ if (value->IsInt32()) {
1213
+ ptr->limits_->min_subgroup_size = value->Int32Value(context).ToChecked();
1214
+ }
1215
+ }
1216
+
1217
+ void GPUSupportedLimitsImpl::GetMaxSubgroupSize(v8::Local<v8::String> property,
1218
+ const v8::PropertyCallbackInfo<v8::Value> &info) {
1219
+ GPUSupportedLimitsImpl *ptr = GetPointer(info.This());
1220
+ if (ptr == nullptr) {
1221
+ // return default ??
1222
+ info.GetReturnValue().Set(0);
1223
+ return;
1224
+ }
1225
+
1226
+ auto limits = ptr->GetLimits();
1227
+
1228
+ info.GetReturnValue().Set(limits->max_subgroup_size);
1229
+ }
1230
+
1231
+
1232
+ void GPUSupportedLimitsImpl::SetMaxSubgroupSize(v8::Local<v8::String> property,
1233
+ v8::Local<v8::Value> value,
1234
+ const v8::PropertyCallbackInfo<void> &info) {
1235
+ GPUSupportedLimitsImpl *ptr = GetPointer(info.This());
1236
+ if (ptr == nullptr) {
1237
+ return;
1238
+ }
1239
+ auto isolate = info.GetIsolate();
1240
+ auto context = isolate->GetCurrentContext();
1241
+ if (value->IsInt32()) {
1242
+ ptr->limits_->max_subgroup_size = value->Int32Value(context).ToChecked();
1243
+ }
1244
+ }
1245
+
1246
+
1247
+ void GPUSupportedLimitsImpl::GetMaxPushConstantSize(v8::Local<v8::String> property,
1248
+ const v8::PropertyCallbackInfo<v8::Value> &info) {
1249
+ GPUSupportedLimitsImpl *ptr = GetPointer(info.This());
1250
+ if (ptr == nullptr) {
1251
+ // return default ??
1252
+ info.GetReturnValue().Set(0);
1253
+ return;
1254
+ }
1255
+
1256
+ auto limits = ptr->GetLimits();
1257
+
1258
+ info.GetReturnValue().Set(limits->max_push_constant_size);
1259
+ }
1260
+
1261
+
1262
+ void GPUSupportedLimitsImpl::SetMaxPushConstantSize(v8::Local<v8::String> property,
1263
+ v8::Local<v8::Value> value,
1264
+ const v8::PropertyCallbackInfo<void> &info) {
1265
+ GPUSupportedLimitsImpl *ptr = GetPointer(info.This());
1266
+ if (ptr == nullptr) {
1267
+ return;
1268
+ }
1269
+ auto isolate = info.GetIsolate();
1270
+ auto context = isolate->GetCurrentContext();
1271
+ if (value->IsInt32()) {
1272
+ ptr->limits_->max_push_constant_size = value->Int32Value(context).ToChecked();
1273
+ }
1274
+ }
1275
+
1276
+ void GPUSupportedLimitsImpl::GetMaxNonSamplerBindings(v8::Local<v8::String> property,
1277
+ const v8::PropertyCallbackInfo<v8::Value> &info) {
1278
+ GPUSupportedLimitsImpl *ptr = GetPointer(info.This());
1279
+ if (ptr == nullptr) {
1280
+ // return default ??
1281
+ info.GetReturnValue().Set(1000000);
1282
+ return;
1283
+ }
1284
+
1285
+ auto limits = ptr->GetLimits();
1286
+
1287
+ info.GetReturnValue().Set(limits->max_non_sampler_bindings);
1288
+
1289
+ }
1290
+
1291
+ void GPUSupportedLimitsImpl::SetMaxNonSamplerBindings(v8::Local<v8::String> property,
1292
+ v8::Local<v8::Value> value,
1293
+ const v8::PropertyCallbackInfo<void> &info) {
1294
+ GPUSupportedLimitsImpl *ptr = GetPointer(info.This());
1295
+ if (ptr == nullptr) {
1296
+ return;
1297
+ }
1298
+ auto isolate = info.GetIsolate();
1299
+ auto context = isolate->GetCurrentContext();
1300
+ if (value->IsInt32()) {
1301
+ ptr->limits_->max_non_sampler_bindings = value->Int32Value(context).ToChecked();
1302
+ }
1303
+ }
1304
+