@nativescript/canvas 2.0.0-beta.9 → 2.0.0-rc.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.
- package/Canvas/common.d.ts +15 -24
- package/Canvas/common.js +147 -203
- package/Canvas/common.js.map +1 -1
- package/Canvas/index.android.d.ts +13 -15
- package/Canvas/index.android.js +152 -151
- package/Canvas/index.android.js.map +1 -1
- package/Canvas/index.d.ts +23 -11
- package/Canvas/index.ios.d.ts +14 -6
- package/Canvas/index.ios.js +213 -124
- package/Canvas/index.ios.js.map +1 -1
- package/Canvas/utils.d.ts +3 -0
- package/Canvas/utils.js +85 -0
- package/Canvas/utils.js.map +1 -0
- package/Canvas2D/CanvasRenderingContext2D/index.d.ts +4 -2
- package/Canvas2D/CanvasRenderingContext2D/index.js +79 -85
- package/Canvas2D/CanvasRenderingContext2D/index.js.map +1 -1
- package/Canvas2D/DOMMatrix/index.d.ts +14 -0
- package/Canvas2D/DOMMatrix/index.js +62 -0
- package/Canvas2D/DOMMatrix/index.js.map +1 -1
- package/Canvas2D/ImageData/index.js +4 -6
- package/Canvas2D/ImageData/index.js.map +1 -1
- package/Canvas2D/Path2D/index.js.map +1 -1
- package/Dom/Dom.js +8 -1
- package/Dom/Dom.js.map +1 -1
- package/Dom/Group.d.ts +1 -2
- package/Dom/Group.js.map +1 -1
- package/Dom/Image.d.ts +4 -1
- package/Dom/Image.js +15 -2
- package/Dom/Image.js.map +1 -1
- package/Dom/Paint.d.ts +1 -1
- package/Dom/Paint.js.map +1 -1
- package/Dom/Text.js.map +1 -1
- package/Dom/shaders/LinearGradient.js.map +1 -1
- package/Dom/shaders/TwoPointConicalGradient.js.map +1 -1
- package/Dom/shapes/Atlas.js.map +1 -1
- package/Dom/shapes/Circle.js.map +1 -1
- package/Dom/shapes/Line.js.map +1 -1
- package/Dom/shapes/Oval.js.map +1 -1
- package/Dom/shapes/Path.d.ts +1 -1
- package/Dom/shapes/Path.js.map +1 -1
- package/Dom/shapes/Rect.js.map +1 -1
- package/Dom/shapes/RoundedRect.js.map +1 -1
- package/Dom/shapes/index.js.map +1 -1
- package/Fonts/FontFace.android.d.ts +46 -0
- package/Fonts/FontFace.android.js +197 -0
- package/Fonts/FontFace.android.js.map +1 -0
- package/Fonts/FontFace.ios.d.ts +45 -0
- package/Fonts/FontFace.ios.js +169 -0
- package/Fonts/FontFace.ios.js.map +1 -0
- package/Fonts/FontFaceSet.android.d.ts +31 -0
- package/Fonts/FontFaceSet.android.js +119 -0
- package/Fonts/FontFaceSet.android.js.map +1 -0
- package/Fonts/FontFaceSet.ios.d.ts +31 -0
- package/Fonts/FontFaceSet.ios.js +109 -0
- package/Fonts/FontFaceSet.ios.js.map +1 -0
- package/Fonts/index.d.ts +2 -0
- package/Fonts/index.js +3 -0
- package/Fonts/index.js.map +1 -0
- package/ImageAsset/index.d.ts +8 -3
- package/ImageAsset/index.js +206 -11
- package/ImageAsset/index.js.map +1 -1
- package/ImageBitmap/index.js +110 -23
- package/ImageBitmap/index.js.map +1 -1
- package/README.md +62 -3
- package/TextDecoder/index.js +3 -3
- package/TextDecoder/index.js.map +1 -1
- package/TextEncoder/index.js +3 -3
- package/TextEncoder/index.js.map +1 -1
- package/WebGL/WebGLExtensions/index.js +5 -5
- package/WebGL/WebGLExtensions/index.js.map +1 -1
- package/WebGL/WebGLRenderingContext/common.d.ts +1 -1
- package/WebGL/WebGLRenderingContext/common.js.map +1 -1
- package/WebGL/WebGLRenderingContext/index.d.ts +1 -0
- package/WebGL/WebGLRenderingContext/index.js +144 -46
- package/WebGL/WebGLRenderingContext/index.js.map +1 -1
- package/WebGL2/WebGL2RenderingContext/index.d.ts +1 -0
- package/WebGL2/WebGL2RenderingContext/index.js +7 -8
- package/WebGL2/WebGL2RenderingContext/index.js.map +1 -1
- package/WebGPU/Constants.d.ts +36 -0
- package/WebGPU/Constants.js +42 -0
- package/WebGPU/Constants.js.map +1 -0
- package/WebGPU/Errors.d.ts +18 -0
- package/WebGPU/Errors.js +21 -0
- package/WebGPU/Errors.js.map +1 -0
- package/WebGPU/GPU.d.ts +13 -0
- package/WebGPU/GPU.js +36 -0
- package/WebGPU/GPU.js.map +1 -0
- package/WebGPU/GPUAdapter.d.ts +26 -0
- package/WebGPU/GPUAdapter.js +93 -0
- package/WebGPU/GPUAdapter.js.map +1 -0
- package/WebGPU/GPUAdapterInfo.d.ts +9 -0
- package/WebGPU/GPUAdapterInfo.js +24 -0
- package/WebGPU/GPUAdapterInfo.js.map +1 -0
- package/WebGPU/GPUBindGroup.d.ts +6 -0
- package/WebGPU/GPUBindGroup.js +15 -0
- package/WebGPU/GPUBindGroup.js.map +1 -0
- package/WebGPU/GPUBindGroupLayout.d.ts +6 -0
- package/WebGPU/GPUBindGroupLayout.js +15 -0
- package/WebGPU/GPUBindGroupLayout.js.map +1 -0
- package/WebGPU/GPUBuffer.d.ts +15 -0
- package/WebGPU/GPUBuffer.js +66 -0
- package/WebGPU/GPUBuffer.js.map +1 -0
- package/WebGPU/GPUCanvasContext.d.ts +42 -0
- package/WebGPU/GPUCanvasContext.js +149 -0
- package/WebGPU/GPUCanvasContext.js.map +1 -0
- package/WebGPU/GPUCommandBuffer.d.ts +6 -0
- package/WebGPU/GPUCommandBuffer.js +15 -0
- package/WebGPU/GPUCommandBuffer.js.map +1 -0
- package/WebGPU/GPUCommandEncoder.d.ts +35 -0
- package/WebGPU/GPUCommandEncoder.js +163 -0
- package/WebGPU/GPUCommandEncoder.js.map +1 -0
- package/WebGPU/GPUComputePassEncoder.d.ts +17 -0
- package/WebGPU/GPUComputePassEncoder.js +53 -0
- package/WebGPU/GPUComputePassEncoder.js.map +1 -0
- package/WebGPU/GPUComputePipeline.d.ts +8 -0
- package/WebGPU/GPUComputePipeline.js +19 -0
- package/WebGPU/GPUComputePipeline.js.map +1 -0
- package/WebGPU/GPUDevice.d.ts +111 -0
- package/WebGPU/GPUDevice.js +341 -0
- package/WebGPU/GPUDevice.js.map +1 -0
- package/WebGPU/GPUDeviceLostInfo.d.ts +1 -0
- package/WebGPU/GPUDeviceLostInfo.js +10 -0
- package/WebGPU/GPUDeviceLostInfo.js.map +1 -0
- package/WebGPU/GPUExternalTexture.d.ts +6 -0
- package/WebGPU/GPUExternalTexture.js +15 -0
- package/WebGPU/GPUExternalTexture.js.map +1 -0
- package/WebGPU/GPUPipelineLayout.d.ts +6 -0
- package/WebGPU/GPUPipelineLayout.js +15 -0
- package/WebGPU/GPUPipelineLayout.js.map +1 -0
- package/WebGPU/GPUQuerySet.d.ts +6 -0
- package/WebGPU/GPUQuerySet.js +15 -0
- package/WebGPU/GPUQuerySet.js.map +1 -0
- package/WebGPU/GPUQueue.d.ts +15 -0
- package/WebGPU/GPUQueue.js +128 -0
- package/WebGPU/GPUQueue.js.map +1 -0
- package/WebGPU/GPURenderBundle.d.ts +6 -0
- package/WebGPU/GPURenderBundle.js +15 -0
- package/WebGPU/GPURenderBundle.js.map +1 -0
- package/WebGPU/GPURenderBundleEncoder.d.ts +22 -0
- package/WebGPU/GPURenderBundleEncoder.js +65 -0
- package/WebGPU/GPURenderBundleEncoder.js.map +1 -0
- package/WebGPU/GPURenderPassEncoder.d.ts +33 -0
- package/WebGPU/GPURenderPassEncoder.js +106 -0
- package/WebGPU/GPURenderPassEncoder.js.map +1 -0
- package/WebGPU/GPURenderPipeline.d.ts +8 -0
- package/WebGPU/GPURenderPipeline.js +19 -0
- package/WebGPU/GPURenderPipeline.js.map +1 -0
- package/WebGPU/GPUSampler.d.ts +6 -0
- package/WebGPU/GPUSampler.js +15 -0
- package/WebGPU/GPUSampler.js.map +1 -0
- package/WebGPU/GPUShaderModule.d.ts +6 -0
- package/WebGPU/GPUShaderModule.js +15 -0
- package/WebGPU/GPUShaderModule.js.map +1 -0
- package/WebGPU/GPUTexture.d.ts +18 -0
- package/WebGPU/GPUTexture.js +47 -0
- package/WebGPU/GPUTexture.js.map +1 -0
- package/WebGPU/GPUTextureView.d.ts +6 -0
- package/WebGPU/GPUTextureView.js +15 -0
- package/WebGPU/GPUTextureView.js.map +1 -0
- package/WebGPU/Interfaces.d.ts +246 -0
- package/WebGPU/Interfaces.js +2 -0
- package/WebGPU/Interfaces.js.map +1 -0
- package/WebGPU/Types.d.ts +47 -0
- package/WebGPU/Types.js +2 -0
- package/WebGPU/Types.js.map +1 -0
- package/WebGPU/Utils.d.ts +7 -0
- package/WebGPU/Utils.js +301 -0
- package/WebGPU/Utils.js.map +1 -0
- package/WebGPU/index.d.ts +28 -0
- package/WebGPU/index.js +29 -0
- package/WebGPU/index.js.map +1 -0
- package/angular/{esm2020 → esm2022}/index.mjs +5 -5
- package/angular/{fesm2015 → fesm2022}/nativescript-canvas-angular.mjs +4 -4
- package/angular/{fesm2015 → fesm2022}/nativescript-canvas-angular.mjs.map +1 -1
- package/angular/package.json +4 -10
- package/common.d.ts +0 -3
- package/common.js +1 -5
- package/common.js.map +1 -1
- package/helpers.js.map +1 -1
- package/index.d.ts +4 -2
- package/index.js +37 -3
- package/index.js.map +1 -1
- package/package.json +2 -5
- package/platforms/android/canvas-release.aar +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/CanvasNative +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Headers/CanvasNative-Swift.h +194 -56
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Headers/CanvasNative.h +1 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Headers/NSCMTLView.h +32 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Headers/canvas_ios.h +152 -151
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Headers/canvas_native.h +2901 -411
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Info.plist +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/CanvasNative.swiftmodule/Project/arm64-apple-ios.swiftsourceinfo +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios.abi.json +10901 -8099
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios.private.swiftinterface +259 -52
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios.swiftinterface +259 -52
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/fonts/Noto_Serif_CJK/NotoSerifTC-Black.ttf +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/fonts/Noto_Serif_CJK/NotoSerifTC-Bold.ttf +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/fonts/Noto_Serif_CJK/NotoSerifTC-ExtraBold.ttf +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/fonts/Noto_Serif_CJK/NotoSerifTC-ExtraLight.ttf +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/fonts/Noto_Serif_CJK/NotoSerifTC-Light.ttf +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/fonts/Noto_Serif_CJK/NotoSerifTC-Medium.ttf +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/fonts/Noto_Serif_CJK/NotoSerifTC-Regular.ttf +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/fonts/Noto_Serif_CJK/NotoSerifTC-SemiBold.ttf +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/fonts/STIXTwoMath/STIXTwoMath-Regular.ttf +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/fonts/STIXTwoMath/STIXTwoText-Bold.ttf +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/fonts/STIXTwoMath/STIXTwoText-BoldItalic.ttf +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/fonts/STIXTwoMath/STIXTwoText-Italic.ttf +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/fonts/STIXTwoMath/STIXTwoText-Medium.ttf +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/fonts/STIXTwoMath/STIXTwoText-MediumItalic.ttf +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/fonts/STIXTwoMath/STIXTwoText-Regular.ttf +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/fonts/STIXTwoMath/STIXTwoText-SemiBold.ttf +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/fonts/STIXTwoMath/STIXTwoText-SemiBoldItalic.ttf +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/dSYMs/CanvasNative.framework.dSYM/Contents/Resources/DWARF/CanvasNative +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/dSYMs/CanvasNative.framework.dSYM/Contents/Resources/Relocations/aarch64/CanvasNative.yml +994 -663
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/CanvasNative +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Headers/CanvasNative-Swift.h +388 -112
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Headers/CanvasNative.h +1 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Headers/NSCMTLView.h +32 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Headers/canvas_ios.h +152 -151
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Headers/canvas_native.h +2901 -411
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Info.plist +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/Project/arm64-apple-ios-simulator.swiftsourceinfo +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/Project/x86_64-apple-ios-simulator.swiftsourceinfo +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios-simulator.abi.json +10901 -8099
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +259 -52
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios-simulator.swiftinterface +259 -52
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.abi.json +10901 -8099
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +259 -52
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +259 -52
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/_CodeSignature/CodeResources +143 -33
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/fonts/Noto_Serif_CJK/NotoSerifTC-Black.ttf +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/fonts/Noto_Serif_CJK/NotoSerifTC-Bold.ttf +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/fonts/Noto_Serif_CJK/NotoSerifTC-ExtraBold.ttf +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/fonts/Noto_Serif_CJK/NotoSerifTC-ExtraLight.ttf +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/fonts/Noto_Serif_CJK/NotoSerifTC-Light.ttf +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/fonts/Noto_Serif_CJK/NotoSerifTC-Medium.ttf +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/fonts/Noto_Serif_CJK/NotoSerifTC-Regular.ttf +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/fonts/Noto_Serif_CJK/NotoSerifTC-SemiBold.ttf +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/fonts/STIXTwoMath/STIXTwoMath-Regular.ttf +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/fonts/STIXTwoMath/STIXTwoText-Bold.ttf +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/fonts/STIXTwoMath/STIXTwoText-BoldItalic.ttf +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/fonts/STIXTwoMath/STIXTwoText-Italic.ttf +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/fonts/STIXTwoMath/STIXTwoText-Medium.ttf +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/fonts/STIXTwoMath/STIXTwoText-MediumItalic.ttf +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/fonts/STIXTwoMath/STIXTwoText-Regular.ttf +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/fonts/STIXTwoMath/STIXTwoText-SemiBold.ttf +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/fonts/STIXTwoMath/STIXTwoText-SemiBoldItalic.ttf +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/dSYMs/CanvasNative.framework.dSYM/Contents/Resources/DWARF/CanvasNative +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/dSYMs/CanvasNative.framework.dSYM/Contents/Resources/Relocations/aarch64/CanvasNative.yml +993 -662
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/dSYMs/CanvasNative.framework.dSYM/Contents/Resources/Relocations/x86_64/CanvasNative.yml +1037 -641
- package/platforms/ios/build.xcconfig +3 -1
- package/platforms/ios/src/NSOperationQueueWrapper.h +3 -1
- package/platforms/ios/src/NSOperationQueueWrapper.mm +41 -9
- package/platforms/ios/src/cpp/AsyncCallback.h +214 -0
- package/platforms/ios/src/cpp/Caches.h +69 -1
- package/platforms/ios/src/cpp/CanvasJSIModule.cpp +647 -1166
- package/platforms/ios/src/cpp/CanvasJSIModule.h +11 -1
- package/platforms/ios/src/cpp/Helpers.h +2 -129
- package/platforms/ios/src/cpp/ImageAssetImpl.cpp +600 -437
- package/platforms/ios/src/cpp/ImageAssetImpl.h +18 -10
- package/platforms/ios/src/cpp/ImageBitmapImpl.cpp +63 -6
- package/platforms/ios/src/cpp/ImageBitmapImpl.h +12 -4
- package/platforms/ios/src/cpp/JSIReadFileCallback.h +4 -4
- package/platforms/ios/src/cpp/NativeType.h +87 -0
- package/platforms/ios/src/cpp/ObjectWrapperImpl.h +50 -0
- package/platforms/ios/src/cpp/OneByteStringResource.cpp +2 -2
- package/platforms/ios/src/cpp/PromiseCallback.h +197 -0
- package/platforms/ios/src/cpp/RafImpl.h +2 -2
- package/platforms/ios/src/cpp/TextDecoderImpl.cpp +0 -6
- package/platforms/ios/src/cpp/TextDecoderImpl.h +3 -3
- package/platforms/ios/src/cpp/TextEncoderImpl.cpp +1 -1
- package/platforms/ios/src/cpp/TextEncoderImpl.h +3 -3
- package/platforms/ios/src/cpp/canvas2d/CanvasGradient.h +8 -7
- package/platforms/ios/src/cpp/canvas2d/CanvasPattern.cpp +1 -11
- package/platforms/ios/src/cpp/canvas2d/CanvasPattern.h +3 -3
- package/platforms/ios/src/cpp/canvas2d/CanvasRenderingContext2DImpl.cpp +193 -90
- package/platforms/ios/src/cpp/canvas2d/CanvasRenderingContext2DImpl.h +77 -23
- package/platforms/ios/src/cpp/canvas2d/ImageDataImpl.cpp +5 -6
- package/platforms/ios/src/cpp/canvas2d/ImageDataImpl.h +4 -4
- package/platforms/ios/src/cpp/canvas2d/MatrixImpl.cpp +409 -3
- package/platforms/ios/src/cpp/canvas2d/MatrixImpl.h +29 -2
- package/platforms/ios/src/cpp/canvas2d/Path2D.cpp +6 -3
- package/platforms/ios/src/cpp/canvas2d/Path2D.h +7 -7
- package/platforms/ios/src/cpp/canvas2d/TextMetricsImpl.h +3 -3
- package/platforms/ios/src/cpp/webgl/WebGLActiveInfoImpl.h +1 -1
- package/platforms/ios/src/cpp/webgl/WebGLBuffer.h +1 -1
- package/platforms/ios/src/cpp/webgl/WebGLFramebuffer.h +1 -1
- package/platforms/ios/src/cpp/webgl/WebGLProgram.h +3 -3
- package/platforms/ios/src/cpp/webgl/WebGLRenderbuffer.h +3 -3
- package/platforms/ios/src/cpp/webgl/WebGLRenderingContext.cpp +247 -160
- package/platforms/ios/src/cpp/webgl/WebGLRenderingContext.h +1 -1
- package/platforms/ios/src/cpp/webgl/WebGLRenderingContextBase.cpp +6 -6
- package/platforms/ios/src/cpp/webgl/WebGLShader.h +1 -1
- package/platforms/ios/src/cpp/webgl/WebGLShaderPrecisionFormatImpl.h +5 -5
- package/platforms/ios/src/cpp/webgl/WebGLTexture.h +3 -2
- package/platforms/ios/src/cpp/webgl/WebGLUniformLocation.h +2 -2
- package/platforms/ios/src/cpp/webgl/extensions/ANGLE_instanced_arraysImpl.h +1 -1
- package/platforms/ios/src/cpp/webgl/extensions/EXT_blend_minmaxImpl.h +1 -1
- package/platforms/ios/src/cpp/webgl/extensions/EXT_color_buffer_half_floatImpl.h +1 -1
- package/platforms/ios/src/cpp/webgl/extensions/EXT_disjoint_timer_queryImpl.h +1 -1
- package/platforms/ios/src/cpp/webgl/extensions/EXT_sRGBImpl.h +1 -1
- package/platforms/ios/src/cpp/webgl/extensions/EXT_shader_texture_lodImpl.h +1 -1
- package/platforms/ios/src/cpp/webgl/extensions/EXT_texture_filter_anisotropicImpl.h +1 -1
- package/platforms/ios/src/cpp/webgl/extensions/OES_element_index_uintImpl.h +2 -2
- package/platforms/ios/src/cpp/webgl/extensions/OES_fbo_render_mipmap.h +5 -5
- package/platforms/ios/src/cpp/webgl/extensions/OES_standard_derivativesImpl.h +1 -1
- package/platforms/ios/src/cpp/webgl/extensions/OES_texture_floatImpl.h +1 -1
- package/platforms/ios/src/cpp/webgl/extensions/OES_texture_float_linearImpl.h +1 -1
- package/platforms/ios/src/cpp/webgl/extensions/OES_texture_half_floatImpl.h +1 -1
- package/platforms/ios/src/cpp/webgl/extensions/OES_texture_half_float_linearImpl.h +1 -1
- package/platforms/ios/src/cpp/webgl/extensions/OES_vertex_array_objectImpl.h +1 -1
- package/platforms/ios/src/cpp/webgl/extensions/WEBGL_color_buffer_floatImpl.h +1 -1
- package/platforms/ios/src/cpp/webgl/extensions/WEBGL_compressed_texture_atcImpl.h +1 -1
- package/platforms/ios/src/cpp/webgl/extensions/WEBGL_compressed_texture_etc1Impl.h +1 -1
- package/platforms/ios/src/cpp/webgl/extensions/WEBGL_compressed_texture_etcImpl.h +2 -2
- package/platforms/ios/src/cpp/webgl/extensions/WEBGL_compressed_texture_pvrtcImpl.h +1 -1
- package/platforms/ios/src/cpp/webgl/extensions/WEBGL_compressed_texture_s3tcImpl.h +1 -1
- package/platforms/ios/src/cpp/webgl/extensions/WEBGL_compressed_texture_s3tc_srgbImpl.h +1 -1
- package/platforms/ios/src/cpp/webgl/extensions/WEBGL_depth_textureImpl.h +1 -1
- package/platforms/ios/src/cpp/webgl/extensions/WEBGL_draw_buffersImpl.h +1 -1
- package/platforms/ios/src/cpp/webgl/extensions/WEBGL_lose_contextImpl.h +1 -1
- package/platforms/ios/src/cpp/webgl2/WebGL2RenderingContext.cpp +1067 -960
- package/platforms/ios/src/cpp/webgl2/WebGL2RenderingContext.h +1 -1
- package/platforms/ios/src/cpp/webgl2/WebGLQuery.h +1 -1
- package/platforms/ios/src/cpp/webgl2/WebGLSampler.h +1 -1
- package/platforms/ios/src/cpp/webgl2/WebGLSyncImpl.h +1 -1
- package/platforms/ios/src/cpp/webgl2/WebGLTransformFeedback.h +1 -1
- package/platforms/ios/src/cpp/webgl2/WebGLVertexArrayObject.h +2 -2
- package/platforms/ios/src/cpp/webgpu/GPUAdapterImpl.cpp +371 -0
- package/platforms/ios/src/cpp/webgpu/GPUAdapterImpl.h +63 -0
- package/platforms/ios/src/cpp/webgpu/GPUAdapterInfoImpl.cpp +174 -0
- package/platforms/ios/src/cpp/webgpu/GPUAdapterInfoImpl.h +58 -0
- package/platforms/ios/src/cpp/webgpu/GPUBindGroupImpl.cpp +79 -0
- package/platforms/ios/src/cpp/webgpu/GPUBindGroupImpl.h +48 -0
- package/platforms/ios/src/cpp/webgpu/GPUBindGroupLayoutImpl.cpp +79 -0
- package/platforms/ios/src/cpp/webgpu/GPUBindGroupLayoutImpl.h +48 -0
- package/platforms/ios/src/cpp/webgpu/GPUBufferImpl.cpp +277 -0
- package/platforms/ios/src/cpp/webgpu/GPUBufferImpl.h +63 -0
- package/platforms/ios/src/cpp/webgpu/GPUCanvasContextImpl.cpp +379 -0
- package/platforms/ios/src/cpp/webgpu/GPUCanvasContextImpl.h +57 -0
- package/platforms/ios/src/cpp/webgpu/GPUCommandBufferImpl.cpp +81 -0
- package/platforms/ios/src/cpp/webgpu/GPUCommandBufferImpl.h +48 -0
- package/platforms/ios/src/cpp/webgpu/GPUCommandEncoderImpl.cpp +1217 -0
- package/platforms/ios/src/cpp/webgpu/GPUCommandEncoderImpl.h +73 -0
- package/platforms/ios/src/cpp/webgpu/GPUComputePassEncoderImpl.cpp +293 -0
- package/platforms/ios/src/cpp/webgpu/GPUComputePassEncoderImpl.h +65 -0
- package/platforms/ios/src/cpp/webgpu/GPUComputePipelineImpl.cpp +109 -0
- package/platforms/ios/src/cpp/webgpu/GPUComputePipelineImpl.h +51 -0
- package/platforms/ios/src/cpp/webgpu/GPUDeviceImpl.cpp +3701 -0
- package/platforms/ios/src/cpp/webgpu/GPUDeviceImpl.h +97 -0
- package/platforms/ios/src/cpp/webgpu/GPUImpl.cpp +200 -0
- package/platforms/ios/src/cpp/webgpu/GPUImpl.h +55 -0
- package/platforms/ios/src/cpp/webgpu/GPULabel.h +33 -0
- package/platforms/ios/src/cpp/webgpu/GPUPipelineLayoutImpl.cpp +80 -0
- package/platforms/ios/src/cpp/webgpu/GPUPipelineLayoutImpl.h +49 -0
- package/platforms/ios/src/cpp/webgpu/GPUQuerySetImpl.cpp +136 -0
- package/platforms/ios/src/cpp/webgpu/GPUQuerySetImpl.h +55 -0
- package/platforms/ios/src/cpp/webgpu/GPUQueueImpl.cpp +605 -0
- package/platforms/ios/src/cpp/webgpu/GPUQueueImpl.h +59 -0
- package/platforms/ios/src/cpp/webgpu/GPURenderBundleEncoderImpl.cpp +501 -0
- package/platforms/ios/src/cpp/webgpu/GPURenderBundleEncoderImpl.h +74 -0
- package/platforms/ios/src/cpp/webgpu/GPURenderBundleImpl.cpp +78 -0
- package/platforms/ios/src/cpp/webgpu/GPURenderBundleImpl.h +48 -0
- package/platforms/ios/src/cpp/webgpu/GPURenderPassEncoderImpl.cpp +723 -0
- package/platforms/ios/src/cpp/webgpu/GPURenderPassEncoderImpl.h +92 -0
- package/platforms/ios/src/cpp/webgpu/GPURenderPipelineImpl.cpp +109 -0
- package/platforms/ios/src/cpp/webgpu/GPURenderPipelineImpl.h +52 -0
- package/platforms/ios/src/cpp/webgpu/GPUSamplerImpl.cpp +79 -0
- package/platforms/ios/src/cpp/webgpu/GPUSamplerImpl.h +48 -0
- package/platforms/ios/src/cpp/webgpu/GPUShaderModuleImpl.cpp +80 -0
- package/platforms/ios/src/cpp/webgpu/GPUShaderModuleImpl.h +48 -0
- package/platforms/ios/src/cpp/webgpu/GPUSupportedLimitsImpl.cpp +1304 -0
- package/platforms/ios/src/cpp/webgpu/GPUSupportedLimitsImpl.h +288 -0
- package/platforms/ios/src/cpp/webgpu/GPUTextureImpl.cpp +386 -0
- package/platforms/ios/src/cpp/webgpu/GPUTextureImpl.h +77 -0
- package/platforms/ios/src/cpp/webgpu/GPUTextureViewImpl.cpp +79 -0
- package/platforms/ios/src/cpp/webgpu/GPUTextureViewImpl.h +48 -0
- package/platforms/ios/src/cpp/webgpu/GPUUtils.h +756 -0
- package/react/index.d.ts +1 -1
- package/utils.d.ts +1 -1
- package/utils.js.map +1 -1
- package/SVG/Circle.d.ts +0 -11
- package/SVG/Circle.js +0 -21
- package/SVG/Circle.js.map +0 -1
- package/SVG/ClipPath.d.ts +0 -4
- package/SVG/ClipPath.js +0 -9
- package/SVG/ClipPath.js.map +0 -1
- package/SVG/Defs.d.ts +0 -4
- package/SVG/Defs.js +0 -9
- package/SVG/Defs.js.map +0 -1
- package/SVG/Ellipse.d.ts +0 -13
- package/SVG/Ellipse.js +0 -26
- package/SVG/Ellipse.js.map +0 -1
- package/SVG/G.d.ts +0 -7
- package/SVG/G.js +0 -9
- package/SVG/G.js.map +0 -1
- package/SVG/Image.d.ts +0 -11
- package/SVG/Image.js +0 -40
- package/SVG/Image.js.map +0 -1
- package/SVG/Line.d.ts +0 -13
- package/SVG/Line.js +0 -26
- package/SVG/Line.js.map +0 -1
- package/SVG/LinearGradient.d.ts +0 -10
- package/SVG/LinearGradient.js +0 -13
- package/SVG/LinearGradient.js.map +0 -1
- package/SVG/Path.d.ts +0 -7
- package/SVG/Path.js +0 -14
- package/SVG/Path.js.map +0 -1
- package/SVG/Pattern.d.ts +0 -4
- package/SVG/Pattern.js +0 -9
- package/SVG/Pattern.js.map +0 -1
- package/SVG/Polygon.d.ts +0 -7
- package/SVG/Polygon.js +0 -14
- package/SVG/Polygon.js.map +0 -1
- package/SVG/Polyline.d.ts +0 -7
- package/SVG/Polyline.js +0 -14
- package/SVG/Polyline.js.map +0 -1
- package/SVG/Rect.d.ts +0 -8
- package/SVG/Rect.js +0 -13
- package/SVG/Rect.js.map +0 -1
- package/SVG/SVG.d.ts +0 -32
- package/SVG/SVG.js +0 -204
- package/SVG/SVG.js.map +0 -1
- package/SVG/SVGItem.d.ts +0 -5
- package/SVG/SVGItem.js +0 -8
- package/SVG/SVGItem.js.map +0 -1
- package/SVG/Stop.d.ts +0 -5
- package/SVG/Stop.js +0 -9
- package/SVG/Stop.js.map +0 -1
- package/SVG/Symbol.d.ts +0 -4
- package/SVG/Symbol.js +0 -9
- package/SVG/Symbol.js.map +0 -1
- package/SVG/Text.d.ts +0 -14
- package/SVG/Text.js +0 -26
- package/SVG/Text.js.map +0 -1
- package/SVG/Use.d.ts +0 -4
- package/SVG/Use.js +0 -9
- package/SVG/Use.js.map +0 -1
- package/SVG/index.d.ts +0 -18
- package/SVG/index.js +0 -19
- package/SVG/index.js.map +0 -1
- package/angular/fesm2020/nativescript-canvas-angular.mjs +0 -24
- package/angular/fesm2020/nativescript-canvas-angular.mjs.map +0 -1
- package/platforms/ios/src/cpp/PerIsolateData.cpp +0 -49
- package/platforms/ios/src/cpp/PerIsolateData.h +0 -54
- package/platforms/ios/src/cpp/URLImpl.cpp +0 -464
- package/platforms/ios/src/cpp/URLImpl.h +0 -121
- package/typings/objc!CanvasNative.d.ts +0 -2038
- package/typings/objc!CanvasNative.js +0 -1
- package/typings/objc!CanvasNative.js.map +0 -1
- /package/angular/{esm2020 → esm2022}/nativescript-canvas-angular.mjs +0 -0
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Created by Osei Fortune on 17/06/2024.
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
#ifndef CANVAS_ANDROID_GPUADAPTERINFOIMPL_H
|
|
6
|
+
#define CANVAS_ANDROID_GPUADAPTERINFOIMPL_H
|
|
7
|
+
|
|
8
|
+
#include "Common.h"
|
|
9
|
+
#include "Helpers.h"
|
|
10
|
+
#include "ObjectWrapperImpl.h"
|
|
11
|
+
|
|
12
|
+
class GPUAdapterInfoImpl : ObjectWrapperImpl {
|
|
13
|
+
public:
|
|
14
|
+
explicit GPUAdapterInfoImpl(const CanvasGPUAdapterInfo *info);
|
|
15
|
+
|
|
16
|
+
~GPUAdapterInfoImpl() {
|
|
17
|
+
canvas_native_webgpu_adapter_info_release(this->GetInfo());
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const CanvasGPUAdapterInfo *GetInfo();
|
|
21
|
+
|
|
22
|
+
static void Init(v8::Local<v8::Object> canvasModule, v8::Isolate *isolate);
|
|
23
|
+
|
|
24
|
+
static GPUAdapterInfoImpl *GetPointer(const v8::Local<v8::Object> &object);
|
|
25
|
+
|
|
26
|
+
static v8::Local<v8::FunctionTemplate> GetCtor(v8::Isolate *isolate);
|
|
27
|
+
|
|
28
|
+
static v8::Local<v8::Object> NewInstance(v8::Isolate *isolate, GPUAdapterInfoImpl *info) {
|
|
29
|
+
auto context = isolate->GetCurrentContext();
|
|
30
|
+
v8::EscapableHandleScope scope(isolate);
|
|
31
|
+
auto object = GPUAdapterInfoImpl::GetCtor(isolate)->GetFunction(
|
|
32
|
+
context).ToLocalChecked()->NewInstance(context).ToLocalChecked();
|
|
33
|
+
SetNativeType(info, NativeType::GPUAdapterInfo);
|
|
34
|
+
object->SetAlignedPointerInInternalField(0, info);
|
|
35
|
+
info->BindFinalizer(isolate, object);
|
|
36
|
+
return scope.Escape(object);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
static void GetArchitecture(v8::Local<v8::Name> name,
|
|
40
|
+
const v8::PropertyCallbackInfo<v8::Value> &info);
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
static void GetDescription(v8::Local<v8::Name> name,
|
|
44
|
+
const v8::PropertyCallbackInfo<v8::Value> &info);
|
|
45
|
+
|
|
46
|
+
static void GetDevice(v8::Local<v8::Name> name,
|
|
47
|
+
const v8::PropertyCallbackInfo<v8::Value> &info);
|
|
48
|
+
|
|
49
|
+
static void GetVendor(v8::Local<v8::Name> name,
|
|
50
|
+
const v8::PropertyCallbackInfo<v8::Value> &info);
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
private:
|
|
54
|
+
const CanvasGPUAdapterInfo *info_;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
#endif //CANVAS_ANDROID_GPUADAPTERINFOIMPL_H
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Created by Osei Fortune on 17/07/2024.
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
#include "GPUBindGroupImpl.h"
|
|
6
|
+
#include "Caches.h"
|
|
7
|
+
|
|
8
|
+
GPUBindGroupImpl::GPUBindGroupImpl(const CanvasGPUBindGroup *groupLayout)
|
|
9
|
+
: group_(groupLayout) {}
|
|
10
|
+
|
|
11
|
+
const CanvasGPUBindGroup *GPUBindGroupImpl::GetBindGroup() {
|
|
12
|
+
return this->group_;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
void GPUBindGroupImpl::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, "GPUBindGroup"), func).FromJust();
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
GPUBindGroupImpl *GPUBindGroupImpl::GetPointer(const v8::Local<v8::Object> &object) {
|
|
29
|
+
auto ptr = object->GetAlignedPointerFromInternalField(0);
|
|
30
|
+
if (ptr == nullptr) {
|
|
31
|
+
return nullptr;
|
|
32
|
+
}
|
|
33
|
+
return static_cast<GPUBindGroupImpl *>(ptr);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
v8::Local<v8::FunctionTemplate> GPUBindGroupImpl::GetCtor(v8::Isolate *isolate) {
|
|
37
|
+
auto cache = Caches::Get(isolate);
|
|
38
|
+
auto ctor = cache->GPUBindGroupTmpl.get();
|
|
39
|
+
if (ctor != nullptr) {
|
|
40
|
+
return ctor->Get(isolate);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
v8::Local<v8::FunctionTemplate> ctorTmpl = v8::FunctionTemplate::New(isolate);
|
|
44
|
+
ctorTmpl->InstanceTemplate()->SetInternalFieldCount(2);
|
|
45
|
+
ctorTmpl->SetClassName(ConvertToV8String(isolate, "GPUBindGroup"));
|
|
46
|
+
|
|
47
|
+
auto tmpl = ctorTmpl->InstanceTemplate();
|
|
48
|
+
tmpl->SetInternalFieldCount(2);
|
|
49
|
+
|
|
50
|
+
tmpl->SetLazyDataProperty(
|
|
51
|
+
ConvertToV8String(isolate, "label"),
|
|
52
|
+
GetLabel
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
cache->GPUBindGroupTmpl =
|
|
56
|
+
std::make_unique<v8::Persistent<v8::FunctionTemplate >>(isolate, ctorTmpl);
|
|
57
|
+
return ctorTmpl;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
void
|
|
62
|
+
GPUBindGroupImpl::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_bind_group_get_label(ptr->group_);
|
|
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
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Created by Osei Fortune on 17/07/2024.
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
#ifndef CANVAS_ANDROID_GPUBINDGROUPIMPL_H
|
|
6
|
+
#define CANVAS_ANDROID_GPUBINDGROUPIMPL_H
|
|
7
|
+
|
|
8
|
+
#include "Common.h"
|
|
9
|
+
#include "Helpers.h"
|
|
10
|
+
#include "ObjectWrapperImpl.h"
|
|
11
|
+
|
|
12
|
+
class GPUBindGroupImpl : ObjectWrapperImpl {
|
|
13
|
+
public:
|
|
14
|
+
explicit GPUBindGroupImpl(const CanvasGPUBindGroup *group);
|
|
15
|
+
|
|
16
|
+
~GPUBindGroupImpl() {
|
|
17
|
+
canvas_native_webgpu_bind_group_release(this->GetBindGroup());
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const CanvasGPUBindGroup *GetBindGroup();
|
|
21
|
+
|
|
22
|
+
static void Init(v8::Local<v8::Object> canvasModule, v8::Isolate *isolate);
|
|
23
|
+
|
|
24
|
+
static GPUBindGroupImpl *GetPointer(const v8::Local<v8::Object> &object);
|
|
25
|
+
|
|
26
|
+
static v8::Local<v8::FunctionTemplate> GetCtor(v8::Isolate *isolate);
|
|
27
|
+
|
|
28
|
+
static v8::Local<v8::Object>
|
|
29
|
+
NewInstance(v8::Isolate *isolate, GPUBindGroupImpl *groupLayout) {
|
|
30
|
+
auto context = isolate->GetCurrentContext();
|
|
31
|
+
v8::EscapableHandleScope scope(isolate);
|
|
32
|
+
auto object = GPUBindGroupImpl::GetCtor(isolate)->GetFunction(
|
|
33
|
+
context).ToLocalChecked()->NewInstance(context).ToLocalChecked();
|
|
34
|
+
SetNativeType(groupLayout, NativeType::GPUBindGroup);
|
|
35
|
+
object->SetAlignedPointerInInternalField(0, groupLayout);
|
|
36
|
+
groupLayout->BindFinalizer(isolate, object);
|
|
37
|
+
return scope.Escape(object);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
static void GetLabel(v8::Local<v8::Name> name,
|
|
41
|
+
const v8::PropertyCallbackInfo<v8::Value> &info);
|
|
42
|
+
|
|
43
|
+
private:
|
|
44
|
+
const CanvasGPUBindGroup *group_;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
#endif //CANVAS_ANDROID_GPUBINDGROUPIMPL_H
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Created by Osei Fortune on 29/06/2024.
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
#include "GPUBindGroupLayoutImpl.h"
|
|
6
|
+
#include "Caches.h"
|
|
7
|
+
|
|
8
|
+
GPUBindGroupLayoutImpl::GPUBindGroupLayoutImpl(const CanvasGPUBindGroupLayout *groupLayout)
|
|
9
|
+
: groupLayout_(groupLayout) {}
|
|
10
|
+
|
|
11
|
+
const CanvasGPUBindGroupLayout *GPUBindGroupLayoutImpl::GetBindGroupLayout() {
|
|
12
|
+
return this->groupLayout_;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
void GPUBindGroupLayoutImpl::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, "GPUBindGroupLayout"), func).FromJust();
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
GPUBindGroupLayoutImpl *GPUBindGroupLayoutImpl::GetPointer(const v8::Local<v8::Object> &object) {
|
|
29
|
+
auto ptr = object->GetAlignedPointerFromInternalField(0);
|
|
30
|
+
if (ptr == nullptr) {
|
|
31
|
+
return nullptr;
|
|
32
|
+
}
|
|
33
|
+
return static_cast<GPUBindGroupLayoutImpl *>(ptr);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
v8::Local<v8::FunctionTemplate> GPUBindGroupLayoutImpl::GetCtor(v8::Isolate *isolate) {
|
|
37
|
+
auto cache = Caches::Get(isolate);
|
|
38
|
+
auto ctor = cache->GPUBindGroupLayoutTmpl.get();
|
|
39
|
+
if (ctor != nullptr) {
|
|
40
|
+
return ctor->Get(isolate);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
v8::Local<v8::FunctionTemplate> ctorTmpl = v8::FunctionTemplate::New(isolate);
|
|
44
|
+
ctorTmpl->InstanceTemplate()->SetInternalFieldCount(2);
|
|
45
|
+
ctorTmpl->SetClassName(ConvertToV8String(isolate, "GPUBindGroupLayout"));
|
|
46
|
+
|
|
47
|
+
auto tmpl = ctorTmpl->InstanceTemplate();
|
|
48
|
+
tmpl->SetInternalFieldCount(2);
|
|
49
|
+
|
|
50
|
+
tmpl->SetLazyDataProperty(
|
|
51
|
+
ConvertToV8String(isolate, "label"),
|
|
52
|
+
GetLabel
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
cache->GPUBindGroupLayoutTmpl =
|
|
56
|
+
std::make_unique<v8::Persistent<v8::FunctionTemplate>>(isolate, ctorTmpl);
|
|
57
|
+
return ctorTmpl;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
void
|
|
62
|
+
GPUBindGroupLayoutImpl::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_bind_group_layout_get_label(ptr->groupLayout_);
|
|
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
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Created by Osei Fortune on 29/06/2024.
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
#ifndef CANVAS_ANDROID_GPUBINDGROUPLAYOUTIMPL_H
|
|
6
|
+
#define CANVAS_ANDROID_GPUBINDGROUPLAYOUTIMPL_H
|
|
7
|
+
|
|
8
|
+
#include "Common.h"
|
|
9
|
+
#include "Helpers.h"
|
|
10
|
+
#include "ObjectWrapperImpl.h"
|
|
11
|
+
|
|
12
|
+
class GPUBindGroupLayoutImpl : ObjectWrapperImpl {
|
|
13
|
+
public:
|
|
14
|
+
explicit GPUBindGroupLayoutImpl(const CanvasGPUBindGroupLayout *groupLayout);
|
|
15
|
+
|
|
16
|
+
~GPUBindGroupLayoutImpl() {
|
|
17
|
+
canvas_native_webgpu_bind_group_layout_release(this->GetBindGroupLayout());
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const CanvasGPUBindGroupLayout *GetBindGroupLayout();
|
|
21
|
+
|
|
22
|
+
static void Init(v8::Local<v8::Object> canvasModule, v8::Isolate *isolate);
|
|
23
|
+
|
|
24
|
+
static GPUBindGroupLayoutImpl *GetPointer(const v8::Local<v8::Object> &object);
|
|
25
|
+
|
|
26
|
+
static v8::Local<v8::FunctionTemplate> GetCtor(v8::Isolate *isolate);
|
|
27
|
+
|
|
28
|
+
static v8::Local<v8::Object>
|
|
29
|
+
NewInstance(v8::Isolate *isolate, GPUBindGroupLayoutImpl *groupLayout) {
|
|
30
|
+
auto context = isolate->GetCurrentContext();
|
|
31
|
+
v8::EscapableHandleScope scope(isolate);
|
|
32
|
+
auto object = GPUBindGroupLayoutImpl::GetCtor(isolate)->GetFunction(
|
|
33
|
+
context).ToLocalChecked()->NewInstance(context).ToLocalChecked();
|
|
34
|
+
SetNativeType(groupLayout, NativeType::GPUBindGroupLayout);
|
|
35
|
+
object->SetAlignedPointerInInternalField(0, groupLayout);
|
|
36
|
+
groupLayout->BindFinalizer(isolate, object);
|
|
37
|
+
return scope.Escape(object);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
static void GetLabel(v8::Local<v8::Name> name,
|
|
41
|
+
const v8::PropertyCallbackInfo<v8::Value> &info);
|
|
42
|
+
|
|
43
|
+
private:
|
|
44
|
+
const CanvasGPUBindGroupLayout *groupLayout_;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
#endif //CANVAS_ANDROID_GPUBINDGROUPLAYOUTIMPL_H
|
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Created by Osei Fortune on 18/06/2024.
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
#include "GPUBufferImpl.h"
|
|
6
|
+
#include "Caches.h"
|
|
7
|
+
|
|
8
|
+
GPUBufferImpl::GPUBufferImpl(const CanvasGPUBuffer *buffer) : buffer_(buffer) {}
|
|
9
|
+
|
|
10
|
+
const CanvasGPUBuffer *GPUBufferImpl::GetGPUBuffer() {
|
|
11
|
+
return this->buffer_;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
void GPUBufferImpl::Init(v8::Local<v8::Object> canvasModule, v8::Isolate *isolate) {
|
|
16
|
+
v8::Locker locker(isolate);
|
|
17
|
+
v8::Isolate::Scope isolate_scope(isolate);
|
|
18
|
+
v8::HandleScope handle_scope(isolate);
|
|
19
|
+
|
|
20
|
+
auto ctor = GetCtor(isolate);
|
|
21
|
+
auto context = isolate->GetCurrentContext();
|
|
22
|
+
auto func = ctor->GetFunction(context).ToLocalChecked();
|
|
23
|
+
|
|
24
|
+
canvasModule->Set(context, ConvertToV8String(isolate, "GPUBuffer"), func).FromJust();
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
GPUBufferImpl *GPUBufferImpl::GetPointer(const v8::Local<v8::Object> &object) {
|
|
28
|
+
auto ptr = object->GetAlignedPointerFromInternalField(0);
|
|
29
|
+
if (ptr == nullptr) {
|
|
30
|
+
return nullptr;
|
|
31
|
+
}
|
|
32
|
+
return static_cast<GPUBufferImpl *>(ptr);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
v8::Local<v8::FunctionTemplate> GPUBufferImpl::GetCtor(v8::Isolate *isolate) {
|
|
36
|
+
auto cache = Caches::Get(isolate);
|
|
37
|
+
auto ctor = cache->GPUBufferTmpl.get();
|
|
38
|
+
if (ctor != nullptr) {
|
|
39
|
+
return ctor->Get(isolate);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
v8::Local<v8::FunctionTemplate> ctorTmpl = v8::FunctionTemplate::New(isolate);
|
|
43
|
+
ctorTmpl->InstanceTemplate()->SetInternalFieldCount(2);
|
|
44
|
+
ctorTmpl->SetClassName(ConvertToV8String(isolate, "GPUBuffer"));
|
|
45
|
+
|
|
46
|
+
auto tmpl = ctorTmpl->InstanceTemplate();
|
|
47
|
+
tmpl->SetInternalFieldCount(2);
|
|
48
|
+
|
|
49
|
+
tmpl->SetLazyDataProperty(
|
|
50
|
+
ConvertToV8String(isolate, "usage"),
|
|
51
|
+
GetUsage
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
tmpl->SetLazyDataProperty(
|
|
55
|
+
ConvertToV8String(isolate, "size"),
|
|
56
|
+
GetSize
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
tmpl->Set(
|
|
60
|
+
ConvertToV8String(isolate, "destroy"),
|
|
61
|
+
v8::FunctionTemplate::New(isolate, &Destroy));
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
tmpl->Set(
|
|
65
|
+
ConvertToV8String(isolate, "mapAsync"),
|
|
66
|
+
v8::FunctionTemplate::New(isolate, &MapAsync));
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
tmpl->Set(
|
|
70
|
+
ConvertToV8String(isolate, "unmap"),
|
|
71
|
+
v8::FunctionTemplate::New(isolate, &UnMap));
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
tmpl->Set(
|
|
75
|
+
ConvertToV8String(isolate, "getMappedRange"),
|
|
76
|
+
v8::FunctionTemplate::New(isolate, &GetMappedRange));
|
|
77
|
+
|
|
78
|
+
tmpl->SetLazyDataProperty(
|
|
79
|
+
ConvertToV8String(isolate, "label"),
|
|
80
|
+
GetLabel
|
|
81
|
+
);
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
cache->GPUBufferTmpl =
|
|
85
|
+
std::make_unique<v8::Persistent<v8::FunctionTemplate>>(isolate, ctorTmpl);
|
|
86
|
+
return ctorTmpl;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
void
|
|
91
|
+
GPUBufferImpl::GetUsage(v8::Local<v8::Name> name,
|
|
92
|
+
const v8::PropertyCallbackInfo<v8::Value> &info) {
|
|
93
|
+
auto ptr = GetPointer(info.This());
|
|
94
|
+
if (ptr != nullptr) {
|
|
95
|
+
auto usage = canvas_native_webgpu_buffer_usage(ptr->GetGPUBuffer());
|
|
96
|
+
info.GetReturnValue().Set(
|
|
97
|
+
usage
|
|
98
|
+
);
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
info.GetReturnValue().Set(0);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
void
|
|
106
|
+
GPUBufferImpl::GetSize(v8::Local<v8::Name> name,
|
|
107
|
+
const v8::PropertyCallbackInfo<v8::Value> &info) {
|
|
108
|
+
auto ptr = GetPointer(info.This());
|
|
109
|
+
if (ptr != nullptr) {
|
|
110
|
+
auto size = canvas_native_webgpu_buffer_size(ptr->GetGPUBuffer());
|
|
111
|
+
info.GetReturnValue().Set((double) size);
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
info.GetReturnValue().Set(0);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
void GPUBufferImpl::Destroy(const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
119
|
+
GPUBufferImpl *ptr = GetPointer(args.This());
|
|
120
|
+
if (ptr == nullptr) {
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
canvas_native_webgpu_buffer_destroy(ptr->GetGPUBuffer());
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
void GPUBufferImpl::UnMap(const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
128
|
+
GPUBufferImpl *ptr = GetPointer(args.This());
|
|
129
|
+
if (ptr == nullptr) {
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
canvas_native_webgpu_buffer_unmap(ptr->GetGPUBuffer());
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
struct MapAsyncData {
|
|
136
|
+
enum CanvasGPUErrorType type;
|
|
137
|
+
char* error;
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
void GPUBufferImpl::MapAsync(const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
141
|
+
GPUBufferImpl *ptr = GetPointer(args.This());
|
|
142
|
+
if (ptr == nullptr) {
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
auto isolate = args.GetIsolate();
|
|
147
|
+
auto context = isolate->GetCurrentContext();
|
|
148
|
+
auto mode = args[0]->Int32Value(context).ToChecked();
|
|
149
|
+
|
|
150
|
+
int64_t offset = -1;
|
|
151
|
+
int64_t size = -1;
|
|
152
|
+
|
|
153
|
+
auto offsetVal = args[1];
|
|
154
|
+
if (offsetVal->IsNumber()) {
|
|
155
|
+
offset = (int64_t) offsetVal.As<v8::Number>()->Value();
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
auto sizeVal = args[2];
|
|
159
|
+
|
|
160
|
+
if (sizeVal->IsNumber()) {
|
|
161
|
+
size = (int64_t) sizeVal.As<v8::Number>()->Value();
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
auto resolver = v8::Promise::Resolver::New(isolate->GetCurrentContext()).ToLocalChecked();
|
|
165
|
+
args.GetReturnValue().Set(resolver->GetPromise());
|
|
166
|
+
|
|
167
|
+
auto callback = new PromiseCallback{
|
|
168
|
+
isolate,
|
|
169
|
+
resolver,
|
|
170
|
+
[](bool done, void *data){
|
|
171
|
+
auto async_data = static_cast<PromiseCallback *>(data);
|
|
172
|
+
auto func = async_data->inner_.get();
|
|
173
|
+
if (func != nullptr && func->isolate_ != nullptr) {
|
|
174
|
+
v8::Isolate *isolate = func->isolate_;
|
|
175
|
+
v8::Locker locker(isolate);
|
|
176
|
+
v8::Isolate::Scope isolate_scope(
|
|
177
|
+
isolate);
|
|
178
|
+
v8::HandleScope handle_scope(
|
|
179
|
+
isolate);
|
|
180
|
+
v8::Local<v8::Promise::Resolver> callback = func->callback_.Get(
|
|
181
|
+
isolate);
|
|
182
|
+
v8::Local<v8::Context> context = callback->GetCreationContextChecked();
|
|
183
|
+
v8::Context::Scope context_scope(
|
|
184
|
+
context);
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
if (func->data == nullptr) {
|
|
188
|
+
callback->Resolve(context, v8::Undefined(isolate));
|
|
189
|
+
} else {
|
|
190
|
+
auto errorData = static_cast<MapAsyncData*>(func->data);
|
|
191
|
+
callback->Reject(context,
|
|
192
|
+
v8::Exception::Error(
|
|
193
|
+
ConvertToV8String(
|
|
194
|
+
isolate,
|
|
195
|
+
errorData->error)));
|
|
196
|
+
canvas_native_string_destroy(
|
|
197
|
+
errorData->error);
|
|
198
|
+
delete errorData;
|
|
199
|
+
func->data = nullptr;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
delete static_cast<PromiseCallback *>(data);
|
|
203
|
+
}
|
|
204
|
+
};
|
|
205
|
+
callback->prepare();
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
canvas_native_webgpu_buffer_map_async(ptr->GetGPUBuffer(), mode == 1 ? GPUMapMode::GPUMapModeRead : GPUMapMode::GPUMapModeWrite, offset, size,
|
|
209
|
+
[](enum CanvasGPUErrorType type, char *error, void *data) {
|
|
210
|
+
if (data != nullptr) {
|
|
211
|
+
auto async_data = static_cast<PromiseCallback *>(data);
|
|
212
|
+
auto inner = async_data->inner_.get();
|
|
213
|
+
if (inner != nullptr) {
|
|
214
|
+
if(error != nullptr){
|
|
215
|
+
inner->data = new MapAsyncData {
|
|
216
|
+
type, error
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
async_data->execute(true);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
}, callback);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
void GPUBufferImpl::GetMappedRange(const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
226
|
+
GPUBufferImpl *ptr = GetPointer(args.This());
|
|
227
|
+
if (ptr == nullptr) {
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
230
|
+
int64_t offset = -1;
|
|
231
|
+
int64_t size = -1;
|
|
232
|
+
|
|
233
|
+
auto offsetVal = args[0];
|
|
234
|
+
if (offsetVal->IsNumber()) {
|
|
235
|
+
offset = (int64_t) offsetVal.As<v8::Number>()->Value();
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
auto sizeVal = args[1];
|
|
239
|
+
|
|
240
|
+
if (sizeVal->IsNumber()) {
|
|
241
|
+
size = (int64_t) sizeVal.As<v8::Number>()->Value();
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
auto buf = canvas_native_webgpu_buffer_get_mapped_range(ptr->GetGPUBuffer(), offset, size);
|
|
245
|
+
auto isolate = args.GetIsolate();
|
|
246
|
+
if (buf == nullptr) {
|
|
247
|
+
args.GetReturnValue().Set(v8::ArrayBuffer::New(isolate, 0));
|
|
248
|
+
} else {
|
|
249
|
+
auto store = v8::ArrayBuffer::NewBackingStore(buf, size, [](void *data, size_t length,
|
|
250
|
+
void *deleter_data) {
|
|
251
|
+
|
|
252
|
+
}, nullptr);
|
|
253
|
+
auto ab = v8::ArrayBuffer::New(isolate, std::move(store));
|
|
254
|
+
args.GetReturnValue().Set(ab);
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
|
|
259
|
+
void
|
|
260
|
+
GPUBufferImpl::GetLabel(v8::Local<v8::Name> name,
|
|
261
|
+
const v8::PropertyCallbackInfo<v8::Value> &info) {
|
|
262
|
+
auto ptr = GetPointer(info.This());
|
|
263
|
+
if (ptr != nullptr) {
|
|
264
|
+
auto label = canvas_native_webgpu_buffer_get_label(ptr->buffer_);
|
|
265
|
+
if (label == nullptr) {
|
|
266
|
+
info.GetReturnValue().SetEmptyString();
|
|
267
|
+
return;
|
|
268
|
+
}
|
|
269
|
+
info.GetReturnValue().Set(
|
|
270
|
+
ConvertToV8String(info.GetIsolate(), label)
|
|
271
|
+
);
|
|
272
|
+
canvas_native_string_destroy(label);
|
|
273
|
+
return;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
info.GetReturnValue().SetEmptyString();
|
|
277
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Created by Osei Fortune on 18/06/2024.
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
#ifndef CANVAS_ANDROID_GPUBUFFERIMPL_H
|
|
6
|
+
#define CANVAS_ANDROID_GPUBUFFERIMPL_H
|
|
7
|
+
|
|
8
|
+
#include "Helpers.h"
|
|
9
|
+
#include "ObjectWrapperImpl.h"
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class GPUBufferImpl : ObjectWrapperImpl {
|
|
13
|
+
public:
|
|
14
|
+
explicit GPUBufferImpl(const CanvasGPUBuffer *buffer);
|
|
15
|
+
|
|
16
|
+
~GPUBufferImpl() {
|
|
17
|
+
canvas_native_webgpu_buffer_release(this->GetGPUBuffer());
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const CanvasGPUBuffer *GetGPUBuffer();
|
|
21
|
+
|
|
22
|
+
static void Init(v8::Local<v8::Object> canvasModule, v8::Isolate *isolate);
|
|
23
|
+
|
|
24
|
+
static GPUBufferImpl *GetPointer(const v8::Local<v8::Object> &object);
|
|
25
|
+
|
|
26
|
+
static v8::Local<v8::FunctionTemplate> GetCtor(v8::Isolate *isolate);
|
|
27
|
+
|
|
28
|
+
static v8::Local<v8::Object> NewInstance(v8::Isolate *isolate, GPUBufferImpl *buffer) {
|
|
29
|
+
auto context = isolate->GetCurrentContext();
|
|
30
|
+
v8::EscapableHandleScope scope(isolate);
|
|
31
|
+
auto object = GPUBufferImpl::GetCtor(isolate)->GetFunction(
|
|
32
|
+
context).ToLocalChecked()->NewInstance(context).ToLocalChecked();
|
|
33
|
+
SetNativeType(buffer, NativeType::GPUBuffer);
|
|
34
|
+
object->SetAlignedPointerInInternalField(0, buffer);
|
|
35
|
+
buffer->BindFinalizer(isolate, object);
|
|
36
|
+
return scope.Escape(object);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
static void GetUsage(v8::Local<v8::Name> name,
|
|
40
|
+
const v8::PropertyCallbackInfo<v8::Value> &info);
|
|
41
|
+
|
|
42
|
+
static void GetSize(v8::Local<v8::Name> name,
|
|
43
|
+
const v8::PropertyCallbackInfo<v8::Value> &info);
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
static void Destroy(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
47
|
+
|
|
48
|
+
static void UnMap(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
49
|
+
|
|
50
|
+
static void MapAsync(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
51
|
+
|
|
52
|
+
static void GetMappedRange(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
53
|
+
|
|
54
|
+
static void GetLabel(v8::Local<v8::Name> name,
|
|
55
|
+
const v8::PropertyCallbackInfo<v8::Value> &info);
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
private:
|
|
59
|
+
const CanvasGPUBuffer *buffer_;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
#endif //CANVAS_ANDROID_GPUBUFFERIMPL_H
|