@nativescript/canvas 2.0.0-webgpu.5 → 2.0.0-webgpu.7

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.
Files changed (53) hide show
  1. package/Canvas/index.android.d.ts +0 -1
  2. package/Canvas/index.android.js +21 -22
  3. package/Canvas/index.android.js.map +1 -1
  4. package/Canvas/index.ios.js +13 -26
  5. package/Canvas/index.ios.js.map +1 -1
  6. package/Dom/Group.d.ts +1 -2
  7. package/Dom/Group.js.map +1 -1
  8. package/Dom/Image.js +0 -1
  9. package/Dom/Image.js.map +1 -1
  10. package/WebGPU/GPUAdapter.d.ts +3 -2
  11. package/WebGPU/GPUAdapter.js.map +1 -1
  12. package/WebGPU/GPUDevice.d.ts +2 -2
  13. package/WebGPU/GPUDevice.js +26 -6
  14. package/WebGPU/GPUDevice.js.map +1 -1
  15. package/WebGPU/GPURenderPassEncoder.d.ts +1 -1
  16. package/WebGPU/GPURenderPassEncoder.js +2 -2
  17. package/WebGPU/GPURenderPassEncoder.js.map +1 -1
  18. package/WebGPU/Interfaces.d.ts +11 -1
  19. package/WebGPU/Types.d.ts +1 -0
  20. package/package.json +1 -1
  21. package/platforms/android/canvas-release.aar +0 -0
  22. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/CanvasNative +0 -0
  23. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Headers/CanvasNative-Swift.h +5 -0
  24. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/CanvasNative.swiftmodule/Project/arm64-apple-ios.swiftsourceinfo +0 -0
  25. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios.abi.json +108 -0
  26. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios.private.swiftinterface +3 -0
  27. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios.swiftinterface +3 -0
  28. package/platforms/ios/CanvasNative.xcframework/ios-arm64/dSYMs/CanvasNative.framework.dSYM/Contents/Resources/DWARF/CanvasNative +0 -0
  29. package/platforms/ios/CanvasNative.xcframework/ios-arm64/dSYMs/CanvasNative.framework.dSYM/Contents/Resources/Relocations/aarch64/CanvasNative.yml +484 -483
  30. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/CanvasNative +0 -0
  31. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Headers/CanvasNative-Swift.h +10 -0
  32. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/Project/arm64-apple-ios-simulator.swiftsourceinfo +0 -0
  33. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/Project/x86_64-apple-ios-simulator.swiftsourceinfo +0 -0
  34. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios-simulator.abi.json +108 -0
  35. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +3 -0
  36. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios-simulator.swiftinterface +3 -0
  37. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.abi.json +108 -0
  38. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +3 -0
  39. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +3 -0
  40. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/_CodeSignature/CodeResources +22 -22
  41. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/dSYMs/CanvasNative.framework.dSYM/Contents/Resources/DWARF/CanvasNative +0 -0
  42. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/dSYMs/CanvasNative.framework.dSYM/Contents/Resources/Relocations/aarch64/CanvasNative.yml +645 -644
  43. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/dSYMs/CanvasNative.framework.dSYM/Contents/Resources/Relocations/x86_64/CanvasNative.yml +683 -682
  44. package/platforms/ios/src/cpp/canvas2d/CanvasRenderingContext2DImpl.cpp +1 -1
  45. package/platforms/ios/src/cpp/canvas2d/Path2D.h +5 -5
  46. package/platforms/ios/src/cpp/webgpu/GPUAdapterImpl.cpp +19 -17
  47. package/platforms/ios/src/cpp/webgpu/GPUBindGroupImpl.h +1 -1
  48. package/platforms/ios/src/cpp/webgpu/GPUDeviceImpl.cpp +1401 -6
  49. package/platforms/ios/src/cpp/webgpu/GPUImpl.h +1 -1
  50. package/platforms/ios/src/cpp/webgpu/GPUPipelineLayoutImpl.h +1 -1
  51. package/platforms/ios/src/cpp/webgpu/GPUQuerySetImpl.h +1 -1
  52. package/platforms/ios/src/cpp/webgpu/GPUQueueImpl.cpp +0 -1
  53. package/platforms/ios/src/cpp/webgpu/GPURenderPassEncoderImpl.cpp +3 -3
