@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,288 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Created by Osei Fortune on 17/06/2024.
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
#ifndef CANVAS_ANDROID_GPUSUPPORTEDLIMITSIMPL_H
|
|
6
|
+
#define CANVAS_ANDROID_GPUSUPPORTEDLIMITSIMPL_H
|
|
7
|
+
|
|
8
|
+
#include "Helpers.h"
|
|
9
|
+
#include "ObjectWrapperImpl.h"
|
|
10
|
+
|
|
11
|
+
class GPUSupportedLimitsImpl : public ObjectWrapperImpl {
|
|
12
|
+
public:
|
|
13
|
+
explicit GPUSupportedLimitsImpl(CanvasGPUSupportedLimits *limits);
|
|
14
|
+
|
|
15
|
+
~GPUSupportedLimitsImpl() {
|
|
16
|
+
canvas_native_webgpu_limits_release(this->limits_);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
CanvasGPUSupportedLimits *GetLimits();
|
|
20
|
+
|
|
21
|
+
static v8::Local<v8::Object> NewInstance(v8::Isolate *isolate, GPUSupportedLimitsImpl *limits) {
|
|
22
|
+
auto context = isolate->GetCurrentContext();
|
|
23
|
+
v8::EscapableHandleScope scope(isolate);
|
|
24
|
+
auto object = GPUSupportedLimitsImpl::GetCtor(isolate)->GetFunction(
|
|
25
|
+
context).ToLocalChecked()->NewInstance(context).ToLocalChecked();
|
|
26
|
+
SetNativeType(limits, NativeType::GPUSupportedLimits);
|
|
27
|
+
object->SetAlignedPointerInInternalField(0, limits);
|
|
28
|
+
limits->BindFinalizer(isolate, object);
|
|
29
|
+
return scope.Escape(object);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
static void Init(v8::Local<v8::Object> canvasModule, v8::Isolate *isolate);
|
|
33
|
+
|
|
34
|
+
static GPUSupportedLimitsImpl *GetPointer(v8::Local<v8::Object> object);
|
|
35
|
+
|
|
36
|
+
static v8::Local<v8::FunctionTemplate> GetCtor(v8::Isolate *isolate);
|
|
37
|
+
|
|
38
|
+
static void Ctor(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
39
|
+
|
|
40
|
+
static void GetMaxTextureDimension1D(v8::Local<v8::String> property,
|
|
41
|
+
const v8::PropertyCallbackInfo<v8::Value> &info);
|
|
42
|
+
|
|
43
|
+
static void SetMaxTextureDimension1D(v8::Local<v8::String> property,
|
|
44
|
+
v8::Local<v8::Value> value,
|
|
45
|
+
const v8::PropertyCallbackInfo<void> &info);
|
|
46
|
+
|
|
47
|
+
static void GetMaxTextureDimension2D(v8::Local<v8::String> property,
|
|
48
|
+
const v8::PropertyCallbackInfo<v8::Value> &info);
|
|
49
|
+
|
|
50
|
+
static void SetMaxTextureDimension2D(v8::Local<v8::String> property,
|
|
51
|
+
v8::Local<v8::Value> value,
|
|
52
|
+
const v8::PropertyCallbackInfo<void> &info);
|
|
53
|
+
|
|
54
|
+
static void GetMaxTextureDimension3D(v8::Local<v8::String> property,
|
|
55
|
+
const v8::PropertyCallbackInfo<v8::Value> &info);
|
|
56
|
+
|
|
57
|
+
static void SetMaxTextureDimension3D(v8::Local<v8::String> property,
|
|
58
|
+
v8::Local<v8::Value> value,
|
|
59
|
+
const v8::PropertyCallbackInfo<void> &info);
|
|
60
|
+
|
|
61
|
+
static void GetMaxTextureArrayLayers(v8::Local<v8::String> property,
|
|
62
|
+
const v8::PropertyCallbackInfo<v8::Value> &info);
|
|
63
|
+
|
|
64
|
+
static void SetMaxTextureArrayLayers(v8::Local<v8::String> property,
|
|
65
|
+
v8::Local<v8::Value> value,
|
|
66
|
+
const v8::PropertyCallbackInfo<void> &info);
|
|
67
|
+
|
|
68
|
+
static void GetMaxBindGroups(v8::Local<v8::String> property,
|
|
69
|
+
const v8::PropertyCallbackInfo<v8::Value> &info);
|
|
70
|
+
|
|
71
|
+
static void SetMaxBindGroups(v8::Local<v8::String> property,
|
|
72
|
+
v8::Local<v8::Value> value,
|
|
73
|
+
const v8::PropertyCallbackInfo<void> &info);
|
|
74
|
+
|
|
75
|
+
static void GetMaxBindingsPerBindGroup(v8::Local<v8::String> property,
|
|
76
|
+
const v8::PropertyCallbackInfo<v8::Value> &info);
|
|
77
|
+
|
|
78
|
+
static void SetMaxBindingsPerBindGroup(v8::Local<v8::String> property,
|
|
79
|
+
v8::Local<v8::Value> value,
|
|
80
|
+
const v8::PropertyCallbackInfo<void> &info);
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
static void GetMaxDynamicUniformBuffersPerPipelineLayout(v8::Local<v8::String> property,
|
|
84
|
+
const v8::PropertyCallbackInfo<v8::Value> &info);
|
|
85
|
+
|
|
86
|
+
static void SetMaxDynamicUniformBuffersPerPipelineLayout(v8::Local<v8::String> property,
|
|
87
|
+
v8::Local<v8::Value> value,
|
|
88
|
+
const v8::PropertyCallbackInfo<void> &info);
|
|
89
|
+
|
|
90
|
+
static void GetMaxDynamicStorageBuffersPerPipelineLayout(v8::Local<v8::String> property,
|
|
91
|
+
const v8::PropertyCallbackInfo<v8::Value> &info);
|
|
92
|
+
|
|
93
|
+
static void SetMaxDynamicStorageBuffersPerPipelineLayout(v8::Local<v8::String> property,
|
|
94
|
+
v8::Local<v8::Value> value,
|
|
95
|
+
const v8::PropertyCallbackInfo<void> &info);
|
|
96
|
+
|
|
97
|
+
static void GetMaxSampledTexturesPerShaderStage(v8::Local<v8::String> property,
|
|
98
|
+
const v8::PropertyCallbackInfo<v8::Value> &info);
|
|
99
|
+
|
|
100
|
+
static void SetMaxSampledTexturesPerShaderStage(v8::Local<v8::String> property,
|
|
101
|
+
v8::Local<v8::Value> value,
|
|
102
|
+
const v8::PropertyCallbackInfo<void> &info);
|
|
103
|
+
|
|
104
|
+
static void GetMaxSamplersPerShaderStage(v8::Local<v8::String> property,
|
|
105
|
+
const v8::PropertyCallbackInfo<v8::Value> &info);
|
|
106
|
+
|
|
107
|
+
static void SetMaxSamplersPerShaderStage(v8::Local<v8::String> property,
|
|
108
|
+
v8::Local<v8::Value> value,
|
|
109
|
+
const v8::PropertyCallbackInfo<void> &info);
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
static void GetMaxStorageBuffersPerShaderStage(v8::Local<v8::String> property,
|
|
113
|
+
const v8::PropertyCallbackInfo<v8::Value> &info);
|
|
114
|
+
|
|
115
|
+
static void SetMaxStorageBuffersPerShaderStage(v8::Local<v8::String> property,
|
|
116
|
+
v8::Local<v8::Value> value,
|
|
117
|
+
const v8::PropertyCallbackInfo<void> &info);
|
|
118
|
+
|
|
119
|
+
static void GetMaxStorageTexturesPerShaderStage(v8::Local<v8::String> property,
|
|
120
|
+
const v8::PropertyCallbackInfo<v8::Value> &info);
|
|
121
|
+
|
|
122
|
+
static void SetMaxStorageTexturesPerShaderStage(v8::Local<v8::String> property,
|
|
123
|
+
v8::Local<v8::Value> value,
|
|
124
|
+
const v8::PropertyCallbackInfo<void> &info);
|
|
125
|
+
|
|
126
|
+
static void GetMaxUniformBuffersPerShaderStage(v8::Local<v8::String> property,
|
|
127
|
+
const v8::PropertyCallbackInfo<v8::Value> &info);
|
|
128
|
+
|
|
129
|
+
static void SetMaxUniformBuffersPerShaderStage(v8::Local<v8::String> property,
|
|
130
|
+
v8::Local<v8::Value> value,
|
|
131
|
+
const v8::PropertyCallbackInfo<void> &info);
|
|
132
|
+
|
|
133
|
+
static void GetMaxUniformBufferBindingSize(v8::Local<v8::String> property,
|
|
134
|
+
const v8::PropertyCallbackInfo<v8::Value> &info);
|
|
135
|
+
|
|
136
|
+
static void SetMaxUniformBufferBindingSize(v8::Local<v8::String> property,
|
|
137
|
+
v8::Local<v8::Value> value,
|
|
138
|
+
const v8::PropertyCallbackInfo<void> &info);
|
|
139
|
+
|
|
140
|
+
static void GetMaxStorageBufferBindingSize(v8::Local<v8::String> property,
|
|
141
|
+
const v8::PropertyCallbackInfo<v8::Value> &info);
|
|
142
|
+
|
|
143
|
+
static void SetMaxStorageBufferBindingSize(v8::Local<v8::String> property,
|
|
144
|
+
v8::Local<v8::Value> value,
|
|
145
|
+
const v8::PropertyCallbackInfo<void> &info);
|
|
146
|
+
|
|
147
|
+
static void GetMaxVertexBuffers(v8::Local<v8::String> property,
|
|
148
|
+
const v8::PropertyCallbackInfo<v8::Value> &info);
|
|
149
|
+
|
|
150
|
+
static void SetMaxVertexBuffers(v8::Local<v8::String> property,
|
|
151
|
+
v8::Local<v8::Value> value,
|
|
152
|
+
const v8::PropertyCallbackInfo<void> &info);
|
|
153
|
+
|
|
154
|
+
static void GetMaxBufferSize(v8::Local<v8::String> property,
|
|
155
|
+
const v8::PropertyCallbackInfo<v8::Value> &info);
|
|
156
|
+
|
|
157
|
+
static void SetMaxBufferSize(v8::Local<v8::String> property,
|
|
158
|
+
v8::Local<v8::Value> value,
|
|
159
|
+
const v8::PropertyCallbackInfo<void> &info);
|
|
160
|
+
|
|
161
|
+
static void GetMaxVertexAttributes(v8::Local<v8::String> property,
|
|
162
|
+
const v8::PropertyCallbackInfo<v8::Value> &info);
|
|
163
|
+
|
|
164
|
+
static void SetMaxVertexAttributes(v8::Local<v8::String> property,
|
|
165
|
+
v8::Local<v8::Value> value,
|
|
166
|
+
const v8::PropertyCallbackInfo<void> &info);
|
|
167
|
+
|
|
168
|
+
static void GetMaxVertexBufferArrayStride(v8::Local<v8::String> property,
|
|
169
|
+
const v8::PropertyCallbackInfo<v8::Value> &info);
|
|
170
|
+
|
|
171
|
+
static void SetMaxVertexBufferArrayStride(v8::Local<v8::String> property,
|
|
172
|
+
v8::Local<v8::Value> value,
|
|
173
|
+
const v8::PropertyCallbackInfo<void> &info);
|
|
174
|
+
|
|
175
|
+
static void GetMinUniformBufferOffsetAlignment(v8::Local<v8::String> property,
|
|
176
|
+
const v8::PropertyCallbackInfo<v8::Value> &info);
|
|
177
|
+
|
|
178
|
+
static void SetMinUniformBufferOffsetAlignment(v8::Local<v8::String> property,
|
|
179
|
+
v8::Local<v8::Value> value,
|
|
180
|
+
const v8::PropertyCallbackInfo<void> &info);
|
|
181
|
+
|
|
182
|
+
static void GetMinStorageBufferOffsetAlignment(v8::Local<v8::String> property,
|
|
183
|
+
const v8::PropertyCallbackInfo<v8::Value> &info);
|
|
184
|
+
|
|
185
|
+
static void SetMinStorageBufferOffsetAlignment(v8::Local<v8::String> property,
|
|
186
|
+
v8::Local<v8::Value> value,
|
|
187
|
+
const v8::PropertyCallbackInfo<void> &info);
|
|
188
|
+
|
|
189
|
+
static void GetMaxInterStageShaderComponents(v8::Local<v8::String> property,
|
|
190
|
+
const v8::PropertyCallbackInfo<v8::Value> &info);
|
|
191
|
+
|
|
192
|
+
static void SetMaxInterStageShaderComponents(v8::Local<v8::String> property,
|
|
193
|
+
v8::Local<v8::Value> value,
|
|
194
|
+
const v8::PropertyCallbackInfo<void> &info);
|
|
195
|
+
|
|
196
|
+
static void GetMaxColorAttachments(v8::Local<v8::String> property,
|
|
197
|
+
const v8::PropertyCallbackInfo<v8::Value> &info);
|
|
198
|
+
|
|
199
|
+
static void SetMaxColorAttachments(v8::Local<v8::String> property,
|
|
200
|
+
v8::Local<v8::Value> value,
|
|
201
|
+
const v8::PropertyCallbackInfo<void> &info);
|
|
202
|
+
|
|
203
|
+
static void GetMaxColorAttachmentBytesPerSample(v8::Local<v8::String> property,
|
|
204
|
+
const v8::PropertyCallbackInfo<v8::Value> &info);
|
|
205
|
+
|
|
206
|
+
static void SetMaxColorAttachmentBytesPerSample(v8::Local<v8::String> property,
|
|
207
|
+
v8::Local<v8::Value> value,
|
|
208
|
+
const v8::PropertyCallbackInfo<void> &info);
|
|
209
|
+
|
|
210
|
+
static void GetMaxComputeWorkgroupStorageSize(v8::Local<v8::String> property,
|
|
211
|
+
const v8::PropertyCallbackInfo<v8::Value> &info);
|
|
212
|
+
|
|
213
|
+
static void SetMaxComputeWorkgroupStorageSize(v8::Local<v8::String> property,
|
|
214
|
+
v8::Local<v8::Value> value,
|
|
215
|
+
const v8::PropertyCallbackInfo<void> &info);
|
|
216
|
+
|
|
217
|
+
static void GetMaxComputeInvocationsPerWorkgroup(v8::Local<v8::String> property,
|
|
218
|
+
const v8::PropertyCallbackInfo<v8::Value> &info);
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
static void SetMaxComputeInvocationsPerWorkgroup(v8::Local<v8::String> property,
|
|
222
|
+
v8::Local<v8::Value> value,
|
|
223
|
+
const v8::PropertyCallbackInfo<void> &info);
|
|
224
|
+
|
|
225
|
+
static void GetMaxComputeWorkgroupSizeX(v8::Local<v8::String> property,
|
|
226
|
+
const v8::PropertyCallbackInfo<v8::Value> &info);
|
|
227
|
+
|
|
228
|
+
static void SetMaxComputeWorkgroupSizeX(v8::Local<v8::String> property,
|
|
229
|
+
v8::Local<v8::Value> value,
|
|
230
|
+
const v8::PropertyCallbackInfo<void> &info);
|
|
231
|
+
|
|
232
|
+
static void GetMaxComputeWorkgroupSizeY(v8::Local<v8::String> property,
|
|
233
|
+
const v8::PropertyCallbackInfo<v8::Value> &info);
|
|
234
|
+
|
|
235
|
+
static void SetMaxComputeWorkgroupSizeY(v8::Local<v8::String> property,
|
|
236
|
+
v8::Local<v8::Value> value,
|
|
237
|
+
const v8::PropertyCallbackInfo<void> &info);
|
|
238
|
+
|
|
239
|
+
static void GetMaxComputeWorkgroupSizeZ(v8::Local<v8::String> property,
|
|
240
|
+
const v8::PropertyCallbackInfo<v8::Value> &info);
|
|
241
|
+
|
|
242
|
+
static void SetMaxComputeWorkgroupSizeZ(v8::Local<v8::String> property,
|
|
243
|
+
v8::Local<v8::Value> value,
|
|
244
|
+
const v8::PropertyCallbackInfo<void> &info);
|
|
245
|
+
|
|
246
|
+
static void GetMaxComputeWorkgroupsPerDimension(v8::Local<v8::String> property,
|
|
247
|
+
const v8::PropertyCallbackInfo<v8::Value> &info);
|
|
248
|
+
|
|
249
|
+
static void SetMaxComputeWorkgroupsPerDimension(v8::Local<v8::String> property,
|
|
250
|
+
v8::Local<v8::Value> value,
|
|
251
|
+
const v8::PropertyCallbackInfo<void> &info);
|
|
252
|
+
|
|
253
|
+
static void GetMinSubgroupSize(v8::Local<v8::String> property,
|
|
254
|
+
const v8::PropertyCallbackInfo<v8::Value> &info);
|
|
255
|
+
|
|
256
|
+
static void SetMinSubgroupSize(v8::Local<v8::String> property,
|
|
257
|
+
v8::Local<v8::Value> value,
|
|
258
|
+
const v8::PropertyCallbackInfo<void> &info);
|
|
259
|
+
|
|
260
|
+
static void GetMaxSubgroupSize(v8::Local<v8::String> property,
|
|
261
|
+
const v8::PropertyCallbackInfo<v8::Value> &info);
|
|
262
|
+
|
|
263
|
+
static void SetMaxSubgroupSize(v8::Local<v8::String> property,
|
|
264
|
+
v8::Local<v8::Value> value,
|
|
265
|
+
const v8::PropertyCallbackInfo<void> &info);
|
|
266
|
+
|
|
267
|
+
static void GetMaxPushConstantSize(v8::Local<v8::String> property,
|
|
268
|
+
const v8::PropertyCallbackInfo<v8::Value> &info);
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+
static void SetMaxPushConstantSize(v8::Local<v8::String> property,
|
|
272
|
+
v8::Local<v8::Value> value,
|
|
273
|
+
const v8::PropertyCallbackInfo<void> &info);
|
|
274
|
+
|
|
275
|
+
static void GetMaxNonSamplerBindings(v8::Local<v8::String> property,
|
|
276
|
+
const v8::PropertyCallbackInfo<v8::Value> &info);
|
|
277
|
+
|
|
278
|
+
|
|
279
|
+
static void SetMaxNonSamplerBindings(v8::Local<v8::String> property,
|
|
280
|
+
v8::Local<v8::Value> value,
|
|
281
|
+
const v8::PropertyCallbackInfo<void> &info);
|
|
282
|
+
|
|
283
|
+
private:
|
|
284
|
+
CanvasGPUSupportedLimits *limits_;
|
|
285
|
+
};
|
|
286
|
+
|
|
287
|
+
|
|
288
|
+
#endif //CANVAS_ANDROID_GPUSUPPORTEDLIMITSIMPL_H
|
|
@@ -0,0 +1,386 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Created by Osei Fortune on 21/06/2024.
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
#include "GPUTextureImpl.h"
|
|
6
|
+
#include "Caches.h"
|
|
7
|
+
#include "GPUTextureViewImpl.h"
|
|
8
|
+
#include "GPULabel.h"
|
|
9
|
+
|
|
10
|
+
GPUTextureImpl::GPUTextureImpl(const CanvasGPUTexture *texture) : texture_(texture) {}
|
|
11
|
+
|
|
12
|
+
const CanvasGPUTexture *GPUTextureImpl::GetTexture() {
|
|
13
|
+
return this->texture_;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
void GPUTextureImpl::Init(v8::Local<v8::Object> canvasModule, v8::Isolate *isolate) {
|
|
18
|
+
v8::Locker locker(isolate);
|
|
19
|
+
v8::Isolate::Scope isolate_scope(isolate);
|
|
20
|
+
v8::HandleScope handle_scope(isolate);
|
|
21
|
+
|
|
22
|
+
auto ctor = GetCtor(isolate);
|
|
23
|
+
auto context = isolate->GetCurrentContext();
|
|
24
|
+
auto func = ctor->GetFunction(context).ToLocalChecked();
|
|
25
|
+
|
|
26
|
+
canvasModule->Set(context, ConvertToV8String(isolate, "GPUTexture"), func).FromJust();
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
GPUTextureImpl *GPUTextureImpl::GetPointer(const v8::Local<v8::Object> &object) {
|
|
30
|
+
auto ptr = object->GetAlignedPointerFromInternalField(0);
|
|
31
|
+
if (ptr == nullptr) {
|
|
32
|
+
return nullptr;
|
|
33
|
+
}
|
|
34
|
+
return static_cast<GPUTextureImpl *>(ptr);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
v8::Local<v8::FunctionTemplate> GPUTextureImpl::GetCtor(v8::Isolate *isolate) {
|
|
38
|
+
auto cache = Caches::Get(isolate);
|
|
39
|
+
auto ctor = cache->GPUTextureTmpl.get();
|
|
40
|
+
if (ctor != nullptr) {
|
|
41
|
+
return ctor->Get(isolate);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
v8::Local<v8::FunctionTemplate> ctorTmpl = v8::FunctionTemplate::New(isolate);
|
|
45
|
+
ctorTmpl->InstanceTemplate()->SetInternalFieldCount(2);
|
|
46
|
+
ctorTmpl->SetClassName(ConvertToV8String(isolate, "GPUTexture"));
|
|
47
|
+
|
|
48
|
+
auto tmpl = ctorTmpl->InstanceTemplate();
|
|
49
|
+
tmpl->SetInternalFieldCount(2);
|
|
50
|
+
|
|
51
|
+
tmpl->SetLazyDataProperty(
|
|
52
|
+
ConvertToV8String(isolate, "label"),
|
|
53
|
+
GetLabel
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
tmpl->Set(
|
|
57
|
+
ConvertToV8String(isolate, "destroy"),
|
|
58
|
+
v8::FunctionTemplate::New(isolate, &Destroy));
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
tmpl->SetLazyDataProperty(
|
|
62
|
+
ConvertToV8String(isolate, "width"),
|
|
63
|
+
GetWidth
|
|
64
|
+
);
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
tmpl->SetLazyDataProperty(
|
|
68
|
+
ConvertToV8String(isolate, "height"),
|
|
69
|
+
GetHeight
|
|
70
|
+
);
|
|
71
|
+
|
|
72
|
+
tmpl->SetLazyDataProperty(
|
|
73
|
+
ConvertToV8String(isolate, "format"),
|
|
74
|
+
GetFormat
|
|
75
|
+
);
|
|
76
|
+
|
|
77
|
+
tmpl->SetLazyDataProperty(
|
|
78
|
+
ConvertToV8String(isolate, "usage"),
|
|
79
|
+
GetUsage
|
|
80
|
+
);
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
tmpl->SetLazyDataProperty(
|
|
84
|
+
ConvertToV8String(isolate, "depthOrArrayLayers"),
|
|
85
|
+
GetDepthOrArrayLayers
|
|
86
|
+
);
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
tmpl->SetLazyDataProperty(
|
|
90
|
+
ConvertToV8String(isolate, "dimension"),
|
|
91
|
+
GetDimension
|
|
92
|
+
);
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
tmpl->SetLazyDataProperty(
|
|
96
|
+
ConvertToV8String(isolate, "sampleCount"),
|
|
97
|
+
GetSampleCount
|
|
98
|
+
);
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
tmpl->SetLazyDataProperty(
|
|
102
|
+
ConvertToV8String(isolate, "mipLevelCount"),
|
|
103
|
+
GetMipLevelCount
|
|
104
|
+
);
|
|
105
|
+
|
|
106
|
+
tmpl->Set(
|
|
107
|
+
ConvertToV8String(isolate, "createView"),
|
|
108
|
+
v8::FunctionTemplate::New(isolate, &CreateView));
|
|
109
|
+
|
|
110
|
+
cache->GPUTextureTmpl =
|
|
111
|
+
std::make_unique<v8::Persistent<v8::FunctionTemplate>>(isolate, ctorTmpl);
|
|
112
|
+
return ctorTmpl;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
void
|
|
117
|
+
GPUTextureImpl::GetLabel(v8::Local<v8::Name> name,
|
|
118
|
+
const v8::PropertyCallbackInfo<v8::Value> &info) {
|
|
119
|
+
auto ptr = GetPointer(info.This());
|
|
120
|
+
if (ptr != nullptr) {
|
|
121
|
+
auto label = canvas_native_webgpu_texture_get_label(ptr->texture_);
|
|
122
|
+
if (label == nullptr) {
|
|
123
|
+
info.GetReturnValue().SetEmptyString();
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
info.GetReturnValue().Set(
|
|
127
|
+
ConvertToV8String(info.GetIsolate(), label)
|
|
128
|
+
);
|
|
129
|
+
canvas_native_string_destroy(label);
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
info.GetReturnValue().SetEmptyString();
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
void
|
|
137
|
+
GPUTextureImpl::GetDimension(v8::Local<v8::Name> name,
|
|
138
|
+
const v8::PropertyCallbackInfo<v8::Value> &info) {
|
|
139
|
+
auto ptr = GetPointer(info.This());
|
|
140
|
+
if (ptr != nullptr) {
|
|
141
|
+
auto width = canvas_native_webgpu_texture_get_dimension(ptr->GetTexture());
|
|
142
|
+
auto isolate = info.GetIsolate();
|
|
143
|
+
switch (width) {
|
|
144
|
+
case CanvasTextureDimensionD1:
|
|
145
|
+
info.GetReturnValue().Set(ConvertToV8String(isolate, "1d"));
|
|
146
|
+
break;
|
|
147
|
+
case CanvasTextureDimensionD2:
|
|
148
|
+
info.GetReturnValue().Set(ConvertToV8String(isolate, "2d"));
|
|
149
|
+
break;
|
|
150
|
+
case CanvasTextureDimensionD3:
|
|
151
|
+
info.GetReturnValue().Set(ConvertToV8String(isolate, "3d"));
|
|
152
|
+
break;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
void
|
|
161
|
+
GPUTextureImpl::GetWidth(v8::Local<v8::Name> name,
|
|
162
|
+
const v8::PropertyCallbackInfo<v8::Value> &info) {
|
|
163
|
+
auto ptr = GetPointer(info.This());
|
|
164
|
+
if (ptr != nullptr) {
|
|
165
|
+
auto width = canvas_native_webgpu_texture_get_width(ptr->GetTexture());
|
|
166
|
+
info.GetReturnValue().Set(width);
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
info.GetReturnValue().Set(0);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
void
|
|
174
|
+
GPUTextureImpl::GetHeight(v8::Local<v8::Name> name,
|
|
175
|
+
const v8::PropertyCallbackInfo<v8::Value> &info) {
|
|
176
|
+
auto ptr = GetPointer(info.This());
|
|
177
|
+
if (ptr != nullptr) {
|
|
178
|
+
auto value = canvas_native_webgpu_texture_get_height(ptr->GetTexture());
|
|
179
|
+
info.GetReturnValue().Set(value);
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
info.GetReturnValue().Set(0);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
void
|
|
186
|
+
GPUTextureImpl::GetDepthOrArrayLayers(v8::Local<v8::Name> name,
|
|
187
|
+
const v8::PropertyCallbackInfo<v8::Value> &info) {
|
|
188
|
+
auto ptr = GetPointer(info.This());
|
|
189
|
+
if (ptr != nullptr) {
|
|
190
|
+
auto value = canvas_native_webgpu_texture_get_depth_or_array_layers(ptr->GetTexture());
|
|
191
|
+
info.GetReturnValue().Set(value);
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
info.GetReturnValue().Set(0);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
void
|
|
199
|
+
GPUTextureImpl::GetUsage(v8::Local<v8::Name> name,
|
|
200
|
+
const v8::PropertyCallbackInfo<v8::Value> &info) {
|
|
201
|
+
auto ptr = GetPointer(info.This());
|
|
202
|
+
if (ptr != nullptr) {
|
|
203
|
+
auto value = canvas_native_webgpu_texture_get_usage(ptr->GetTexture());
|
|
204
|
+
info.GetReturnValue().Set(value);
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
info.GetReturnValue().Set(0);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
void
|
|
212
|
+
GPUTextureImpl::GetFormat(v8::Local<v8::Name> name,
|
|
213
|
+
const v8::PropertyCallbackInfo<v8::Value> &info) {
|
|
214
|
+
auto ptr = GetPointer(info.This());
|
|
215
|
+
if (ptr != nullptr) {
|
|
216
|
+
auto isolate = info.GetIsolate();
|
|
217
|
+
auto value = canvas_native_webgpu_texture_get_format(ptr->GetTexture());
|
|
218
|
+
auto str = canvas_native_webgpu_enum_gpu_texture_to_string(value);
|
|
219
|
+
info.GetReturnValue().Set(ConvertToV8String(isolate, str));
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
222
|
+
info.GetReturnValue().Set(0);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
void
|
|
226
|
+
GPUTextureImpl::GetSampleCount(v8::Local<v8::Name> name,
|
|
227
|
+
const v8::PropertyCallbackInfo<v8::Value> &info) {
|
|
228
|
+
auto ptr = GetPointer(info.This());
|
|
229
|
+
if (ptr != nullptr) {
|
|
230
|
+
auto value = canvas_native_webgpu_texture_get_sample_count(ptr->GetTexture());
|
|
231
|
+
info.GetReturnValue().Set(value);
|
|
232
|
+
return;
|
|
233
|
+
}
|
|
234
|
+
info.GetReturnValue().Set(0);
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
void
|
|
238
|
+
GPUTextureImpl::GetMipLevelCount(v8::Local<v8::Name> name,
|
|
239
|
+
const v8::PropertyCallbackInfo<v8::Value> &info) {
|
|
240
|
+
auto ptr = GetPointer(info.This());
|
|
241
|
+
if (ptr != nullptr) {
|
|
242
|
+
auto value = canvas_native_webgpu_texture_get_mip_level_count(ptr->GetTexture());
|
|
243
|
+
info.GetReturnValue().Set(value);
|
|
244
|
+
return;
|
|
245
|
+
}
|
|
246
|
+
info.GetReturnValue().Set(0);
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
void GPUTextureImpl::Destroy(const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
251
|
+
GPUTextureImpl *ptr = GetPointer(args.This());
|
|
252
|
+
if (ptr == nullptr) {
|
|
253
|
+
return;
|
|
254
|
+
}
|
|
255
|
+
canvas_native_webgpu_texture_destroy(ptr->GetTexture());
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
|
|
259
|
+
void GPUTextureImpl::CreateView(const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
260
|
+
GPUTextureImpl *ptr = GetPointer(args.This());
|
|
261
|
+
if (ptr == nullptr) {
|
|
262
|
+
args.GetReturnValue().SetUndefined();
|
|
263
|
+
return;
|
|
264
|
+
}
|
|
265
|
+
auto isolate = args.GetIsolate();
|
|
266
|
+
auto context = isolate->GetCurrentContext();
|
|
267
|
+
|
|
268
|
+
auto descVal = args[0];
|
|
269
|
+
|
|
270
|
+
CanvasCreateTextureViewDescriptor *descriptor = nullptr;
|
|
271
|
+
|
|
272
|
+
CanvasTextureAspect aspect = CanvasTextureAspectAll;
|
|
273
|
+
|
|
274
|
+
CanvasImageSubresourceRange range = {
|
|
275
|
+
aspect, 0, -1, 0, -1
|
|
276
|
+
};
|
|
277
|
+
|
|
278
|
+
GPULabel label;
|
|
279
|
+
|
|
280
|
+
if (descVal->IsObject()) {
|
|
281
|
+
descriptor = new CanvasCreateTextureViewDescriptor{};
|
|
282
|
+
descriptor->label = nullptr;
|
|
283
|
+
auto descObj = descVal.As<v8::Object>();
|
|
284
|
+
|
|
285
|
+
v8::Local<v8::Value> aspectVal;
|
|
286
|
+
|
|
287
|
+
if (descObj->Get(context, ConvertToV8String(isolate, "aspect")).ToLocal(&aspectVal)) {
|
|
288
|
+
auto aspectStr = ConvertFromV8String(isolate, aspectVal);
|
|
289
|
+
if (aspectStr == "all") {
|
|
290
|
+
aspect = CanvasTextureAspectAll;
|
|
291
|
+
} else if (aspectStr == "stencil-only") {
|
|
292
|
+
aspect = CanvasTextureAspectStencilOnly;
|
|
293
|
+
} else if (aspectStr == "depth-only") {
|
|
294
|
+
aspect = CanvasTextureAspectDepthOnly;
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
|
|
299
|
+
v8::Local<v8::Value> arrayLayerCountVal;
|
|
300
|
+
if (descObj->Get(context, ConvertToV8String(isolate, "arrayLayerCount")).ToLocal(
|
|
301
|
+
&arrayLayerCountVal) && arrayLayerCountVal->IsInt32()) {
|
|
302
|
+
range.array_layer_count = arrayLayerCountVal->Int32Value(context).FromJust();
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
v8::Local<v8::Value> mipLevelCountVal;
|
|
306
|
+
if (descObj->Get(context, ConvertToV8String(isolate, "mipLevelCount")).ToLocal(
|
|
307
|
+
&mipLevelCountVal) && mipLevelCountVal->IsInt32()) {
|
|
308
|
+
range.mip_level_count = mipLevelCountVal->Int32Value(context).FromJust();
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
v8::Local<v8::Value> baseArrayLayerVal;
|
|
312
|
+
if (descObj->Get(context, ConvertToV8String(isolate, "baseArrayLayer")).ToLocal(
|
|
313
|
+
&baseArrayLayerVal) && baseArrayLayerVal->IsUint32()) {
|
|
314
|
+
range.base_array_layer = baseArrayLayerVal->Uint32Value(context).FromJust();
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
v8::Local<v8::Value> baseMipLevelVal;
|
|
318
|
+
if (descObj->Get(context, ConvertToV8String(isolate, "baseMipLevel")).ToLocal(
|
|
319
|
+
&baseMipLevelVal) && baseMipLevelVal->IsUint32()) {
|
|
320
|
+
range.base_mip_level = baseMipLevelVal->Uint32Value(context).FromJust();
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
descriptor->range = ⦥
|
|
324
|
+
|
|
325
|
+
|
|
326
|
+
v8::Local<v8::Value> formatVal;
|
|
327
|
+
descObj->Get(context, ConvertToV8String(isolate, "format")).ToLocal(&formatVal);
|
|
328
|
+
auto formatStr = ConvertFromV8String(isolate, formatVal);
|
|
329
|
+
|
|
330
|
+
descriptor->format = CanvasOptionalGPUTextureFormat{
|
|
331
|
+
CanvasOptionalGPUTextureFormatNone
|
|
332
|
+
};
|
|
333
|
+
|
|
334
|
+
if (!formatStr.empty()) {
|
|
335
|
+
auto format = canvas_native_webgpu_enum_string_to_gpu_texture(formatStr.c_str());
|
|
336
|
+
descriptor->format = format;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
auto dimension = CanvasOptionalTextureViewDimensionNone;
|
|
340
|
+
|
|
341
|
+
|
|
342
|
+
v8::Local<v8::Value> labelVal;
|
|
343
|
+
descObj->Get(context, ConvertToV8String(isolate, "label")).ToLocal(&labelVal);
|
|
344
|
+
|
|
345
|
+
label = GPULabel(isolate, labelVal);
|
|
346
|
+
|
|
347
|
+
descriptor->label = *label;
|
|
348
|
+
|
|
349
|
+
v8::Local<v8::Value> dimensionVal;
|
|
350
|
+
if (descObj->Get(context, ConvertToV8String(isolate, "dimension")).ToLocal(&dimensionVal)) {
|
|
351
|
+
auto dimensionStr = ConvertFromV8String(isolate, dimensionVal);
|
|
352
|
+
if (dimensionStr == "1d") {
|
|
353
|
+
dimension = CanvasOptionalTextureViewDimensionD1;
|
|
354
|
+
} else if (dimensionStr == "2d") {
|
|
355
|
+
dimension = CanvasOptionalTextureViewDimensionD2;
|
|
356
|
+
} else if (dimensionStr == "2d-array") {
|
|
357
|
+
dimension = CanvasOptionalTextureViewDimensionD2Array;
|
|
358
|
+
} else if (dimensionStr == "cube") {
|
|
359
|
+
dimension = CanvasOptionalTextureViewDimensionCube;
|
|
360
|
+
} else if (dimensionStr == "cube-array") {
|
|
361
|
+
dimension = CanvasOptionalTextureViewDimensionCubeArray;
|
|
362
|
+
} else if (dimensionStr == "3d") {
|
|
363
|
+
dimension = CanvasOptionalTextureViewDimensionD3;
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
descriptor->dimension = dimension;
|
|
368
|
+
|
|
369
|
+
|
|
370
|
+
}
|
|
371
|
+
auto view = canvas_native_webgpu_texture_create_texture_view(ptr->GetTexture(), descriptor);
|
|
372
|
+
|
|
373
|
+
if (descriptor != nullptr) {
|
|
374
|
+
delete descriptor;
|
|
375
|
+
descriptor = nullptr;
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
if (view != nullptr) {
|
|
379
|
+
auto ret = GPUTextureViewImpl::NewInstance(isolate, new GPUTextureViewImpl(view));
|
|
380
|
+
args.GetReturnValue().Set(ret);
|
|
381
|
+
return;
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
args.GetReturnValue().SetUndefined();
|
|
385
|
+
|
|
386
|
+
}
|