@nativescript/canvas 2.0.0-webgpu.33 → 2.0.0-webgpu.34

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 (38) hide show
  1. package/Canvas/index.android.js +12 -2
  2. package/Canvas/index.android.js.map +1 -1
  3. package/Canvas/index.ios.js +11 -7
  4. package/Canvas/index.ios.js.map +1 -1
  5. package/WebGL2/WebGL2RenderingContext/index.js.map +1 -1
  6. package/WebGPU/GPUDevice.js +17 -18
  7. package/WebGPU/GPUDevice.js.map +1 -1
  8. package/index.d.ts +1 -1
  9. package/index.js +2 -2
  10. package/index.js.map +1 -1
  11. package/package.json +1 -1
  12. package/platforms/android/canvas-release.aar +0 -0
  13. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/CanvasNative +0 -0
  14. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Headers/CanvasNative-Swift.h +1 -0
  15. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Headers/canvas_native.h +2 -0
  16. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/CanvasNative.swiftmodule/Project/arm64-apple-ios.swiftsourceinfo +0 -0
  17. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios.abi.json +42 -18
  18. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios.private.swiftinterface +1 -0
  19. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios.swiftinterface +1 -0
  20. package/platforms/ios/CanvasNative.xcframework/ios-arm64/dSYMs/CanvasNative.framework.dSYM/Contents/Resources/DWARF/CanvasNative +0 -0
  21. package/platforms/ios/CanvasNative.xcframework/ios-arm64/dSYMs/CanvasNative.framework.dSYM/Contents/Resources/Relocations/aarch64/CanvasNative.yml +675 -671
  22. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/CanvasNative +0 -0
  23. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Headers/CanvasNative-Swift.h +2 -0
  24. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Headers/canvas_native.h +2 -0
  25. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/Project/arm64-apple-ios-simulator.swiftsourceinfo +0 -0
  26. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/Project/x86_64-apple-ios-simulator.swiftsourceinfo +0 -0
  27. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios-simulator.abi.json +42 -18
  28. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +1 -0
  29. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios-simulator.swiftinterface +1 -0
  30. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.abi.json +42 -18
  31. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +1 -0
  32. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +1 -0
  33. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/_CodeSignature/CodeResources +24 -24
  34. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/dSYMs/CanvasNative.framework.dSYM/Contents/Resources/DWARF/CanvasNative +0 -0
  35. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/dSYMs/CanvasNative.framework.dSYM/Contents/Resources/Relocations/aarch64/CanvasNative.yml +677 -673
  36. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/dSYMs/CanvasNative.framework.dSYM/Contents/Resources/Relocations/x86_64/CanvasNative.yml +730 -726
  37. package/platforms/ios/src/cpp/webgpu/GPUDeviceImpl.cpp +33 -33
  38. package/utils.d.ts +1 -1
