@nativescript/canvas 2.0.0-webgpu.1 → 2.0.0-webgpu.11
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 +2 -16
- package/Canvas/common.js +1 -62
- package/Canvas/common.js.map +1 -1
- package/Canvas/index.android.d.ts +6 -8
- package/Canvas/index.android.js +116 -62
- package/Canvas/index.android.js.map +1 -1
- package/Canvas/index.d.ts +7 -8
- package/Canvas/index.ios.d.ts +3 -2
- package/Canvas/index.ios.js +115 -74
- package/Canvas/index.ios.js.map +1 -1
- package/Canvas2D/CanvasRenderingContext2D/index.d.ts +1 -0
- package/Canvas2D/CanvasRenderingContext2D/index.js +72 -72
- package/Canvas2D/CanvasRenderingContext2D/index.js.map +1 -1
- package/Canvas2D/DOMMatrix/index.js +1 -1
- package/Canvas2D/DOMMatrix/index.js.map +1 -1
- 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/ImageAsset/index.d.ts +3 -1
- package/ImageAsset/index.js +38 -6
- package/ImageAsset/index.js.map +1 -1
- package/ImageBitmap/index.js +3 -3
- 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.js.map +1 -1
- package/WebGL/WebGLRenderingContext/index.js.map +1 -1
- package/WebGL2/WebGL2RenderingContext/index.js.map +1 -1
- package/WebGPU/Constants.js.map +1 -1
- package/WebGPU/GPU.js.map +1 -1
- package/WebGPU/GPUAdapter.d.ts +4 -2
- package/WebGPU/GPUAdapter.js +3 -0
- package/WebGPU/GPUAdapter.js.map +1 -1
- package/WebGPU/GPUAdapterInfo.js.map +1 -1
- package/WebGPU/GPUBindGroup.d.ts +1 -0
- package/WebGPU/GPUBindGroup.js +3 -0
- package/WebGPU/GPUBindGroup.js.map +1 -1
- package/WebGPU/GPUBindGroupLayout.d.ts +1 -0
- package/WebGPU/GPUBindGroupLayout.js +3 -0
- package/WebGPU/GPUBindGroupLayout.js.map +1 -1
- package/WebGPU/GPUBuffer.js +6 -2
- package/WebGPU/GPUBuffer.js.map +1 -1
- package/WebGPU/GPUCanvasContext.d.ts +1 -1
- package/WebGPU/GPUCanvasContext.js +13 -10
- package/WebGPU/GPUCanvasContext.js.map +1 -1
- package/WebGPU/GPUCommandBuffer.d.ts +1 -0
- package/WebGPU/GPUCommandBuffer.js +3 -0
- package/WebGPU/GPUCommandBuffer.js.map +1 -1
- package/WebGPU/GPUCommandEncoder.d.ts +1 -0
- package/WebGPU/GPUCommandEncoder.js +3 -0
- package/WebGPU/GPUCommandEncoder.js.map +1 -1
- package/WebGPU/GPUComputePassEncoder.d.ts +1 -0
- package/WebGPU/GPUComputePassEncoder.js +3 -0
- package/WebGPU/GPUComputePassEncoder.js.map +1 -1
- package/WebGPU/GPUComputePipeline.d.ts +1 -0
- package/WebGPU/GPUComputePipeline.js +3 -0
- package/WebGPU/GPUComputePipeline.js.map +1 -1
- package/WebGPU/GPUDevice.d.ts +4 -4
- package/WebGPU/GPUDevice.js +32 -9
- package/WebGPU/GPUDevice.js.map +1 -1
- package/WebGPU/GPUExternalTexture.d.ts +1 -0
- package/WebGPU/GPUExternalTexture.js +3 -0
- package/WebGPU/GPUExternalTexture.js.map +1 -1
- package/WebGPU/GPUPipelineLayout.d.ts +1 -0
- package/WebGPU/GPUPipelineLayout.js +3 -0
- package/WebGPU/GPUPipelineLayout.js.map +1 -1
- package/WebGPU/GPUQuerySet.d.ts +1 -0
- package/WebGPU/GPUQuerySet.js +3 -0
- package/WebGPU/GPUQuerySet.js.map +1 -1
- package/WebGPU/GPUQueue.d.ts +1 -0
- package/WebGPU/GPUQueue.js +11 -0
- package/WebGPU/GPUQueue.js.map +1 -1
- package/WebGPU/GPURenderBundle.d.ts +1 -0
- package/WebGPU/GPURenderBundle.js +3 -0
- package/WebGPU/GPURenderBundle.js.map +1 -1
- package/WebGPU/GPURenderBundleEncoder.d.ts +4 -2
- package/WebGPU/GPURenderBundleEncoder.js +7 -3
- package/WebGPU/GPURenderBundleEncoder.js.map +1 -1
- package/WebGPU/GPURenderPassEncoder.d.ts +2 -1
- package/WebGPU/GPURenderPassEncoder.js +5 -2
- package/WebGPU/GPURenderPassEncoder.js.map +1 -1
- package/WebGPU/GPURenderPipeline.d.ts +1 -0
- package/WebGPU/GPURenderPipeline.js +3 -0
- package/WebGPU/GPURenderPipeline.js.map +1 -1
- package/WebGPU/GPUSampler.d.ts +1 -0
- package/WebGPU/GPUSampler.js +3 -0
- package/WebGPU/GPUSampler.js.map +1 -1
- package/WebGPU/GPUShaderModule.d.ts +1 -1
- package/WebGPU/GPUShaderModule.js +2 -2
- package/WebGPU/GPUShaderModule.js.map +1 -1
- package/WebGPU/GPUTexture.d.ts +1 -0
- package/WebGPU/GPUTexture.js +3 -0
- package/WebGPU/GPUTexture.js.map +1 -1
- package/WebGPU/GPUTextureView.d.ts +1 -0
- package/WebGPU/GPUTextureView.js +3 -0
- package/WebGPU/GPUTextureView.js.map +1 -1
- package/WebGPU/Interfaces.d.ts +14 -4
- package/WebGPU/Types.d.ts +28 -27
- package/WebGPU/Utils.d.ts +1 -1
- package/WebGPU/Utils.js.map +1 -1
- package/angular/{esm2020 → esm2022}/index.mjs +5 -5
- package/angular/{fesm2015 → fesm2022}/nativescript-canvas-angular.mjs +4 -4
- package/angular/{fesm2020 → fesm2022}/nativescript-canvas-angular.mjs.map +1 -1
- package/angular/package.json +4 -10
- package/helpers.js.map +1 -1
- package/package.json +2 -2
- 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 +26 -9
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Headers/canvas_native.h +2091 -2055
- 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 +971 -205
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios.private.swiftinterface +38 -9
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios.swiftinterface +38 -9
- 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 +645 -602
- 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 +52 -18
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Headers/canvas_native.h +2091 -2055
- 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 +971 -205
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +38 -9
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios-simulator.swiftinterface +38 -9
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.abi.json +971 -205
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +38 -9
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +38 -9
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/_CodeSignature/CodeResources +25 -25
- 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 +647 -604
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/dSYMs/CanvasNative.framework.dSYM/Contents/Resources/Relocations/x86_64/CanvasNative.yml +685 -638
- package/platforms/ios/src/NSOperationQueueWrapper.h +2 -0
- package/platforms/ios/src/cpp/AsyncCallback.h +206 -0
- package/platforms/ios/src/cpp/CanvasJSIModule.cpp +13 -13
- package/platforms/ios/src/cpp/Helpers.h +2 -164
- package/platforms/ios/src/cpp/ImageAssetImpl.cpp +13 -13
- package/platforms/ios/src/cpp/ImageBitmapImpl.cpp +1 -1
- package/platforms/ios/src/cpp/ImageBitmapImpl.h +2 -1
- 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 +198 -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 -1
- package/platforms/ios/src/cpp/canvas2d/CanvasPattern.h +3 -3
- package/platforms/ios/src/cpp/canvas2d/CanvasRenderingContext2DImpl.cpp +146 -76
- package/platforms/ios/src/cpp/canvas2d/CanvasRenderingContext2DImpl.h +74 -20
- 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 +10 -10
- package/platforms/ios/src/cpp/canvas2d/MatrixImpl.h +2 -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 +8 -8
- package/platforms/ios/src/cpp/webgl/WebGLRenderingContext.h +1 -1
- package/platforms/ios/src/cpp/webgl/WebGLRenderingContextBase.cpp +1 -1
- 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 +722 -722
- 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 +137 -69
- package/platforms/ios/src/cpp/webgpu/GPUAdapterImpl.h +1 -1
- package/platforms/ios/src/cpp/webgpu/GPUAdapterInfoImpl.cpp +1 -1
- package/platforms/ios/src/cpp/webgpu/GPUAdapterInfoImpl.h +1 -1
- package/platforms/ios/src/cpp/webgpu/GPUBindGroupImpl.cpp +32 -6
- package/platforms/ios/src/cpp/webgpu/GPUBindGroupImpl.h +5 -2
- package/platforms/ios/src/cpp/webgpu/GPUBindGroupLayoutImpl.cpp +27 -1
- package/platforms/ios/src/cpp/webgpu/GPUBindGroupLayoutImpl.h +4 -1
- package/platforms/ios/src/cpp/webgpu/GPUBufferImpl.cpp +80 -32
- package/platforms/ios/src/cpp/webgpu/GPUBufferImpl.h +8 -4
- package/platforms/ios/src/cpp/webgpu/GPUCanvasContextImpl.cpp +19 -14
- package/platforms/ios/src/cpp/webgpu/GPUCanvasContextImpl.h +1 -1
- package/platforms/ios/src/cpp/webgpu/GPUCommandBufferImpl.cpp +29 -2
- package/platforms/ios/src/cpp/webgpu/GPUCommandBufferImpl.h +4 -1
- package/platforms/ios/src/cpp/webgpu/GPUCommandEncoderImpl.cpp +455 -457
- package/platforms/ios/src/cpp/webgpu/GPUCommandEncoderImpl.h +5 -1
- package/platforms/ios/src/cpp/webgpu/GPUComputePassEncoderImpl.cpp +42 -14
- package/platforms/ios/src/cpp/webgpu/GPUComputePassEncoderImpl.h +4 -1
- package/platforms/ios/src/cpp/webgpu/GPUComputePipelineImpl.cpp +26 -1
- package/platforms/ios/src/cpp/webgpu/GPUComputePipelineImpl.h +3 -1
- package/platforms/ios/src/cpp/webgpu/GPUDeviceImpl.cpp +1699 -727
- package/platforms/ios/src/cpp/webgpu/GPUDeviceImpl.h +4 -2
- package/platforms/ios/src/cpp/webgpu/GPUImpl.cpp +54 -41
- package/platforms/ios/src/cpp/webgpu/GPUImpl.h +2 -2
- package/platforms/ios/src/cpp/webgpu/GPUPipelineLayoutImpl.cpp +27 -1
- package/platforms/ios/src/cpp/webgpu/GPUPipelineLayoutImpl.h +8 -5
- package/platforms/ios/src/cpp/webgpu/GPUQuerySetImpl.cpp +2 -3
- package/platforms/ios/src/cpp/webgpu/GPUQuerySetImpl.h +2 -2
- package/platforms/ios/src/cpp/webgpu/GPUQueueImpl.cpp +65 -25
- package/platforms/ios/src/cpp/webgpu/GPUQueueImpl.h +4 -1
- package/platforms/ios/src/cpp/webgpu/GPURenderBundleEncoderImpl.cpp +42 -14
- package/platforms/ios/src/cpp/webgpu/GPURenderBundleEncoderImpl.h +4 -1
- package/platforms/ios/src/cpp/webgpu/GPURenderBundleImpl.cpp +26 -1
- package/platforms/ios/src/cpp/webgpu/GPURenderBundleImpl.h +4 -1
- package/platforms/ios/src/cpp/webgpu/GPURenderPassEncoderImpl.cpp +34 -7
- package/platforms/ios/src/cpp/webgpu/GPURenderPassEncoderImpl.h +4 -1
- package/platforms/ios/src/cpp/webgpu/GPURenderPipelineImpl.cpp +26 -1
- package/platforms/ios/src/cpp/webgpu/GPURenderPipelineImpl.h +4 -1
- package/platforms/ios/src/cpp/webgpu/GPUSamplerImpl.cpp +27 -1
- package/platforms/ios/src/cpp/webgpu/GPUSamplerImpl.h +5 -2
- package/platforms/ios/src/cpp/webgpu/GPUShaderModuleImpl.cpp +25 -1
- package/platforms/ios/src/cpp/webgpu/GPUShaderModuleImpl.h +5 -2
- package/platforms/ios/src/cpp/webgpu/GPUSupportedLimitsImpl.cpp +2 -2
- package/platforms/ios/src/cpp/webgpu/GPUSupportedLimitsImpl.h +2 -2
- package/platforms/ios/src/cpp/webgpu/GPUTextureImpl.cpp +33 -8
- package/platforms/ios/src/cpp/webgpu/GPUTextureImpl.h +6 -4
- package/platforms/ios/src/cpp/webgpu/GPUTextureViewImpl.cpp +27 -1
- package/platforms/ios/src/cpp/webgpu/GPUTextureViewImpl.h +5 -2
- package/platforms/ios/src/cpp/webgpu/GPUUtils.h +511 -0
- package/react/index.d.ts +1 -1
- package/utils.d.ts +1 -1
- package/utils.js.map +1 -1
- package/angular/fesm2015/nativescript-canvas-angular.mjs.map +0 -1
- package/angular/fesm2020/nativescript-canvas-angular.mjs +0 -24
- 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
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
|
|
12
12
|
class GPUDeviceImpl : ObjectWrapperImpl {
|
|
13
13
|
public:
|
|
14
|
-
GPUDeviceImpl(const CanvasGPUDevice *device);
|
|
14
|
+
explicit GPUDeviceImpl(const CanvasGPUDevice *device);
|
|
15
15
|
|
|
16
16
|
~GPUDeviceImpl() {
|
|
17
17
|
canvas_native_webgpu_device_release(this->device_);
|
|
@@ -30,12 +30,14 @@ public:
|
|
|
30
30
|
v8::EscapableHandleScope scope(isolate);
|
|
31
31
|
auto object = GPUDeviceImpl::GetCtor(isolate)->GetFunction(
|
|
32
32
|
context).ToLocalChecked()->NewInstance(context).ToLocalChecked();
|
|
33
|
-
SetNativeType(
|
|
33
|
+
SetNativeType(device, NativeType::GPUDevice);
|
|
34
34
|
object->SetAlignedPointerInInternalField(0, device);
|
|
35
35
|
device->BindFinalizer(isolate, object);
|
|
36
36
|
return scope.Escape(object);
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
+
static void GetLabel(v8::Local<v8::Name> name,
|
|
40
|
+
const v8::PropertyCallbackInfo<v8::Value> &info);
|
|
39
41
|
|
|
40
42
|
static void GetFeatures(v8::Local<v8::Name> name,
|
|
41
43
|
const v8::PropertyCallbackInfo<v8::Value> &info);
|
|
@@ -20,7 +20,7 @@ void GPUImpl::Init(const v8::Local<v8::Object> &canvasModule, v8::Isolate *isola
|
|
|
20
20
|
auto context = isolate->GetCurrentContext();
|
|
21
21
|
auto func = ctor->GetFunction(context).ToLocalChecked();
|
|
22
22
|
|
|
23
|
-
canvasModule->Set(context, ConvertToV8String(isolate, "GPU"), func).FromJust()
|
|
23
|
+
canvasModule->Set(context, ConvertToV8String(isolate, "GPU"), func).FromJust();
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
|
|
@@ -69,7 +69,7 @@ void GPUImpl::Ctor(const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
|
69
69
|
|
|
70
70
|
ret->SetAlignedPointerInInternalField(0, object);
|
|
71
71
|
|
|
72
|
-
SetNativeType(
|
|
72
|
+
SetNativeType(object, NativeType::GPUInstance);
|
|
73
73
|
|
|
74
74
|
object->BindFinalizer(isolate, ret);
|
|
75
75
|
|
|
@@ -122,49 +122,62 @@ void GPUImpl::RequestAdapter(const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
124
|
|
|
125
|
-
|
|
125
|
+
|
|
126
126
|
auto callback = new AsyncCallback{
|
|
127
127
|
isolate,
|
|
128
|
-
|
|
128
|
+
args[1].As<v8::Function>(),
|
|
129
|
+
[](bool done, void *data) {
|
|
130
|
+
if (data != nullptr) {
|
|
131
|
+
auto async_data = static_cast<AsyncCallback *>(data);
|
|
132
|
+
auto func = async_data->inner_.get();
|
|
133
|
+
if (func != nullptr && func->isolate_ != nullptr) {
|
|
134
|
+
v8::Isolate *isolate = func->isolate_;
|
|
135
|
+
v8::Locker locker(isolate);
|
|
136
|
+
v8::Isolate::Scope isolate_scope(isolate);
|
|
137
|
+
v8::HandleScope handle_scope(isolate);
|
|
138
|
+
v8::Local<v8::Function> callback = func->callback_.Get(
|
|
139
|
+
isolate);
|
|
140
|
+
v8::Local<v8::Context> context = callback->GetCreationContextChecked();
|
|
141
|
+
v8::Context::Scope context_scope(context);
|
|
142
|
+
|
|
143
|
+
if (func->data != nullptr) {
|
|
144
|
+
auto impl = new GPUAdapterImpl(
|
|
145
|
+
static_cast<const CanvasGPUAdapter *>(func->data));
|
|
146
|
+
auto ret = GPUAdapterImpl::NewInstance(
|
|
147
|
+
isolate, impl);
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
v8::Local<v8::Value> args[2] = {
|
|
151
|
+
v8::Null(isolate), ret};
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
callback->Call(context, context->Global(),
|
|
155
|
+
2,
|
|
156
|
+
args); // ignore JS return value
|
|
157
|
+
|
|
158
|
+
delete static_cast<AsyncCallback *>(data);
|
|
159
|
+
} else {
|
|
160
|
+
v8::Local<v8::Value> args[1] = {
|
|
161
|
+
v8::Null(isolate)};
|
|
162
|
+
|
|
163
|
+
callback->Call(context, context->Global(),
|
|
164
|
+
1,
|
|
165
|
+
args); // ignore JS return value
|
|
166
|
+
delete static_cast<AsyncCallback *>(data);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
129
171
|
};
|
|
172
|
+
callback->prepare();
|
|
130
173
|
canvas_native_webgpu_request_adapter(ptr->GetGPUInstance(), &opts,
|
|
131
174
|
[](const CanvasGPUAdapter *adapter, void *data) {
|
|
132
175
|
if (data != nullptr) {
|
|
133
|
-
auto
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
v8::HandleScope handle_scope(isolate);
|
|
139
|
-
v8::Local<v8::Function> callback = func->callback.Get(
|
|
140
|
-
isolate);
|
|
141
|
-
v8::Local<v8::Context> context = callback->GetCreationContextChecked();
|
|
142
|
-
v8::Context::Scope context_scope(context);
|
|
143
|
-
|
|
144
|
-
if (adapter != nullptr) {
|
|
145
|
-
auto impl = new GPUAdapterImpl(adapter);
|
|
146
|
-
auto ret = GPUAdapterImpl::NewInstance(
|
|
147
|
-
isolate, impl);
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
v8::Local<v8::Value> args[2] = {
|
|
151
|
-
v8::Null(isolate), ret};
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
callback->Call(context, context->Global(),
|
|
155
|
-
2,
|
|
156
|
-
args); // ignore JS return value
|
|
157
|
-
|
|
158
|
-
delete static_cast<AsyncCallback *>(data);
|
|
159
|
-
} else {
|
|
160
|
-
v8::Local<v8::Value> args[1] = {
|
|
161
|
-
v8::Null(isolate)};
|
|
162
|
-
|
|
163
|
-
callback->Call(context, context->Global(),
|
|
164
|
-
1,
|
|
165
|
-
args); // ignore JS return value
|
|
166
|
-
delete static_cast<AsyncCallback *>(data);
|
|
167
|
-
}
|
|
176
|
+
auto async_data = static_cast<AsyncCallback *>(data);
|
|
177
|
+
auto inner = async_data->inner_.get();
|
|
178
|
+
if (inner != nullptr) {
|
|
179
|
+
inner->data = (void *) adapter;
|
|
180
|
+
async_data->execute(true);
|
|
168
181
|
}
|
|
169
182
|
}
|
|
170
183
|
}, callback);
|
|
@@ -180,7 +193,7 @@ void GPUImpl::__GetPointer(const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
|
180
193
|
|
|
181
194
|
auto isolate = args.GetIsolate();
|
|
182
195
|
|
|
183
|
-
auto pointer = (
|
|
184
|
-
auto ret = std::to_string(
|
|
196
|
+
auto pointer = canvas_native_webgpu_get_pointer_addr(ptr->GetGPUInstance());
|
|
197
|
+
auto ret = std::to_string(pointer);
|
|
185
198
|
args.GetReturnValue().Set(ConvertToV8String(isolate, ret));
|
|
186
199
|
}
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
class GPUImpl : ObjectWrapperImpl {
|
|
14
14
|
public:
|
|
15
|
-
GPUImpl(const CanvasWebGPUInstance *instance);
|
|
15
|
+
explicit GPUImpl(const CanvasWebGPUInstance *instance);
|
|
16
16
|
|
|
17
17
|
~GPUImpl() {
|
|
18
18
|
if (this->instance_ != nullptr) {
|
|
@@ -37,7 +37,7 @@ public:
|
|
|
37
37
|
v8::EscapableHandleScope scope(isolate);
|
|
38
38
|
auto object = GPUImpl::GetCtor(isolate)->GetFunction(
|
|
39
39
|
context).ToLocalChecked()->NewInstance(context).ToLocalChecked();
|
|
40
|
-
SetNativeType(
|
|
40
|
+
SetNativeType(instance, NativeType::GPUInstance);
|
|
41
41
|
object->SetAlignedPointerInInternalField(0, instance);
|
|
42
42
|
instance->BindFinalizer(isolate, object);
|
|
43
43
|
return scope.Escape(object);
|
|
@@ -22,7 +22,7 @@ void GPUPipelineLayoutImpl::Init(v8::Local<v8::Object> canvasModule, v8::Isolate
|
|
|
22
22
|
auto context = isolate->GetCurrentContext();
|
|
23
23
|
auto func = ctor->GetFunction(context).ToLocalChecked();
|
|
24
24
|
|
|
25
|
-
canvasModule->Set(context, ConvertToV8String(isolate, "GPUPipelineLayout"), func).FromJust()
|
|
25
|
+
canvasModule->Set(context, ConvertToV8String(isolate, "GPUPipelineLayout"), func).FromJust();
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
GPUPipelineLayoutImpl *GPUPipelineLayoutImpl::GetPointer(const v8::Local<v8::Object> &object) {
|
|
@@ -47,8 +47,34 @@ v8::Local<v8::FunctionTemplate> GPUPipelineLayoutImpl::GetCtor(v8::Isolate *isol
|
|
|
47
47
|
auto tmpl = ctorTmpl->InstanceTemplate();
|
|
48
48
|
tmpl->SetInternalFieldCount(2);
|
|
49
49
|
|
|
50
|
+
tmpl->SetLazyDataProperty(
|
|
51
|
+
ConvertToV8String(isolate, "label"),
|
|
52
|
+
GetLabel
|
|
53
|
+
);
|
|
54
|
+
|
|
50
55
|
cache->GPUPipelineLayoutTmpl =
|
|
51
56
|
std::make_unique<v8::Persistent<v8::FunctionTemplate>>(isolate, ctorTmpl);
|
|
52
57
|
return ctorTmpl;
|
|
53
58
|
}
|
|
54
59
|
|
|
60
|
+
|
|
61
|
+
void
|
|
62
|
+
GPUPipelineLayoutImpl::GetLabel(v8::Local<v8::Name> name,
|
|
63
|
+
const v8::PropertyCallbackInfo<v8::Value> &info) {
|
|
64
|
+
auto ptr = GetPointer(info.This());
|
|
65
|
+
if (ptr != nullptr) {
|
|
66
|
+
auto label = canvas_native_webgpu_pipeline_layout_get_label(ptr->pipeline_);
|
|
67
|
+
if (label == nullptr) {
|
|
68
|
+
info.GetReturnValue().SetEmptyString();
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
info.GetReturnValue().Set(
|
|
72
|
+
ConvertToV8String(info.GetIsolate(), label)
|
|
73
|
+
);
|
|
74
|
+
canvas_native_string_destroy(label);
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
info.GetReturnValue().SetEmptyString();
|
|
79
|
+
}
|
|
80
|
+
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
class GPUPipelineLayoutImpl : ObjectWrapperImpl {
|
|
14
14
|
public:
|
|
15
|
-
GPUPipelineLayoutImpl(const CanvasGPUPipelineLayout *pipeline);
|
|
15
|
+
explicit GPUPipelineLayoutImpl(const CanvasGPUPipelineLayout *pipeline);
|
|
16
16
|
|
|
17
17
|
~GPUPipelineLayoutImpl() {
|
|
18
18
|
canvas_native_webgpu_pipeline_layout_release(this->GetPipeline());
|
|
@@ -26,17 +26,20 @@ public:
|
|
|
26
26
|
|
|
27
27
|
static v8::Local<v8::FunctionTemplate> GetCtor(v8::Isolate *isolate);
|
|
28
28
|
|
|
29
|
-
static v8::Local<v8::Object>
|
|
29
|
+
static v8::Local<v8::Object>
|
|
30
|
+
NewInstance(v8::Isolate *isolate, GPUPipelineLayoutImpl *pipeline) {
|
|
30
31
|
auto context = isolate->GetCurrentContext();
|
|
31
32
|
v8::EscapableHandleScope scope(isolate);
|
|
32
33
|
auto object = GPUPipelineLayoutImpl::GetCtor(isolate)->GetFunction(
|
|
33
34
|
context).ToLocalChecked()->NewInstance(context).ToLocalChecked();
|
|
34
|
-
SetNativeType(
|
|
35
|
-
object->SetAlignedPointerInInternalField(0,
|
|
36
|
-
|
|
35
|
+
SetNativeType(pipeline, NativeType::GPUPipelineLayout);
|
|
36
|
+
object->SetAlignedPointerInInternalField(0, pipeline);
|
|
37
|
+
pipeline->BindFinalizer(isolate, object);
|
|
37
38
|
return scope.Escape(object);
|
|
38
39
|
}
|
|
39
40
|
|
|
41
|
+
static void GetLabel(v8::Local<v8::Name> name,
|
|
42
|
+
const v8::PropertyCallbackInfo<v8::Value> &info);
|
|
40
43
|
|
|
41
44
|
private:
|
|
42
45
|
const CanvasGPUPipelineLayout *pipeline_;
|
|
@@ -21,7 +21,7 @@ void GPUQuerySetImpl::Init(v8::Local<v8::Object> canvasModule, v8::Isolate *isol
|
|
|
21
21
|
auto context = isolate->GetCurrentContext();
|
|
22
22
|
auto func = ctor->GetFunction(context).ToLocalChecked();
|
|
23
23
|
|
|
24
|
-
canvasModule->Set(context, ConvertToV8String(isolate, "GPUQuerySet"), func).FromJust()
|
|
24
|
+
canvasModule->Set(context, ConvertToV8String(isolate, "GPUQuerySet"), func).FromJust();
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
GPUQuerySetImpl *GPUQuerySetImpl::GetPointer(const v8::Local<v8::Object> &object) {
|
|
@@ -78,7 +78,6 @@ void
|
|
|
78
78
|
GPUQuerySetImpl::GetCount(v8::Local<v8::Name> name,
|
|
79
79
|
const v8::PropertyCallbackInfo<v8::Value> &info) {
|
|
80
80
|
auto ptr = GetPointer(info.This());
|
|
81
|
-
auto isolate = info.GetIsolate();
|
|
82
81
|
if (ptr != nullptr) {
|
|
83
82
|
info.GetReturnValue().Set(canvas_native_webgpu_query_set_get_count(ptr->GetQuerySet()));
|
|
84
83
|
return;
|
|
@@ -132,6 +131,6 @@ void GPUQuerySetImpl::Destroy(const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
|
132
131
|
if (ptr == nullptr) {
|
|
133
132
|
return;
|
|
134
133
|
}
|
|
135
|
-
|
|
134
|
+
canvas_native_webgpu_query_set_destroy(ptr->querySet_);
|
|
136
135
|
|
|
137
136
|
}
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
class GPUQuerySetImpl : ObjectWrapperImpl {
|
|
12
12
|
public:
|
|
13
|
-
GPUQuerySetImpl(const CanvasGPUQuerySet *querySet);
|
|
13
|
+
explicit GPUQuerySetImpl(const CanvasGPUQuerySet *querySet);
|
|
14
14
|
|
|
15
15
|
~GPUQuerySetImpl() {
|
|
16
16
|
canvas_native_webgpu_query_set_release(this->GetQuerySet());
|
|
@@ -29,7 +29,7 @@ public:
|
|
|
29
29
|
v8::EscapableHandleScope scope(isolate);
|
|
30
30
|
auto object = GPUQuerySetImpl::GetCtor(isolate)->GetFunction(
|
|
31
31
|
context).ToLocalChecked()->NewInstance(context).ToLocalChecked();
|
|
32
|
-
SetNativeType(
|
|
32
|
+
SetNativeType(querySet, NativeType::GPUQuerySet);
|
|
33
33
|
object->SetAlignedPointerInInternalField(0, querySet);
|
|
34
34
|
querySet->BindFinalizer(isolate, object);
|
|
35
35
|
return scope.Escape(object);
|
|
@@ -30,7 +30,7 @@ void GPUQueueImpl::Init(v8::Local<v8::Object> canvasModule, v8::Isolate *isolate
|
|
|
30
30
|
auto context = isolate->GetCurrentContext();
|
|
31
31
|
auto func = ctor->GetFunction(context).ToLocalChecked();
|
|
32
32
|
|
|
33
|
-
canvasModule->Set(context, ConvertToV8String(isolate, "GPUQueue"), func).FromJust()
|
|
33
|
+
canvasModule->Set(context, ConvertToV8String(isolate, "GPUQueue"), func).FromJust();
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
GPUQueueImpl *GPUQueueImpl::GetPointer(const v8::Local<v8::Object> &object) {
|
|
@@ -55,6 +55,10 @@ v8::Local<v8::FunctionTemplate> GPUQueueImpl::GetCtor(v8::Isolate *isolate) {
|
|
|
55
55
|
auto tmpl = ctorTmpl->InstanceTemplate();
|
|
56
56
|
tmpl->SetInternalFieldCount(2);
|
|
57
57
|
|
|
58
|
+
tmpl->SetLazyDataProperty(
|
|
59
|
+
ConvertToV8String(isolate, "label"),
|
|
60
|
+
GetLabel
|
|
61
|
+
);
|
|
58
62
|
|
|
59
63
|
tmpl->Set(
|
|
60
64
|
ConvertToV8String(isolate, "copyExternalImageToTexture"),
|
|
@@ -84,6 +88,28 @@ v8::Local<v8::FunctionTemplate> GPUQueueImpl::GetCtor(v8::Isolate *isolate) {
|
|
|
84
88
|
return ctorTmpl;
|
|
85
89
|
}
|
|
86
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
|
+
|
|
87
113
|
void GPUQueueImpl::CopyExternalImageToTexture(const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
88
114
|
auto *ptr = GetPointer(args.This());
|
|
89
115
|
if (ptr == nullptr) {
|
|
@@ -306,33 +332,48 @@ void GPUQueueImpl::SubmitWorkDone(const v8::FunctionCallbackInfo<v8::Value> &arg
|
|
|
306
332
|
}
|
|
307
333
|
|
|
308
334
|
auto isolate = args.GetIsolate();
|
|
335
|
+
auto cb = args[0].As<v8::Function>();
|
|
336
|
+
auto callback = new AsyncCallback(isolate, cb, [](bool done, void *data) {
|
|
337
|
+
if (data != nullptr) {
|
|
338
|
+
auto async_data = static_cast<AsyncCallback *>(data);
|
|
339
|
+
auto func = async_data->inner_.get();
|
|
340
|
+
if (func != nullptr && func->isolate_ != nullptr) {
|
|
341
|
+
v8::Isolate *isolate = func->isolate_;
|
|
342
|
+
v8::Locker locker(isolate);
|
|
343
|
+
v8::Isolate::Scope isolate_scope(
|
|
344
|
+
isolate);
|
|
345
|
+
v8::HandleScope handle_scope(
|
|
346
|
+
isolate);
|
|
347
|
+
v8::Local<v8::Function> callback = func->callback_.Get(
|
|
348
|
+
isolate);
|
|
349
|
+
v8::Local<v8::Context> context = callback->GetCreationContextChecked();
|
|
350
|
+
v8::Context::Scope context_scope(
|
|
351
|
+
context);
|
|
352
|
+
|
|
353
|
+
if (func->data != nullptr) {
|
|
354
|
+
// todo handle error
|
|
355
|
+
canvas_native_string_destroy(static_cast<char *>(func->data));
|
|
356
|
+
func->data = nullptr;
|
|
357
|
+
}
|
|
309
358
|
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
canvas_native_webgpu_queue_on_submitted_work_done(ptr->GetGPUQueue(),
|
|
314
|
-
[](char *error, void *data) {
|
|
315
|
-
auto cb = static_cast<JSICallback *>(data);
|
|
316
|
-
|
|
317
|
-
v8::Isolate *isolate = cb->isolate_;
|
|
318
|
-
v8::Locker locker(isolate);
|
|
319
|
-
v8::Isolate::Scope isolate_scope(
|
|
320
|
-
isolate);
|
|
321
|
-
v8::HandleScope handle_scope(
|
|
322
|
-
isolate);
|
|
323
|
-
v8::Local<v8::Function> callback = cb->callback_->Get(
|
|
324
|
-
isolate);
|
|
325
|
-
v8::Local<v8::Context> context = callback->GetCreationContextChecked();
|
|
326
|
-
v8::Context::Scope context_scope(
|
|
327
|
-
context);
|
|
359
|
+
callback->Call(context,
|
|
360
|
+
context->Global(),
|
|
361
|
+
0, nullptr);
|
|
328
362
|
|
|
363
|
+
delete static_cast<AsyncCallback *>(data);
|
|
364
|
+
}
|
|
329
365
|
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
0, nullptr);
|
|
366
|
+
}
|
|
367
|
+
});
|
|
333
368
|
|
|
369
|
+
callback->prepare();
|
|
334
370
|
|
|
335
|
-
|
|
371
|
+
canvas_native_webgpu_queue_on_submitted_work_done(ptr->GetGPUQueue(),
|
|
372
|
+
[](char *error, void *data) {
|
|
373
|
+
if (data != nullptr) {
|
|
374
|
+
auto async_data = static_cast<AsyncCallback *>(data);
|
|
375
|
+
async_data->execute(true);
|
|
376
|
+
}
|
|
336
377
|
},
|
|
337
378
|
callback);
|
|
338
379
|
|
|
@@ -353,7 +394,6 @@ void GPUQueueImpl::WriteBuffer(const v8::FunctionCallbackInfo<v8::Value> &args)
|
|
|
353
394
|
if (bufferValue->IsObject()) {
|
|
354
395
|
auto buffer = GPUBufferImpl::GetPointer(bufferValue.As<v8::Object>());
|
|
355
396
|
|
|
356
|
-
|
|
357
397
|
auto bufferOffset = (uint64_t) args[1].As<v8::Number>()->Value();
|
|
358
398
|
|
|
359
399
|
auto dataValue = args[2].As<v8::TypedArray>();
|
|
@@ -364,7 +404,7 @@ void GPUQueueImpl::WriteBuffer(const v8::FunctionCallbackInfo<v8::Value> &args)
|
|
|
364
404
|
|
|
365
405
|
auto data = static_cast<uint8_t *>(store->Data()) + offset;
|
|
366
406
|
|
|
367
|
-
auto data_size = store->ByteLength();
|
|
407
|
+
auto data_size = store->ByteLength() - offset;
|
|
368
408
|
|
|
369
409
|
auto dataOffset = (uint64_t) args[3].As<v8::Number>()->Value();
|
|
370
410
|
|
|
@@ -31,12 +31,15 @@ public:
|
|
|
31
31
|
v8::EscapableHandleScope scope(isolate);
|
|
32
32
|
auto object = GPUQueueImpl::GetCtor(isolate)->GetFunction(
|
|
33
33
|
context).ToLocalChecked()->NewInstance(context).ToLocalChecked();
|
|
34
|
-
SetNativeType(
|
|
34
|
+
SetNativeType(queue, NativeType::GPUQueue);
|
|
35
35
|
object->SetAlignedPointerInInternalField(0, queue);
|
|
36
36
|
queue->BindFinalizer(isolate, object);
|
|
37
37
|
return scope.Escape(object);
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
+
static void GetLabel(v8::Local<v8::Name> name,
|
|
41
|
+
const v8::PropertyCallbackInfo<v8::Value> &info);
|
|
42
|
+
|
|
40
43
|
static void CopyExternalImageToTexture(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
41
44
|
|
|
42
45
|
static void Submit(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
@@ -54,6 +54,11 @@ v8::Local<v8::FunctionTemplate> GPURenderBundleEncoderImpl::GetCtor(v8::Isolate
|
|
|
54
54
|
auto tmpl = ctorTmpl->InstanceTemplate();
|
|
55
55
|
tmpl->SetInternalFieldCount(2);
|
|
56
56
|
|
|
57
|
+
tmpl->SetLazyDataProperty(
|
|
58
|
+
ConvertToV8String(isolate, "label"),
|
|
59
|
+
GetLabel
|
|
60
|
+
);
|
|
61
|
+
|
|
57
62
|
tmpl->Set(
|
|
58
63
|
ConvertToV8String(isolate, "draw"),
|
|
59
64
|
v8::FunctionTemplate::New(isolate, &Draw));
|
|
@@ -109,6 +114,28 @@ v8::Local<v8::FunctionTemplate> GPURenderBundleEncoderImpl::GetCtor(v8::Isolate
|
|
|
109
114
|
return ctorTmpl;
|
|
110
115
|
}
|
|
111
116
|
|
|
117
|
+
|
|
118
|
+
void
|
|
119
|
+
GPURenderBundleEncoderImpl::GetLabel(v8::Local<v8::Name> name,
|
|
120
|
+
const v8::PropertyCallbackInfo<v8::Value> &info) {
|
|
121
|
+
auto ptr = GetPointer(info.This());
|
|
122
|
+
if (ptr != nullptr) {
|
|
123
|
+
auto label = canvas_native_webgpu_render_bundle_encoder_get_label(ptr->encoder_);
|
|
124
|
+
if (label == nullptr) {
|
|
125
|
+
info.GetReturnValue().SetEmptyString();
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
info.GetReturnValue().Set(
|
|
129
|
+
ConvertToV8String(info.GetIsolate(), label)
|
|
130
|
+
);
|
|
131
|
+
canvas_native_string_destroy(label);
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
info.GetReturnValue().SetEmptyString();
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
|
|
112
139
|
void GPURenderBundleEncoderImpl::Draw(const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
113
140
|
auto *ptr = GetPointer(args.This());
|
|
114
141
|
if (ptr == nullptr) {
|
|
@@ -163,12 +190,16 @@ void GPURenderBundleEncoderImpl::DrawIndexed(const v8::FunctionCallbackInfo<v8::
|
|
|
163
190
|
|
|
164
191
|
|
|
165
192
|
auto indexCountVal = args[0];
|
|
166
|
-
auto
|
|
167
|
-
auto
|
|
168
|
-
auto
|
|
193
|
+
auto instanceCountVal = args[1];
|
|
194
|
+
auto firstIndexVal = args[2];
|
|
195
|
+
auto baseVertexVal = args[3];
|
|
196
|
+
auto firstInstanceVal = args[4];
|
|
169
197
|
|
|
170
198
|
if (indexCountVal->IsUint32()) {
|
|
171
199
|
|
|
200
|
+
if (instanceCountVal->IsUint32()) {
|
|
201
|
+
instanceCount = instanceCountVal.As<v8::Uint32>()->Value();
|
|
202
|
+
}
|
|
172
203
|
|
|
173
204
|
if (firstIndexVal->IsUint32()) {
|
|
174
205
|
firstIndex = firstIndexVal.As<v8::Uint32>()->Value();
|
|
@@ -256,7 +287,7 @@ void GPURenderBundleEncoderImpl::Finish(const v8::FunctionCallbackInfo<v8::Value
|
|
|
256
287
|
auto isolate = args.GetIsolate();
|
|
257
288
|
auto context = isolate->GetCurrentContext();
|
|
258
289
|
|
|
259
|
-
|
|
290
|
+
std::string label;
|
|
260
291
|
v8::Local<v8::Value> labelVal;
|
|
261
292
|
|
|
262
293
|
auto optionsVal = args[0];
|
|
@@ -265,13 +296,11 @@ void GPURenderBundleEncoderImpl::Finish(const v8::FunctionCallbackInfo<v8::Value
|
|
|
265
296
|
auto options = optionsVal.As<v8::Object>();
|
|
266
297
|
options->Get(context, ConvertToV8String(isolate, "label")).ToLocal(&labelVal);
|
|
267
298
|
|
|
268
|
-
|
|
269
|
-
label = *v8::String::Utf8Value(isolate, labelVal);
|
|
270
|
-
}
|
|
299
|
+
label = ConvertFromV8String(isolate, labelVal);
|
|
271
300
|
}
|
|
272
301
|
|
|
273
302
|
|
|
274
|
-
auto bundle = canvas_native_webgpu_render_bundle_encoder_finish(ptr->GetEncoder(), label);
|
|
303
|
+
auto bundle = canvas_native_webgpu_render_bundle_encoder_finish(ptr->GetEncoder(), label.c_str());
|
|
275
304
|
|
|
276
305
|
if (bundle != nullptr) {
|
|
277
306
|
auto ret = GPURenderBundleImpl::NewInstance(isolate, new GPURenderBundleImpl(bundle));
|
|
@@ -345,7 +374,7 @@ void GPURenderBundleEncoderImpl::SetBindGroup(const v8::FunctionCallbackInfo<v8:
|
|
|
345
374
|
auto index = indexVal->Uint32Value(context).FromJust();
|
|
346
375
|
auto bindGroup = GPUBindGroupImpl::GetPointer(bindGroupVal.As<v8::Object>());
|
|
347
376
|
|
|
348
|
-
if (dynamicOffsets->
|
|
377
|
+
if (dynamicOffsets->IsUint32Array()) {
|
|
349
378
|
auto buf = dynamicOffsets.As<v8::Uint32Array>();
|
|
350
379
|
auto buffer = buf->Buffer();
|
|
351
380
|
auto store = buffer->GetBackingStore();
|
|
@@ -374,7 +403,6 @@ void GPURenderBundleEncoderImpl::SetIndexBuffer(const v8::FunctionCallbackInfo<v
|
|
|
374
403
|
}
|
|
375
404
|
|
|
376
405
|
auto isolate = args.GetIsolate();
|
|
377
|
-
auto context = isolate->GetCurrentContext();
|
|
378
406
|
|
|
379
407
|
auto bufferVal = args[0];
|
|
380
408
|
auto indexFormatVal = args[1];
|
|
@@ -385,7 +413,7 @@ void GPURenderBundleEncoderImpl::SetIndexBuffer(const v8::FunctionCallbackInfo<v
|
|
|
385
413
|
|
|
386
414
|
auto type = GetNativeType(bufferVal);
|
|
387
415
|
|
|
388
|
-
if (type == NativeType::
|
|
416
|
+
if (type == NativeType::GPUBuffer) {
|
|
389
417
|
auto buffer = GPUBufferImpl::GetPointer(bufferVal.As<v8::Object>());
|
|
390
418
|
auto indexFormat = ConvertFromV8String(isolate, indexFormatVal);
|
|
391
419
|
if (offsetVal->IsNumber()) {
|
|
@@ -421,7 +449,7 @@ void GPURenderBundleEncoderImpl::SetPipeline(const v8::FunctionCallbackInfo<v8::
|
|
|
421
449
|
}
|
|
422
450
|
|
|
423
451
|
auto pipelineVal = args[0];
|
|
424
|
-
if
|
|
452
|
+
if(GetNativeType(pipelineVal) == NativeType::GPURenderPipeline){
|
|
425
453
|
auto pipeline = GPURenderPipelineImpl::GetPointer(pipelineVal.As<v8::Object>());
|
|
426
454
|
if (pipeline != nullptr) {
|
|
427
455
|
canvas_native_webgpu_render_bundle_encoder_set_pipeline(ptr->GetEncoder(),
|
|
@@ -445,11 +473,11 @@ void GPURenderBundleEncoderImpl::SetVertexBuffer(const v8::FunctionCallbackInfo<
|
|
|
445
473
|
|
|
446
474
|
if (slotVal->IsUint32() && bufferVal->IsObject()) {
|
|
447
475
|
auto slot = slotVal.As<v8::Uint32>()->Value();
|
|
448
|
-
|
|
449
|
-
if (buffer == nullptr) {
|
|
476
|
+
if (GetNativeType(bufferVal) != NativeType::GPUBuffer) {
|
|
450
477
|
// todo throw ??
|
|
451
478
|
return;
|
|
452
479
|
}
|
|
480
|
+
auto buffer = GPUBufferImpl::GetPointer(bufferVal.As<v8::Object>());
|
|
453
481
|
|
|
454
482
|
if (offsetVal->IsNumber()) {
|
|
455
483
|
offset = (int64_t) offsetVal.As<v8::Number>()->Value();
|
|
@@ -32,12 +32,15 @@ public:
|
|
|
32
32
|
v8::EscapableHandleScope scope(isolate);
|
|
33
33
|
auto object = GPURenderBundleEncoderImpl::GetCtor(isolate)->GetFunction(
|
|
34
34
|
context).ToLocalChecked()->NewInstance(context).ToLocalChecked();
|
|
35
|
-
SetNativeType(
|
|
35
|
+
SetNativeType(encoder, NativeType::GPURenderBundleEncoder);
|
|
36
36
|
object->SetAlignedPointerInInternalField(0, encoder);
|
|
37
37
|
encoder->BindFinalizer(isolate, object);
|
|
38
38
|
return scope.Escape(object);
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
+
static void GetLabel(v8::Local<v8::Name> name,
|
|
42
|
+
const v8::PropertyCallbackInfo<v8::Value> &info);
|
|
43
|
+
|
|
41
44
|
static void Draw(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
42
45
|
|
|
43
46
|
static void DrawIndexed(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
@@ -22,7 +22,7 @@ void GPURenderBundleImpl::Init(v8::Local<v8::Object> canvasModule, v8::Isolate *
|
|
|
22
22
|
auto context = isolate->GetCurrentContext();
|
|
23
23
|
auto func = ctor->GetFunction(context).ToLocalChecked();
|
|
24
24
|
|
|
25
|
-
canvasModule->Set(context, ConvertToV8String(isolate, "GPURenderBundle"), func).FromJust()
|
|
25
|
+
canvasModule->Set(context, ConvertToV8String(isolate, "GPURenderBundle"), func).FromJust();
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
GPURenderBundleImpl *GPURenderBundleImpl::GetPointer(const v8::Local<v8::Object> &object) {
|
|
@@ -47,7 +47,32 @@ v8::Local<v8::FunctionTemplate> GPURenderBundleImpl::GetCtor(v8::Isolate *isolat
|
|
|
47
47
|
auto tmpl = ctorTmpl->InstanceTemplate();
|
|
48
48
|
tmpl->SetInternalFieldCount(2);
|
|
49
49
|
|
|
50
|
+
tmpl->SetLazyDataProperty(
|
|
51
|
+
ConvertToV8String(isolate, "label"),
|
|
52
|
+
GetLabel
|
|
53
|
+
);
|
|
54
|
+
|
|
50
55
|
cache->GPURenderBundleTmpl =
|
|
51
56
|
std::make_unique<v8::Persistent<v8::FunctionTemplate>>(isolate, ctorTmpl);
|
|
52
57
|
return ctorTmpl;
|
|
53
58
|
}
|
|
59
|
+
|
|
60
|
+
void
|
|
61
|
+
GPURenderBundleImpl::GetLabel(v8::Local<v8::Name> name,
|
|
62
|
+
const v8::PropertyCallbackInfo<v8::Value> &info) {
|
|
63
|
+
auto ptr = GetPointer(info.This());
|
|
64
|
+
if (ptr != nullptr) {
|
|
65
|
+
auto label = canvas_native_webgpu_render_bundle_get_label(ptr->bundle_);
|
|
66
|
+
if (label == nullptr) {
|
|
67
|
+
info.GetReturnValue().SetEmptyString();
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
info.GetReturnValue().Set(
|
|
71
|
+
ConvertToV8String(info.GetIsolate(), label)
|
|
72
|
+
);
|
|
73
|
+
canvas_native_string_destroy(label);
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
info.GetReturnValue().SetEmptyString();
|
|
78
|
+
}
|
|
@@ -30,12 +30,15 @@ public:
|
|
|
30
30
|
v8::EscapableHandleScope scope(isolate);
|
|
31
31
|
auto object = GPURenderBundleImpl::GetCtor(isolate)->GetFunction(
|
|
32
32
|
context).ToLocalChecked()->NewInstance(context).ToLocalChecked();
|
|
33
|
-
SetNativeType(
|
|
33
|
+
SetNativeType(bundle, NativeType::GPURenderBundle);
|
|
34
34
|
object->SetAlignedPointerInInternalField(0, bundle);
|
|
35
35
|
bundle->BindFinalizer(isolate, object);
|
|
36
36
|
return scope.Escape(object);
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
+
static void GetLabel(v8::Local<v8::Name> name,
|
|
40
|
+
const v8::PropertyCallbackInfo<v8::Value> &info);
|
|
41
|
+
|
|
39
42
|
|
|
40
43
|
private:
|
|
41
44
|
const CanvasGPURenderBundle *bundle_;
|