@nativescript/canvas 2.0.0-webgpu.0 → 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 +3 -18
- package/Canvas/common.js +9 -72
- package/Canvas/common.js.map +1 -1
- package/Canvas/index.android.d.ts +6 -8
- package/Canvas/index.android.js +117 -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 +116 -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 +4 -2
- package/WebGPU/GPUCanvasContext.js +16 -4
- 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 +9 -1
- 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 +69 -71
- 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 +2 -0
- package/WebGPU/GPUTexture.js +6 -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/common.d.ts +0 -3
- package/common.js +1 -5
- package/common.js.map +1 -1
- 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 +2159 -2085
- 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 +2159 -2085
- 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 +583 -450
- 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 +1709 -728
- 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 +51 -54
- package/platforms/ios/src/cpp/webgpu/GPURenderPassEncoderImpl.h +6 -3
- 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 +580 -2
- 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
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
#include "GPUTextureImpl.h"
|
|
14
14
|
|
|
15
15
|
GPUCommandEncoderImpl::GPUCommandEncoderImpl(const CanvasGPUCommandEncoder *encoder) : encoder_(
|
|
16
|
-
|
|
16
|
+
encoder) {}
|
|
17
17
|
|
|
18
18
|
const CanvasGPUCommandEncoder *GPUCommandEncoderImpl::GetEncoder() {
|
|
19
19
|
return this->encoder_;
|
|
@@ -23,12 +23,12 @@ void GPUCommandEncoderImpl::Init(v8::Local<v8::Object> canvasModule, v8::Isolate
|
|
|
23
23
|
v8::Locker locker(isolate);
|
|
24
24
|
v8::Isolate::Scope isolate_scope(isolate);
|
|
25
25
|
v8::HandleScope handle_scope(isolate);
|
|
26
|
-
|
|
26
|
+
|
|
27
27
|
auto ctor = GetCtor(isolate);
|
|
28
28
|
auto context = isolate->GetCurrentContext();
|
|
29
29
|
auto func = ctor->GetFunction(context).ToLocalChecked();
|
|
30
|
-
|
|
31
|
-
canvasModule->Set(context, ConvertToV8String(isolate, "GPUCommandEncoder"), func).FromJust()
|
|
30
|
+
|
|
31
|
+
canvasModule->Set(context, ConvertToV8String(isolate, "GPUCommandEncoder"), func).FromJust();
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
GPUCommandEncoderImpl *GPUCommandEncoderImpl::GetPointer(const v8::Local<v8::Object> &object) {
|
|
@@ -45,165 +45,185 @@ v8::Local<v8::FunctionTemplate> GPUCommandEncoderImpl::GetCtor(v8::Isolate *isol
|
|
|
45
45
|
if (ctor != nullptr) {
|
|
46
46
|
return ctor->Get(isolate);
|
|
47
47
|
}
|
|
48
|
-
|
|
48
|
+
|
|
49
49
|
v8::Local<v8::FunctionTemplate> ctorTmpl = v8::FunctionTemplate::New(isolate);
|
|
50
50
|
ctorTmpl->InstanceTemplate()->SetInternalFieldCount(2);
|
|
51
51
|
ctorTmpl->SetClassName(ConvertToV8String(isolate, "GPUCommandEncoder"));
|
|
52
|
-
|
|
52
|
+
|
|
53
53
|
auto tmpl = ctorTmpl->InstanceTemplate();
|
|
54
54
|
tmpl->SetInternalFieldCount(2);
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
|
|
56
|
+
tmpl->SetLazyDataProperty(
|
|
57
|
+
ConvertToV8String(isolate, "label"),
|
|
58
|
+
GetLabel
|
|
59
|
+
);
|
|
60
|
+
|
|
57
61
|
tmpl->Set(
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
62
|
+
ConvertToV8String(isolate, "beginComputePass"),
|
|
63
|
+
v8::FunctionTemplate::New(isolate, &BeginComputePass));
|
|
64
|
+
|
|
61
65
|
tmpl->Set(
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
66
|
+
ConvertToV8String(isolate, "beginRenderPass"),
|
|
67
|
+
v8::FunctionTemplate::New(isolate, &BeginRenderPass));
|
|
68
|
+
|
|
65
69
|
tmpl->Set(
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
70
|
+
ConvertToV8String(isolate, "clearBuffer"),
|
|
71
|
+
v8::FunctionTemplate::New(isolate, &ClearBuffer));
|
|
72
|
+
|
|
69
73
|
tmpl->Set(
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
74
|
+
ConvertToV8String(isolate, "copyBufferToBuffer"),
|
|
75
|
+
v8::FunctionTemplate::New(isolate, &CopyBufferToBuffer));
|
|
76
|
+
|
|
73
77
|
tmpl->Set(
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
78
|
+
ConvertToV8String(isolate, "copyBufferToTexture"),
|
|
79
|
+
v8::FunctionTemplate::New(isolate, &CopyBufferToTexture));
|
|
80
|
+
|
|
77
81
|
tmpl->Set(
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
82
|
+
ConvertToV8String(isolate, "copyTextureToBuffer"),
|
|
83
|
+
v8::FunctionTemplate::New(isolate, &CopyTextureToBuffer));
|
|
84
|
+
|
|
81
85
|
tmpl->Set(
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
86
|
+
ConvertToV8String(isolate, "copyTextureToTexture"),
|
|
87
|
+
v8::FunctionTemplate::New(isolate, &CopyTextureToTexture));
|
|
88
|
+
|
|
85
89
|
tmpl->Set(
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
90
|
+
ConvertToV8String(isolate, "finish"),
|
|
91
|
+
v8::FunctionTemplate::New(isolate, &Finish));
|
|
92
|
+
|
|
89
93
|
tmpl->Set(
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
94
|
+
ConvertToV8String(isolate, "insertDebugMarker"),
|
|
95
|
+
v8::FunctionTemplate::New(isolate, &InsertDebugMarker));
|
|
96
|
+
|
|
93
97
|
tmpl->Set(
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
98
|
+
ConvertToV8String(isolate, "popDebugGroup"),
|
|
99
|
+
v8::FunctionTemplate::New(isolate, &PopDebugGroup));
|
|
100
|
+
|
|
97
101
|
tmpl->Set(
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
102
|
+
ConvertToV8String(isolate, "pushDebugGroup"),
|
|
103
|
+
v8::FunctionTemplate::New(isolate, &PushDebugGroup));
|
|
104
|
+
|
|
101
105
|
tmpl->Set(
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
106
|
+
ConvertToV8String(isolate, "resolveQuerySet"),
|
|
107
|
+
v8::FunctionTemplate::New(isolate, &ResolveQuerySet));
|
|
108
|
+
|
|
105
109
|
tmpl->Set(
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
+
ConvertToV8String(isolate, "writeTimestamp"),
|
|
111
|
+
v8::FunctionTemplate::New(isolate, &WriteTimestamp));
|
|
112
|
+
|
|
113
|
+
|
|
110
114
|
cache->GPUCommandEncoderTmpl =
|
|
111
|
-
|
|
115
|
+
std::make_unique<v8::Persistent<v8::FunctionTemplate>>(isolate, ctorTmpl);
|
|
112
116
|
return ctorTmpl;
|
|
113
117
|
}
|
|
114
118
|
|
|
119
|
+
void
|
|
120
|
+
GPUCommandEncoderImpl::GetLabel(v8::Local<v8::Name> name,
|
|
121
|
+
const v8::PropertyCallbackInfo<v8::Value> &info) {
|
|
122
|
+
auto ptr = GetPointer(info.This());
|
|
123
|
+
if (ptr != nullptr) {
|
|
124
|
+
auto label = canvas_native_webgpu_command_encoder_get_label(ptr->encoder_);
|
|
125
|
+
if (label == nullptr) {
|
|
126
|
+
info.GetReturnValue().SetEmptyString();
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
info.GetReturnValue().Set(
|
|
130
|
+
ConvertToV8String(info.GetIsolate(), label)
|
|
131
|
+
);
|
|
132
|
+
canvas_native_string_destroy(label);
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
info.GetReturnValue().SetEmptyString();
|
|
137
|
+
}
|
|
138
|
+
|
|
115
139
|
|
|
116
140
|
void GPUCommandEncoderImpl::BeginComputePass(const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
117
141
|
auto ptr = GetPointer(args.This());
|
|
118
142
|
if (ptr == nullptr) {
|
|
119
143
|
return;
|
|
120
144
|
}
|
|
121
|
-
|
|
145
|
+
|
|
122
146
|
auto isolate = args.GetIsolate();
|
|
123
147
|
auto context = isolate->GetCurrentContext();
|
|
124
|
-
|
|
148
|
+
|
|
125
149
|
auto descVal = args[0];
|
|
126
|
-
|
|
150
|
+
|
|
127
151
|
const CanvasGPUComputePassEncoder *pass;
|
|
128
|
-
|
|
152
|
+
|
|
129
153
|
if (!descVal->IsNullOrUndefined() && descVal->IsObject()) {
|
|
130
154
|
auto desc = descVal.As<v8::Object>();
|
|
131
|
-
|
|
132
|
-
|
|
155
|
+
|
|
156
|
+
|
|
133
157
|
v8::Local<v8::Value> labelVal;
|
|
134
158
|
desc->Get(context, ConvertToV8String(isolate, "label")).ToLocal(&labelVal);
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
if (!labelVal.IsEmpty() && labelVal->IsString()) {
|
|
139
|
-
label = *v8::String::Utf8Value(isolate, labelVal);
|
|
140
|
-
}
|
|
141
|
-
|
|
159
|
+
|
|
160
|
+
std::string label = ConvertFromV8String(isolate, labelVal);
|
|
161
|
+
|
|
142
162
|
const CanvasGPUQuerySet *querySet = nullptr;
|
|
163
|
+
|
|
143
164
|
int32_t beginningOfPassWriteIndex = -1;
|
|
144
|
-
|
|
165
|
+
|
|
145
166
|
int32_t endOfPassWriteIndex = -1;
|
|
146
|
-
|
|
147
|
-
|
|
167
|
+
|
|
168
|
+
|
|
148
169
|
v8::Local<v8::Value> timestampWritesVal;
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
if (!timestampWritesVal.IsEmpty() && timestampWritesVal->IsObject()) {
|
|
170
|
+
|
|
171
|
+
auto success = desc->Get(context, ConvertToV8String(isolate, "timestampWrites")).ToLocal(
|
|
172
|
+
×tampWritesVal);
|
|
173
|
+
if (success && timestampWritesVal->IsObject()) {
|
|
154
174
|
auto timestampWrites = timestampWritesVal.As<v8::Object>();
|
|
155
|
-
|
|
175
|
+
|
|
156
176
|
v8::Local<v8::Value> querySetVal;
|
|
157
|
-
timestampWrites->Get(context, ConvertToV8String(isolate, "querySet")).ToLocal(
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
if (
|
|
177
|
+
success = timestampWrites->Get(context, ConvertToV8String(isolate, "querySet")).ToLocal(
|
|
178
|
+
&querySetVal);
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
if (success && querySetVal->IsObject()) {
|
|
162
182
|
auto queryPtr = GPUQuerySetImpl::GetPointer(querySetVal.As<v8::Object>());
|
|
163
183
|
if (queryPtr != nullptr) {
|
|
164
184
|
querySet = queryPtr->GetQuerySet();
|
|
165
185
|
}
|
|
166
186
|
}
|
|
167
|
-
|
|
187
|
+
|
|
168
188
|
v8::Local<v8::Value> beginningOfPassWriteIndexVal;
|
|
169
|
-
|
|
170
|
-
|
|
189
|
+
|
|
190
|
+
|
|
171
191
|
v8::Local<v8::Value> endOfPassWriteIndexVal;
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
timestampWrites->Get(context,
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
success = timestampWrites->Get(context,
|
|
175
195
|
ConvertToV8String(isolate, "beginningOfPassWriteIndex")).ToLocal(
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
ConvertToV8String(isolate, "endOfPassWriteIndex")).ToLocal(
|
|
180
|
-
&endOfPassWriteIndexVal);
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
if (beginningOfPassWriteIndexVal->IsInt32()) {
|
|
196
|
+
&beginningOfPassWriteIndexVal);
|
|
197
|
+
|
|
198
|
+
if (success && beginningOfPassWriteIndexVal->IsInt32()) {
|
|
184
199
|
beginningOfPassWriteIndex = beginningOfPassWriteIndexVal.As<v8::Int32>()->Value();
|
|
185
200
|
}
|
|
186
|
-
|
|
187
|
-
|
|
201
|
+
|
|
202
|
+
success = timestampWrites->Get(context,
|
|
203
|
+
ConvertToV8String(isolate, "endOfPassWriteIndex")).ToLocal(
|
|
204
|
+
&endOfPassWriteIndexVal);
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
if (success && endOfPassWriteIndexVal->IsInt32()) {
|
|
188
208
|
endOfPassWriteIndex = endOfPassWriteIndexVal.As<v8::Int32>()->Value();
|
|
189
209
|
}
|
|
190
210
|
}
|
|
191
|
-
|
|
192
|
-
|
|
211
|
+
|
|
212
|
+
|
|
193
213
|
pass = canvas_native_webgpu_command_encoder_begin_compute_pass(ptr->GetEncoder(),
|
|
194
|
-
querySet, label,
|
|
214
|
+
querySet, label.c_str(),
|
|
195
215
|
beginningOfPassWriteIndex,
|
|
196
216
|
endOfPassWriteIndex);
|
|
197
|
-
|
|
198
|
-
|
|
217
|
+
|
|
218
|
+
|
|
199
219
|
} else {
|
|
200
220
|
pass = canvas_native_webgpu_command_encoder_begin_compute_pass(ptr->GetEncoder(),
|
|
201
221
|
nullptr, nullptr, -1,
|
|
202
222
|
-1);
|
|
203
|
-
|
|
223
|
+
|
|
204
224
|
}
|
|
205
|
-
|
|
206
|
-
|
|
225
|
+
|
|
226
|
+
|
|
207
227
|
if (pass != nullptr) {
|
|
208
228
|
auto value = new GPUComputePassEncoderImpl(pass);
|
|
209
229
|
auto ret = GPUComputePassEncoderImpl::NewInstance(isolate, value);
|
|
@@ -211,7 +231,7 @@ void GPUCommandEncoderImpl::BeginComputePass(const v8::FunctionCallbackInfo<v8::
|
|
|
211
231
|
} else {
|
|
212
232
|
args.GetReturnValue().SetUndefined();
|
|
213
233
|
}
|
|
214
|
-
|
|
234
|
+
|
|
215
235
|
}
|
|
216
236
|
|
|
217
237
|
void GPUCommandEncoderImpl::BeginRenderPass(const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
@@ -219,242 +239,357 @@ void GPUCommandEncoderImpl::BeginRenderPass(const v8::FunctionCallbackInfo<v8::V
|
|
|
219
239
|
if (ptr == nullptr) {
|
|
220
240
|
return;
|
|
221
241
|
}
|
|
222
|
-
|
|
242
|
+
|
|
223
243
|
auto isolate = args.GetIsolate();
|
|
224
244
|
auto context = isolate->GetCurrentContext();
|
|
225
|
-
|
|
245
|
+
|
|
226
246
|
auto descVal = args[0];
|
|
227
|
-
|
|
247
|
+
|
|
228
248
|
const CanvasGPURenderPassEncoder *pass = nullptr;
|
|
229
|
-
|
|
249
|
+
|
|
230
250
|
std::vector<CanvasRenderPassColorAttachment> colorAttachments_;
|
|
231
|
-
|
|
251
|
+
|
|
232
252
|
if (!descVal->IsNullOrUndefined() && descVal->IsObject()) {
|
|
233
253
|
auto desc = descVal.As<v8::Object>();
|
|
234
|
-
|
|
235
|
-
|
|
254
|
+
|
|
236
255
|
v8::Local<v8::Value> labelVal;
|
|
237
256
|
desc->Get(context, ConvertToV8String(isolate, "label")).ToLocal(&labelVal);
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
label = *v8::String::Utf8Value(isolate, labelVal);
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
|
|
257
|
+
|
|
258
|
+
std::string label = ConvertFromV8String(isolate, labelVal);
|
|
259
|
+
|
|
260
|
+
|
|
246
261
|
v8::Local<v8::Value> colorAttachmentsVal;
|
|
247
262
|
desc->Get(context, ConvertToV8String(isolate, "colorAttachments")).ToLocal(
|
|
248
|
-
|
|
249
|
-
|
|
263
|
+
&colorAttachmentsVal);
|
|
264
|
+
|
|
250
265
|
auto colorAttachments = colorAttachmentsVal.As<v8::Array>();
|
|
251
266
|
auto colorAttachmentsLength = colorAttachments->Length();
|
|
252
|
-
|
|
267
|
+
|
|
253
268
|
for (int i = 0; i < colorAttachmentsLength; i++) {
|
|
254
269
|
auto colorAttachment = colorAttachments->Get(context,
|
|
255
270
|
i).ToLocalChecked().As<v8::Object>();
|
|
256
|
-
|
|
271
|
+
|
|
257
272
|
v8::Local<v8::Value> clearValueVal;
|
|
258
273
|
colorAttachment->Get(context, ConvertToV8String(isolate, "clearValue")).ToLocal(
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
if (!r.IsEmpty() && r->IsNumber()) {
|
|
275
|
-
clearValue.r = r.As<v8::Number>()->Value();
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
if (!g.IsEmpty() && g->IsNumber()) {
|
|
279
|
-
clearValue.g = g.As<v8::Number>()->Value();
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
if (!b.IsEmpty() && b->IsNumber()) {
|
|
284
|
-
clearValue.b = b.As<v8::Number>()->Value();
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
if (!a.IsEmpty() && a->IsNumber()) {
|
|
288
|
-
clearValue.a = a.As<v8::Number>()->Value();
|
|
274
|
+
&clearValueVal);
|
|
275
|
+
|
|
276
|
+
auto clearValue = ParseColor(isolate, clearValueVal);
|
|
277
|
+
|
|
278
|
+
const CanvasGPUTextureView *view = nullptr;
|
|
279
|
+
|
|
280
|
+
v8::Local<v8::Value> viewVal;
|
|
281
|
+
|
|
282
|
+
|
|
283
|
+
if (colorAttachment->Get(context, ConvertToV8String(isolate,
|
|
284
|
+
"view")).ToLocal(&viewVal)) {
|
|
285
|
+
auto type = GetNativeType(viewVal);
|
|
286
|
+
if (type == NativeType::GPUTextureView) {
|
|
287
|
+
auto viewPtr = GPUTextureViewImpl::GetPointer(viewVal.As<v8::Object>());
|
|
288
|
+
view = viewPtr->GetTextureView();
|
|
289
289
|
}
|
|
290
290
|
}
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
const CanvasGPUTextureView *resolve_target = nullptr;
|
|
300
|
-
|
|
301
|
-
v8::Local<v8::Value> resolve_target_val;
|
|
302
|
-
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+
const CanvasGPUTextureView *resolveTarget = nullptr;
|
|
294
|
+
|
|
295
|
+
v8::Local<v8::Value> resolveTargetVal;
|
|
296
|
+
|
|
303
297
|
colorAttachment->Get(context, ConvertToV8String(isolate, "resolveTarget")).ToLocal(
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
auto resolve_target_type = GetNativeType(
|
|
307
|
-
|
|
298
|
+
&resolveTargetVal);
|
|
299
|
+
|
|
300
|
+
auto resolve_target_type = GetNativeType(resolveTargetVal);
|
|
301
|
+
|
|
308
302
|
if (resolve_target_type == NativeType::GPUTextureView) {
|
|
309
|
-
auto res = GPUTextureViewImpl::GetPointer(
|
|
310
|
-
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
// default
|
|
314
|
-
CanvasLoadOp load = CanvasLoadOp::CanvasLoadOpClear;
|
|
315
|
-
CanvasStoreOp store = CanvasStoreOp::CanvasStoreOpStore;
|
|
316
|
-
auto loadVal = colorAttachment->Get(context, ConvertToV8String(isolate,
|
|
317
|
-
"loadOp")).ToLocalChecked();
|
|
318
|
-
|
|
319
|
-
if (loadVal->IsUint32()) {
|
|
320
|
-
load = (CanvasLoadOp) loadVal->Uint32Value(
|
|
321
|
-
context).ToChecked();
|
|
322
|
-
} else if (loadVal->IsString()) {
|
|
323
|
-
auto val = ConvertFromV8String(isolate, loadVal);
|
|
324
|
-
if (val == "clear") {
|
|
325
|
-
load = CanvasLoadOp::CanvasLoadOpClear;
|
|
326
|
-
} else if (val == "load") {
|
|
327
|
-
load = CanvasLoadOp::CanvasLoadOpLoad;
|
|
328
|
-
}
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
auto storeVal = colorAttachment->Get(context, ConvertToV8String(isolate,
|
|
333
|
-
"storeOp")).ToLocalChecked();
|
|
334
|
-
|
|
335
|
-
if (!storeVal.IsEmpty() && storeVal->IsUint32()) {
|
|
336
|
-
store = (CanvasStoreOp) storeVal->Uint32Value(
|
|
337
|
-
context).ToChecked();
|
|
338
|
-
} else if (storeVal->IsString()) {
|
|
339
|
-
auto val = ConvertFromV8String(isolate, storeVal);
|
|
340
|
-
if (val == "discard") {
|
|
341
|
-
store = CanvasStoreOp::CanvasStoreOpDiscard;
|
|
342
|
-
} else if (val == "store") {
|
|
343
|
-
store = CanvasStoreOp::CanvasStoreOpStore;
|
|
344
|
-
}
|
|
303
|
+
auto res = GPUTextureViewImpl::GetPointer(resolveTargetVal.As<v8::Object>());
|
|
304
|
+
resolveTarget = res->GetTextureView();
|
|
345
305
|
}
|
|
346
|
-
|
|
306
|
+
|
|
307
|
+
v8::Local<v8::Value> loadVal;
|
|
308
|
+
v8::Local<v8::Value> storeVal;
|
|
309
|
+
colorAttachment->Get(context, ConvertToV8String(isolate,
|
|
310
|
+
"loadOp")).ToLocal(&loadVal);
|
|
311
|
+
|
|
312
|
+
colorAttachment->Get(context, ConvertToV8String(isolate,
|
|
313
|
+
"storeOp")).ToLocal(&storeVal);
|
|
314
|
+
|
|
315
|
+
|
|
316
|
+
CanvasLoadOp load = ParseCanvasLoadOp(isolate, loadVal);
|
|
317
|
+
CanvasStoreOp store = ParseCanvasStoreOp(isolate, storeVal);
|
|
318
|
+
|
|
319
|
+
|
|
320
|
+
|
|
347
321
|
CanvasPassChannelColor channel{
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
322
|
+
load,
|
|
323
|
+
store,
|
|
324
|
+
clearValue,
|
|
325
|
+
false
|
|
352
326
|
};
|
|
353
|
-
|
|
327
|
+
|
|
354
328
|
auto attachment = CanvasRenderPassColorAttachment{
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
329
|
+
view,
|
|
330
|
+
resolveTarget,
|
|
331
|
+
channel
|
|
358
332
|
};
|
|
359
|
-
|
|
333
|
+
|
|
360
334
|
colorAttachments_.push_back(attachment);
|
|
361
|
-
|
|
335
|
+
|
|
362
336
|
}
|
|
363
|
-
|
|
364
|
-
|
|
337
|
+
|
|
338
|
+
|
|
339
|
+
// todo add when supported
|
|
365
340
|
v8::Local<v8::Value> maxDrawCountVal;
|
|
366
|
-
|
|
367
341
|
desc->Get(context, ConvertToV8String(isolate, "maxDrawCount")).ToLocal(&maxDrawCountVal);
|
|
368
|
-
|
|
369
|
-
|
|
342
|
+
|
|
343
|
+
|
|
370
344
|
CanvasRenderPassDepthStencilAttachment *depthStencilAttachment = nullptr;
|
|
371
345
|
v8::Local<v8::Value> depthStencilAttachmentVal;
|
|
372
|
-
|
|
346
|
+
|
|
373
347
|
desc->Get(context, ConvertToV8String(isolate, "depthStencilAttachment")).ToLocal(
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
348
|
+
&depthStencilAttachmentVal);
|
|
349
|
+
|
|
350
|
+
|
|
377
351
|
if (!depthStencilAttachmentVal.IsEmpty() && depthStencilAttachmentVal->IsObject()) {
|
|
378
352
|
auto depthStencilAttachmentObj = depthStencilAttachmentVal.As<v8::Object>();
|
|
353
|
+
depthStencilAttachment = new CanvasRenderPassDepthStencilAttachment{};
|
|
354
|
+
|
|
355
|
+
|
|
356
|
+
v8::Local<v8::Value> viewVal;
|
|
357
|
+
depthStencilAttachmentObj->Get(context, ConvertToV8String(isolate,
|
|
358
|
+
"view")).ToLocal(&viewVal);
|
|
359
|
+
|
|
360
|
+
auto viewPtr = GPUTextureViewImpl::GetPointer(viewVal.As<v8::Object>());
|
|
361
|
+
depthStencilAttachment->view = viewPtr->GetTextureView();
|
|
362
|
+
|
|
363
|
+
|
|
364
|
+
v8::Local<v8::Value> depthClearValue;
|
|
365
|
+
depthStencilAttachmentObj->Get(context, ConvertToV8String(isolate,
|
|
366
|
+
"depthClearValue")).ToLocal(
|
|
367
|
+
&depthClearValue);
|
|
368
|
+
|
|
369
|
+
depthStencilAttachment->depth_clear_value = 0;
|
|
370
|
+
|
|
371
|
+
if (!depthClearValue.IsEmpty() && depthClearValue->IsNumber()) {
|
|
372
|
+
depthStencilAttachment->depth_clear_value = (float) depthClearValue->NumberValue(
|
|
373
|
+
context).FromJust();
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
v8::Local<v8::Value> depthLoadOp;
|
|
377
|
+
depthStencilAttachmentObj->Get(context, ConvertToV8String(isolate,
|
|
378
|
+
"depthLoadOp")).ToLocal(
|
|
379
|
+
&depthLoadOp);
|
|
380
|
+
|
|
381
|
+
depthStencilAttachment->depth_load_op = CanvasOptionalLoadOp{
|
|
382
|
+
CanvasOptionalLoadOpNone
|
|
383
|
+
};
|
|
384
|
+
|
|
385
|
+
if (!depthLoadOp.IsEmpty() && depthLoadOp->IsString()) {
|
|
386
|
+
auto value = ConvertFromV8String(isolate, depthLoadOp);
|
|
387
|
+
if (value == "load") {
|
|
388
|
+
depthStencilAttachment->depth_load_op = CanvasOptionalLoadOp{
|
|
389
|
+
CanvasOptionalLoadOpSome,
|
|
390
|
+
CanvasLoadOpLoad
|
|
391
|
+
};
|
|
392
|
+
} else if (value == "clear") {
|
|
393
|
+
depthStencilAttachment->depth_load_op = CanvasOptionalLoadOp{
|
|
394
|
+
CanvasOptionalLoadOpSome,
|
|
395
|
+
CanvasLoadOpClear
|
|
396
|
+
};
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
|
|
401
|
+
v8::Local<v8::Value> depthStoreOp;
|
|
402
|
+
depthStencilAttachmentObj->Get(context, ConvertToV8String(isolate,
|
|
403
|
+
"depthStoreOp")).ToLocal(
|
|
404
|
+
&depthStoreOp);
|
|
405
|
+
|
|
406
|
+
depthStencilAttachment->depth_store_op = CanvasOptionalStoreOp{
|
|
407
|
+
CanvasOptionalStoreOpNone
|
|
408
|
+
};
|
|
409
|
+
|
|
410
|
+
if (!depthStoreOp.IsEmpty() && depthStoreOp->IsString()) {
|
|
411
|
+
auto value = ConvertFromV8String(isolate, depthStoreOp);
|
|
412
|
+
if (value == "store") {
|
|
413
|
+
depthStencilAttachment->depth_store_op = depthStencilAttachment->depth_store_op = CanvasOptionalStoreOp{
|
|
414
|
+
CanvasOptionalStoreOpSome,
|
|
415
|
+
CanvasStoreOpStore
|
|
416
|
+
};
|
|
417
|
+
} else if (value == "discard") {
|
|
418
|
+
depthStencilAttachment->depth_store_op = depthStencilAttachment->depth_store_op = CanvasOptionalStoreOp{
|
|
419
|
+
CanvasOptionalStoreOpSome,
|
|
420
|
+
CanvasStoreOpDiscard
|
|
421
|
+
};
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
|
|
426
|
+
v8::Local<v8::Value> depthReadOnly;
|
|
427
|
+
depthStencilAttachmentObj->Get(context, ConvertToV8String(isolate,
|
|
428
|
+
"depthReadOnly")).ToLocal(
|
|
429
|
+
&depthReadOnly);
|
|
430
|
+
|
|
431
|
+
depthStencilAttachment->depth_read_only = false;
|
|
432
|
+
if (!depthReadOnly.IsEmpty() && depthReadOnly->IsBoolean()) {
|
|
433
|
+
depthStencilAttachment->depth_read_only = depthReadOnly->BooleanValue(isolate);
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
|
|
437
|
+
v8::Local<v8::Value> stencilClearValue;
|
|
438
|
+
depthStencilAttachmentObj->Get(context, ConvertToV8String(isolate,
|
|
439
|
+
"stencilClearValue")).ToLocal(
|
|
440
|
+
&stencilClearValue);
|
|
441
|
+
|
|
442
|
+
depthStencilAttachment->stencil_clear_value = 0;
|
|
443
|
+
|
|
444
|
+
if (!stencilClearValue.IsEmpty() && stencilClearValue->IsUint32()) {
|
|
445
|
+
depthStencilAttachment->stencil_clear_value = stencilClearValue->Uint32Value(
|
|
446
|
+
context).FromJust();
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
|
|
450
|
+
v8::Local<v8::Value> stencilLoadOp;
|
|
451
|
+
depthStencilAttachmentObj->Get(context, ConvertToV8String(isolate,
|
|
452
|
+
"stencilLoadOp")).ToLocal(
|
|
453
|
+
&stencilLoadOp);
|
|
454
|
+
|
|
455
|
+
depthStencilAttachment->stencil_load_op = CanvasOptionalLoadOp{
|
|
456
|
+
CanvasOptionalLoadOpNone
|
|
457
|
+
};
|
|
458
|
+
|
|
459
|
+
if (!stencilLoadOp.IsEmpty() && stencilLoadOp->IsString()) {
|
|
460
|
+
auto value = ConvertFromV8String(isolate, stencilLoadOp);
|
|
461
|
+
if (value == "load") {
|
|
462
|
+
depthStencilAttachment->stencil_load_op = CanvasOptionalLoadOp{
|
|
463
|
+
CanvasOptionalLoadOpSome,
|
|
464
|
+
CanvasLoadOpLoad
|
|
465
|
+
};
|
|
466
|
+
} else if (value == "clear") {
|
|
467
|
+
depthStencilAttachment->stencil_load_op = CanvasOptionalLoadOp{
|
|
468
|
+
CanvasOptionalLoadOpSome,
|
|
469
|
+
CanvasLoadOpClear
|
|
470
|
+
};
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
|
|
475
|
+
v8::Local<v8::Value> stencilStoreOp;
|
|
476
|
+
depthStencilAttachmentObj->Get(context, ConvertToV8String(isolate,
|
|
477
|
+
"stencilStoreOp")).ToLocal(
|
|
478
|
+
&stencilStoreOp);
|
|
479
|
+
|
|
480
|
+
depthStencilAttachment->stencil_store_op = CanvasOptionalStoreOp{
|
|
481
|
+
CanvasOptionalStoreOpNone
|
|
482
|
+
};
|
|
483
|
+
|
|
484
|
+
if (!stencilStoreOp.IsEmpty() && stencilStoreOp->IsString()) {
|
|
485
|
+
auto value = ConvertFromV8String(isolate, stencilStoreOp);
|
|
486
|
+
if (value == "store") {
|
|
487
|
+
depthStencilAttachment->stencil_store_op = CanvasOptionalStoreOp{
|
|
488
|
+
CanvasOptionalStoreOpSome,
|
|
489
|
+
CanvasStoreOpStore
|
|
490
|
+
};
|
|
491
|
+
} else if (value == "discard") {
|
|
492
|
+
depthStencilAttachment->stencil_store_op = CanvasOptionalStoreOp{
|
|
493
|
+
CanvasOptionalStoreOpSome,
|
|
494
|
+
CanvasStoreOpDiscard
|
|
495
|
+
};
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
|
|
500
|
+
v8::Local<v8::Value> stencilReadOnly;
|
|
501
|
+
depthStencilAttachmentObj->Get(context, ConvertToV8String(isolate,
|
|
502
|
+
"stencilReadOnly")).ToLocal(
|
|
503
|
+
&stencilReadOnly);
|
|
504
|
+
|
|
505
|
+
depthStencilAttachment->stencil_read_only = false;
|
|
506
|
+
if (!stencilReadOnly.IsEmpty() && stencilReadOnly->IsBoolean()) {
|
|
507
|
+
depthStencilAttachment->stencil_read_only = stencilReadOnly->BooleanValue(isolate);
|
|
508
|
+
}
|
|
509
|
+
|
|
379
510
|
}
|
|
380
|
-
|
|
381
|
-
|
|
511
|
+
|
|
382
512
|
const CanvasGPUQuerySet *occlusion_query_set = nullptr;
|
|
383
513
|
v8::Local<v8::Value> occlusionQuerySetVal;
|
|
384
|
-
|
|
385
|
-
|
|
514
|
+
|
|
515
|
+
|
|
386
516
|
desc->Get(context, ConvertToV8String(isolate, "occlusionQuerySet")).ToLocal(
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
if (
|
|
517
|
+
&occlusionQuerySetVal);
|
|
518
|
+
|
|
519
|
+
|
|
520
|
+
if (GetNativeType(occlusionQuerySetVal) == NativeType::GPUQuerySet) {
|
|
391
521
|
auto occlusionQuerySet = GPUQuerySetImpl::GetPointer(
|
|
392
|
-
|
|
522
|
+
occlusionQuerySetVal.As<v8::Object>());
|
|
393
523
|
occlusion_query_set = occlusionQuerySet->GetQuerySet();
|
|
394
524
|
}
|
|
395
|
-
|
|
396
|
-
|
|
525
|
+
|
|
526
|
+
|
|
397
527
|
v8::Local<v8::Value> timestampWritesVal;
|
|
398
528
|
desc->Get(context, ConvertToV8String(isolate, "timestampWrites")).ToLocal(
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
529
|
+
×tampWritesVal);
|
|
530
|
+
|
|
531
|
+
|
|
402
532
|
const CanvasGPUQuerySet *querySet = nullptr;
|
|
403
533
|
int32_t beginningOfPassWriteIndex = -1;
|
|
404
534
|
int32_t endOfPassWriteIndex = -1;
|
|
405
|
-
|
|
535
|
+
|
|
406
536
|
if (!timestampWritesVal.IsEmpty() && timestampWritesVal->IsObject()) {
|
|
407
537
|
auto timestampWrites = timestampWritesVal.As<v8::Object>();
|
|
408
538
|
v8::Local<v8::Value> querySetVal;
|
|
409
539
|
timestampWrites->Get(context, ConvertToV8String(isolate, "querySet")).ToLocal(
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
if (
|
|
540
|
+
&querySetVal);
|
|
541
|
+
|
|
542
|
+
|
|
543
|
+
if (GetNativeType(querySetVal) == NativeType::GPUQuerySet) {
|
|
414
544
|
auto queryPtr = GPUQuerySetImpl::GetPointer(querySetVal.As<v8::Object>());
|
|
415
545
|
if (queryPtr != nullptr) {
|
|
416
546
|
querySet = queryPtr->GetQuerySet();
|
|
417
547
|
}
|
|
418
548
|
}
|
|
419
|
-
|
|
549
|
+
|
|
420
550
|
v8::Local<v8::Value> beginningOfPassWriteIndexVal;
|
|
421
|
-
|
|
551
|
+
|
|
422
552
|
v8::Local<v8::Value> endOfPassWriteIndexVal;
|
|
423
|
-
|
|
424
|
-
|
|
553
|
+
|
|
554
|
+
|
|
425
555
|
auto beginningOfPassWriteIndexValSuccess = timestampWrites->Get(context,
|
|
426
556
|
ConvertToV8String(
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
557
|
+
isolate,
|
|
558
|
+
"beginningOfPassWriteIndex")).ToLocal(
|
|
559
|
+
&beginningOfPassWriteIndexVal);
|
|
560
|
+
|
|
431
561
|
auto endOfPassWriteIndexValSuccess = timestampWrites->Get(context,
|
|
432
562
|
ConvertToV8String(isolate,
|
|
433
563
|
"endOfPassWriteIndex")).ToLocal(
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
564
|
+
&endOfPassWriteIndexVal);
|
|
565
|
+
|
|
566
|
+
|
|
437
567
|
if (beginningOfPassWriteIndexValSuccess && beginningOfPassWriteIndexVal->IsInt32()) {
|
|
438
568
|
beginningOfPassWriteIndex = beginningOfPassWriteIndexVal.As<v8::Int32>()->Value();
|
|
439
569
|
}
|
|
440
|
-
|
|
570
|
+
|
|
441
571
|
if (endOfPassWriteIndexValSuccess && endOfPassWriteIndexVal->IsInt32()) {
|
|
442
572
|
endOfPassWriteIndex = endOfPassWriteIndexVal.As<v8::Int32>()->Value();
|
|
443
573
|
}
|
|
444
|
-
|
|
574
|
+
|
|
445
575
|
}
|
|
446
|
-
|
|
447
|
-
|
|
576
|
+
|
|
577
|
+
|
|
448
578
|
pass = canvas_native_webgpu_command_encoder_begin_render_pass(
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
579
|
+
ptr->GetEncoder(), label.c_str(), colorAttachments_.data(), colorAttachments_.size(),
|
|
580
|
+
depthStencilAttachment, occlusion_query_set,
|
|
581
|
+
querySet, beginningOfPassWriteIndex, endOfPassWriteIndex
|
|
582
|
+
);
|
|
583
|
+
|
|
584
|
+
if (depthStencilAttachment != nullptr) {
|
|
585
|
+
delete depthStencilAttachment;
|
|
586
|
+
depthStencilAttachment = nullptr;
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
|
|
455
590
|
}
|
|
456
|
-
|
|
457
|
-
|
|
591
|
+
|
|
592
|
+
|
|
458
593
|
if (pass != nullptr) {
|
|
459
594
|
auto value = new GPURenderPassEncoderImpl(pass);
|
|
460
595
|
auto ret = GPURenderPassEncoderImpl::NewInstance(isolate, value);
|
|
@@ -462,7 +597,7 @@ void GPUCommandEncoderImpl::BeginRenderPass(const v8::FunctionCallbackInfo<v8::V
|
|
|
462
597
|
} else {
|
|
463
598
|
args.GetReturnValue().SetUndefined();
|
|
464
599
|
}
|
|
465
|
-
|
|
600
|
+
|
|
466
601
|
}
|
|
467
602
|
|
|
468
603
|
void GPUCommandEncoderImpl::ClearBuffer(const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
@@ -470,37 +605,37 @@ void GPUCommandEncoderImpl::ClearBuffer(const v8::FunctionCallbackInfo<v8::Value
|
|
|
470
605
|
if (ptr == nullptr) {
|
|
471
606
|
return;
|
|
472
607
|
}
|
|
473
|
-
|
|
608
|
+
|
|
474
609
|
auto bufferVal = args[0];
|
|
475
610
|
const CanvasGPUBuffer *buffer = nullptr;
|
|
476
|
-
|
|
611
|
+
|
|
477
612
|
if (bufferVal->IsObject()) {
|
|
478
613
|
auto bufferPtr = GPUBufferImpl::GetPointer(bufferVal.As<v8::Object>());
|
|
479
614
|
if (bufferPtr != nullptr) {
|
|
480
615
|
buffer = bufferPtr->GetGPUBuffer();
|
|
481
616
|
}
|
|
482
617
|
}
|
|
483
|
-
|
|
618
|
+
|
|
484
619
|
if (buffer == nullptr) {
|
|
485
620
|
return;
|
|
486
621
|
}
|
|
487
|
-
|
|
622
|
+
|
|
488
623
|
int64_t offset = -1;
|
|
489
624
|
auto offsetVal = args[1];
|
|
490
|
-
|
|
625
|
+
|
|
491
626
|
if (offsetVal->IsNumber()) {
|
|
492
627
|
offset = (int64_t) offsetVal.As<v8::Number>()->Value();
|
|
493
628
|
}
|
|
494
|
-
|
|
629
|
+
|
|
495
630
|
int64_t size = -1;
|
|
496
631
|
auto sizeVal = args[2];
|
|
497
|
-
|
|
632
|
+
|
|
498
633
|
if (sizeVal->IsNumber()) {
|
|
499
634
|
size = (int64_t) sizeVal.As<v8::Number>()->Value();
|
|
500
635
|
}
|
|
501
|
-
|
|
636
|
+
|
|
502
637
|
canvas_native_webgpu_command_encoder_clear_buffer(ptr->GetEncoder(), buffer, offset, size);
|
|
503
|
-
|
|
638
|
+
|
|
504
639
|
}
|
|
505
640
|
|
|
506
641
|
void GPUCommandEncoderImpl::CopyBufferToBuffer(const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
@@ -510,7 +645,7 @@ void GPUCommandEncoderImpl::CopyBufferToBuffer(const v8::FunctionCallbackInfo<v8
|
|
|
510
645
|
}
|
|
511
646
|
auto isolate = args.GetIsolate();
|
|
512
647
|
auto context = isolate->GetCurrentContext();
|
|
513
|
-
|
|
648
|
+
|
|
514
649
|
auto source = args[0];
|
|
515
650
|
auto sourceType = GetNativeType(source);
|
|
516
651
|
auto sourceOffset = args[1];
|
|
@@ -518,22 +653,22 @@ void GPUCommandEncoderImpl::CopyBufferToBuffer(const v8::FunctionCallbackInfo<v8
|
|
|
518
653
|
auto destinationType = GetNativeType(destination);
|
|
519
654
|
auto destinationOffset = args[3];
|
|
520
655
|
auto size = args[4];
|
|
521
|
-
|
|
656
|
+
|
|
522
657
|
if (sourceType == NativeType::GPUBuffer && destinationType == NativeType::GPUBuffer) {
|
|
523
658
|
auto src = GPUBufferImpl::GetPointer(source.As<v8::Object>());
|
|
524
659
|
auto dst = GPUBufferImpl::GetPointer(destination.As<v8::Object>());
|
|
525
660
|
canvas_native_webgpu_command_encoder_copy_buffer_to_buffer(ptr->GetEncoder(),
|
|
526
661
|
src->GetGPUBuffer(),
|
|
527
662
|
(int64_t) sourceOffset->NumberValue(
|
|
528
|
-
|
|
663
|
+
context).FromJust(),
|
|
529
664
|
dst->GetGPUBuffer(),
|
|
530
665
|
(int64_t) destinationOffset->NumberValue(
|
|
531
|
-
|
|
666
|
+
context).FromJust(),
|
|
532
667
|
(uint64_t) size->NumberValue(
|
|
533
|
-
|
|
534
|
-
|
|
668
|
+
context).FromJust()
|
|
669
|
+
);
|
|
535
670
|
}
|
|
536
|
-
|
|
671
|
+
|
|
537
672
|
}
|
|
538
673
|
|
|
539
674
|
void GPUCommandEncoderImpl::CopyBufferToTexture(const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
@@ -541,15 +676,15 @@ void GPUCommandEncoderImpl::CopyBufferToTexture(const v8::FunctionCallbackInfo<v
|
|
|
541
676
|
if (ptr == nullptr) {
|
|
542
677
|
return;
|
|
543
678
|
}
|
|
544
|
-
|
|
545
|
-
|
|
679
|
+
|
|
680
|
+
|
|
546
681
|
auto isolate = args.GetIsolate();
|
|
547
682
|
auto context = isolate->GetCurrentContext();
|
|
548
|
-
|
|
683
|
+
|
|
549
684
|
auto source = args[0];
|
|
550
685
|
auto destination = args[1];
|
|
551
686
|
auto copySize = args[2];
|
|
552
|
-
|
|
687
|
+
|
|
553
688
|
if (source->IsObject() && destination->IsObject() && copySize->IsObject()) {
|
|
554
689
|
const CanvasGPUBuffer *buffer = nullptr;
|
|
555
690
|
auto src = source.As<v8::Object>();
|
|
@@ -560,73 +695,73 @@ void GPUCommandEncoderImpl::CopyBufferToTexture(const v8::FunctionCallbackInfo<v
|
|
|
560
695
|
}
|
|
561
696
|
uint64_t offset = 0;
|
|
562
697
|
int32_t rowsPerImage = -1;
|
|
563
|
-
|
|
698
|
+
|
|
564
699
|
v8::Local<v8::Value> rowsPerImageVal;
|
|
565
|
-
|
|
700
|
+
|
|
566
701
|
src->Get(context, ConvertToV8String(isolate, "rowsPerImage")).ToLocal(&rowsPerImageVal);
|
|
567
|
-
|
|
702
|
+
|
|
568
703
|
if (!rowsPerImageVal.IsEmpty() && rowsPerImageVal->IsInt32()) {
|
|
569
704
|
rowsPerImage = rowsPerImageVal->Int32Value(context).FromJust();
|
|
570
705
|
}
|
|
571
|
-
|
|
572
|
-
|
|
706
|
+
|
|
707
|
+
|
|
573
708
|
v8::Local<v8::Value> offsetVal;
|
|
574
|
-
|
|
709
|
+
|
|
575
710
|
src->Get(context, ConvertToV8String(isolate, "offset")).ToLocal(&offsetVal);
|
|
576
|
-
|
|
711
|
+
|
|
577
712
|
if (!offsetVal.IsEmpty() && offsetVal->IsNumber()) {
|
|
578
713
|
offset = (int64_t) offsetVal->NumberValue(context).FromJust();
|
|
579
714
|
}
|
|
580
|
-
|
|
715
|
+
|
|
581
716
|
v8::Local<v8::Value> bytesPerRowVal;
|
|
582
|
-
|
|
717
|
+
|
|
583
718
|
src->Get(context, ConvertToV8String(isolate, "bytesPerRow")).ToLocal(&bytesPerRowVal);
|
|
584
|
-
|
|
719
|
+
|
|
585
720
|
CanvasImageCopyBuffer copy{
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
721
|
+
buffer,
|
|
722
|
+
offset,
|
|
723
|
+
bytesPerRowVal->Int32Value(context).FromJust(),
|
|
724
|
+
rowsPerImage
|
|
590
725
|
};
|
|
591
|
-
|
|
592
|
-
|
|
726
|
+
|
|
727
|
+
|
|
593
728
|
uint32_t mipLevel = 0;
|
|
594
729
|
CanvasOrigin3d origin{0, 0, 0};
|
|
595
730
|
CanvasTextureAspect aspect = CanvasTextureAspectAll;
|
|
596
|
-
|
|
731
|
+
|
|
597
732
|
const CanvasGPUTexture *texture = nullptr;
|
|
598
733
|
auto dst = destination.As<v8::Object>();
|
|
599
|
-
|
|
600
|
-
|
|
734
|
+
|
|
735
|
+
|
|
601
736
|
v8::Local<v8::Value> textureVal;
|
|
602
737
|
dst->Get(context, ConvertToV8String(isolate, "texture")).ToLocal(&textureVal);
|
|
603
738
|
if (GetNativeType(textureVal) == NativeType::GPUTexture) {
|
|
604
739
|
texture = GPUTextureImpl::GetPointer(textureVal.As<v8::Object>())->GetTexture();
|
|
605
740
|
}
|
|
606
|
-
|
|
607
|
-
|
|
741
|
+
|
|
742
|
+
|
|
608
743
|
v8::Local<v8::Value> mipLevelVal;
|
|
609
744
|
dst->Get(context, ConvertToV8String(isolate, "mipLevel")).ToLocal(&mipLevelVal);
|
|
610
|
-
|
|
745
|
+
|
|
611
746
|
if (!mipLevelVal.IsEmpty() && mipLevelVal->IsUint32()) {
|
|
612
747
|
mipLevel = mipLevelVal->Uint32Value(context).FromJust();
|
|
613
748
|
}
|
|
614
|
-
|
|
749
|
+
|
|
615
750
|
v8::Local<v8::Value> originVal;
|
|
616
751
|
dst->Get(context, ConvertToV8String(isolate, "origin")).ToLocal(&originVal);
|
|
617
|
-
|
|
618
|
-
|
|
752
|
+
|
|
753
|
+
|
|
619
754
|
if (!originVal.IsEmpty() && originVal->IsObject()) {
|
|
620
755
|
auto originObj = originVal.As<v8::Object>();
|
|
621
|
-
|
|
622
|
-
|
|
756
|
+
|
|
757
|
+
|
|
623
758
|
v8::Local<v8::Value> xVal;
|
|
624
759
|
v8::Local<v8::Value> yVal;
|
|
625
760
|
v8::Local<v8::Value> zVal;
|
|
626
761
|
originObj->Get(context, ConvertToV8String(isolate, "x")).ToLocal(&xVal);
|
|
627
762
|
originObj->Get(context, ConvertToV8String(isolate, "y")).ToLocal(&yVal);
|
|
628
763
|
originObj->Get(context, ConvertToV8String(isolate, "z")).ToLocal(&zVal);
|
|
629
|
-
|
|
764
|
+
|
|
630
765
|
if (xVal->IsUint32()) {
|
|
631
766
|
origin.x = xVal->Uint32Value(context).FromJust();
|
|
632
767
|
}
|
|
@@ -636,36 +771,36 @@ void GPUCommandEncoderImpl::CopyBufferToTexture(const v8::FunctionCallbackInfo<v
|
|
|
636
771
|
if (zVal->IsUint32()) {
|
|
637
772
|
origin.z = zVal->Uint32Value(context).FromJust();
|
|
638
773
|
}
|
|
639
|
-
|
|
774
|
+
|
|
640
775
|
}
|
|
641
|
-
|
|
642
|
-
|
|
776
|
+
|
|
777
|
+
|
|
643
778
|
v8::Local<v8::Value> aspectVal;
|
|
644
779
|
dst->Get(context, ConvertToV8String(isolate, "aspect")).ToLocal(&aspectVal);
|
|
645
|
-
|
|
646
|
-
|
|
780
|
+
|
|
781
|
+
|
|
647
782
|
auto aspectStr = ConvertFromV8String(isolate, aspectVal);
|
|
648
|
-
|
|
783
|
+
|
|
649
784
|
if (aspectStr == "stencil-only") {
|
|
650
785
|
aspect = CanvasTextureAspectStencilOnly;
|
|
651
786
|
} else if (aspectStr == "depth-only") {
|
|
652
787
|
aspect = CanvasTextureAspectDepthOnly;
|
|
653
788
|
}
|
|
654
|
-
|
|
789
|
+
|
|
655
790
|
CanvasImageCopyTexture ct{
|
|
656
|
-
|
|
791
|
+
texture, mipLevel, origin, aspect
|
|
657
792
|
};
|
|
658
|
-
|
|
793
|
+
|
|
659
794
|
CanvasExtent3d cz = ParseExtent3d(isolate, copySize);
|
|
660
795
|
canvas_native_webgpu_command_encoder_copy_buffer_to_texture(
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
796
|
+
ptr->GetEncoder(),
|
|
797
|
+
©,
|
|
798
|
+
&ct,
|
|
799
|
+
&cz
|
|
800
|
+
);
|
|
666
801
|
}
|
|
667
|
-
|
|
668
|
-
|
|
802
|
+
|
|
803
|
+
|
|
669
804
|
}
|
|
670
805
|
|
|
671
806
|
void GPUCommandEncoderImpl::CopyTextureToBuffer(const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
@@ -673,20 +808,20 @@ void GPUCommandEncoderImpl::CopyTextureToBuffer(const v8::FunctionCallbackInfo<v
|
|
|
673
808
|
if (ptr == nullptr) {
|
|
674
809
|
return;
|
|
675
810
|
}
|
|
676
|
-
|
|
677
|
-
|
|
811
|
+
|
|
812
|
+
|
|
678
813
|
auto isolate = args.GetIsolate();
|
|
679
814
|
auto context = isolate->GetCurrentContext();
|
|
680
|
-
|
|
815
|
+
|
|
681
816
|
// copying texture to buffer swapped the real source and dst
|
|
682
817
|
auto source = args[1];
|
|
683
818
|
auto destination = args[0];
|
|
684
819
|
auto copySize = args[2];
|
|
685
|
-
|
|
820
|
+
|
|
686
821
|
if (source->IsObject() && destination->IsObject() && copySize->IsObject()) {
|
|
687
822
|
const CanvasGPUBuffer *buffer = nullptr;
|
|
688
823
|
auto src = source.As<v8::Object>();
|
|
689
|
-
|
|
824
|
+
|
|
690
825
|
v8::Local<v8::Value> bufferVal;
|
|
691
826
|
src->Get(context, ConvertToV8String(isolate, "buffer")).ToLocal(&bufferVal);
|
|
692
827
|
if (GetNativeType(bufferVal) == NativeType::GPUBuffer) {
|
|
@@ -694,73 +829,73 @@ void GPUCommandEncoderImpl::CopyTextureToBuffer(const v8::FunctionCallbackInfo<v
|
|
|
694
829
|
}
|
|
695
830
|
uint64_t offset = 0;
|
|
696
831
|
int32_t rowsPerImage = -1;
|
|
697
|
-
|
|
832
|
+
|
|
698
833
|
v8::Local<v8::Value> rowsPerImageVal;
|
|
699
|
-
|
|
834
|
+
|
|
700
835
|
src->Get(context, ConvertToV8String(isolate, "rowsPerImage")).ToLocal(&rowsPerImageVal);
|
|
701
|
-
|
|
836
|
+
|
|
702
837
|
if (!rowsPerImageVal.IsEmpty() && rowsPerImageVal->IsInt32()) {
|
|
703
838
|
rowsPerImage = rowsPerImageVal->Int32Value(context).FromJust();
|
|
704
839
|
}
|
|
705
|
-
|
|
706
|
-
|
|
840
|
+
|
|
841
|
+
|
|
707
842
|
v8::Local<v8::Value> offsetVal;
|
|
708
|
-
|
|
843
|
+
|
|
709
844
|
src->Get(context, ConvertToV8String(isolate, "offset")).ToLocal(&offsetVal);
|
|
710
|
-
|
|
845
|
+
|
|
711
846
|
if (!offsetVal.IsEmpty() && offsetVal->IsNumber()) {
|
|
712
847
|
offset = (int64_t) offsetVal->NumberValue(context).FromJust();
|
|
713
848
|
}
|
|
714
|
-
|
|
849
|
+
|
|
715
850
|
v8::Local<v8::Value> bytesPerRowVal;
|
|
716
|
-
|
|
851
|
+
|
|
717
852
|
src->Get(context, ConvertToV8String(isolate, "bytesPerRow")).ToLocal(&bytesPerRowVal);
|
|
718
|
-
|
|
853
|
+
|
|
719
854
|
CanvasImageCopyBuffer copy{
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
855
|
+
buffer,
|
|
856
|
+
offset,
|
|
857
|
+
bytesPerRowVal->Int32Value(context).FromJust(),
|
|
858
|
+
rowsPerImage
|
|
724
859
|
};
|
|
725
|
-
|
|
726
|
-
|
|
860
|
+
|
|
861
|
+
|
|
727
862
|
uint32_t mipLevel = 0;
|
|
728
863
|
CanvasOrigin3d origin{0, 0, 0};
|
|
729
864
|
CanvasTextureAspect aspect = CanvasTextureAspectAll;
|
|
730
|
-
|
|
865
|
+
|
|
731
866
|
const CanvasGPUTexture *texture = nullptr;
|
|
732
867
|
auto dst = destination.As<v8::Object>();
|
|
733
|
-
|
|
734
|
-
|
|
868
|
+
|
|
869
|
+
|
|
735
870
|
v8::Local<v8::Value> textureVal;
|
|
736
871
|
dst->Get(context, ConvertToV8String(isolate, "texture")).ToLocal(&textureVal);
|
|
737
872
|
if (GetNativeType(textureVal) == NativeType::GPUTexture) {
|
|
738
873
|
texture = GPUTextureImpl::GetPointer(textureVal.As<v8::Object>())->GetTexture();
|
|
739
874
|
}
|
|
740
|
-
|
|
741
|
-
|
|
875
|
+
|
|
876
|
+
|
|
742
877
|
v8::Local<v8::Value> mipLevelVal;
|
|
743
878
|
dst->Get(context, ConvertToV8String(isolate, "mipLevel")).ToLocal(&mipLevelVal);
|
|
744
|
-
|
|
879
|
+
|
|
745
880
|
if (!mipLevelVal.IsEmpty() && mipLevelVal->IsUint32()) {
|
|
746
881
|
mipLevel = mipLevelVal->Uint32Value(context).FromJust();
|
|
747
882
|
}
|
|
748
|
-
|
|
883
|
+
|
|
749
884
|
v8::Local<v8::Value> originVal;
|
|
750
885
|
dst->Get(context, ConvertToV8String(isolate, "origin")).ToLocal(&originVal);
|
|
751
|
-
|
|
752
|
-
|
|
886
|
+
|
|
887
|
+
|
|
753
888
|
if (!originVal.IsEmpty() && originVal->IsObject()) {
|
|
754
889
|
auto originObj = originVal.As<v8::Object>();
|
|
755
|
-
|
|
756
|
-
|
|
890
|
+
|
|
891
|
+
|
|
757
892
|
v8::Local<v8::Value> xVal;
|
|
758
893
|
v8::Local<v8::Value> yVal;
|
|
759
894
|
v8::Local<v8::Value> zVal;
|
|
760
895
|
originObj->Get(context, ConvertToV8String(isolate, "x")).ToLocal(&xVal);
|
|
761
896
|
originObj->Get(context, ConvertToV8String(isolate, "y")).ToLocal(&yVal);
|
|
762
897
|
originObj->Get(context, ConvertToV8String(isolate, "z")).ToLocal(&zVal);
|
|
763
|
-
|
|
898
|
+
|
|
764
899
|
if (xVal->IsUint32()) {
|
|
765
900
|
origin.x = xVal->Uint32Value(context).FromJust();
|
|
766
901
|
}
|
|
@@ -770,36 +905,36 @@ void GPUCommandEncoderImpl::CopyTextureToBuffer(const v8::FunctionCallbackInfo<v
|
|
|
770
905
|
if (zVal->IsUint32()) {
|
|
771
906
|
origin.z = zVal->Uint32Value(context).FromJust();
|
|
772
907
|
}
|
|
773
|
-
|
|
908
|
+
|
|
774
909
|
}
|
|
775
|
-
|
|
776
|
-
|
|
910
|
+
|
|
911
|
+
|
|
777
912
|
v8::Local<v8::Value> aspectVal;
|
|
778
913
|
dst->Get(context, ConvertToV8String(isolate, "aspect")).ToLocal(&aspectVal);
|
|
779
|
-
|
|
780
|
-
|
|
914
|
+
|
|
915
|
+
|
|
781
916
|
auto aspectStr = ConvertFromV8String(isolate, aspectVal);
|
|
782
|
-
|
|
917
|
+
|
|
783
918
|
if (aspectStr == "stencil-only") {
|
|
784
919
|
aspect = CanvasTextureAspectStencilOnly;
|
|
785
920
|
} else if (aspectStr == "depth-only") {
|
|
786
921
|
aspect = CanvasTextureAspectDepthOnly;
|
|
787
922
|
}
|
|
788
|
-
|
|
923
|
+
|
|
789
924
|
CanvasImageCopyTexture ct{
|
|
790
|
-
|
|
925
|
+
texture, mipLevel, origin, aspect
|
|
791
926
|
};
|
|
792
|
-
|
|
927
|
+
|
|
793
928
|
CanvasExtent3d cz = ParseExtent3d(isolate, copySize);
|
|
794
929
|
canvas_native_webgpu_command_encoder_copy_texture_to_buffer(
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
930
|
+
ptr->GetEncoder(),
|
|
931
|
+
&ct,
|
|
932
|
+
©,
|
|
933
|
+
&cz
|
|
934
|
+
);
|
|
800
935
|
}
|
|
801
|
-
|
|
802
|
-
|
|
936
|
+
|
|
937
|
+
|
|
803
938
|
}
|
|
804
939
|
|
|
805
940
|
void GPUCommandEncoderImpl::CopyTextureToTexture(const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
@@ -807,51 +942,51 @@ void GPUCommandEncoderImpl::CopyTextureToTexture(const v8::FunctionCallbackInfo<
|
|
|
807
942
|
if (ptr == nullptr) {
|
|
808
943
|
return;
|
|
809
944
|
}
|
|
810
|
-
|
|
945
|
+
|
|
811
946
|
auto isolate = args.GetIsolate();
|
|
812
947
|
auto context = isolate->GetCurrentContext();
|
|
813
|
-
|
|
948
|
+
|
|
814
949
|
// copying texture to buffer swapped the real source and dst
|
|
815
950
|
auto source = args[0];
|
|
816
951
|
auto destination = args[1];
|
|
817
952
|
auto copySize = args[2];
|
|
818
|
-
|
|
953
|
+
|
|
819
954
|
if (source->IsObject() && destination->IsObject() && copySize->IsObject()) {
|
|
820
955
|
auto src = source.As<v8::Object>();
|
|
821
|
-
|
|
956
|
+
|
|
822
957
|
uint32_t mipLevelA = 0;
|
|
823
958
|
CanvasOrigin3d originA{0, 0, 0};
|
|
824
959
|
CanvasTextureAspect aspectA = CanvasTextureAspectAll;
|
|
825
|
-
|
|
960
|
+
|
|
826
961
|
const CanvasGPUTexture *textureA = nullptr;
|
|
827
|
-
|
|
962
|
+
|
|
828
963
|
v8::Local<v8::Value> srcTextureVal;
|
|
829
964
|
src->Get(context, ConvertToV8String(isolate, "texture")).ToLocal(&srcTextureVal);
|
|
830
965
|
if (GetNativeType(srcTextureVal) == NativeType::GPUTexture) {
|
|
831
966
|
textureA = GPUTextureImpl::GetPointer(srcTextureVal.As<v8::Object>())->GetTexture();
|
|
832
967
|
}
|
|
833
|
-
|
|
968
|
+
|
|
834
969
|
v8::Local<v8::Value> mipLevelAVal;
|
|
835
970
|
src->Get(context, ConvertToV8String(isolate, "mipLevel")).ToLocal(&mipLevelAVal);
|
|
836
|
-
|
|
971
|
+
|
|
837
972
|
if (!mipLevelAVal.IsEmpty() && mipLevelAVal->IsUint32()) {
|
|
838
973
|
mipLevelA = mipLevelAVal->Uint32Value(context).FromJust();
|
|
839
974
|
}
|
|
840
|
-
|
|
975
|
+
|
|
841
976
|
v8::Local<v8::Value> originAVal;
|
|
842
977
|
src->Get(context, ConvertToV8String(isolate, "origin")).ToLocal(&originAVal);
|
|
843
|
-
|
|
844
|
-
|
|
978
|
+
|
|
979
|
+
|
|
845
980
|
if (!originAVal.IsEmpty() && originAVal->IsObject()) {
|
|
846
981
|
auto originObj = originAVal.As<v8::Object>();
|
|
847
|
-
|
|
982
|
+
|
|
848
983
|
v8::Local<v8::Value> xVal;
|
|
849
984
|
v8::Local<v8::Value> yVal;
|
|
850
985
|
v8::Local<v8::Value> zVal;
|
|
851
986
|
originObj->Get(context, ConvertToV8String(isolate, "x")).ToLocal(&xVal);
|
|
852
987
|
originObj->Get(context, ConvertToV8String(isolate, "y")).ToLocal(&yVal);
|
|
853
988
|
originObj->Get(context, ConvertToV8String(isolate, "z")).ToLocal(&zVal);
|
|
854
|
-
|
|
989
|
+
|
|
855
990
|
if (xVal->IsUint32()) {
|
|
856
991
|
originA.x = xVal->Uint32Value(context).FromJust();
|
|
857
992
|
}
|
|
@@ -861,58 +996,58 @@ void GPUCommandEncoderImpl::CopyTextureToTexture(const v8::FunctionCallbackInfo<
|
|
|
861
996
|
if (zVal->IsUint32()) {
|
|
862
997
|
originA.z = zVal->Uint32Value(context).FromJust();
|
|
863
998
|
}
|
|
864
|
-
|
|
999
|
+
|
|
865
1000
|
}
|
|
866
|
-
|
|
1001
|
+
|
|
867
1002
|
v8::Local<v8::Value> aspectAVal;
|
|
868
1003
|
src->Get(context, ConvertToV8String(isolate, "aspect")).ToLocal(&aspectAVal);
|
|
869
|
-
|
|
1004
|
+
|
|
870
1005
|
auto aspectAStr = ConvertFromV8String(isolate, aspectAVal);
|
|
871
|
-
|
|
1006
|
+
|
|
872
1007
|
if (aspectAStr == "stencil-only") {
|
|
873
1008
|
aspectA = CanvasTextureAspectStencilOnly;
|
|
874
1009
|
} else if (aspectAStr == "depth-only") {
|
|
875
1010
|
aspectA = CanvasTextureAspectDepthOnly;
|
|
876
1011
|
}
|
|
877
1012
|
CanvasImageCopyTexture copy{
|
|
878
|
-
|
|
1013
|
+
textureA, mipLevelA, originA, aspectA
|
|
879
1014
|
};
|
|
880
|
-
|
|
1015
|
+
|
|
881
1016
|
uint32_t mipLevel = 0;
|
|
882
1017
|
CanvasOrigin3d origin{0, 0, 0};
|
|
883
1018
|
CanvasTextureAspect aspect = CanvasTextureAspectAll;
|
|
884
|
-
|
|
1019
|
+
|
|
885
1020
|
const CanvasGPUTexture *texture = nullptr;
|
|
886
1021
|
auto dst = destination.As<v8::Object>();
|
|
887
|
-
|
|
888
|
-
|
|
1022
|
+
|
|
1023
|
+
|
|
889
1024
|
v8::Local<v8::Value> textureVal;
|
|
890
1025
|
dst->Get(context, ConvertToV8String(isolate, "texture")).ToLocal(&textureVal);
|
|
891
1026
|
if (GetNativeType(textureVal) == NativeType::GPUTexture) {
|
|
892
1027
|
texture = GPUTextureImpl::GetPointer(textureVal.As<v8::Object>())->GetTexture();
|
|
893
1028
|
}
|
|
894
|
-
|
|
895
|
-
|
|
1029
|
+
|
|
1030
|
+
|
|
896
1031
|
v8::Local<v8::Value> mipLevelVal;
|
|
897
1032
|
dst->Get(context, ConvertToV8String(isolate, "mipLevel")).ToLocal(&mipLevelVal);
|
|
898
|
-
|
|
1033
|
+
|
|
899
1034
|
if (!mipLevelVal.IsEmpty() && mipLevelVal->IsUint32()) {
|
|
900
1035
|
mipLevel = mipLevelVal->Uint32Value(context).FromJust();
|
|
901
1036
|
}
|
|
902
|
-
|
|
1037
|
+
|
|
903
1038
|
v8::Local<v8::Value> originVal;
|
|
904
1039
|
dst->Get(context, ConvertToV8String(isolate, "origin")).ToLocal(&originVal);
|
|
905
|
-
|
|
1040
|
+
|
|
906
1041
|
if (!originVal.IsEmpty() && originVal->IsObject()) {
|
|
907
1042
|
auto originObj = originVal.As<v8::Object>();
|
|
908
|
-
|
|
1043
|
+
|
|
909
1044
|
v8::Local<v8::Value> xVal;
|
|
910
1045
|
v8::Local<v8::Value> yVal;
|
|
911
1046
|
v8::Local<v8::Value> zVal;
|
|
912
1047
|
originObj->Get(context, ConvertToV8String(isolate, "x")).ToLocal(&xVal);
|
|
913
1048
|
originObj->Get(context, ConvertToV8String(isolate, "y")).ToLocal(&yVal);
|
|
914
1049
|
originObj->Get(context, ConvertToV8String(isolate, "z")).ToLocal(&zVal);
|
|
915
|
-
|
|
1050
|
+
|
|
916
1051
|
if (xVal->IsUint32()) {
|
|
917
1052
|
origin.x = xVal->Uint32Value(context).FromJust();
|
|
918
1053
|
}
|
|
@@ -922,36 +1057,36 @@ void GPUCommandEncoderImpl::CopyTextureToTexture(const v8::FunctionCallbackInfo<
|
|
|
922
1057
|
if (zVal->IsUint32()) {
|
|
923
1058
|
origin.z = zVal->Uint32Value(context).FromJust();
|
|
924
1059
|
}
|
|
925
|
-
|
|
1060
|
+
|
|
926
1061
|
}
|
|
927
|
-
|
|
928
|
-
|
|
1062
|
+
|
|
1063
|
+
|
|
929
1064
|
v8::Local<v8::Value> aspectVal;
|
|
930
1065
|
dst->Get(context, ConvertToV8String(isolate, "aspect")).ToLocal(&aspectVal);
|
|
931
|
-
|
|
1066
|
+
|
|
932
1067
|
auto aspectStr = ConvertFromV8String(isolate, aspectVal);
|
|
933
|
-
|
|
1068
|
+
|
|
934
1069
|
if (aspectStr == "stencil-only") {
|
|
935
1070
|
aspect = CanvasTextureAspectStencilOnly;
|
|
936
1071
|
} else if (aspectStr == "depth-only") {
|
|
937
1072
|
aspect = CanvasTextureAspectDepthOnly;
|
|
938
1073
|
}
|
|
939
|
-
|
|
1074
|
+
|
|
940
1075
|
CanvasImageCopyTexture ct{
|
|
941
|
-
|
|
1076
|
+
texture, mipLevel, origin, aspect
|
|
942
1077
|
};
|
|
943
|
-
|
|
1078
|
+
|
|
944
1079
|
CanvasExtent3d cz = ParseExtent3d(isolate, copySize);
|
|
945
|
-
|
|
1080
|
+
|
|
946
1081
|
canvas_native_webgpu_command_encoder_copy_texture_to_texture(
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
1082
|
+
ptr->GetEncoder(),
|
|
1083
|
+
©,
|
|
1084
|
+
&ct,
|
|
1085
|
+
&cz
|
|
1086
|
+
);
|
|
952
1087
|
}
|
|
953
|
-
|
|
954
|
-
|
|
1088
|
+
|
|
1089
|
+
|
|
955
1090
|
}
|
|
956
1091
|
|
|
957
1092
|
void GPUCommandEncoderImpl::Finish(const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
@@ -959,33 +1094,31 @@ void GPUCommandEncoderImpl::Finish(const v8::FunctionCallbackInfo<v8::Value> &ar
|
|
|
959
1094
|
if (ptr == nullptr) {
|
|
960
1095
|
return;
|
|
961
1096
|
}
|
|
962
|
-
|
|
1097
|
+
|
|
963
1098
|
auto isolate = args.GetIsolate();
|
|
964
1099
|
auto context = isolate->GetCurrentContext();
|
|
965
|
-
|
|
966
|
-
|
|
1100
|
+
|
|
967
1101
|
auto descVal = args[0];
|
|
968
1102
|
std::string label;
|
|
969
1103
|
bool didSet = false;
|
|
970
1104
|
if (descVal->IsObject()) {
|
|
971
1105
|
auto desc = descVal.As<v8::Object>();
|
|
972
1106
|
v8::Local<v8::Value> labelVal;
|
|
973
|
-
desc->Get(context, ConvertToV8String(isolate, "label")).ToLocal(&labelVal);
|
|
974
|
-
if (
|
|
1107
|
+
didSet = desc->Get(context, ConvertToV8String(isolate, "label")).ToLocal(&labelVal);
|
|
1108
|
+
if (didSet && labelVal->IsString()) {
|
|
975
1109
|
label = ConvertFromV8String(isolate, labelVal);
|
|
976
|
-
didSet = true;
|
|
977
1110
|
}
|
|
978
1111
|
}
|
|
979
|
-
|
|
1112
|
+
|
|
980
1113
|
auto value = canvas_native_webgpu_command_encoder_finish(ptr->GetEncoder(),
|
|
981
1114
|
didSet ? label.c_str() : nullptr);
|
|
982
|
-
|
|
1115
|
+
|
|
983
1116
|
if (value != nullptr) {
|
|
984
1117
|
auto ret = GPUCommandBufferImpl::NewInstance(isolate, new GPUCommandBufferImpl(value));
|
|
985
1118
|
args.GetReturnValue().Set(ret);
|
|
986
1119
|
return;
|
|
987
1120
|
}
|
|
988
|
-
|
|
1121
|
+
|
|
989
1122
|
args.GetReturnValue().SetUndefined();
|
|
990
1123
|
}
|
|
991
1124
|
|
|
@@ -995,9 +1128,9 @@ GPUCommandEncoderImpl::InsertDebugMarker(const v8::FunctionCallbackInfo<v8::Valu
|
|
|
995
1128
|
if (ptr == nullptr) {
|
|
996
1129
|
return;
|
|
997
1130
|
}
|
|
998
|
-
|
|
1131
|
+
|
|
999
1132
|
auto isolate = args.GetIsolate();
|
|
1000
|
-
|
|
1133
|
+
|
|
1001
1134
|
auto markerLabelVal = args[0];
|
|
1002
1135
|
if (markerLabelVal->IsString()) {
|
|
1003
1136
|
auto markerLabel = ConvertFromV8String(isolate, markerLabelVal);
|
|
@@ -1011,7 +1144,7 @@ void GPUCommandEncoderImpl::PopDebugGroup(const v8::FunctionCallbackInfo<v8::Val
|
|
|
1011
1144
|
if (ptr == nullptr) {
|
|
1012
1145
|
return;
|
|
1013
1146
|
}
|
|
1014
|
-
|
|
1147
|
+
|
|
1015
1148
|
canvas_native_webgpu_command_encoder_pop_debug_group(ptr->GetEncoder());
|
|
1016
1149
|
}
|
|
1017
1150
|
|
|
@@ -1020,9 +1153,9 @@ void GPUCommandEncoderImpl::PushDebugGroup(const v8::FunctionCallbackInfo<v8::Va
|
|
|
1020
1153
|
if (ptr == nullptr) {
|
|
1021
1154
|
return;
|
|
1022
1155
|
}
|
|
1023
|
-
|
|
1156
|
+
|
|
1024
1157
|
auto isolate = args.GetIsolate();
|
|
1025
|
-
|
|
1158
|
+
|
|
1026
1159
|
auto groupLabelVal = args[0];
|
|
1027
1160
|
if (groupLabelVal->IsString()) {
|
|
1028
1161
|
auto groupLabel = ConvertFromV8String(isolate, groupLabelVal);
|
|
@@ -1036,10 +1169,10 @@ void GPUCommandEncoderImpl::ResolveQuerySet(const v8::FunctionCallbackInfo<v8::V
|
|
|
1036
1169
|
if (ptr == nullptr) {
|
|
1037
1170
|
return;
|
|
1038
1171
|
}
|
|
1039
|
-
|
|
1172
|
+
|
|
1040
1173
|
auto isolate = args.GetIsolate();
|
|
1041
1174
|
auto context = isolate->GetCurrentContext();
|
|
1042
|
-
|
|
1175
|
+
|
|
1043
1176
|
auto querySet = args[0];
|
|
1044
1177
|
auto queryType = GetNativeType(querySet);
|
|
1045
1178
|
auto firstQuery = args[1];
|
|
@@ -1047,19 +1180,19 @@ void GPUCommandEncoderImpl::ResolveQuerySet(const v8::FunctionCallbackInfo<v8::V
|
|
|
1047
1180
|
auto destination = args[3];
|
|
1048
1181
|
auto destinationType = GetNativeType(destination);
|
|
1049
1182
|
auto destinationOffset = args[4];
|
|
1050
|
-
|
|
1051
|
-
|
|
1183
|
+
|
|
1184
|
+
|
|
1052
1185
|
if (queryType == NativeType::GPUQuerySet && destinationType == NativeType::GPUBuffer) {
|
|
1053
1186
|
auto qs = GPUQuerySetImpl::GetPointer(querySet.As<v8::Object>());
|
|
1054
1187
|
auto dest = GPUBufferImpl::GetPointer(destination.As<v8::Object>());
|
|
1055
1188
|
canvas_native_webgpu_command_encoder_resolve_query_set(ptr->GetEncoder(), qs->GetQuerySet(),
|
|
1056
1189
|
firstQuery->Uint32Value(
|
|
1057
|
-
|
|
1190
|
+
context).FromJust(),
|
|
1058
1191
|
queryCount->Uint32Value(
|
|
1059
|
-
|
|
1192
|
+
context).FromJust(),
|
|
1060
1193
|
dest->GetGPUBuffer(),
|
|
1061
1194
|
(uint64_t) destinationOffset->NumberValue(
|
|
1062
|
-
|
|
1195
|
+
context).FromJust());
|
|
1063
1196
|
}
|
|
1064
1197
|
}
|
|
1065
1198
|
|
|
@@ -1068,20 +1201,20 @@ void GPUCommandEncoderImpl::WriteTimestamp(const v8::FunctionCallbackInfo<v8::Va
|
|
|
1068
1201
|
if (ptr == nullptr) {
|
|
1069
1202
|
return;
|
|
1070
1203
|
}
|
|
1071
|
-
|
|
1204
|
+
|
|
1072
1205
|
auto isolate = args.GetIsolate();
|
|
1073
1206
|
auto context = isolate->GetCurrentContext();
|
|
1074
|
-
|
|
1207
|
+
|
|
1075
1208
|
auto querySet = args[0];
|
|
1076
1209
|
auto queryType = GetNativeType(querySet);
|
|
1077
1210
|
auto queryIndex = args[1];
|
|
1078
|
-
|
|
1211
|
+
|
|
1079
1212
|
if (queryType == NativeType::GPUQuerySet) {
|
|
1080
1213
|
auto qs = GPUQuerySetImpl::GetPointer(querySet.As<v8::Object>());
|
|
1081
1214
|
canvas_native_webgpu_command_encoder_write_timestamp(ptr->GetEncoder(), qs->GetQuerySet(),
|
|
1082
1215
|
queryIndex->Uint32Value(
|
|
1083
|
-
|
|
1216
|
+
context).FromJust());
|
|
1084
1217
|
}
|
|
1085
|
-
|
|
1086
|
-
|
|
1218
|
+
|
|
1219
|
+
|
|
1087
1220
|
}
|