@nativescript/canvas 2.0.0-rc.10 → 2.0.0-rc.11
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 +6 -4
- package/Canvas/index.android.js.map +1 -1
- package/Canvas/index.ios.js +4 -3
- package/Canvas/index.ios.js.map +1 -1
- package/Canvas/utils.js +2 -1
- package/Canvas/utils.js.map +1 -1
- package/Canvas2D/CanvasRenderingContext2D/index.d.ts +1 -0
- package/Canvas2D/CanvasRenderingContext2D/index.js +158 -6
- package/Canvas2D/CanvasRenderingContext2D/index.js.map +1 -1
- package/Canvas2D/DOMMatrix/index.js +280 -2
- package/Canvas2D/DOMMatrix/index.js.map +1 -1
- package/Canvas2D/Path2D/index.js.map +1 -1
- package/WebGL/WebGLRenderingContext/index.js +0 -1
- package/WebGL/WebGLRenderingContext/index.js.map +1 -1
- package/WebGPU/GPUCanvasContext.d.ts +0 -1
- package/WebGPU/GPUCanvasContext.js +6 -18
- package/WebGPU/GPUCanvasContext.js.map +1 -1
- package/WebGPU/GPUCommandEncoder.d.ts +1 -1
- package/WebGPU/GPUCommandEncoder.js +1 -1
- package/WebGPU/GPUCommandEncoder.js.map +1 -1
- package/WebGPU/GPUDevice.d.ts +2 -2
- package/WebGPU/GPUDevice.js.map +1 -1
- package/WebGPU/GPUQueue.js +1 -4
- package/WebGPU/GPUQueue.js.map +1 -1
- package/WebGPU/GPURenderPassEncoder.d.ts +1 -1
- package/WebGPU/GPURenderPassEncoder.js +2 -2
- package/WebGPU/GPURenderPassEncoder.js.map +1 -1
- package/WebGPU/Interfaces.d.ts +1 -0
- package/WebGPU/Types.d.ts +3 -3
- package/WebGPU/Utils.d.ts +1 -1
- package/WebGPU/Utils.js +67 -93
- package/WebGPU/Utils.js.map +1 -1
- package/angular/fesm2022/nativescript-canvas-angular.mjs +5 -5
- package/angular/package.json +0 -2
- 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 +10 -5
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Headers/canvas_native.h +249 -47
- 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 +12361 -10901
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios.private.swiftinterface +55 -49
- 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 +55 -49
- 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 +954 -994
- 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 +20 -10
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Headers/canvas_native.h +249 -47
- 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 +12361 -10901
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +55 -49
- 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 +55 -49
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.abi.json +12361 -10901
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +55 -49
- 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 +55 -49
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/_CodeSignature/CodeResources +29 -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 +955 -993
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/dSYMs/CanvasNative.framework.dSYM/Contents/Resources/Relocations/x86_64/CanvasNative.yml +824 -1037
- package/platforms/ios/src/cpp/CanvasJSIModule.cpp +1166 -1175
- package/platforms/ios/src/cpp/OnRafCallback.cpp +15 -10
- package/platforms/ios/src/cpp/OnRafCallback.h +1 -0
- package/platforms/ios/src/cpp/canvas2d/CanvasRenderingContext2DImpl.cpp +59 -15
- package/platforms/ios/src/cpp/canvas2d/Path2D.cpp +1 -1
- package/platforms/ios/src/cpp/webgpu/GPUAdapterImpl.cpp +4 -8
- package/platforms/ios/src/cpp/webgpu/GPUCanvasContextImpl.cpp +431 -326
- package/platforms/ios/src/cpp/webgpu/GPUCanvasContextImpl.h +98 -42
- package/platforms/ios/src/cpp/webgpu/GPUCommandEncoderImpl.cpp +1150 -1144
- package/platforms/ios/src/cpp/webgpu/GPUDeviceImpl.cpp +69 -34
- package/platforms/ios/src/cpp/webgpu/GPUQueueImpl.cpp +45 -19
- package/platforms/ios/src/cpp/webgpu/GPURenderPassEncoderImpl.cpp +22 -19
- package/platforms/ios/src/cpp/webgpu/GPUTextureImpl.cpp +11 -0
- package/platforms/ios/src/cpp/webgpu/GPUUtils.h +25 -15
- package/angular/esm2022/index.mjs +0 -17
- package/angular/esm2022/nativescript-canvas-angular.mjs +0 -5
|
@@ -1295,7 +1295,8 @@ 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
|
-
auto hasDepthStencil = options->Get(context,
|
|
1298
|
+
auto hasDepthStencil = options->Get(context,
|
|
1299
|
+
ConvertToV8String(isolate, "depthStencil")).ToLocal(
|
|
1299
1300
|
&stencilValue);
|
|
1300
1301
|
|
|
1301
1302
|
CanvasDepthStencilState *stencil = nullptr;
|
|
@@ -1533,7 +1534,9 @@ void GPUDeviceImpl::CreateRenderPipeline(const v8::FunctionCallbackInfo<v8::Valu
|
|
|
1533
1534
|
|
|
1534
1535
|
v8::Local<v8::Value> writeMaskVal;
|
|
1535
1536
|
|
|
1536
|
-
auto hasWriteMask = state->Get(context,
|
|
1537
|
+
auto hasWriteMask = state->Get(context,
|
|
1538
|
+
ConvertToV8String(isolate, "writeMask")).ToLocal(
|
|
1539
|
+
&writeMaskVal);
|
|
1537
1540
|
|
|
1538
1541
|
if (hasWriteMask && writeMaskVal->IsUint32()) {
|
|
1539
1542
|
writeMask = writeMaskVal->Uint32Value(context).FromJust();
|
|
@@ -1545,7 +1548,8 @@ void GPUDeviceImpl::CreateRenderPipeline(const v8::FunctionCallbackInfo<v8::Valu
|
|
|
1545
1548
|
|
|
1546
1549
|
v8::Local<v8::Value> blendVal;
|
|
1547
1550
|
|
|
1548
|
-
auto hasBlend = state->Get(context, ConvertToV8String(isolate, "blend")).ToLocal(
|
|
1551
|
+
auto hasBlend = state->Get(context, ConvertToV8String(isolate, "blend")).ToLocal(
|
|
1552
|
+
&blendVal);
|
|
1549
1553
|
|
|
1550
1554
|
if (hasBlend && blendVal->IsObject()) {
|
|
1551
1555
|
auto blendObj = blendVal.As<v8::Object>();
|
|
@@ -1639,7 +1643,8 @@ void GPUDeviceImpl::CreateRenderPipeline(const v8::FunctionCallbackInfo<v8::Valu
|
|
|
1639
1643
|
}
|
|
1640
1644
|
|
|
1641
1645
|
v8::Local<v8::Value> constantsVal;
|
|
1642
|
-
auto hasConstants = fragmentValueObj->Get(context,
|
|
1646
|
+
auto hasConstants = fragmentValueObj->Get(context,
|
|
1647
|
+
ConvertToV8String(isolate, "constants")).ToLocal(
|
|
1643
1648
|
&constantsVal);
|
|
1644
1649
|
|
|
1645
1650
|
if (hasConstants && constantsVal->IsMap()) {
|
|
@@ -1676,7 +1681,8 @@ void GPUDeviceImpl::CreateRenderPipeline(const v8::FunctionCallbackInfo<v8::Valu
|
|
|
1676
1681
|
|
|
1677
1682
|
|
|
1678
1683
|
v8::Local<v8::Value> entryPoint;
|
|
1679
|
-
auto hasEntryPoint = fragmentValueObj->Get(context, ConvertToV8String(isolate,
|
|
1684
|
+
auto hasEntryPoint = fragmentValueObj->Get(context, ConvertToV8String(isolate,
|
|
1685
|
+
"entryPoint")).ToLocal(
|
|
1680
1686
|
&entryPoint);
|
|
1681
1687
|
|
|
1682
1688
|
|
|
@@ -1755,7 +1761,8 @@ void GPUDeviceImpl::CreateRenderPipeline(const v8::FunctionCallbackInfo<v8::Valu
|
|
|
1755
1761
|
v8::Local<v8::Value> count;
|
|
1756
1762
|
v8::Local<v8::Value> mask;
|
|
1757
1763
|
|
|
1758
|
-
auto hasAlphaToCoverageEnabled = multisampleObj->Get(context, ConvertToV8String(isolate,
|
|
1764
|
+
auto hasAlphaToCoverageEnabled = multisampleObj->Get(context, ConvertToV8String(isolate,
|
|
1765
|
+
"alphaToCoverageEnabled")).
|
|
1759
1766
|
ToLocal(&alphaToCoverageEnabled);
|
|
1760
1767
|
|
|
1761
1768
|
if (hasAlphaToCoverageEnabled && alphaToCoverageEnabled->IsBoolean()) {
|
|
@@ -1802,7 +1809,9 @@ void GPUDeviceImpl::CreateRenderPipeline(const v8::FunctionCallbackInfo<v8::Valu
|
|
|
1802
1809
|
CanvasOptionalIndexFormatNone
|
|
1803
1810
|
};
|
|
1804
1811
|
|
|
1805
|
-
primitive->topology =
|
|
1812
|
+
primitive->topology = CanvasOptionalPrimitiveTopology{
|
|
1813
|
+
CanvasOptionalPrimitiveTopologyNone
|
|
1814
|
+
};
|
|
1806
1815
|
|
|
1807
1816
|
primitive->unclipped_depth = false;
|
|
1808
1817
|
|
|
@@ -1919,19 +1928,24 @@ void GPUDeviceImpl::CreateRenderPipeline(const v8::FunctionCallbackInfo<v8::Valu
|
|
|
1919
1928
|
auto topology = topologyValue.As<v8::Uint32>()->Value();
|
|
1920
1929
|
switch (topology) {
|
|
1921
1930
|
case 0:
|
|
1922
|
-
primitive->topology =
|
|
1931
|
+
primitive->topology.tag = CanvasOptionalPrimitiveTopologySome;
|
|
1932
|
+
primitive->topology.some = CanvasPrimitiveTopology::CanvasPrimitiveTopologyPointList;
|
|
1923
1933
|
break;
|
|
1924
1934
|
case 1:
|
|
1925
|
-
primitive->topology =
|
|
1935
|
+
primitive->topology.tag = CanvasOptionalPrimitiveTopologySome;
|
|
1936
|
+
primitive->topology.some = CanvasPrimitiveTopology::CanvasPrimitiveTopologyLineList;
|
|
1926
1937
|
break;
|
|
1927
1938
|
case 2:
|
|
1928
|
-
primitive->topology =
|
|
1939
|
+
primitive->topology.tag = CanvasOptionalPrimitiveTopologySome;
|
|
1940
|
+
primitive->topology.some = CanvasPrimitiveTopology::CanvasPrimitiveTopologyLineStrip;
|
|
1929
1941
|
break;
|
|
1930
1942
|
case 3:
|
|
1931
|
-
primitive->topology =
|
|
1943
|
+
primitive->topology.tag = CanvasOptionalPrimitiveTopologySome;
|
|
1944
|
+
primitive->topology.some = CanvasPrimitiveTopology::CanvasPrimitiveTopologyTriangleList;
|
|
1932
1945
|
break;
|
|
1933
1946
|
case 4:
|
|
1934
|
-
primitive->topology =
|
|
1947
|
+
primitive->topology.tag = CanvasOptionalPrimitiveTopologySome;
|
|
1948
|
+
primitive->topology.some = CanvasPrimitiveTopology::CanvasPrimitiveTopologyTriangleStrip;
|
|
1935
1949
|
break;
|
|
1936
1950
|
default:
|
|
1937
1951
|
break;
|
|
@@ -1939,15 +1953,20 @@ void GPUDeviceImpl::CreateRenderPipeline(const v8::FunctionCallbackInfo<v8::Valu
|
|
|
1939
1953
|
} else if (topologyValue->IsString()) {
|
|
1940
1954
|
auto topology = ConvertFromV8String(isolate, topologyValue);
|
|
1941
1955
|
if (topology == "line-list") {
|
|
1942
|
-
primitive->topology =
|
|
1956
|
+
primitive->topology.tag = CanvasOptionalPrimitiveTopologySome;
|
|
1957
|
+
primitive->topology.some = CanvasPrimitiveTopology::CanvasPrimitiveTopologyLineList;
|
|
1943
1958
|
} else if (topology == "line-strip") {
|
|
1944
|
-
primitive->topology =
|
|
1959
|
+
primitive->topology.tag = CanvasOptionalPrimitiveTopologySome;
|
|
1960
|
+
primitive->topology.some = CanvasPrimitiveTopology::CanvasPrimitiveTopologyLineStrip;
|
|
1945
1961
|
} else if (topology == "point-list") {
|
|
1946
|
-
primitive->topology =
|
|
1962
|
+
primitive->topology.tag = CanvasOptionalPrimitiveTopologySome;
|
|
1963
|
+
primitive->topology.some = CanvasPrimitiveTopology::CanvasPrimitiveTopologyPointList;
|
|
1947
1964
|
} else if (topology == "triangle-list") {
|
|
1948
|
-
primitive->topology =
|
|
1965
|
+
primitive->topology.tag = CanvasOptionalPrimitiveTopologySome;
|
|
1966
|
+
primitive->topology.some = CanvasPrimitiveTopology::CanvasPrimitiveTopologyTriangleList;
|
|
1949
1967
|
} else if (topology == "triangle-strip") {
|
|
1950
|
-
primitive->topology =
|
|
1968
|
+
primitive->topology.tag = CanvasOptionalPrimitiveTopologySome;
|
|
1969
|
+
primitive->topology.some = CanvasPrimitiveTopology::CanvasPrimitiveTopologyTriangleStrip;
|
|
1951
1970
|
}
|
|
1952
1971
|
}
|
|
1953
1972
|
|
|
@@ -1968,7 +1987,7 @@ void GPUDeviceImpl::CreateRenderPipeline(const v8::FunctionCallbackInfo<v8::Valu
|
|
|
1968
1987
|
|
|
1969
1988
|
|
|
1970
1989
|
v8::Local<v8::Value> vertexValue;
|
|
1971
|
-
|
|
1990
|
+
auto hasVertex = options->Get(context, ConvertToV8String(isolate, "vertex")).ToLocal(
|
|
1972
1991
|
&vertexValue);
|
|
1973
1992
|
|
|
1974
1993
|
|
|
@@ -1990,7 +2009,9 @@ void GPUDeviceImpl::CreateRenderPipeline(const v8::FunctionCallbackInfo<v8::Valu
|
|
|
1990
2009
|
vertex->module = module->GetShaderModule();
|
|
1991
2010
|
|
|
1992
2011
|
v8::Local<v8::Value> constantsVal;
|
|
1993
|
-
auto hasConstants = vertexObj->Get(context,
|
|
2012
|
+
auto hasConstants = vertexObj->Get(context,
|
|
2013
|
+
ConvertToV8String(isolate, "constants")).ToLocal(
|
|
2014
|
+
&constantsVal);
|
|
1994
2015
|
|
|
1995
2016
|
if (hasConstants && constantsVal->IsMap()) {
|
|
1996
2017
|
auto constants = constantsVal.As<v8::Map>();
|
|
@@ -2027,7 +2048,8 @@ void GPUDeviceImpl::CreateRenderPipeline(const v8::FunctionCallbackInfo<v8::Valu
|
|
|
2027
2048
|
}
|
|
2028
2049
|
|
|
2029
2050
|
v8::Local<v8::Value> buffersVal;
|
|
2030
|
-
auto hasBuffers = vertexObj->Get(context, ConvertToV8String(isolate, "buffers")).ToLocal(
|
|
2051
|
+
auto hasBuffers = vertexObj->Get(context, ConvertToV8String(isolate, "buffers")).ToLocal(
|
|
2052
|
+
&buffersVal);
|
|
2031
2053
|
|
|
2032
2054
|
uint64_t stride = 0;
|
|
2033
2055
|
if (hasBuffers && buffersVal->IsArray()) {
|
|
@@ -2039,7 +2061,8 @@ void GPUDeviceImpl::CreateRenderPipeline(const v8::FunctionCallbackInfo<v8::Valu
|
|
|
2039
2061
|
|
|
2040
2062
|
v8::Local<v8::Value> arrayStride;
|
|
2041
2063
|
|
|
2042
|
-
auto hasArrayStride = buffer->Get(context, ConvertToV8String(isolate,
|
|
2064
|
+
auto hasArrayStride = buffer->Get(context, ConvertToV8String(isolate,
|
|
2065
|
+
"arrayStride")).ToLocal(
|
|
2043
2066
|
&arrayStride);
|
|
2044
2067
|
|
|
2045
2068
|
if (hasArrayStride && arrayStride->IsNumber()) {
|
|
@@ -2050,7 +2073,8 @@ void GPUDeviceImpl::CreateRenderPipeline(const v8::FunctionCallbackInfo<v8::Valu
|
|
|
2050
2073
|
|
|
2051
2074
|
v8::Local<v8::Value> attributesValue;
|
|
2052
2075
|
|
|
2053
|
-
auto hasAttributes = buffer->Get(context,
|
|
2076
|
+
auto hasAttributes = buffer->Get(context,
|
|
2077
|
+
ConvertToV8String(isolate, "attributes")).ToLocal(
|
|
2054
2078
|
&attributesValue);
|
|
2055
2079
|
|
|
2056
2080
|
if (hasAttributes && attributesValue->IsArray()) {
|
|
@@ -2629,7 +2653,6 @@ void GPUDeviceImpl::CreateRenderPipelineAsync(const v8::FunctionCallbackInfo<v8:
|
|
|
2629
2653
|
descriptor.label = *label;
|
|
2630
2654
|
|
|
2631
2655
|
|
|
2632
|
-
|
|
2633
2656
|
v8::Local<v8::Value> layoutVal;
|
|
2634
2657
|
options->Get(context, ConvertToV8String(isolate, "layout")).ToLocal(
|
|
2635
2658
|
&layoutVal);
|
|
@@ -2721,7 +2744,9 @@ void GPUDeviceImpl::CreateRenderPipelineAsync(const v8::FunctionCallbackInfo<v8:
|
|
|
2721
2744
|
CanvasOptionalIndexFormatNone
|
|
2722
2745
|
};
|
|
2723
2746
|
|
|
2724
|
-
primitive->topology =
|
|
2747
|
+
primitive->topology = CanvasOptionalPrimitiveTopology{
|
|
2748
|
+
CanvasOptionalPrimitiveTopologyNone
|
|
2749
|
+
};
|
|
2725
2750
|
|
|
2726
2751
|
primitive->unclipped_depth = false;
|
|
2727
2752
|
|
|
@@ -2838,19 +2863,24 @@ void GPUDeviceImpl::CreateRenderPipelineAsync(const v8::FunctionCallbackInfo<v8:
|
|
|
2838
2863
|
auto topology = topologyValue.As<v8::Uint32>()->Value();
|
|
2839
2864
|
switch (topology) {
|
|
2840
2865
|
case 0:
|
|
2841
|
-
primitive->topology =
|
|
2866
|
+
primitive->topology.tag = CanvasOptionalPrimitiveTopologySome;
|
|
2867
|
+
primitive->topology.some = CanvasPrimitiveTopology::CanvasPrimitiveTopologyPointList;
|
|
2842
2868
|
break;
|
|
2843
2869
|
case 1:
|
|
2844
|
-
primitive->topology =
|
|
2870
|
+
primitive->topology.tag = CanvasOptionalPrimitiveTopologySome;
|
|
2871
|
+
primitive->topology.some = CanvasPrimitiveTopology::CanvasPrimitiveTopologyLineList;
|
|
2845
2872
|
break;
|
|
2846
2873
|
case 2:
|
|
2847
|
-
primitive->topology =
|
|
2874
|
+
primitive->topology.tag = CanvasOptionalPrimitiveTopologySome;
|
|
2875
|
+
primitive->topology.some = CanvasPrimitiveTopology::CanvasPrimitiveTopologyLineStrip;
|
|
2848
2876
|
break;
|
|
2849
2877
|
case 3:
|
|
2850
|
-
primitive->topology =
|
|
2878
|
+
primitive->topology.tag = CanvasOptionalPrimitiveTopologySome;
|
|
2879
|
+
primitive->topology.some = CanvasPrimitiveTopology::CanvasPrimitiveTopologyTriangleList;
|
|
2851
2880
|
break;
|
|
2852
2881
|
case 4:
|
|
2853
|
-
primitive->topology =
|
|
2882
|
+
primitive->topology.tag = CanvasOptionalPrimitiveTopologySome;
|
|
2883
|
+
primitive->topology.some = CanvasPrimitiveTopology::CanvasPrimitiveTopologyTriangleStrip;
|
|
2854
2884
|
break;
|
|
2855
2885
|
default:
|
|
2856
2886
|
break;
|
|
@@ -2858,15 +2888,20 @@ void GPUDeviceImpl::CreateRenderPipelineAsync(const v8::FunctionCallbackInfo<v8:
|
|
|
2858
2888
|
} else if (topologyValue->IsString()) {
|
|
2859
2889
|
auto topology = ConvertFromV8String(isolate, topologyValue);
|
|
2860
2890
|
if (topology == "line-list") {
|
|
2861
|
-
primitive->topology =
|
|
2891
|
+
primitive->topology.tag = CanvasOptionalPrimitiveTopologySome;
|
|
2892
|
+
primitive->topology.some = CanvasPrimitiveTopology::CanvasPrimitiveTopologyLineList;
|
|
2862
2893
|
} else if (topology == "line-strip") {
|
|
2863
|
-
primitive->topology =
|
|
2894
|
+
primitive->topology.tag = CanvasOptionalPrimitiveTopologySome;
|
|
2895
|
+
primitive->topology.some = CanvasPrimitiveTopology::CanvasPrimitiveTopologyLineStrip;
|
|
2864
2896
|
} else if (topology == "point-list") {
|
|
2865
|
-
primitive->topology =
|
|
2897
|
+
primitive->topology.tag = CanvasOptionalPrimitiveTopologySome;
|
|
2898
|
+
primitive->topology.some = CanvasPrimitiveTopology::CanvasPrimitiveTopologyPointList;
|
|
2866
2899
|
} else if (topology == "triangle-list") {
|
|
2867
|
-
primitive->topology =
|
|
2900
|
+
primitive->topology.tag = CanvasOptionalPrimitiveTopologySome;
|
|
2901
|
+
primitive->topology.some = CanvasPrimitiveTopology::CanvasPrimitiveTopologyTriangleList;
|
|
2868
2902
|
} else if (topology == "triangle-strip") {
|
|
2869
|
-
primitive->topology =
|
|
2903
|
+
primitive->topology.tag = CanvasOptionalPrimitiveTopologySome;
|
|
2904
|
+
primitive->topology.some = CanvasPrimitiveTopology::CanvasPrimitiveTopologyTriangleStrip;
|
|
2870
2905
|
}
|
|
2871
2906
|
}
|
|
2872
2907
|
|
|
@@ -199,7 +199,7 @@ void GPUQueueImpl::CopyExternalImageToTexture(const v8::FunctionCallbackInfo<v8:
|
|
|
199
199
|
auto textureVal = destinationObj->Get(context, ConvertToV8String(isolate,
|
|
200
200
|
"texture")).ToLocalChecked();
|
|
201
201
|
auto texture = GPUTextureImpl::GetPointer(textureVal.As<v8::Object>())->GetTexture();
|
|
202
|
-
|
|
202
|
+
|
|
203
203
|
|
|
204
204
|
uint32_t mipLevel = 0;
|
|
205
205
|
CanvasOrigin3d origin{0, 0, 0};
|
|
@@ -442,31 +442,57 @@ void GPUQueueImpl::WriteBuffer(const v8::FunctionCallbackInfo<v8::Value> &args)
|
|
|
442
442
|
auto buffer = GPUBufferImpl::GetPointer(bufferValue.As<v8::Object>());
|
|
443
443
|
|
|
444
444
|
auto bufferOffset = (uint64_t) args[1].As<v8::Number>()->Value();
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
445
|
+
|
|
446
|
+
std::shared_ptr<v8::BackingStore> store;
|
|
447
|
+
|
|
448
|
+
uint8_t * data = nullptr;
|
|
449
|
+
|
|
450
|
+
size_t offset = 0;
|
|
451
|
+
size_t data_size = 0;
|
|
452
|
+
|
|
453
|
+
if(args[2]->IsTypedArray()){
|
|
454
|
+
auto dataValue = args[2].As<v8::TypedArray>();
|
|
455
|
+
store = dataValue->Buffer()->GetBackingStore();
|
|
456
|
+
offset = dataValue->ByteOffset();
|
|
457
|
+
data = static_cast<uint8_t *>(store->Data()) + offset;
|
|
458
|
+
data_size = store->ByteLength() - offset;
|
|
459
|
+
}else if(args[2]->IsArrayBuffer()){
|
|
460
|
+
auto dataValue = args[2].As<v8::ArrayBuffer>();
|
|
461
|
+
store = dataValue->GetBackingStore();
|
|
462
|
+
data = static_cast<uint8_t *>(store->Data());
|
|
463
|
+
data_size = store->ByteLength();
|
|
464
|
+
}else {
|
|
465
|
+
return;
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
|
|
455
469
|
|
|
456
470
|
auto dataOffset = (uint64_t) args[3].As<v8::Number>()->Value();
|
|
457
471
|
|
|
458
|
-
int64_t size = -1;
|
|
459
472
|
auto sizeValue = args[4];
|
|
460
473
|
|
|
461
|
-
if (sizeValue->IsNumber()) {
|
|
462
|
-
size = (int64_t) sizeValue->ToNumber(context).ToLocalChecked()->Value();
|
|
463
|
-
}
|
|
464
|
-
|
|
465
474
|
|
|
466
475
|
if (buffer != nullptr) {
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
476
|
+
|
|
477
|
+
|
|
478
|
+
if (sizeValue->IsNumber()) {
|
|
479
|
+
int64_t size = (int64_t) sizeValue->ToNumber(context).ToLocalChecked()->Value();
|
|
480
|
+
|
|
481
|
+
if(size < 0){
|
|
482
|
+
canvas_native_webgpu_queue_write_buffer(ptr->GetGPUQueue(), buffer->GetGPUBuffer(),
|
|
483
|
+
bufferOffset, data, data_size, dataOffset);
|
|
484
|
+
}else {
|
|
485
|
+
canvas_native_webgpu_queue_write_buffer_size(ptr->GetGPUQueue(),
|
|
486
|
+
buffer->GetGPUBuffer(),
|
|
487
|
+
bufferOffset, data, data_size,
|
|
488
|
+
dataOffset,
|
|
489
|
+
size);
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
} else {
|
|
493
|
+
canvas_native_webgpu_queue_write_buffer(ptr->GetGPUQueue(), buffer->GetGPUBuffer(),
|
|
494
|
+
bufferOffset, data, data_size, dataOffset);
|
|
495
|
+
}
|
|
470
496
|
}
|
|
471
497
|
}
|
|
472
498
|
|
|
@@ -586,8 +586,10 @@ void GPURenderPassEncoderImpl::SetBlendConstant(const v8::FunctionCallbackInfo<v
|
|
|
586
586
|
|
|
587
587
|
auto color = ParseColor(isolate, colorVal);
|
|
588
588
|
|
|
589
|
-
|
|
590
|
-
|
|
589
|
+
if (color.tag == CanvasOptionalColorSome) {
|
|
590
|
+
canvas_native_webgpu_render_pass_encoder_set_blend_constant(ptr->GetPass(),
|
|
591
|
+
&color.some);
|
|
592
|
+
}
|
|
591
593
|
}
|
|
592
594
|
|
|
593
595
|
}
|
|
@@ -702,22 +704,23 @@ void GPURenderPassEncoderImpl::SetViewport(const v8::FunctionCallbackInfo<v8::Va
|
|
|
702
704
|
|
|
703
705
|
auto isolate = args.GetIsolate();
|
|
704
706
|
auto context = isolate->GetCurrentContext();
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
canvas_native_webgpu_render_pass_encoder_set_viewport(ptr->GetPass(),x,y,width,height,
|
|
707
|
+
|
|
708
|
+
|
|
709
|
+
auto x = (float) xVal->NumberValue(
|
|
710
|
+
context).FromJust();
|
|
711
|
+
auto y = (float) yVal->NumberValue(
|
|
712
|
+
context).FromJust();
|
|
713
|
+
auto width = (float) widthVal->NumberValue(
|
|
714
|
+
context).FromJust();
|
|
715
|
+
auto height = (float) heightVal->NumberValue(
|
|
716
|
+
context).FromJust();
|
|
717
|
+
|
|
718
|
+
auto minDepth = (float) minDepthVal->NumberValue(
|
|
719
|
+
context).FromJust();
|
|
720
|
+
auto maxDepth = (float) maxDepthVal->NumberValue(
|
|
721
|
+
context).FromJust();
|
|
722
|
+
|
|
723
|
+
canvas_native_webgpu_render_pass_encoder_set_viewport(ptr->GetPass(), x, y, width, height,
|
|
724
|
+
minDepth, maxDepth);
|
|
722
725
|
|
|
723
726
|
}
|
|
@@ -364,6 +364,17 @@ void GPUTextureImpl::CreateView(const v8::FunctionCallbackInfo<v8::Value> &args)
|
|
|
364
364
|
}
|
|
365
365
|
}
|
|
366
366
|
|
|
367
|
+
|
|
368
|
+
v8::Local<v8::Value> usageVal;
|
|
369
|
+
uint32_t usage = 0;
|
|
370
|
+
if (descObj->Get(context, ConvertToV8String(isolate, "usage")).ToLocal(
|
|
371
|
+
&usageVal) && usageVal->IsUint32()) {
|
|
372
|
+
usage = usageVal->Uint32Value(context).FromJust();
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
descriptor->usage = usage;
|
|
376
|
+
|
|
377
|
+
|
|
367
378
|
descriptor->dimension = dimension;
|
|
368
379
|
|
|
369
380
|
|
|
@@ -13,9 +13,9 @@
|
|
|
13
13
|
#include "GPUBufferImpl.h"
|
|
14
14
|
|
|
15
15
|
inline static CanvasStoreOp
|
|
16
|
-
ParseCanvasStoreOp(v8::Isolate *isolate, const v8::Local<v8::Value> &obj){
|
|
16
|
+
ParseCanvasStoreOp(v8::Isolate *isolate, const v8::Local<v8::Value> &obj) {
|
|
17
17
|
auto ret = CanvasStoreOp::CanvasStoreOpStore;
|
|
18
|
-
if(!obj.IsEmpty()){
|
|
18
|
+
if (!obj.IsEmpty()) {
|
|
19
19
|
if (obj->IsUint32()) {
|
|
20
20
|
ret = (CanvasStoreOp) obj->Uint32Value(isolate->GetCurrentContext()).ToChecked();
|
|
21
21
|
} else if (obj->IsString()) {
|
|
@@ -31,9 +31,9 @@ ParseCanvasStoreOp(v8::Isolate *isolate, const v8::Local<v8::Value> &obj){
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
inline static CanvasLoadOp
|
|
34
|
-
ParseCanvasLoadOp(v8::Isolate *isolate, const v8::Local<v8::Value> &obj){
|
|
34
|
+
ParseCanvasLoadOp(v8::Isolate *isolate, const v8::Local<v8::Value> &obj) {
|
|
35
35
|
auto ret = CanvasLoadOp::CanvasLoadOpClear;
|
|
36
|
-
if(!obj.IsEmpty()){
|
|
36
|
+
if (!obj.IsEmpty()) {
|
|
37
37
|
if (obj->IsUint32()) {
|
|
38
38
|
ret = (CanvasLoadOp) obj->Uint32Value(isolate->GetCurrentContext()).ToChecked();
|
|
39
39
|
} else if (obj->IsString()) {
|
|
@@ -687,65 +687,75 @@ ParseExtent3d(v8::Isolate *isolate, const v8::Local<v8::Value> &obj) {
|
|
|
687
687
|
}
|
|
688
688
|
|
|
689
689
|
|
|
690
|
-
inline static
|
|
690
|
+
inline static CanvasOptionalColor
|
|
691
691
|
ParseColor(v8::Isolate *isolate, const v8::Local<v8::Value> &obj) {
|
|
692
692
|
|
|
693
693
|
auto context = isolate->GetCurrentContext();
|
|
694
|
-
|
|
695
|
-
|
|
694
|
+
CanvasOptionalColor ret{
|
|
695
|
+
CanvasOptionalColorNone
|
|
696
696
|
};
|
|
697
697
|
|
|
698
698
|
if (!obj.IsEmpty()) {
|
|
699
699
|
if (obj->IsArray()) {
|
|
700
700
|
auto array = obj.As<v8::Array>();
|
|
701
701
|
v8::Local<v8::Value> r;
|
|
702
|
+
ret.tag = CanvasOptionalColorSome;
|
|
703
|
+
ret.some = CanvasColor{
|
|
704
|
+
0, 0, 0, 0
|
|
705
|
+
};
|
|
702
706
|
if (array->Get(context, 0).ToLocal(&r) &&
|
|
703
707
|
r->IsNumber()) {
|
|
704
|
-
ret.r = r->NumberValue(context).FromJust();
|
|
708
|
+
ret.some.r = r->NumberValue(context).FromJust();
|
|
705
709
|
}
|
|
706
710
|
|
|
707
711
|
v8::Local<v8::Value> g;
|
|
708
712
|
if (array->Get(context, 1).ToLocal(&g) &&
|
|
709
713
|
g->IsNumber()) {
|
|
710
|
-
ret.g = g->NumberValue(context).FromJust();
|
|
714
|
+
ret.some.g = g->NumberValue(context).FromJust();
|
|
711
715
|
}
|
|
712
716
|
|
|
713
717
|
v8::Local<v8::Value> b;
|
|
714
718
|
if (array->Get(context, 2).ToLocal(
|
|
715
719
|
&b) && b->IsNumber()) {
|
|
716
|
-
ret.b = b->NumberValue(context).FromJust();
|
|
720
|
+
ret.some.b = b->NumberValue(context).FromJust();
|
|
717
721
|
}
|
|
718
722
|
|
|
719
723
|
|
|
720
724
|
v8::Local<v8::Value> a;
|
|
721
725
|
if (array->Get(context, 3).ToLocal(
|
|
722
726
|
&a) && a->IsNumber()) {
|
|
723
|
-
ret.a = a->NumberValue(context).FromJust();
|
|
727
|
+
ret.some.a = a->NumberValue(context).FromJust();
|
|
724
728
|
}
|
|
725
729
|
} else if (obj->IsObject()) {
|
|
726
730
|
auto colorObj = obj.As<v8::Object>();
|
|
727
731
|
v8::Local<v8::Value> r;
|
|
732
|
+
|
|
733
|
+
ret.tag = CanvasOptionalColorSome;
|
|
734
|
+
ret.some = CanvasColor{
|
|
735
|
+
0, 0, 0, 0
|
|
736
|
+
};
|
|
737
|
+
|
|
728
738
|
if (colorObj->Get(context, ConvertToV8String(isolate, "r")).ToLocal(&r) &&
|
|
729
739
|
r->IsNumber()) {
|
|
730
|
-
ret.r = r->NumberValue(context).FromJust();
|
|
740
|
+
ret.some.r = r->NumberValue(context).FromJust();
|
|
731
741
|
}
|
|
732
742
|
|
|
733
743
|
v8::Local<v8::Value> g;
|
|
734
744
|
if (colorObj->Get(context, ConvertToV8String(isolate, "g")).ToLocal(&g) &&
|
|
735
745
|
g->IsNumber()) {
|
|
736
|
-
ret.g = g->NumberValue(context).FromJust();
|
|
746
|
+
ret.some.g = g->NumberValue(context).FromJust();
|
|
737
747
|
}
|
|
738
748
|
|
|
739
749
|
v8::Local<v8::Value> b;
|
|
740
750
|
if (colorObj->Get(context, ConvertToV8String(isolate, "b")).ToLocal(
|
|
741
751
|
&b) && b->IsNumber()) {
|
|
742
|
-
ret.b = b->NumberValue(context).FromJust();
|
|
752
|
+
ret.some.b = b->NumberValue(context).FromJust();
|
|
743
753
|
}
|
|
744
754
|
|
|
745
755
|
v8::Local<v8::Value> a;
|
|
746
756
|
if (colorObj->Get(context, ConvertToV8String(isolate, "a")).ToLocal(
|
|
747
757
|
&a) && a->IsNumber()) {
|
|
748
|
-
ret.a = a->NumberValue(context).FromJust();
|
|
758
|
+
ret.some.a = a->NumberValue(context).FromJust();
|
|
749
759
|
}
|
|
750
760
|
}
|
|
751
761
|
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { NgModule, NO_ERRORS_SCHEMA } from '@angular/core';
|
|
2
|
-
import { registerElement } from '@nativescript/angular';
|
|
3
|
-
import * as i0 from "@angular/core";
|
|
4
|
-
registerElement('Canvas', () => require('@nativescript/canvas').Canvas);
|
|
5
|
-
// @ts-ignore
|
|
6
|
-
export class CanvasModule {
|
|
7
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: CanvasModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
8
|
-
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.12", ngImport: i0, type: CanvasModule });
|
|
9
|
-
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: CanvasModule });
|
|
10
|
-
}
|
|
11
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: CanvasModule, decorators: [{
|
|
12
|
-
type: NgModule,
|
|
13
|
-
args: [{
|
|
14
|
-
schemas: [NO_ERRORS_SCHEMA]
|
|
15
|
-
}]
|
|
16
|
-
}] });
|
|
17
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi9wYWNrYWdlcy9jYW52YXMvYW5ndWxhci9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUMsUUFBUSxFQUFFLGdCQUFnQixFQUFDLE1BQU0sZUFBZSxDQUFDO0FBQ3pELE9BQU8sRUFBQyxlQUFlLEVBQUMsTUFBTSx1QkFBdUIsQ0FBQzs7QUFFdEQsZUFBZSxDQUFDLFFBQVEsRUFBRSxHQUFHLEVBQUUsQ0FBQyxPQUFPLENBQUMsc0JBQXNCLENBQUMsQ0FBQyxNQUFNLENBQUMsQ0FBQztBQU14RSxhQUFhO0FBQ2IsTUFBTSxPQUFPLFlBQVk7d0dBQVosWUFBWTt5R0FBWixZQUFZO3lHQUFaLFlBQVk7OzRGQUFaLFlBQVk7a0JBSnhCLFFBQVE7bUJBQUM7b0JBQ1IsT0FBTyxFQUFFLENBQUMsZ0JBQWdCLENBQUM7aUJBQzVCIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHtOZ01vZHVsZSwgTk9fRVJST1JTX1NDSEVNQX0gZnJvbSAnQGFuZ3VsYXIvY29yZSc7XG5pbXBvcnQge3JlZ2lzdGVyRWxlbWVudH0gZnJvbSAnQG5hdGl2ZXNjcmlwdC9hbmd1bGFyJztcblxucmVnaXN0ZXJFbGVtZW50KCdDYW52YXMnLCAoKSA9PiByZXF1aXJlKCdAbmF0aXZlc2NyaXB0L2NhbnZhcycpLkNhbnZhcyk7XG5cblxuQE5nTW9kdWxlKHtcbiAgc2NoZW1hczogW05PX0VSUk9SU19TQ0hFTUFdXG59KVxuLy8gQHRzLWlnbm9yZVxuZXhwb3J0IGNsYXNzIENhbnZhc01vZHVsZSB7XG59XG4iXX0=
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Generated bundle index. Do not edit.
|
|
3
|
-
*/
|
|
4
|
-
export * from './index';
|
|
5
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibmF0aXZlc2NyaXB0LWNhbnZhcy1hbmd1bGFyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vcGFja2FnZXMvY2FudmFzL2FuZ3VsYXIvbmF0aXZlc2NyaXB0LWNhbnZhcy1hbmd1bGFyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOztHQUVHO0FBRUgsY0FBYyxTQUFTLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIEdlbmVyYXRlZCBidW5kbGUgaW5kZXguIERvIG5vdCBlZGl0LlxuICovXG5cbmV4cG9ydCAqIGZyb20gJy4vaW5kZXgnO1xuIl19
|