@@ -630,7 +630,7 @@ void CanvasRenderingContext2DImpl::DrawPoints(const v8::FunctionCallbackInfo<v8:
630
630
  }
631
631
 
632
632
  canvas_native_context_draw_points(
633
- ptr->GetContext(), pointMode,
633
+ ptr->GetContext(), (int32_t)pointMode,
634
634
  store.data(), store.size());
635
635
 
636
636
 
@@ -199,7 +199,7 @@ public:
199
199
  double rotation,
200
200
  double start_angle,
201
201
  double end_angle,
202
- double anticlockwise) {
202
+ bool anticlockwise) {
203
203
 
204
204
  canvas_native_path_ellipse(
205
205
  receiver_obj,
@@ -222,7 +222,7 @@ public:
222
222
  double rotation,
223
223
  double start_angle,
224
224
  double end_angle,
225
- double anticlockwise) {
225
+ bool anticlockwise) {
226
226
  Path2D *ptr = GetPointer(receiver_obj);
227
227
  if (ptr == nullptr) {
228
228
  return;
@@ -362,9 +362,9 @@ public:
362
362
 
363
363
  canvas_native_path_round_rect(
364
364
  ptr->GetPath(),
365
- x, y,
366
- width,
367
- height, buf.data(),
365
+ (float)x, (float)y,
366
+ (float)width,
367
+ (float)height, buf.data(),
368
368
  buf.size());
369
369
 
370
370
  }
@@ -61,7 +61,6 @@ v8::Local<v8::FunctionTemplate> GPUAdapterImpl::GetCtor(v8::Isolate *isolate) {
61
61
  GetLimits
62
62
  );
63
63
 
64
-
65
64
  tmpl->Set(
66
65
  ConvertToV8String(isolate, "requestAdapterInfo"),
67
66
  v8::FunctionTemplate::New(isolate, &RequestAdapterInfo));
@@ -90,19 +89,19 @@ GPUAdapterImpl::GetFeatures(v8::Local<v8::Name> name,
90
89
 
91
90
  auto len = canvas_native_string_buffer_get_length(features);
92
91
 
93
- auto map = v8::Map::New(isolate);
92
+ auto set = v8::Set::New(isolate);
94
93
  for (int i = 0; i < len; ++i) {
95
94
  auto item = canvas_native_string_buffer_get_value_at(features, i);
96
95
  if (item != nullptr) {
97
- auto keyValue = ConvertToV8OneByteString(isolate, (char *) item);
98
- map->Set(context, keyValue, keyValue);
96
+ auto keyValue = ConvertToV8String(isolate, (char *) item);
97
+ set->Add(context, keyValue);
99
98
  canvas_native_string_destroy(item);
100
99
  }
101
100
 
102
101
  }
103
102
  canvas_native_string_buffer_release(features);
104
103
 
105
- info.GetReturnValue().Set(map);
104
+ info.GetReturnValue().Set(set);
106
105
 
107
106
  return;
108
107
  }
@@ -162,11 +161,14 @@ struct RequestData {
162
161
  char *error_;
163
162
  const CanvasGPUDevice *device_;
164
163
  char **required_features_data_;
164
+ size_t required_features_data_size;
165
165
 
166
166
  ~RequestData() {
167
167
  if (required_features_data_ != nullptr) {
168
- delete[] required_features_data_;
169
- required_features_data_ = nullptr;
168
+ for (size_t i = 0; i < required_features_data_size; ++i) {
169
+ delete[] required_features_data_[i];
170
+ }
171
+ delete[] required_features_data_;
170
172
  }
171
173
 
172
174
  if (error_ != nullptr) {
@@ -212,11 +214,9 @@ void GPUAdapterImpl::RequestDevice(const v8::FunctionCallbackInfo<v8::Value> &ar
212
214
  &requiredFeaturesValue);
213
215
 
214
216
 
215
- if (!requiredFeaturesValue.IsEmpty() && requiredFeaturesValue->IsSet()) {
216
- v8::Local<v8::Set> requiredFeaturesSet = requiredFeaturesValue.As<v8::Set>();
217
- v8::Local<v8::Array> requiredFeatures = requiredFeaturesSet->AsArray();
217
+ if (!requiredFeaturesValue.IsEmpty() && requiredFeaturesValue->IsArray()) {
218
+ v8::Local<v8::Array> requiredFeatures = requiredFeaturesValue.As<v8::Array>();
218
219
  auto len = requiredFeatures->Length();
219
-
220
220
  for (int i = 0; i < len; i++) {
221
221
  auto item = requiredFeatures->Get(context, i);
222
222
  if (!item.IsEmpty()) {
@@ -245,10 +245,12 @@ void GPUAdapterImpl::RequestDevice(const v8::FunctionCallbackInfo<v8::Value> &ar
245
245
  size_t required_features_data_length = required_features_buf.size();
246
246
 
247
247
  if (required_features_data_length > 0) {
248
- required_features_data = new char *[required_features_data_length + 1];
248
+ required_features_data = new char *[required_features_data_length];
249
249
 
250
250
  for (size_t i = 0; i < required_features_data_length; ++i) {
251
- std::strcpy(required_features_data[i], required_features_buf[i].c_str());
251
+ required_features_data[i] = new char[required_features_buf[i].size() + 1];
252
+ auto src = required_features_buf[i].c_str();
253
+ std::strcpy(required_features_data[i], src);
252
254
  }
253
255
  }
254
256
 
@@ -297,7 +299,6 @@ void GPUAdapterImpl::RequestDevice(const v8::FunctionCallbackInfo<v8::Value> &ar
297
299
  callback->Call(context, context->Global(),
298
300
  1,
299
301
  args); // ignore JS return value
300
- delete static_cast<AsyncCallback *>(data);
301
302
  } else {
302
303
 
303
304
  auto impl = new GPUDeviceImpl(requestData->device_);
@@ -311,14 +312,14 @@ void GPUAdapterImpl::RequestDevice(const v8::FunctionCallbackInfo<v8::Value> &ar
311
312
  callback->Call(context, context->Global(),
312
313
  2,
313
314
  args); // ignore JS return value
314
-
315
- delete static_cast<AsyncCallback *>(data);
316
315
  }
317
316
 
318
317
  if (requestData != nullptr) {
319
318
  delete requestData;
320
319
  requestData = nullptr;
321
320
  }
321
+
322
+ delete static_cast<AsyncCallback *>(data);
322
323
  }
323
324
  }
324
325
  }
@@ -330,7 +331,8 @@ void GPUAdapterImpl::RequestDevice(const v8::FunctionCallbackInfo<v8::Value> &ar
330
331
  inner->data = new RequestData{
331
332
  nullptr,
332
333
  nullptr,
333
- required_features_data
334
+ required_features_data,
335
+ required_features_data_length
334
336
  };
335
337
  }
336
338
 
@@ -11,7 +11,7 @@
11
11
 
12
12
  class GPUBindGroupImpl : ObjectWrapperImpl {
13
13
  public:
14
- GPUBindGroupImpl(const CanvasGPUBindGroup *group);
14
+ explicit GPUBindGroupImpl(const CanvasGPUBindGroup *group);
15
15
 
16
16
  ~GPUBindGroupImpl() {
17
17
  canvas_native_webgpu_bind_group_release(this->GetBindGroup());