@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
|
@@ -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,11 +23,11 @@ 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
|
-
|
|
30
|
+
|
|
31
31
|
canvasModule->Set(context, ConvertToV8String(isolate, "GPUCommandEncoder"), func).FromJust();
|
|
32
32
|
}
|
|
33
33
|
|
|
@@ -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,171 +239,149 @@ 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
|
-
|
|
274
|
+
&clearValueVal);
|
|
275
|
+
|
|
261
276
|
auto clearValue = ParseColor(isolate, clearValueVal);
|
|
262
|
-
|
|
263
|
-
v8::Local<v8::Value> viewVal;
|
|
264
|
-
colorAttachment->Get(context, ConvertToV8String(isolate,
|
|
265
|
-
"view")).ToLocal(&viewVal);
|
|
266
|
-
|
|
277
|
+
|
|
267
278
|
const CanvasGPUTextureView *view = nullptr;
|
|
268
|
-
|
|
269
|
-
auto viewPtr = GPUTextureViewImpl::GetPointer(viewVal.As<v8::Object>());
|
|
270
|
-
view = viewPtr->GetTextureView();
|
|
271
279
|
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
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
|
+
}
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+
const CanvasGPUTextureView *resolveTarget = nullptr;
|
|
294
|
+
|
|
295
|
+
v8::Local<v8::Value> resolveTargetVal;
|
|
296
|
+
|
|
276
297
|
colorAttachment->Get(context, ConvertToV8String(isolate, "resolveTarget")).ToLocal(
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
auto resolve_target_type = GetNativeType(
|
|
280
|
-
|
|
298
|
+
&resolveTargetVal);
|
|
299
|
+
|
|
300
|
+
auto resolve_target_type = GetNativeType(resolveTargetVal);
|
|
301
|
+
|
|
281
302
|
if (resolve_target_type == NativeType::GPUTextureView) {
|
|
282
|
-
auto res = GPUTextureViewImpl::GetPointer(
|
|
283
|
-
|
|
303
|
+
auto res = GPUTextureViewImpl::GetPointer(resolveTargetVal.As<v8::Object>());
|
|
304
|
+
resolveTarget = res->GetTextureView();
|
|
284
305
|
}
|
|
285
|
-
|
|
286
|
-
// default
|
|
287
|
-
CanvasLoadOp load = CanvasLoadOp::CanvasLoadOpClear;
|
|
288
|
-
CanvasStoreOp store = CanvasStoreOp::CanvasStoreOpStore;
|
|
306
|
+
|
|
289
307
|
v8::Local<v8::Value> loadVal;
|
|
290
|
-
|
|
291
|
-
if(colorAttachment->Get(context, ConvertToV8String(isolate,
|
|
292
|
-
"loadOp")).ToLocal(&loadVal)){
|
|
293
|
-
if (loadVal->IsUint32()) {
|
|
294
|
-
load = (CanvasLoadOp) loadVal->Uint32Value(
|
|
295
|
-
context).ToChecked();
|
|
296
|
-
} else if (loadVal->IsString()) {
|
|
297
|
-
auto val = ConvertFromV8String(isolate, loadVal);
|
|
298
|
-
if (val == "clear") {
|
|
299
|
-
load = CanvasLoadOp::CanvasLoadOpClear;
|
|
300
|
-
} else if (val == "load") {
|
|
301
|
-
load = CanvasLoadOp::CanvasLoadOpLoad;
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
|
|
307
308
|
v8::Local<v8::Value> storeVal;
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
store = CanvasStoreOp::CanvasStoreOpStore;
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
}
|
|
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
|
+
|
|
322
319
|
|
|
320
|
+
|
|
323
321
|
CanvasPassChannelColor channel{
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
322
|
+
load,
|
|
323
|
+
store,
|
|
324
|
+
clearValue,
|
|
325
|
+
false
|
|
328
326
|
};
|
|
329
|
-
|
|
327
|
+
|
|
330
328
|
auto attachment = CanvasRenderPassColorAttachment{
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
329
|
+
view,
|
|
330
|
+
resolveTarget,
|
|
331
|
+
channel
|
|
334
332
|
};
|
|
335
|
-
|
|
333
|
+
|
|
336
334
|
colorAttachments_.push_back(attachment);
|
|
337
|
-
|
|
335
|
+
|
|
338
336
|
}
|
|
339
|
-
|
|
340
|
-
|
|
337
|
+
|
|
338
|
+
|
|
341
339
|
// todo add when supported
|
|
342
340
|
v8::Local<v8::Value> maxDrawCountVal;
|
|
343
341
|
desc->Get(context, ConvertToV8String(isolate, "maxDrawCount")).ToLocal(&maxDrawCountVal);
|
|
344
|
-
|
|
345
|
-
|
|
342
|
+
|
|
343
|
+
|
|
346
344
|
CanvasRenderPassDepthStencilAttachment *depthStencilAttachment = nullptr;
|
|
347
345
|
v8::Local<v8::Value> depthStencilAttachmentVal;
|
|
348
|
-
|
|
346
|
+
|
|
349
347
|
desc->Get(context, ConvertToV8String(isolate, "depthStencilAttachment")).ToLocal(
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
348
|
+
&depthStencilAttachmentVal);
|
|
349
|
+
|
|
350
|
+
|
|
353
351
|
if (!depthStencilAttachmentVal.IsEmpty() && depthStencilAttachmentVal->IsObject()) {
|
|
354
352
|
auto depthStencilAttachmentObj = depthStencilAttachmentVal.As<v8::Object>();
|
|
355
353
|
depthStencilAttachment = new CanvasRenderPassDepthStencilAttachment{};
|
|
356
|
-
|
|
357
|
-
|
|
354
|
+
|
|
355
|
+
|
|
358
356
|
v8::Local<v8::Value> viewVal;
|
|
359
357
|
depthStencilAttachmentObj->Get(context, ConvertToV8String(isolate,
|
|
360
358
|
"view")).ToLocal(&viewVal);
|
|
361
|
-
|
|
359
|
+
|
|
362
360
|
auto viewPtr = GPUTextureViewImpl::GetPointer(viewVal.As<v8::Object>());
|
|
363
361
|
depthStencilAttachment->view = viewPtr->GetTextureView();
|
|
364
|
-
|
|
365
|
-
|
|
362
|
+
|
|
363
|
+
|
|
366
364
|
v8::Local<v8::Value> depthClearValue;
|
|
367
365
|
depthStencilAttachmentObj->Get(context, ConvertToV8String(isolate,
|
|
368
366
|
"depthClearValue")).ToLocal(
|
|
369
|
-
|
|
370
|
-
|
|
367
|
+
&depthClearValue);
|
|
368
|
+
|
|
371
369
|
depthStencilAttachment->depth_clear_value = 0;
|
|
372
|
-
|
|
370
|
+
|
|
373
371
|
if (!depthClearValue.IsEmpty() && depthClearValue->IsNumber()) {
|
|
374
372
|
depthStencilAttachment->depth_clear_value = (float) depthClearValue->NumberValue(
|
|
375
|
-
|
|
373
|
+
context).FromJust();
|
|
376
374
|
}
|
|
377
|
-
|
|
375
|
+
|
|
378
376
|
v8::Local<v8::Value> depthLoadOp;
|
|
379
377
|
depthStencilAttachmentObj->Get(context, ConvertToV8String(isolate,
|
|
380
378
|
"depthLoadOp")).ToLocal(
|
|
381
|
-
|
|
382
|
-
|
|
379
|
+
&depthLoadOp);
|
|
380
|
+
|
|
383
381
|
depthStencilAttachment->depth_load_op = CanvasOptionalLoadOp{
|
|
384
382
|
CanvasOptionalLoadOpNone
|
|
385
383
|
};
|
|
386
|
-
|
|
384
|
+
|
|
387
385
|
if (!depthLoadOp.IsEmpty() && depthLoadOp->IsString()) {
|
|
388
386
|
auto value = ConvertFromV8String(isolate, depthLoadOp);
|
|
389
387
|
if (value == "load") {
|
|
@@ -398,17 +396,17 @@ void GPUCommandEncoderImpl::BeginRenderPass(const v8::FunctionCallbackInfo<v8::V
|
|
|
398
396
|
};
|
|
399
397
|
}
|
|
400
398
|
}
|
|
401
|
-
|
|
402
|
-
|
|
399
|
+
|
|
400
|
+
|
|
403
401
|
v8::Local<v8::Value> depthStoreOp;
|
|
404
402
|
depthStencilAttachmentObj->Get(context, ConvertToV8String(isolate,
|
|
405
403
|
"depthStoreOp")).ToLocal(
|
|
406
|
-
|
|
407
|
-
|
|
404
|
+
&depthStoreOp);
|
|
405
|
+
|
|
408
406
|
depthStencilAttachment->depth_store_op = CanvasOptionalStoreOp{
|
|
409
407
|
CanvasOptionalStoreOpNone
|
|
410
408
|
};
|
|
411
|
-
|
|
409
|
+
|
|
412
410
|
if (!depthStoreOp.IsEmpty() && depthStoreOp->IsString()) {
|
|
413
411
|
auto value = ConvertFromV8String(isolate, depthStoreOp);
|
|
414
412
|
if (value == "store") {
|
|
@@ -423,41 +421,41 @@ void GPUCommandEncoderImpl::BeginRenderPass(const v8::FunctionCallbackInfo<v8::V
|
|
|
423
421
|
};
|
|
424
422
|
}
|
|
425
423
|
}
|
|
426
|
-
|
|
427
|
-
|
|
424
|
+
|
|
425
|
+
|
|
428
426
|
v8::Local<v8::Value> depthReadOnly;
|
|
429
427
|
depthStencilAttachmentObj->Get(context, ConvertToV8String(isolate,
|
|
430
428
|
"depthReadOnly")).ToLocal(
|
|
431
|
-
|
|
432
|
-
|
|
429
|
+
&depthReadOnly);
|
|
430
|
+
|
|
433
431
|
depthStencilAttachment->depth_read_only = false;
|
|
434
432
|
if (!depthReadOnly.IsEmpty() && depthReadOnly->IsBoolean()) {
|
|
435
433
|
depthStencilAttachment->depth_read_only = depthReadOnly->BooleanValue(isolate);
|
|
436
434
|
}
|
|
437
|
-
|
|
438
|
-
|
|
435
|
+
|
|
436
|
+
|
|
439
437
|
v8::Local<v8::Value> stencilClearValue;
|
|
440
438
|
depthStencilAttachmentObj->Get(context, ConvertToV8String(isolate,
|
|
441
439
|
"stencilClearValue")).ToLocal(
|
|
442
|
-
|
|
443
|
-
|
|
440
|
+
&stencilClearValue);
|
|
441
|
+
|
|
444
442
|
depthStencilAttachment->stencil_clear_value = 0;
|
|
445
|
-
|
|
443
|
+
|
|
446
444
|
if (!stencilClearValue.IsEmpty() && stencilClearValue->IsUint32()) {
|
|
447
445
|
depthStencilAttachment->stencil_clear_value = stencilClearValue->Uint32Value(
|
|
448
|
-
|
|
446
|
+
context).FromJust();
|
|
449
447
|
}
|
|
450
|
-
|
|
451
|
-
|
|
448
|
+
|
|
449
|
+
|
|
452
450
|
v8::Local<v8::Value> stencilLoadOp;
|
|
453
451
|
depthStencilAttachmentObj->Get(context, ConvertToV8String(isolate,
|
|
454
452
|
"stencilLoadOp")).ToLocal(
|
|
455
|
-
|
|
456
|
-
|
|
453
|
+
&stencilLoadOp);
|
|
454
|
+
|
|
457
455
|
depthStencilAttachment->stencil_load_op = CanvasOptionalLoadOp{
|
|
458
456
|
CanvasOptionalLoadOpNone
|
|
459
457
|
};
|
|
460
|
-
|
|
458
|
+
|
|
461
459
|
if (!stencilLoadOp.IsEmpty() && stencilLoadOp->IsString()) {
|
|
462
460
|
auto value = ConvertFromV8String(isolate, stencilLoadOp);
|
|
463
461
|
if (value == "load") {
|
|
@@ -472,17 +470,17 @@ void GPUCommandEncoderImpl::BeginRenderPass(const v8::FunctionCallbackInfo<v8::V
|
|
|
472
470
|
};
|
|
473
471
|
}
|
|
474
472
|
}
|
|
475
|
-
|
|
476
|
-
|
|
473
|
+
|
|
474
|
+
|
|
477
475
|
v8::Local<v8::Value> stencilStoreOp;
|
|
478
476
|
depthStencilAttachmentObj->Get(context, ConvertToV8String(isolate,
|
|
479
477
|
"stencilStoreOp")).ToLocal(
|
|
480
|
-
|
|
481
|
-
|
|
478
|
+
&stencilStoreOp);
|
|
479
|
+
|
|
482
480
|
depthStencilAttachment->stencil_store_op = CanvasOptionalStoreOp{
|
|
483
481
|
CanvasOptionalStoreOpNone
|
|
484
482
|
};
|
|
485
|
-
|
|
483
|
+
|
|
486
484
|
if (!stencilStoreOp.IsEmpty() && stencilStoreOp->IsString()) {
|
|
487
485
|
auto value = ConvertFromV8String(isolate, stencilStoreOp);
|
|
488
486
|
if (value == "store") {
|
|
@@ -497,100 +495,101 @@ void GPUCommandEncoderImpl::BeginRenderPass(const v8::FunctionCallbackInfo<v8::V
|
|
|
497
495
|
};
|
|
498
496
|
}
|
|
499
497
|
}
|
|
500
|
-
|
|
501
|
-
|
|
498
|
+
|
|
499
|
+
|
|
502
500
|
v8::Local<v8::Value> stencilReadOnly;
|
|
503
501
|
depthStencilAttachmentObj->Get(context, ConvertToV8String(isolate,
|
|
504
502
|
"stencilReadOnly")).ToLocal(
|
|
505
|
-
|
|
506
|
-
|
|
503
|
+
&stencilReadOnly);
|
|
504
|
+
|
|
507
505
|
depthStencilAttachment->stencil_read_only = false;
|
|
508
506
|
if (!stencilReadOnly.IsEmpty() && stencilReadOnly->IsBoolean()) {
|
|
509
507
|
depthStencilAttachment->stencil_read_only = stencilReadOnly->BooleanValue(isolate);
|
|
510
508
|
}
|
|
511
|
-
|
|
509
|
+
|
|
512
510
|
}
|
|
513
|
-
|
|
511
|
+
|
|
514
512
|
const CanvasGPUQuerySet *occlusion_query_set = nullptr;
|
|
515
513
|
v8::Local<v8::Value> occlusionQuerySetVal;
|
|
516
|
-
|
|
517
|
-
|
|
514
|
+
|
|
515
|
+
|
|
518
516
|
desc->Get(context, ConvertToV8String(isolate, "occlusionQuerySet")).ToLocal(
|
|
519
|
-
|
|
520
|
-
|
|
517
|
+
&occlusionQuerySetVal);
|
|
518
|
+
|
|
521
519
|
|
|
522
520
|
if (GetNativeType(occlusionQuerySetVal) == NativeType::GPUQuerySet) {
|
|
523
521
|
auto occlusionQuerySet = GPUQuerySetImpl::GetPointer(
|
|
524
|
-
|
|
522
|
+
occlusionQuerySetVal.As<v8::Object>());
|
|
525
523
|
occlusion_query_set = occlusionQuerySet->GetQuerySet();
|
|
526
524
|
}
|
|
527
|
-
|
|
528
|
-
|
|
525
|
+
|
|
526
|
+
|
|
529
527
|
v8::Local<v8::Value> timestampWritesVal;
|
|
530
528
|
desc->Get(context, ConvertToV8String(isolate, "timestampWrites")).ToLocal(
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
529
|
+
×tampWritesVal);
|
|
530
|
+
|
|
531
|
+
|
|
534
532
|
const CanvasGPUQuerySet *querySet = nullptr;
|
|
535
533
|
int32_t beginningOfPassWriteIndex = -1;
|
|
536
534
|
int32_t endOfPassWriteIndex = -1;
|
|
537
|
-
|
|
535
|
+
|
|
538
536
|
if (!timestampWritesVal.IsEmpty() && timestampWritesVal->IsObject()) {
|
|
539
537
|
auto timestampWrites = timestampWritesVal.As<v8::Object>();
|
|
540
538
|
v8::Local<v8::Value> querySetVal;
|
|
541
539
|
timestampWrites->Get(context, ConvertToV8String(isolate, "querySet")).ToLocal(
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
540
|
+
&querySetVal);
|
|
541
|
+
|
|
542
|
+
|
|
545
543
|
if (GetNativeType(querySetVal) == NativeType::GPUQuerySet) {
|
|
546
544
|
auto queryPtr = GPUQuerySetImpl::GetPointer(querySetVal.As<v8::Object>());
|
|
547
545
|
if (queryPtr != nullptr) {
|
|
548
546
|
querySet = queryPtr->GetQuerySet();
|
|
549
547
|
}
|
|
550
548
|
}
|
|
551
|
-
|
|
549
|
+
|
|
552
550
|
v8::Local<v8::Value> beginningOfPassWriteIndexVal;
|
|
553
|
-
|
|
551
|
+
|
|
554
552
|
v8::Local<v8::Value> endOfPassWriteIndexVal;
|
|
555
|
-
|
|
556
|
-
|
|
553
|
+
|
|
554
|
+
|
|
557
555
|
auto beginningOfPassWriteIndexValSuccess = timestampWrites->Get(context,
|
|
558
556
|
ConvertToV8String(
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
557
|
+
isolate,
|
|
558
|
+
"beginningOfPassWriteIndex")).ToLocal(
|
|
559
|
+
&beginningOfPassWriteIndexVal);
|
|
560
|
+
|
|
563
561
|
auto endOfPassWriteIndexValSuccess = timestampWrites->Get(context,
|
|
564
562
|
ConvertToV8String(isolate,
|
|
565
563
|
"endOfPassWriteIndex")).ToLocal(
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
564
|
+
&endOfPassWriteIndexVal);
|
|
565
|
+
|
|
566
|
+
|
|
569
567
|
if (beginningOfPassWriteIndexValSuccess && beginningOfPassWriteIndexVal->IsInt32()) {
|
|
570
568
|
beginningOfPassWriteIndex = beginningOfPassWriteIndexVal.As<v8::Int32>()->Value();
|
|
571
569
|
}
|
|
572
|
-
|
|
570
|
+
|
|
573
571
|
if (endOfPassWriteIndexValSuccess && endOfPassWriteIndexVal->IsInt32()) {
|
|
574
572
|
endOfPassWriteIndex = endOfPassWriteIndexVal.As<v8::Int32>()->Value();
|
|
575
573
|
}
|
|
576
|
-
|
|
574
|
+
|
|
577
575
|
}
|
|
578
|
-
|
|
579
|
-
|
|
576
|
+
|
|
577
|
+
|
|
580
578
|
pass = canvas_native_webgpu_command_encoder_begin_render_pass(
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
579
|
+
ptr->GetEncoder(), label.c_str(), colorAttachments_.data(), colorAttachments_.size(),
|
|
580
|
+
depthStencilAttachment, occlusion_query_set,
|
|
581
|
+
querySet, beginningOfPassWriteIndex, endOfPassWriteIndex
|
|
582
|
+
);
|
|
583
|
+
|
|
586
584
|
if (depthStencilAttachment != nullptr) {
|
|
587
585
|
delete depthStencilAttachment;
|
|
586
|
+
depthStencilAttachment = nullptr;
|
|
588
587
|
}
|
|
589
|
-
|
|
590
|
-
|
|
588
|
+
|
|
589
|
+
|
|
591
590
|
}
|
|
592
|
-
|
|
593
|
-
|
|
591
|
+
|
|
592
|
+
|
|
594
593
|
if (pass != nullptr) {
|
|
595
594
|
auto value = new GPURenderPassEncoderImpl(pass);
|
|
596
595
|
auto ret = GPURenderPassEncoderImpl::NewInstance(isolate, value);
|
|
@@ -598,7 +597,7 @@ void GPUCommandEncoderImpl::BeginRenderPass(const v8::FunctionCallbackInfo<v8::V
|
|
|
598
597
|
} else {
|
|
599
598
|
args.GetReturnValue().SetUndefined();
|
|
600
599
|
}
|
|
601
|
-
|
|
600
|
+
|
|
602
601
|
}
|
|
603
602
|
|
|
604
603
|
void GPUCommandEncoderImpl::ClearBuffer(const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
@@ -606,37 +605,37 @@ void GPUCommandEncoderImpl::ClearBuffer(const v8::FunctionCallbackInfo<v8::Value
|
|
|
606
605
|
if (ptr == nullptr) {
|
|
607
606
|
return;
|
|
608
607
|
}
|
|
609
|
-
|
|
608
|
+
|
|
610
609
|
auto bufferVal = args[0];
|
|
611
610
|
const CanvasGPUBuffer *buffer = nullptr;
|
|
612
|
-
|
|
611
|
+
|
|
613
612
|
if (bufferVal->IsObject()) {
|
|
614
613
|
auto bufferPtr = GPUBufferImpl::GetPointer(bufferVal.As<v8::Object>());
|
|
615
614
|
if (bufferPtr != nullptr) {
|
|
616
615
|
buffer = bufferPtr->GetGPUBuffer();
|
|
617
616
|
}
|
|
618
617
|
}
|
|
619
|
-
|
|
618
|
+
|
|
620
619
|
if (buffer == nullptr) {
|
|
621
620
|
return;
|
|
622
621
|
}
|
|
623
|
-
|
|
622
|
+
|
|
624
623
|
int64_t offset = -1;
|
|
625
624
|
auto offsetVal = args[1];
|
|
626
|
-
|
|
625
|
+
|
|
627
626
|
if (offsetVal->IsNumber()) {
|
|
628
627
|
offset = (int64_t) offsetVal.As<v8::Number>()->Value();
|
|
629
628
|
}
|
|
630
|
-
|
|
629
|
+
|
|
631
630
|
int64_t size = -1;
|
|
632
631
|
auto sizeVal = args[2];
|
|
633
|
-
|
|
632
|
+
|
|
634
633
|
if (sizeVal->IsNumber()) {
|
|
635
634
|
size = (int64_t) sizeVal.As<v8::Number>()->Value();
|
|
636
635
|
}
|
|
637
|
-
|
|
636
|
+
|
|
638
637
|
canvas_native_webgpu_command_encoder_clear_buffer(ptr->GetEncoder(), buffer, offset, size);
|
|
639
|
-
|
|
638
|
+
|
|
640
639
|
}
|
|
641
640
|
|
|
642
641
|
void GPUCommandEncoderImpl::CopyBufferToBuffer(const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
@@ -646,7 +645,7 @@ void GPUCommandEncoderImpl::CopyBufferToBuffer(const v8::FunctionCallbackInfo<v8
|
|
|
646
645
|
}
|
|
647
646
|
auto isolate = args.GetIsolate();
|
|
648
647
|
auto context = isolate->GetCurrentContext();
|
|
649
|
-
|
|
648
|
+
|
|
650
649
|
auto source = args[0];
|
|
651
650
|
auto sourceType = GetNativeType(source);
|
|
652
651
|
auto sourceOffset = args[1];
|
|
@@ -654,22 +653,22 @@ void GPUCommandEncoderImpl::CopyBufferToBuffer(const v8::FunctionCallbackInfo<v8
|
|
|
654
653
|
auto destinationType = GetNativeType(destination);
|
|
655
654
|
auto destinationOffset = args[3];
|
|
656
655
|
auto size = args[4];
|
|
657
|
-
|
|
656
|
+
|
|
658
657
|
if (sourceType == NativeType::GPUBuffer && destinationType == NativeType::GPUBuffer) {
|
|
659
658
|
auto src = GPUBufferImpl::GetPointer(source.As<v8::Object>());
|
|
660
659
|
auto dst = GPUBufferImpl::GetPointer(destination.As<v8::Object>());
|
|
661
660
|
canvas_native_webgpu_command_encoder_copy_buffer_to_buffer(ptr->GetEncoder(),
|
|
662
661
|
src->GetGPUBuffer(),
|
|
663
662
|
(int64_t) sourceOffset->NumberValue(
|
|
664
|
-
|
|
663
|
+
context).FromJust(),
|
|
665
664
|
dst->GetGPUBuffer(),
|
|
666
665
|
(int64_t) destinationOffset->NumberValue(
|
|
667
|
-
|
|
666
|
+
context).FromJust(),
|
|
668
667
|
(uint64_t) size->NumberValue(
|
|
669
|
-
|
|
670
|
-
|
|
668
|
+
context).FromJust()
|
|
669
|
+
);
|
|
671
670
|
}
|
|
672
|
-
|
|
671
|
+
|
|
673
672
|
}
|
|
674
673
|
|
|
675
674
|
void GPUCommandEncoderImpl::CopyBufferToTexture(const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
@@ -677,15 +676,15 @@ void GPUCommandEncoderImpl::CopyBufferToTexture(const v8::FunctionCallbackInfo<v
|
|
|
677
676
|
if (ptr == nullptr) {
|
|
678
677
|
return;
|
|
679
678
|
}
|
|
680
|
-
|
|
681
|
-
|
|
679
|
+
|
|
680
|
+
|
|
682
681
|
auto isolate = args.GetIsolate();
|
|
683
682
|
auto context = isolate->GetCurrentContext();
|
|
684
|
-
|
|
683
|
+
|
|
685
684
|
auto source = args[0];
|
|
686
685
|
auto destination = args[1];
|
|
687
686
|
auto copySize = args[2];
|
|
688
|
-
|
|
687
|
+
|
|
689
688
|
if (source->IsObject() && destination->IsObject() && copySize->IsObject()) {
|
|
690
689
|
const CanvasGPUBuffer *buffer = nullptr;
|
|
691
690
|
auto src = source.As<v8::Object>();
|
|
@@ -696,73 +695,73 @@ void GPUCommandEncoderImpl::CopyBufferToTexture(const v8::FunctionCallbackInfo<v
|
|
|
696
695
|
}
|
|
697
696
|
uint64_t offset = 0;
|
|
698
697
|
int32_t rowsPerImage = -1;
|
|
699
|
-
|
|
698
|
+
|
|
700
699
|
v8::Local<v8::Value> rowsPerImageVal;
|
|
701
|
-
|
|
700
|
+
|
|
702
701
|
src->Get(context, ConvertToV8String(isolate, "rowsPerImage")).ToLocal(&rowsPerImageVal);
|
|
703
|
-
|
|
702
|
+
|
|
704
703
|
if (!rowsPerImageVal.IsEmpty() && rowsPerImageVal->IsInt32()) {
|
|
705
704
|
rowsPerImage = rowsPerImageVal->Int32Value(context).FromJust();
|
|
706
705
|
}
|
|
707
|
-
|
|
708
|
-
|
|
706
|
+
|
|
707
|
+
|
|
709
708
|
v8::Local<v8::Value> offsetVal;
|
|
710
|
-
|
|
709
|
+
|
|
711
710
|
src->Get(context, ConvertToV8String(isolate, "offset")).ToLocal(&offsetVal);
|
|
712
|
-
|
|
711
|
+
|
|
713
712
|
if (!offsetVal.IsEmpty() && offsetVal->IsNumber()) {
|
|
714
713
|
offset = (int64_t) offsetVal->NumberValue(context).FromJust();
|
|
715
714
|
}
|
|
716
|
-
|
|
715
|
+
|
|
717
716
|
v8::Local<v8::Value> bytesPerRowVal;
|
|
718
|
-
|
|
717
|
+
|
|
719
718
|
src->Get(context, ConvertToV8String(isolate, "bytesPerRow")).ToLocal(&bytesPerRowVal);
|
|
720
|
-
|
|
719
|
+
|
|
721
720
|
CanvasImageCopyBuffer copy{
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
721
|
+
buffer,
|
|
722
|
+
offset,
|
|
723
|
+
bytesPerRowVal->Int32Value(context).FromJust(),
|
|
724
|
+
rowsPerImage
|
|
726
725
|
};
|
|
727
|
-
|
|
728
|
-
|
|
726
|
+
|
|
727
|
+
|
|
729
728
|
uint32_t mipLevel = 0;
|
|
730
729
|
CanvasOrigin3d origin{0, 0, 0};
|
|
731
730
|
CanvasTextureAspect aspect = CanvasTextureAspectAll;
|
|
732
|
-
|
|
731
|
+
|
|
733
732
|
const CanvasGPUTexture *texture = nullptr;
|
|
734
733
|
auto dst = destination.As<v8::Object>();
|
|
735
|
-
|
|
736
|
-
|
|
734
|
+
|
|
735
|
+
|
|
737
736
|
v8::Local<v8::Value> textureVal;
|
|
738
737
|
dst->Get(context, ConvertToV8String(isolate, "texture")).ToLocal(&textureVal);
|
|
739
738
|
if (GetNativeType(textureVal) == NativeType::GPUTexture) {
|
|
740
739
|
texture = GPUTextureImpl::GetPointer(textureVal.As<v8::Object>())->GetTexture();
|
|
741
740
|
}
|
|
742
|
-
|
|
743
|
-
|
|
741
|
+
|
|
742
|
+
|
|
744
743
|
v8::Local<v8::Value> mipLevelVal;
|
|
745
744
|
dst->Get(context, ConvertToV8String(isolate, "mipLevel")).ToLocal(&mipLevelVal);
|
|
746
|
-
|
|
745
|
+
|
|
747
746
|
if (!mipLevelVal.IsEmpty() && mipLevelVal->IsUint32()) {
|
|
748
747
|
mipLevel = mipLevelVal->Uint32Value(context).FromJust();
|
|
749
748
|
}
|
|
750
|
-
|
|
749
|
+
|
|
751
750
|
v8::Local<v8::Value> originVal;
|
|
752
751
|
dst->Get(context, ConvertToV8String(isolate, "origin")).ToLocal(&originVal);
|
|
753
|
-
|
|
754
|
-
|
|
752
|
+
|
|
753
|
+
|
|
755
754
|
if (!originVal.IsEmpty() && originVal->IsObject()) {
|
|
756
755
|
auto originObj = originVal.As<v8::Object>();
|
|
757
|
-
|
|
758
|
-
|
|
756
|
+
|
|
757
|
+
|
|
759
758
|
v8::Local<v8::Value> xVal;
|
|
760
759
|
v8::Local<v8::Value> yVal;
|
|
761
760
|
v8::Local<v8::Value> zVal;
|
|
762
761
|
originObj->Get(context, ConvertToV8String(isolate, "x")).ToLocal(&xVal);
|
|
763
762
|
originObj->Get(context, ConvertToV8String(isolate, "y")).ToLocal(&yVal);
|
|
764
763
|
originObj->Get(context, ConvertToV8String(isolate, "z")).ToLocal(&zVal);
|
|
765
|
-
|
|
764
|
+
|
|
766
765
|
if (xVal->IsUint32()) {
|
|
767
766
|
origin.x = xVal->Uint32Value(context).FromJust();
|
|
768
767
|
}
|
|
@@ -772,36 +771,36 @@ void GPUCommandEncoderImpl::CopyBufferToTexture(const v8::FunctionCallbackInfo<v
|
|
|
772
771
|
if (zVal->IsUint32()) {
|
|
773
772
|
origin.z = zVal->Uint32Value(context).FromJust();
|
|
774
773
|
}
|
|
775
|
-
|
|
774
|
+
|
|
776
775
|
}
|
|
777
|
-
|
|
778
|
-
|
|
776
|
+
|
|
777
|
+
|
|
779
778
|
v8::Local<v8::Value> aspectVal;
|
|
780
779
|
dst->Get(context, ConvertToV8String(isolate, "aspect")).ToLocal(&aspectVal);
|
|
781
|
-
|
|
782
|
-
|
|
780
|
+
|
|
781
|
+
|
|
783
782
|
auto aspectStr = ConvertFromV8String(isolate, aspectVal);
|
|
784
|
-
|
|
783
|
+
|
|
785
784
|
if (aspectStr == "stencil-only") {
|
|
786
785
|
aspect = CanvasTextureAspectStencilOnly;
|
|
787
786
|
} else if (aspectStr == "depth-only") {
|
|
788
787
|
aspect = CanvasTextureAspectDepthOnly;
|
|
789
788
|
}
|
|
790
|
-
|
|
789
|
+
|
|
791
790
|
CanvasImageCopyTexture ct{
|
|
792
|
-
|
|
791
|
+
texture, mipLevel, origin, aspect
|
|
793
792
|
};
|
|
794
|
-
|
|
793
|
+
|
|
795
794
|
CanvasExtent3d cz = ParseExtent3d(isolate, copySize);
|
|
796
795
|
canvas_native_webgpu_command_encoder_copy_buffer_to_texture(
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
796
|
+
ptr->GetEncoder(),
|
|
797
|
+
©,
|
|
798
|
+
&ct,
|
|
799
|
+
&cz
|
|
800
|
+
);
|
|
802
801
|
}
|
|
803
|
-
|
|
804
|
-
|
|
802
|
+
|
|
803
|
+
|
|
805
804
|
}
|
|
806
805
|
|
|
807
806
|
void GPUCommandEncoderImpl::CopyTextureToBuffer(const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
@@ -809,20 +808,20 @@ void GPUCommandEncoderImpl::CopyTextureToBuffer(const v8::FunctionCallbackInfo<v
|
|
|
809
808
|
if (ptr == nullptr) {
|
|
810
809
|
return;
|
|
811
810
|
}
|
|
812
|
-
|
|
813
|
-
|
|
811
|
+
|
|
812
|
+
|
|
814
813
|
auto isolate = args.GetIsolate();
|
|
815
814
|
auto context = isolate->GetCurrentContext();
|
|
816
|
-
|
|
815
|
+
|
|
817
816
|
// copying texture to buffer swapped the real source and dst
|
|
818
817
|
auto source = args[1];
|
|
819
818
|
auto destination = args[0];
|
|
820
819
|
auto copySize = args[2];
|
|
821
|
-
|
|
820
|
+
|
|
822
821
|
if (source->IsObject() && destination->IsObject() && copySize->IsObject()) {
|
|
823
822
|
const CanvasGPUBuffer *buffer = nullptr;
|
|
824
823
|
auto src = source.As<v8::Object>();
|
|
825
|
-
|
|
824
|
+
|
|
826
825
|
v8::Local<v8::Value> bufferVal;
|
|
827
826
|
src->Get(context, ConvertToV8String(isolate, "buffer")).ToLocal(&bufferVal);
|
|
828
827
|
if (GetNativeType(bufferVal) == NativeType::GPUBuffer) {
|
|
@@ -830,73 +829,73 @@ void GPUCommandEncoderImpl::CopyTextureToBuffer(const v8::FunctionCallbackInfo<v
|
|
|
830
829
|
}
|
|
831
830
|
uint64_t offset = 0;
|
|
832
831
|
int32_t rowsPerImage = -1;
|
|
833
|
-
|
|
832
|
+
|
|
834
833
|
v8::Local<v8::Value> rowsPerImageVal;
|
|
835
|
-
|
|
834
|
+
|
|
836
835
|
src->Get(context, ConvertToV8String(isolate, "rowsPerImage")).ToLocal(&rowsPerImageVal);
|
|
837
|
-
|
|
836
|
+
|
|
838
837
|
if (!rowsPerImageVal.IsEmpty() && rowsPerImageVal->IsInt32()) {
|
|
839
838
|
rowsPerImage = rowsPerImageVal->Int32Value(context).FromJust();
|
|
840
839
|
}
|
|
841
|
-
|
|
842
|
-
|
|
840
|
+
|
|
841
|
+
|
|
843
842
|
v8::Local<v8::Value> offsetVal;
|
|
844
|
-
|
|
843
|
+
|
|
845
844
|
src->Get(context, ConvertToV8String(isolate, "offset")).ToLocal(&offsetVal);
|
|
846
|
-
|
|
845
|
+
|
|
847
846
|
if (!offsetVal.IsEmpty() && offsetVal->IsNumber()) {
|
|
848
847
|
offset = (int64_t) offsetVal->NumberValue(context).FromJust();
|
|
849
848
|
}
|
|
850
|
-
|
|
849
|
+
|
|
851
850
|
v8::Local<v8::Value> bytesPerRowVal;
|
|
852
|
-
|
|
851
|
+
|
|
853
852
|
src->Get(context, ConvertToV8String(isolate, "bytesPerRow")).ToLocal(&bytesPerRowVal);
|
|
854
|
-
|
|
853
|
+
|
|
855
854
|
CanvasImageCopyBuffer copy{
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
855
|
+
buffer,
|
|
856
|
+
offset,
|
|
857
|
+
bytesPerRowVal->Int32Value(context).FromJust(),
|
|
858
|
+
rowsPerImage
|
|
860
859
|
};
|
|
861
|
-
|
|
862
|
-
|
|
860
|
+
|
|
861
|
+
|
|
863
862
|
uint32_t mipLevel = 0;
|
|
864
863
|
CanvasOrigin3d origin{0, 0, 0};
|
|
865
864
|
CanvasTextureAspect aspect = CanvasTextureAspectAll;
|
|
866
|
-
|
|
865
|
+
|
|
867
866
|
const CanvasGPUTexture *texture = nullptr;
|
|
868
867
|
auto dst = destination.As<v8::Object>();
|
|
869
|
-
|
|
870
|
-
|
|
868
|
+
|
|
869
|
+
|
|
871
870
|
v8::Local<v8::Value> textureVal;
|
|
872
871
|
dst->Get(context, ConvertToV8String(isolate, "texture")).ToLocal(&textureVal);
|
|
873
872
|
if (GetNativeType(textureVal) == NativeType::GPUTexture) {
|
|
874
873
|
texture = GPUTextureImpl::GetPointer(textureVal.As<v8::Object>())->GetTexture();
|
|
875
874
|
}
|
|
876
|
-
|
|
877
|
-
|
|
875
|
+
|
|
876
|
+
|
|
878
877
|
v8::Local<v8::Value> mipLevelVal;
|
|
879
878
|
dst->Get(context, ConvertToV8String(isolate, "mipLevel")).ToLocal(&mipLevelVal);
|
|
880
|
-
|
|
879
|
+
|
|
881
880
|
if (!mipLevelVal.IsEmpty() && mipLevelVal->IsUint32()) {
|
|
882
881
|
mipLevel = mipLevelVal->Uint32Value(context).FromJust();
|
|
883
882
|
}
|
|
884
|
-
|
|
883
|
+
|
|
885
884
|
v8::Local<v8::Value> originVal;
|
|
886
885
|
dst->Get(context, ConvertToV8String(isolate, "origin")).ToLocal(&originVal);
|
|
887
|
-
|
|
888
|
-
|
|
886
|
+
|
|
887
|
+
|
|
889
888
|
if (!originVal.IsEmpty() && originVal->IsObject()) {
|
|
890
889
|
auto originObj = originVal.As<v8::Object>();
|
|
891
|
-
|
|
892
|
-
|
|
890
|
+
|
|
891
|
+
|
|
893
892
|
v8::Local<v8::Value> xVal;
|
|
894
893
|
v8::Local<v8::Value> yVal;
|
|
895
894
|
v8::Local<v8::Value> zVal;
|
|
896
895
|
originObj->Get(context, ConvertToV8String(isolate, "x")).ToLocal(&xVal);
|
|
897
896
|
originObj->Get(context, ConvertToV8String(isolate, "y")).ToLocal(&yVal);
|
|
898
897
|
originObj->Get(context, ConvertToV8String(isolate, "z")).ToLocal(&zVal);
|
|
899
|
-
|
|
898
|
+
|
|
900
899
|
if (xVal->IsUint32()) {
|
|
901
900
|
origin.x = xVal->Uint32Value(context).FromJust();
|
|
902
901
|
}
|
|
@@ -906,36 +905,36 @@ void GPUCommandEncoderImpl::CopyTextureToBuffer(const v8::FunctionCallbackInfo<v
|
|
|
906
905
|
if (zVal->IsUint32()) {
|
|
907
906
|
origin.z = zVal->Uint32Value(context).FromJust();
|
|
908
907
|
}
|
|
909
|
-
|
|
908
|
+
|
|
910
909
|
}
|
|
911
|
-
|
|
912
|
-
|
|
910
|
+
|
|
911
|
+
|
|
913
912
|
v8::Local<v8::Value> aspectVal;
|
|
914
913
|
dst->Get(context, ConvertToV8String(isolate, "aspect")).ToLocal(&aspectVal);
|
|
915
|
-
|
|
916
|
-
|
|
914
|
+
|
|
915
|
+
|
|
917
916
|
auto aspectStr = ConvertFromV8String(isolate, aspectVal);
|
|
918
|
-
|
|
917
|
+
|
|
919
918
|
if (aspectStr == "stencil-only") {
|
|
920
919
|
aspect = CanvasTextureAspectStencilOnly;
|
|
921
920
|
} else if (aspectStr == "depth-only") {
|
|
922
921
|
aspect = CanvasTextureAspectDepthOnly;
|
|
923
922
|
}
|
|
924
|
-
|
|
923
|
+
|
|
925
924
|
CanvasImageCopyTexture ct{
|
|
926
|
-
|
|
925
|
+
texture, mipLevel, origin, aspect
|
|
927
926
|
};
|
|
928
|
-
|
|
927
|
+
|
|
929
928
|
CanvasExtent3d cz = ParseExtent3d(isolate, copySize);
|
|
930
929
|
canvas_native_webgpu_command_encoder_copy_texture_to_buffer(
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
930
|
+
ptr->GetEncoder(),
|
|
931
|
+
&ct,
|
|
932
|
+
©,
|
|
933
|
+
&cz
|
|
934
|
+
);
|
|
936
935
|
}
|
|
937
|
-
|
|
938
|
-
|
|
936
|
+
|
|
937
|
+
|
|
939
938
|
}
|
|
940
939
|
|
|
941
940
|
void GPUCommandEncoderImpl::CopyTextureToTexture(const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
@@ -943,51 +942,51 @@ void GPUCommandEncoderImpl::CopyTextureToTexture(const v8::FunctionCallbackInfo<
|
|
|
943
942
|
if (ptr == nullptr) {
|
|
944
943
|
return;
|
|
945
944
|
}
|
|
946
|
-
|
|
945
|
+
|
|
947
946
|
auto isolate = args.GetIsolate();
|
|
948
947
|
auto context = isolate->GetCurrentContext();
|
|
949
|
-
|
|
948
|
+
|
|
950
949
|
// copying texture to buffer swapped the real source and dst
|
|
951
950
|
auto source = args[0];
|
|
952
951
|
auto destination = args[1];
|
|
953
952
|
auto copySize = args[2];
|
|
954
|
-
|
|
953
|
+
|
|
955
954
|
if (source->IsObject() && destination->IsObject() && copySize->IsObject()) {
|
|
956
955
|
auto src = source.As<v8::Object>();
|
|
957
|
-
|
|
956
|
+
|
|
958
957
|
uint32_t mipLevelA = 0;
|
|
959
958
|
CanvasOrigin3d originA{0, 0, 0};
|
|
960
959
|
CanvasTextureAspect aspectA = CanvasTextureAspectAll;
|
|
961
|
-
|
|
960
|
+
|
|
962
961
|
const CanvasGPUTexture *textureA = nullptr;
|
|
963
|
-
|
|
962
|
+
|
|
964
963
|
v8::Local<v8::Value> srcTextureVal;
|
|
965
964
|
src->Get(context, ConvertToV8String(isolate, "texture")).ToLocal(&srcTextureVal);
|
|
966
965
|
if (GetNativeType(srcTextureVal) == NativeType::GPUTexture) {
|
|
967
966
|
textureA = GPUTextureImpl::GetPointer(srcTextureVal.As<v8::Object>())->GetTexture();
|
|
968
967
|
}
|
|
969
|
-
|
|
968
|
+
|
|
970
969
|
v8::Local<v8::Value> mipLevelAVal;
|
|
971
970
|
src->Get(context, ConvertToV8String(isolate, "mipLevel")).ToLocal(&mipLevelAVal);
|
|
972
|
-
|
|
971
|
+
|
|
973
972
|
if (!mipLevelAVal.IsEmpty() && mipLevelAVal->IsUint32()) {
|
|
974
973
|
mipLevelA = mipLevelAVal->Uint32Value(context).FromJust();
|
|
975
974
|
}
|
|
976
|
-
|
|
975
|
+
|
|
977
976
|
v8::Local<v8::Value> originAVal;
|
|
978
977
|
src->Get(context, ConvertToV8String(isolate, "origin")).ToLocal(&originAVal);
|
|
979
|
-
|
|
980
|
-
|
|
978
|
+
|
|
979
|
+
|
|
981
980
|
if (!originAVal.IsEmpty() && originAVal->IsObject()) {
|
|
982
981
|
auto originObj = originAVal.As<v8::Object>();
|
|
983
|
-
|
|
982
|
+
|
|
984
983
|
v8::Local<v8::Value> xVal;
|
|
985
984
|
v8::Local<v8::Value> yVal;
|
|
986
985
|
v8::Local<v8::Value> zVal;
|
|
987
986
|
originObj->Get(context, ConvertToV8String(isolate, "x")).ToLocal(&xVal);
|
|
988
987
|
originObj->Get(context, ConvertToV8String(isolate, "y")).ToLocal(&yVal);
|
|
989
988
|
originObj->Get(context, ConvertToV8String(isolate, "z")).ToLocal(&zVal);
|
|
990
|
-
|
|
989
|
+
|
|
991
990
|
if (xVal->IsUint32()) {
|
|
992
991
|
originA.x = xVal->Uint32Value(context).FromJust();
|
|
993
992
|
}
|
|
@@ -997,58 +996,58 @@ void GPUCommandEncoderImpl::CopyTextureToTexture(const v8::FunctionCallbackInfo<
|
|
|
997
996
|
if (zVal->IsUint32()) {
|
|
998
997
|
originA.z = zVal->Uint32Value(context).FromJust();
|
|
999
998
|
}
|
|
1000
|
-
|
|
999
|
+
|
|
1001
1000
|
}
|
|
1002
|
-
|
|
1001
|
+
|
|
1003
1002
|
v8::Local<v8::Value> aspectAVal;
|
|
1004
1003
|
src->Get(context, ConvertToV8String(isolate, "aspect")).ToLocal(&aspectAVal);
|
|
1005
|
-
|
|
1004
|
+
|
|
1006
1005
|
auto aspectAStr = ConvertFromV8String(isolate, aspectAVal);
|
|
1007
|
-
|
|
1006
|
+
|
|
1008
1007
|
if (aspectAStr == "stencil-only") {
|
|
1009
1008
|
aspectA = CanvasTextureAspectStencilOnly;
|
|
1010
1009
|
} else if (aspectAStr == "depth-only") {
|
|
1011
1010
|
aspectA = CanvasTextureAspectDepthOnly;
|
|
1012
1011
|
}
|
|
1013
1012
|
CanvasImageCopyTexture copy{
|
|
1014
|
-
|
|
1013
|
+
textureA, mipLevelA, originA, aspectA
|
|
1015
1014
|
};
|
|
1016
|
-
|
|
1015
|
+
|
|
1017
1016
|
uint32_t mipLevel = 0;
|
|
1018
1017
|
CanvasOrigin3d origin{0, 0, 0};
|
|
1019
1018
|
CanvasTextureAspect aspect = CanvasTextureAspectAll;
|
|
1020
|
-
|
|
1019
|
+
|
|
1021
1020
|
const CanvasGPUTexture *texture = nullptr;
|
|
1022
1021
|
auto dst = destination.As<v8::Object>();
|
|
1023
|
-
|
|
1024
|
-
|
|
1022
|
+
|
|
1023
|
+
|
|
1025
1024
|
v8::Local<v8::Value> textureVal;
|
|
1026
1025
|
dst->Get(context, ConvertToV8String(isolate, "texture")).ToLocal(&textureVal);
|
|
1027
1026
|
if (GetNativeType(textureVal) == NativeType::GPUTexture) {
|
|
1028
1027
|
texture = GPUTextureImpl::GetPointer(textureVal.As<v8::Object>())->GetTexture();
|
|
1029
1028
|
}
|
|
1030
|
-
|
|
1031
|
-
|
|
1029
|
+
|
|
1030
|
+
|
|
1032
1031
|
v8::Local<v8::Value> mipLevelVal;
|
|
1033
1032
|
dst->Get(context, ConvertToV8String(isolate, "mipLevel")).ToLocal(&mipLevelVal);
|
|
1034
|
-
|
|
1033
|
+
|
|
1035
1034
|
if (!mipLevelVal.IsEmpty() && mipLevelVal->IsUint32()) {
|
|
1036
1035
|
mipLevel = mipLevelVal->Uint32Value(context).FromJust();
|
|
1037
1036
|
}
|
|
1038
|
-
|
|
1037
|
+
|
|
1039
1038
|
v8::Local<v8::Value> originVal;
|
|
1040
1039
|
dst->Get(context, ConvertToV8String(isolate, "origin")).ToLocal(&originVal);
|
|
1041
|
-
|
|
1040
|
+
|
|
1042
1041
|
if (!originVal.IsEmpty() && originVal->IsObject()) {
|
|
1043
1042
|
auto originObj = originVal.As<v8::Object>();
|
|
1044
|
-
|
|
1043
|
+
|
|
1045
1044
|
v8::Local<v8::Value> xVal;
|
|
1046
1045
|
v8::Local<v8::Value> yVal;
|
|
1047
1046
|
v8::Local<v8::Value> zVal;
|
|
1048
1047
|
originObj->Get(context, ConvertToV8String(isolate, "x")).ToLocal(&xVal);
|
|
1049
1048
|
originObj->Get(context, ConvertToV8String(isolate, "y")).ToLocal(&yVal);
|
|
1050
1049
|
originObj->Get(context, ConvertToV8String(isolate, "z")).ToLocal(&zVal);
|
|
1051
|
-
|
|
1050
|
+
|
|
1052
1051
|
if (xVal->IsUint32()) {
|
|
1053
1052
|
origin.x = xVal->Uint32Value(context).FromJust();
|
|
1054
1053
|
}
|
|
@@ -1058,36 +1057,36 @@ void GPUCommandEncoderImpl::CopyTextureToTexture(const v8::FunctionCallbackInfo<
|
|
|
1058
1057
|
if (zVal->IsUint32()) {
|
|
1059
1058
|
origin.z = zVal->Uint32Value(context).FromJust();
|
|
1060
1059
|
}
|
|
1061
|
-
|
|
1060
|
+
|
|
1062
1061
|
}
|
|
1063
|
-
|
|
1064
|
-
|
|
1062
|
+
|
|
1063
|
+
|
|
1065
1064
|
v8::Local<v8::Value> aspectVal;
|
|
1066
1065
|
dst->Get(context, ConvertToV8String(isolate, "aspect")).ToLocal(&aspectVal);
|
|
1067
|
-
|
|
1066
|
+
|
|
1068
1067
|
auto aspectStr = ConvertFromV8String(isolate, aspectVal);
|
|
1069
|
-
|
|
1068
|
+
|
|
1070
1069
|
if (aspectStr == "stencil-only") {
|
|
1071
1070
|
aspect = CanvasTextureAspectStencilOnly;
|
|
1072
1071
|
} else if (aspectStr == "depth-only") {
|
|
1073
1072
|
aspect = CanvasTextureAspectDepthOnly;
|
|
1074
1073
|
}
|
|
1075
|
-
|
|
1074
|
+
|
|
1076
1075
|
CanvasImageCopyTexture ct{
|
|
1077
|
-
|
|
1076
|
+
texture, mipLevel, origin, aspect
|
|
1078
1077
|
};
|
|
1079
|
-
|
|
1078
|
+
|
|
1080
1079
|
CanvasExtent3d cz = ParseExtent3d(isolate, copySize);
|
|
1081
|
-
|
|
1080
|
+
|
|
1082
1081
|
canvas_native_webgpu_command_encoder_copy_texture_to_texture(
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1082
|
+
ptr->GetEncoder(),
|
|
1083
|
+
©,
|
|
1084
|
+
&ct,
|
|
1085
|
+
&cz
|
|
1086
|
+
);
|
|
1088
1087
|
}
|
|
1089
|
-
|
|
1090
|
-
|
|
1088
|
+
|
|
1089
|
+
|
|
1091
1090
|
}
|
|
1092
1091
|
|
|
1093
1092
|
void GPUCommandEncoderImpl::Finish(const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
@@ -1095,11 +1094,10 @@ void GPUCommandEncoderImpl::Finish(const v8::FunctionCallbackInfo<v8::Value> &ar
|
|
|
1095
1094
|
if (ptr == nullptr) {
|
|
1096
1095
|
return;
|
|
1097
1096
|
}
|
|
1098
|
-
|
|
1097
|
+
|
|
1099
1098
|
auto isolate = args.GetIsolate();
|
|
1100
1099
|
auto context = isolate->GetCurrentContext();
|
|
1101
|
-
|
|
1102
|
-
|
|
1100
|
+
|
|
1103
1101
|
auto descVal = args[0];
|
|
1104
1102
|
std::string label;
|
|
1105
1103
|
bool didSet = false;
|
|
@@ -1111,16 +1109,16 @@ void GPUCommandEncoderImpl::Finish(const v8::FunctionCallbackInfo<v8::Value> &ar
|
|
|
1111
1109
|
label = ConvertFromV8String(isolate, labelVal);
|
|
1112
1110
|
}
|
|
1113
1111
|
}
|
|
1114
|
-
|
|
1112
|
+
|
|
1115
1113
|
auto value = canvas_native_webgpu_command_encoder_finish(ptr->GetEncoder(),
|
|
1116
1114
|
didSet ? label.c_str() : nullptr);
|
|
1117
|
-
|
|
1115
|
+
|
|
1118
1116
|
if (value != nullptr) {
|
|
1119
1117
|
auto ret = GPUCommandBufferImpl::NewInstance(isolate, new GPUCommandBufferImpl(value));
|
|
1120
1118
|
args.GetReturnValue().Set(ret);
|
|
1121
1119
|
return;
|
|
1122
1120
|
}
|
|
1123
|
-
|
|
1121
|
+
|
|
1124
1122
|
args.GetReturnValue().SetUndefined();
|
|
1125
1123
|
}
|
|
1126
1124
|
|
|
@@ -1130,9 +1128,9 @@ GPUCommandEncoderImpl::InsertDebugMarker(const v8::FunctionCallbackInfo<v8::Valu
|
|
|
1130
1128
|
if (ptr == nullptr) {
|
|
1131
1129
|
return;
|
|
1132
1130
|
}
|
|
1133
|
-
|
|
1131
|
+
|
|
1134
1132
|
auto isolate = args.GetIsolate();
|
|
1135
|
-
|
|
1133
|
+
|
|
1136
1134
|
auto markerLabelVal = args[0];
|
|
1137
1135
|
if (markerLabelVal->IsString()) {
|
|
1138
1136
|
auto markerLabel = ConvertFromV8String(isolate, markerLabelVal);
|
|
@@ -1146,7 +1144,7 @@ void GPUCommandEncoderImpl::PopDebugGroup(const v8::FunctionCallbackInfo<v8::Val
|
|
|
1146
1144
|
if (ptr == nullptr) {
|
|
1147
1145
|
return;
|
|
1148
1146
|
}
|
|
1149
|
-
|
|
1147
|
+
|
|
1150
1148
|
canvas_native_webgpu_command_encoder_pop_debug_group(ptr->GetEncoder());
|
|
1151
1149
|
}
|
|
1152
1150
|
|
|
@@ -1155,9 +1153,9 @@ void GPUCommandEncoderImpl::PushDebugGroup(const v8::FunctionCallbackInfo<v8::Va
|
|
|
1155
1153
|
if (ptr == nullptr) {
|
|
1156
1154
|
return;
|
|
1157
1155
|
}
|
|
1158
|
-
|
|
1156
|
+
|
|
1159
1157
|
auto isolate = args.GetIsolate();
|
|
1160
|
-
|
|
1158
|
+
|
|
1161
1159
|
auto groupLabelVal = args[0];
|
|
1162
1160
|
if (groupLabelVal->IsString()) {
|
|
1163
1161
|
auto groupLabel = ConvertFromV8String(isolate, groupLabelVal);
|
|
@@ -1171,10 +1169,10 @@ void GPUCommandEncoderImpl::ResolveQuerySet(const v8::FunctionCallbackInfo<v8::V
|
|
|
1171
1169
|
if (ptr == nullptr) {
|
|
1172
1170
|
return;
|
|
1173
1171
|
}
|
|
1174
|
-
|
|
1172
|
+
|
|
1175
1173
|
auto isolate = args.GetIsolate();
|
|
1176
1174
|
auto context = isolate->GetCurrentContext();
|
|
1177
|
-
|
|
1175
|
+
|
|
1178
1176
|
auto querySet = args[0];
|
|
1179
1177
|
auto queryType = GetNativeType(querySet);
|
|
1180
1178
|
auto firstQuery = args[1];
|
|
@@ -1182,19 +1180,19 @@ void GPUCommandEncoderImpl::ResolveQuerySet(const v8::FunctionCallbackInfo<v8::V
|
|
|
1182
1180
|
auto destination = args[3];
|
|
1183
1181
|
auto destinationType = GetNativeType(destination);
|
|
1184
1182
|
auto destinationOffset = args[4];
|
|
1185
|
-
|
|
1186
|
-
|
|
1183
|
+
|
|
1184
|
+
|
|
1187
1185
|
if (queryType == NativeType::GPUQuerySet && destinationType == NativeType::GPUBuffer) {
|
|
1188
1186
|
auto qs = GPUQuerySetImpl::GetPointer(querySet.As<v8::Object>());
|
|
1189
1187
|
auto dest = GPUBufferImpl::GetPointer(destination.As<v8::Object>());
|
|
1190
1188
|
canvas_native_webgpu_command_encoder_resolve_query_set(ptr->GetEncoder(), qs->GetQuerySet(),
|
|
1191
1189
|
firstQuery->Uint32Value(
|
|
1192
|
-
|
|
1190
|
+
context).FromJust(),
|
|
1193
1191
|
queryCount->Uint32Value(
|
|
1194
|
-
|
|
1192
|
+
context).FromJust(),
|
|
1195
1193
|
dest->GetGPUBuffer(),
|
|
1196
1194
|
(uint64_t) destinationOffset->NumberValue(
|
|
1197
|
-
|
|
1195
|
+
context).FromJust());
|
|
1198
1196
|
}
|
|
1199
1197
|
}
|
|
1200
1198
|
|
|
@@ -1203,20 +1201,20 @@ void GPUCommandEncoderImpl::WriteTimestamp(const v8::FunctionCallbackInfo<v8::Va
|
|
|
1203
1201
|
if (ptr == nullptr) {
|
|
1204
1202
|
return;
|
|
1205
1203
|
}
|
|
1206
|
-
|
|
1204
|
+
|
|
1207
1205
|
auto isolate = args.GetIsolate();
|
|
1208
1206
|
auto context = isolate->GetCurrentContext();
|
|
1209
|
-
|
|
1207
|
+
|
|
1210
1208
|
auto querySet = args[0];
|
|
1211
1209
|
auto queryType = GetNativeType(querySet);
|
|
1212
1210
|
auto queryIndex = args[1];
|
|
1213
|
-
|
|
1211
|
+
|
|
1214
1212
|
if (queryType == NativeType::GPUQuerySet) {
|
|
1215
1213
|
auto qs = GPUQuerySetImpl::GetPointer(querySet.As<v8::Object>());
|
|
1216
1214
|
canvas_native_webgpu_command_encoder_write_timestamp(ptr->GetEncoder(), qs->GetQuerySet(),
|
|
1217
1215
|
queryIndex->Uint32Value(
|
|
1218
|
-
|
|
1216
|
+
context).FromJust());
|
|
1219
1217
|
}
|
|
1220
|
-
|
|
1221
|
-
|
|
1218
|
+
|
|
1219
|
+
|
|
1222
1220
|
}
|