@nativescript/canvas 2.0.0-webgpu.34 → 2.0.0-webgpu.35
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/index.android.js.map +1 -1
- package/Canvas/index.ios.d.ts +7 -1
- package/Canvas/index.ios.js +56 -16
- package/Canvas/index.ios.js.map +1 -1
- package/WebGL/WebGLRenderingContext/index.js +1 -1
- package/WebGL/WebGLRenderingContext/index.js.map +1 -1
- package/WebGL2/WebGL2RenderingContext/index.js +1 -1
- package/WebGL2/WebGL2RenderingContext/index.js.map +1 -1
- package/angular/esm2022/index.mjs +4 -4
- package/angular/fesm2022/nativescript-canvas-angular.mjs +4 -4
- package/package.json +1 -1
- 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 +1 -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 +7997 -7202
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios.private.swiftinterface +4 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios.swiftinterface +4 -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 +525 -519
- 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 +2 -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 +7997 -7202
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +4 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios-simulator.swiftinterface +4 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.abi.json +7997 -7202
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +4 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +4 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/_CodeSignature/CodeResources +22 -22
- 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 +681 -675
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/dSYMs/CanvasNative.framework.dSYM/Contents/Resources/Relocations/x86_64/CanvasNative.yml +734 -728
- package/platforms/ios/src/cpp/CanvasJSIModule.cpp +11 -12
- package/platforms/ios/src/cpp/webgl/WebGLRenderingContextBase.cpp +1 -1
- package/platforms/ios/src/cpp/webgpu/GPUComputePassEncoderImpl.cpp +42 -37
- package/platforms/ios/src/cpp/webgpu/GPURenderBundleEncoderImpl.cpp +26 -23
- package/platforms/ios/src/cpp/webgpu/GPURenderPassEncoderImpl.cpp +26 -23
|
@@ -233,7 +233,7 @@ void CanvasJSIModule::Create2DContext(const v8::FunctionCallbackInfo<v8::Value>
|
|
|
233
233
|
auto context = isolate->GetCurrentContext();
|
|
234
234
|
auto ptr = args[0].As<v8::BigInt>()->Int64Value();
|
|
235
235
|
|
|
236
|
-
auto context_2d = static_cast<CanvasRenderingContext2D *>((void *)ptr);
|
|
236
|
+
auto context_2d = static_cast<CanvasRenderingContext2D *>((void *) ptr);
|
|
237
237
|
|
|
238
238
|
auto ret = CanvasRenderingContext2DImpl::NewInstance(isolate, new CanvasRenderingContext2DImpl(
|
|
239
239
|
context_2d));
|
|
@@ -358,7 +358,7 @@ void CanvasJSIModule::CreateImageBitmap(const v8::FunctionCallbackInfo<v8::Value
|
|
|
358
358
|
isolate, ta);
|
|
359
359
|
|
|
360
360
|
auto callback = new AsyncCallback(isolate, cbFunc, [](bool done, void *data) {
|
|
361
|
-
if(data == nullptr){return;}
|
|
361
|
+
if (data == nullptr) { return; }
|
|
362
362
|
auto async_data = static_cast<AsyncCallback *>(data);
|
|
363
363
|
auto func = async_data->inner_.get();
|
|
364
364
|
if (func != nullptr && func->isolate_ != nullptr) {
|
|
@@ -598,7 +598,7 @@ void CanvasJSIModule::Create2DContextWithPointer(const v8::FunctionCallbackInfo<
|
|
|
598
598
|
|
|
599
599
|
struct FileData {
|
|
600
600
|
char *error_;
|
|
601
|
-
U8Buffer*
|
|
601
|
+
U8Buffer *data;
|
|
602
602
|
|
|
603
603
|
~FileData() {
|
|
604
604
|
if (error_ != nullptr) {
|
|
@@ -615,7 +615,7 @@ void CanvasJSIModule::ReadFile(const v8::FunctionCallbackInfo<v8::Value> &args)
|
|
|
615
615
|
|
|
616
616
|
|
|
617
617
|
auto callback = new AsyncCallback(isolate, cbFunc, [](bool done, void *data) {
|
|
618
|
-
if(data == nullptr){return;}
|
|
618
|
+
if (data == nullptr) { return; }
|
|
619
619
|
auto async_data = static_cast<AsyncCallback *>(data);
|
|
620
620
|
auto func = async_data->inner_.get();
|
|
621
621
|
if (func != nullptr && func->isolate_ != nullptr) {
|
|
@@ -624,12 +624,12 @@ void CanvasJSIModule::ReadFile(const v8::FunctionCallbackInfo<v8::Value> &args)
|
|
|
624
624
|
v8::Isolate::Scope isolate_scope(isolate);
|
|
625
625
|
v8::HandleScope handle_scope(isolate);
|
|
626
626
|
v8::Local<v8::Function> callback = func->callback_.Get(
|
|
627
|
-
|
|
627
|
+
isolate);
|
|
628
628
|
v8::Local<v8::Context> context = callback->GetCreationContextChecked();
|
|
629
629
|
v8::Context::Scope context_scope(context);
|
|
630
630
|
|
|
631
631
|
if (func->data != nullptr) {
|
|
632
|
-
auto file_data = static_cast<FileData*>(func->data);
|
|
632
|
+
auto file_data = static_cast<FileData *>(func->data);
|
|
633
633
|
|
|
634
634
|
v8::Local<v8::Value> args[2];
|
|
635
635
|
|
|
@@ -701,11 +701,11 @@ void CanvasJSIModule::ReadFile(const v8::FunctionCallbackInfo<v8::Value> &args)
|
|
|
701
701
|
|
|
702
702
|
if (!canvas_native_helper_read_file_has_error(ret)) {
|
|
703
703
|
auto buf = canvas_native_helper_read_file_take_data(ret);
|
|
704
|
-
callback->inner_->data = new FileData
|
|
704
|
+
callback->inner_->data = new FileData{nullptr, buf};
|
|
705
705
|
done = true;
|
|
706
706
|
} else {
|
|
707
707
|
auto error = canvas_native_helper_read_file_get_error(ret);
|
|
708
|
-
callback->inner_->data = new FileData
|
|
708
|
+
callback->inner_->data = new FileData{const_cast<char *>(error), nullptr};
|
|
709
709
|
}
|
|
710
710
|
canvas_native_helper_release(ret);
|
|
711
711
|
callback->execute(done);
|
|
@@ -714,7 +714,6 @@ void CanvasJSIModule::ReadFile(const v8::FunctionCallbackInfo<v8::Value> &args)
|
|
|
714
714
|
thread.detach();
|
|
715
715
|
|
|
716
716
|
|
|
717
|
-
|
|
718
717
|
}
|
|
719
718
|
|
|
720
719
|
void CanvasJSIModule::CreateWebGLContext(const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
@@ -734,7 +733,7 @@ void CanvasJSIModule::CreateWebGLContext(const v8::FunctionCallbackInfo<v8::Valu
|
|
|
734
733
|
auto count = args.Length();
|
|
735
734
|
if (count == 6) {
|
|
736
735
|
auto ctx = args[1].As<v8::BigInt>()->Int64Value();
|
|
737
|
-
auto webgl =
|
|
736
|
+
auto webgl = (WebGLState *) ctx;
|
|
738
737
|
|
|
739
738
|
auto renderingContext = WebGLRenderingContext::NewInstance(isolate,
|
|
740
739
|
new WebGLRenderingContext(
|
|
@@ -817,8 +816,8 @@ void CanvasJSIModule::CreateWebGL2Context(const v8::FunctionCallbackInfo<v8::Val
|
|
|
817
816
|
|
|
818
817
|
auto count = args.Length();
|
|
819
818
|
if (count == 6) {
|
|
820
|
-
auto ctx = args[
|
|
821
|
-
auto webgl =
|
|
819
|
+
auto ctx = args[1].As<v8::BigInt>()->Int64Value();
|
|
820
|
+
auto webgl = (WebGLState *) ctx;
|
|
822
821
|
auto renderingContext = WebGL2RenderingContext::NewInstance(isolate,
|
|
823
822
|
new WebGL2RenderingContext(
|
|
824
823
|
webgl,
|
|
@@ -141,8 +141,8 @@ WebGLRenderingContextBase::~WebGLRenderingContextBase() {
|
|
|
141
141
|
if (_raf != nullptr) {
|
|
142
142
|
canvas_native_raf_stop(
|
|
143
143
|
_raf->GetRaf());
|
|
144
|
+
canvas_native_raf_release(_raf->GetRaf());
|
|
144
145
|
}
|
|
145
|
-
canvas_native_raf_release(_raf->GetRaf());
|
|
146
146
|
this->raf_ = nullptr;
|
|
147
147
|
canvas_native_webgl_state_destroy(this->GetState());
|
|
148
148
|
this->state_ = nullptr;
|
|
@@ -17,7 +17,7 @@ const CanvasGPUComputePassEncoder *GPUComputePassEncoderImpl::GetComputePass() {
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
void GPUComputePassEncoderImpl::Init(v8::Local
|
|
20
|
+
void GPUComputePassEncoderImpl::Init(v8::Local<v8::Object> canvasModule, v8::Isolate *isolate) {
|
|
21
21
|
v8::Locker locker(isolate);
|
|
22
22
|
v8::Isolate::Scope isolate_scope(isolate);
|
|
23
23
|
v8::HandleScope handle_scope(isolate);
|
|
@@ -31,7 +31,7 @@ void GPUComputePassEncoderImpl::Init(v8::Local <v8::Object> canvasModule, v8::Is
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
GPUComputePassEncoderImpl *
|
|
34
|
-
GPUComputePassEncoderImpl::GetPointer(const v8::Local
|
|
34
|
+
GPUComputePassEncoderImpl::GetPointer(const v8::Local<v8::Object> &object) {
|
|
35
35
|
auto ptr = object->GetAlignedPointerFromInternalField(0);
|
|
36
36
|
if (ptr == nullptr) {
|
|
37
37
|
return nullptr;
|
|
@@ -39,14 +39,14 @@ GPUComputePassEncoderImpl::GetPointer(const v8::Local <v8::Object> &object) {
|
|
|
39
39
|
return static_cast<GPUComputePassEncoderImpl *>(ptr);
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
v8::Local
|
|
42
|
+
v8::Local<v8::FunctionTemplate> GPUComputePassEncoderImpl::GetCtor(v8::Isolate *isolate) {
|
|
43
43
|
auto cache = Caches::Get(isolate);
|
|
44
44
|
auto ctor = cache->GPUComputePassEncoderTmpl.get();
|
|
45
45
|
if (ctor != nullptr) {
|
|
46
46
|
return ctor->Get(isolate);
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
v8::Local
|
|
49
|
+
v8::Local<v8::FunctionTemplate> ctorTmpl = v8::FunctionTemplate::New(isolate);
|
|
50
50
|
ctorTmpl->InstanceTemplate()->SetInternalFieldCount(2);
|
|
51
51
|
ctorTmpl->SetClassName(ConvertToV8String(isolate, "GPUComputePassEncoder"));
|
|
52
52
|
|
|
@@ -92,14 +92,14 @@ v8::Local <v8::FunctionTemplate> GPUComputePassEncoderImpl::GetCtor(v8::Isolate
|
|
|
92
92
|
|
|
93
93
|
|
|
94
94
|
cache->GPUComputePassEncoderTmpl =
|
|
95
|
-
std::make_unique<v8::Persistent
|
|
96
|
-
|
|
95
|
+
std::make_unique<v8::Persistent<v8::FunctionTemplate>>
|
|
96
|
+
(isolate, ctorTmpl);
|
|
97
97
|
return ctorTmpl;
|
|
98
98
|
}
|
|
99
99
|
|
|
100
100
|
void
|
|
101
|
-
GPUComputePassEncoderImpl::GetLabel(v8::Local
|
|
102
|
-
const v8::PropertyCallbackInfo
|
|
101
|
+
GPUComputePassEncoderImpl::GetLabel(v8::Local<v8::Name> name,
|
|
102
|
+
const v8::PropertyCallbackInfo<v8::Value> &info) {
|
|
103
103
|
auto ptr = GetPointer(info.This());
|
|
104
104
|
if (ptr != nullptr) {
|
|
105
105
|
auto label = canvas_native_webgpu_compute_pass_encoder_get_label(ptr->computePass_);
|
|
@@ -119,7 +119,7 @@ GPUComputePassEncoderImpl::GetLabel(v8::Local <v8::Name> name,
|
|
|
119
119
|
|
|
120
120
|
|
|
121
121
|
void
|
|
122
|
-
GPUComputePassEncoderImpl::DispatchWorkgroups(const v8::FunctionCallbackInfo
|
|
122
|
+
GPUComputePassEncoderImpl::DispatchWorkgroups(const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
123
123
|
auto *ptr = GetPointer(args.This());
|
|
124
124
|
if (ptr == nullptr) {
|
|
125
125
|
return;
|
|
@@ -154,7 +154,7 @@ GPUComputePassEncoderImpl::DispatchWorkgroups(const v8::FunctionCallbackInfo <v8
|
|
|
154
154
|
}
|
|
155
155
|
|
|
156
156
|
void GPUComputePassEncoderImpl::DispatchWorkgroupsIndirect(
|
|
157
|
-
const v8::FunctionCallbackInfo
|
|
157
|
+
const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
158
158
|
auto *ptr = GetPointer(args.This());
|
|
159
159
|
if (ptr == nullptr) {
|
|
160
160
|
return;
|
|
@@ -178,7 +178,7 @@ void GPUComputePassEncoderImpl::DispatchWorkgroupsIndirect(
|
|
|
178
178
|
}
|
|
179
179
|
|
|
180
180
|
|
|
181
|
-
void GPUComputePassEncoderImpl::End(const v8::FunctionCallbackInfo
|
|
181
|
+
void GPUComputePassEncoderImpl::End(const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
182
182
|
auto *ptr = GetPointer(args.This());
|
|
183
183
|
if (ptr == nullptr) {
|
|
184
184
|
return;
|
|
@@ -188,7 +188,7 @@ void GPUComputePassEncoderImpl::End(const v8::FunctionCallbackInfo <v8::Value> &
|
|
|
188
188
|
}
|
|
189
189
|
|
|
190
190
|
void
|
|
191
|
-
GPUComputePassEncoderImpl::InsertDebugMarker(const v8::FunctionCallbackInfo
|
|
191
|
+
GPUComputePassEncoderImpl::InsertDebugMarker(const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
192
192
|
auto *ptr = GetPointer(args.This());
|
|
193
193
|
if (ptr == nullptr) {
|
|
194
194
|
return;
|
|
@@ -204,7 +204,7 @@ GPUComputePassEncoderImpl::InsertDebugMarker(const v8::FunctionCallbackInfo <v8:
|
|
|
204
204
|
}
|
|
205
205
|
}
|
|
206
206
|
|
|
207
|
-
void GPUComputePassEncoderImpl::PopDebugGroup(const v8::FunctionCallbackInfo
|
|
207
|
+
void GPUComputePassEncoderImpl::PopDebugGroup(const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
208
208
|
auto *ptr = GetPointer(args.This());
|
|
209
209
|
if (ptr == nullptr) {
|
|
210
210
|
return;
|
|
@@ -213,7 +213,7 @@ void GPUComputePassEncoderImpl::PopDebugGroup(const v8::FunctionCallbackInfo <v8
|
|
|
213
213
|
canvas_native_webgpu_compute_pass_encoder_pop_debug_group(ptr->GetComputePass());
|
|
214
214
|
}
|
|
215
215
|
|
|
216
|
-
void GPUComputePassEncoderImpl::PushDebugGroup(const v8::FunctionCallbackInfo
|
|
216
|
+
void GPUComputePassEncoderImpl::PushDebugGroup(const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
217
217
|
auto *ptr = GetPointer(args.This());
|
|
218
218
|
if (ptr == nullptr) {
|
|
219
219
|
return;
|
|
@@ -229,7 +229,7 @@ void GPUComputePassEncoderImpl::PushDebugGroup(const v8::FunctionCallbackInfo <v
|
|
|
229
229
|
}
|
|
230
230
|
}
|
|
231
231
|
|
|
232
|
-
void GPUComputePassEncoderImpl::SetBindGroup(const v8::FunctionCallbackInfo
|
|
232
|
+
void GPUComputePassEncoderImpl::SetBindGroup(const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
233
233
|
auto *ptr = GetPointer(args.This());
|
|
234
234
|
if (ptr == nullptr) {
|
|
235
235
|
return;
|
|
@@ -244,34 +244,39 @@ void GPUComputePassEncoderImpl::SetBindGroup(const v8::FunctionCallbackInfo <v8:
|
|
|
244
244
|
auto dynamicOffsetsStart = args[3];
|
|
245
245
|
auto dynamicOffsetsLength = args[4];
|
|
246
246
|
|
|
247
|
+
const CanvasGPUBindGroup *bindGroup = nullptr;
|
|
248
|
+
|
|
247
249
|
auto type = GetNativeType(bindGroupVal);
|
|
248
250
|
|
|
249
251
|
if (type == NativeType::GPUBindGroup) {
|
|
250
|
-
auto
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
252
|
+
auto group = GPUBindGroupImpl::GetPointer(bindGroupVal.As<v8::Object>());
|
|
253
|
+
bindGroup = group->GetBindGroup();
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
auto index = indexVal->Uint32Value(context).FromJust();
|
|
257
|
+
|
|
258
|
+
|
|
259
|
+
if (dynamicOffsets->IsUint8Array()) {
|
|
260
|
+
auto buf = dynamicOffsets.As<v8::Uint32Array>();
|
|
261
|
+
auto buffer = buf->Buffer();
|
|
262
|
+
auto store = buffer->GetBackingStore();
|
|
263
|
+
auto offset = buf->ByteOffset();
|
|
264
|
+
auto data = static_cast<uint8_t *>(buffer->GetBackingStore()->Data()) + offset;
|
|
265
|
+
auto size = buf->Length();
|
|
266
|
+
auto start = (size_t) dynamicOffsetsStart->NumberValue(context).FromJust();
|
|
267
|
+
auto offset_length = (size_t) dynamicOffsetsLength->NumberValue(context).FromJust();
|
|
268
|
+
canvas_native_webgpu_compute_pass_encoder_set_bind_group(ptr->GetComputePass(), index,
|
|
269
|
+
bindGroup,
|
|
270
|
+
static_cast<const uint32_t *>(static_cast<void *>(data)),
|
|
271
|
+
size, start, offset_length);
|
|
272
|
+
} else {
|
|
273
|
+
canvas_native_webgpu_compute_pass_encoder_set_bind_group(ptr->GetComputePass(), index,
|
|
274
|
+
bindGroup,
|
|
275
|
+
nullptr, 0, 0, 0);
|
|
271
276
|
}
|
|
272
277
|
}
|
|
273
278
|
|
|
274
|
-
void GPUComputePassEncoderImpl::SetPipeline(const v8::FunctionCallbackInfo
|
|
279
|
+
void GPUComputePassEncoderImpl::SetPipeline(const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
275
280
|
auto *ptr = GetPointer(args.This());
|
|
276
281
|
if (ptr == nullptr) {
|
|
277
282
|
return;
|
|
@@ -118,7 +118,7 @@ v8::Local<v8::FunctionTemplate> GPURenderBundleEncoderImpl::GetCtor(v8::Isolate
|
|
|
118
118
|
|
|
119
119
|
void
|
|
120
120
|
GPURenderBundleEncoderImpl::GetLabel(v8::Local<v8::Name> name,
|
|
121
|
-
|
|
121
|
+
const v8::PropertyCallbackInfo<v8::Value> &info) {
|
|
122
122
|
auto ptr = GetPointer(info.This());
|
|
123
123
|
if (ptr != nullptr) {
|
|
124
124
|
auto label = canvas_native_webgpu_render_bundle_encoder_get_label(ptr->encoder_);
|
|
@@ -369,30 +369,33 @@ void GPURenderBundleEncoderImpl::SetBindGroup(const v8::FunctionCallbackInfo<v8:
|
|
|
369
369
|
auto dynamicOffsetsStart = args[3];
|
|
370
370
|
auto dynamicOffsetsLength = args[4];
|
|
371
371
|
|
|
372
|
+
const CanvasGPUBindGroup *bindGroup = nullptr;
|
|
372
373
|
auto type = GetNativeType(bindGroupVal);
|
|
373
374
|
|
|
375
|
+
auto index = indexVal->Uint32Value(context).FromJust();
|
|
376
|
+
|
|
374
377
|
if (type == NativeType::GPUBindGroup) {
|
|
375
|
-
auto
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
378
|
+
auto group = GPUBindGroupImpl::GetPointer(bindGroupVal.As<v8::Object>());
|
|
379
|
+
bindGroup = group->GetBindGroup();
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
if (dynamicOffsets->IsUint32Array()) {
|
|
383
|
+
auto buf = dynamicOffsets.As<v8::Uint32Array>();
|
|
384
|
+
auto buffer = buf->Buffer();
|
|
385
|
+
auto store = buffer->GetBackingStore();
|
|
386
|
+
auto offset = buf->ByteOffset();
|
|
387
|
+
auto data = static_cast<uint8_t *>(buffer->GetBackingStore()->Data()) + offset;
|
|
388
|
+
auto size = buf->Length();
|
|
389
|
+
auto start = (size_t) dynamicOffsetsStart->NumberValue(context).FromJust();
|
|
390
|
+
auto offset_length = (size_t) dynamicOffsetsLength->NumberValue(context).FromJust();
|
|
391
|
+
canvas_native_webgpu_render_bundle_encoder_set_bind_group(ptr->GetEncoder(), index,
|
|
392
|
+
bindGroup,
|
|
393
|
+
static_cast<const uint32_t *>(static_cast<void *>(data)),
|
|
394
|
+
size, start, offset_length);
|
|
395
|
+
} else {
|
|
396
|
+
canvas_native_webgpu_render_bundle_encoder_set_bind_group(ptr->GetEncoder(), index,
|
|
397
|
+
bindGroup,
|
|
398
|
+
nullptr, 0, 0, 0);
|
|
396
399
|
}
|
|
397
400
|
|
|
398
401
|
}
|
|
@@ -450,7 +453,7 @@ void GPURenderBundleEncoderImpl::SetPipeline(const v8::FunctionCallbackInfo<v8::
|
|
|
450
453
|
}
|
|
451
454
|
|
|
452
455
|
auto pipelineVal = args[0];
|
|
453
|
-
if(GetNativeType(pipelineVal) == NativeType::GPURenderPipeline){
|
|
456
|
+
if (GetNativeType(pipelineVal) == NativeType::GPURenderPipeline) {
|
|
454
457
|
auto pipeline = GPURenderPipelineImpl::GetPointer(pipelineVal.As<v8::Object>());
|
|
455
458
|
if (pipeline != nullptr) {
|
|
456
459
|
canvas_native_webgpu_render_bundle_encoder_set_pipeline(ptr->GetEncoder(),
|
|
@@ -428,30 +428,34 @@ void GPURenderPassEncoderImpl::SetBindGroup(const v8::FunctionCallbackInfo<v8::V
|
|
|
428
428
|
auto dynamicOffsetsStart = args[3];
|
|
429
429
|
auto dynamicOffsetsLength = args[4];
|
|
430
430
|
|
|
431
|
+
const CanvasGPUBindGroup *bindGroup = nullptr;
|
|
432
|
+
|
|
431
433
|
auto type = GetNativeType(bindGroupVal);
|
|
432
434
|
|
|
435
|
+
auto index = indexVal->Uint32Value(context).FromJust();
|
|
436
|
+
|
|
433
437
|
if (type == NativeType::GPUBindGroup) {
|
|
434
|
-
auto
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
438
|
+
auto group = GPUBindGroupImpl::GetPointer(bindGroupVal.As<v8::Object>());
|
|
439
|
+
bindGroup = group->GetBindGroup();
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
if (dynamicOffsets->IsUint32Array()) {
|
|
443
|
+
auto buf = dynamicOffsets.As<v8::Uint32Array>();
|
|
444
|
+
auto buffer = buf->Buffer();
|
|
445
|
+
auto store = buffer->GetBackingStore();
|
|
446
|
+
auto offset = buf->ByteOffset();
|
|
447
|
+
auto data = static_cast<uint8_t *>(buffer->GetBackingStore()->Data()) + offset;
|
|
448
|
+
auto size = buf->Length();
|
|
449
|
+
auto start = (size_t) dynamicOffsetsStart->NumberValue(context).FromJust();
|
|
450
|
+
auto offset_length = (size_t) dynamicOffsetsLength->NumberValue(context).FromJust();
|
|
451
|
+
canvas_native_webgpu_render_pass_encoder_set_bind_group(ptr->GetPass(), index,
|
|
452
|
+
bindGroup,
|
|
453
|
+
static_cast<const uint32_t *>(static_cast<void *>(data)),
|
|
454
|
+
size, start, offset_length);
|
|
455
|
+
} else {
|
|
456
|
+
canvas_native_webgpu_render_pass_encoder_set_bind_group(ptr->GetPass(), index,
|
|
457
|
+
bindGroup,
|
|
458
|
+
nullptr, 0, 0, 0);
|
|
455
459
|
}
|
|
456
460
|
}
|
|
457
461
|
|
|
@@ -596,8 +600,7 @@ void GPURenderPassEncoderImpl::SetVertexBuffer(const v8::FunctionCallbackInfo<v8
|
|
|
596
600
|
if (type == NativeType::GPUBuffer) {
|
|
597
601
|
auto context = isolate->GetCurrentContext();
|
|
598
602
|
auto slot = slotVal->ToUint32(context).ToLocalChecked();
|
|
599
|
-
|
|
600
|
-
|
|
603
|
+
|
|
601
604
|
|
|
602
605
|
auto buffer = GPUBufferImpl::GetPointer(bufferVal.As<v8::Object>());
|
|
603
606
|
|