@nativescript/canvas 2.0.0-webgpu.1 → 2.0.0-webgpu.10

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 (290) hide show
  1. package/Canvas/common.d.ts +2 -16
  2. package/Canvas/common.js +1 -62
  3. package/Canvas/common.js.map +1 -1
  4. package/Canvas/index.android.d.ts +6 -8
  5. package/Canvas/index.android.js +116 -62
  6. package/Canvas/index.android.js.map +1 -1
  7. package/Canvas/index.d.ts +7 -8
  8. package/Canvas/index.ios.d.ts +3 -2
  9. package/Canvas/index.ios.js +115 -74
  10. package/Canvas/index.ios.js.map +1 -1
  11. package/Canvas2D/CanvasRenderingContext2D/index.d.ts +1 -0
  12. package/Canvas2D/CanvasRenderingContext2D/index.js +72 -72
  13. package/Canvas2D/CanvasRenderingContext2D/index.js.map +1 -1
  14. package/Canvas2D/DOMMatrix/index.js +1 -1
  15. package/Canvas2D/DOMMatrix/index.js.map +1 -1
  16. package/Canvas2D/ImageData/index.js.map +1 -1
  17. package/Canvas2D/Path2D/index.js.map +1 -1
  18. package/Dom/Dom.js +8 -1
  19. package/Dom/Dom.js.map +1 -1
  20. package/Dom/Group.d.ts +1 -2
  21. package/Dom/Group.js.map +1 -1
  22. package/Dom/Image.d.ts +4 -1
  23. package/Dom/Image.js +15 -2
  24. package/Dom/Image.js.map +1 -1
  25. package/Dom/Paint.d.ts +1 -1
  26. package/Dom/Paint.js.map +1 -1
  27. package/Dom/Text.js.map +1 -1
  28. package/Dom/shaders/LinearGradient.js.map +1 -1
  29. package/Dom/shaders/TwoPointConicalGradient.js.map +1 -1
  30. package/Dom/shapes/Atlas.js.map +1 -1
  31. package/Dom/shapes/Circle.js.map +1 -1
  32. package/Dom/shapes/Line.js.map +1 -1
  33. package/Dom/shapes/Oval.js.map +1 -1
  34. package/Dom/shapes/Path.d.ts +1 -1
  35. package/Dom/shapes/Path.js.map +1 -1
  36. package/Dom/shapes/Rect.js.map +1 -1
  37. package/Dom/shapes/RoundedRect.js.map +1 -1
  38. package/Dom/shapes/index.js.map +1 -1
  39. package/ImageAsset/index.d.ts +3 -1
  40. package/ImageAsset/index.js +38 -6
  41. package/ImageAsset/index.js.map +1 -1
  42. package/ImageBitmap/index.js +3 -3
  43. package/ImageBitmap/index.js.map +1 -1
  44. package/README.md +62 -3
  45. package/TextDecoder/index.js +3 -3
  46. package/TextDecoder/index.js.map +1 -1
  47. package/TextEncoder/index.js +3 -3
  48. package/TextEncoder/index.js.map +1 -1
  49. package/WebGL/WebGLExtensions/index.js +5 -5
  50. package/WebGL/WebGLExtensions/index.js.map +1 -1
  51. package/WebGL/WebGLRenderingContext/common.js.map +1 -1
  52. package/WebGL/WebGLRenderingContext/index.js.map +1 -1
  53. package/WebGL2/WebGL2RenderingContext/index.js.map +1 -1
  54. package/WebGPU/Constants.js.map +1 -1
  55. package/WebGPU/GPU.js.map +1 -1
  56. package/WebGPU/GPUAdapter.d.ts +4 -2
  57. package/WebGPU/GPUAdapter.js +3 -0
  58. package/WebGPU/GPUAdapter.js.map +1 -1
  59. package/WebGPU/GPUAdapterInfo.js.map +1 -1
  60. package/WebGPU/GPUBindGroup.d.ts +1 -0
  61. package/WebGPU/GPUBindGroup.js +3 -0
  62. package/WebGPU/GPUBindGroup.js.map +1 -1
  63. package/WebGPU/GPUBindGroupLayout.d.ts +1 -0
  64. package/WebGPU/GPUBindGroupLayout.js +3 -0
  65. package/WebGPU/GPUBindGroupLayout.js.map +1 -1
  66. package/WebGPU/GPUBuffer.js +6 -2
  67. package/WebGPU/GPUBuffer.js.map +1 -1
  68. package/WebGPU/GPUCanvasContext.d.ts +1 -1
  69. package/WebGPU/GPUCanvasContext.js +13 -10
  70. package/WebGPU/GPUCanvasContext.js.map +1 -1
  71. package/WebGPU/GPUCommandBuffer.d.ts +1 -0
  72. package/WebGPU/GPUCommandBuffer.js +3 -0
  73. package/WebGPU/GPUCommandBuffer.js.map +1 -1
  74. package/WebGPU/GPUCommandEncoder.d.ts +1 -0
  75. package/WebGPU/GPUCommandEncoder.js +3 -0
  76. package/WebGPU/GPUCommandEncoder.js.map +1 -1
  77. package/WebGPU/GPUComputePassEncoder.d.ts +1 -0
  78. package/WebGPU/GPUComputePassEncoder.js +3 -0
  79. package/WebGPU/GPUComputePassEncoder.js.map +1 -1
  80. package/WebGPU/GPUComputePipeline.d.ts +1 -0
  81. package/WebGPU/GPUComputePipeline.js +3 -0
  82. package/WebGPU/GPUComputePipeline.js.map +1 -1
  83. package/WebGPU/GPUDevice.d.ts +4 -4
  84. package/WebGPU/GPUDevice.js +32 -9
  85. package/WebGPU/GPUDevice.js.map +1 -1
  86. package/WebGPU/GPUExternalTexture.d.ts +1 -0
  87. package/WebGPU/GPUExternalTexture.js +3 -0
  88. package/WebGPU/GPUExternalTexture.js.map +1 -1
  89. package/WebGPU/GPUPipelineLayout.d.ts +1 -0
  90. package/WebGPU/GPUPipelineLayout.js +3 -0
  91. package/WebGPU/GPUPipelineLayout.js.map +1 -1
  92. package/WebGPU/GPUQuerySet.d.ts +1 -0
  93. package/WebGPU/GPUQuerySet.js +3 -0
  94. package/WebGPU/GPUQuerySet.js.map +1 -1
  95. package/WebGPU/GPUQueue.d.ts +1 -0
  96. package/WebGPU/GPUQueue.js +3 -0
  97. package/WebGPU/GPUQueue.js.map +1 -1
  98. package/WebGPU/GPURenderBundle.d.ts +1 -0
  99. package/WebGPU/GPURenderBundle.js +3 -0
  100. package/WebGPU/GPURenderBundle.js.map +1 -1
  101. package/WebGPU/GPURenderBundleEncoder.d.ts +1 -0
  102. package/WebGPU/GPURenderBundleEncoder.js +3 -0
  103. package/WebGPU/GPURenderBundleEncoder.js.map +1 -1
  104. package/WebGPU/GPURenderPassEncoder.d.ts +2 -1
  105. package/WebGPU/GPURenderPassEncoder.js +5 -2
  106. package/WebGPU/GPURenderPassEncoder.js.map +1 -1
  107. package/WebGPU/GPURenderPipeline.d.ts +1 -0
  108. package/WebGPU/GPURenderPipeline.js +3 -0
  109. package/WebGPU/GPURenderPipeline.js.map +1 -1
  110. package/WebGPU/GPUSampler.d.ts +1 -0
  111. package/WebGPU/GPUSampler.js +3 -0
  112. package/WebGPU/GPUSampler.js.map +1 -1
  113. package/WebGPU/GPUShaderModule.d.ts +1 -1
  114. package/WebGPU/GPUShaderModule.js +2 -2
  115. package/WebGPU/GPUShaderModule.js.map +1 -1
  116. package/WebGPU/GPUTexture.d.ts +1 -0
  117. package/WebGPU/GPUTexture.js +3 -0
  118. package/WebGPU/GPUTexture.js.map +1 -1
  119. package/WebGPU/GPUTextureView.d.ts +1 -0
  120. package/WebGPU/GPUTextureView.js +3 -0
  121. package/WebGPU/GPUTextureView.js.map +1 -1
  122. package/WebGPU/Interfaces.d.ts +14 -4
  123. package/WebGPU/Types.d.ts +28 -27
  124. package/WebGPU/Utils.d.ts +1 -1
  125. package/WebGPU/Utils.js.map +1 -1
  126. package/angular/{esm2020 → esm2022}/index.mjs +5 -5
  127. package/angular/{fesm2015 → fesm2022}/nativescript-canvas-angular.mjs +4 -4
  128. package/angular/{fesm2020 → fesm2022}/nativescript-canvas-angular.mjs.map +1 -1
  129. package/angular/package.json +4 -10
  130. package/helpers.js.map +1 -1
  131. package/package.json +2 -2
  132. package/platforms/android/canvas-release.aar +0 -0
  133. package/platforms/ios/CanvasNative.xcframework/Info.plist +5 -5
  134. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/CanvasNative +0 -0
  135. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Headers/CanvasNative-Swift.h +26 -9
  136. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Headers/canvas_native.h +2091 -2055
  137. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Info.plist +0 -0
  138. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/CanvasNative.swiftmodule/Project/arm64-apple-ios.swiftsourceinfo +0 -0
  139. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios.abi.json +971 -205
  140. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios.private.swiftinterface +38 -9
  141. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios.swiftinterface +38 -9
  142. package/platforms/ios/CanvasNative.xcframework/ios-arm64/dSYMs/CanvasNative.framework.dSYM/Contents/Resources/DWARF/CanvasNative +0 -0
  143. package/platforms/ios/CanvasNative.xcframework/ios-arm64/dSYMs/CanvasNative.framework.dSYM/Contents/Resources/Relocations/aarch64/CanvasNative.yml +645 -602
  144. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/CanvasNative +0 -0
  145. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Headers/CanvasNative-Swift.h +52 -18
  146. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Headers/canvas_native.h +2091 -2055
  147. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Info.plist +0 -0
  148. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/Project/arm64-apple-ios-simulator.swiftsourceinfo +0 -0
  149. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/Project/x86_64-apple-ios-simulator.swiftsourceinfo +0 -0
  150. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios-simulator.abi.json +971 -205
  151. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +38 -9
  152. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios-simulator.swiftinterface +38 -9
  153. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.abi.json +971 -205
  154. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +38 -9
  155. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +38 -9
  156. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/_CodeSignature/CodeResources +25 -25
  157. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/dSYMs/CanvasNative.framework.dSYM/Contents/Resources/DWARF/CanvasNative +0 -0
  158. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/dSYMs/CanvasNative.framework.dSYM/Contents/Resources/Relocations/aarch64/CanvasNative.yml +647 -604
  159. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/dSYMs/CanvasNative.framework.dSYM/Contents/Resources/Relocations/x86_64/CanvasNative.yml +685 -638
  160. package/platforms/ios/src/NSOperationQueueWrapper.h +2 -0
  161. package/platforms/ios/src/cpp/AsyncCallback.h +206 -0
  162. package/platforms/ios/src/cpp/CanvasJSIModule.cpp +13 -13
  163. package/platforms/ios/src/cpp/Helpers.h +2 -164
  164. package/platforms/ios/src/cpp/ImageAssetImpl.cpp +13 -13
  165. package/platforms/ios/src/cpp/ImageBitmapImpl.cpp +1 -1
  166. package/platforms/ios/src/cpp/ImageBitmapImpl.h +2 -1
  167. package/platforms/ios/src/cpp/JSIReadFileCallback.h +4 -4
  168. package/platforms/ios/src/cpp/NativeType.h +87 -0
  169. package/platforms/ios/src/cpp/ObjectWrapperImpl.h +50 -0
  170. package/platforms/ios/src/cpp/OneByteStringResource.cpp +2 -2
  171. package/platforms/ios/src/cpp/PromiseCallback.h +198 -0
  172. package/platforms/ios/src/cpp/RafImpl.h +2 -2
  173. package/platforms/ios/src/cpp/TextDecoderImpl.cpp +0 -6
  174. package/platforms/ios/src/cpp/TextDecoderImpl.h +3 -3
  175. package/platforms/ios/src/cpp/TextEncoderImpl.cpp +1 -1
  176. package/platforms/ios/src/cpp/TextEncoderImpl.h +3 -3
  177. package/platforms/ios/src/cpp/canvas2d/CanvasGradient.h +8 -7
  178. package/platforms/ios/src/cpp/canvas2d/CanvasPattern.cpp +1 -1
  179. package/platforms/ios/src/cpp/canvas2d/CanvasPattern.h +3 -3
  180. package/platforms/ios/src/cpp/canvas2d/CanvasRenderingContext2DImpl.cpp +146 -76
  181. package/platforms/ios/src/cpp/canvas2d/CanvasRenderingContext2DImpl.h +74 -20
  182. package/platforms/ios/src/cpp/canvas2d/ImageDataImpl.cpp +5 -6
  183. package/platforms/ios/src/cpp/canvas2d/ImageDataImpl.h +4 -4
  184. package/platforms/ios/src/cpp/canvas2d/MatrixImpl.cpp +10 -10
  185. package/platforms/ios/src/cpp/canvas2d/MatrixImpl.h +2 -2
  186. package/platforms/ios/src/cpp/canvas2d/Path2D.cpp +6 -3
  187. package/platforms/ios/src/cpp/canvas2d/Path2D.h +7 -7
  188. package/platforms/ios/src/cpp/canvas2d/TextMetricsImpl.h +3 -3
  189. package/platforms/ios/src/cpp/webgl/WebGLActiveInfoImpl.h +1 -1
  190. package/platforms/ios/src/cpp/webgl/WebGLBuffer.h +1 -1
  191. package/platforms/ios/src/cpp/webgl/WebGLFramebuffer.h +1 -1
  192. package/platforms/ios/src/cpp/webgl/WebGLProgram.h +3 -3
  193. package/platforms/ios/src/cpp/webgl/WebGLRenderbuffer.h +3 -3
  194. package/platforms/ios/src/cpp/webgl/WebGLRenderingContext.cpp +8 -8
  195. package/platforms/ios/src/cpp/webgl/WebGLRenderingContext.h +1 -1
  196. package/platforms/ios/src/cpp/webgl/WebGLRenderingContextBase.cpp +1 -1
  197. package/platforms/ios/src/cpp/webgl/WebGLShader.h +1 -1
  198. package/platforms/ios/src/cpp/webgl/WebGLShaderPrecisionFormatImpl.h +5 -5
  199. package/platforms/ios/src/cpp/webgl/WebGLTexture.h +3 -2
  200. package/platforms/ios/src/cpp/webgl/WebGLUniformLocation.h +2 -2
  201. package/platforms/ios/src/cpp/webgl/extensions/ANGLE_instanced_arraysImpl.h +1 -1
  202. package/platforms/ios/src/cpp/webgl/extensions/EXT_blend_minmaxImpl.h +1 -1
  203. package/platforms/ios/src/cpp/webgl/extensions/EXT_color_buffer_half_floatImpl.h +1 -1
  204. package/platforms/ios/src/cpp/webgl/extensions/EXT_disjoint_timer_queryImpl.h +1 -1
  205. package/platforms/ios/src/cpp/webgl/extensions/EXT_sRGBImpl.h +1 -1
  206. package/platforms/ios/src/cpp/webgl/extensions/EXT_shader_texture_lodImpl.h +1 -1
  207. package/platforms/ios/src/cpp/webgl/extensions/EXT_texture_filter_anisotropicImpl.h +1 -1
  208. package/platforms/ios/src/cpp/webgl/extensions/OES_element_index_uintImpl.h +2 -2
  209. package/platforms/ios/src/cpp/webgl/extensions/OES_fbo_render_mipmap.h +5 -5
  210. package/platforms/ios/src/cpp/webgl/extensions/OES_standard_derivativesImpl.h +1 -1
  211. package/platforms/ios/src/cpp/webgl/extensions/OES_texture_floatImpl.h +1 -1
  212. package/platforms/ios/src/cpp/webgl/extensions/OES_texture_float_linearImpl.h +1 -1
  213. package/platforms/ios/src/cpp/webgl/extensions/OES_texture_half_floatImpl.h +1 -1
  214. package/platforms/ios/src/cpp/webgl/extensions/OES_texture_half_float_linearImpl.h +1 -1
  215. package/platforms/ios/src/cpp/webgl/extensions/OES_vertex_array_objectImpl.h +1 -1
  216. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_color_buffer_floatImpl.h +1 -1
  217. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_compressed_texture_atcImpl.h +1 -1
  218. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_compressed_texture_etc1Impl.h +1 -1
  219. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_compressed_texture_etcImpl.h +2 -2
  220. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_compressed_texture_pvrtcImpl.h +1 -1
  221. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_compressed_texture_s3tcImpl.h +1 -1
  222. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_compressed_texture_s3tc_srgbImpl.h +1 -1
  223. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_depth_textureImpl.h +1 -1
  224. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_draw_buffersImpl.h +1 -1
  225. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_lose_contextImpl.h +1 -1
  226. package/platforms/ios/src/cpp/webgl2/WebGL2RenderingContext.cpp +722 -722
  227. package/platforms/ios/src/cpp/webgl2/WebGL2RenderingContext.h +1 -1
  228. package/platforms/ios/src/cpp/webgl2/WebGLQuery.h +1 -1
  229. package/platforms/ios/src/cpp/webgl2/WebGLSampler.h +1 -1
  230. package/platforms/ios/src/cpp/webgl2/WebGLSyncImpl.h +1 -1
  231. package/platforms/ios/src/cpp/webgl2/WebGLTransformFeedback.h +1 -1
  232. package/platforms/ios/src/cpp/webgl2/WebGLVertexArrayObject.h +2 -2
  233. package/platforms/ios/src/cpp/webgpu/GPUAdapterImpl.cpp +137 -69
  234. package/platforms/ios/src/cpp/webgpu/GPUAdapterImpl.h +1 -1
  235. package/platforms/ios/src/cpp/webgpu/GPUAdapterInfoImpl.cpp +1 -1
  236. package/platforms/ios/src/cpp/webgpu/GPUAdapterInfoImpl.h +1 -1
  237. package/platforms/ios/src/cpp/webgpu/GPUBindGroupImpl.cpp +32 -6
  238. package/platforms/ios/src/cpp/webgpu/GPUBindGroupImpl.h +5 -2
  239. package/platforms/ios/src/cpp/webgpu/GPUBindGroupLayoutImpl.cpp +27 -1
  240. package/platforms/ios/src/cpp/webgpu/GPUBindGroupLayoutImpl.h +4 -1
  241. package/platforms/ios/src/cpp/webgpu/GPUBufferImpl.cpp +80 -32
  242. package/platforms/ios/src/cpp/webgpu/GPUBufferImpl.h +8 -4
  243. package/platforms/ios/src/cpp/webgpu/GPUCanvasContextImpl.cpp +19 -14
  244. package/platforms/ios/src/cpp/webgpu/GPUCanvasContextImpl.h +1 -1
  245. package/platforms/ios/src/cpp/webgpu/GPUCommandBufferImpl.cpp +29 -2
  246. package/platforms/ios/src/cpp/webgpu/GPUCommandBufferImpl.h +4 -1
  247. package/platforms/ios/src/cpp/webgpu/GPUCommandEncoderImpl.cpp +455 -457
  248. package/platforms/ios/src/cpp/webgpu/GPUCommandEncoderImpl.h +5 -1
  249. package/platforms/ios/src/cpp/webgpu/GPUComputePassEncoderImpl.cpp +42 -14
  250. package/platforms/ios/src/cpp/webgpu/GPUComputePassEncoderImpl.h +4 -1
  251. package/platforms/ios/src/cpp/webgpu/GPUComputePipelineImpl.cpp +26 -1
  252. package/platforms/ios/src/cpp/webgpu/GPUComputePipelineImpl.h +3 -1
  253. package/platforms/ios/src/cpp/webgpu/GPUDeviceImpl.cpp +1699 -727
  254. package/platforms/ios/src/cpp/webgpu/GPUDeviceImpl.h +4 -2
  255. package/platforms/ios/src/cpp/webgpu/GPUImpl.cpp +54 -41
  256. package/platforms/ios/src/cpp/webgpu/GPUImpl.h +2 -2
  257. package/platforms/ios/src/cpp/webgpu/GPUPipelineLayoutImpl.cpp +27 -1
  258. package/platforms/ios/src/cpp/webgpu/GPUPipelineLayoutImpl.h +8 -5
  259. package/platforms/ios/src/cpp/webgpu/GPUQuerySetImpl.cpp +2 -3
  260. package/platforms/ios/src/cpp/webgpu/GPUQuerySetImpl.h +2 -2
  261. package/platforms/ios/src/cpp/webgpu/GPUQueueImpl.cpp +65 -25
  262. package/platforms/ios/src/cpp/webgpu/GPUQueueImpl.h +4 -1
  263. package/platforms/ios/src/cpp/webgpu/GPURenderBundleEncoderImpl.cpp +30 -5
  264. package/platforms/ios/src/cpp/webgpu/GPURenderBundleEncoderImpl.h +4 -1
  265. package/platforms/ios/src/cpp/webgpu/GPURenderBundleImpl.cpp +26 -1
  266. package/platforms/ios/src/cpp/webgpu/GPURenderBundleImpl.h +4 -1
  267. package/platforms/ios/src/cpp/webgpu/GPURenderPassEncoderImpl.cpp +33 -6
  268. package/platforms/ios/src/cpp/webgpu/GPURenderPassEncoderImpl.h +4 -1
  269. package/platforms/ios/src/cpp/webgpu/GPURenderPipelineImpl.cpp +26 -1
  270. package/platforms/ios/src/cpp/webgpu/GPURenderPipelineImpl.h +4 -1
  271. package/platforms/ios/src/cpp/webgpu/GPUSamplerImpl.cpp +27 -1
  272. package/platforms/ios/src/cpp/webgpu/GPUSamplerImpl.h +5 -2
  273. package/platforms/ios/src/cpp/webgpu/GPUShaderModuleImpl.cpp +25 -1
  274. package/platforms/ios/src/cpp/webgpu/GPUShaderModuleImpl.h +5 -2
  275. package/platforms/ios/src/cpp/webgpu/GPUSupportedLimitsImpl.cpp +2 -2
  276. package/platforms/ios/src/cpp/webgpu/GPUSupportedLimitsImpl.h +2 -2
  277. package/platforms/ios/src/cpp/webgpu/GPUTextureImpl.cpp +33 -8
  278. package/platforms/ios/src/cpp/webgpu/GPUTextureImpl.h +6 -4
  279. package/platforms/ios/src/cpp/webgpu/GPUTextureViewImpl.cpp +27 -1
  280. package/platforms/ios/src/cpp/webgpu/GPUTextureViewImpl.h +5 -2
  281. package/platforms/ios/src/cpp/webgpu/GPUUtils.h +511 -0
  282. package/react/index.d.ts +1 -1
  283. package/utils.d.ts +1 -1
  284. package/utils.js.map +1 -1
  285. package/angular/fesm2015/nativescript-canvas-angular.mjs.map +0 -1
  286. package/angular/fesm2020/nativescript-canvas-angular.mjs +0 -24
  287. package/typings/objc!CanvasNative.d.ts +0 -2038
  288. package/typings/objc!CanvasNative.js +0 -1
  289. package/typings/objc!CanvasNative.js.map +0 -1
  290. /package/angular/{esm2020 → esm2022}/nativescript-canvas-angular.mjs +0 -0
