@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,55 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Created by Osei Fortune on 23/06/2024.
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
#ifndef CANVAS_ANDROID_GPUQUERYSETIMPL_H
|
|
6
|
+
#define CANVAS_ANDROID_GPUQUERYSETIMPL_H
|
|
7
|
+
|
|
8
|
+
#include "Helpers.h"
|
|
9
|
+
#include "ObjectWrapperImpl.h"
|
|
10
|
+
|
|
11
|
+
class GPUQuerySetImpl : ObjectWrapperImpl {
|
|
12
|
+
public:
|
|
13
|
+
explicit GPUQuerySetImpl(const CanvasGPUQuerySet *querySet);
|
|
14
|
+
|
|
15
|
+
~GPUQuerySetImpl() {
|
|
16
|
+
canvas_native_webgpu_query_set_release(this->GetQuerySet());
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const CanvasGPUQuerySet *GetQuerySet();
|
|
20
|
+
|
|
21
|
+
static void Init(v8::Local<v8::Object> canvasModule, v8::Isolate *isolate);
|
|
22
|
+
|
|
23
|
+
static GPUQuerySetImpl *GetPointer(const v8::Local<v8::Object> &object);
|
|
24
|
+
|
|
25
|
+
static v8::Local<v8::FunctionTemplate> GetCtor(v8::Isolate *isolate);
|
|
26
|
+
|
|
27
|
+
static v8::Local<v8::Object> NewInstance(v8::Isolate *isolate, GPUQuerySetImpl *querySet) {
|
|
28
|
+
auto context = isolate->GetCurrentContext();
|
|
29
|
+
v8::EscapableHandleScope scope(isolate);
|
|
30
|
+
auto object = GPUQuerySetImpl::GetCtor(isolate)->GetFunction(
|
|
31
|
+
context).ToLocalChecked()->NewInstance(context).ToLocalChecked();
|
|
32
|
+
SetNativeType(querySet, NativeType::GPUQuerySet);
|
|
33
|
+
object->SetAlignedPointerInInternalField(0, querySet);
|
|
34
|
+
querySet->BindFinalizer(isolate, object);
|
|
35
|
+
return scope.Escape(object);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
static void GetType(v8::Local<v8::Name> name,
|
|
39
|
+
const v8::PropertyCallbackInfo<v8::Value> &info);
|
|
40
|
+
|
|
41
|
+
static void GetCount(v8::Local<v8::Name> name,
|
|
42
|
+
const v8::PropertyCallbackInfo<v8::Value> &info);
|
|
43
|
+
|
|
44
|
+
static void GetLabel(v8::Local<v8::Name> name,
|
|
45
|
+
const v8::PropertyCallbackInfo<v8::Value> &info);
|
|
46
|
+
|
|
47
|
+
static void Destroy(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
private:
|
|
51
|
+
const CanvasGPUQuerySet *querySet_;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
#endif //CANVAS_ANDROID_GPUQUERYSETIMPL_H
|
|
@@ -0,0 +1,605 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Created by Osei Fortune on 18/06/2024.
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
#include "GPUQueueImpl.h"
|
|
6
|
+
#include "Caches.h"
|
|
7
|
+
#include "GPUBufferImpl.h"
|
|
8
|
+
#include "GPUCommandBufferImpl.h"
|
|
9
|
+
#include "JSICallback.h"
|
|
10
|
+
#include "GPUTextureImpl.h"
|
|
11
|
+
#include "ImageAssetImpl.h"
|
|
12
|
+
#include "ImageBitmapImpl.h"
|
|
13
|
+
#include "ImageDataImpl.h"
|
|
14
|
+
#include "CanvasRenderingContext2DImpl.h"
|
|
15
|
+
#include "WebGLRenderingContextBase.h"
|
|
16
|
+
|
|
17
|
+
GPUQueueImpl::GPUQueueImpl(const CanvasGPUQueue *queue) : queue_(queue) {}
|
|
18
|
+
|
|
19
|
+
const CanvasGPUQueue *GPUQueueImpl::GetGPUQueue() {
|
|
20
|
+
return this->queue_;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
void GPUQueueImpl::Init(v8::Local<v8::Object> canvasModule, v8::Isolate *isolate) {
|
|
25
|
+
v8::Locker locker(isolate);
|
|
26
|
+
v8::Isolate::Scope isolate_scope(isolate);
|
|
27
|
+
v8::HandleScope handle_scope(isolate);
|
|
28
|
+
|
|
29
|
+
auto ctor = GetCtor(isolate);
|
|
30
|
+
auto context = isolate->GetCurrentContext();
|
|
31
|
+
auto func = ctor->GetFunction(context).ToLocalChecked();
|
|
32
|
+
|
|
33
|
+
canvasModule->Set(context, ConvertToV8String(isolate, "GPUQueue"), func).FromJust();
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
GPUQueueImpl *GPUQueueImpl::GetPointer(const v8::Local<v8::Object> &object) {
|
|
37
|
+
auto ptr = object->GetAlignedPointerFromInternalField(0);
|
|
38
|
+
if (ptr == nullptr) {
|
|
39
|
+
return nullptr;
|
|
40
|
+
}
|
|
41
|
+
return static_cast<GPUQueueImpl *>(ptr);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
v8::Local<v8::FunctionTemplate> GPUQueueImpl::GetCtor(v8::Isolate *isolate) {
|
|
45
|
+
auto cache = Caches::Get(isolate);
|
|
46
|
+
auto ctor = cache->GPUQueueTmpl.get();
|
|
47
|
+
if (ctor != nullptr) {
|
|
48
|
+
return ctor->Get(isolate);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
v8::Local<v8::FunctionTemplate> ctorTmpl = v8::FunctionTemplate::New(isolate);
|
|
52
|
+
ctorTmpl->InstanceTemplate()->SetInternalFieldCount(2);
|
|
53
|
+
ctorTmpl->SetClassName(ConvertToV8String(isolate, "GPUQueue"));
|
|
54
|
+
|
|
55
|
+
auto tmpl = ctorTmpl->InstanceTemplate();
|
|
56
|
+
tmpl->SetInternalFieldCount(2);
|
|
57
|
+
|
|
58
|
+
tmpl->SetLazyDataProperty(
|
|
59
|
+
ConvertToV8String(isolate, "label"),
|
|
60
|
+
GetLabel
|
|
61
|
+
);
|
|
62
|
+
|
|
63
|
+
tmpl->Set(
|
|
64
|
+
ConvertToV8String(isolate, "copyExternalImageToTexture"),
|
|
65
|
+
v8::FunctionTemplate::New(isolate, &CopyExternalImageToTexture));
|
|
66
|
+
|
|
67
|
+
tmpl->Set(
|
|
68
|
+
ConvertToV8String(isolate, "submit"),
|
|
69
|
+
v8::FunctionTemplate::New(isolate, &Submit));
|
|
70
|
+
|
|
71
|
+
tmpl->Set(
|
|
72
|
+
ConvertToV8String(isolate, "onSubmittedWorkDone"),
|
|
73
|
+
v8::FunctionTemplate::New(isolate, &SubmitWorkDone));
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
tmpl->Set(
|
|
77
|
+
ConvertToV8String(isolate, "writeBuffer"),
|
|
78
|
+
v8::FunctionTemplate::New(isolate, &WriteBuffer));
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
tmpl->Set(
|
|
82
|
+
ConvertToV8String(isolate, "writeTexture"),
|
|
83
|
+
v8::FunctionTemplate::New(isolate, &WriteTexture));
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
cache->GPUQueueTmpl =
|
|
87
|
+
std::make_unique<v8::Persistent<v8::FunctionTemplate>>(isolate, ctorTmpl);
|
|
88
|
+
return ctorTmpl;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
void
|
|
93
|
+
GPUQueueImpl::GetLabel(v8::Local<v8::Name> name,
|
|
94
|
+
const v8::PropertyCallbackInfo<v8::Value> &info) {
|
|
95
|
+
auto ptr = GetPointer(info.This());
|
|
96
|
+
if (ptr != nullptr) {
|
|
97
|
+
auto label = canvas_native_webgpu_queue_get_label(ptr->queue_);
|
|
98
|
+
if (label == nullptr) {
|
|
99
|
+
info.GetReturnValue().SetEmptyString();
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
info.GetReturnValue().Set(
|
|
103
|
+
ConvertToV8String(info.GetIsolate(), label)
|
|
104
|
+
);
|
|
105
|
+
canvas_native_string_destroy(label);
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
info.GetReturnValue().SetEmptyString();
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
void GPUQueueImpl::CopyExternalImageToTexture(const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
114
|
+
auto *ptr = GetPointer(args.This());
|
|
115
|
+
if (ptr == nullptr) {
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
auto isolate = args.GetIsolate();
|
|
120
|
+
auto context = isolate->GetCurrentContext();
|
|
121
|
+
|
|
122
|
+
auto sourceVal = args[0];
|
|
123
|
+
auto destinationVal = args[1];
|
|
124
|
+
auto sizeVal = args[2];
|
|
125
|
+
|
|
126
|
+
if (sourceVal->IsObject() && destinationVal->IsObject() &&
|
|
127
|
+
sizeVal->IsObject()) {
|
|
128
|
+
|
|
129
|
+
auto sourceObj = sourceVal.As<v8::Object>();
|
|
130
|
+
|
|
131
|
+
v8::Local<v8::Value> sourceSourceValue;
|
|
132
|
+
sourceObj->Get(context, ConvertToV8String(isolate, "source")).ToLocal(&sourceSourceValue);
|
|
133
|
+
|
|
134
|
+
auto sourceType = GetNativeType(sourceSourceValue);
|
|
135
|
+
|
|
136
|
+
U8Buffer *buffer = nullptr;
|
|
137
|
+
uint32_t width = 0;
|
|
138
|
+
uint32_t height = 0;
|
|
139
|
+
const ImageAsset *imageAsset = nullptr;
|
|
140
|
+
const WebGLState *gl = nullptr;
|
|
141
|
+
const CanvasRenderingContext2D *c2d = nullptr;
|
|
142
|
+
if (sourceType == NativeType::ImageBitmap) {
|
|
143
|
+
auto bitmap = ImageBitmapImpl::GetPointer(sourceSourceValue.As<v8::Object>());
|
|
144
|
+
imageAsset = bitmap->GetImageAsset();
|
|
145
|
+
} else if (sourceType == NativeType::ImageAsset) {
|
|
146
|
+
auto asset = ImageAssetImpl::GetPointer(sourceSourceValue.As<v8::Object>());
|
|
147
|
+
imageAsset = asset->GetImageAsset();
|
|
148
|
+
} else if (sourceType == NativeType::ImageData) {
|
|
149
|
+
auto imageData = ImageDataImpl::GetPointer(sourceSourceValue.As<v8::Object>());
|
|
150
|
+
buffer = canvas_native_image_data_get_data(imageData->GetImageData());
|
|
151
|
+
width = canvas_native_image_data_get_width(imageData->GetImageData());
|
|
152
|
+
height = canvas_native_image_data_get_height(imageData->GetImageData());
|
|
153
|
+
} else if (sourceType == NativeType::CanvasRenderingContext2D) {
|
|
154
|
+
auto ctx = CanvasRenderingContext2DImpl::GetPointer(sourceSourceValue.As<v8::Object>());
|
|
155
|
+
c2d = ctx->GetContext();
|
|
156
|
+
} else if (sourceType == NativeType::WebGLRenderingContextBase) {
|
|
157
|
+
auto webgl = WebGLRenderingContextBase::GetPointer(sourceSourceValue.As<v8::Object>());
|
|
158
|
+
gl = webgl->GetState();
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
if (buffer == nullptr && imageAsset == nullptr && gl == nullptr && c2d == nullptr) {
|
|
162
|
+
// todo error ??
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
CanvasOrigin2d sourceOrigin{0, 0};
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
v8::Local<v8::Value> sourceOriginVal;
|
|
170
|
+
if (sourceObj->Get(context, ConvertToV8String(isolate, "origin")).ToLocal(
|
|
171
|
+
&sourceOriginVal) &&
|
|
172
|
+
sourceOriginVal->IsObject()) {
|
|
173
|
+
auto sourceOriginObj = sourceOriginVal.As<v8::Object>();
|
|
174
|
+
|
|
175
|
+
v8::Local<v8::Value> xVal;
|
|
176
|
+
if (sourceOriginObj->Get(context, ConvertToV8String(isolate, "x")).ToLocal(&xVal) &&
|
|
177
|
+
xVal->IsUint32()) {
|
|
178
|
+
sourceOrigin.x = xVal->Uint32Value(context).FromJust();
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
v8::Local<v8::Value> yVal;
|
|
182
|
+
if (sourceOriginObj->Get(context, ConvertToV8String(isolate, "y")).ToLocal(&yVal) &&
|
|
183
|
+
yVal->IsUint32()) {
|
|
184
|
+
sourceOrigin.y = yVal->Uint32Value(context).FromJust();
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
bool flipY = false;
|
|
190
|
+
|
|
191
|
+
v8::Local<v8::Value> flipYVal;
|
|
192
|
+
if (sourceObj->Get(context, ConvertToV8String(isolate, "flipY")).ToLocal(&flipYVal) &&
|
|
193
|
+
flipYVal->IsBoolean()) {
|
|
194
|
+
flipY = flipYVal->BooleanValue(isolate);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
auto destinationObj = destinationVal.As<v8::Object>();
|
|
198
|
+
|
|
199
|
+
auto textureVal = destinationObj->Get(context, ConvertToV8String(isolate,
|
|
200
|
+
"texture")).ToLocalChecked();
|
|
201
|
+
auto texture = GPUTextureImpl::GetPointer(textureVal.As<v8::Object>())->GetTexture();
|
|
202
|
+
|
|
203
|
+
uint32_t mipLevel = 0;
|
|
204
|
+
CanvasOrigin3d origin{0, 0, 0};
|
|
205
|
+
CanvasTextureAspect aspect = CanvasTextureAspectAll;
|
|
206
|
+
|
|
207
|
+
v8::Local<v8::Value> mipLevelVal;
|
|
208
|
+
if (destinationObj->Get(context, ConvertToV8String(isolate, "mipLevel")).ToLocal(
|
|
209
|
+
&mipLevelVal) &&
|
|
210
|
+
mipLevelVal->IsUint32()) {
|
|
211
|
+
mipLevel = mipLevelVal->Uint32Value(context).FromJust();
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
v8::Local<v8::Value> originVal;
|
|
216
|
+
if (destinationObj->Get(context, ConvertToV8String(isolate, "origin")).ToLocal(
|
|
217
|
+
&originVal) &&
|
|
218
|
+
originVal->IsObject()) {
|
|
219
|
+
auto originObj = originVal.As<v8::Object>();
|
|
220
|
+
|
|
221
|
+
v8::Local<v8::Value> xVal;
|
|
222
|
+
if (originObj->Get(context, ConvertToV8String(isolate, "x")).ToLocal(&xVal) &&
|
|
223
|
+
xVal->IsUint32()) {
|
|
224
|
+
origin.x = xVal->Uint32Value(context).FromJust();
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
v8::Local<v8::Value> yVal;
|
|
228
|
+
if (originObj->Get(context, ConvertToV8String(isolate, "y")).ToLocal(&yVal) &&
|
|
229
|
+
yVal->IsUint32()) {
|
|
230
|
+
origin.y = yVal->Uint32Value(context).FromJust();
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
v8::Local<v8::Value> zVal;
|
|
234
|
+
if (originObj->Get(context, ConvertToV8String(isolate, "z")).ToLocal(&zVal) &&
|
|
235
|
+
zVal->IsUint32()) {
|
|
236
|
+
origin.z = zVal->Uint32Value(context).FromJust();
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
v8::Local<v8::Value> aspectVal;
|
|
243
|
+
if (destinationObj->Get(context, ConvertToV8String(isolate, "aspect")).ToLocal(
|
|
244
|
+
&aspectVal)) {
|
|
245
|
+
if (aspectVal->IsString()) {
|
|
246
|
+
auto aspectStr = ConvertFromV8String(isolate, aspectVal);
|
|
247
|
+
if (aspectStr == "depth-only") {
|
|
248
|
+
aspect = CanvasTextureAspectDepthOnly;
|
|
249
|
+
} else if (aspectStr == "stencil-only") {
|
|
250
|
+
aspect = CanvasTextureAspectStencilOnly;
|
|
251
|
+
} else if (aspectStr == "all") {
|
|
252
|
+
aspect = CanvasTextureAspectAll;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
CanvasImageCopyTexture destination{
|
|
258
|
+
texture,
|
|
259
|
+
mipLevel,
|
|
260
|
+
origin,
|
|
261
|
+
aspect
|
|
262
|
+
};
|
|
263
|
+
|
|
264
|
+
|
|
265
|
+
CanvasExtent3d extent3D = ParseExtent3d(isolate, sizeVal);
|
|
266
|
+
|
|
267
|
+
if (imageAsset != nullptr) {
|
|
268
|
+
CanvasImageCopyImageAsset source{
|
|
269
|
+
imageAsset,
|
|
270
|
+
sourceOrigin,
|
|
271
|
+
flipY,
|
|
272
|
+
};
|
|
273
|
+
|
|
274
|
+
|
|
275
|
+
canvas_native_webgpu_queue_copy_image_asset_to_texture(ptr->GetGPUQueue(), &source,
|
|
276
|
+
&destination,
|
|
277
|
+
&extent3D);
|
|
278
|
+
return;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
if (c2d != nullptr) {
|
|
283
|
+
CanvasImageCopyCanvasRenderingContext2D source{
|
|
284
|
+
c2d,
|
|
285
|
+
sourceOrigin,
|
|
286
|
+
flipY,
|
|
287
|
+
};
|
|
288
|
+
|
|
289
|
+
|
|
290
|
+
canvas_native_webgpu_queue_copy_context_to_texture(ptr->GetGPUQueue(), &source,
|
|
291
|
+
&destination,
|
|
292
|
+
&extent3D);
|
|
293
|
+
return;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
if (gl != nullptr) {
|
|
297
|
+
CanvasImageCopyWebGL source{
|
|
298
|
+
gl,
|
|
299
|
+
sourceOrigin,
|
|
300
|
+
flipY,
|
|
301
|
+
};
|
|
302
|
+
|
|
303
|
+
|
|
304
|
+
canvas_native_webgpu_queue_copy_webgl_to_texture(ptr->GetGPUQueue(), &source,
|
|
305
|
+
&destination,
|
|
306
|
+
&extent3D);
|
|
307
|
+
return;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
|
|
311
|
+
auto data = canvas_native_u8_buffer_get_bytes(buffer);
|
|
312
|
+
auto size = canvas_native_u8_buffer_get_length(buffer);
|
|
313
|
+
|
|
314
|
+
|
|
315
|
+
if (data == nullptr || size == 0) {
|
|
316
|
+
// todo error
|
|
317
|
+
return;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
CanvasImageCopyExternalImage source{
|
|
321
|
+
data,
|
|
322
|
+
size,
|
|
323
|
+
sourceOrigin,
|
|
324
|
+
flipY,
|
|
325
|
+
width,
|
|
326
|
+
height,
|
|
327
|
+
};
|
|
328
|
+
|
|
329
|
+
|
|
330
|
+
canvas_native_webgpu_queue_copy_external_image_to_texture(ptr->GetGPUQueue(), &source,
|
|
331
|
+
&destination,
|
|
332
|
+
&extent3D);
|
|
333
|
+
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
void GPUQueueImpl::Submit(const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
338
|
+
auto *ptr = GetPointer(args.This());
|
|
339
|
+
if (ptr == nullptr) {
|
|
340
|
+
return;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
auto isolate = args.GetIsolate();
|
|
344
|
+
auto context = isolate->GetCurrentContext();
|
|
345
|
+
|
|
346
|
+
std::vector<const CanvasGPUCommandBuffer *> commandBuffers;
|
|
347
|
+
auto commandBuffersVal = args[0];
|
|
348
|
+
|
|
349
|
+
if (commandBuffersVal->IsArray()) {
|
|
350
|
+
auto commandBuffersArray = commandBuffersVal.As<v8::Array>();
|
|
351
|
+
auto len = commandBuffersArray->Length();
|
|
352
|
+
|
|
353
|
+
for (int i = 0; i < len; i++) {
|
|
354
|
+
v8::Local<v8::Value> item;
|
|
355
|
+
commandBuffersArray->Get(context, i).ToLocal(&item);
|
|
356
|
+
auto type = GetNativeType(item);
|
|
357
|
+
if (type == NativeType::GPUCommandBuffer) {
|
|
358
|
+
auto buffer = GPUCommandBufferImpl::GetPointer(item.As<v8::Object>());
|
|
359
|
+
if (buffer != nullptr) {
|
|
360
|
+
commandBuffers.push_back(buffer->GetGPUCommandBuffer());
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
|
|
366
|
+
canvas_native_webgpu_queue_submit(ptr->GetGPUQueue(), commandBuffers.data(),
|
|
367
|
+
commandBuffers.size());
|
|
368
|
+
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
void GPUQueueImpl::SubmitWorkDone(const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
375
|
+
auto *ptr = GetPointer(args.This());
|
|
376
|
+
if (ptr == nullptr) {
|
|
377
|
+
return;
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
auto isolate = args.GetIsolate();
|
|
381
|
+
auto cb = args[0].As<v8::Function>();
|
|
382
|
+
auto callback = new AsyncCallback(isolate, cb, [](bool done, void *data) {
|
|
383
|
+
if (data != nullptr) {
|
|
384
|
+
auto async_data = static_cast<AsyncCallback *>(data);
|
|
385
|
+
auto func = async_data->inner_.get();
|
|
386
|
+
if (func != nullptr && func->isolate_ != nullptr) {
|
|
387
|
+
v8::Isolate *isolate = func->isolate_;
|
|
388
|
+
v8::Locker locker(isolate);
|
|
389
|
+
v8::Isolate::Scope isolate_scope(
|
|
390
|
+
isolate);
|
|
391
|
+
v8::HandleScope handle_scope(
|
|
392
|
+
isolate);
|
|
393
|
+
v8::Local<v8::Function> callback = func->callback_.Get(
|
|
394
|
+
isolate);
|
|
395
|
+
v8::Local<v8::Context> context = callback->GetCreationContextChecked();
|
|
396
|
+
v8::Context::Scope context_scope(
|
|
397
|
+
context);
|
|
398
|
+
|
|
399
|
+
if (func->data != nullptr) {
|
|
400
|
+
// todo handle error
|
|
401
|
+
canvas_native_string_destroy(static_cast<char *>(func->data));
|
|
402
|
+
func->data = nullptr;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
callback->Call(context,
|
|
406
|
+
context->Global(),
|
|
407
|
+
0, nullptr);
|
|
408
|
+
|
|
409
|
+
delete static_cast<AsyncCallback *>(data);
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
}
|
|
413
|
+
});
|
|
414
|
+
|
|
415
|
+
callback->prepare();
|
|
416
|
+
|
|
417
|
+
canvas_native_webgpu_queue_on_submitted_work_done(ptr->GetGPUQueue(),
|
|
418
|
+
[](char *error, void *data) {
|
|
419
|
+
if (data != nullptr) {
|
|
420
|
+
auto async_data = static_cast<AsyncCallback *>(data);
|
|
421
|
+
async_data->execute(true);
|
|
422
|
+
}
|
|
423
|
+
},
|
|
424
|
+
callback);
|
|
425
|
+
|
|
426
|
+
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
void GPUQueueImpl::WriteBuffer(const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
430
|
+
auto *ptr = GetPointer(args.This());
|
|
431
|
+
if (ptr == nullptr) {
|
|
432
|
+
return;
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
auto isolate = args.GetIsolate();
|
|
436
|
+
auto context = isolate->GetCurrentContext();
|
|
437
|
+
|
|
438
|
+
auto bufferValue = args[0];
|
|
439
|
+
|
|
440
|
+
if (bufferValue->IsObject()) {
|
|
441
|
+
auto buffer = GPUBufferImpl::GetPointer(bufferValue.As<v8::Object>());
|
|
442
|
+
|
|
443
|
+
auto bufferOffset = (uint64_t) args[1].As<v8::Number>()->Value();
|
|
444
|
+
|
|
445
|
+
auto dataValue = args[2].As<v8::TypedArray>();
|
|
446
|
+
|
|
447
|
+
auto offset = dataValue->ByteOffset();
|
|
448
|
+
|
|
449
|
+
auto store = dataValue->Buffer()->GetBackingStore();
|
|
450
|
+
|
|
451
|
+
auto data = static_cast<uint8_t *>(store->Data()) + offset;
|
|
452
|
+
|
|
453
|
+
auto data_size = store->ByteLength() - offset;
|
|
454
|
+
|
|
455
|
+
auto dataOffset = (uint64_t) args[3].As<v8::Number>()->Value();
|
|
456
|
+
|
|
457
|
+
int64_t size = -1;
|
|
458
|
+
auto sizeValue = args[4];
|
|
459
|
+
|
|
460
|
+
if (sizeValue->IsNumber()) {
|
|
461
|
+
size = (int64_t) sizeValue->ToNumber(context).ToLocalChecked()->Value();
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
|
|
465
|
+
if (buffer != nullptr) {
|
|
466
|
+
canvas_native_webgpu_queue_write_buffer(ptr->GetGPUQueue(), buffer->GetGPUBuffer(),
|
|
467
|
+
bufferOffset, data, data_size, dataOffset,
|
|
468
|
+
size);
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
void GPUQueueImpl::WriteTexture(const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
476
|
+
auto *ptr = GetPointer(args.This());
|
|
477
|
+
if (ptr == nullptr) {
|
|
478
|
+
return;
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
auto isolate = args.GetIsolate();
|
|
482
|
+
auto context = isolate->GetCurrentContext();
|
|
483
|
+
|
|
484
|
+
|
|
485
|
+
auto destinationVal = args[0];
|
|
486
|
+
auto dataVal = args[1];
|
|
487
|
+
auto dataLayoutVal = args[2];
|
|
488
|
+
auto sizeVal = args[3];
|
|
489
|
+
|
|
490
|
+
if (destinationVal->IsObject() && dataVal->IsObject() && dataLayoutVal->IsObject() &&
|
|
491
|
+
sizeVal->IsObject()) {
|
|
492
|
+
auto destinationObj = destinationVal.As<v8::Object>();
|
|
493
|
+
|
|
494
|
+
auto textureVal = destinationObj->Get(context, ConvertToV8String(isolate,
|
|
495
|
+
"texture")).ToLocalChecked();
|
|
496
|
+
auto texture = GPUTextureImpl::GetPointer(textureVal.As<v8::Object>())->GetTexture();
|
|
497
|
+
|
|
498
|
+
uint32_t mipLevel = 0;
|
|
499
|
+
CanvasOrigin3d origin{0, 0, 0};
|
|
500
|
+
CanvasTextureAspect aspect = CanvasTextureAspectAll;
|
|
501
|
+
|
|
502
|
+
v8::Local<v8::Value> mipLevelVal;
|
|
503
|
+
if (destinationObj->Get(context, ConvertToV8String(isolate, "mipLevel")).ToLocal(
|
|
504
|
+
&mipLevelVal) &&
|
|
505
|
+
mipLevelVal->IsUint32()) {
|
|
506
|
+
mipLevel = mipLevelVal->Uint32Value(context).FromJust();
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
|
|
510
|
+
v8::Local<v8::Value> originVal;
|
|
511
|
+
if (destinationObj->Get(context, ConvertToV8String(isolate, "origin")).ToLocal(
|
|
512
|
+
&originVal) &&
|
|
513
|
+
originVal->IsObject()) {
|
|
514
|
+
auto originObj = originVal.As<v8::Object>();
|
|
515
|
+
|
|
516
|
+
v8::Local<v8::Value> xVal;
|
|
517
|
+
if (originObj->Get(context, ConvertToV8String(isolate, "x")).ToLocal(&xVal) &&
|
|
518
|
+
xVal->IsUint32()) {
|
|
519
|
+
origin.x = xVal->Uint32Value(context).FromJust();
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
v8::Local<v8::Value> yVal;
|
|
523
|
+
if (originObj->Get(context, ConvertToV8String(isolate, "y")).ToLocal(&yVal) &&
|
|
524
|
+
yVal->IsUint32()) {
|
|
525
|
+
origin.y = yVal->Uint32Value(context).FromJust();
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
v8::Local<v8::Value> zVal;
|
|
529
|
+
if (originObj->Get(context, ConvertToV8String(isolate, "z")).ToLocal(&zVal) &&
|
|
530
|
+
zVal->IsUint32()) {
|
|
531
|
+
origin.z = zVal->Uint32Value(context).FromJust();
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
|
|
537
|
+
v8::Local<v8::Value> aspectVal;
|
|
538
|
+
if (destinationObj->Get(context, ConvertToV8String(isolate, "aspect")).ToLocal(
|
|
539
|
+
&aspectVal)) {
|
|
540
|
+
if (aspectVal->IsString()) {
|
|
541
|
+
auto aspectStr = ConvertFromV8String(isolate, aspectVal);
|
|
542
|
+
if (aspectStr == "depth-only") {
|
|
543
|
+
aspect = CanvasTextureAspectDepthOnly;
|
|
544
|
+
} else if (aspectStr == "stencil-only") {
|
|
545
|
+
aspect = CanvasTextureAspectStencilOnly;
|
|
546
|
+
} else if (aspectStr == "all") {
|
|
547
|
+
aspect = CanvasTextureAspectAll;
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
CanvasImageCopyTexture destination{
|
|
553
|
+
texture,
|
|
554
|
+
mipLevel,
|
|
555
|
+
origin,
|
|
556
|
+
aspect
|
|
557
|
+
};
|
|
558
|
+
auto array = dataVal.As<v8::TypedArray>();
|
|
559
|
+
auto ab = array->Buffer();
|
|
560
|
+
auto offset = array->ByteOffset();
|
|
561
|
+
auto store = ab->GetBackingStore();
|
|
562
|
+
auto data = static_cast<const uint8_t *>(store->Data()) + offset;
|
|
563
|
+
auto size = array->ByteLength();
|
|
564
|
+
|
|
565
|
+
auto dataLayoutObj = dataLayoutVal.As<v8::Object>();
|
|
566
|
+
|
|
567
|
+
CanvasImageDataLayout layout{
|
|
568
|
+
0, -1, -1
|
|
569
|
+
};
|
|
570
|
+
|
|
571
|
+
v8::Local<v8::Value> offsetVal;
|
|
572
|
+
if (dataLayoutObj->Get(context, ConvertToV8String(isolate, "offset")).ToLocal(&offsetVal) &&
|
|
573
|
+
offsetVal->IsNumber()) {
|
|
574
|
+
layout.offset = (uint64_t) offsetVal->NumberValue(context).FromJust();
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
|
|
578
|
+
v8::Local<v8::Value> bytesPerRowVal;
|
|
579
|
+
if (dataLayoutObj->Get(context, ConvertToV8String(isolate, "bytesPerRow")).ToLocal(
|
|
580
|
+
&bytesPerRowVal) &&
|
|
581
|
+
bytesPerRowVal->IsInt32()) {
|
|
582
|
+
layout.bytes_per_row = bytesPerRowVal->Int32Value(context).FromJust();
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
|
|
586
|
+
v8::Local<v8::Value> rowsPerImageVal;
|
|
587
|
+
if (dataLayoutObj->Get(context, ConvertToV8String(isolate, "rowsPerImage")).ToLocal(
|
|
588
|
+
&rowsPerImageVal) &&
|
|
589
|
+
rowsPerImageVal->IsInt32()) {
|
|
590
|
+
layout.rows_per_image = rowsPerImageVal->Int32Value(context).FromJust();
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
|
|
594
|
+
CanvasExtent3d extent3D = ParseExtent3d(isolate, sizeVal);
|
|
595
|
+
|
|
596
|
+
canvas_native_webgpu_queue_write_texture(ptr->GetGPUQueue(), &destination, &layout,
|
|
597
|
+
&extent3D, data, size);
|
|
598
|
+
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
|
|
605
|
+
|