@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
|
@@ -115,7 +115,7 @@ public:
|
|
|
115
115
|
v8::EscapableHandleScope scope(isolate);
|
|
116
116
|
auto object = WebGL2RenderingContext::GetCtor(isolate)->GetFunction(
|
|
117
117
|
context).ToLocalChecked()->NewInstance(context).ToLocalChecked();
|
|
118
|
-
SetNativeType(
|
|
118
|
+
SetNativeType(renderingContext, NativeType::WebGLRenderingContextBase);
|
|
119
119
|
object->SetAlignedPointerInInternalField(0, renderingContext);
|
|
120
120
|
renderingContext->BindFinalizer(isolate, object);
|
|
121
121
|
return scope.Escape(object);
|
|
@@ -35,7 +35,7 @@ public:
|
|
|
35
35
|
v8::EscapableHandleScope scope(isolate);
|
|
36
36
|
auto object = WebGLQuery::GetCtor(isolate)->GetFunction(
|
|
37
37
|
context).ToLocalChecked()->NewInstance(context).ToLocalChecked();
|
|
38
|
-
SetNativeType(
|
|
38
|
+
SetNativeType( query, NativeType::WebGLQuery);
|
|
39
39
|
object->SetAlignedPointerInInternalField(0, query);
|
|
40
40
|
query->BindFinalizer(isolate, object);
|
|
41
41
|
return scope.Escape(object);
|
|
@@ -36,7 +36,7 @@ public:
|
|
|
36
36
|
v8::EscapableHandleScope scope(isolate);
|
|
37
37
|
auto object = WebGLSampler::GetCtor(isolate)->GetFunction(
|
|
38
38
|
context).ToLocalChecked()->NewInstance(context).ToLocalChecked();
|
|
39
|
-
SetNativeType(
|
|
39
|
+
SetNativeType( sampler, NativeType::WebGLSampler);
|
|
40
40
|
object->SetAlignedPointerInInternalField(0, sampler);
|
|
41
41
|
sampler->BindFinalizer(isolate, object);
|
|
42
42
|
return scope.Escape(object);
|
|
@@ -35,7 +35,7 @@ public:
|
|
|
35
35
|
v8::EscapableHandleScope scope(isolate);
|
|
36
36
|
auto object = WebGLSyncImpl::GetCtor(isolate)->GetFunction(
|
|
37
37
|
context).ToLocalChecked()->NewInstance(context).ToLocalChecked();
|
|
38
|
-
SetNativeType(
|
|
38
|
+
SetNativeType( sync, NativeType::WebGLSync);
|
|
39
39
|
object->SetAlignedPointerInInternalField(0, sync);
|
|
40
40
|
sync->BindFinalizer(isolate, object);
|
|
41
41
|
return scope.Escape(object);
|
|
@@ -37,7 +37,7 @@ public:
|
|
|
37
37
|
v8::EscapableHandleScope scope(isolate);
|
|
38
38
|
auto object = WebGLTransformFeedback::GetCtor(isolate)->GetFunction(
|
|
39
39
|
context).ToLocalChecked()->NewInstance(context).ToLocalChecked();
|
|
40
|
-
SetNativeType(
|
|
40
|
+
SetNativeType( feedback, NativeType::WebGLTransformFeedback);
|
|
41
41
|
object->SetAlignedPointerInInternalField(0, feedback);
|
|
42
42
|
feedback->BindFinalizer(isolate, object);
|
|
43
43
|
return scope.Escape(object);
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
#include "Helpers.h"
|
|
10
10
|
#include "ObjectWrapperImpl.h"
|
|
11
11
|
|
|
12
|
-
class WebGLVertexArrayObject: ObjectWrapperImpl {
|
|
12
|
+
class WebGLVertexArrayObject : ObjectWrapperImpl {
|
|
13
13
|
public:
|
|
14
14
|
WebGLVertexArrayObject(uint32_t vertexArrayObject) : vertexArrayObject_(vertexArrayObject) {}
|
|
15
15
|
|
|
@@ -38,7 +38,7 @@ public:
|
|
|
38
38
|
v8::EscapableHandleScope scope(isolate);
|
|
39
39
|
auto object = WebGLVertexArrayObject::GetCtor(isolate)->GetFunction(
|
|
40
40
|
context).ToLocalChecked()->NewInstance(context).ToLocalChecked();
|
|
41
|
-
SetNativeType(
|
|
41
|
+
SetNativeType(vertexArrayObject, NativeType::WebGLVertexArrayObject);
|
|
42
42
|
object->SetAlignedPointerInInternalField(0, vertexArrayObject);
|
|
43
43
|
vertexArrayObject->BindFinalizer(isolate, object);
|
|
44
44
|
return scope.Escape(object);
|
|
@@ -0,0 +1,371 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Created by Osei Fortune on 17/06/2024.
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
#include "GPUAdapterImpl.h"
|
|
6
|
+
#include "Caches.h"
|
|
7
|
+
#include "GPULabel.h"
|
|
8
|
+
GPUAdapterImpl::GPUAdapterImpl(const CanvasGPUAdapter *adapter) : adapter_(adapter) {}
|
|
9
|
+
|
|
10
|
+
const CanvasGPUAdapter *GPUAdapterImpl::GetGPUAdapter() {
|
|
11
|
+
return this->adapter_;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
void GPUAdapterImpl::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, "GPUAdapter"), func).FromJust();
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
GPUAdapterImpl *GPUAdapterImpl::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<GPUAdapterImpl *>(ptr);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
v8::Local<v8::FunctionTemplate> GPUAdapterImpl::GetCtor(v8::Isolate *isolate) {
|
|
36
|
+
auto cache = Caches::Get(isolate);
|
|
37
|
+
auto ctor = cache->GPUAdapterTmpl.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, "GPUAdapter"));
|
|
45
|
+
|
|
46
|
+
auto tmpl = ctorTmpl->InstanceTemplate();
|
|
47
|
+
tmpl->SetInternalFieldCount(2);
|
|
48
|
+
|
|
49
|
+
tmpl->SetLazyDataProperty(
|
|
50
|
+
ConvertToV8String(isolate, "features"),
|
|
51
|
+
GetFeatures
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
tmpl->SetLazyDataProperty(
|
|
55
|
+
ConvertToV8String(isolate, "isFallbackAdapter"),
|
|
56
|
+
GetIsFallbackAdapter
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
tmpl->SetLazyDataProperty(
|
|
60
|
+
ConvertToV8String(isolate, "limits"),
|
|
61
|
+
GetLimits
|
|
62
|
+
);
|
|
63
|
+
|
|
64
|
+
tmpl->Set(
|
|
65
|
+
ConvertToV8String(isolate, "requestAdapterInfo"),
|
|
66
|
+
v8::FunctionTemplate::New(isolate, &RequestAdapterInfo));
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
tmpl->Set(
|
|
70
|
+
ConvertToV8String(isolate, "requestDevice"),
|
|
71
|
+
v8::FunctionTemplate::New(isolate, &RequestDevice));
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
cache->GPUAdapterTmpl =
|
|
75
|
+
std::make_unique<v8::Persistent<v8::FunctionTemplate>>(isolate, ctorTmpl);
|
|
76
|
+
return ctorTmpl;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
void
|
|
81
|
+
GPUAdapterImpl::GetFeatures(v8::Local<v8::Name> name,
|
|
82
|
+
const v8::PropertyCallbackInfo<v8::Value> &info) {
|
|
83
|
+
auto ptr = GetPointer(info.This());
|
|
84
|
+
auto isolate = info.GetIsolate();
|
|
85
|
+
if (ptr != nullptr) {
|
|
86
|
+
auto context = isolate->GetCurrentContext();
|
|
87
|
+
|
|
88
|
+
auto features = canvas_native_webgpu_adapter_get_features(ptr->GetGPUAdapter());
|
|
89
|
+
|
|
90
|
+
auto len = canvas_native_string_buffer_get_length(features);
|
|
91
|
+
|
|
92
|
+
auto set = v8::Set::New(isolate);
|
|
93
|
+
for (int i = 0; i < len; ++i) {
|
|
94
|
+
auto item = canvas_native_string_buffer_get_value_at(features, i);
|
|
95
|
+
if (item != nullptr) {
|
|
96
|
+
auto keyValue = ConvertToV8String(isolate, (char *) item);
|
|
97
|
+
set->Add(context, keyValue);
|
|
98
|
+
canvas_native_string_destroy(item);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
}
|
|
102
|
+
canvas_native_string_buffer_release(features);
|
|
103
|
+
|
|
104
|
+
info.GetReturnValue().Set(set);
|
|
105
|
+
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
info.GetReturnValue().Set(v8::Map::New(info.GetIsolate()));
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
void
|
|
113
|
+
GPUAdapterImpl::GetIsFallbackAdapter(v8::Local<v8::Name> name,
|
|
114
|
+
const v8::PropertyCallbackInfo<v8::Value> &info) {
|
|
115
|
+
auto ptr = GetPointer(info.This());
|
|
116
|
+
if (ptr != nullptr) {
|
|
117
|
+
info.GetReturnValue().Set(
|
|
118
|
+
canvas_native_webgpu_adapter_is_fallback_adapter(ptr->GetGPUAdapter())
|
|
119
|
+
);
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
info.GetReturnValue().Set(false);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
void
|
|
126
|
+
GPUAdapterImpl::GetLimits(v8::Local<v8::Name> name,
|
|
127
|
+
const v8::PropertyCallbackInfo<v8::Value> &info) {
|
|
128
|
+
auto ptr = GetPointer(info.This());
|
|
129
|
+
if (ptr != nullptr) {
|
|
130
|
+
auto limits = canvas_native_webgpu_adapter_get_limits(ptr->GetGPUAdapter());
|
|
131
|
+
auto ret = GPUSupportedLimitsImpl::NewInstance(info.GetIsolate(),
|
|
132
|
+
new GPUSupportedLimitsImpl(limits));
|
|
133
|
+
info.GetReturnValue().Set(ret);
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
info.GetReturnValue().SetUndefined();
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
void GPUAdapterImpl::RequestAdapterInfo(const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
141
|
+
GPUAdapterImpl *ptr = GetPointer(args.This());
|
|
142
|
+
if (ptr == nullptr) {
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
auto isolate = args.GetIsolate();
|
|
147
|
+
|
|
148
|
+
auto info = canvas_native_webgpu_adapter_request_adapter_info(ptr->GetGPUAdapter());
|
|
149
|
+
|
|
150
|
+
if (info != nullptr) {
|
|
151
|
+
auto value = new GPUAdapterInfoImpl(info);
|
|
152
|
+
auto ret = GPUAdapterInfoImpl::NewInstance(isolate, value);
|
|
153
|
+
args.GetReturnValue().Set(ret);
|
|
154
|
+
} else {
|
|
155
|
+
args.GetReturnValue().SetUndefined();
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
struct RequestData {
|
|
161
|
+
char *error_;
|
|
162
|
+
const CanvasGPUDevice *device_;
|
|
163
|
+
char **required_features_data_;
|
|
164
|
+
size_t required_features_data_size;
|
|
165
|
+
|
|
166
|
+
~RequestData() {
|
|
167
|
+
if (required_features_data_ != nullptr) {
|
|
168
|
+
for (size_t i = 0; i < required_features_data_size; ++i) {
|
|
169
|
+
delete[] required_features_data_[i];
|
|
170
|
+
}
|
|
171
|
+
delete[] required_features_data_;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
if (error_ != nullptr) {
|
|
175
|
+
canvas_native_string_destroy(error_);
|
|
176
|
+
error_ = nullptr;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
void GPUAdapterImpl::RequestDevice(const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
182
|
+
GPUAdapterImpl *ptr = GetPointer(args.This());
|
|
183
|
+
auto isolate = args.GetIsolate();
|
|
184
|
+
auto context = isolate->GetCurrentContext();
|
|
185
|
+
auto optionsValue = args[0];
|
|
186
|
+
auto cb = args[1];
|
|
187
|
+
if (ptr == nullptr) {
|
|
188
|
+
// todo error
|
|
189
|
+
cb.As<v8::Function>()->Call(context, context->Global(), 0, nullptr);
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
auto func = cb.As<v8::Function>();
|
|
194
|
+
|
|
195
|
+
GPULabel label;
|
|
196
|
+
|
|
197
|
+
std::vector<std::string> required_features_buf;
|
|
198
|
+
|
|
199
|
+
CanvasGPUSupportedLimits *limits = nullptr;
|
|
200
|
+
|
|
201
|
+
if (!optionsValue.IsEmpty() && optionsValue->IsObject()) {
|
|
202
|
+
auto options = optionsValue.As<v8::Object>();
|
|
203
|
+
v8::Local<v8::Value> labelValue;
|
|
204
|
+
options->Get(context, ConvertToV8String(isolate, "label")).ToLocal(
|
|
205
|
+
&labelValue);
|
|
206
|
+
|
|
207
|
+
label = GPULabel(isolate, labelValue);
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
v8::Local<v8::Value> requiredFeaturesValue;
|
|
211
|
+
|
|
212
|
+
options->Get(context, ConvertToV8String(isolate, "requiredFeatures")).ToLocal(
|
|
213
|
+
&requiredFeaturesValue);
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
if (!requiredFeaturesValue.IsEmpty() && requiredFeaturesValue->IsArray()) {
|
|
217
|
+
v8::Local<v8::Array> requiredFeatures = requiredFeaturesValue.As<v8::Array>();
|
|
218
|
+
auto len = requiredFeatures->Length();
|
|
219
|
+
for (int i = 0; i < len; i++) {
|
|
220
|
+
auto item = requiredFeatures->Get(context, i);
|
|
221
|
+
if (!item.IsEmpty()) {
|
|
222
|
+
auto value = item.ToLocalChecked();
|
|
223
|
+
if (value->IsString()) {
|
|
224
|
+
required_features_buf.push_back(ConvertFromV8String(isolate, value));
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
v8::Local<v8::Value> limitsValue;
|
|
231
|
+
|
|
232
|
+
options->Get(context, ConvertToV8String(isolate, "requiredLimits")).ToLocal(
|
|
233
|
+
&limitsValue);
|
|
234
|
+
|
|
235
|
+
if (!limitsValue.IsEmpty() && limitsValue->IsObject()) {
|
|
236
|
+
auto limits_ptr = GPUSupportedLimitsImpl::GetPointer(limitsValue.As<v8::Object>());
|
|
237
|
+
if (limits_ptr != nullptr) {
|
|
238
|
+
limits = limits_ptr->GetLimits();
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
char **required_features_data = nullptr;
|
|
244
|
+
size_t required_features_data_length = required_features_buf.size();
|
|
245
|
+
|
|
246
|
+
if (required_features_data_length > 0) {
|
|
247
|
+
required_features_data = new char *[required_features_data_length];
|
|
248
|
+
|
|
249
|
+
for (size_t i = 0; i < required_features_data_length; ++i) {
|
|
250
|
+
required_features_data[i] = new char[required_features_buf[i].size() + 1];
|
|
251
|
+
auto src = required_features_buf[i].c_str();
|
|
252
|
+
std::strcpy(required_features_data[i], src);
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
auto callback = new AsyncCallback{
|
|
257
|
+
isolate,
|
|
258
|
+
func,
|
|
259
|
+
[](bool done, void *data) {
|
|
260
|
+
if (data != nullptr) {
|
|
261
|
+
auto async_data = static_cast<AsyncCallback *>(data);
|
|
262
|
+
auto func = async_data->inner_.get();
|
|
263
|
+
if (func != nullptr && func->isolate_ != nullptr) {
|
|
264
|
+
v8::Isolate *isolate = func->isolate_;
|
|
265
|
+
v8::Locker locker(isolate);
|
|
266
|
+
v8::Isolate::Scope isolate_scope(isolate);
|
|
267
|
+
v8::HandleScope handle_scope(isolate);
|
|
268
|
+
v8::Local<v8::Function> callback = func->callback_.Get(
|
|
269
|
+
isolate);
|
|
270
|
+
v8::Local<v8::Context> context = callback->GetCreationContextChecked();
|
|
271
|
+
v8::Context::Scope context_scope(context);
|
|
272
|
+
|
|
273
|
+
RequestData *requestData = nullptr;
|
|
274
|
+
if (func->data != nullptr) {
|
|
275
|
+
requestData = static_cast<RequestData *>(func->data);
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
if (requestData == nullptr) {
|
|
279
|
+
// Should never happen
|
|
280
|
+
v8::Local<v8::Value> args[1] = {
|
|
281
|
+
v8::Exception::Error(
|
|
282
|
+
ConvertToV8String(isolate, "Internal Error"))};
|
|
283
|
+
|
|
284
|
+
callback->Call(context, context->Global(),
|
|
285
|
+
1,
|
|
286
|
+
args); // ignore JS return value
|
|
287
|
+
delete static_cast<AsyncCallback *>(data);
|
|
288
|
+
|
|
289
|
+
return;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
if (requestData->error_ != nullptr) {
|
|
293
|
+
v8::Local<v8::Value> args[1] = {
|
|
294
|
+
v8::Exception::Error(
|
|
295
|
+
ConvertToV8String(isolate,
|
|
296
|
+
requestData->error_))};
|
|
297
|
+
|
|
298
|
+
callback->Call(context, context->Global(),
|
|
299
|
+
1,
|
|
300
|
+
args); // ignore JS return value
|
|
301
|
+
|
|
302
|
+
|
|
303
|
+
} else {
|
|
304
|
+
|
|
305
|
+
auto impl = new GPUDeviceImpl(requestData->device_);
|
|
306
|
+
auto ret = GPUDeviceImpl::NewInstance(
|
|
307
|
+
isolate, impl);
|
|
308
|
+
|
|
309
|
+
v8::Local<v8::Value> args[2] = {
|
|
310
|
+
v8::Null(isolate), ret};
|
|
311
|
+
|
|
312
|
+
|
|
313
|
+
callback->Call(context, context->Global(),
|
|
314
|
+
2,
|
|
315
|
+
args); // ignore JS return value
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
if (requestData != nullptr) {
|
|
319
|
+
delete requestData;
|
|
320
|
+
requestData = nullptr;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
delete static_cast<AsyncCallback *>(data);
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
};
|
|
328
|
+
|
|
329
|
+
auto inner = callback->inner_.get();
|
|
330
|
+
|
|
331
|
+
if (required_features_data != nullptr) {
|
|
332
|
+
inner->data = new RequestData{
|
|
333
|
+
nullptr,
|
|
334
|
+
nullptr,
|
|
335
|
+
required_features_data,
|
|
336
|
+
required_features_data_length
|
|
337
|
+
};
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
callback->prepare();
|
|
341
|
+
|
|
342
|
+
canvas_native_webgpu_adapter_request_device(ptr->GetGPUAdapter(),
|
|
343
|
+
*label,
|
|
344
|
+
required_features_data,
|
|
345
|
+
required_features_data_length,
|
|
346
|
+
limits,
|
|
347
|
+
[](char *error, const CanvasGPUDevice *device,
|
|
348
|
+
void *data) {
|
|
349
|
+
if (data != nullptr) {
|
|
350
|
+
auto async_data = static_cast<AsyncCallback *>(data);
|
|
351
|
+
auto inner = async_data->inner_.get();
|
|
352
|
+
if (inner != nullptr) {
|
|
353
|
+
if (inner->data == nullptr) {
|
|
354
|
+
inner->data = new RequestData{
|
|
355
|
+
error,
|
|
356
|
+
device
|
|
357
|
+
};
|
|
358
|
+
} else {
|
|
359
|
+
auto request_data = static_cast<RequestData *>(inner->data);
|
|
360
|
+
request_data->error_ = error;
|
|
361
|
+
request_data->device_ = device;
|
|
362
|
+
delete request_data->required_features_data_;
|
|
363
|
+
request_data->required_features_data_ = nullptr;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
async_data->execute(true);
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
}, callback);
|
|
370
|
+
|
|
371
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Created by Osei Fortune on 17/06/2024.
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
#ifndef CANVAS_ANDROID_GPUADAPTERIMPL_H
|
|
6
|
+
#define CANVAS_ANDROID_GPUADAPTERIMPL_H
|
|
7
|
+
|
|
8
|
+
#include "Common.h"
|
|
9
|
+
#include "Helpers.h"
|
|
10
|
+
#include "ObjectWrapperImpl.h"
|
|
11
|
+
#include "GPUSupportedLimitsImpl.h"
|
|
12
|
+
#include "GPUDeviceImpl.h"
|
|
13
|
+
#include "GPUAdapterInfoImpl.h"
|
|
14
|
+
|
|
15
|
+
class GPUAdapterImpl : ObjectWrapperImpl {
|
|
16
|
+
public:
|
|
17
|
+
explicit GPUAdapterImpl(const CanvasGPUAdapter *adapter);
|
|
18
|
+
|
|
19
|
+
~GPUAdapterImpl() {
|
|
20
|
+
canvas_native_webgpu_adapter_release(this->GetGPUAdapter());
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const CanvasGPUAdapter *GetGPUAdapter();
|
|
24
|
+
|
|
25
|
+
static void Init(v8::Local<v8::Object> canvasModule, v8::Isolate *isolate);
|
|
26
|
+
|
|
27
|
+
static GPUAdapterImpl *GetPointer(const v8::Local<v8::Object> &object);
|
|
28
|
+
|
|
29
|
+
static v8::Local<v8::FunctionTemplate> GetCtor(v8::Isolate *isolate);
|
|
30
|
+
|
|
31
|
+
static v8::Local<v8::Object> NewInstance(v8::Isolate *isolate, GPUAdapterImpl *adapter) {
|
|
32
|
+
auto context = isolate->GetCurrentContext();
|
|
33
|
+
v8::EscapableHandleScope scope(isolate);
|
|
34
|
+
auto object = GPUAdapterImpl::GetCtor(isolate)->GetFunction(
|
|
35
|
+
context).ToLocalChecked()->NewInstance(context).ToLocalChecked();
|
|
36
|
+
SetNativeType(adapter, NativeType::GPUAdapter);
|
|
37
|
+
object->SetAlignedPointerInInternalField(0, adapter);
|
|
38
|
+
adapter->BindFinalizer(isolate, object);
|
|
39
|
+
return scope.Escape(object);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
static void GetFeatures(v8::Local<v8::Name> name,
|
|
43
|
+
const v8::PropertyCallbackInfo<v8::Value> &info);
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
static void GetIsFallbackAdapter(v8::Local<v8::Name> name,
|
|
47
|
+
const v8::PropertyCallbackInfo<v8::Value> &info);
|
|
48
|
+
|
|
49
|
+
static void GetLimits(v8::Local<v8::Name> name,
|
|
50
|
+
const v8::PropertyCallbackInfo<v8::Value> &info);
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
static void RequestAdapterInfo(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
54
|
+
|
|
55
|
+
static void RequestDevice(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
private:
|
|
59
|
+
const CanvasGPUAdapter *adapter_;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
#endif //CANVAS_ANDROID_GPUADAPTERIMPL_H
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Created by Osei Fortune on 17/06/2024.
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
#include "GPUAdapterInfoImpl.h"
|
|
6
|
+
#include "Caches.h"
|
|
7
|
+
|
|
8
|
+
GPUAdapterInfoImpl::GPUAdapterInfoImpl(const CanvasGPUAdapterInfo *info) : info_(info) {}
|
|
9
|
+
|
|
10
|
+
const CanvasGPUAdapterInfo *GPUAdapterInfoImpl::GetInfo() {
|
|
11
|
+
return this->info_;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
void GPUAdapterInfoImpl::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, "GPUAdapterInfo"), func).FromJust();
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
GPUAdapterInfoImpl *GPUAdapterInfoImpl::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<GPUAdapterInfoImpl *>(ptr);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
v8::Local<v8::FunctionTemplate> GPUAdapterInfoImpl::GetCtor(v8::Isolate *isolate) {
|
|
36
|
+
auto cache = Caches::Get(isolate);
|
|
37
|
+
auto ctor = cache->GPUAdapterInfoTmpl.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, "GPUAdapterInfo"));
|
|
45
|
+
|
|
46
|
+
auto tmpl = ctorTmpl->InstanceTemplate();
|
|
47
|
+
tmpl->SetInternalFieldCount(2);
|
|
48
|
+
|
|
49
|
+
tmpl->SetLazyDataProperty(
|
|
50
|
+
ConvertToV8String(isolate, "architecture"),
|
|
51
|
+
GetArchitecture
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
tmpl->SetLazyDataProperty(
|
|
55
|
+
ConvertToV8String(isolate, "description"),
|
|
56
|
+
GetDescription
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
tmpl->SetLazyDataProperty(
|
|
60
|
+
ConvertToV8String(isolate, "device"),
|
|
61
|
+
GetDevice
|
|
62
|
+
);
|
|
63
|
+
|
|
64
|
+
tmpl->SetLazyDataProperty(
|
|
65
|
+
ConvertToV8String(isolate, "vendor"),
|
|
66
|
+
GetVendor
|
|
67
|
+
);
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
cache->GPUAdapterInfoTmpl =
|
|
71
|
+
std::make_unique<v8::Persistent<v8::FunctionTemplate>>(isolate, ctorTmpl);
|
|
72
|
+
return ctorTmpl;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
void
|
|
77
|
+
GPUAdapterInfoImpl::GetArchitecture(v8::Local<v8::Name> name,
|
|
78
|
+
const v8::PropertyCallbackInfo<v8::Value> &info) {
|
|
79
|
+
auto ptr = GetPointer(info.This());
|
|
80
|
+
|
|
81
|
+
if (ptr == nullptr) {
|
|
82
|
+
info.GetReturnValue().SetEmptyString();
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
auto architecture = canvas_native_webgpu_adapter_info_architecture(ptr->GetInfo());
|
|
87
|
+
|
|
88
|
+
if (architecture == nullptr) {
|
|
89
|
+
info.GetReturnValue().SetEmptyString();
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
auto ret = ConvertToV8String(info.GetIsolate(), architecture);
|
|
94
|
+
|
|
95
|
+
canvas_native_string_destroy(architecture);
|
|
96
|
+
|
|
97
|
+
info.GetReturnValue().Set(ret);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
void
|
|
102
|
+
GPUAdapterInfoImpl::GetDescription(v8::Local<v8::Name> name,
|
|
103
|
+
const v8::PropertyCallbackInfo<v8::Value> &info) {
|
|
104
|
+
auto ptr = GetPointer(info.This());
|
|
105
|
+
|
|
106
|
+
if (ptr == nullptr) {
|
|
107
|
+
info.GetReturnValue().SetEmptyString();
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
auto description = canvas_native_webgpu_adapter_info_description(ptr->GetInfo());
|
|
112
|
+
|
|
113
|
+
if (description == nullptr) {
|
|
114
|
+
info.GetReturnValue().SetEmptyString();
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
auto ret = ConvertToV8String(info.GetIsolate(), description);
|
|
119
|
+
|
|
120
|
+
canvas_native_string_destroy(description);
|
|
121
|
+
|
|
122
|
+
info.GetReturnValue().Set(ret);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
void
|
|
127
|
+
GPUAdapterInfoImpl::GetDevice(v8::Local<v8::Name> name,
|
|
128
|
+
const v8::PropertyCallbackInfo<v8::Value> &info) {
|
|
129
|
+
auto ptr = GetPointer(info.This());
|
|
130
|
+
|
|
131
|
+
if (ptr == nullptr) {
|
|
132
|
+
info.GetReturnValue().SetEmptyString();
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
auto device = canvas_native_webgpu_adapter_info_device(ptr->GetInfo());
|
|
137
|
+
|
|
138
|
+
if (device == nullptr) {
|
|
139
|
+
info.GetReturnValue().SetEmptyString();
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
auto ret = ConvertToV8String(info.GetIsolate(), device);
|
|
144
|
+
|
|
145
|
+
canvas_native_string_destroy(device);
|
|
146
|
+
|
|
147
|
+
info.GetReturnValue().Set(ret);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
void
|
|
152
|
+
GPUAdapterInfoImpl::GetVendor(v8::Local<v8::Name> name,
|
|
153
|
+
const v8::PropertyCallbackInfo<v8::Value> &info) {
|
|
154
|
+
auto ptr = GetPointer(info.This());
|
|
155
|
+
|
|
156
|
+
if (ptr == nullptr) {
|
|
157
|
+
info.GetReturnValue().SetEmptyString();
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
auto vendor = canvas_native_webgpu_adapter_info_vendor(ptr->GetInfo());
|
|
162
|
+
|
|
163
|
+
if (vendor == nullptr) {
|
|
164
|
+
info.GetReturnValue().SetEmptyString();
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
auto ret = ConvertToV8String(info.GetIsolate(), vendor);
|
|
169
|
+
|
|
170
|
+
canvas_native_string_destroy(vendor);
|
|
171
|
+
|
|
172
|
+
info.GetReturnValue().Set(ret);
|
|
173
|
+
}
|
|
174
|
+
|