@@ -1295,12 +1295,12 @@ void GPUDeviceImpl::CreateRenderPipeline(const v8::FunctionCallbackInfo<v8::Valu
1295
1295
  auto options = optionsVal.As<v8::Object>();
1296
1296
 
1297
1297
  v8::Local<v8::Value> stencilValue;
1298
- options->Get(context, ConvertToV8String(isolate, "depthStencil")).ToLocal(
1298
+ auto hasDepthStencil = options->Get(context, ConvertToV8String(isolate, "depthStencil")).ToLocal(
1299
1299
  &stencilValue);
1300
1300
 
1301
1301
  CanvasDepthStencilState *stencil = nullptr;
1302
1302
 
1303
- if (!stencilValue.IsEmpty() && stencilValue->IsObject()) {
1303
+ if (hasDepthStencil && stencilValue->IsObject()) {
1304
1304
  auto stencilObj = stencilValue.As<v8::Object>();
1305
1305
  stencil = new CanvasDepthStencilState{};
1306
1306
  stencil->depth_bias = 0;
@@ -1491,14 +1491,14 @@ void GPUDeviceImpl::CreateRenderPipeline(const v8::FunctionCallbackInfo<v8::Valu
1491
1491
 
1492
1492
 
1493
1493
  v8::Local<v8::Value> fragmentValue;
1494
- options->Get(context, ConvertToV8String(isolate, "fragment")).ToLocal(
1494
+ auto hasFragment = options->Get(context, ConvertToV8String(isolate, "fragment")).ToLocal(
1495
1495
  &fragmentValue);
1496
1496
 
1497
1497
  CanvasFragmentState *fragment = nullptr;
1498
1498
 
1499
1499
  std::vector<CanvasColorTargetState> targets;
1500
1500
 
1501
- if (!fragmentValue.IsEmpty() && fragmentValue->IsObject()) {
1501
+ if (hasFragment && fragmentValue->IsObject()) {
1502
1502
  auto fragmentValueObj = fragmentValue.As<v8::Object>();
1503
1503
  fragment = new CanvasFragmentState{};
1504
1504
 
@@ -1532,9 +1532,9 @@ void GPUDeviceImpl::CreateRenderPipeline(const v8::FunctionCallbackInfo<v8::Valu
1532
1532
 
1533
1533
  v8::Local<v8::Value> writeMaskVal;
1534
1534
 
1535
- state->Get(context, ConvertToV8String(isolate, "writeMask")).ToLocal(&writeMaskVal);
1535
+ auto hasWriteMask = state->Get(context, ConvertToV8String(isolate, "writeMask")).ToLocal(&writeMaskVal);
1536
1536
 
1537
- if (!writeMaskVal.IsEmpty() && writeMaskVal->IsUint32()) {
1537
+ if (hasWriteMask && writeMaskVal->IsUint32()) {
1538
1538
  writeMask = writeMaskVal->Uint32Value(context).FromJust();
1539
1539
  }
1540
1540
 
@@ -1544,9 +1544,9 @@ void GPUDeviceImpl::CreateRenderPipeline(const v8::FunctionCallbackInfo<v8::Valu
1544
1544
 
1545
1545
  v8::Local<v8::Value> blendVal;
1546
1546
 
1547
- state->Get(context, ConvertToV8String(isolate, "blend")).ToLocal(&blendVal);
1547
+ auto hasBlend = state->Get(context, ConvertToV8String(isolate, "blend")).ToLocal(&blendVal);
1548
1548
 
1549
- if (!blendVal.IsEmpty() && blendVal->IsObject()) {
1549
+ if (hasBlend && blendVal->IsObject()) {
1550
1550
  auto blendObj = blendVal.As<v8::Object>();
1551
1551
  auto alpha = blendObj->Get(context, ConvertToV8String(isolate,
1552
1552
  "alpha")).ToLocalChecked().As<v8::Object>();
@@ -1638,10 +1638,10 @@ void GPUDeviceImpl::CreateRenderPipeline(const v8::FunctionCallbackInfo<v8::Valu
1638
1638
  }
1639
1639
 
1640
1640
  v8::Local<v8::Value> constantsVal;
1641
- fragmentValueObj->Get(context, ConvertToV8String(isolate, "constants")).ToLocal(
1641
+ auto hasConstants = fragmentValueObj->Get(context, ConvertToV8String(isolate, "constants")).ToLocal(
1642
1642
  &constantsVal);
1643
1643
 
1644
- if (!constantsVal.IsEmpty() && constantsVal->IsMap()) {
1644
+ if (hasConstants && constantsVal->IsMap()) {
1645
1645
  auto constants = constantsVal.As<v8::Map>();
1646
1646
  auto keyValues = constants->AsArray();
1647
1647
  auto length = keyValues->Length();
@@ -1675,11 +1675,11 @@ void GPUDeviceImpl::CreateRenderPipeline(const v8::FunctionCallbackInfo<v8::Valu
1675
1675
 
1676
1676
 
1677
1677
  v8::Local<v8::Value> entryPoint;
1678
- fragmentValueObj->Get(context, ConvertToV8String(isolate, "entryPoint")).ToLocal(
1678
+ auto hasEntryPoint = fragmentValueObj->Get(context, ConvertToV8String(isolate, "entryPoint")).ToLocal(
1679
1679
  &entryPoint);
1680
1680
 
1681
1681
 
1682
- if (!entryPoint.IsEmpty() && entryPoint->IsString()) {
1682
+ if (hasEntryPoint && entryPoint->IsString()) {
1683
1683
  auto ep = v8::String::Utf8Value(isolate, entryPoint);
1684
1684
  char *entry_point = (char *) malloc(ep.length());
1685
1685
  std::strcpy(entry_point, *ep);
@@ -1707,7 +1707,6 @@ void GPUDeviceImpl::CreateRenderPipeline(const v8::FunctionCallbackInfo<v8::Valu
1707
1707
 
1708
1708
  auto label = GPULabel(isolate, labelVal);
1709
1709
 
1710
-
1711
1710
  descriptor.label = *label;
1712
1711
 
1713
1712
 
@@ -1738,13 +1737,13 @@ void GPUDeviceImpl::CreateRenderPipeline(const v8::FunctionCallbackInfo<v8::Valu
1738
1737
 
1739
1738
 
1740
1739
  v8::Local<v8::Value> multisampleValue;
1741
- options->Get(context, ConvertToV8String(isolate, "multisample")).ToLocal(
1740
+ auto hasMultisample = options->Get(context, ConvertToV8String(isolate, "multisample")).ToLocal(
1742
1741
  &multisampleValue);
1743
1742
 
1744
1743
 
1745
1744
  CanvasMultisampleState *multisample = nullptr;
1746
1745
 
1747
- if (!multisampleValue.IsEmpty() && multisampleValue->IsObject()) {
1746
+ if (hasMultisample && multisampleValue->IsObject()) {
1748
1747
  auto multisampleObj = multisampleValue.As<v8::Object>();
1749
1748
  multisample = new CanvasMultisampleState{};
1750
1749
  multisample->alpha_to_coverage_enabled = false;
@@ -1755,25 +1754,25 @@ void GPUDeviceImpl::CreateRenderPipeline(const v8::FunctionCallbackInfo<v8::Valu
1755
1754
  v8::Local<v8::Value> count;
1756
1755
  v8::Local<v8::Value> mask;
1757
1756
 
1758
- multisampleObj->Get(context, ConvertToV8String(isolate, "alphaToCoverageEnabled")).
1757
+ auto hasAlphaToCoverageEnabled = multisampleObj->Get(context, ConvertToV8String(isolate, "alphaToCoverageEnabled")).
1759
1758
  ToLocal(&alphaToCoverageEnabled);
1760
1759
 
1761
- if (!alphaToCoverageEnabled.IsEmpty() && alphaToCoverageEnabled->IsBoolean()) {
1760
+ if (hasAlphaToCoverageEnabled && alphaToCoverageEnabled->IsBoolean()) {
1762
1761
  multisample->alpha_to_coverage_enabled = alphaToCoverageEnabled->BooleanValue(
1763
1762
  isolate);
1764
1763
  }
1765
1764
 
1766
- multisampleObj->Get(context, ConvertToV8String(isolate, "count")).
1765
+ auto hasCount = multisampleObj->Get(context, ConvertToV8String(isolate, "count")).
1767
1766
  ToLocal(&count);
1768
1767
 
1769
- if (!count.IsEmpty() && count->IsUint32()) {
1768
+ if (hasCount && count->IsUint32()) {
1770
1769
  multisample->count = count.As<v8::Uint32>()->Value();
1771
1770
  }
1772
1771
 
1773
- multisampleObj->Get(context, ConvertToV8String(isolate, "mask")).
1772
+ auto hasMask = multisampleObj->Get(context, ConvertToV8String(isolate, "mask")).
1774
1773
  ToLocal(&mask);
1775
1774
 
1776
- if (!mask.IsEmpty() && mask->IsNumber()) {
1775
+ if (hasMask && mask->IsNumber()) {
1777
1776
  // todo verify mask
1778
1777
  auto maskValue = mask.As<v8::Number>()->Value();
1779
1778
  multisample->mask = (uint64_t) maskValue;
@@ -1786,13 +1785,13 @@ void GPUDeviceImpl::CreateRenderPipeline(const v8::FunctionCallbackInfo<v8::Valu
1786
1785
 
1787
1786
 
1788
1787
  v8::Local<v8::Value> primitiveValue;
1789
- options->Get(context, ConvertToV8String(isolate, "primitive")).ToLocal(
1788
+ auto hasPrimitive = options->Get(context, ConvertToV8String(isolate, "primitive")).ToLocal(
1790
1789
  &primitiveValue);
1791
1790
 
1792
1791
 
1793
1792
  CanvasPrimitiveState *primitive = nullptr;
1794
1793
 
1795
- if (!primitiveValue.IsEmpty() && primitiveValue->IsObject()) {
1794
+ if (hasPrimitive && primitiveValue->IsObject()) {
1796
1795
  auto primitiveObj = primitiveValue.As<v8::Object>();
1797
1796
  primitive = new CanvasPrimitiveState{};
1798
1797
 
@@ -1968,7 +1967,7 @@ void GPUDeviceImpl::CreateRenderPipeline(const v8::FunctionCallbackInfo<v8::Valu
1968
1967
 
1969
1968
 
1970
1969
  v8::Local<v8::Value> vertexValue;
1971
- options->Get(context, ConvertToV8String(isolate, "vertex")).ToLocal(
1970
+ auto hasVertex = options->Get(context, ConvertToV8String(isolate, "vertex")).ToLocal(
1972
1971
  &vertexValue);
1973
1972
 
1974
1973
 
@@ -1978,7 +1977,7 @@ void GPUDeviceImpl::CreateRenderPipeline(const v8::FunctionCallbackInfo<v8::Valu
1978
1977
 
1979
1978
  std::vector<std::vector<CanvasVertexAttribute>> attributes;
1980
1979
 
1981
- if (!vertexValue.IsEmpty() && vertexValue->IsObject()) {
1980
+ if (hasVertex && vertexValue->IsObject()) {
1982
1981
  auto vertexObj = vertexValue.As<v8::Object>();
1983
1982
  vertex = new CanvasVertexState{};
1984
1983
 
@@ -1990,9 +1989,9 @@ void GPUDeviceImpl::CreateRenderPipeline(const v8::FunctionCallbackInfo<v8::Valu
1990
1989
  vertex->module = module->GetShaderModule();
1991
1990
 
1992
1991
  v8::Local<v8::Value> constantsVal;
1993
- vertexObj->Get(context, ConvertToV8String(isolate, "constants")).ToLocal(&constantsVal);
1992
+ auto hasConstants = vertexObj->Get(context, ConvertToV8String(isolate, "constants")).ToLocal(&constantsVal);
1994
1993
 
1995
- if (!constantsVal.IsEmpty() && constantsVal->IsMap()) {
1994
+ if (hasConstants && constantsVal->IsMap()) {
1996
1995
  auto constants = constantsVal.As<v8::Map>();
1997
1996
  auto keyValues = constants->AsArray();
1998
1997
  auto len = keyValues->Length();
@@ -2027,10 +2026,10 @@ void GPUDeviceImpl::CreateRenderPipeline(const v8::FunctionCallbackInfo<v8::Valu
2027
2026
  }
2028
2027
 
2029
2028
  v8::Local<v8::Value> buffersVal;
2030
- vertexObj->Get(context, ConvertToV8String(isolate, "buffers")).ToLocal(&buffersVal);
2029
+ auto hasBuffers = vertexObj->Get(context, ConvertToV8String(isolate, "buffers")).ToLocal(&buffersVal);
2031
2030
 
2032
2031
  uint64_t stride = 0;
2033
- if (!buffersVal.IsEmpty() && buffersVal->IsArray()) {
2032
+ if (hasBuffers && buffersVal->IsArray()) {
2034
2033
  auto buffers = buffersVal.As<v8::Array>();
2035
2034
  auto len = buffers->Length();
2036
2035
 
@@ -2039,10 +2038,10 @@ void GPUDeviceImpl::CreateRenderPipeline(const v8::FunctionCallbackInfo<v8::Valu
2039
2038
 
2040
2039
  v8::Local<v8::Value> arrayStride;
2041
2040
 
2042
- buffer->Get(context, ConvertToV8String(isolate, "arrayStride")).ToLocal(
2041
+ auto hasArrayStride = buffer->Get(context, ConvertToV8String(isolate, "arrayStride")).ToLocal(
2043
2042
  &arrayStride);
2044
2043
 
2045
- if (!arrayStride.IsEmpty() && arrayStride->IsNumber()) {
2044
+ if (hasArrayStride && arrayStride->IsNumber()) {
2046
2045
  stride = (uint64_t) arrayStride.As<v8::Number>()->Value();
2047
2046
  }
2048
2047
 
@@ -2050,10 +2049,10 @@ void GPUDeviceImpl::CreateRenderPipeline(const v8::FunctionCallbackInfo<v8::Valu
2050
2049
 
2051
2050
  v8::Local<v8::Value> attributesValue;
2052
2051
 
2053
- buffer->Get(context, ConvertToV8String(isolate, "attributes")).ToLocal(
2052
+ auto hasAttributes = buffer->Get(context, ConvertToV8String(isolate, "attributes")).ToLocal(
2054
2053
  &attributesValue);
2055
2054
 
2056
- if (!attributesValue.IsEmpty() && attributesValue->IsArray()) {
2055
+ if (hasAttributes && attributesValue->IsArray()) {
2057
2056
  auto attributes_array = attributesValue.As<v8::Array>();
2058
2057
  auto attributes_len = attributes_array->Length();
2059
2058
 
@@ -2144,6 +2143,7 @@ void GPUDeviceImpl::CreateRenderPipeline(const v8::FunctionCallbackInfo<v8::Valu
2144
2143
  }
2145
2144
 
2146
2145
 
2146
+
2147
2147
  auto pipeline = canvas_native_webgpu_device_create_render_pipeline(ptr->GetGPUDevice(),
2148
2148
  &descriptor);
2149
2149
 
package/utils.d.ts CHANGED
@@ -4,6 +4,6 @@ export declare class Utils {
4
4
  static _CHECKED_FOR_SUPPORT: boolean;
5
5
  static toJSArray(array: any): any[];
6
6
  static get IS_SUPPORTED_TYPED_ARRAYS_VERSION(): boolean;
7
- static isTypedArray(value: any): value is Uint32Array | Uint8Array | Uint8ClampedArray | Int32Array | Float32Array | Int8Array | Uint16Array | Int16Array;
7
+ static isTypedArray(value: any): value is Uint32Array | Uint8Array | Uint8ClampedArray | Int8Array | Uint16Array | Int16Array | Int32Array | Float32Array;
8
8
  }
9
9
  export default function lazy<T>(action: () => T): () => T;