@nativescript/canvas 2.0.0-webgpu.1 → 2.0.0-webgpu.10
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 +3 -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 +1 -0
- package/WebGPU/GPURenderBundleEncoder.js +3 -0
- 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/Info.plist +5 -5
- 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 +30 -5
- 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 +33 -6
- 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
|
@@ -115,7 +115,7 @@ public:
|
|
|
115
115
|
v8::EscapableHandleScope scope(isolate);
|
|
116
116
|
auto object = WebGL2RenderingContext::GetCtor(isolate)->GetFunction(
|
|
117
117
|
context).ToLocalChecked()->NewInstance(context).ToLocalChecked();
|
|
118
|
-
SetNativeType(
|
|
118
|
+
SetNativeType(renderingContext, NativeType::WebGLRenderingContextBase);
|
|
119
119
|
object->SetAlignedPointerInInternalField(0, renderingContext);
|
|
120
120
|
renderingContext->BindFinalizer(isolate, object);
|
|
121
121
|
return scope.Escape(object);
|
|
@@ -35,7 +35,7 @@ public:
|
|
|
35
35
|
v8::EscapableHandleScope scope(isolate);
|
|
36
36
|
auto object = WebGLQuery::GetCtor(isolate)->GetFunction(
|
|
37
37
|
context).ToLocalChecked()->NewInstance(context).ToLocalChecked();
|
|
38
|
-
SetNativeType(
|
|
38
|
+
SetNativeType( query, NativeType::WebGLQuery);
|
|
39
39
|
object->SetAlignedPointerInInternalField(0, query);
|
|
40
40
|
query->BindFinalizer(isolate, object);
|
|
41
41
|
return scope.Escape(object);
|
|
@@ -36,7 +36,7 @@ public:
|
|
|
36
36
|
v8::EscapableHandleScope scope(isolate);
|
|
37
37
|
auto object = WebGLSampler::GetCtor(isolate)->GetFunction(
|
|
38
38
|
context).ToLocalChecked()->NewInstance(context).ToLocalChecked();
|
|
39
|
-
SetNativeType(
|
|
39
|
+
SetNativeType( sampler, NativeType::WebGLSampler);
|
|
40
40
|
object->SetAlignedPointerInInternalField(0, sampler);
|
|
41
41
|
sampler->BindFinalizer(isolate, object);
|
|
42
42
|
return scope.Escape(object);
|
|
@@ -35,7 +35,7 @@ public:
|
|
|
35
35
|
v8::EscapableHandleScope scope(isolate);
|
|
36
36
|
auto object = WebGLSyncImpl::GetCtor(isolate)->GetFunction(
|
|
37
37
|
context).ToLocalChecked()->NewInstance(context).ToLocalChecked();
|
|
38
|
-
SetNativeType(
|
|
38
|
+
SetNativeType( sync, NativeType::WebGLSync);
|
|
39
39
|
object->SetAlignedPointerInInternalField(0, sync);
|
|
40
40
|
sync->BindFinalizer(isolate, object);
|
|
41
41
|
return scope.Escape(object);
|
|
@@ -37,7 +37,7 @@ public:
|
|
|
37
37
|
v8::EscapableHandleScope scope(isolate);
|
|
38
38
|
auto object = WebGLTransformFeedback::GetCtor(isolate)->GetFunction(
|
|
39
39
|
context).ToLocalChecked()->NewInstance(context).ToLocalChecked();
|
|
40
|
-
SetNativeType(
|
|
40
|
+
SetNativeType( feedback, NativeType::WebGLTransformFeedback);
|
|
41
41
|
object->SetAlignedPointerInInternalField(0, feedback);
|
|
42
42
|
feedback->BindFinalizer(isolate, object);
|
|
43
43
|
return scope.Escape(object);
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
#include "Helpers.h"
|
|
10
10
|
#include "ObjectWrapperImpl.h"
|
|
11
11
|
|
|
12
|
-
class WebGLVertexArrayObject: ObjectWrapperImpl {
|
|
12
|
+
class WebGLVertexArrayObject : ObjectWrapperImpl {
|
|
13
13
|
public:
|
|
14
14
|
WebGLVertexArrayObject(uint32_t vertexArrayObject) : vertexArrayObject_(vertexArrayObject) {}
|
|
15
15
|
|
|
@@ -38,7 +38,7 @@ public:
|
|
|
38
38
|
v8::EscapableHandleScope scope(isolate);
|
|
39
39
|
auto object = WebGLVertexArrayObject::GetCtor(isolate)->GetFunction(
|
|
40
40
|
context).ToLocalChecked()->NewInstance(context).ToLocalChecked();
|
|
41
|
-
SetNativeType(
|
|
41
|
+
SetNativeType(vertexArrayObject, NativeType::WebGLVertexArrayObject);
|
|
42
42
|
object->SetAlignedPointerInInternalField(0, vertexArrayObject);
|
|
43
43
|
vertexArrayObject->BindFinalizer(isolate, object);
|
|
44
44
|
return scope.Escape(object);
|
|
@@ -61,7 +61,6 @@ v8::Local<v8::FunctionTemplate> GPUAdapterImpl::GetCtor(v8::Isolate *isolate) {
|
|
|
61
61
|
GetLimits
|
|
62
62
|
);
|
|
63
63
|
|
|
64
|
-
|
|
65
64
|
tmpl->Set(
|
|
66
65
|
ConvertToV8String(isolate, "requestAdapterInfo"),
|
|
67
66
|
v8::FunctionTemplate::New(isolate, &RequestAdapterInfo));
|
|
@@ -90,19 +89,19 @@ GPUAdapterImpl::GetFeatures(v8::Local<v8::Name> name,
|
|
|
90
89
|
|
|
91
90
|
auto len = canvas_native_string_buffer_get_length(features);
|
|
92
91
|
|
|
93
|
-
auto
|
|
92
|
+
auto set = v8::Set::New(isolate);
|
|
94
93
|
for (int i = 0; i < len; ++i) {
|
|
95
94
|
auto item = canvas_native_string_buffer_get_value_at(features, i);
|
|
96
95
|
if (item != nullptr) {
|
|
97
|
-
auto keyValue =
|
|
98
|
-
|
|
96
|
+
auto keyValue = ConvertToV8String(isolate, (char *) item);
|
|
97
|
+
set->Add(context, keyValue);
|
|
99
98
|
canvas_native_string_destroy(item);
|
|
100
99
|
}
|
|
101
100
|
|
|
102
101
|
}
|
|
103
|
-
|
|
102
|
+
canvas_native_string_buffer_release(features);
|
|
104
103
|
|
|
105
|
-
info.GetReturnValue().Set(
|
|
104
|
+
info.GetReturnValue().Set(set);
|
|
106
105
|
|
|
107
106
|
return;
|
|
108
107
|
}
|
|
@@ -158,6 +157,27 @@ void GPUAdapterImpl::RequestAdapterInfo(const v8::FunctionCallbackInfo<v8::Value
|
|
|
158
157
|
|
|
159
158
|
}
|
|
160
159
|
|
|
160
|
+
struct RequestData {
|
|
161
|
+
char *error_;
|
|
162
|
+
const CanvasGPUDevice *device_;
|
|
163
|
+
char **required_features_data_;
|
|
164
|
+
size_t required_features_data_size;
|
|
165
|
+
|
|
166
|
+
~RequestData() {
|
|
167
|
+
if (required_features_data_ != nullptr) {
|
|
168
|
+
for (size_t i = 0; i < required_features_data_size; ++i) {
|
|
169
|
+
delete[] required_features_data_[i];
|
|
170
|
+
}
|
|
171
|
+
delete[] required_features_data_;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
if (error_ != nullptr) {
|
|
175
|
+
canvas_native_string_destroy(error_);
|
|
176
|
+
error_ = nullptr;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
};
|
|
180
|
+
|
|
161
181
|
void GPUAdapterImpl::RequestDevice(const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
162
182
|
GPUAdapterImpl *ptr = GetPointer(args.This());
|
|
163
183
|
auto isolate = args.GetIsolate();
|
|
@@ -170,7 +190,7 @@ void GPUAdapterImpl::RequestDevice(const v8::FunctionCallbackInfo<v8::Value> &ar
|
|
|
170
190
|
return;
|
|
171
191
|
}
|
|
172
192
|
|
|
173
|
-
|
|
193
|
+
auto func = cb.As<v8::Function>();
|
|
174
194
|
|
|
175
195
|
std::string label;
|
|
176
196
|
|
|
@@ -194,11 +214,9 @@ void GPUAdapterImpl::RequestDevice(const v8::FunctionCallbackInfo<v8::Value> &ar
|
|
|
194
214
|
&requiredFeaturesValue);
|
|
195
215
|
|
|
196
216
|
|
|
197
|
-
if (!requiredFeaturesValue.IsEmpty() && requiredFeaturesValue->
|
|
198
|
-
v8::Local<v8::
|
|
199
|
-
v8::Local<v8::Array> requiredFeatures = requiredFeaturesSet->AsArray();
|
|
217
|
+
if (!requiredFeaturesValue.IsEmpty() && requiredFeaturesValue->IsArray()) {
|
|
218
|
+
v8::Local<v8::Array> requiredFeatures = requiredFeaturesValue.As<v8::Array>();
|
|
200
219
|
auto len = requiredFeatures->Length();
|
|
201
|
-
|
|
202
220
|
for (int i = 0; i < len; i++) {
|
|
203
221
|
auto item = requiredFeatures->Get(context, i);
|
|
204
222
|
if (!item.IsEmpty()) {
|
|
@@ -210,7 +228,6 @@ void GPUAdapterImpl::RequestDevice(const v8::FunctionCallbackInfo<v8::Value> &ar
|
|
|
210
228
|
}
|
|
211
229
|
}
|
|
212
230
|
|
|
213
|
-
|
|
214
231
|
v8::Local<v8::Value> limitsValue;
|
|
215
232
|
|
|
216
233
|
options->Get(context, ConvertToV8String(isolate, "requiredLimits")).ToLocal(
|
|
@@ -228,75 +245,126 @@ void GPUAdapterImpl::RequestDevice(const v8::FunctionCallbackInfo<v8::Value> &ar
|
|
|
228
245
|
size_t required_features_data_length = required_features_buf.size();
|
|
229
246
|
|
|
230
247
|
if (required_features_data_length > 0) {
|
|
231
|
-
required_features_data = new char *[required_features_data_length
|
|
248
|
+
required_features_data = new char *[required_features_data_length];
|
|
232
249
|
|
|
233
250
|
for (size_t i = 0; i < required_features_data_length; ++i) {
|
|
234
|
-
|
|
251
|
+
required_features_data[i] = new char[required_features_buf[i].size() + 1];
|
|
252
|
+
auto src = required_features_buf[i].c_str();
|
|
253
|
+
std::strcpy(required_features_data[i], src);
|
|
235
254
|
}
|
|
236
255
|
}
|
|
237
256
|
|
|
238
|
-
|
|
239
257
|
auto callback = new AsyncCallback{
|
|
240
258
|
isolate,
|
|
241
|
-
|
|
242
|
-
|
|
259
|
+
func,
|
|
260
|
+
[](bool done, void *data) {
|
|
261
|
+
if (data != nullptr) {
|
|
262
|
+
auto async_data = static_cast<AsyncCallback *>(data);
|
|
263
|
+
auto func = async_data->inner_.get();
|
|
264
|
+
if (func != nullptr && func->isolate_ != nullptr) {
|
|
265
|
+
v8::Isolate *isolate = func->isolate_;
|
|
266
|
+
v8::Locker locker(isolate);
|
|
267
|
+
v8::Isolate::Scope isolate_scope(isolate);
|
|
268
|
+
v8::HandleScope handle_scope(isolate);
|
|
269
|
+
v8::Local<v8::Function> callback = func->callback_.Get(
|
|
270
|
+
isolate);
|
|
271
|
+
v8::Local<v8::Context> context = callback->GetCreationContextChecked();
|
|
272
|
+
v8::Context::Scope context_scope(context);
|
|
273
|
+
|
|
274
|
+
RequestData *requestData = nullptr;
|
|
275
|
+
if (func->data != nullptr) {
|
|
276
|
+
requestData = static_cast<RequestData *>(func->data);
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
if (requestData == nullptr) {
|
|
280
|
+
// Should never happen
|
|
281
|
+
v8::Local<v8::Value> args[1] = {
|
|
282
|
+
v8::Exception::Error(
|
|
283
|
+
ConvertToV8String(isolate, "Internal Error"))};
|
|
284
|
+
|
|
285
|
+
callback->Call(context, context->Global(),
|
|
286
|
+
1,
|
|
287
|
+
args); // ignore JS return value
|
|
288
|
+
delete static_cast<AsyncCallback *>(data);
|
|
289
|
+
|
|
290
|
+
return;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
if (requestData->error_ != nullptr) {
|
|
294
|
+
v8::Local<v8::Value> args[1] = {
|
|
295
|
+
v8::Exception::Error(
|
|
296
|
+
ConvertToV8String(isolate,
|
|
297
|
+
requestData->error_))};
|
|
298
|
+
|
|
299
|
+
callback->Call(context, context->Global(),
|
|
300
|
+
1,
|
|
301
|
+
args); // ignore JS return value
|
|
302
|
+
} else {
|
|
303
|
+
|
|
304
|
+
auto impl = new GPUDeviceImpl(requestData->device_);
|
|
305
|
+
auto ret = GPUDeviceImpl::NewInstance(
|
|
306
|
+
isolate, impl);
|
|
307
|
+
|
|
308
|
+
v8::Local<v8::Value> args[2] = {
|
|
309
|
+
v8::Null(isolate), ret};
|
|
310
|
+
|
|
311
|
+
|
|
312
|
+
callback->Call(context, context->Global(),
|
|
313
|
+
2,
|
|
314
|
+
args); // ignore JS return value
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
if (requestData != nullptr) {
|
|
318
|
+
delete requestData;
|
|
319
|
+
requestData = nullptr;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
delete static_cast<AsyncCallback *>(data);
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
}
|
|
243
326
|
};
|
|
244
327
|
|
|
245
|
-
|
|
246
|
-
label.empty() ? nullptr : label.c_str(),
|
|
247
|
-
required_features_data, required_features_data_length,
|
|
248
|
-
limits,
|
|
249
|
-
[](char *error, const CanvasGPUDevice *device, void *data) {
|
|
250
|
-
if (data != nullptr) {
|
|
251
|
-
auto func = static_cast<AsyncCallback *>(data);
|
|
252
|
-
if (func->isolate != nullptr) {
|
|
253
|
-
v8::Isolate *isolate = func->isolate;
|
|
254
|
-
v8::Locker locker(isolate);
|
|
255
|
-
v8::Isolate::Scope isolate_scope(isolate);
|
|
256
|
-
v8::HandleScope handle_scope(isolate);
|
|
257
|
-
v8::Local<v8::Function> callback = func->callback.Get(
|
|
258
|
-
isolate);
|
|
259
|
-
v8::Local<v8::Context> context = callback->GetCreationContextChecked();
|
|
260
|
-
v8::Context::Scope context_scope(context);
|
|
261
|
-
|
|
262
|
-
if (func->data != nullptr) {
|
|
263
|
-
delete[] static_cast<char **>(func->data);
|
|
264
|
-
func->data = nullptr;
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
if (error != nullptr) {
|
|
268
|
-
v8::Local<v8::Value> args[1] = {
|
|
269
|
-
v8::Exception::Error(
|
|
270
|
-
ConvertToV8String(isolate,
|
|
271
|
-
error))};
|
|
272
|
-
|
|
273
|
-
canvas_native_string_destroy(error);
|
|
274
|
-
|
|
275
|
-
callback->Call(context, context->Global(),
|
|
276
|
-
1,
|
|
277
|
-
args); // ignore JS return value
|
|
278
|
-
delete static_cast<AsyncCallback *>(data);
|
|
279
|
-
} else {
|
|
280
|
-
|
|
281
|
-
auto impl = new GPUDeviceImpl(device);
|
|
282
|
-
auto ret = GPUDeviceImpl::NewInstance(
|
|
283
|
-
isolate, impl);
|
|
328
|
+
auto inner = callback->inner_.get();
|
|
284
329
|
|
|
330
|
+
if (required_features_data != nullptr) {
|
|
331
|
+
inner->data = new RequestData{
|
|
332
|
+
nullptr,
|
|
333
|
+
nullptr,
|
|
334
|
+
required_features_data,
|
|
335
|
+
required_features_data_length
|
|
336
|
+
};
|
|
337
|
+
}
|
|
285
338
|
|
|
286
|
-
|
|
287
|
-
v8::Null(isolate), ret};
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
callback->Call(context, context->Global(),
|
|
291
|
-
2,
|
|
292
|
-
args); // ignore JS return value
|
|
293
|
-
|
|
294
|
-
delete static_cast<AsyncCallback *>(data);
|
|
339
|
+
callback->prepare();
|
|
295
340
|
|
|
341
|
+
canvas_native_webgpu_adapter_request_device(ptr->GetGPUAdapter(),
|
|
342
|
+
label.empty() ? nullptr : label.c_str(),
|
|
343
|
+
required_features_data,
|
|
344
|
+
required_features_data_length,
|
|
345
|
+
limits,
|
|
346
|
+
[](char *error, const CanvasGPUDevice *device,
|
|
347
|
+
void *data) {
|
|
348
|
+
if (data != nullptr) {
|
|
349
|
+
auto async_data = static_cast<AsyncCallback *>(data);
|
|
350
|
+
auto inner = async_data->inner_.get();
|
|
351
|
+
if (inner != nullptr) {
|
|
352
|
+
if (inner->data == nullptr) {
|
|
353
|
+
inner->data = new RequestData{
|
|
354
|
+
error,
|
|
355
|
+
device
|
|
356
|
+
};
|
|
357
|
+
} else {
|
|
358
|
+
auto request_data = static_cast<RequestData *>(inner->data);
|
|
359
|
+
request_data->error_ = error;
|
|
360
|
+
request_data->device_ = device;
|
|
361
|
+
delete request_data->required_features_data_;
|
|
362
|
+
request_data->required_features_data_ = nullptr;
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
async_data->execute(true);
|
|
366
|
+
}
|
|
296
367
|
}
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
}, callback);
|
|
300
|
-
|
|
368
|
+
}, callback);
|
|
301
369
|
|
|
302
370
|
}
|
|
@@ -33,7 +33,7 @@ public:
|
|
|
33
33
|
v8::EscapableHandleScope scope(isolate);
|
|
34
34
|
auto object = GPUAdapterImpl::GetCtor(isolate)->GetFunction(
|
|
35
35
|
context).ToLocalChecked()->NewInstance(context).ToLocalChecked();
|
|
36
|
-
SetNativeType(
|
|
36
|
+
SetNativeType(adapter, NativeType::GPUAdapter);
|
|
37
37
|
object->SetAlignedPointerInInternalField(0, adapter);
|
|
38
38
|
adapter->BindFinalizer(isolate, object);
|
|
39
39
|
return scope.Escape(object);
|
|
@@ -21,7 +21,7 @@ void GPUAdapterInfoImpl::Init(v8::Local<v8::Object> canvasModule, v8::Isolate *i
|
|
|
21
21
|
auto context = isolate->GetCurrentContext();
|
|
22
22
|
auto func = ctor->GetFunction(context).ToLocalChecked();
|
|
23
23
|
|
|
24
|
-
canvasModule->Set(context, ConvertToV8String(isolate, "GPUAdapterInfo"), func).FromJust()
|
|
24
|
+
canvasModule->Set(context, ConvertToV8String(isolate, "GPUAdapterInfo"), func).FromJust();
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
GPUAdapterInfoImpl *GPUAdapterInfoImpl::GetPointer(const v8::Local<v8::Object> &object) {
|
|
@@ -30,7 +30,7 @@ public:
|
|
|
30
30
|
v8::EscapableHandleScope scope(isolate);
|
|
31
31
|
auto object = GPUAdapterInfoImpl::GetCtor(isolate)->GetFunction(
|
|
32
32
|
context).ToLocalChecked()->NewInstance(context).ToLocalChecked();
|
|
33
|
-
SetNativeType(
|
|
33
|
+
SetNativeType(info, NativeType::GPUAdapterInfo);
|
|
34
34
|
object->SetAlignedPointerInInternalField(0, info);
|
|
35
35
|
info->BindFinalizer(isolate, object);
|
|
36
36
|
return scope.Escape(object);
|
|
@@ -13,7 +13,7 @@ const CanvasGPUBindGroup *GPUBindGroupImpl::GetBindGroup() {
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
void GPUBindGroupImpl::Init(v8::Local
|
|
16
|
+
void GPUBindGroupImpl::Init(v8::Local<v8::Object> canvasModule, v8::Isolate *isolate) {
|
|
17
17
|
v8::Locker locker(isolate);
|
|
18
18
|
v8::Isolate::Scope isolate_scope(isolate);
|
|
19
19
|
v8::HandleScope handle_scope(isolate);
|
|
@@ -22,10 +22,10 @@ void GPUBindGroupImpl::Init(v8::Local <v8::Object> canvasModule, v8::Isolate *is
|
|
|
22
22
|
auto context = isolate->GetCurrentContext();
|
|
23
23
|
auto func = ctor->GetFunction(context).ToLocalChecked();
|
|
24
24
|
|
|
25
|
-
canvasModule->Set(context, ConvertToV8String(isolate, "GPUBindGroup"), func).FromJust()
|
|
25
|
+
canvasModule->Set(context, ConvertToV8String(isolate, "GPUBindGroup"), func).FromJust();
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
GPUBindGroupImpl *GPUBindGroupImpl::GetPointer(const v8::Local
|
|
28
|
+
GPUBindGroupImpl *GPUBindGroupImpl::GetPointer(const v8::Local<v8::Object> &object) {
|
|
29
29
|
auto ptr = object->GetAlignedPointerFromInternalField(0);
|
|
30
30
|
if (ptr == nullptr) {
|
|
31
31
|
return nullptr;
|
|
@@ -33,21 +33,47 @@ GPUBindGroupImpl *GPUBindGroupImpl::GetPointer(const v8::Local <v8::Object> &obj
|
|
|
33
33
|
return static_cast<GPUBindGroupImpl *>(ptr);
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
v8::Local
|
|
36
|
+
v8::Local<v8::FunctionTemplate> GPUBindGroupImpl::GetCtor(v8::Isolate *isolate) {
|
|
37
37
|
auto cache = Caches::Get(isolate);
|
|
38
38
|
auto ctor = cache->GPUBindGroupTmpl.get();
|
|
39
39
|
if (ctor != nullptr) {
|
|
40
40
|
return ctor->Get(isolate);
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
v8::Local
|
|
43
|
+
v8::Local<v8::FunctionTemplate> ctorTmpl = v8::FunctionTemplate::New(isolate);
|
|
44
44
|
ctorTmpl->InstanceTemplate()->SetInternalFieldCount(2);
|
|
45
45
|
ctorTmpl->SetClassName(ConvertToV8String(isolate, "GPUBindGroup"));
|
|
46
46
|
|
|
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->GPUBindGroupTmpl =
|
|
51
|
-
std::make_unique
|
|
56
|
+
std::make_unique<v8::Persistent<v8::FunctionTemplate >>(isolate, ctorTmpl);
|
|
52
57
|
return ctorTmpl;
|
|
53
58
|
}
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
void
|
|
62
|
+
GPUBindGroupImpl::GetLabel(v8::Local<v8::Name> name,
|
|
63
|
+
const v8::PropertyCallbackInfo<v8::Value> &info) {
|
|
64
|
+
auto ptr = GetPointer(info.This());
|
|
65
|
+
if (ptr != nullptr) {
|
|
66
|
+
auto label = canvas_native_webgpu_bind_group_get_label(ptr->group_);
|
|
67
|
+
if (label == nullptr) {
|
|
68
|
+
info.GetReturnValue().SetEmptyString();
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
info.GetReturnValue().Set(
|
|
72
|
+
ConvertToV8String(info.GetIsolate(), label)
|
|
73
|
+
);
|
|
74
|
+
canvas_native_string_destroy(label);
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
info.GetReturnValue().SetEmptyString();
|
|
79
|
+
}
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
|
|
12
12
|
class GPUBindGroupImpl : ObjectWrapperImpl {
|
|
13
13
|
public:
|
|
14
|
-
GPUBindGroupImpl(const CanvasGPUBindGroup *group);
|
|
14
|
+
explicit GPUBindGroupImpl(const CanvasGPUBindGroup *group);
|
|
15
15
|
|
|
16
16
|
~GPUBindGroupImpl() {
|
|
17
17
|
canvas_native_webgpu_bind_group_release(this->GetBindGroup());
|
|
@@ -31,12 +31,15 @@ public:
|
|
|
31
31
|
v8::EscapableHandleScope scope(isolate);
|
|
32
32
|
auto object = GPUBindGroupImpl::GetCtor(isolate)->GetFunction(
|
|
33
33
|
context).ToLocalChecked()->NewInstance(context).ToLocalChecked();
|
|
34
|
-
SetNativeType(
|
|
34
|
+
SetNativeType(groupLayout, NativeType::GPUBindGroup);
|
|
35
35
|
object->SetAlignedPointerInInternalField(0, groupLayout);
|
|
36
36
|
groupLayout->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
|
private:
|
|
41
44
|
const CanvasGPUBindGroup *group_;
|
|
42
45
|
};
|
|
@@ -22,7 +22,7 @@ void GPUBindGroupLayoutImpl::Init(v8::Local<v8::Object> canvasModule, v8::Isolat
|
|
|
22
22
|
auto context = isolate->GetCurrentContext();
|
|
23
23
|
auto func = ctor->GetFunction(context).ToLocalChecked();
|
|
24
24
|
|
|
25
|
-
canvasModule->Set(context, ConvertToV8String(isolate, "GPUBindGroupLayout"), func).FromJust()
|
|
25
|
+
canvasModule->Set(context, ConvertToV8String(isolate, "GPUBindGroupLayout"), func).FromJust();
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
GPUBindGroupLayoutImpl *GPUBindGroupLayoutImpl::GetPointer(const v8::Local<v8::Object> &object) {
|
|
@@ -47,7 +47,33 @@ v8::Local<v8::FunctionTemplate> GPUBindGroupLayoutImpl::GetCtor(v8::Isolate *iso
|
|
|
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->GPUBindGroupLayoutTmpl =
|
|
51
56
|
std::make_unique<v8::Persistent<v8::FunctionTemplate>>(isolate, ctorTmpl);
|
|
52
57
|
return ctorTmpl;
|
|
53
58
|
}
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
void
|
|
62
|
+
GPUBindGroupLayoutImpl::GetLabel(v8::Local<v8::Name> name,
|
|
63
|
+
const v8::PropertyCallbackInfo<v8::Value> &info) {
|
|
64
|
+
auto ptr = GetPointer(info.This());
|
|
65
|
+
if (ptr != nullptr) {
|
|
66
|
+
auto label = canvas_native_webgpu_bind_group_layout_get_label(ptr->groupLayout_);
|
|
67
|
+
if (label == nullptr) {
|
|
68
|
+
info.GetReturnValue().SetEmptyString();
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
info.GetReturnValue().Set(
|
|
72
|
+
ConvertToV8String(info.GetIsolate(), label)
|
|
73
|
+
);
|
|
74
|
+
canvas_native_string_destroy(label);
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
info.GetReturnValue().SetEmptyString();
|
|
79
|
+
}
|
|
@@ -31,12 +31,15 @@ public:
|
|
|
31
31
|
v8::EscapableHandleScope scope(isolate);
|
|
32
32
|
auto object = GPUBindGroupLayoutImpl::GetCtor(isolate)->GetFunction(
|
|
33
33
|
context).ToLocalChecked()->NewInstance(context).ToLocalChecked();
|
|
34
|
-
SetNativeType(
|
|
34
|
+
SetNativeType(groupLayout, NativeType::GPUBindGroupLayout);
|
|
35
35
|
object->SetAlignedPointerInInternalField(0, groupLayout);
|
|
36
36
|
groupLayout->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
|
private:
|
|
41
44
|
const CanvasGPUBindGroupLayout *groupLayout_;
|
|
42
45
|
};
|