@nativescript/canvas 2.0.0-beta.9 → 2.0.0-webgpu.1
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 +24 -17
- package/Canvas/common.js +133 -66
- package/Canvas/common.js.map +1 -1
- package/Canvas/index.android.d.ts +5 -7
- package/Canvas/index.android.js +62 -133
- package/Canvas/index.android.js.map +1 -1
- package/Canvas/index.d.ts +4 -1
- package/Canvas/index.ios.d.ts +4 -5
- package/Canvas/index.ios.js +73 -82
- 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 +86 -32
- 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 +35 -0
- package/WebGPU/GPUCanvasContext.js +76 -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 +110 -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 +356 -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 +17 -0
- package/WebGPU/GPUTexture.js +44 -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/common.d.ts +0 -3
- package/common.js +1 -5
- package/common.js.map +1 -1
- 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/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 +23 -23
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Headers/canvas_ios.h +41 -8
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Headers/canvas_native.h +2318 -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 +1563 -3729
- 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 -663
- 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 +41 -8
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Headers/canvas_native.h +2318 -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 +1563 -3729
- 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 +1563 -3729
- 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 -662
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/dSYMs/CanvasNative.framework.dSYM/Contents/Resources/Relocations/x86_64/CanvasNative.yml +638 -641
- 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 +1222 -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 +2750 -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 +623 -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 +245 -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
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Created by Osei Fortune on 29/06/2024.
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
#include "GPURenderPipelineImpl.h"
|
|
6
|
+
#include "Caches.h"
|
|
7
|
+
#include "GPUBindGroupLayoutImpl.h"
|
|
8
|
+
|
|
9
|
+
GPURenderPipelineImpl::GPURenderPipelineImpl(const CanvasGPURenderPipeline *pipeline) : pipeline_(
|
|
10
|
+
pipeline) {}
|
|
11
|
+
|
|
12
|
+
const CanvasGPURenderPipeline *GPURenderPipelineImpl::GetGPUPipeline() {
|
|
13
|
+
return this->pipeline_;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
void GPURenderPipelineImpl::Init(v8::Local<v8::Object> canvasModule, v8::Isolate *isolate) {
|
|
18
|
+
v8::Locker locker(isolate);
|
|
19
|
+
v8::Isolate::Scope isolate_scope(isolate);
|
|
20
|
+
v8::HandleScope handle_scope(isolate);
|
|
21
|
+
|
|
22
|
+
auto ctor = GetCtor(isolate);
|
|
23
|
+
auto context = isolate->GetCurrentContext();
|
|
24
|
+
auto func = ctor->GetFunction(context).ToLocalChecked();
|
|
25
|
+
|
|
26
|
+
canvasModule->Set(context, ConvertToV8String(isolate, "GPURenderPipeline"), func).FromJust();;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
GPURenderPipelineImpl *GPURenderPipelineImpl::GetPointer(const v8::Local<v8::Object> &object) {
|
|
30
|
+
auto ptr = object->GetAlignedPointerFromInternalField(0);
|
|
31
|
+
if (ptr == nullptr) {
|
|
32
|
+
return nullptr;
|
|
33
|
+
}
|
|
34
|
+
return static_cast<GPURenderPipelineImpl *>(ptr);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
v8::Local<v8::FunctionTemplate> GPURenderPipelineImpl::GetCtor(v8::Isolate *isolate) {
|
|
38
|
+
auto cache = Caches::Get(isolate);
|
|
39
|
+
auto ctor = cache->GPURenderPipelineTmpl.get();
|
|
40
|
+
if (ctor != nullptr) {
|
|
41
|
+
return ctor->Get(isolate);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
v8::Local<v8::FunctionTemplate> ctorTmpl = v8::FunctionTemplate::New(isolate);
|
|
45
|
+
ctorTmpl->InstanceTemplate()->SetInternalFieldCount(2);
|
|
46
|
+
ctorTmpl->SetClassName(ConvertToV8String(isolate, "GPURenderPipeline"));
|
|
47
|
+
|
|
48
|
+
auto tmpl = ctorTmpl->InstanceTemplate();
|
|
49
|
+
tmpl->SetInternalFieldCount(2);
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
tmpl->Set(
|
|
53
|
+
ConvertToV8String(isolate, "getBindGroupLayout"),
|
|
54
|
+
v8::FunctionTemplate::New(isolate, &GetBindGroupLayout));
|
|
55
|
+
|
|
56
|
+
cache->GPURenderPipelineTmpl =
|
|
57
|
+
std::make_unique<v8::Persistent<v8::FunctionTemplate>>(isolate, ctorTmpl);
|
|
58
|
+
return ctorTmpl;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
void GPURenderPipelineImpl::GetBindGroupLayout(const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
62
|
+
auto *ptr = GetPointer(args.This());
|
|
63
|
+
if (ptr == nullptr) {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
auto isolate = args.GetIsolate();
|
|
68
|
+
auto context = isolate->GetCurrentContext();
|
|
69
|
+
auto index = args[0]->Uint32Value(context).ToChecked();
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
auto group_layout = canvas_native_webgpu_render_pipeline_get_bind_group_layout(
|
|
73
|
+
ptr->GetGPUPipeline(), index);
|
|
74
|
+
|
|
75
|
+
if (group_layout != nullptr) {
|
|
76
|
+
auto ret = GPUBindGroupLayoutImpl::NewInstance(isolate,
|
|
77
|
+
new GPUBindGroupLayoutImpl(group_layout));
|
|
78
|
+
args.GetReturnValue().Set(ret);
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
args.GetReturnValue().SetUndefined();
|
|
83
|
+
}
|
|
84
|
+
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Created by Osei Fortune on 29/06/2024.
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
#ifndef CANVAS_ANDROID_GPURENDERPIPELINEIMPL_H
|
|
6
|
+
#define CANVAS_ANDROID_GPURENDERPIPELINEIMPL_H
|
|
7
|
+
|
|
8
|
+
#include "Common.h"
|
|
9
|
+
#include "Helpers.h"
|
|
10
|
+
#include "ObjectWrapperImpl.h"
|
|
11
|
+
|
|
12
|
+
class GPURenderPipelineImpl : ObjectWrapperImpl {
|
|
13
|
+
public:
|
|
14
|
+
explicit GPURenderPipelineImpl(const CanvasGPURenderPipeline *pipeline);
|
|
15
|
+
|
|
16
|
+
~GPURenderPipelineImpl() {
|
|
17
|
+
canvas_native_webgpu_render_pipeline_release(this->pipeline_);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const CanvasGPURenderPipeline *GetGPUPipeline();
|
|
21
|
+
|
|
22
|
+
static void Init(v8::Local <v8::Object> canvasModule, v8::Isolate *isolate);
|
|
23
|
+
|
|
24
|
+
static GPURenderPipelineImpl *GetPointer(const v8::Local <v8::Object> &object);
|
|
25
|
+
|
|
26
|
+
static v8::Local <v8::FunctionTemplate> GetCtor(v8::Isolate *isolate);
|
|
27
|
+
|
|
28
|
+
static v8::Local <v8::Object>
|
|
29
|
+
NewInstance(v8::Isolate *isolate, GPURenderPipelineImpl *pipeline) {
|
|
30
|
+
auto context = isolate->GetCurrentContext();
|
|
31
|
+
v8::EscapableHandleScope scope(isolate);
|
|
32
|
+
auto object = GPURenderPipelineImpl::GetCtor(isolate)->GetFunction(
|
|
33
|
+
context).ToLocalChecked()->NewInstance(context).ToLocalChecked();
|
|
34
|
+
SetNativeType(object, NativeType::GPURenderPipeline);
|
|
35
|
+
object->SetAlignedPointerInInternalField(0, pipeline);
|
|
36
|
+
pipeline->BindFinalizer(isolate, object);
|
|
37
|
+
return scope.Escape(object);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
static void GetBindGroupLayout(const v8::FunctionCallbackInfo <v8::Value> &args);
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
private:
|
|
45
|
+
const CanvasGPURenderPipeline *pipeline_;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
#endif //CANVAS_ANDROID_GPURENDERPIPELINEIMPL_H
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Created by Osei Fortune on 17/07/2024.
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
#include "GPUSamplerImpl.h"
|
|
6
|
+
#include "Caches.h"
|
|
7
|
+
|
|
8
|
+
GPUSamplerImpl::GPUSamplerImpl(const CanvasGPUSampler *sampler) : sampler_(
|
|
9
|
+
sampler) {}
|
|
10
|
+
|
|
11
|
+
const CanvasGPUSampler *GPUSamplerImpl::GetSampler() {
|
|
12
|
+
return this->sampler_;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
void GPUSamplerImpl::Init(v8::Local<v8::Object> canvasModule, v8::Isolate *isolate) {
|
|
17
|
+
v8::Locker locker(isolate);
|
|
18
|
+
v8::Isolate::Scope isolate_scope(isolate);
|
|
19
|
+
v8::HandleScope handle_scope(isolate);
|
|
20
|
+
|
|
21
|
+
auto ctor = GetCtor(isolate);
|
|
22
|
+
auto context = isolate->GetCurrentContext();
|
|
23
|
+
auto func = ctor->GetFunction(context).ToLocalChecked();
|
|
24
|
+
|
|
25
|
+
canvasModule->Set(context, ConvertToV8String(isolate, "GPUSampler"), func).FromJust();;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
GPUSamplerImpl *GPUSamplerImpl::GetPointer(const v8::Local<v8::Object> &object) {
|
|
29
|
+
auto ptr = object->GetAlignedPointerFromInternalField(0);
|
|
30
|
+
if (ptr == nullptr) {
|
|
31
|
+
return nullptr;
|
|
32
|
+
}
|
|
33
|
+
return static_cast<GPUSamplerImpl *>(ptr);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
v8::Local<v8::FunctionTemplate> GPUSamplerImpl::GetCtor(v8::Isolate *isolate) {
|
|
37
|
+
auto cache = Caches::Get(isolate);
|
|
38
|
+
auto ctor = cache->GPUSamplerTmpl.get();
|
|
39
|
+
if (ctor != nullptr) {
|
|
40
|
+
return ctor->Get(isolate);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
v8::Local<v8::FunctionTemplate> ctorTmpl = v8::FunctionTemplate::New(isolate);
|
|
44
|
+
ctorTmpl->InstanceTemplate()->SetInternalFieldCount(2);
|
|
45
|
+
ctorTmpl->SetClassName(ConvertToV8String(isolate, "GPUSampler"));
|
|
46
|
+
|
|
47
|
+
auto tmpl = ctorTmpl->InstanceTemplate();
|
|
48
|
+
tmpl->SetInternalFieldCount(2);
|
|
49
|
+
|
|
50
|
+
cache->GPUSamplerTmpl =
|
|
51
|
+
std::make_unique<v8::Persistent<v8::FunctionTemplate>>(isolate, ctorTmpl);
|
|
52
|
+
return ctorTmpl;
|
|
53
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Created by Osei Fortune on 17/07/2024.
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
#ifndef CANVAS_ANDROID_GPUSAMPLERIMPL_H
|
|
6
|
+
#define CANVAS_ANDROID_GPUSAMPLERIMPL_H
|
|
7
|
+
|
|
8
|
+
#include "Common.h"
|
|
9
|
+
#include "Helpers.h"
|
|
10
|
+
#include "ObjectWrapperImpl.h"
|
|
11
|
+
|
|
12
|
+
class GPUSamplerImpl: ObjectWrapperImpl {
|
|
13
|
+
public:
|
|
14
|
+
explicit GPUSamplerImpl(const CanvasGPUSampler *sampler);
|
|
15
|
+
|
|
16
|
+
~GPUSamplerImpl() {
|
|
17
|
+
canvas_native_webgpu_sampler_release(this->sampler_);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const CanvasGPUSampler *GetSampler();
|
|
21
|
+
|
|
22
|
+
static void Init(v8::Local<v8::Object> canvasModule, v8::Isolate *isolate);
|
|
23
|
+
|
|
24
|
+
static GPUSamplerImpl *GetPointer(const v8::Local<v8::Object> &object);
|
|
25
|
+
|
|
26
|
+
static v8::Local<v8::FunctionTemplate> GetCtor(v8::Isolate *isolate);
|
|
27
|
+
|
|
28
|
+
static v8::Local<v8::Object> NewInstance(v8::Isolate *isolate, GPUSamplerImpl *sampler) {
|
|
29
|
+
auto context = isolate->GetCurrentContext();
|
|
30
|
+
v8::EscapableHandleScope scope(isolate);
|
|
31
|
+
auto object = GPUSamplerImpl::GetCtor(isolate)->GetFunction(
|
|
32
|
+
context).ToLocalChecked()->NewInstance(context).ToLocalChecked();
|
|
33
|
+
SetNativeType(object, NativeType::GPUSampler);
|
|
34
|
+
object->SetAlignedPointerInInternalField(0, sampler);
|
|
35
|
+
sampler->BindFinalizer(isolate, object);
|
|
36
|
+
return scope.Escape(object);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
private:
|
|
41
|
+
const CanvasGPUSampler *sampler_;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
#endif //CANVAS_ANDROID_GPUSAMPLERIMPL_H
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Created by Osei Fortune on 23/06/2024.
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
#include "GPUShaderModuleImpl.h"
|
|
6
|
+
#include "Caches.h"
|
|
7
|
+
|
|
8
|
+
GPUShaderModuleImpl::GPUShaderModuleImpl(const CanvasGPUShaderModule *shaderModule) : shaderModule_(
|
|
9
|
+
shaderModule) {}
|
|
10
|
+
|
|
11
|
+
const CanvasGPUShaderModule *GPUShaderModuleImpl::GetShaderModule() {
|
|
12
|
+
return this->shaderModule_;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
void GPUShaderModuleImpl::Init(v8::Local<v8::Object> canvasModule, v8::Isolate *isolate) {
|
|
17
|
+
v8::Locker locker(isolate);
|
|
18
|
+
v8::Isolate::Scope isolate_scope(isolate);
|
|
19
|
+
v8::HandleScope handle_scope(isolate);
|
|
20
|
+
|
|
21
|
+
auto ctor = GetCtor(isolate);
|
|
22
|
+
auto context = isolate->GetCurrentContext();
|
|
23
|
+
auto func = ctor->GetFunction(context).ToLocalChecked();
|
|
24
|
+
|
|
25
|
+
canvasModule->Set(context, ConvertToV8String(isolate, "GPUShaderModule"), func).FromJust();;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
GPUShaderModuleImpl *GPUShaderModuleImpl::GetPointer(const v8::Local<v8::Object> &object) {
|
|
29
|
+
auto ptr = object->GetAlignedPointerFromInternalField(0);
|
|
30
|
+
if (ptr == nullptr) {
|
|
31
|
+
return nullptr;
|
|
32
|
+
}
|
|
33
|
+
return static_cast<GPUShaderModuleImpl *>(ptr);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
v8::Local<v8::FunctionTemplate> GPUShaderModuleImpl::GetCtor(v8::Isolate *isolate) {
|
|
37
|
+
auto cache = Caches::Get(isolate);
|
|
38
|
+
auto ctor = cache->GPUShaderModuleTmpl.get();
|
|
39
|
+
if (ctor != nullptr) {
|
|
40
|
+
return ctor->Get(isolate);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
v8::Local<v8::FunctionTemplate> ctorTmpl = v8::FunctionTemplate::New(isolate);
|
|
44
|
+
ctorTmpl->InstanceTemplate()->SetInternalFieldCount(2);
|
|
45
|
+
ctorTmpl->SetClassName(ConvertToV8String(isolate, "GPUShaderModule"));
|
|
46
|
+
|
|
47
|
+
auto tmpl = ctorTmpl->InstanceTemplate();
|
|
48
|
+
tmpl->SetInternalFieldCount(2);
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
cache->GPUShaderModuleTmpl =
|
|
52
|
+
std::make_unique<v8::Persistent<v8::FunctionTemplate>>(isolate, ctorTmpl);
|
|
53
|
+
return ctorTmpl;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Created by Osei Fortune on 23/06/2024.
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
#ifndef CANVAS_ANDROID_GPUSHADERMODULEIMPL_H
|
|
6
|
+
#define CANVAS_ANDROID_GPUSHADERMODULEIMPL_H
|
|
7
|
+
|
|
8
|
+
#include "Common.h"
|
|
9
|
+
#include "Helpers.h"
|
|
10
|
+
#include "ObjectWrapperImpl.h"
|
|
11
|
+
|
|
12
|
+
class GPUShaderModuleImpl : ObjectWrapperImpl {
|
|
13
|
+
public:
|
|
14
|
+
GPUShaderModuleImpl(const CanvasGPUShaderModule *shaderModule);
|
|
15
|
+
|
|
16
|
+
~GPUShaderModuleImpl() {
|
|
17
|
+
canvas_native_webgpu_shader_module_release(this->GetShaderModule());
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const CanvasGPUShaderModule *GetShaderModule();
|
|
21
|
+
|
|
22
|
+
static void Init(v8::Local<v8::Object> canvasModule, v8::Isolate *isolate);
|
|
23
|
+
|
|
24
|
+
static GPUShaderModuleImpl *GetPointer(const v8::Local<v8::Object> &object);
|
|
25
|
+
|
|
26
|
+
static v8::Local<v8::FunctionTemplate> GetCtor(v8::Isolate *isolate);
|
|
27
|
+
|
|
28
|
+
static v8::Local<v8::Object>
|
|
29
|
+
NewInstance(v8::Isolate *isolate, GPUShaderModuleImpl *shaderModule) {
|
|
30
|
+
auto context = isolate->GetCurrentContext();
|
|
31
|
+
v8::EscapableHandleScope scope(isolate);
|
|
32
|
+
auto object = GPUShaderModuleImpl::GetCtor(isolate)->GetFunction(
|
|
33
|
+
context).ToLocalChecked()->NewInstance(context).ToLocalChecked();
|
|
34
|
+
SetNativeType(object, NativeType::GPUShaderModule);
|
|
35
|
+
object->SetAlignedPointerInInternalField(0, shaderModule);
|
|
36
|
+
shaderModule->BindFinalizer(isolate, object);
|
|
37
|
+
return scope.Escape(object);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
private:
|
|
41
|
+
const CanvasGPUShaderModule *shaderModule_;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
#endif //CANVAS_ANDROID_GPUSHADERMODULEIMPL_H
|