@@ -28,7 +28,7 @@ void GPURenderPassEncoderImpl::Init(v8::Local<v8::Object> canvasModule, v8::Isol
28
28
  auto func = ctor->GetFunction(context).ToLocalChecked();
29
29
 
30
30
  canvasModule->Set(context, ConvertToV8String(isolate, "GPURenderPassEncoder"),
31
- func).FromJust();;
31
+ func).FromJust();
32
32
  }
33
33
 
34
34
  GPURenderPassEncoderImpl *
@@ -54,6 +54,11 @@ v8::Local<v8::FunctionTemplate> GPURenderPassEncoderImpl::GetCtor(v8::Isolate *i
54
54
  auto tmpl = ctorTmpl->InstanceTemplate();
55
55
  tmpl->SetInternalFieldCount(2);
56
56
 
57
+ tmpl->SetLazyDataProperty(
58
+ ConvertToV8String(isolate, "label"),
59
+ GetLabel
60
+ );
61
+
57
62
  tmpl->Set(
58
63
  ConvertToV8String(isolate, "beginOcclusionQuery"),
59
64
  v8::FunctionTemplate::New(isolate, &BeginOcclusionQuery));
@@ -136,6 +141,27 @@ v8::Local<v8::FunctionTemplate> GPURenderPassEncoderImpl::GetCtor(v8::Isolate *i
136
141
  }
137
142
 
138
143
 
144
+ void
145
+ GPURenderPassEncoderImpl::GetLabel(v8::Local<v8::Name> name,
146
+ const v8::PropertyCallbackInfo<v8::Value> &info) {
147
+ auto ptr = GetPointer(info.This());
148
+ if (ptr != nullptr) {
149
+ auto label = canvas_native_webgpu_render_pass_encoder_get_label(ptr->pass_);
150
+ if (label == nullptr) {
151
+ info.GetReturnValue().SetEmptyString();
152
+ return;
153
+ }
154
+ info.GetReturnValue().Set(
155
+ ConvertToV8String(info.GetIsolate(), label)
156
+ );
157
+ canvas_native_string_destroy(label);
158
+ return;
159
+ }
160
+
161
+ info.GetReturnValue().SetEmptyString();
162
+ }
163
+
164
+
139
165
  void
140
166
  GPURenderPassEncoderImpl::BeginOcclusionQuery(const v8::FunctionCallbackInfo<v8::Value> &args) {
141
167
  auto *ptr = GetPointer(args.This());
@@ -228,9 +254,10 @@ void GPURenderPassEncoderImpl::DrawIndexed(const v8::FunctionCallbackInfo<v8::Va
228
254
  firstInstance = firstInstanceVal.As<v8::Uint32>()->Value();
229
255
  }
230
256
 
257
+ auto indexCount = indexCountVal->Uint32Value(
258
+ context).FromJust();
231
259
  canvas_native_webgpu_render_pass_encoder_draw_indexed(ptr->GetPass(),
232
- indexCountVal->Uint32Value(
233
- context).FromJust(),
260
+ indexCount,
234
261
  instanceCount, firstIndex,
235
262
  baseVertex,
236
263
  firstInstance);
@@ -407,7 +434,7 @@ void GPURenderPassEncoderImpl::SetBindGroup(const v8::FunctionCallbackInfo<v8::V
407
434
  auto index = indexVal->Uint32Value(context).FromJust();
408
435
  auto bindgroup = GPUBindGroupImpl::GetPointer(bindGroupVal.As<v8::Object>());
409
436
 
410
- if (dynamicOffsets->IsUint8Array()) {
437
+ if (dynamicOffsets->IsUint32Array()) {
411
438
  auto buf = dynamicOffsets.As<v8::Uint32Array>();
412
439
  auto buffer = buf->Buffer();
413
440
  auto store = buffer->GetBackingStore();
@@ -445,7 +472,7 @@ void GPURenderPassEncoderImpl::SetIndexBuffer(const v8::FunctionCallbackInfo<v8:
445
472
 
446
473
  auto type = GetNativeType(bufferVal);
447
474
 
448
- if (type == NativeType::GPURenderBundleEncoder) {
475
+ if (type == NativeType::GPUBuffer) {
449
476
  auto buffer = GPUBufferImpl::GetPointer(bufferVal.As<v8::Object>());
450
477
  auto indexFormat = ConvertFromV8String(isolate, indexFormatVal);
451
478
  if (offsetVal->IsNumber()) {
@@ -501,7 +528,7 @@ void GPURenderPassEncoderImpl::SetPipeline(const v8::FunctionCallbackInfo<v8::Va
501
528
  }
502
529
 
503
530
  auto pipelineVal = args[0];
504
- if(GetNativeType(pipelineVal) == NativeType::GPURenderPipeline){
531
+ if (GetNativeType(pipelineVal) == NativeType::GPURenderPipeline) {
505
532
  auto pipeline = GPURenderPipelineImpl::GetPointer(pipelineVal.As<v8::Object>());
506
533
  canvas_native_webgpu_render_pass_encoder_set_pipeline(ptr->GetPass(),
507
534
  pipeline->GetGPUPipeline());
@@ -32,12 +32,15 @@ public:
32
32
  v8::EscapableHandleScope scope(isolate);
33
33
  auto object = GPURenderPassEncoderImpl::GetCtor(isolate)->GetFunction(
34
34
  context).ToLocalChecked()->NewInstance(context).ToLocalChecked();
35
- SetNativeType(object, NativeType::GPURenderPassEncoder);
35
+ SetNativeType(encoder, NativeType::GPURenderPassEncoder);
36
36
  object->SetAlignedPointerInInternalField(0, encoder);
37
37
  encoder->BindFinalizer(isolate, object);
38
38
  return scope.Escape(object);
39
39
  }
40
40
 
41
+ static void GetLabel(v8::Local<v8::Name> name,
42
+ const v8::PropertyCallbackInfo<v8::Value> &info);
43
+
41
44
  static void BeginOcclusionQuery(const v8::FunctionCallbackInfo<v8::Value> &args);
42
45
 
43
46
  static void Draw(const v8::FunctionCallbackInfo<v8::Value> &args);
@@ -23,7 +23,7 @@ void GPURenderPipelineImpl::Init(v8::Local<v8::Object> canvasModule, v8::Isolate
23
23
  auto context = isolate->GetCurrentContext();
24
24
  auto func = ctor->GetFunction(context).ToLocalChecked();
25
25
 
26
- canvasModule->Set(context, ConvertToV8String(isolate, "GPURenderPipeline"), func).FromJust();;
26
+ canvasModule->Set(context, ConvertToV8String(isolate, "GPURenderPipeline"), func).FromJust();
27
27
  }
28
28
 
29
29
  GPURenderPipelineImpl *GPURenderPipelineImpl::GetPointer(const v8::Local<v8::Object> &object) {
@@ -48,6 +48,10 @@ v8::Local<v8::FunctionTemplate> GPURenderPipelineImpl::GetCtor(v8::Isolate *isol
48
48
  auto tmpl = ctorTmpl->InstanceTemplate();
49
49
  tmpl->SetInternalFieldCount(2);
50
50
 
51
+ tmpl->SetLazyDataProperty(
52
+ ConvertToV8String(isolate, "label"),
53
+ GetLabel
54
+ );
51
55
 
52
56
  tmpl->Set(
53
57
  ConvertToV8String(isolate, "getBindGroupLayout"),
@@ -82,3 +86,24 @@ void GPURenderPipelineImpl::GetBindGroupLayout(const v8::FunctionCallbackInfo<v8
82
86
  args.GetReturnValue().SetUndefined();
83
87
  }
84
88
 
89
+
90
+ void
91
+ GPURenderPipelineImpl::GetLabel(v8::Local<v8::Name> name,
92
+ const v8::PropertyCallbackInfo<v8::Value> &info) {
93
+ auto ptr = GetPointer(info.This());
94
+ if (ptr != nullptr) {
95
+ auto label = canvas_native_webgpu_render_pipeline_get_label(ptr->pipeline_);
96
+ if (label == nullptr) {
97
+ info.GetReturnValue().SetEmptyString();
98
+ return;
99
+ }
100
+ info.GetReturnValue().Set(
101
+ ConvertToV8String(info.GetIsolate(), label)
102
+ );
103
+ canvas_native_string_destroy(label);
104
+ return;
105
+ }
106
+
107
+ info.GetReturnValue().SetEmptyString();
108
+ }
109
+
@@ -31,12 +31,15 @@ public:
31
31
  v8::EscapableHandleScope scope(isolate);
32
32
  auto object = GPURenderPipelineImpl::GetCtor(isolate)->GetFunction(
33
33
  context).ToLocalChecked()->NewInstance(context).ToLocalChecked();
34
- SetNativeType(object, NativeType::GPURenderPipeline);
34
+ SetNativeType(pipeline, NativeType::GPURenderPipeline);
35
35
  object->SetAlignedPointerInInternalField(0, pipeline);
36
36
  pipeline->BindFinalizer(isolate, object);
37
37
  return scope.Escape(object);
38
38
  }
39
39
 
40
+ static void GetLabel(v8::Local<v8::Name> name,
41
+ const v8::PropertyCallbackInfo<v8::Value> &info);
42
+
40
43
 
41
44
  static void GetBindGroupLayout(const v8::FunctionCallbackInfo <v8::Value> &args);
42
45
 
@@ -22,7 +22,7 @@ void GPUSamplerImpl::Init(v8::Local<v8::Object> canvasModule, v8::Isolate *isola
22
22
  auto context = isolate->GetCurrentContext();
23
23
  auto func = ctor->GetFunction(context).ToLocalChecked();
24
24
 
25
- canvasModule->Set(context, ConvertToV8String(isolate, "GPUSampler"), func).FromJust();;
25
+ canvasModule->Set(context, ConvertToV8String(isolate, "GPUSampler"), func).FromJust();
26
26
  }
27
27
 
28
28
  GPUSamplerImpl *GPUSamplerImpl::GetPointer(const v8::Local<v8::Object> &object) {
@@ -47,7 +47,33 @@ v8::Local<v8::FunctionTemplate> GPUSamplerImpl::GetCtor(v8::Isolate *isolate) {
47
47
  auto tmpl = ctorTmpl->InstanceTemplate();
48
48
  tmpl->SetInternalFieldCount(2);
49
49
 
50
+ tmpl->SetLazyDataProperty(
51
+ ConvertToV8String(isolate, "label"),
52
+ GetLabel
53
+ );
54
+
50
55
  cache->GPUSamplerTmpl =
51
56
  std::make_unique<v8::Persistent<v8::FunctionTemplate>>(isolate, ctorTmpl);
52
57
  return ctorTmpl;
53
58
  }
59
+
60
+
61
+ void
62
+ GPUSamplerImpl::GetLabel(v8::Local<v8::Name> name,
63
+ const v8::PropertyCallbackInfo<v8::Value> &info) {
64
+ auto ptr = GetPointer(info.This());
65
+ if (ptr != nullptr) {
66
+ auto label = canvas_native_webgpu_sampler_get_label(ptr->sampler_);
67
+ if (label == nullptr) {
68
+ info.GetReturnValue().SetEmptyString();
69
+ return;
70
+ }
71
+ info.GetReturnValue().Set(
72
+ ConvertToV8String(info.GetIsolate(), label)
73
+ );
74
+ canvas_native_string_destroy(label);
75
+ return;
76
+ }
77
+
78
+ info.GetReturnValue().SetEmptyString();
79
+ }
@@ -9,7 +9,7 @@
9
9
  #include "Helpers.h"
10
10
  #include "ObjectWrapperImpl.h"
11
11
 
12
- class GPUSamplerImpl: ObjectWrapperImpl {
12
+ class GPUSamplerImpl : ObjectWrapperImpl {
13
13
  public:
14
14
  explicit GPUSamplerImpl(const CanvasGPUSampler *sampler);
15
15
 
@@ -30,12 +30,15 @@ public:
30
30
  v8::EscapableHandleScope scope(isolate);
31
31
  auto object = GPUSamplerImpl::GetCtor(isolate)->GetFunction(
32
32
  context).ToLocalChecked()->NewInstance(context).ToLocalChecked();
33
- SetNativeType(object, NativeType::GPUSampler);
33
+ SetNativeType(sampler, NativeType::GPUSampler);
34
34
  object->SetAlignedPointerInInternalField(0, sampler);
35
35
  sampler->BindFinalizer(isolate, object);
36
36
  return scope.Escape(object);
37
37
  }
38
38
 
39
+ static void GetLabel(v8::Local<v8::Name> name,
40
+ const v8::PropertyCallbackInfo<v8::Value> &info);
41
+
39
42
 
40
43
  private:
41
44
  const CanvasGPUSampler *sampler_;
@@ -22,7 +22,7 @@ void GPUShaderModuleImpl::Init(v8::Local<v8::Object> canvasModule, v8::Isolate *
22
22
  auto context = isolate->GetCurrentContext();
23
23
  auto func = ctor->GetFunction(context).ToLocalChecked();
24
24
 
25
- canvasModule->Set(context, ConvertToV8String(isolate, "GPUShaderModule"), func).FromJust();;
25
+ canvasModule->Set(context, ConvertToV8String(isolate, "GPUShaderModule"), func).FromJust();
26
26
  }
27
27
 
28
28
  GPUShaderModuleImpl *GPUShaderModuleImpl::GetPointer(const v8::Local<v8::Object> &object) {
@@ -47,10 +47,34 @@ v8::Local<v8::FunctionTemplate> GPUShaderModuleImpl::GetCtor(v8::Isolate *isolat
47
47
  auto tmpl = ctorTmpl->InstanceTemplate();
48
48
  tmpl->SetInternalFieldCount(2);
49
49
 
50
+ tmpl->SetLazyDataProperty(
51
+ ConvertToV8String(isolate, "label"),
52
+ GetLabel
53
+ );
50
54
 
51
55
  cache->GPUShaderModuleTmpl =
52
56
  std::make_unique<v8::Persistent<v8::FunctionTemplate>>(isolate, ctorTmpl);
53
57
  return ctorTmpl;
54
58
  }
55
59
 
60
+ void
61
+ GPUShaderModuleImpl::GetLabel(v8::Local<v8::Name> name,
62
+ const v8::PropertyCallbackInfo<v8::Value> &info) {
63
+ auto ptr = GetPointer(info.This());
64
+ if (ptr != nullptr) {
65
+ auto label = canvas_native_webgpu_shader_module_get_label(ptr->shaderModule_);
66
+ if (label == nullptr) {
67
+ info.GetReturnValue().SetEmptyString();
68
+ return;
69
+ }
70
+ info.GetReturnValue().Set(
71
+ ConvertToV8String(info.GetIsolate(), label)
72
+ );
73
+ canvas_native_string_destroy(label);
74
+ return;
75
+ }
76
+
77
+ info.GetReturnValue().SetEmptyString();
78
+ }
79
+
56
80
 
@@ -11,7 +11,7 @@
11
11
 
12
12
  class GPUShaderModuleImpl : ObjectWrapperImpl {
13
13
  public:
14
- GPUShaderModuleImpl(const CanvasGPUShaderModule *shaderModule);
14
+ explicit GPUShaderModuleImpl(const CanvasGPUShaderModule *shaderModule);
15
15
 
16
16
  ~GPUShaderModuleImpl() {
17
17
  canvas_native_webgpu_shader_module_release(this->GetShaderModule());
@@ -31,12 +31,15 @@ public:
31
31
  v8::EscapableHandleScope scope(isolate);
32
32
  auto object = GPUShaderModuleImpl::GetCtor(isolate)->GetFunction(
33
33
  context).ToLocalChecked()->NewInstance(context).ToLocalChecked();
34
- SetNativeType(object, NativeType::GPUShaderModule);
34
+ SetNativeType(shaderModule, NativeType::GPUShaderModule);
35
35
  object->SetAlignedPointerInInternalField(0, shaderModule);
36
36
  shaderModule->BindFinalizer(isolate, object);
37
37
  return scope.Escape(object);
38
38
  }
39
39
 
40
+ static void GetLabel(v8::Local<v8::Name> name,
41
+ const v8::PropertyCallbackInfo<v8::Value> &info);
42
+
40
43
  private:
41
44
  const CanvasGPUShaderModule *shaderModule_;
42
45
  };
@@ -22,7 +22,7 @@ void GPUSupportedLimitsImpl::Init(v8::Local<v8::Object> canvasModule, v8::Isolat
22
22
  auto context = isolate->GetCurrentContext();
23
23
  auto func = ctor->GetFunction(context).ToLocalChecked();
24
24
 
25
- canvasModule->Set(context, ConvertToV8String(isolate, "GPUSupportedLimits"), func).FromJust();;
25
+ canvasModule->Set(context, ConvertToV8String(isolate, "GPUSupportedLimits"), func).FromJust();
26
26
  }
27
27
 
28
28
  GPUSupportedLimitsImpl *GPUSupportedLimitsImpl::GetPointer(v8::Local<v8::Object> object) {
@@ -281,7 +281,7 @@ void GPUSupportedLimitsImpl::Ctor(const v8::FunctionCallbackInfo<v8::Value> &arg
281
281
 
282
282
  ret->SetAlignedPointerInInternalField(0, object);
283
283
 
284
- SetNativeType(ret, NativeType::GPUSupportedLimits);
284
+ SetNativeType(object, NativeType::GPUSupportedLimits);
285
285
 
286
286
  object->BindFinalizer(isolate, ret);
287
287
 
@@ -10,7 +10,7 @@
10
10
 
11
11
  class GPUSupportedLimitsImpl : public ObjectWrapperImpl {
12
12
  public:
13
- GPUSupportedLimitsImpl(CanvasGPUSupportedLimits *limits);
13
+ explicit GPUSupportedLimitsImpl(CanvasGPUSupportedLimits *limits);
14
14
 
15
15
  ~GPUSupportedLimitsImpl() {
16
16
  canvas_native_webgpu_limits_release(this->limits_);
@@ -23,7 +23,7 @@ public:
23
23
  v8::EscapableHandleScope scope(isolate);
24
24
  auto object = GPUSupportedLimitsImpl::GetCtor(isolate)->GetFunction(
25
25
  context).ToLocalChecked()->NewInstance(context).ToLocalChecked();
26
- SetNativeType(object, NativeType::GPUSupportedLimits);
26
+ SetNativeType(limits, NativeType::GPUSupportedLimits);
27
27
  object->SetAlignedPointerInInternalField(0, limits);
28
28
  limits->BindFinalizer(isolate, object);
29
29
  return scope.Escape(object);
@@ -47,6 +47,10 @@ v8::Local<v8::FunctionTemplate> GPUTextureImpl::GetCtor(v8::Isolate *isolate) {
47
47
  auto tmpl = ctorTmpl->InstanceTemplate();
48
48
  tmpl->SetInternalFieldCount(2);
49
49
 
50
+ tmpl->SetLazyDataProperty(
51
+ ConvertToV8String(isolate, "label"),
52
+ GetLabel
53
+ );
50
54
 
51
55
  tmpl->Set(
52
56
  ConvertToV8String(isolate, "destroy"),
@@ -107,6 +111,27 @@ v8::Local<v8::FunctionTemplate> GPUTextureImpl::GetCtor(v8::Isolate *isolate) {
107
111
  return ctorTmpl;
108
112
  }
109
113
 
114
+
115
+ void
116
+ GPUTextureImpl::GetLabel(v8::Local<v8::Name> name,
117
+ const v8::PropertyCallbackInfo<v8::Value> &info) {
118
+ auto ptr = GetPointer(info.This());
119
+ if (ptr != nullptr) {
120
+ auto label = canvas_native_webgpu_texture_get_label(ptr->texture_);
121
+ if (label == nullptr) {
122
+ info.GetReturnValue().SetEmptyString();
123
+ return;
124
+ }
125
+ info.GetReturnValue().Set(
126
+ ConvertToV8String(info.GetIsolate(), label)
127
+ );
128
+ canvas_native_string_destroy(label);
129
+ return;
130
+ }
131
+
132
+ info.GetReturnValue().SetEmptyString();
133
+ }
134
+
110
135
  void
111
136
  GPUTextureImpl::GetDimension(v8::Local<v8::Name> name,
112
137
  const v8::PropertyCallbackInfo<v8::Value> &info) {
@@ -249,6 +274,7 @@ void GPUTextureImpl::CreateView(const v8::FunctionCallbackInfo<v8::Value> &args)
249
274
  aspect, 0, -1, 0, -1
250
275
  };
251
276
 
277
+ std::string label;
252
278
 
253
279
  if (descVal->IsObject()) {
254
280
  descriptor = new CanvasCreateTextureViewDescriptor{};
@@ -269,7 +295,6 @@ void GPUTextureImpl::CreateView(const v8::FunctionCallbackInfo<v8::Value> &args)
269
295
  }
270
296
 
271
297
 
272
-
273
298
  v8::Local<v8::Value> arrayLayerCountVal;
274
299
  if (descObj->Get(context, ConvertToV8String(isolate, "arrayLayerCount")).ToLocal(
275
300
  &arrayLayerCountVal) && arrayLayerCountVal->IsInt32()) {
@@ -297,16 +322,15 @@ void GPUTextureImpl::CreateView(const v8::FunctionCallbackInfo<v8::Value> &args)
297
322
  descriptor->range = &range;
298
323
 
299
324
 
300
-
301
325
  v8::Local<v8::Value> formatVal;
302
326
  descObj->Get(context, ConvertToV8String(isolate, "format")).ToLocal(&formatVal);
303
327
  auto formatStr = ConvertFromV8String(isolate, formatVal);
304
328
 
305
- descriptor->format = CanvasOptionalGPUTextureFormat {
306
- CanvasOptionalGPUTextureFormatNone
329
+ descriptor->format = CanvasOptionalGPUTextureFormat{
330
+ CanvasOptionalGPUTextureFormatNone
307
331
  };
308
332
 
309
- if (!formatStr.empty()){
333
+ if (!formatStr.empty()) {
310
334
  auto format = canvas_native_webgpu_enum_string_to_gpu_texture(formatStr.c_str());
311
335
  descriptor->format = format;
312
336
  }
@@ -317,9 +341,9 @@ void GPUTextureImpl::CreateView(const v8::FunctionCallbackInfo<v8::Value> &args)
317
341
  v8::Local<v8::Value> labelVal;
318
342
  descObj->Get(context, ConvertToV8String(isolate, "label")).ToLocal(&labelVal);
319
343
 
320
- if (!labelVal.IsEmpty() && labelVal->IsString()) {
321
- descriptor->label = *v8::String::Utf8Value(isolate, labelVal);
322
- }
344
+ label = ConvertFromV8String(isolate, labelVal);
345
+
346
+ descriptor->label = label.c_str();
323
347
 
324
348
  v8::Local<v8::Value> dimensionVal;
325
349
  if (descObj->Get(context, ConvertToV8String(isolate, "dimension")).ToLocal(&dimensionVal)) {
@@ -347,6 +371,7 @@ void GPUTextureImpl::CreateView(const v8::FunctionCallbackInfo<v8::Value> &args)
347
371
 
348
372
  if (descriptor != nullptr) {
349
373
  delete descriptor;
374
+ descriptor = nullptr;
350
375
  }
351
376
 
352
377
  if (view != nullptr) {
@@ -25,17 +25,19 @@ public:
25
25
 
26
26
  static v8::Local<v8::FunctionTemplate> GetCtor(v8::Isolate *isolate);
27
27
 
28
- static v8::Local<v8::Object> NewInstance(v8::Isolate *isolate, GPUTextureImpl *queue) {
28
+ static v8::Local<v8::Object> NewInstance(v8::Isolate *isolate, GPUTextureImpl *texture) {
29
29
  auto context = isolate->GetCurrentContext();
30
30
  v8::EscapableHandleScope scope(isolate);
31
31
  auto object = GPUTextureImpl::GetCtor(isolate)->GetFunction(
32
32
  context).ToLocalChecked()->NewInstance(context).ToLocalChecked();
33
- SetNativeType(object, NativeType::GPUTexture);
34
- object->SetAlignedPointerInInternalField(0, queue);
35
- queue->BindFinalizer(isolate, object);
33
+ SetNativeType(texture, NativeType::GPUTexture);
34
+ object->SetAlignedPointerInInternalField(0, texture);
35
+ texture->BindFinalizer(isolate, object);
36
36
  return scope.Escape(object);
37
37
  }
38
38
 
39
+ static void GetLabel(v8::Local<v8::Name> name,
40
+ const v8::PropertyCallbackInfo<v8::Value> &info);
39
41
 
40
42
 
41
43
  static void GetWidth(v8::Local<v8::Name> name,
@@ -21,7 +21,7 @@ void GPUTextureViewImpl::Init(v8::Local<v8::Object> canvasModule, v8::Isolate *i
21
21
  auto context = isolate->GetCurrentContext();
22
22
  auto func = ctor->GetFunction(context).ToLocalChecked();
23
23
 
24
- canvasModule->Set(context, ConvertToV8String(isolate, "GPUTextureView"), func).FromJust();;
24
+ canvasModule->Set(context, ConvertToV8String(isolate, "GPUTextureView"), func).FromJust();
25
25
  }
26
26
 
27
27
  GPUTextureViewImpl *GPUTextureViewImpl::GetPointer(const v8::Local<v8::Object> &object) {
@@ -46,8 +46,34 @@ v8::Local<v8::FunctionTemplate> GPUTextureViewImpl::GetCtor(v8::Isolate *isolate
46
46
  auto tmpl = ctorTmpl->InstanceTemplate();
47
47
  tmpl->SetInternalFieldCount(2);
48
48
 
49
+ tmpl->SetLazyDataProperty(
50
+ ConvertToV8String(isolate, "label"),
51
+ GetLabel
52
+ );
53
+
49
54
 
50
55
  cache->GPUTextureViewTmpl =
51
56
  std::make_unique<v8::Persistent<v8::FunctionTemplate>>(isolate, ctorTmpl);
52
57
  return ctorTmpl;
53
58
  }
59
+
60
+
61
+ void
62
+ GPUTextureViewImpl::GetLabel(v8::Local<v8::Name> name,
63
+ const v8::PropertyCallbackInfo<v8::Value> &info) {
64
+ auto ptr = GetPointer(info.This());
65
+ if (ptr != nullptr) {
66
+ auto label = canvas_native_webgpu_texture_view_get_label(ptr->view_);
67
+ if (label == nullptr) {
68
+ info.GetReturnValue().SetEmptyString();
69
+ return;
70
+ }
71
+ info.GetReturnValue().Set(
72
+ ConvertToV8String(info.GetIsolate(), label)
73
+ );
74
+ canvas_native_string_destroy(label);
75
+ return;
76
+ }
77
+
78
+ info.GetReturnValue().SetEmptyString();
79
+ }
@@ -11,7 +11,7 @@
11
11
 
12
12
  class GPUTextureViewImpl : ObjectWrapperImpl {
13
13
  public:
14
- GPUTextureViewImpl(const CanvasGPUTextureView *view);
14
+ explicit GPUTextureViewImpl(const CanvasGPUTextureView *view);
15
15
 
16
16
  ~GPUTextureViewImpl() {
17
17
  canvas_native_webgpu_texture_view_release(this->GetTextureView());
@@ -30,12 +30,15 @@ public:
30
30
  v8::EscapableHandleScope scope(isolate);
31
31
  auto object = GPUTextureViewImpl::GetCtor(isolate)->GetFunction(
32
32
  context).ToLocalChecked()->NewInstance(context).ToLocalChecked();
33
- SetNativeType(object, NativeType::GPUTextureView);
33
+ SetNativeType(view, NativeType::GPUTextureView);
34
34
  object->SetAlignedPointerInInternalField(0, view);
35
35
  view->BindFinalizer(isolate, object);
36
36
  return scope.Escape(object);
37
37
  }
38
38
 
39
+ static void GetLabel(v8::Local<v8::Name> name,
40
+ const v8::PropertyCallbackInfo<v8::Value> &info);
41
+
39
42
 
40
43
  private:
41
44
  const CanvasGPUTextureView *view_;