@nativescript/canvas 2.0.0-webgpu.4 → 2.0.0-webgpu.41
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 +5 -10
- package/Canvas/common.js +61 -144
- package/Canvas/common.js.map +1 -1
- package/Canvas/index.android.d.ts +6 -5
- package/Canvas/index.android.js +63 -42
- package/Canvas/index.android.js.map +1 -1
- package/Canvas/index.d.ts +13 -3
- package/Canvas/index.ios.d.ts +9 -1
- package/Canvas/index.ios.js +117 -66
- 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 +3 -1
- package/Canvas2D/CanvasRenderingContext2D/index.js +2 -4
- 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.d.ts +4 -2
- package/ImageAsset/index.js +151 -37
- 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/common.d.ts +1 -1
- package/WebGL/WebGLRenderingContext/index.js +76 -32
- package/WebGL/WebGLRenderingContext/index.js.map +1 -1
- package/WebGL2/WebGL2RenderingContext/index.js +5 -5
- 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 +5 -3
- 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 +75 -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 +65 -14
- 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 +5 -1
- package/WebGPU/GPURenderPassEncoder.js +14 -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 +226 -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/fesm2022/nativescript-canvas-angular.mjs.map +1 -1
- package/common.js.map +1 -1
- package/index.d.ts +2 -1
- package/index.js +3 -2
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/platforms/android/canvas-release.aar +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/CanvasNative +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Headers/CanvasNative-Swift.h +61 -30
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Headers/CanvasNative.h +1 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Headers/NSCMTLView.h +32 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Headers/canvas_ios.h +144 -176
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Headers/canvas_native.h +342 -72
- 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 +1928 -630
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios.private.swiftinterface +85 -23
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios.swiftinterface +85 -23
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/NSCCanvas.nib +0 -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 +681 -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 +122 -60
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Headers/CanvasNative.h +1 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Headers/NSCMTLView.h +32 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Headers/canvas_ios.h +144 -176
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Headers/canvas_native.h +342 -72
- 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 +1928 -630
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +85 -23
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios-simulator.swiftinterface +85 -23
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.abi.json +1928 -630
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +85 -23
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +85 -23
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/NSCCanvas.nib +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/_CodeSignature/CodeResources +40 -29
- 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 +683 -646
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/dSYMs/CanvasNative.framework.dSYM/Contents/Resources/Relocations/x86_64/CanvasNative.yml +736 -684
- package/platforms/ios/src/NSOperationQueueWrapper.h +1 -1
- package/platforms/ios/src/NSOperationQueueWrapper.mm +41 -9
- package/platforms/ios/src/cpp/AsyncCallback.h +16 -8
- package/platforms/ios/src/cpp/CanvasJSIModule.cpp +310 -801
- package/platforms/ios/src/cpp/CanvasJSIModule.h +2 -0
- package/platforms/ios/src/cpp/ImageAssetImpl.cpp +578 -413
- package/platforms/ios/src/cpp/ImageAssetImpl.h +7 -3
- package/platforms/ios/src/cpp/ImageBitmapImpl.cpp +60 -3
- package/platforms/ios/src/cpp/ImageBitmapImpl.h +10 -3
- package/platforms/ios/src/cpp/PromiseCallback.h +1 -2
- package/platforms/ios/src/cpp/canvas2d/CanvasRenderingContext2DImpl.cpp +7 -11
- package/platforms/ios/src/cpp/canvas2d/CanvasRenderingContext2DImpl.h +3 -3
- package/platforms/ios/src/cpp/canvas2d/Path2D.h +5 -5
- package/platforms/ios/src/cpp/webgl/WebGLRenderingContext.cpp +106 -1
- package/platforms/ios/src/cpp/webgl/WebGLRenderingContextBase.cpp +6 -6
- package/platforms/ios/src/cpp/webgpu/GPUAdapterImpl.cpp +26 -23
- package/platforms/ios/src/cpp/webgpu/GPUBindGroupImpl.cpp +31 -5
- package/platforms/ios/src/cpp/webgpu/GPUBindGroupImpl.h +4 -1
- package/platforms/ios/src/cpp/webgpu/GPUBindGroupLayoutImpl.cpp +26 -0
- package/platforms/ios/src/cpp/webgpu/GPUBindGroupLayoutImpl.h +3 -0
- package/platforms/ios/src/cpp/webgpu/GPUBufferImpl.cpp +41 -7
- package/platforms/ios/src/cpp/webgpu/GPUBufferImpl.h +4 -0
- package/platforms/ios/src/cpp/webgpu/GPUCanvasContextImpl.cpp +11 -5
- package/platforms/ios/src/cpp/webgpu/GPUCommandBufferImpl.cpp +28 -1
- package/platforms/ios/src/cpp/webgpu/GPUCommandBufferImpl.h +3 -0
- package/platforms/ios/src/cpp/webgpu/GPUCommandEncoderImpl.cpp +75 -79
- package/platforms/ios/src/cpp/webgpu/GPUCommandEncoderImpl.h +4 -0
- package/platforms/ios/src/cpp/webgpu/GPUComputePassEncoderImpl.cpp +56 -23
- package/platforms/ios/src/cpp/webgpu/GPUComputePassEncoderImpl.h +3 -0
- package/platforms/ios/src/cpp/webgpu/GPUComputePipelineImpl.cpp +25 -0
- package/platforms/ios/src/cpp/webgpu/GPUComputePipelineImpl.h +2 -0
- package/platforms/ios/src/cpp/webgpu/GPUDeviceImpl.cpp +1606 -681
- package/platforms/ios/src/cpp/webgpu/GPUDeviceImpl.h +2 -0
- package/platforms/ios/src/cpp/webgpu/GPUImpl.cpp +2 -1
- package/platforms/ios/src/cpp/webgpu/GPUImpl.h +1 -1
- package/platforms/ios/src/cpp/webgpu/GPULabel.h +33 -0
- package/platforms/ios/src/cpp/webgpu/GPUPipelineLayoutImpl.cpp +26 -0
- package/platforms/ios/src/cpp/webgpu/GPUPipelineLayoutImpl.h +3 -1
- package/platforms/ios/src/cpp/webgpu/GPUQuerySetImpl.cpp +1 -2
- package/platforms/ios/src/cpp/webgpu/GPUQuerySetImpl.h +1 -1
- package/platforms/ios/src/cpp/webgpu/GPUQueueImpl.cpp +83 -14
- package/platforms/ios/src/cpp/webgpu/GPUQueueImpl.h +3 -0
- package/platforms/ios/src/cpp/webgpu/GPURenderBundleEncoderImpl.cpp +66 -34
- package/platforms/ios/src/cpp/webgpu/GPURenderBundleEncoderImpl.h +3 -0
- package/platforms/ios/src/cpp/webgpu/GPURenderBundleImpl.cpp +25 -0
- package/platforms/ios/src/cpp/webgpu/GPURenderBundleImpl.h +3 -0
- package/platforms/ios/src/cpp/webgpu/GPURenderPassEncoderImpl.cpp +151 -52
- package/platforms/ios/src/cpp/webgpu/GPURenderPassEncoderImpl.h +7 -0
- package/platforms/ios/src/cpp/webgpu/GPURenderPipelineImpl.cpp +25 -0
- package/platforms/ios/src/cpp/webgpu/GPURenderPipelineImpl.h +3 -0
- package/platforms/ios/src/cpp/webgpu/GPUSamplerImpl.cpp +26 -0
- package/platforms/ios/src/cpp/webgpu/GPUSamplerImpl.h +4 -1
- package/platforms/ios/src/cpp/webgpu/GPUShaderModuleImpl.cpp +24 -0
- package/platforms/ios/src/cpp/webgpu/GPUShaderModuleImpl.h +3 -0
- package/platforms/ios/src/cpp/webgpu/GPUTextureImpl.cpp +34 -8
- package/platforms/ios/src/cpp/webgpu/GPUTextureImpl.h +2 -0
- package/platforms/ios/src/cpp/webgpu/GPUTextureViewImpl.cpp +26 -0
- package/platforms/ios/src/cpp/webgpu/GPUTextureViewImpl.h +3 -0
- package/platforms/ios/src/cpp/webgpu/GPUUtils.h +511 -0
- package/utils.d.ts +1 -1
|
@@ -54,6 +54,11 @@ v8::Local<v8::FunctionTemplate> GPURenderPassEncoderImpl::GetCtor(v8::Isolate *i
|
|
|
54
54
|
auto tmpl = ctorTmpl->InstanceTemplate();
|
|
55
55
|
tmpl->SetInternalFieldCount(2);
|
|
56
56
|
|
|
57
|
+
tmpl->SetLazyDataProperty(
|
|
58
|
+
ConvertToV8String(isolate, "label"),
|
|
59
|
+
GetLabel
|
|
60
|
+
);
|
|
61
|
+
|
|
57
62
|
tmpl->Set(
|
|
58
63
|
ConvertToV8String(isolate, "beginOcclusionQuery"),
|
|
59
64
|
v8::FunctionTemplate::New(isolate, &BeginOcclusionQuery));
|
|
@@ -74,6 +79,14 @@ v8::Local<v8::FunctionTemplate> GPURenderPassEncoderImpl::GetCtor(v8::Isolate *i
|
|
|
74
79
|
ConvertToV8String(isolate, "drawIndirect"),
|
|
75
80
|
v8::FunctionTemplate::New(isolate, &DrawIndirect));
|
|
76
81
|
|
|
82
|
+
tmpl->Set(
|
|
83
|
+
ConvertToV8String(isolate, "multiDrawIndexedIndirect"),
|
|
84
|
+
v8::FunctionTemplate::New(isolate, &MultiDrawIndexedIndirect));
|
|
85
|
+
|
|
86
|
+
tmpl->Set(
|
|
87
|
+
ConvertToV8String(isolate, "multiDrawIndirect"),
|
|
88
|
+
v8::FunctionTemplate::New(isolate, &MultiDrawIndirect));
|
|
89
|
+
|
|
77
90
|
tmpl->Set(
|
|
78
91
|
ConvertToV8String(isolate, "end"),
|
|
79
92
|
v8::FunctionTemplate::New(isolate, &End));
|
|
@@ -136,6 +149,27 @@ v8::Local<v8::FunctionTemplate> GPURenderPassEncoderImpl::GetCtor(v8::Isolate *i
|
|
|
136
149
|
}
|
|
137
150
|
|
|
138
151
|
|
|
152
|
+
void
|
|
153
|
+
GPURenderPassEncoderImpl::GetLabel(v8::Local<v8::Name> name,
|
|
154
|
+
const v8::PropertyCallbackInfo<v8::Value> &info) {
|
|
155
|
+
auto ptr = GetPointer(info.This());
|
|
156
|
+
if (ptr != nullptr) {
|
|
157
|
+
auto label = canvas_native_webgpu_render_pass_encoder_get_label(ptr->pass_);
|
|
158
|
+
if (label == nullptr) {
|
|
159
|
+
info.GetReturnValue().SetEmptyString();
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
info.GetReturnValue().Set(
|
|
163
|
+
ConvertToV8String(info.GetIsolate(), label)
|
|
164
|
+
);
|
|
165
|
+
canvas_native_string_destroy(label);
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
info.GetReturnValue().SetEmptyString();
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
|
|
139
173
|
void
|
|
140
174
|
GPURenderPassEncoderImpl::BeginOcclusionQuery(const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
141
175
|
auto *ptr = GetPointer(args.This());
|
|
@@ -229,7 +263,7 @@ void GPURenderPassEncoderImpl::DrawIndexed(const v8::FunctionCallbackInfo<v8::Va
|
|
|
229
263
|
}
|
|
230
264
|
|
|
231
265
|
auto indexCount = indexCountVal->Uint32Value(
|
|
232
|
-
|
|
266
|
+
context).FromJust();
|
|
233
267
|
canvas_native_webgpu_render_pass_encoder_draw_indexed(ptr->GetPass(),
|
|
234
268
|
indexCount,
|
|
235
269
|
instanceCount, firstIndex,
|
|
@@ -265,6 +299,36 @@ GPURenderPassEncoderImpl::DrawIndexedIndirect(const v8::FunctionCallbackInfo<v8:
|
|
|
265
299
|
}
|
|
266
300
|
|
|
267
301
|
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
void
|
|
305
|
+
GPURenderPassEncoderImpl::MultiDrawIndexedIndirect(
|
|
306
|
+
const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
307
|
+
auto *ptr = GetPointer(args.This());
|
|
308
|
+
if (ptr == nullptr) {
|
|
309
|
+
return;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
auto isolate = args.GetIsolate();
|
|
313
|
+
auto context = isolate->GetCurrentContext();
|
|
314
|
+
|
|
315
|
+
auto indirectBufferVal = args[0];
|
|
316
|
+
auto indirectOffsetVal = args[1];
|
|
317
|
+
auto countVal = args[2];
|
|
318
|
+
|
|
319
|
+
|
|
320
|
+
auto indirectBufferType = GetNativeType(indirectBufferVal);
|
|
321
|
+
|
|
322
|
+
if (indirectBufferType == NativeType::GPUBuffer) {
|
|
323
|
+
auto indirectBuffer = GPUBufferImpl::GetPointer(indirectBufferVal.As<v8::Object>());
|
|
324
|
+
uint64_t offset = (uint64_t) indirectOffsetVal->NumberValue(context).FromJust();
|
|
325
|
+
uint32_t count = countVal->Uint32Value(context).FromJust();
|
|
326
|
+
canvas_native_webgpu_render_pass_encoder_multi_draw_indexed_indirect(ptr->GetPass(),
|
|
327
|
+
indirectBuffer->GetGPUBuffer(),
|
|
328
|
+
offset, count);
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
|
|
268
332
|
}
|
|
269
333
|
|
|
270
334
|
void
|
|
@@ -292,6 +356,35 @@ GPURenderPassEncoderImpl::DrawIndirect(const v8::FunctionCallbackInfo<v8::Value>
|
|
|
292
356
|
}
|
|
293
357
|
|
|
294
358
|
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
void
|
|
362
|
+
GPURenderPassEncoderImpl::MultiDrawIndirect(const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
363
|
+
auto *ptr = GetPointer(args.This());
|
|
364
|
+
if (ptr == nullptr) {
|
|
365
|
+
return;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
auto isolate = args.GetIsolate();
|
|
369
|
+
auto context = isolate->GetCurrentContext();
|
|
370
|
+
|
|
371
|
+
auto indirectBufferVal = args[0];
|
|
372
|
+
auto indirectOffsetVal = args[1];
|
|
373
|
+
auto countVal = args[2];
|
|
374
|
+
|
|
375
|
+
|
|
376
|
+
auto indirectBufferType = GetNativeType(indirectBufferVal);
|
|
377
|
+
|
|
378
|
+
if (indirectBufferType == NativeType::GPUBuffer) {
|
|
379
|
+
auto indirectBuffer = GPUBufferImpl::GetPointer(indirectBufferVal.As<v8::Object>());
|
|
380
|
+
uint64_t offset = (uint64_t) indirectOffsetVal->NumberValue(context).FromJust();
|
|
381
|
+
uint32_t count = countVal->Uint32Value(context).FromJust();
|
|
382
|
+
canvas_native_webgpu_render_pass_encoder_multi_draw_indirect(ptr->GetPass(),
|
|
383
|
+
indirectBuffer->GetGPUBuffer(),
|
|
384
|
+
offset, count);
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
|
|
295
388
|
}
|
|
296
389
|
|
|
297
390
|
void GPURenderPassEncoderImpl::End(const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
@@ -328,7 +421,7 @@ void GPURenderPassEncoderImpl::ExecuteBundles(const v8::FunctionCallbackInfo<v8:
|
|
|
328
421
|
std::vector<const CanvasGPURenderBundle *> bundles;
|
|
329
422
|
for (int i = 0; i < len; i++) {
|
|
330
423
|
v8::Local<v8::Value> bundleVal;
|
|
331
|
-
bundlesArray->Get(context, i).ToLocal(&
|
|
424
|
+
bundlesArray->Get(context, i).ToLocal(&bundleVal);
|
|
332
425
|
auto type = GetNativeType(bundleVal);
|
|
333
426
|
if (type == NativeType::GPURenderBundle) {
|
|
334
427
|
auto bundle = GPURenderBundleImpl::GetPointer(bundleVal.As<v8::Object>());
|
|
@@ -402,30 +495,34 @@ void GPURenderPassEncoderImpl::SetBindGroup(const v8::FunctionCallbackInfo<v8::V
|
|
|
402
495
|
auto dynamicOffsetsStart = args[3];
|
|
403
496
|
auto dynamicOffsetsLength = args[4];
|
|
404
497
|
|
|
498
|
+
const CanvasGPUBindGroup *bindGroup = nullptr;
|
|
499
|
+
|
|
405
500
|
auto type = GetNativeType(bindGroupVal);
|
|
406
501
|
|
|
502
|
+
auto index = indexVal->Uint32Value(context).FromJust();
|
|
503
|
+
|
|
407
504
|
if (type == NativeType::GPUBindGroup) {
|
|
408
|
-
auto
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
505
|
+
auto group = GPUBindGroupImpl::GetPointer(bindGroupVal.As<v8::Object>());
|
|
506
|
+
bindGroup = group->GetBindGroup();
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
if (dynamicOffsets->IsUint32Array()) {
|
|
510
|
+
auto buf = dynamicOffsets.As<v8::Uint32Array>();
|
|
511
|
+
auto buffer = buf->Buffer();
|
|
512
|
+
auto store = buffer->GetBackingStore();
|
|
513
|
+
auto offset = buf->ByteOffset();
|
|
514
|
+
auto data = static_cast<uint8_t *>(buffer->GetBackingStore()->Data()) + offset;
|
|
515
|
+
auto size = buf->Length();
|
|
516
|
+
auto start = (size_t) dynamicOffsetsStart->NumberValue(context).FromJust();
|
|
517
|
+
auto offset_length = (size_t) dynamicOffsetsLength->NumberValue(context).FromJust();
|
|
518
|
+
canvas_native_webgpu_render_pass_encoder_set_bind_group(ptr->GetPass(), index,
|
|
519
|
+
bindGroup,
|
|
520
|
+
static_cast<const uint32_t *>(static_cast<void *>(data)),
|
|
521
|
+
size, start, offset_length);
|
|
522
|
+
} else {
|
|
523
|
+
canvas_native_webgpu_render_pass_encoder_set_bind_group(ptr->GetPass(), index,
|
|
524
|
+
bindGroup,
|
|
525
|
+
nullptr, 0, 0, 0);
|
|
429
526
|
}
|
|
430
527
|
}
|
|
431
528
|
|
|
@@ -446,7 +543,7 @@ void GPURenderPassEncoderImpl::SetIndexBuffer(const v8::FunctionCallbackInfo<v8:
|
|
|
446
543
|
|
|
447
544
|
auto type = GetNativeType(bufferVal);
|
|
448
545
|
|
|
449
|
-
if (type == NativeType::
|
|
546
|
+
if (type == NativeType::GPUBuffer) {
|
|
450
547
|
auto buffer = GPUBufferImpl::GetPointer(bufferVal.As<v8::Object>());
|
|
451
548
|
auto indexFormat = ConvertFromV8String(isolate, indexFormatVal);
|
|
452
549
|
if (offsetVal->IsNumber()) {
|
|
@@ -502,7 +599,7 @@ void GPURenderPassEncoderImpl::SetPipeline(const v8::FunctionCallbackInfo<v8::Va
|
|
|
502
599
|
}
|
|
503
600
|
|
|
504
601
|
auto pipelineVal = args[0];
|
|
505
|
-
if(GetNativeType(pipelineVal) == NativeType::GPURenderPipeline){
|
|
602
|
+
if (GetNativeType(pipelineVal) == NativeType::GPURenderPipeline) {
|
|
506
603
|
auto pipeline = GPURenderPipelineImpl::GetPointer(pipelineVal.As<v8::Object>());
|
|
507
604
|
canvas_native_webgpu_render_pass_encoder_set_pipeline(ptr->GetPass(),
|
|
508
605
|
pipeline->GetGPUPipeline());
|
|
@@ -565,13 +662,12 @@ void GPURenderPassEncoderImpl::SetVertexBuffer(const v8::FunctionCallbackInfo<v8
|
|
|
565
662
|
int64_t size = -1;
|
|
566
663
|
auto offsetVal = args[2];
|
|
567
664
|
auto sizeVal = args[3];
|
|
665
|
+
auto type = GetNativeType(bufferVal);
|
|
666
|
+
auto isolate = args.GetIsolate();
|
|
667
|
+
if (type == NativeType::GPUBuffer) {
|
|
668
|
+
auto context = isolate->GetCurrentContext();
|
|
669
|
+
auto slot = slotVal->ToUint32(context).ToLocalChecked();
|
|
568
670
|
|
|
569
|
-
if (slotVal->IsUint32() && bufferVal->IsObject()) {
|
|
570
|
-
auto slot = slotVal.As<v8::Uint32>()->Value();
|
|
571
|
-
if (GetNativeType(bufferVal) != NativeType::GPUBuffer) {
|
|
572
|
-
// todo throw ??
|
|
573
|
-
return;
|
|
574
|
-
}
|
|
575
671
|
|
|
576
672
|
auto buffer = GPUBufferImpl::GetPointer(bufferVal.As<v8::Object>());
|
|
577
673
|
|
|
@@ -583,7 +679,7 @@ void GPURenderPassEncoderImpl::SetVertexBuffer(const v8::FunctionCallbackInfo<v8
|
|
|
583
679
|
size = (int64_t) sizeVal.As<v8::Number>()->Value();
|
|
584
680
|
}
|
|
585
681
|
|
|
586
|
-
canvas_native_webgpu_render_pass_encoder_set_vertex_buffer(ptr->GetPass(), slot,
|
|
682
|
+
canvas_native_webgpu_render_pass_encoder_set_vertex_buffer(ptr->GetPass(), slot->Value(),
|
|
587
683
|
buffer->GetGPUBuffer(), offset,
|
|
588
684
|
size);
|
|
589
685
|
|
|
@@ -596,29 +692,32 @@ void GPURenderPassEncoderImpl::SetViewport(const v8::FunctionCallbackInfo<v8::Va
|
|
|
596
692
|
return;
|
|
597
693
|
}
|
|
598
694
|
|
|
599
|
-
auto
|
|
600
|
-
auto
|
|
601
|
-
auto
|
|
602
|
-
auto
|
|
695
|
+
auto xVal = args[0];
|
|
696
|
+
auto yVal = args[1];
|
|
697
|
+
auto widthVal = args[2];
|
|
698
|
+
auto heightVal = args[3];
|
|
603
699
|
|
|
604
|
-
auto
|
|
605
|
-
auto
|
|
700
|
+
auto minDepthVal = args[4];
|
|
701
|
+
auto maxDepthVal = args[5];
|
|
606
702
|
|
|
607
703
|
auto isolate = args.GetIsolate();
|
|
608
704
|
auto context = isolate->GetCurrentContext();
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
(float)
|
|
614
|
-
|
|
615
|
-
(float)
|
|
616
|
-
|
|
617
|
-
(float)
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
705
|
+
|
|
706
|
+
|
|
707
|
+
auto x = (float) xVal->NumberValue(
|
|
708
|
+
context).FromJust();
|
|
709
|
+
auto y = (float) yVal->NumberValue(
|
|
710
|
+
context).FromJust();
|
|
711
|
+
auto width = (float) widthVal->NumberValue(
|
|
712
|
+
context).FromJust();
|
|
713
|
+
auto height = (float) heightVal->NumberValue(
|
|
714
|
+
context).FromJust();
|
|
715
|
+
|
|
716
|
+
auto minDepth = (float) minDepthVal->NumberValue(
|
|
717
|
+
context).FromJust();
|
|
718
|
+
auto maxDepth = (float) maxDepthVal->NumberValue(
|
|
719
|
+
context).FromJust();
|
|
720
|
+
|
|
721
|
+
canvas_native_webgpu_render_pass_encoder_set_viewport(ptr->GetPass(),x,y,width,height, minDepth, maxDepth);
|
|
623
722
|
|
|
624
723
|
}
|
|
@@ -38,6 +38,9 @@ public:
|
|
|
38
38
|
return scope.Escape(object);
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
+
static void GetLabel(v8::Local<v8::Name> name,
|
|
42
|
+
const v8::PropertyCallbackInfo<v8::Value> &info);
|
|
43
|
+
|
|
41
44
|
static void BeginOcclusionQuery(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
42
45
|
|
|
43
46
|
static void Draw(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
@@ -48,6 +51,10 @@ public:
|
|
|
48
51
|
|
|
49
52
|
static void DrawIndirect(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
50
53
|
|
|
54
|
+
static void MultiDrawIndexedIndirect(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
55
|
+
|
|
56
|
+
static void MultiDrawIndirect(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
57
|
+
|
|
51
58
|
static void End(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
52
59
|
|
|
53
60
|
static void EndOcclusionQuery(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
@@ -48,6 +48,10 @@ v8::Local<v8::FunctionTemplate> GPURenderPipelineImpl::GetCtor(v8::Isolate *isol
|
|
|
48
48
|
auto tmpl = ctorTmpl->InstanceTemplate();
|
|
49
49
|
tmpl->SetInternalFieldCount(2);
|
|
50
50
|
|
|
51
|
+
tmpl->SetLazyDataProperty(
|
|
52
|
+
ConvertToV8String(isolate, "label"),
|
|
53
|
+
GetLabel
|
|
54
|
+
);
|
|
51
55
|
|
|
52
56
|
tmpl->Set(
|
|
53
57
|
ConvertToV8String(isolate, "getBindGroupLayout"),
|
|
@@ -82,3 +86,24 @@ void GPURenderPipelineImpl::GetBindGroupLayout(const v8::FunctionCallbackInfo<v8
|
|
|
82
86
|
args.GetReturnValue().SetUndefined();
|
|
83
87
|
}
|
|
84
88
|
|
|
89
|
+
|
|
90
|
+
void
|
|
91
|
+
GPURenderPipelineImpl::GetLabel(v8::Local<v8::Name> name,
|
|
92
|
+
const v8::PropertyCallbackInfo<v8::Value> &info) {
|
|
93
|
+
auto ptr = GetPointer(info.This());
|
|
94
|
+
if (ptr != nullptr) {
|
|
95
|
+
auto label = canvas_native_webgpu_render_pipeline_get_label(ptr->pipeline_);
|
|
96
|
+
if (label == nullptr) {
|
|
97
|
+
info.GetReturnValue().SetEmptyString();
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
info.GetReturnValue().Set(
|
|
101
|
+
ConvertToV8String(info.GetIsolate(), label)
|
|
102
|
+
);
|
|
103
|
+
canvas_native_string_destroy(label);
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
info.GetReturnValue().SetEmptyString();
|
|
108
|
+
}
|
|
109
|
+
|
|
@@ -47,7 +47,33 @@ v8::Local<v8::FunctionTemplate> GPUSamplerImpl::GetCtor(v8::Isolate *isolate) {
|
|
|
47
47
|
auto tmpl = ctorTmpl->InstanceTemplate();
|
|
48
48
|
tmpl->SetInternalFieldCount(2);
|
|
49
49
|
|
|
50
|
+
tmpl->SetLazyDataProperty(
|
|
51
|
+
ConvertToV8String(isolate, "label"),
|
|
52
|
+
GetLabel
|
|
53
|
+
);
|
|
54
|
+
|
|
50
55
|
cache->GPUSamplerTmpl =
|
|
51
56
|
std::make_unique<v8::Persistent<v8::FunctionTemplate>>(isolate, ctorTmpl);
|
|
52
57
|
return ctorTmpl;
|
|
53
58
|
}
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
void
|
|
62
|
+
GPUSamplerImpl::GetLabel(v8::Local<v8::Name> name,
|
|
63
|
+
const v8::PropertyCallbackInfo<v8::Value> &info) {
|
|
64
|
+
auto ptr = GetPointer(info.This());
|
|
65
|
+
if (ptr != nullptr) {
|
|
66
|
+
auto label = canvas_native_webgpu_sampler_get_label(ptr->sampler_);
|
|
67
|
+
if (label == nullptr) {
|
|
68
|
+
info.GetReturnValue().SetEmptyString();
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
info.GetReturnValue().Set(
|
|
72
|
+
ConvertToV8String(info.GetIsolate(), label)
|
|
73
|
+
);
|
|
74
|
+
canvas_native_string_destroy(label);
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
info.GetReturnValue().SetEmptyString();
|
|
79
|
+
}
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
#include "Helpers.h"
|
|
10
10
|
#include "ObjectWrapperImpl.h"
|
|
11
11
|
|
|
12
|
-
class GPUSamplerImpl: ObjectWrapperImpl {
|
|
12
|
+
class GPUSamplerImpl : ObjectWrapperImpl {
|
|
13
13
|
public:
|
|
14
14
|
explicit GPUSamplerImpl(const CanvasGPUSampler *sampler);
|
|
15
15
|
|
|
@@ -36,6 +36,9 @@ public:
|
|
|
36
36
|
return scope.Escape(object);
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
+
static void GetLabel(v8::Local<v8::Name> name,
|
|
40
|
+
const v8::PropertyCallbackInfo<v8::Value> &info);
|
|
41
|
+
|
|
39
42
|
|
|
40
43
|
private:
|
|
41
44
|
const CanvasGPUSampler *sampler_;
|
|
@@ -47,10 +47,34 @@ v8::Local<v8::FunctionTemplate> GPUShaderModuleImpl::GetCtor(v8::Isolate *isolat
|
|
|
47
47
|
auto tmpl = ctorTmpl->InstanceTemplate();
|
|
48
48
|
tmpl->SetInternalFieldCount(2);
|
|
49
49
|
|
|
50
|
+
tmpl->SetLazyDataProperty(
|
|
51
|
+
ConvertToV8String(isolate, "label"),
|
|
52
|
+
GetLabel
|
|
53
|
+
);
|
|
50
54
|
|
|
51
55
|
cache->GPUShaderModuleTmpl =
|
|
52
56
|
std::make_unique<v8::Persistent<v8::FunctionTemplate>>(isolate, ctorTmpl);
|
|
53
57
|
return ctorTmpl;
|
|
54
58
|
}
|
|
55
59
|
|
|
60
|
+
void
|
|
61
|
+
GPUShaderModuleImpl::GetLabel(v8::Local<v8::Name> name,
|
|
62
|
+
const v8::PropertyCallbackInfo<v8::Value> &info) {
|
|
63
|
+
auto ptr = GetPointer(info.This());
|
|
64
|
+
if (ptr != nullptr) {
|
|
65
|
+
auto label = canvas_native_webgpu_shader_module_get_label(ptr->shaderModule_);
|
|
66
|
+
if (label == nullptr) {
|
|
67
|
+
info.GetReturnValue().SetEmptyString();
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
info.GetReturnValue().Set(
|
|
71
|
+
ConvertToV8String(info.GetIsolate(), label)
|
|
72
|
+
);
|
|
73
|
+
canvas_native_string_destroy(label);
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
info.GetReturnValue().SetEmptyString();
|
|
78
|
+
}
|
|
79
|
+
|
|
56
80
|
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
#include "GPUTextureImpl.h"
|
|
6
6
|
#include "Caches.h"
|
|
7
7
|
#include "GPUTextureViewImpl.h"
|
|
8
|
+
#include "GPULabel.h"
|
|
8
9
|
|
|
9
10
|
GPUTextureImpl::GPUTextureImpl(const CanvasGPUTexture *texture) : texture_(texture) {}
|
|
10
11
|
|
|
@@ -47,6 +48,10 @@ v8::Local<v8::FunctionTemplate> GPUTextureImpl::GetCtor(v8::Isolate *isolate) {
|
|
|
47
48
|
auto tmpl = ctorTmpl->InstanceTemplate();
|
|
48
49
|
tmpl->SetInternalFieldCount(2);
|
|
49
50
|
|
|
51
|
+
tmpl->SetLazyDataProperty(
|
|
52
|
+
ConvertToV8String(isolate, "label"),
|
|
53
|
+
GetLabel
|
|
54
|
+
);
|
|
50
55
|
|
|
51
56
|
tmpl->Set(
|
|
52
57
|
ConvertToV8String(isolate, "destroy"),
|
|
@@ -107,6 +112,27 @@ v8::Local<v8::FunctionTemplate> GPUTextureImpl::GetCtor(v8::Isolate *isolate) {
|
|
|
107
112
|
return ctorTmpl;
|
|
108
113
|
}
|
|
109
114
|
|
|
115
|
+
|
|
116
|
+
void
|
|
117
|
+
GPUTextureImpl::GetLabel(v8::Local<v8::Name> name,
|
|
118
|
+
const v8::PropertyCallbackInfo<v8::Value> &info) {
|
|
119
|
+
auto ptr = GetPointer(info.This());
|
|
120
|
+
if (ptr != nullptr) {
|
|
121
|
+
auto label = canvas_native_webgpu_texture_get_label(ptr->texture_);
|
|
122
|
+
if (label == nullptr) {
|
|
123
|
+
info.GetReturnValue().SetEmptyString();
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
info.GetReturnValue().Set(
|
|
127
|
+
ConvertToV8String(info.GetIsolate(), label)
|
|
128
|
+
);
|
|
129
|
+
canvas_native_string_destroy(label);
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
info.GetReturnValue().SetEmptyString();
|
|
134
|
+
}
|
|
135
|
+
|
|
110
136
|
void
|
|
111
137
|
GPUTextureImpl::GetDimension(v8::Local<v8::Name> name,
|
|
112
138
|
const v8::PropertyCallbackInfo<v8::Value> &info) {
|
|
@@ -249,6 +275,7 @@ void GPUTextureImpl::CreateView(const v8::FunctionCallbackInfo<v8::Value> &args)
|
|
|
249
275
|
aspect, 0, -1, 0, -1
|
|
250
276
|
};
|
|
251
277
|
|
|
278
|
+
GPULabel label;
|
|
252
279
|
|
|
253
280
|
if (descVal->IsObject()) {
|
|
254
281
|
descriptor = new CanvasCreateTextureViewDescriptor{};
|
|
@@ -269,7 +296,6 @@ void GPUTextureImpl::CreateView(const v8::FunctionCallbackInfo<v8::Value> &args)
|
|
|
269
296
|
}
|
|
270
297
|
|
|
271
298
|
|
|
272
|
-
|
|
273
299
|
v8::Local<v8::Value> arrayLayerCountVal;
|
|
274
300
|
if (descObj->Get(context, ConvertToV8String(isolate, "arrayLayerCount")).ToLocal(
|
|
275
301
|
&arrayLayerCountVal) && arrayLayerCountVal->IsInt32()) {
|
|
@@ -297,16 +323,15 @@ void GPUTextureImpl::CreateView(const v8::FunctionCallbackInfo<v8::Value> &args)
|
|
|
297
323
|
descriptor->range = ⦥
|
|
298
324
|
|
|
299
325
|
|
|
300
|
-
|
|
301
326
|
v8::Local<v8::Value> formatVal;
|
|
302
327
|
descObj->Get(context, ConvertToV8String(isolate, "format")).ToLocal(&formatVal);
|
|
303
328
|
auto formatStr = ConvertFromV8String(isolate, formatVal);
|
|
304
329
|
|
|
305
|
-
descriptor->format = CanvasOptionalGPUTextureFormat
|
|
306
|
-
|
|
330
|
+
descriptor->format = CanvasOptionalGPUTextureFormat{
|
|
331
|
+
CanvasOptionalGPUTextureFormatNone
|
|
307
332
|
};
|
|
308
333
|
|
|
309
|
-
if (!formatStr.empty()){
|
|
334
|
+
if (!formatStr.empty()) {
|
|
310
335
|
auto format = canvas_native_webgpu_enum_string_to_gpu_texture(formatStr.c_str());
|
|
311
336
|
descriptor->format = format;
|
|
312
337
|
}
|
|
@@ -317,9 +342,9 @@ void GPUTextureImpl::CreateView(const v8::FunctionCallbackInfo<v8::Value> &args)
|
|
|
317
342
|
v8::Local<v8::Value> labelVal;
|
|
318
343
|
descObj->Get(context, ConvertToV8String(isolate, "label")).ToLocal(&labelVal);
|
|
319
344
|
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
345
|
+
label = GPULabel(isolate, labelVal);
|
|
346
|
+
|
|
347
|
+
descriptor->label = *label;
|
|
323
348
|
|
|
324
349
|
v8::Local<v8::Value> dimensionVal;
|
|
325
350
|
if (descObj->Get(context, ConvertToV8String(isolate, "dimension")).ToLocal(&dimensionVal)) {
|
|
@@ -347,6 +372,7 @@ void GPUTextureImpl::CreateView(const v8::FunctionCallbackInfo<v8::Value> &args)
|
|
|
347
372
|
|
|
348
373
|
if (descriptor != nullptr) {
|
|
349
374
|
delete descriptor;
|
|
375
|
+
descriptor = nullptr;
|
|
350
376
|
}
|
|
351
377
|
|
|
352
378
|
if (view != nullptr) {
|
|
@@ -46,8 +46,34 @@ v8::Local<v8::FunctionTemplate> GPUTextureViewImpl::GetCtor(v8::Isolate *isolate
|
|
|
46
46
|
auto tmpl = ctorTmpl->InstanceTemplate();
|
|
47
47
|
tmpl->SetInternalFieldCount(2);
|
|
48
48
|
|
|
49
|
+
tmpl->SetLazyDataProperty(
|
|
50
|
+
ConvertToV8String(isolate, "label"),
|
|
51
|
+
GetLabel
|
|
52
|
+
);
|
|
53
|
+
|
|
49
54
|
|
|
50
55
|
cache->GPUTextureViewTmpl =
|
|
51
56
|
std::make_unique<v8::Persistent<v8::FunctionTemplate>>(isolate, ctorTmpl);
|
|
52
57
|
return ctorTmpl;
|
|
53
58
|
}
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
void
|
|
62
|
+
GPUTextureViewImpl::GetLabel(v8::Local<v8::Name> name,
|
|
63
|
+
const v8::PropertyCallbackInfo<v8::Value> &info) {
|
|
64
|
+
auto ptr = GetPointer(info.This());
|
|
65
|
+
if (ptr != nullptr) {
|
|
66
|
+
auto label = canvas_native_webgpu_texture_view_get_label(ptr->view_);
|
|
67
|
+
if (label == nullptr) {
|
|
68
|
+
info.GetReturnValue().SetEmptyString();
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
info.GetReturnValue().Set(
|
|
72
|
+
ConvertToV8String(info.GetIsolate(), label)
|
|
73
|
+
);
|
|
74
|
+
canvas_native_string_destroy(label);
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
info.GetReturnValue().SetEmptyString();
|
|
79
|
+
}
|