@nativescript/canvas 2.0.0-beta.8 → 2.0.0-webgpu.0
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 +23 -15
- package/Canvas/common.js +125 -56
- package/Canvas/common.js.map +1 -1
- package/Canvas/index.android.d.ts +5 -7
- package/Canvas/index.android.js +61 -133
- package/Canvas/index.android.js.map +1 -1
- package/Canvas/index.d.ts +4 -1
- package/Canvas/index.ios.d.ts +6 -6
- package/Canvas/index.ios.js +75 -85
- package/Canvas/index.ios.js.map +1 -1
- package/Canvas2D/CanvasRenderingContext2D/index.d.ts +1 -1
- package/Canvas2D/CanvasRenderingContext2D/index.js +8 -11
- package/Canvas2D/CanvasRenderingContext2D/index.js.map +1 -1
- package/Canvas2D/DOMMatrix/index.d.ts +14 -0
- package/Canvas2D/DOMMatrix/index.js +62 -0
- package/Canvas2D/DOMMatrix/index.js.map +1 -1
- package/Canvas2D/ImageData/index.js +4 -6
- package/Canvas2D/ImageData/index.js.map +1 -1
- package/ImageAsset/index.d.ts +1 -0
- package/ImageAsset/index.js +49 -0
- package/ImageAsset/index.js.map +1 -1
- package/WebGL/WebGLRenderingContext/index.d.ts +1 -0
- package/WebGL/WebGLRenderingContext/index.js +104 -14
- package/WebGL/WebGLRenderingContext/index.js.map +1 -1
- package/WebGL2/WebGL2RenderingContext/index.d.ts +1 -0
- package/WebGL2/WebGL2RenderingContext/index.js +2 -3
- package/WebGL2/WebGL2RenderingContext/index.js.map +1 -1
- package/WebGPU/Constants.d.ts +36 -0
- package/WebGPU/Constants.js +42 -0
- package/WebGPU/Constants.js.map +1 -0
- package/WebGPU/Errors.d.ts +18 -0
- package/WebGPU/Errors.js +21 -0
- package/WebGPU/Errors.js.map +1 -0
- package/WebGPU/GPU.d.ts +13 -0
- package/WebGPU/GPU.js +35 -0
- package/WebGPU/GPU.js.map +1 -0
- package/WebGPU/GPUAdapter.d.ts +23 -0
- package/WebGPU/GPUAdapter.js +62 -0
- package/WebGPU/GPUAdapter.js.map +1 -0
- package/WebGPU/GPUAdapterInfo.d.ts +9 -0
- package/WebGPU/GPUAdapterInfo.js +24 -0
- package/WebGPU/GPUAdapterInfo.js.map +1 -0
- package/WebGPU/GPUBindGroup.d.ts +5 -0
- package/WebGPU/GPUBindGroup.js +12 -0
- package/WebGPU/GPUBindGroup.js.map +1 -0
- package/WebGPU/GPUBindGroupLayout.d.ts +5 -0
- package/WebGPU/GPUBindGroupLayout.js +12 -0
- package/WebGPU/GPUBindGroupLayout.js.map +1 -0
- package/WebGPU/GPUBuffer.d.ts +15 -0
- package/WebGPU/GPUBuffer.js +54 -0
- package/WebGPU/GPUBuffer.js.map +1 -0
- package/WebGPU/GPUCanvasContext.d.ts +33 -0
- package/WebGPU/GPUCanvasContext.js +67 -0
- package/WebGPU/GPUCanvasContext.js.map +1 -0
- package/WebGPU/GPUCommandBuffer.d.ts +5 -0
- package/WebGPU/GPUCommandBuffer.js +12 -0
- package/WebGPU/GPUCommandBuffer.js.map +1 -0
- package/WebGPU/GPUCommandEncoder.d.ts +41 -0
- package/WebGPU/GPUCommandEncoder.js +105 -0
- package/WebGPU/GPUCommandEncoder.js.map +1 -0
- package/WebGPU/GPUComputePassEncoder.d.ts +16 -0
- package/WebGPU/GPUComputePassEncoder.js +50 -0
- package/WebGPU/GPUComputePassEncoder.js.map +1 -0
- package/WebGPU/GPUComputePipeline.d.ts +7 -0
- package/WebGPU/GPUComputePipeline.js +16 -0
- package/WebGPU/GPUComputePipeline.js.map +1 -0
- package/WebGPU/GPUDevice.d.ts +173 -0
- package/WebGPU/GPUDevice.js +381 -0
- package/WebGPU/GPUDevice.js.map +1 -0
- package/WebGPU/GPUDeviceLostInfo.d.ts +1 -0
- package/WebGPU/GPUDeviceLostInfo.js +10 -0
- package/WebGPU/GPUDeviceLostInfo.js.map +1 -0
- package/WebGPU/GPUExternalTexture.d.ts +5 -0
- package/WebGPU/GPUExternalTexture.js +12 -0
- package/WebGPU/GPUExternalTexture.js.map +1 -0
- package/WebGPU/GPUPipelineLayout.d.ts +5 -0
- package/WebGPU/GPUPipelineLayout.js +12 -0
- package/WebGPU/GPUPipelineLayout.js.map +1 -0
- package/WebGPU/GPUQuerySet.d.ts +5 -0
- package/WebGPU/GPUQuerySet.js +12 -0
- package/WebGPU/GPUQuerySet.js.map +1 -0
- package/WebGPU/GPUQueue.d.ts +14 -0
- package/WebGPU/GPUQueue.js +77 -0
- package/WebGPU/GPUQueue.js.map +1 -0
- package/WebGPU/GPURenderBundle.d.ts +5 -0
- package/WebGPU/GPURenderBundle.js +12 -0
- package/WebGPU/GPURenderBundle.js.map +1 -0
- package/WebGPU/GPURenderBundleEncoder.d.ts +20 -0
- package/WebGPU/GPURenderBundleEncoder.js +61 -0
- package/WebGPU/GPURenderBundleEncoder.js.map +1 -0
- package/WebGPU/GPURenderPassEncoder.d.ts +29 -0
- package/WebGPU/GPURenderPassEncoder.js +94 -0
- package/WebGPU/GPURenderPassEncoder.js.map +1 -0
- package/WebGPU/GPURenderPipeline.d.ts +7 -0
- package/WebGPU/GPURenderPipeline.js +16 -0
- package/WebGPU/GPURenderPipeline.js.map +1 -0
- package/WebGPU/GPUSampler.d.ts +5 -0
- package/WebGPU/GPUSampler.js +12 -0
- package/WebGPU/GPUSampler.js.map +1 -0
- package/WebGPU/GPUShaderModule.d.ts +6 -0
- package/WebGPU/GPUShaderModule.js +15 -0
- package/WebGPU/GPUShaderModule.js.map +1 -0
- package/WebGPU/GPUTexture.d.ts +16 -0
- package/WebGPU/GPUTexture.js +41 -0
- package/WebGPU/GPUTexture.js.map +1 -0
- package/WebGPU/GPUTextureView.d.ts +5 -0
- package/WebGPU/GPUTextureView.js +12 -0
- package/WebGPU/GPUTextureView.js.map +1 -0
- package/WebGPU/Interfaces.d.ts +155 -0
- package/WebGPU/Interfaces.js +2 -0
- package/WebGPU/Interfaces.js.map +1 -0
- package/WebGPU/Types.d.ts +39 -0
- package/WebGPU/Types.js +2 -0
- package/WebGPU/Types.js.map +1 -0
- package/WebGPU/Utils.d.ts +1 -0
- package/WebGPU/Utils.js +75 -0
- package/WebGPU/Utils.js.map +1 -0
- package/WebGPU/index.d.ts +28 -0
- package/WebGPU/index.js +29 -0
- package/WebGPU/index.js.map +1 -0
- package/index.d.ts +1 -1
- package/index.js +22 -1
- package/index.js.map +1 -1
- package/package.json +1 -4
- 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 +23 -23
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Headers/canvas_ios.h +47 -8
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Headers/canvas_native.h +2280 -103
- 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 +1564 -3814
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios.private.swiftinterface +27 -34
- 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 +27 -34
- 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 +602 -664
- 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 +46 -46
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Headers/canvas_ios.h +47 -8
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Headers/canvas_native.h +2280 -103
- 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 +1564 -3814
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +27 -34
- 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 +27 -34
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.abi.json +1564 -3814
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +27 -34
- 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 +27 -34
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/_CodeSignature/CodeResources +31 -31
- 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 +604 -663
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/dSYMs/CanvasNative.framework.dSYM/Contents/Resources/Relocations/x86_64/CanvasNative.yml +638 -642
- package/platforms/ios/build.xcconfig +3 -1
- package/platforms/ios/src/cpp/Caches.h +69 -1
- package/platforms/ios/src/cpp/CanvasJSIModule.cpp +320 -395
- package/platforms/ios/src/cpp/CanvasJSIModule.h +7 -1
- package/platforms/ios/src/cpp/Helpers.h +43 -8
- package/platforms/ios/src/cpp/ImageAssetImpl.cpp +35 -37
- package/platforms/ios/src/cpp/ImageAssetImpl.h +14 -10
- package/platforms/ios/src/cpp/ImageBitmapImpl.cpp +2 -2
- package/platforms/ios/src/cpp/ImageBitmapImpl.h +1 -1
- package/platforms/ios/src/cpp/canvas2d/CanvasPattern.cpp +0 -10
- package/platforms/ios/src/cpp/canvas2d/CanvasRenderingContext2DImpl.cpp +41 -4
- package/platforms/ios/src/cpp/canvas2d/MatrixImpl.cpp +409 -3
- package/platforms/ios/src/cpp/canvas2d/MatrixImpl.h +27 -0
- package/platforms/ios/src/cpp/webgl/WebGLRenderingContext.cpp +131 -149
- package/platforms/ios/src/cpp/webgl2/WebGL2RenderingContext.cpp +1766 -1659
- package/platforms/ios/src/cpp/webgpu/GPUAdapterImpl.cpp +302 -0
- package/platforms/ios/src/cpp/webgpu/GPUAdapterImpl.h +63 -0
- package/platforms/ios/src/cpp/webgpu/GPUAdapterInfoImpl.cpp +174 -0
- package/platforms/ios/src/cpp/webgpu/GPUAdapterInfoImpl.h +58 -0
- package/platforms/ios/src/cpp/webgpu/GPUBindGroupImpl.cpp +53 -0
- package/platforms/ios/src/cpp/webgpu/GPUBindGroupImpl.h +45 -0
- package/platforms/ios/src/cpp/webgpu/GPUBindGroupLayoutImpl.cpp +53 -0
- package/platforms/ios/src/cpp/webgpu/GPUBindGroupLayoutImpl.h +45 -0
- package/platforms/ios/src/cpp/webgpu/GPUBufferImpl.cpp +229 -0
- package/platforms/ios/src/cpp/webgpu/GPUBufferImpl.h +59 -0
- package/platforms/ios/src/cpp/webgpu/GPUCanvasContextImpl.cpp +317 -0
- package/platforms/ios/src/cpp/webgpu/GPUCanvasContextImpl.h +55 -0
- package/platforms/ios/src/cpp/webgpu/GPUCommandBufferImpl.cpp +54 -0
- package/platforms/ios/src/cpp/webgpu/GPUCommandBufferImpl.h +45 -0
- package/platforms/ios/src/cpp/webgpu/GPUCommandEncoderImpl.cpp +1087 -0
- package/platforms/ios/src/cpp/webgpu/GPUCommandEncoderImpl.h +69 -0
- package/platforms/ios/src/cpp/webgpu/GPUComputePassEncoderImpl.cpp +260 -0
- package/platforms/ios/src/cpp/webgpu/GPUComputePassEncoderImpl.h +62 -0
- package/platforms/ios/src/cpp/webgpu/GPUComputePipelineImpl.cpp +84 -0
- package/platforms/ios/src/cpp/webgpu/GPUComputePipelineImpl.h +49 -0
- package/platforms/ios/src/cpp/webgpu/GPUDeviceImpl.cpp +2741 -0
- package/platforms/ios/src/cpp/webgpu/GPUDeviceImpl.h +95 -0
- package/platforms/ios/src/cpp/webgpu/GPUImpl.cpp +186 -0
- package/platforms/ios/src/cpp/webgpu/GPUImpl.h +55 -0
- package/platforms/ios/src/cpp/webgpu/GPUPipelineLayoutImpl.cpp +54 -0
- package/platforms/ios/src/cpp/webgpu/GPUPipelineLayoutImpl.h +46 -0
- package/platforms/ios/src/cpp/webgpu/GPUQuerySetImpl.cpp +137 -0
- package/platforms/ios/src/cpp/webgpu/GPUQuerySetImpl.h +55 -0
- package/platforms/ios/src/cpp/webgpu/GPUQueueImpl.cpp +521 -0
- package/platforms/ios/src/cpp/webgpu/GPUQueueImpl.h +56 -0
- package/platforms/ios/src/cpp/webgpu/GPURenderBundleEncoderImpl.cpp +469 -0
- package/platforms/ios/src/cpp/webgpu/GPURenderBundleEncoderImpl.h +71 -0
- package/platforms/ios/src/cpp/webgpu/GPURenderBundleImpl.cpp +53 -0
- package/platforms/ios/src/cpp/webgpu/GPURenderBundleImpl.h +45 -0
- package/platforms/ios/src/cpp/webgpu/GPURenderPassEncoderImpl.cpp +653 -0
- package/platforms/ios/src/cpp/webgpu/GPURenderPassEncoderImpl.h +85 -0
- package/platforms/ios/src/cpp/webgpu/GPURenderPipelineImpl.cpp +84 -0
- package/platforms/ios/src/cpp/webgpu/GPURenderPipelineImpl.h +49 -0
- package/platforms/ios/src/cpp/webgpu/GPUSamplerImpl.cpp +53 -0
- package/platforms/ios/src/cpp/webgpu/GPUSamplerImpl.h +45 -0
- package/platforms/ios/src/cpp/webgpu/GPUShaderModuleImpl.cpp +56 -0
- package/platforms/ios/src/cpp/webgpu/GPUShaderModuleImpl.h +45 -0
- package/platforms/ios/src/cpp/webgpu/GPUSupportedLimitsImpl.cpp +1304 -0
- package/platforms/ios/src/cpp/webgpu/GPUSupportedLimitsImpl.h +288 -0
- package/platforms/ios/src/cpp/webgpu/GPUTextureImpl.cpp +360 -0
- package/platforms/ios/src/cpp/webgpu/GPUTextureImpl.h +75 -0
- package/platforms/ios/src/cpp/webgpu/GPUTextureViewImpl.cpp +53 -0
- package/platforms/ios/src/cpp/webgpu/GPUTextureViewImpl.h +45 -0
- package/platforms/ios/src/cpp/webgpu/GPUUtils.h +178 -0
- package/SVG/Circle.d.ts +0 -11
- package/SVG/Circle.js +0 -21
- package/SVG/Circle.js.map +0 -1
- package/SVG/ClipPath.d.ts +0 -4
- package/SVG/ClipPath.js +0 -9
- package/SVG/ClipPath.js.map +0 -1
- package/SVG/Defs.d.ts +0 -4
- package/SVG/Defs.js +0 -9
- package/SVG/Defs.js.map +0 -1
- package/SVG/Ellipse.d.ts +0 -13
- package/SVG/Ellipse.js +0 -26
- package/SVG/Ellipse.js.map +0 -1
- package/SVG/G.d.ts +0 -7
- package/SVG/G.js +0 -9
- package/SVG/G.js.map +0 -1
- package/SVG/Image.d.ts +0 -11
- package/SVG/Image.js +0 -40
- package/SVG/Image.js.map +0 -1
- package/SVG/Line.d.ts +0 -13
- package/SVG/Line.js +0 -26
- package/SVG/Line.js.map +0 -1
- package/SVG/LinearGradient.d.ts +0 -10
- package/SVG/LinearGradient.js +0 -13
- package/SVG/LinearGradient.js.map +0 -1
- package/SVG/Path.d.ts +0 -7
- package/SVG/Path.js +0 -14
- package/SVG/Path.js.map +0 -1
- package/SVG/Pattern.d.ts +0 -4
- package/SVG/Pattern.js +0 -9
- package/SVG/Pattern.js.map +0 -1
- package/SVG/Polygon.d.ts +0 -7
- package/SVG/Polygon.js +0 -14
- package/SVG/Polygon.js.map +0 -1
- package/SVG/Polyline.d.ts +0 -7
- package/SVG/Polyline.js +0 -14
- package/SVG/Polyline.js.map +0 -1
- package/SVG/Rect.d.ts +0 -8
- package/SVG/Rect.js +0 -13
- package/SVG/Rect.js.map +0 -1
- package/SVG/SVG.d.ts +0 -32
- package/SVG/SVG.js +0 -204
- package/SVG/SVG.js.map +0 -1
- package/SVG/SVGItem.d.ts +0 -5
- package/SVG/SVGItem.js +0 -8
- package/SVG/SVGItem.js.map +0 -1
- package/SVG/Stop.d.ts +0 -5
- package/SVG/Stop.js +0 -9
- package/SVG/Stop.js.map +0 -1
- package/SVG/Symbol.d.ts +0 -4
- package/SVG/Symbol.js +0 -9
- package/SVG/Symbol.js.map +0 -1
- package/SVG/Text.d.ts +0 -14
- package/SVG/Text.js +0 -26
- package/SVG/Text.js.map +0 -1
- package/SVG/Use.d.ts +0 -4
- package/SVG/Use.js +0 -9
- package/SVG/Use.js.map +0 -1
- package/SVG/index.d.ts +0 -18
- package/SVG/index.js +0 -19
- package/SVG/index.js.map +0 -1
- package/platforms/ios/src/cpp/PerIsolateData.cpp +0 -49
- package/platforms/ios/src/cpp/PerIsolateData.h +0 -54
- package/platforms/ios/src/cpp/URLImpl.cpp +0 -464
- package/platforms/ios/src/cpp/URLImpl.h +0 -121
|
@@ -7,7 +7,121 @@
|
|
|
7
7
|
#include "JSIRuntime.h"
|
|
8
8
|
#include "JSIReadFileCallback.h"
|
|
9
9
|
#include "Helpers.h"
|
|
10
|
-
|
|
10
|
+
|
|
11
|
+
struct GLOptions {
|
|
12
|
+
int32_t version;
|
|
13
|
+
bool alpha;
|
|
14
|
+
bool antialias;
|
|
15
|
+
bool depth;
|
|
16
|
+
bool failIfMajorPerformanceCaveat;
|
|
17
|
+
int32_t powerPreference;
|
|
18
|
+
bool premultipliedAlpha;
|
|
19
|
+
bool preserveDrawingBuffer;
|
|
20
|
+
bool stencil;
|
|
21
|
+
bool desynchronized;
|
|
22
|
+
bool xrCompatible;
|
|
23
|
+
|
|
24
|
+
public:
|
|
25
|
+
GLOptions() {
|
|
26
|
+
this->version = 0;
|
|
27
|
+
this->alpha = true;
|
|
28
|
+
this->antialias = true;
|
|
29
|
+
this->depth = true;
|
|
30
|
+
this->failIfMajorPerformanceCaveat = false;
|
|
31
|
+
this->powerPreference = 0;
|
|
32
|
+
this->premultipliedAlpha = true;
|
|
33
|
+
this->preserveDrawingBuffer = false;
|
|
34
|
+
this->stencil = false;
|
|
35
|
+
this->desynchronized = false;
|
|
36
|
+
this->xrCompatible = false;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
void parseGLOptions(const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
40
|
+
auto configValue = args[0];
|
|
41
|
+
|
|
42
|
+
if (!(!configValue->IsNullOrUndefined() && configValue->IsObject())) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
auto isolate = args.GetIsolate();
|
|
47
|
+
auto context = isolate->GetCurrentContext();
|
|
48
|
+
auto config = configValue.As<v8::Object>();
|
|
49
|
+
|
|
50
|
+
v8::Local<v8::Value> versionValue;
|
|
51
|
+
|
|
52
|
+
config->Get(context, ConvertToV8String(isolate, "version")).ToLocal(&versionValue);
|
|
53
|
+
|
|
54
|
+
if (!versionValue.IsEmpty() && versionValue->IsInt32()) {
|
|
55
|
+
versionValue->Int32Value(context).To(&this->version);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
v8::Local<v8::Value> alphaValue;
|
|
59
|
+
|
|
60
|
+
config->Get(context, ConvertToV8String(isolate, "alpha")).ToLocal(&alphaValue);
|
|
61
|
+
if (!alphaValue.IsEmpty() && alphaValue->IsBoolean()) {
|
|
62
|
+
this->alpha = alphaValue->BooleanValue(isolate);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
v8::Local<v8::Value> antialiasValue;
|
|
66
|
+
config->Get(context, ConvertToV8String(isolate, "antialias")).ToLocal(
|
|
67
|
+
&antialiasValue);
|
|
68
|
+
if (!antialiasValue.IsEmpty() && antialiasValue->IsBoolean()) {
|
|
69
|
+
this->antialias = antialiasValue->BooleanValue(isolate);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
v8::Local<v8::Value> failIfMajorPerformanceCaveatValue;
|
|
73
|
+
config->Get(context, ConvertToV8String(isolate, "failIfMajorPerformanceCaveat")).ToLocal(
|
|
74
|
+
&failIfMajorPerformanceCaveatValue);
|
|
75
|
+
if (!failIfMajorPerformanceCaveatValue.IsEmpty() &&
|
|
76
|
+
failIfMajorPerformanceCaveatValue->IsBoolean()) {
|
|
77
|
+
this->failIfMajorPerformanceCaveat = failIfMajorPerformanceCaveatValue->BooleanValue(
|
|
78
|
+
isolate);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
v8::Local<v8::Value> powerPreferenceValue;
|
|
82
|
+
config->Get(context, ConvertToV8String(isolate, "powerPreference")).ToLocal(
|
|
83
|
+
&powerPreferenceValue);
|
|
84
|
+
if (!powerPreferenceValue.IsEmpty() && powerPreferenceValue->IsInt32()) {
|
|
85
|
+
powerPreferenceValue->Int32Value(context).To(&this->powerPreference);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
v8::Local<v8::Value> premultipliedAlphaValue;
|
|
89
|
+
config->Get(context,
|
|
90
|
+
ConvertToV8String(isolate, "premultipliedAlpha")).ToLocal(
|
|
91
|
+
&premultipliedAlphaValue);
|
|
92
|
+
if (!premultipliedAlphaValue.IsEmpty() && premultipliedAlphaValue->IsBoolean()) {
|
|
93
|
+
this->premultipliedAlpha = premultipliedAlphaValue->BooleanValue(isolate);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
v8::Local<v8::Value> preserveDrawingBufferValue;
|
|
97
|
+
config->Get(context,
|
|
98
|
+
ConvertToV8String(isolate, "preserveDrawingBuffer")).ToLocal(
|
|
99
|
+
&preserveDrawingBufferValue);
|
|
100
|
+
if (!preserveDrawingBufferValue.IsEmpty() && preserveDrawingBufferValue->IsBoolean()) {
|
|
101
|
+
this->preserveDrawingBuffer = preserveDrawingBufferValue->BooleanValue(isolate);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
v8::Local<v8::Value> stencilValue;
|
|
105
|
+
config->Get(context, ConvertToV8String(isolate, "stencil")).ToLocal(&stencilValue);
|
|
106
|
+
if (!stencilValue.IsEmpty() && stencilValue->IsBoolean()) {
|
|
107
|
+
this->stencil = stencilValue->BooleanValue(isolate);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
v8::Local<v8::Value> desynchronizedValue;
|
|
111
|
+
config->Get(context, ConvertToV8String(isolate, "desynchronized")).ToLocal(
|
|
112
|
+
&desynchronizedValue);
|
|
113
|
+
if (!desynchronizedValue.IsEmpty() && desynchronizedValue->IsBoolean()) {
|
|
114
|
+
this->desynchronized = desynchronizedValue->BooleanValue(isolate);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
v8::Local<v8::Value> xrCompatibleValue;
|
|
118
|
+
config->Get(context, ConvertToV8String(isolate, "xrCompatible")).ToLocal(
|
|
119
|
+
&xrCompatibleValue);
|
|
120
|
+
if (!xrCompatibleValue.IsEmpty() && xrCompatibleValue->IsBoolean()) {
|
|
121
|
+
this->xrCompatible = xrCompatibleValue->BooleanValue(isolate);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
};
|
|
11
125
|
|
|
12
126
|
void CanvasJSIModule::install(v8::Isolate *isolate) {
|
|
13
127
|
|
|
@@ -35,47 +149,53 @@ void CanvasJSIModule::install(v8::Isolate *isolate) {
|
|
|
35
149
|
CanvasPattern::Init(canvasMod, isolate);
|
|
36
150
|
MatrixImpl::Init(canvasMod, isolate);
|
|
37
151
|
TextMetricsImpl::Init(canvasMod, isolate);
|
|
38
|
-
URLImpl::Init(canvasMod, isolate);
|
|
39
152
|
|
|
40
|
-
// always use the last slot
|
|
41
|
-
auto lastSlot = isolate->GetNumberOfDataSlots() - 1;
|
|
42
|
-
auto data = new PerIsolateData(isolate);
|
|
43
|
-
isolate->SetData(lastSlot, data);
|
|
44
153
|
|
|
45
|
-
|
|
154
|
+
GPUImpl::Init(canvasMod, isolate);
|
|
155
|
+
GPUSupportedLimitsImpl::Init(canvasMod, isolate);
|
|
156
|
+
GPUDeviceImpl::Init(canvasMod, isolate);
|
|
157
|
+
GPUQueueImpl::Init(canvasMod, isolate);
|
|
158
|
+
|
|
159
|
+
v8Global->Set(context, ConvertToV8String(isolate, "CanvasModule"), canvasMod).FromJust();
|
|
46
160
|
canvasMod->Set(context, ConvertToV8String(isolate, "create2DContext"),
|
|
47
161
|
v8::FunctionTemplate::New(isolate, &Create2DContext)->GetFunction(
|
|
48
|
-
context).ToLocalChecked());
|
|
162
|
+
context).ToLocalChecked()).FromJust();
|
|
49
163
|
canvasMod->Set(context, ConvertToV8String(isolate, "createImageBitmap"),
|
|
50
164
|
v8::FunctionTemplate::New(isolate, &CreateImageBitmap)->GetFunction(
|
|
51
|
-
context).ToLocalChecked());
|
|
165
|
+
context).ToLocalChecked()).FromJust();
|
|
52
166
|
canvasMod->Set(context, ConvertToV8String(isolate, "create2DContextWithPointer"),
|
|
53
167
|
v8::FunctionTemplate::New(isolate, &Create2DContextWithPointer)->GetFunction(
|
|
54
|
-
context).ToLocalChecked());
|
|
168
|
+
context).ToLocalChecked()).FromJust();
|
|
169
|
+
|
|
170
|
+
canvasMod->Set(context, ConvertToV8String(isolate, "createWebGPUContextWithPointer"),
|
|
171
|
+
v8::FunctionTemplate::New(isolate,
|
|
172
|
+
&CreateWebGPUContextWithPointer)->GetFunction(
|
|
173
|
+
context).ToLocalChecked()).FromJust();
|
|
174
|
+
|
|
175
|
+
|
|
55
176
|
canvasMod->Set(context, ConvertToV8String(isolate, "readFile"),
|
|
56
177
|
v8::FunctionTemplate::New(isolate, &ReadFile)->GetFunction(
|
|
57
|
-
context).ToLocalChecked());
|
|
178
|
+
context).ToLocalChecked()).FromJust();
|
|
58
179
|
|
|
59
180
|
canvasMod->Set(context, ConvertToV8String(isolate, "createWebGLContext"),
|
|
60
181
|
v8::FunctionTemplate::New(isolate, &CreateWebGLContext)->GetFunction(
|
|
61
|
-
context).ToLocalChecked());
|
|
182
|
+
context).ToLocalChecked()).FromJust();
|
|
62
183
|
|
|
63
184
|
canvasMod->Set(context, ConvertToV8String(isolate, "createWebGL2Context"),
|
|
64
185
|
v8::FunctionTemplate::New(isolate, &CreateWebGL2Context)->GetFunction(
|
|
65
|
-
context).ToLocalChecked());
|
|
186
|
+
context).ToLocalChecked()).FromJust();
|
|
66
187
|
|
|
67
188
|
|
|
68
189
|
canvasMod->Set(context, ConvertToV8String(isolate, "__addFontFamily"),
|
|
69
190
|
v8::FunctionTemplate::New(isolate, &AddFontFamily)->GetFunction(
|
|
70
|
-
context).ToLocalChecked());
|
|
191
|
+
context).ToLocalChecked()).FromJust();
|
|
71
192
|
|
|
72
193
|
global->Set(context,
|
|
73
|
-
ConvertToV8String(isolate, "CanvasModule"), canvasMod);
|
|
194
|
+
ConvertToV8String(isolate, "CanvasModule"), canvasMod).FromJust();
|
|
74
195
|
|
|
75
196
|
}
|
|
76
197
|
}
|
|
77
198
|
|
|
78
|
-
|
|
79
199
|
void CanvasJSIModule::AddFontFamily(const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
80
200
|
auto isolate = args.GetIsolate();
|
|
81
201
|
auto context = isolate->GetCurrentContext();
|
|
@@ -807,7 +927,7 @@ void CanvasJSIModule::CreateImageBitmap(const v8::FunctionCallbackInfo<v8::Value
|
|
|
807
927
|
}
|
|
808
928
|
}
|
|
809
929
|
|
|
810
|
-
auto type = GetNativeType(
|
|
930
|
+
auto type = GetNativeType(image);
|
|
811
931
|
|
|
812
932
|
if (len == 1 || len == 2) {
|
|
813
933
|
if (len == 2) {
|
|
@@ -1190,404 +1310,209 @@ void CanvasJSIModule::ReadFile(const v8::FunctionCallbackInfo<v8::Value> &args)
|
|
|
1190
1310
|
}
|
|
1191
1311
|
|
|
1192
1312
|
void CanvasJSIModule::CreateWebGLContext(const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
1193
|
-
auto configValue = args[0];
|
|
1194
|
-
auto isolate = args.GetIsolate();
|
|
1195
|
-
auto context = isolate->GetCurrentContext();
|
|
1196
|
-
if (!configValue->IsNullOrUndefined() && configValue->IsObject()) {
|
|
1197
|
-
auto config = configValue.As<v8::Object>();
|
|
1198
|
-
std::string version("none");
|
|
1199
|
-
auto alpha = true;
|
|
1200
|
-
auto antialias = true;
|
|
1201
|
-
auto depth = true;
|
|
1202
|
-
auto fail_if_major_performance_caveat = false;
|
|
1203
|
-
std::string power_preference("default");
|
|
1204
|
-
auto premultiplied_alpha = true;
|
|
1205
|
-
auto preserve_drawing_buffer = false;
|
|
1206
|
-
auto stencil = false;
|
|
1207
|
-
auto desynchronized = false;
|
|
1208
|
-
auto xr_compatible = false;
|
|
1209
|
-
|
|
1210
|
-
auto last = isolate->GetNumberOfDataSlots() - 1;
|
|
1211
|
-
auto data = isolate->GetData(last);
|
|
1212
|
-
|
|
1213
|
-
if (data != nullptr) {
|
|
1214
|
-
auto consts = static_cast<PerIsolateData *>(data);
|
|
1215
|
-
|
|
1216
|
-
v8::Local<v8::Value> versionValue;
|
|
1217
|
-
|
|
1218
|
-
config->Get(context, consts->VERSION_PERSISTENT->Get(isolate)).ToLocal(&versionValue);
|
|
1219
|
-
|
|
1220
|
-
if (!versionValue.IsEmpty() && versionValue->IsString()) {
|
|
1221
|
-
version = ConvertFromV8String(isolate, versionValue);
|
|
1222
|
-
}
|
|
1223
|
-
|
|
1224
|
-
v8::Local<v8::Value> alphaValue;
|
|
1225
|
-
|
|
1226
|
-
config->Get(context, consts->ALPHA_PERSISTENT->Get(isolate)).ToLocal(&alphaValue);
|
|
1227
|
-
if (!alphaValue.IsEmpty() && alphaValue->IsBoolean()) {
|
|
1228
|
-
alpha = alphaValue->BooleanValue(isolate);
|
|
1229
|
-
}
|
|
1230
|
-
|
|
1231
|
-
v8::Local<v8::Value> antialiasValue;
|
|
1232
|
-
config->Get(context, consts->ANTIALIAS_PERSISTENT->Get(isolate)).ToLocal(
|
|
1233
|
-
&antialiasValue);
|
|
1234
|
-
if (!antialiasValue.IsEmpty() && antialiasValue->IsBoolean()) {
|
|
1235
|
-
antialias = antialiasValue->BooleanValue(isolate);
|
|
1236
|
-
}
|
|
1237
|
-
|
|
1238
|
-
v8::Local<v8::Value> failIfMajorPerformanceCaveatValue;
|
|
1239
|
-
config->Get(context,
|
|
1240
|
-
consts->FAIL_IF_MAJOR_PERFORMANCE_CAVEAT_PERSISTENT->Get(isolate)).ToLocal(
|
|
1241
|
-
&failIfMajorPerformanceCaveatValue);
|
|
1242
|
-
if (!failIfMajorPerformanceCaveatValue.IsEmpty() &&
|
|
1243
|
-
failIfMajorPerformanceCaveatValue->IsBoolean()) {
|
|
1244
|
-
fail_if_major_performance_caveat = failIfMajorPerformanceCaveatValue->BooleanValue(
|
|
1245
|
-
isolate);
|
|
1246
|
-
}
|
|
1247
|
-
|
|
1248
|
-
v8::Local<v8::Value> powerPreferenceValue;
|
|
1249
|
-
config->Get(context, consts->POWER_PREFERENCE_PERSISTENT->Get(isolate)).ToLocal(
|
|
1250
|
-
&powerPreferenceValue);
|
|
1251
|
-
if (!powerPreferenceValue.IsEmpty() && powerPreferenceValue->IsString()) {
|
|
1252
|
-
power_preference = ConvertFromV8String(isolate, powerPreferenceValue);
|
|
1253
|
-
}
|
|
1254
|
-
|
|
1255
|
-
v8::Local<v8::Value> premultipliedAlphaValue;
|
|
1256
|
-
config->Get(context,
|
|
1257
|
-
consts->PREMULTIPLIED_ALPHA_PERSISTENT->Get(isolate)).ToLocal(
|
|
1258
|
-
&premultipliedAlphaValue);
|
|
1259
|
-
if (!premultipliedAlphaValue.IsEmpty() && premultipliedAlphaValue->IsBoolean()) {
|
|
1260
|
-
premultiplied_alpha = premultipliedAlphaValue->BooleanValue(isolate);
|
|
1261
|
-
}
|
|
1262
|
-
|
|
1263
|
-
v8::Local<v8::Value> preserveDrawingBufferValue;
|
|
1264
|
-
config->Get(context,
|
|
1265
|
-
consts->PRESERVE_DRAWING_BUFFER_PERSISTENT->Get(isolate)).ToLocal(
|
|
1266
|
-
&preserveDrawingBufferValue);
|
|
1267
|
-
if (!preserveDrawingBufferValue.IsEmpty() && preserveDrawingBufferValue->IsBoolean()) {
|
|
1268
|
-
preserve_drawing_buffer = preserveDrawingBufferValue->BooleanValue(isolate);
|
|
1269
|
-
}
|
|
1270
|
-
|
|
1271
|
-
v8::Local<v8::Value> stencilValue;
|
|
1272
|
-
config->Get(context, consts->STENCIL_PERSISTENT->Get(isolate)).ToLocal(&stencilValue);
|
|
1273
|
-
if (!stencilValue.IsEmpty() && stencilValue->IsBoolean()) {
|
|
1274
|
-
stencil = stencilValue->BooleanValue(isolate);
|
|
1275
|
-
}
|
|
1276
|
-
|
|
1277
|
-
v8::Local<v8::Value> desynchronizedValue;
|
|
1278
|
-
config->Get(context, consts->DESYNCHRONIZED_PERSISTENT->Get(isolate)).ToLocal(
|
|
1279
|
-
&desynchronizedValue);
|
|
1280
|
-
if (!desynchronizedValue.IsEmpty() && desynchronizedValue->IsBoolean()) {
|
|
1281
|
-
desynchronized = desynchronizedValue->BooleanValue(isolate);
|
|
1282
|
-
}
|
|
1283
|
-
|
|
1284
|
-
v8::Local<v8::Value> xrCompatibleValue;
|
|
1285
|
-
config->Get(context,
|
|
1286
|
-
consts->XR_COMPATIBLE_PERSISTENT->Get(isolate)).ToLocal(&xrCompatibleValue);
|
|
1287
|
-
if (!xrCompatibleValue.IsEmpty() && xrCompatibleValue->IsBoolean()) {
|
|
1288
|
-
xr_compatible = xrCompatibleValue->BooleanValue(isolate);
|
|
1289
|
-
}
|
|
1290
|
-
}
|
|
1291
1313
|
|
|
1314
|
+
auto options = GLOptions();
|
|
1315
|
+
options.parseGLOptions(args);
|
|
1292
1316
|
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
return;
|
|
1297
|
-
} else {
|
|
1298
|
-
auto count = args.Length();
|
|
1299
|
-
if (count == 6) {
|
|
1300
|
-
auto ctx = args[1].As<v8::BigInt>()->Int64Value();
|
|
1301
|
-
// auto density = args[2]->NumberValue(context).ToChecked();
|
|
1302
|
-
// auto fontColor = args[3]->NumberValue(context).ToChecked();
|
|
1303
|
-
// auto ppi = args[4]->NumberValue(context).ToChecked();
|
|
1304
|
-
// auto direction = args[5]->NumberValue(context).ToChecked();
|
|
1305
|
-
auto webgl = canvas_native_webgl_create(
|
|
1306
|
-
ctx,
|
|
1307
|
-
version.c_str(),
|
|
1308
|
-
alpha,
|
|
1309
|
-
antialias,
|
|
1310
|
-
depth,
|
|
1311
|
-
fail_if_major_performance_caveat,
|
|
1312
|
-
power_preference.c_str(),
|
|
1313
|
-
premultiplied_alpha,
|
|
1314
|
-
preserve_drawing_buffer,
|
|
1315
|
-
stencil,
|
|
1316
|
-
desynchronized,
|
|
1317
|
-
xr_compatible
|
|
1318
|
-
);
|
|
1319
|
-
|
|
1320
|
-
auto renderingContext = WebGLRenderingContext::NewInstance(isolate,
|
|
1321
|
-
new WebGLRenderingContext(
|
|
1322
|
-
webgl));
|
|
1323
|
-
|
|
1324
|
-
args.GetReturnValue().Set(renderingContext);
|
|
1325
|
-
return;
|
|
1326
|
-
} else if (count == 7) {
|
|
1327
|
-
auto width = args[1]->NumberValue(context).ToChecked();
|
|
1328
|
-
auto height = args[2]->NumberValue(context).ToChecked();
|
|
1329
|
-
// auto density = args[3]->NumberValue(context).ToChecked();
|
|
1330
|
-
// auto fontColor = args[4]->NumberValue(context).ToChecked();
|
|
1331
|
-
// auto ppi = args[5]->NumberValue(context).ToChecked();
|
|
1332
|
-
// auto direction = args[6]->NumberValue(context).ToChecked();
|
|
1333
|
-
auto ctx = canvas_native_webgl_create_no_window(
|
|
1334
|
-
(int32_t) width,
|
|
1335
|
-
(int32_t) height,
|
|
1336
|
-
version.c_str(),
|
|
1337
|
-
alpha,
|
|
1338
|
-
antialias,
|
|
1339
|
-
depth,
|
|
1340
|
-
fail_if_major_performance_caveat,
|
|
1341
|
-
power_preference.c_str(),
|
|
1342
|
-
premultiplied_alpha,
|
|
1343
|
-
preserve_drawing_buffer,
|
|
1344
|
-
stencil,
|
|
1345
|
-
desynchronized,
|
|
1346
|
-
xr_compatible,
|
|
1347
|
-
false
|
|
1348
|
-
);
|
|
1349
|
-
|
|
1350
|
-
auto renderingContext = WebGLRenderingContext::NewInstance(isolate,
|
|
1351
|
-
new WebGLRenderingContext(
|
|
1352
|
-
ctx));
|
|
1353
|
-
|
|
1354
|
-
args.GetReturnValue().Set(renderingContext);
|
|
1355
|
-
return;
|
|
1356
|
-
|
|
1357
|
-
} else {
|
|
1358
|
-
auto width = (int32_t) args[1]->NumberValue(context).ToChecked();
|
|
1359
|
-
auto height = (int32_t) args[2]->NumberValue(context).ToChecked();
|
|
1360
|
-
|
|
1361
|
-
auto ctx = canvas_native_webgl_create_no_window(
|
|
1362
|
-
width,
|
|
1363
|
-
height,
|
|
1364
|
-
version.c_str(),
|
|
1365
|
-
alpha,
|
|
1366
|
-
antialias,
|
|
1367
|
-
depth,
|
|
1368
|
-
fail_if_major_performance_caveat,
|
|
1369
|
-
power_preference.c_str(),
|
|
1370
|
-
premultiplied_alpha,
|
|
1371
|
-
preserve_drawing_buffer,
|
|
1372
|
-
stencil,
|
|
1373
|
-
desynchronized,
|
|
1374
|
-
xr_compatible,
|
|
1375
|
-
false
|
|
1376
|
-
);
|
|
1377
|
-
|
|
1378
|
-
auto renderingContext = WebGLRenderingContext::NewInstance(isolate,
|
|
1379
|
-
new WebGLRenderingContext(
|
|
1380
|
-
ctx));
|
|
1381
|
-
|
|
1382
|
-
args.GetReturnValue().Set(renderingContext);
|
|
1383
|
-
return;
|
|
1384
|
-
}
|
|
1385
|
-
|
|
1386
|
-
}
|
|
1317
|
+
if (options.version != 1) {
|
|
1318
|
+
args.GetReturnValue().SetNull();
|
|
1319
|
+
return;
|
|
1387
1320
|
}
|
|
1388
|
-
args.GetReturnValue().SetNull();
|
|
1389
|
-
}
|
|
1390
1321
|
|
|
1391
|
-
void CanvasJSIModule::CreateWebGL2Context(const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
1392
|
-
auto configValue = args[0];
|
|
1393
1322
|
auto isolate = args.GetIsolate();
|
|
1394
1323
|
auto context = isolate->GetCurrentContext();
|
|
1395
|
-
if (!configValue->IsNullOrUndefined() && configValue->IsObject()) {
|
|
1396
|
-
auto config = configValue.As<v8::Object>();
|
|
1397
|
-
std::string version("none");
|
|
1398
|
-
auto alpha = true;
|
|
1399
|
-
auto antialias = true;
|
|
1400
|
-
auto depth = true;
|
|
1401
|
-
auto fail_if_major_performance_caveat = false;
|
|
1402
|
-
std::string power_preference("default");
|
|
1403
|
-
auto premultiplied_alpha = true;
|
|
1404
|
-
auto preserve_drawing_buffer = false;
|
|
1405
|
-
auto stencil = false;
|
|
1406
|
-
auto desynchronized = false;
|
|
1407
|
-
auto xr_compatible = false;
|
|
1408
|
-
|
|
1409
1324
|
|
|
1410
|
-
auto last = isolate->GetNumberOfDataSlots() - 1;
|
|
1411
|
-
auto data = isolate->GetData(last);
|
|
1412
1325
|
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1326
|
+
auto count = args.Length();
|
|
1327
|
+
if (count == 6) {
|
|
1328
|
+
auto ctx = args[1].As<v8::BigInt>()->Int64Value();
|
|
1329
|
+
auto webgl = canvas_native_webgl_create(
|
|
1330
|
+
ctx,
|
|
1331
|
+
options.version,
|
|
1332
|
+
options.alpha,
|
|
1333
|
+
options.antialias,
|
|
1334
|
+
options.depth,
|
|
1335
|
+
options.failIfMajorPerformanceCaveat,
|
|
1336
|
+
options.powerPreference,
|
|
1337
|
+
options.premultipliedAlpha,
|
|
1338
|
+
options.preserveDrawingBuffer,
|
|
1339
|
+
options.stencil,
|
|
1340
|
+
options.desynchronized,
|
|
1341
|
+
options.xrCompatible
|
|
1342
|
+
);
|
|
1343
|
+
|
|
1344
|
+
auto renderingContext = WebGLRenderingContext::NewInstance(isolate,
|
|
1345
|
+
new WebGLRenderingContext(
|
|
1346
|
+
webgl));
|
|
1347
|
+
|
|
1348
|
+
args.GetReturnValue().Set(renderingContext);
|
|
1349
|
+
return;
|
|
1350
|
+
} else if (count == 7) {
|
|
1351
|
+
auto width = args[1]->NumberValue(context).ToChecked();
|
|
1352
|
+
auto height = args[2]->NumberValue(context).ToChecked();
|
|
1353
|
+
auto ctx = canvas_native_webgl_create_no_window(
|
|
1354
|
+
(int32_t) width,
|
|
1355
|
+
(int32_t) height,
|
|
1356
|
+
options.version,
|
|
1357
|
+
options.alpha,
|
|
1358
|
+
options.antialias,
|
|
1359
|
+
options.depth,
|
|
1360
|
+
options.failIfMajorPerformanceCaveat,
|
|
1361
|
+
options.powerPreference,
|
|
1362
|
+
options.premultipliedAlpha,
|
|
1363
|
+
options.preserveDrawingBuffer,
|
|
1364
|
+
options.stencil,
|
|
1365
|
+
options.desynchronized,
|
|
1366
|
+
options.xrCompatible,
|
|
1367
|
+
false
|
|
1368
|
+
);
|
|
1369
|
+
|
|
1370
|
+
auto renderingContext = WebGLRenderingContext::NewInstance(isolate,
|
|
1371
|
+
new WebGLRenderingContext(
|
|
1372
|
+
ctx));
|
|
1373
|
+
|
|
1374
|
+
args.GetReturnValue().Set(renderingContext);
|
|
1375
|
+
return;
|
|
1425
1376
|
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1377
|
+
} else {
|
|
1378
|
+
auto width = (int32_t) args[1]->NumberValue(context).ToChecked();
|
|
1379
|
+
auto height = (int32_t) args[2]->NumberValue(context).ToChecked();
|
|
1380
|
+
|
|
1381
|
+
auto ctx = canvas_native_webgl_create_no_window(
|
|
1382
|
+
width,
|
|
1383
|
+
height,
|
|
1384
|
+
options.version,
|
|
1385
|
+
options.alpha,
|
|
1386
|
+
options.antialias,
|
|
1387
|
+
options.depth,
|
|
1388
|
+
options.failIfMajorPerformanceCaveat,
|
|
1389
|
+
options.powerPreference,
|
|
1390
|
+
options.premultipliedAlpha,
|
|
1391
|
+
options.preserveDrawingBuffer,
|
|
1392
|
+
options.stencil,
|
|
1393
|
+
options.desynchronized,
|
|
1394
|
+
options.xrCompatible,
|
|
1395
|
+
false
|
|
1396
|
+
);
|
|
1397
|
+
|
|
1398
|
+
auto renderingContext = WebGLRenderingContext::NewInstance(isolate,
|
|
1399
|
+
new WebGLRenderingContext(
|
|
1400
|
+
ctx));
|
|
1401
|
+
|
|
1402
|
+
args.GetReturnValue().Set(renderingContext);
|
|
1403
|
+
return;
|
|
1404
|
+
}
|
|
1405
|
+
}
|
|
1430
1406
|
|
|
1431
|
-
|
|
1432
|
-
config->Get(context, consts->ANTIALIAS_PERSISTENT->Get(isolate)).ToLocal(
|
|
1433
|
-
&antialiasValue);
|
|
1434
|
-
if (!antialiasValue.IsEmpty() && antialiasValue->IsBoolean()) {
|
|
1435
|
-
antialias = antialiasValue->BooleanValue(isolate);
|
|
1436
|
-
}
|
|
1407
|
+
void CanvasJSIModule::CreateWebGL2Context(const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
1437
1408
|
|
|
1438
|
-
v8::Local<v8::Value> failIfMajorPerformanceCaveatValue;
|
|
1439
|
-
config->Get(context,
|
|
1440
|
-
consts->FAIL_IF_MAJOR_PERFORMANCE_CAVEAT_PERSISTENT->Get(isolate)).ToLocal(
|
|
1441
|
-
&failIfMajorPerformanceCaveatValue);
|
|
1442
|
-
if (!failIfMajorPerformanceCaveatValue.IsEmpty() &&
|
|
1443
|
-
failIfMajorPerformanceCaveatValue->IsBoolean()) {
|
|
1444
|
-
fail_if_major_performance_caveat = failIfMajorPerformanceCaveatValue->BooleanValue(
|
|
1445
|
-
isolate);
|
|
1446
|
-
}
|
|
1447
1409
|
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
&powerPreferenceValue);
|
|
1451
|
-
if (!powerPreferenceValue.IsEmpty() && powerPreferenceValue->IsString()) {
|
|
1452
|
-
power_preference = ConvertFromV8String(isolate, powerPreferenceValue);
|
|
1453
|
-
}
|
|
1410
|
+
auto options = GLOptions();
|
|
1411
|
+
options.parseGLOptions(args);
|
|
1454
1412
|
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
if (!premultipliedAlphaValue.IsEmpty() && premultipliedAlphaValue->IsBoolean()) {
|
|
1460
|
-
premultiplied_alpha = premultipliedAlphaValue->BooleanValue(isolate);
|
|
1461
|
-
}
|
|
1413
|
+
if (options.version != 2) {
|
|
1414
|
+
args.GetReturnValue().SetNull();
|
|
1415
|
+
return;
|
|
1416
|
+
}
|
|
1462
1417
|
|
|
1463
|
-
v8::Local<v8::Value> preserveDrawingBufferValue;
|
|
1464
|
-
config->Get(context,
|
|
1465
|
-
consts->PRESERVE_DRAWING_BUFFER_PERSISTENT->Get(isolate)).ToLocal(
|
|
1466
|
-
&preserveDrawingBufferValue);
|
|
1467
|
-
if (!preserveDrawingBufferValue.IsEmpty() && preserveDrawingBufferValue->IsBoolean()) {
|
|
1468
|
-
preserve_drawing_buffer = preserveDrawingBufferValue->BooleanValue(isolate);
|
|
1469
|
-
}
|
|
1470
1418
|
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
if (!stencilValue.IsEmpty() && stencilValue->IsBoolean()) {
|
|
1474
|
-
stencil = stencilValue->BooleanValue(isolate);
|
|
1475
|
-
}
|
|
1419
|
+
auto isolate = args.GetIsolate();
|
|
1420
|
+
auto context = isolate->GetCurrentContext();
|
|
1476
1421
|
|
|
1477
|
-
v8::Local<v8::Value> desynchronizedValue;
|
|
1478
|
-
config->Get(context, consts->DESYNCHRONIZED_PERSISTENT->Get(isolate)).ToLocal(
|
|
1479
|
-
&desynchronizedValue);
|
|
1480
|
-
if (!desynchronizedValue.IsEmpty() && desynchronizedValue->IsBoolean()) {
|
|
1481
|
-
desynchronized = desynchronizedValue->BooleanValue(isolate);
|
|
1482
|
-
}
|
|
1483
1422
|
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1423
|
+
auto count = args.Length();
|
|
1424
|
+
if (count == 6) {
|
|
1425
|
+
auto ctx = args[1].As<v8::BigInt>()->Int64Value();
|
|
1426
|
+
auto webgl = canvas_native_webgl_create(
|
|
1427
|
+
ctx,
|
|
1428
|
+
options.version,
|
|
1429
|
+
options.alpha,
|
|
1430
|
+
options.antialias,
|
|
1431
|
+
options.depth,
|
|
1432
|
+
options.failIfMajorPerformanceCaveat,
|
|
1433
|
+
options.powerPreference,
|
|
1434
|
+
options.premultipliedAlpha,
|
|
1435
|
+
options.preserveDrawingBuffer,
|
|
1436
|
+
options.stencil,
|
|
1437
|
+
options.desynchronized,
|
|
1438
|
+
options.xrCompatible
|
|
1439
|
+
);
|
|
1440
|
+
|
|
1441
|
+
auto renderingContext = WebGL2RenderingContext::NewInstance(isolate,
|
|
1442
|
+
new WebGL2RenderingContext(
|
|
1443
|
+
webgl,
|
|
1444
|
+
WebGLRenderingVersion::V2));
|
|
1445
|
+
|
|
1446
|
+
args.GetReturnValue().Set(renderingContext);
|
|
1447
|
+
return;
|
|
1491
1448
|
|
|
1449
|
+
} else if (count ==
|
|
1450
|
+
7) {
|
|
1451
|
+
auto width = args[1]->NumberValue(context).ToChecked();
|
|
1452
|
+
auto height = args[2]->NumberValue(context).ToChecked();
|
|
1453
|
+
auto ctx = canvas_native_webgl_create_no_window(
|
|
1454
|
+
(int32_t) width,
|
|
1455
|
+
(int32_t) height,
|
|
1456
|
+
options.version,
|
|
1457
|
+
options.alpha,
|
|
1458
|
+
options.antialias,
|
|
1459
|
+
options.depth,
|
|
1460
|
+
options.failIfMajorPerformanceCaveat,
|
|
1461
|
+
options.powerPreference,
|
|
1462
|
+
options.premultipliedAlpha,
|
|
1463
|
+
options.preserveDrawingBuffer,
|
|
1464
|
+
options.stencil,
|
|
1465
|
+
options.desynchronized,
|
|
1466
|
+
options.xrCompatible,
|
|
1467
|
+
false
|
|
1468
|
+
);
|
|
1469
|
+
auto renderingContext = WebGL2RenderingContext::NewInstance(isolate,
|
|
1470
|
+
new WebGL2RenderingContext(
|
|
1471
|
+
ctx,
|
|
1472
|
+
WebGLRenderingVersion::V2));
|
|
1473
|
+
|
|
1474
|
+
args.GetReturnValue().Set(renderingContext);
|
|
1475
|
+
return;
|
|
1492
1476
|
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
new WebGL2RenderingContext(
|
|
1523
|
-
webgl,
|
|
1524
|
-
WebGLRenderingVersion::V2));
|
|
1525
|
-
|
|
1526
|
-
args.GetReturnValue().Set(renderingContext);
|
|
1527
|
-
return;
|
|
1477
|
+
} else {
|
|
1478
|
+
auto width = (int32_t) args[1]->NumberValue(context).ToChecked();
|
|
1479
|
+
auto height = (int32_t) args[2]->NumberValue(context).ToChecked();
|
|
1480
|
+
auto ctx = canvas_native_webgl_create_no_window(
|
|
1481
|
+
width,
|
|
1482
|
+
height,
|
|
1483
|
+
options.version,
|
|
1484
|
+
options.alpha,
|
|
1485
|
+
options.antialias,
|
|
1486
|
+
options.depth,
|
|
1487
|
+
options.failIfMajorPerformanceCaveat,
|
|
1488
|
+
options.powerPreference,
|
|
1489
|
+
options.premultipliedAlpha,
|
|
1490
|
+
options.preserveDrawingBuffer,
|
|
1491
|
+
options.stencil,
|
|
1492
|
+
options.desynchronized,
|
|
1493
|
+
options.xrCompatible,
|
|
1494
|
+
false
|
|
1495
|
+
);
|
|
1496
|
+
|
|
1497
|
+
auto renderingContext = WebGL2RenderingContext::NewInstance(isolate,
|
|
1498
|
+
new WebGL2RenderingContext(
|
|
1499
|
+
ctx,
|
|
1500
|
+
WebGLRenderingVersion::V2));
|
|
1501
|
+
|
|
1502
|
+
args.GetReturnValue().Set(renderingContext);
|
|
1503
|
+
return;
|
|
1504
|
+
}
|
|
1505
|
+
}
|
|
1528
1506
|
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
// auto fontColor = args[4]->NumberValue(context).ToChecked();
|
|
1535
|
-
// auto ppi = args[5]->NumberValue(context).ToChecked();
|
|
1536
|
-
// auto direction = args[6]->NumberValue(context).ToChecked();
|
|
1537
|
-
auto ctx = canvas_native_webgl_create_no_window(
|
|
1538
|
-
(int32_t) width,
|
|
1539
|
-
(int32_t) height,
|
|
1540
|
-
version.c_str(),
|
|
1541
|
-
alpha,
|
|
1542
|
-
antialias,
|
|
1543
|
-
depth,
|
|
1544
|
-
fail_if_major_performance_caveat,
|
|
1545
|
-
power_preference.c_str(),
|
|
1546
|
-
premultiplied_alpha,
|
|
1547
|
-
preserve_drawing_buffer,
|
|
1548
|
-
stencil,
|
|
1549
|
-
desynchronized,
|
|
1550
|
-
xr_compatible,
|
|
1551
|
-
false
|
|
1552
|
-
);
|
|
1553
|
-
auto renderingContext = WebGL2RenderingContext::NewInstance(isolate,
|
|
1554
|
-
new WebGL2RenderingContext(
|
|
1555
|
-
ctx,
|
|
1556
|
-
WebGLRenderingVersion::V2));
|
|
1557
|
-
|
|
1558
|
-
args.GetReturnValue().Set(renderingContext);
|
|
1559
|
-
return;
|
|
1507
|
+
void
|
|
1508
|
+
CanvasJSIModule::CreateWebGPUContextWithPointer(const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
1509
|
+
auto isolate = args.GetIsolate();
|
|
1510
|
+
auto context = isolate->GetCurrentContext();
|
|
1511
|
+
auto ptr = args[0]->ToBigInt(context).ToLocalChecked()->Int64Value();
|
|
1560
1512
|
|
|
1561
|
-
|
|
1562
|
-
auto width = (int32_t) args[1]->NumberValue(context).ToChecked();
|
|
1563
|
-
auto height = (int32_t) args[2]->NumberValue(context).ToChecked();
|
|
1564
|
-
auto ctx = canvas_native_webgl_create_no_window(
|
|
1565
|
-
width,
|
|
1566
|
-
height,
|
|
1567
|
-
version.c_str(),
|
|
1568
|
-
alpha,
|
|
1569
|
-
antialias,
|
|
1570
|
-
depth,
|
|
1571
|
-
fail_if_major_performance_caveat,
|
|
1572
|
-
power_preference.c_str(),
|
|
1573
|
-
premultiplied_alpha,
|
|
1574
|
-
preserve_drawing_buffer,
|
|
1575
|
-
stencil,
|
|
1576
|
-
desynchronized,
|
|
1577
|
-
xr_compatible,
|
|
1578
|
-
false
|
|
1579
|
-
);
|
|
1580
|
-
|
|
1581
|
-
auto renderingContext = WebGL2RenderingContext::NewInstance(isolate,
|
|
1582
|
-
new WebGL2RenderingContext(
|
|
1583
|
-
ctx,
|
|
1584
|
-
WebGLRenderingVersion::V2));
|
|
1585
|
-
|
|
1586
|
-
args.GetReturnValue().Set(renderingContext);
|
|
1587
|
-
return;
|
|
1588
|
-
}
|
|
1589
|
-
}
|
|
1590
|
-
}
|
|
1513
|
+
auto wgpu = static_cast<CanvasGPUCanvasContext *>((void *) ptr);
|
|
1591
1514
|
|
|
1592
|
-
|
|
1515
|
+
auto ret = GPUCanvasContextImpl::NewInstance(isolate, new GPUCanvasContextImpl(
|
|
1516
|
+
wgpu));
|
|
1517
|
+
args.GetReturnValue().Set(ret);
|
|
1593
1518
|
}
|