@nativescript/canvas 2.0.0-webgpu.2 → 2.0.0-webgpu.21
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 -4
- package/Canvas/common.js +35 -125
- package/Canvas/common.js.map +1 -1
- package/Canvas/index.android.d.ts +0 -1
- package/Canvas/index.android.js +45 -38
- package/Canvas/index.android.js.map +1 -1
- package/Canvas/index.d.ts +11 -3
- package/Canvas/index.ios.js +49 -40
- package/Canvas/index.ios.js.map +1 -1
- package/Canvas/utils.d.ts +3 -0
- package/Canvas/utils.js +85 -0
- package/Canvas/utils.js.map +1 -0
- package/Canvas2D/CanvasRenderingContext2D/index.d.ts +1 -0
- package/Canvas2D/CanvasRenderingContext2D/index.js +1 -0
- package/Canvas2D/CanvasRenderingContext2D/index.js.map +1 -1
- package/Dom/Group.d.ts +1 -2
- package/Dom/Group.js.map +1 -1
- package/Dom/Image.js +0 -1
- package/Dom/Image.js.map +1 -1
- package/Dom/Paint.d.ts +1 -1
- package/Dom/shapes/Path.d.ts +1 -1
- package/ImageAsset/index.js +77 -33
- package/ImageAsset/index.js.map +1 -1
- package/ImageBitmap/index.js +107 -20
- package/ImageBitmap/index.js.map +1 -1
- package/README.md +2 -4
- package/WebGL/WebGLRenderingContext/index.js +73 -31
- package/WebGL/WebGLRenderingContext/index.js.map +1 -1
- package/WebGL2/WebGL2RenderingContext/index.js +4 -4
- package/WebGL2/WebGL2RenderingContext/index.js.map +1 -1
- package/WebGPU/GPU.js +4 -3
- package/WebGPU/GPU.js.map +1 -1
- package/WebGPU/GPUAdapter.d.ts +6 -3
- package/WebGPU/GPUAdapter.js +31 -0
- package/WebGPU/GPUAdapter.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 +10 -2
- package/WebGPU/GPUBuffer.js.map +1 -1
- package/WebGPU/GPUCanvasContext.d.ts +3 -2
- package/WebGPU/GPUCanvasContext.js +52 -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 +3 -9
- package/WebGPU/GPUCommandEncoder.js +94 -41
- 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 +17 -79
- package/WebGPU/GPUDevice.js +72 -91
- 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 +45 -7
- package/WebGPU/GPUQueue.js.map +1 -1
- package/WebGPU/GPURenderBundle.d.ts +1 -0
- package/WebGPU/GPURenderBundle.js +3 -0
- package/WebGPU/GPURenderBundle.js.map +1 -1
- package/WebGPU/GPURenderBundleEncoder.d.ts +4 -2
- package/WebGPU/GPURenderBundleEncoder.js +7 -3
- package/WebGPU/GPURenderBundleEncoder.js.map +1 -1
- package/WebGPU/GPURenderPassEncoder.d.ts +2 -1
- package/WebGPU/GPURenderPassEncoder.js +5 -2
- package/WebGPU/GPURenderPassEncoder.js.map +1 -1
- package/WebGPU/GPURenderPipeline.d.ts +1 -0
- package/WebGPU/GPURenderPipeline.js +3 -0
- package/WebGPU/GPURenderPipeline.js.map +1 -1
- package/WebGPU/GPUSampler.d.ts +1 -0
- package/WebGPU/GPUSampler.js +3 -0
- package/WebGPU/GPUSampler.js.map +1 -1
- package/WebGPU/GPUShaderModule.d.ts +1 -1
- package/WebGPU/GPUShaderModule.js +2 -2
- package/WebGPU/GPUShaderModule.js.map +1 -1
- package/WebGPU/GPUTexture.d.ts +1 -0
- package/WebGPU/GPUTexture.js +3 -0
- package/WebGPU/GPUTexture.js.map +1 -1
- package/WebGPU/GPUTextureView.d.ts +1 -0
- package/WebGPU/GPUTextureView.js +3 -0
- package/WebGPU/GPUTextureView.js.map +1 -1
- package/WebGPU/Interfaces.d.ts +95 -4
- package/WebGPU/Types.d.ts +9 -1
- package/WebGPU/Utils.d.ts +6 -0
- package/WebGPU/Utils.js +221 -0
- package/WebGPU/Utils.js.map +1 -1
- package/angular/esm2022/index.mjs +4 -4
- package/angular/fesm2022/nativescript-canvas-angular.mjs +4 -4
- package/angular/package.json +20 -0
- package/package.json +1 -3
- 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 +9 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Headers/canvas_ios.h +7 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Headers/canvas_native.h +226 -61
- 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 +6871 -5995
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios.private.swiftinterface +7 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios.swiftinterface +7 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/dSYMs/CanvasNative.framework.dSYM/Contents/Resources/DWARF/CanvasNative +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/dSYMs/CanvasNative.framework.dSYM/Contents/Resources/Relocations/aarch64/CanvasNative.yml +656 -644
- 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 +18 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Headers/canvas_ios.h +7 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Headers/canvas_native.h +226 -61
- 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 +6871 -5995
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +7 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios-simulator.swiftinterface +7 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.abi.json +6871 -5995
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +7 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +7 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/_CodeSignature/CodeResources +27 -27
- 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 +658 -646
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/dSYMs/CanvasNative.framework.dSYM/Contents/Resources/Relocations/x86_64/CanvasNative.yml +696 -684
- package/platforms/ios/src/NSOperationQueueWrapper.h +3 -1
- package/platforms/ios/src/NSOperationQueueWrapper.mm +41 -9
- package/platforms/ios/src/cpp/AsyncCallback.h +214 -0
- package/platforms/ios/src/cpp/CanvasJSIModule.cpp +123 -47
- package/platforms/ios/src/cpp/Helpers.h +2 -164
- package/platforms/ios/src/cpp/ImageAssetImpl.cpp +18 -26
- package/platforms/ios/src/cpp/ImageAssetImpl.h +3 -3
- package/platforms/ios/src/cpp/ImageBitmapImpl.cpp +60 -3
- package/platforms/ios/src/cpp/ImageBitmapImpl.h +12 -4
- package/platforms/ios/src/cpp/NativeType.h +87 -0
- package/platforms/ios/src/cpp/ObjectWrapperImpl.h +50 -0
- package/platforms/ios/src/cpp/PromiseCallback.h +197 -0
- package/platforms/ios/src/cpp/canvas2d/CanvasGradient.h +7 -6
- package/platforms/ios/src/cpp/canvas2d/CanvasPattern.cpp +1 -1
- package/platforms/ios/src/cpp/canvas2d/CanvasPattern.h +1 -1
- package/platforms/ios/src/cpp/canvas2d/CanvasRenderingContext2DImpl.cpp +6 -6
- package/platforms/ios/src/cpp/canvas2d/CanvasRenderingContext2DImpl.h +18 -13
- package/platforms/ios/src/cpp/canvas2d/ImageDataImpl.cpp +2 -2
- package/platforms/ios/src/cpp/canvas2d/ImageDataImpl.h +1 -1
- package/platforms/ios/src/cpp/canvas2d/MatrixImpl.cpp +10 -10
- package/platforms/ios/src/cpp/canvas2d/Path2D.cpp +6 -3
- package/platforms/ios/src/cpp/canvas2d/Path2D.h +5 -5
- 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 +106 -1
- package/platforms/ios/src/cpp/webgl/WebGLRenderingContext.h +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.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 +142 -73
- 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 +11 -5
- 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 +101 -106
- 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 +1683 -733
- package/platforms/ios/src/cpp/webgpu/GPUDeviceImpl.h +3 -1
- package/platforms/ios/src/cpp/webgpu/GPUImpl.cpp +53 -39
- package/platforms/ios/src/cpp/webgpu/GPUImpl.h +2 -2
- package/platforms/ios/src/cpp/webgpu/GPULabel.h +33 -0
- 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 +88 -36
- package/platforms/ios/src/cpp/webgpu/GPUQueueImpl.h +4 -1
- package/platforms/ios/src/cpp/webgpu/GPURenderBundleEncoderImpl.cpp +43 -14
- package/platforms/ios/src/cpp/webgpu/GPURenderBundleEncoderImpl.h +4 -1
- package/platforms/ios/src/cpp/webgpu/GPURenderBundleImpl.cpp +26 -1
- package/platforms/ios/src/cpp/webgpu/GPURenderBundleImpl.h +4 -1
- package/platforms/ios/src/cpp/webgpu/GPURenderPassEncoderImpl.cpp +40 -14
- 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 +34 -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/utils.d.ts +1 -1
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
#include "Helpers.h"
|
|
9
9
|
#include "ObjectWrapperImpl.h"
|
|
10
10
|
|
|
11
|
+
|
|
11
12
|
class GPUBufferImpl : ObjectWrapperImpl {
|
|
12
13
|
public:
|
|
13
14
|
explicit GPUBufferImpl(const CanvasGPUBuffer *buffer);
|
|
@@ -24,14 +25,14 @@ public:
|
|
|
24
25
|
|
|
25
26
|
static v8::Local<v8::FunctionTemplate> GetCtor(v8::Isolate *isolate);
|
|
26
27
|
|
|
27
|
-
static v8::Local<v8::Object> NewInstance(v8::Isolate *isolate, GPUBufferImpl *
|
|
28
|
+
static v8::Local<v8::Object> NewInstance(v8::Isolate *isolate, GPUBufferImpl *buffer) {
|
|
28
29
|
auto context = isolate->GetCurrentContext();
|
|
29
30
|
v8::EscapableHandleScope scope(isolate);
|
|
30
31
|
auto object = GPUBufferImpl::GetCtor(isolate)->GetFunction(
|
|
31
32
|
context).ToLocalChecked()->NewInstance(context).ToLocalChecked();
|
|
32
|
-
SetNativeType(
|
|
33
|
-
object->SetAlignedPointerInInternalField(0,
|
|
34
|
-
|
|
33
|
+
SetNativeType(buffer, NativeType::GPUBuffer);
|
|
34
|
+
object->SetAlignedPointerInInternalField(0, buffer);
|
|
35
|
+
buffer->BindFinalizer(isolate, object);
|
|
35
36
|
return scope.Escape(object);
|
|
36
37
|
}
|
|
37
38
|
|
|
@@ -50,6 +51,9 @@ public:
|
|
|
50
51
|
|
|
51
52
|
static void GetMappedRange(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
52
53
|
|
|
54
|
+
static void GetLabel(v8::Local<v8::Name> name,
|
|
55
|
+
const v8::PropertyCallbackInfo<v8::Value> &info);
|
|
56
|
+
|
|
53
57
|
|
|
54
58
|
private:
|
|
55
59
|
const CanvasGPUBuffer *buffer_;
|
|
@@ -189,7 +189,7 @@ void GPUCanvasContextImpl::Configure(const v8::FunctionCallbackInfo<v8::Value> &
|
|
|
189
189
|
|
|
190
190
|
v8::Local<v8::Value> sizeValue;
|
|
191
191
|
options->Get(context, ConvertToV8String(isolate, "size")).ToLocal(
|
|
192
|
-
&
|
|
192
|
+
&sizeValue);
|
|
193
193
|
|
|
194
194
|
CanvasExtent3d size = ParseExtent3d(isolate, sizeValue);
|
|
195
195
|
|
|
@@ -207,7 +207,7 @@ void GPUCanvasContextImpl::UnConfigure(const v8::FunctionCallbackInfo<v8::Value>
|
|
|
207
207
|
return;
|
|
208
208
|
}
|
|
209
209
|
|
|
210
|
-
|
|
210
|
+
canvas_native_webgpu_context_unconfigure(ptr->GetContext());
|
|
211
211
|
|
|
212
212
|
}
|
|
213
213
|
|
|
@@ -224,9 +224,15 @@ void GPUCanvasContextImpl::GetCurrentTexture(const v8::FunctionCallbackInfo<v8::
|
|
|
224
224
|
auto texture = canvas_native_webgpu_context_get_current_texture(ctx);
|
|
225
225
|
|
|
226
226
|
if (texture != nullptr) {
|
|
227
|
-
auto
|
|
228
|
-
|
|
229
|
-
|
|
227
|
+
auto status = canvas_native_webgpu_texture_get_status(texture);
|
|
228
|
+
if(status == SurfaceGetCurrentTextureStatusSuccess){
|
|
229
|
+
auto textureImpl = new GPUTextureImpl(texture);
|
|
230
|
+
auto ret = GPUTextureImpl::NewInstance(isolate, textureImpl);
|
|
231
|
+
args.GetReturnValue().Set(ret);
|
|
232
|
+
}else {
|
|
233
|
+
canvas_native_webgpu_texture_release(texture);
|
|
234
|
+
args.GetReturnValue().SetNull();
|
|
235
|
+
}
|
|
230
236
|
return;
|
|
231
237
|
}
|
|
232
238
|
|
|
@@ -31,7 +31,7 @@ public:
|
|
|
31
31
|
v8::EscapableHandleScope scope(isolate);
|
|
32
32
|
auto object = GPUCanvasContextImpl::GetCtor(isolate)->GetFunction(
|
|
33
33
|
context).ToLocalChecked()->NewInstance(context).ToLocalChecked();
|
|
34
|
-
SetNativeType(
|
|
34
|
+
SetNativeType(ctx, NativeType::GPUCanvasContext);
|
|
35
35
|
object->SetAlignedPointerInInternalField(0, ctx);
|
|
36
36
|
ctx->BindFinalizer(isolate, object);
|
|
37
37
|
return scope.Escape(object);
|
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
#include "GPUCommandBufferImpl.h"
|
|
6
6
|
#include "Caches.h"
|
|
7
7
|
|
|
8
|
-
GPUCommandBufferImpl::GPUCommandBufferImpl(const CanvasGPUCommandBuffer *commandBuffer)
|
|
8
|
+
GPUCommandBufferImpl::GPUCommandBufferImpl(const CanvasGPUCommandBuffer *commandBuffer)
|
|
9
|
+
: commandBuffer_(
|
|
9
10
|
commandBuffer) {}
|
|
10
11
|
|
|
11
12
|
const CanvasGPUCommandBuffer *GPUCommandBufferImpl::GetGPUCommandBuffer() {
|
|
@@ -22,7 +23,7 @@ void GPUCommandBufferImpl::Init(v8::Local<v8::Object> canvasModule, v8::Isolate
|
|
|
22
23
|
auto context = isolate->GetCurrentContext();
|
|
23
24
|
auto func = ctor->GetFunction(context).ToLocalChecked();
|
|
24
25
|
|
|
25
|
-
canvasModule->Set(context, ConvertToV8String(isolate, "GPUCommandBuffer"), func).FromJust()
|
|
26
|
+
canvasModule->Set(context, ConvertToV8String(isolate, "GPUCommandBuffer"), func).FromJust();
|
|
26
27
|
}
|
|
27
28
|
|
|
28
29
|
GPUCommandBufferImpl *GPUCommandBufferImpl::GetPointer(const v8::Local<v8::Object> &object) {
|
|
@@ -47,8 +48,34 @@ v8::Local<v8::FunctionTemplate> GPUCommandBufferImpl::GetCtor(v8::Isolate *isola
|
|
|
47
48
|
auto tmpl = ctorTmpl->InstanceTemplate();
|
|
48
49
|
tmpl->SetInternalFieldCount(2);
|
|
49
50
|
|
|
51
|
+
tmpl->SetLazyDataProperty(
|
|
52
|
+
ConvertToV8String(isolate, "label"),
|
|
53
|
+
GetLabel
|
|
54
|
+
);
|
|
55
|
+
|
|
50
56
|
|
|
51
57
|
cache->GPUCommandBufferTmpl =
|
|
52
58
|
std::make_unique<v8::Persistent<v8::FunctionTemplate>>(isolate, ctorTmpl);
|
|
53
59
|
return ctorTmpl;
|
|
54
60
|
}
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
void
|
|
64
|
+
GPUCommandBufferImpl::GetLabel(v8::Local<v8::Name> name,
|
|
65
|
+
const v8::PropertyCallbackInfo<v8::Value> &info) {
|
|
66
|
+
auto ptr = GetPointer(info.This());
|
|
67
|
+
if (ptr != nullptr) {
|
|
68
|
+
auto label = canvas_native_webgpu_command_buffer_get_label(ptr->commandBuffer_);
|
|
69
|
+
if (label == nullptr) {
|
|
70
|
+
info.GetReturnValue().SetEmptyString();
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
info.GetReturnValue().Set(
|
|
74
|
+
ConvertToV8String(info.GetIsolate(), label)
|
|
75
|
+
);
|
|
76
|
+
canvas_native_string_destroy(label);
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
info.GetReturnValue().SetEmptyString();
|
|
81
|
+
}
|
|
@@ -31,12 +31,15 @@ public:
|
|
|
31
31
|
v8::EscapableHandleScope scope(isolate);
|
|
32
32
|
auto object = GPUCommandBufferImpl::GetCtor(isolate)->GetFunction(
|
|
33
33
|
context).ToLocalChecked()->NewInstance(context).ToLocalChecked();
|
|
34
|
-
SetNativeType(
|
|
34
|
+
SetNativeType(commandBuffer, NativeType::GPUCommandBuffer);
|
|
35
35
|
object->SetAlignedPointerInInternalField(0, commandBuffer);
|
|
36
36
|
commandBuffer->BindFinalizer(isolate, object);
|
|
37
37
|
return scope.Escape(object);
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
+
static void GetLabel(v8::Local<v8::Name> name,
|
|
41
|
+
const v8::PropertyCallbackInfo<v8::Value> &info);
|
|
42
|
+
|
|
40
43
|
private:
|
|
41
44
|
const CanvasGPUCommandBuffer *commandBuffer_;
|
|
42
45
|
};
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
#include "GPURenderPassEncoderImpl.h"
|
|
12
12
|
#include "GPUCommandBufferImpl.h"
|
|
13
13
|
#include "GPUTextureImpl.h"
|
|
14
|
+
#include "GPULabel.h"
|
|
14
15
|
|
|
15
16
|
GPUCommandEncoderImpl::GPUCommandEncoderImpl(const CanvasGPUCommandEncoder *encoder) : encoder_(
|
|
16
17
|
encoder) {}
|
|
@@ -53,6 +54,10 @@ v8::Local<v8::FunctionTemplate> GPUCommandEncoderImpl::GetCtor(v8::Isolate *isol
|
|
|
53
54
|
auto tmpl = ctorTmpl->InstanceTemplate();
|
|
54
55
|
tmpl->SetInternalFieldCount(2);
|
|
55
56
|
|
|
57
|
+
tmpl->SetLazyDataProperty(
|
|
58
|
+
ConvertToV8String(isolate, "label"),
|
|
59
|
+
GetLabel
|
|
60
|
+
);
|
|
56
61
|
|
|
57
62
|
tmpl->Set(
|
|
58
63
|
ConvertToV8String(isolate, "beginComputePass"),
|
|
@@ -112,6 +117,26 @@ v8::Local<v8::FunctionTemplate> GPUCommandEncoderImpl::GetCtor(v8::Isolate *isol
|
|
|
112
117
|
return ctorTmpl;
|
|
113
118
|
}
|
|
114
119
|
|
|
120
|
+
void
|
|
121
|
+
GPUCommandEncoderImpl::GetLabel(v8::Local<v8::Name> name,
|
|
122
|
+
const v8::PropertyCallbackInfo<v8::Value> &info) {
|
|
123
|
+
auto ptr = GetPointer(info.This());
|
|
124
|
+
if (ptr != nullptr) {
|
|
125
|
+
auto label = canvas_native_webgpu_command_encoder_get_label(ptr->encoder_);
|
|
126
|
+
if (label == nullptr) {
|
|
127
|
+
info.GetReturnValue().SetEmptyString();
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
info.GetReturnValue().Set(
|
|
131
|
+
ConvertToV8String(info.GetIsolate(), label)
|
|
132
|
+
);
|
|
133
|
+
canvas_native_string_destroy(label);
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
info.GetReturnValue().SetEmptyString();
|
|
138
|
+
}
|
|
139
|
+
|
|
115
140
|
|
|
116
141
|
void GPUCommandEncoderImpl::BeginComputePass(const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
117
142
|
auto ptr = GetPointer(args.This());
|
|
@@ -133,32 +158,28 @@ void GPUCommandEncoderImpl::BeginComputePass(const v8::FunctionCallbackInfo<v8::
|
|
|
133
158
|
v8::Local<v8::Value> labelVal;
|
|
134
159
|
desc->Get(context, ConvertToV8String(isolate, "label")).ToLocal(&labelVal);
|
|
135
160
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
if (!labelVal.IsEmpty() && labelVal->IsString()) {
|
|
139
|
-
label = *v8::String::Utf8Value(isolate, labelVal);
|
|
140
|
-
}
|
|
161
|
+
auto label = GPULabel(isolate, labelVal);
|
|
141
162
|
|
|
142
163
|
const CanvasGPUQuerySet *querySet = nullptr;
|
|
164
|
+
|
|
143
165
|
int32_t beginningOfPassWriteIndex = -1;
|
|
144
166
|
|
|
145
167
|
int32_t endOfPassWriteIndex = -1;
|
|
146
168
|
|
|
147
169
|
|
|
148
170
|
v8::Local<v8::Value> timestampWritesVal;
|
|
149
|
-
desc->Get(context, ConvertToV8String(isolate, "timestampWrites")).ToLocal(
|
|
150
|
-
×tampWritesVal);
|
|
151
171
|
|
|
152
|
-
|
|
153
|
-
|
|
172
|
+
auto success = desc->Get(context, ConvertToV8String(isolate, "timestampWrites")).ToLocal(
|
|
173
|
+
×tampWritesVal);
|
|
174
|
+
if (success && timestampWritesVal->IsObject()) {
|
|
154
175
|
auto timestampWrites = timestampWritesVal.As<v8::Object>();
|
|
155
176
|
|
|
156
177
|
v8::Local<v8::Value> querySetVal;
|
|
157
|
-
timestampWrites->Get(context, ConvertToV8String(isolate, "querySet")).ToLocal(
|
|
178
|
+
success = timestampWrites->Get(context, ConvertToV8String(isolate, "querySet")).ToLocal(
|
|
158
179
|
&querySetVal);
|
|
159
180
|
|
|
160
181
|
|
|
161
|
-
if (
|
|
182
|
+
if (success && querySetVal->IsObject()) {
|
|
162
183
|
auto queryPtr = GPUQuerySetImpl::GetPointer(querySetVal.As<v8::Object>());
|
|
163
184
|
if (queryPtr != nullptr) {
|
|
164
185
|
querySet = queryPtr->GetQuerySet();
|
|
@@ -171,27 +192,29 @@ void GPUCommandEncoderImpl::BeginComputePass(const v8::FunctionCallbackInfo<v8::
|
|
|
171
192
|
v8::Local<v8::Value> endOfPassWriteIndexVal;
|
|
172
193
|
|
|
173
194
|
|
|
174
|
-
timestampWrites->Get(context,
|
|
175
|
-
|
|
195
|
+
success = timestampWrites->Get(context,
|
|
196
|
+
ConvertToV8String(isolate,
|
|
197
|
+
"beginningOfPassWriteIndex")).ToLocal(
|
|
176
198
|
&beginningOfPassWriteIndexVal);
|
|
177
199
|
|
|
178
|
-
|
|
179
|
-
ConvertToV8String(isolate, "endOfPassWriteIndex")).ToLocal(
|
|
180
|
-
&endOfPassWriteIndexVal);
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
if (beginningOfPassWriteIndexVal->IsInt32()) {
|
|
200
|
+
if (success && beginningOfPassWriteIndexVal->IsInt32()) {
|
|
184
201
|
beginningOfPassWriteIndex = beginningOfPassWriteIndexVal.As<v8::Int32>()->Value();
|
|
185
202
|
}
|
|
186
203
|
|
|
187
|
-
|
|
204
|
+
success = timestampWrites->Get(context,
|
|
205
|
+
ConvertToV8String(isolate,
|
|
206
|
+
"endOfPassWriteIndex")).ToLocal(
|
|
207
|
+
&endOfPassWriteIndexVal);
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
if (success && endOfPassWriteIndexVal->IsInt32()) {
|
|
188
211
|
endOfPassWriteIndex = endOfPassWriteIndexVal.As<v8::Int32>()->Value();
|
|
189
212
|
}
|
|
190
213
|
}
|
|
191
214
|
|
|
192
215
|
|
|
193
216
|
pass = canvas_native_webgpu_command_encoder_begin_compute_pass(ptr->GetEncoder(),
|
|
194
|
-
querySet, label,
|
|
217
|
+
querySet, *label,
|
|
195
218
|
beginningOfPassWriteIndex,
|
|
196
219
|
endOfPassWriteIndex);
|
|
197
220
|
|
|
@@ -232,15 +255,10 @@ void GPUCommandEncoderImpl::BeginRenderPass(const v8::FunctionCallbackInfo<v8::V
|
|
|
232
255
|
if (!descVal->IsNullOrUndefined() && descVal->IsObject()) {
|
|
233
256
|
auto desc = descVal.As<v8::Object>();
|
|
234
257
|
|
|
235
|
-
|
|
236
258
|
v8::Local<v8::Value> labelVal;
|
|
237
259
|
desc->Get(context, ConvertToV8String(isolate, "label")).ToLocal(&labelVal);
|
|
238
260
|
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
if (!labelVal.IsEmpty() && labelVal->IsString()) {
|
|
242
|
-
label = *v8::String::Utf8Value(isolate, labelVal);
|
|
243
|
-
}
|
|
261
|
+
auto label = GPULabel(isolate, labelVal);
|
|
244
262
|
|
|
245
263
|
|
|
246
264
|
v8::Local<v8::Value> colorAttachmentsVal;
|
|
@@ -260,65 +278,46 @@ void GPUCommandEncoderImpl::BeginRenderPass(const v8::FunctionCallbackInfo<v8::V
|
|
|
260
278
|
|
|
261
279
|
auto clearValue = ParseColor(isolate, clearValueVal);
|
|
262
280
|
|
|
281
|
+
const CanvasGPUTextureView *view = nullptr;
|
|
282
|
+
|
|
263
283
|
v8::Local<v8::Value> viewVal;
|
|
264
|
-
colorAttachment->Get(context, ConvertToV8String(isolate,
|
|
265
|
-
"view")).ToLocal(&viewVal);
|
|
266
284
|
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
285
|
+
if (colorAttachment->Get(context, ConvertToV8String(isolate,
|
|
286
|
+
"view")).ToLocal(&viewVal)) {
|
|
287
|
+
auto type = GetNativeType(viewVal);
|
|
288
|
+
if (type == NativeType::GPUTextureView) {
|
|
289
|
+
auto viewPtr = GPUTextureViewImpl::GetPointer(viewVal.As<v8::Object>());
|
|
290
|
+
view = viewPtr->GetTextureView();
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
const CanvasGPUTextureView *resolveTarget = nullptr;
|
|
273
296
|
|
|
274
|
-
v8::Local<v8::Value>
|
|
297
|
+
v8::Local<v8::Value> resolveTargetVal;
|
|
275
298
|
|
|
276
299
|
colorAttachment->Get(context, ConvertToV8String(isolate, "resolveTarget")).ToLocal(
|
|
277
|
-
&
|
|
300
|
+
&resolveTargetVal);
|
|
278
301
|
|
|
279
|
-
auto resolve_target_type = GetNativeType(
|
|
302
|
+
auto resolve_target_type = GetNativeType(resolveTargetVal);
|
|
280
303
|
|
|
281
304
|
if (resolve_target_type == NativeType::GPUTextureView) {
|
|
282
|
-
auto res = GPUTextureViewImpl::GetPointer(
|
|
283
|
-
|
|
305
|
+
auto res = GPUTextureViewImpl::GetPointer(resolveTargetVal.As<v8::Object>());
|
|
306
|
+
resolveTarget = res->GetTextureView();
|
|
284
307
|
}
|
|
285
308
|
|
|
286
|
-
// default
|
|
287
|
-
CanvasLoadOp load = CanvasLoadOp::CanvasLoadOpClear;
|
|
288
|
-
CanvasStoreOp store = CanvasStoreOp::CanvasStoreOpStore;
|
|
289
309
|
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
310
|
v8::Local<v8::Value> storeVal;
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
store = CanvasStoreOp::CanvasStoreOpStore;
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
}
|
|
311
|
+
colorAttachment->Get(context, ConvertToV8String(isolate,
|
|
312
|
+
"loadOp")).ToLocal(&loadVal);
|
|
313
|
+
|
|
314
|
+
colorAttachment->Get(context, ConvertToV8String(isolate,
|
|
315
|
+
"storeOp")).ToLocal(&storeVal);
|
|
316
|
+
|
|
317
|
+
|
|
318
|
+
CanvasLoadOp load = ParseCanvasLoadOp(isolate, loadVal);
|
|
319
|
+
CanvasStoreOp store = ParseCanvasStoreOp(isolate, storeVal);
|
|
320
|
+
|
|
322
321
|
|
|
323
322
|
CanvasPassChannelColor channel{
|
|
324
323
|
load,
|
|
@@ -329,7 +328,7 @@ void GPUCommandEncoderImpl::BeginRenderPass(const v8::FunctionCallbackInfo<v8::V
|
|
|
329
328
|
|
|
330
329
|
auto attachment = CanvasRenderPassColorAttachment{
|
|
331
330
|
view,
|
|
332
|
-
|
|
331
|
+
resolveTarget,
|
|
333
332
|
channel
|
|
334
333
|
};
|
|
335
334
|
|
|
@@ -381,20 +380,20 @@ void GPUCommandEncoderImpl::BeginRenderPass(const v8::FunctionCallbackInfo<v8::V
|
|
|
381
380
|
&depthLoadOp);
|
|
382
381
|
|
|
383
382
|
depthStencilAttachment->depth_load_op = CanvasOptionalLoadOp{
|
|
384
|
-
|
|
383
|
+
CanvasOptionalLoadOpNone
|
|
385
384
|
};
|
|
386
385
|
|
|
387
386
|
if (!depthLoadOp.IsEmpty() && depthLoadOp->IsString()) {
|
|
388
387
|
auto value = ConvertFromV8String(isolate, depthLoadOp);
|
|
389
388
|
if (value == "load") {
|
|
390
389
|
depthStencilAttachment->depth_load_op = CanvasOptionalLoadOp{
|
|
391
|
-
|
|
392
|
-
|
|
390
|
+
CanvasOptionalLoadOpSome,
|
|
391
|
+
CanvasLoadOpLoad
|
|
393
392
|
};
|
|
394
393
|
} else if (value == "clear") {
|
|
395
394
|
depthStencilAttachment->depth_load_op = CanvasOptionalLoadOp{
|
|
396
|
-
|
|
397
|
-
|
|
395
|
+
CanvasOptionalLoadOpSome,
|
|
396
|
+
CanvasLoadOpClear
|
|
398
397
|
};
|
|
399
398
|
}
|
|
400
399
|
}
|
|
@@ -406,20 +405,20 @@ void GPUCommandEncoderImpl::BeginRenderPass(const v8::FunctionCallbackInfo<v8::V
|
|
|
406
405
|
&depthStoreOp);
|
|
407
406
|
|
|
408
407
|
depthStencilAttachment->depth_store_op = CanvasOptionalStoreOp{
|
|
409
|
-
|
|
408
|
+
CanvasOptionalStoreOpNone
|
|
410
409
|
};
|
|
411
410
|
|
|
412
411
|
if (!depthStoreOp.IsEmpty() && depthStoreOp->IsString()) {
|
|
413
412
|
auto value = ConvertFromV8String(isolate, depthStoreOp);
|
|
414
413
|
if (value == "store") {
|
|
415
414
|
depthStencilAttachment->depth_store_op = depthStencilAttachment->depth_store_op = CanvasOptionalStoreOp{
|
|
416
|
-
|
|
417
|
-
|
|
415
|
+
CanvasOptionalStoreOpSome,
|
|
416
|
+
CanvasStoreOpStore
|
|
418
417
|
};
|
|
419
418
|
} else if (value == "discard") {
|
|
420
419
|
depthStencilAttachment->depth_store_op = depthStencilAttachment->depth_store_op = CanvasOptionalStoreOp{
|
|
421
|
-
|
|
422
|
-
|
|
420
|
+
CanvasOptionalStoreOpSome,
|
|
421
|
+
CanvasStoreOpDiscard
|
|
423
422
|
};
|
|
424
423
|
}
|
|
425
424
|
}
|
|
@@ -455,20 +454,20 @@ void GPUCommandEncoderImpl::BeginRenderPass(const v8::FunctionCallbackInfo<v8::V
|
|
|
455
454
|
&stencilLoadOp);
|
|
456
455
|
|
|
457
456
|
depthStencilAttachment->stencil_load_op = CanvasOptionalLoadOp{
|
|
458
|
-
|
|
457
|
+
CanvasOptionalLoadOpNone
|
|
459
458
|
};
|
|
460
459
|
|
|
461
460
|
if (!stencilLoadOp.IsEmpty() && stencilLoadOp->IsString()) {
|
|
462
461
|
auto value = ConvertFromV8String(isolate, stencilLoadOp);
|
|
463
462
|
if (value == "load") {
|
|
464
463
|
depthStencilAttachment->stencil_load_op = CanvasOptionalLoadOp{
|
|
465
|
-
|
|
466
|
-
|
|
464
|
+
CanvasOptionalLoadOpSome,
|
|
465
|
+
CanvasLoadOpLoad
|
|
467
466
|
};
|
|
468
467
|
} else if (value == "clear") {
|
|
469
468
|
depthStencilAttachment->stencil_load_op = CanvasOptionalLoadOp{
|
|
470
|
-
|
|
471
|
-
|
|
469
|
+
CanvasOptionalLoadOpSome,
|
|
470
|
+
CanvasLoadOpClear
|
|
472
471
|
};
|
|
473
472
|
}
|
|
474
473
|
}
|
|
@@ -480,20 +479,20 @@ void GPUCommandEncoderImpl::BeginRenderPass(const v8::FunctionCallbackInfo<v8::V
|
|
|
480
479
|
&stencilStoreOp);
|
|
481
480
|
|
|
482
481
|
depthStencilAttachment->stencil_store_op = CanvasOptionalStoreOp{
|
|
483
|
-
|
|
482
|
+
CanvasOptionalStoreOpNone
|
|
484
483
|
};
|
|
485
484
|
|
|
486
485
|
if (!stencilStoreOp.IsEmpty() && stencilStoreOp->IsString()) {
|
|
487
486
|
auto value = ConvertFromV8String(isolate, stencilStoreOp);
|
|
488
487
|
if (value == "store") {
|
|
489
488
|
depthStencilAttachment->stencil_store_op = CanvasOptionalStoreOp{
|
|
490
|
-
|
|
491
|
-
|
|
489
|
+
CanvasOptionalStoreOpSome,
|
|
490
|
+
CanvasStoreOpStore
|
|
492
491
|
};
|
|
493
492
|
} else if (value == "discard") {
|
|
494
493
|
depthStencilAttachment->stencil_store_op = CanvasOptionalStoreOp{
|
|
495
|
-
|
|
496
|
-
|
|
494
|
+
CanvasOptionalStoreOpSome,
|
|
495
|
+
CanvasStoreOpDiscard
|
|
497
496
|
};
|
|
498
497
|
}
|
|
499
498
|
}
|
|
@@ -518,7 +517,7 @@ void GPUCommandEncoderImpl::BeginRenderPass(const v8::FunctionCallbackInfo<v8::V
|
|
|
518
517
|
desc->Get(context, ConvertToV8String(isolate, "occlusionQuerySet")).ToLocal(
|
|
519
518
|
&occlusionQuerySetVal);
|
|
520
519
|
|
|
521
|
-
|
|
520
|
+
|
|
522
521
|
if (GetNativeType(occlusionQuerySetVal) == NativeType::GPUQuerySet) {
|
|
523
522
|
auto occlusionQuerySet = GPUQuerySetImpl::GetPointer(
|
|
524
523
|
occlusionQuerySetVal.As<v8::Object>());
|
|
@@ -578,13 +577,14 @@ void GPUCommandEncoderImpl::BeginRenderPass(const v8::FunctionCallbackInfo<v8::V
|
|
|
578
577
|
|
|
579
578
|
|
|
580
579
|
pass = canvas_native_webgpu_command_encoder_begin_render_pass(
|
|
581
|
-
ptr->GetEncoder(), label, colorAttachments_.data(), colorAttachments_.size(),
|
|
580
|
+
ptr->GetEncoder(), *label, colorAttachments_.data(), colorAttachments_.size(),
|
|
582
581
|
depthStencilAttachment, occlusion_query_set,
|
|
583
582
|
querySet, beginningOfPassWriteIndex, endOfPassWriteIndex
|
|
584
583
|
);
|
|
585
584
|
|
|
586
585
|
if (depthStencilAttachment != nullptr) {
|
|
587
586
|
delete depthStencilAttachment;
|
|
587
|
+
depthStencilAttachment = nullptr;
|
|
588
588
|
}
|
|
589
589
|
|
|
590
590
|
|
|
@@ -1099,21 +1099,16 @@ void GPUCommandEncoderImpl::Finish(const v8::FunctionCallbackInfo<v8::Value> &ar
|
|
|
1099
1099
|
auto isolate = args.GetIsolate();
|
|
1100
1100
|
auto context = isolate->GetCurrentContext();
|
|
1101
1101
|
|
|
1102
|
-
|
|
1103
1102
|
auto descVal = args[0];
|
|
1104
|
-
|
|
1105
|
-
bool didSet = false;
|
|
1103
|
+
GPULabel label;
|
|
1106
1104
|
if (descVal->IsObject()) {
|
|
1107
1105
|
auto desc = descVal.As<v8::Object>();
|
|
1108
1106
|
v8::Local<v8::Value> labelVal;
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
label = ConvertFromV8String(isolate, labelVal);
|
|
1112
|
-
}
|
|
1107
|
+
desc->Get(context, ConvertToV8String(isolate, "label")).ToLocal(&labelVal);
|
|
1108
|
+
label = GPULabel(isolate, labelVal);
|
|
1113
1109
|
}
|
|
1114
1110
|
|
|
1115
|
-
auto value = canvas_native_webgpu_command_encoder_finish(ptr->GetEncoder(),
|
|
1116
|
-
didSet ? label.c_str() : nullptr);
|
|
1111
|
+
auto value = canvas_native_webgpu_command_encoder_finish(ptr->GetEncoder(), *label);
|
|
1117
1112
|
|
|
1118
1113
|
if (value != nullptr) {
|
|
1119
1114
|
auto ret = GPUCommandBufferImpl::NewInstance(isolate, new GPUCommandBufferImpl(value));
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
#include "Helpers.h"
|
|
9
9
|
#include "ObjectWrapperImpl.h"
|
|
10
10
|
#include "GPUUtils.h"
|
|
11
|
+
|
|
11
12
|
class GPUCommandEncoderImpl : ObjectWrapperImpl {
|
|
12
13
|
public:
|
|
13
14
|
explicit GPUCommandEncoderImpl(const CanvasGPUCommandEncoder *encoder);
|
|
@@ -29,12 +30,15 @@ public:
|
|
|
29
30
|
v8::EscapableHandleScope scope(isolate);
|
|
30
31
|
auto object = GPUCommandEncoderImpl::GetCtor(isolate)->GetFunction(
|
|
31
32
|
context).ToLocalChecked()->NewInstance(context).ToLocalChecked();
|
|
32
|
-
SetNativeType(
|
|
33
|
+
SetNativeType(encoder, NativeType::GPUCommandEncoder);
|
|
33
34
|
object->SetAlignedPointerInInternalField(0, encoder);
|
|
34
35
|
encoder->BindFinalizer(isolate, object);
|
|
35
36
|
return scope.Escape(object);
|
|
36
37
|
}
|
|
37
38
|
|
|
39
|
+
static void GetLabel(v8::Local<v8::Name> name,
|
|
40
|
+
const v8::PropertyCallbackInfo<v8::Value> &info);
|
|
41
|
+
|
|
38
42
|
static void BeginComputePass(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
39
43
|
|
|
40
44
|
static void BeginRenderPass(const v8::FunctionCallbackInfo<v8::Value> &args);
|