@nativescript/canvas 2.0.0-rc.2 → 2.0.0-rc.20
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 +13 -6
- package/Canvas/common.js +257 -206
- package/Canvas/common.js.map +1 -1
- package/Canvas/index.android.d.ts +2 -0
- package/Canvas/index.android.js +23 -4
- package/Canvas/index.android.js.map +1 -1
- package/Canvas/index.d.ts +3 -0
- package/Canvas/index.ios.d.ts +2 -0
- package/Canvas/index.ios.js +16 -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/Fonts/FontFace.android.js +7 -3
- package/Fonts/FontFace.android.js.map +1 -1
- package/Fonts/FontFace.ios.d.ts +1 -0
- package/Fonts/FontFace.ios.js +10 -3
- package/Fonts/FontFace.ios.js.map +1 -1
- package/TextDecoder/index.d.ts +1 -0
- package/TextDecoder/index.js +17 -0
- package/TextDecoder/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/GPUCompilationInfo.d.ts +10 -0
- package/WebGPU/GPUCompilationInfo.js +20 -0
- package/WebGPU/GPUCompilationInfo.js.map +1 -0
- package/WebGPU/GPUCompilationMessage.d.ts +11 -0
- package/WebGPU/GPUCompilationMessage.js +30 -0
- package/WebGPU/GPUCompilationMessage.js.map +1 -0
- 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/GPUShaderModule.d.ts +2 -0
- package/WebGPU/GPUShaderModule.js +10 -0
- package/WebGPU/GPUShaderModule.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/WebGPU/index.d.ts +2 -0
- package/WebGPU/index.js +2 -0
- package/WebGPU/index.js.map +1 -1
- package/angular/fesm2022/nativescript-canvas-angular.mjs +5 -5
- package/angular/package.json +0 -2
- package/helpers.d.ts +3 -0
- package/helpers.js +9 -0
- package/helpers.js.map +1 -1
- package/index.js +6 -1
- package/index.js.map +1 -1
- package/package.json +1 -1
- 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 +10 -5
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Headers/canvas_native.h +294 -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 +11317 -11881
- 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 +294 -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 +11317 -11881
- 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 +11317 -11881
- 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/Caches.h +6 -0
- package/platforms/ios/src/cpp/CanvasJSIModule.cpp +1172 -1011
- package/platforms/ios/src/cpp/CanvasJSIModule.h +6 -0
- package/platforms/ios/src/cpp/Helpers.h +23 -2
- package/platforms/ios/src/cpp/NativeType.h +3 -1
- package/platforms/ios/src/cpp/OnRafCallback.cpp +15 -10
- package/platforms/ios/src/cpp/OnRafCallback.h +1 -0
- package/platforms/ios/src/cpp/PromiseCallback.h +42 -20
- package/platforms/ios/src/cpp/TextDecoderImpl.cpp +142 -0
- package/platforms/ios/src/cpp/TextDecoderImpl.h +2 -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/GPUCompilationInfoImpl.cpp +88 -0
- package/platforms/ios/src/cpp/webgpu/GPUCompilationInfoImpl.h +49 -0
- package/platforms/ios/src/cpp/webgpu/GPUCompilationMessageImpl.cpp +193 -0
- package/platforms/ios/src/cpp/webgpu/GPUCompilationMessageImpl.h +64 -0
- package/platforms/ios/src/cpp/webgpu/GPUDeviceImpl.cpp +69 -34
- package/platforms/ios/src/cpp/webgpu/GPUQueueImpl.cpp +45 -18
- package/platforms/ios/src/cpp/webgpu/GPURenderPassEncoderImpl.cpp +22 -19
- package/platforms/ios/src/cpp/webgpu/GPUShaderModuleImpl.cpp +23 -0
- package/platforms/ios/src/cpp/webgpu/GPUShaderModuleImpl.h +2 -0
- 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
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Created by Osei Fortune on 14/06/2025.
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
#include "GPUCompilationInfoImpl.h"
|
|
6
|
+
#include "Caches.h"
|
|
7
|
+
#include "GPUCompilationMessageImpl.h"
|
|
8
|
+
|
|
9
|
+
GPUCompilationInfoImpl::GPUCompilationInfoImpl(CanvasGPUCompilationInfo *info) : info_(
|
|
10
|
+
info) {}
|
|
11
|
+
|
|
12
|
+
CanvasGPUCompilationInfo *GPUCompilationInfoImpl::GetCompilationInfo() {
|
|
13
|
+
return this->info_;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
void GPUCompilationInfoImpl::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, "GPUCompilationInfo"), func).FromJust();
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
GPUCompilationInfoImpl *GPUCompilationInfoImpl::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<GPUCompilationInfoImpl *>(ptr);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
v8::Local<v8::FunctionTemplate> GPUCompilationInfoImpl::GetCtor(v8::Isolate *isolate) {
|
|
38
|
+
auto cache = Caches::Get(isolate);
|
|
39
|
+
auto ctor = cache->GPUCompilationInfoTmpl.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, "GPUCompilationInfo"));
|
|
47
|
+
|
|
48
|
+
auto tmpl = ctorTmpl->InstanceTemplate();
|
|
49
|
+
tmpl->SetInternalFieldCount(2);
|
|
50
|
+
|
|
51
|
+
tmpl->SetLazyDataProperty(
|
|
52
|
+
ConvertToV8String(isolate, "messages"),
|
|
53
|
+
GetMessages
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
cache->GPUCompilationInfoTmpl =
|
|
58
|
+
std::make_unique<v8::Persistent<v8::FunctionTemplate>>(isolate, ctorTmpl);
|
|
59
|
+
return ctorTmpl;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
void
|
|
64
|
+
GPUCompilationInfoImpl::GetMessages(v8::Local<v8::Name> name,
|
|
65
|
+
const v8::PropertyCallbackInfo<v8::Value> &info) {
|
|
66
|
+
auto isolate = info.GetIsolate();
|
|
67
|
+
auto context = isolate->GetCurrentContext();
|
|
68
|
+
auto ptr = GetPointer(info.This());
|
|
69
|
+
if (ptr != nullptr) {
|
|
70
|
+
auto count = canvas_native_webgpu_compilation_info_get_messages_count(
|
|
71
|
+
ptr->GetCompilationInfo());
|
|
72
|
+
auto array = v8::Array::New(isolate, (int) count);
|
|
73
|
+
for (int i = 0; i < count; i++) {
|
|
74
|
+
auto msg = canvas_native_webgpu_compilation_info_get_message_at(
|
|
75
|
+
ptr->GetCompilationInfo(), i);
|
|
76
|
+
if (msg != nullptr) {
|
|
77
|
+
auto ret = new GPUCompilationMessageImpl(msg);
|
|
78
|
+
array->Set(context, i, GPUCompilationMessageImpl::NewInstance(isolate, ret));
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
info.GetReturnValue().Set(array);
|
|
83
|
+
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
info.GetReturnValue().Set(v8::Array::New(isolate));
|
|
88
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Created by Osei Fortune on 14/06/2025.
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
#ifndef CANVAS_ANDROID_GPUCOMPILATIONINFOIMPL_H
|
|
6
|
+
#define CANVAS_ANDROID_GPUCOMPILATIONINFOIMPL_H
|
|
7
|
+
|
|
8
|
+
#include "Common.h"
|
|
9
|
+
#include "Helpers.h"
|
|
10
|
+
#include "ObjectWrapperImpl.h"
|
|
11
|
+
|
|
12
|
+
class GPUCompilationInfoImpl : ObjectWrapperImpl {
|
|
13
|
+
public:
|
|
14
|
+
explicit GPUCompilationInfoImpl(CanvasGPUCompilationInfo *info);
|
|
15
|
+
|
|
16
|
+
~GPUCompilationInfoImpl() {
|
|
17
|
+
canvas_native_webgpu_compilation_info_release(this->GetCompilationInfo());
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
CanvasGPUCompilationInfo* GetCompilationInfo();
|
|
21
|
+
|
|
22
|
+
static void Init(v8::Local<v8::Object> canvasModule, v8::Isolate *isolate);
|
|
23
|
+
|
|
24
|
+
static GPUCompilationInfoImpl *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, GPUCompilationInfoImpl *info) {
|
|
30
|
+
auto context = isolate->GetCurrentContext();
|
|
31
|
+
v8::EscapableHandleScope scope(isolate);
|
|
32
|
+
auto object = GPUCompilationInfoImpl::GetCtor(isolate)->GetFunction(
|
|
33
|
+
context).ToLocalChecked()->NewInstance(context).ToLocalChecked();
|
|
34
|
+
SetNativeType(info, NativeType::GPUCompilationInfo);
|
|
35
|
+
object->SetAlignedPointerInInternalField(0, info);
|
|
36
|
+
info->BindFinalizer(isolate, object);
|
|
37
|
+
return scope.Escape(object);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
static void GetMessages(v8::Local<v8::Name> name,
|
|
41
|
+
const v8::PropertyCallbackInfo<v8::Value> &info);
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
private:
|
|
45
|
+
CanvasGPUCompilationInfo *info_;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
#endif //CANVAS_ANDROID_GPUCOMPILATIONINFOIMPL_H
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Created by Osei Fortune on 14/06/2025.
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
#include "GPUCompilationMessageImpl.h"
|
|
6
|
+
#include "Caches.h"
|
|
7
|
+
|
|
8
|
+
GPUCompilationMessageImpl::GPUCompilationMessageImpl(CanvasGPUCompilationMessage *message)
|
|
9
|
+
: message_(
|
|
10
|
+
message) {}
|
|
11
|
+
|
|
12
|
+
CanvasGPUCompilationMessage *GPUCompilationMessageImpl::GetMessage() {
|
|
13
|
+
return this->message_;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
void GPUCompilationMessageImpl::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, "GPUCompilationMessage"),
|
|
27
|
+
func).FromJust();
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
GPUCompilationMessageImpl *
|
|
31
|
+
GPUCompilationMessageImpl::GetPointer(const v8::Local<v8::Object> &object) {
|
|
32
|
+
auto ptr = object->GetAlignedPointerFromInternalField(0);
|
|
33
|
+
if (ptr == nullptr) {
|
|
34
|
+
return nullptr;
|
|
35
|
+
}
|
|
36
|
+
return static_cast<GPUCompilationMessageImpl *>(ptr);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
v8::Local<v8::FunctionTemplate> GPUCompilationMessageImpl::GetCtor(v8::Isolate *isolate) {
|
|
40
|
+
auto cache = Caches::Get(isolate);
|
|
41
|
+
auto ctor = cache->GPUCompilationMessageTmpl.get();
|
|
42
|
+
if (ctor != nullptr) {
|
|
43
|
+
return ctor->Get(isolate);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
v8::Local<v8::FunctionTemplate> ctorTmpl = v8::FunctionTemplate::New(isolate);
|
|
47
|
+
ctorTmpl->InstanceTemplate()->SetInternalFieldCount(2);
|
|
48
|
+
ctorTmpl->SetClassName(ConvertToV8String(isolate, "GPUCompilationMessage"));
|
|
49
|
+
|
|
50
|
+
auto tmpl = ctorTmpl->InstanceTemplate();
|
|
51
|
+
tmpl->SetInternalFieldCount(2);
|
|
52
|
+
|
|
53
|
+
tmpl->SetLazyDataProperty(
|
|
54
|
+
ConvertToV8String(isolate, "length"),
|
|
55
|
+
GetLength
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
tmpl->SetLazyDataProperty(
|
|
59
|
+
ConvertToV8String(isolate, "lineNum"),
|
|
60
|
+
GetLineNum
|
|
61
|
+
);
|
|
62
|
+
|
|
63
|
+
tmpl->SetLazyDataProperty(
|
|
64
|
+
ConvertToV8String(isolate, "linePos"),
|
|
65
|
+
GetLinePos
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
tmpl->SetLazyDataProperty(
|
|
69
|
+
ConvertToV8String(isolate, "message"),
|
|
70
|
+
GetMessage
|
|
71
|
+
);
|
|
72
|
+
|
|
73
|
+
tmpl->SetLazyDataProperty(
|
|
74
|
+
ConvertToV8String(isolate, "offset"),
|
|
75
|
+
GetOffset
|
|
76
|
+
);
|
|
77
|
+
|
|
78
|
+
tmpl->SetLazyDataProperty(
|
|
79
|
+
ConvertToV8String(isolate, "type"),
|
|
80
|
+
GetType
|
|
81
|
+
);
|
|
82
|
+
|
|
83
|
+
cache->GPUCompilationMessageTmpl =
|
|
84
|
+
std::make_unique<v8::Persistent<v8::FunctionTemplate>>(isolate, ctorTmpl);
|
|
85
|
+
return ctorTmpl;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
void
|
|
89
|
+
GPUCompilationMessageImpl::GetLength(v8::Local<v8::Name> name,
|
|
90
|
+
const v8::PropertyCallbackInfo<v8::Value> &info) {
|
|
91
|
+
auto ptr = GetPointer(info.This());
|
|
92
|
+
if (ptr != nullptr) {
|
|
93
|
+
auto len = canvas_native_webgpu_compilation_message_get_length(ptr->GetMessage());
|
|
94
|
+
|
|
95
|
+
info.GetReturnValue().Set((double) len);
|
|
96
|
+
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
info.GetReturnValue().Set(0);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
void
|
|
105
|
+
GPUCompilationMessageImpl::GetLineNum(v8::Local<v8::Name> name,
|
|
106
|
+
const v8::PropertyCallbackInfo<v8::Value> &info) {
|
|
107
|
+
auto ptr = GetPointer(info.This());
|
|
108
|
+
if (ptr != nullptr) {
|
|
109
|
+
auto num = canvas_native_webgpu_compilation_message_get_line_num(ptr->GetMessage());
|
|
110
|
+
|
|
111
|
+
info.GetReturnValue().Set((double) num);
|
|
112
|
+
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
info.GetReturnValue().Set(0);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
void
|
|
121
|
+
GPUCompilationMessageImpl::GetLinePos(v8::Local<v8::Name> name,
|
|
122
|
+
const v8::PropertyCallbackInfo<v8::Value> &info) {
|
|
123
|
+
auto ptr = GetPointer(info.This());
|
|
124
|
+
if (ptr != nullptr) {
|
|
125
|
+
auto pos = canvas_native_webgpu_compilation_message_get_line_pos(ptr->GetMessage());
|
|
126
|
+
|
|
127
|
+
info.GetReturnValue().Set((double) pos);
|
|
128
|
+
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
info.GetReturnValue().Set(0);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
void
|
|
136
|
+
GPUCompilationMessageImpl::GetMessage(v8::Local<v8::Name> name,
|
|
137
|
+
const v8::PropertyCallbackInfo<v8::Value> &info) {
|
|
138
|
+
auto ptr = GetPointer(info.This());
|
|
139
|
+
if (ptr != nullptr) {
|
|
140
|
+
auto isolate = info.GetIsolate();
|
|
141
|
+
auto len = canvas_native_webgpu_compilation_message_get_message(ptr->GetMessage());
|
|
142
|
+
|
|
143
|
+
info.GetReturnValue().Set(ConvertToV8String(isolate, len));
|
|
144
|
+
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
info.GetReturnValue().SetEmptyString();
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
void
|
|
153
|
+
GPUCompilationMessageImpl::GetOffset(v8::Local<v8::Name> name,
|
|
154
|
+
const v8::PropertyCallbackInfo<v8::Value> &info) {
|
|
155
|
+
auto ptr = GetPointer(info.This());
|
|
156
|
+
if (ptr != nullptr) {
|
|
157
|
+
auto offset = canvas_native_webgpu_compilation_message_get_offset(ptr->GetMessage());
|
|
158
|
+
|
|
159
|
+
info.GetReturnValue().Set((double) offset);
|
|
160
|
+
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
info.GetReturnValue().Set(0);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
void
|
|
169
|
+
GPUCompilationMessageImpl::GetType(v8::Local<v8::Name> name,
|
|
170
|
+
const v8::PropertyCallbackInfo<v8::Value> &info) {
|
|
171
|
+
auto ptr = GetPointer(info.This());
|
|
172
|
+
auto isolate = info.GetIsolate();
|
|
173
|
+
if (ptr != nullptr) {
|
|
174
|
+
auto message_type = canvas_native_webgpu_compilation_message_get_type(ptr->GetMessage());
|
|
175
|
+
|
|
176
|
+
switch (message_type) {
|
|
177
|
+
case CanvasGPUCompilationMessageType::CanvasGPUCompilationMessageTypeInfo:
|
|
178
|
+
info.GetReturnValue().Set(ConvertToV8String(isolate, "info"));
|
|
179
|
+
break;
|
|
180
|
+
case CanvasGPUCompilationMessageType::CanvasGPUCompilationMessageTypeWarning:
|
|
181
|
+
info.GetReturnValue().Set(ConvertToV8String(isolate, "warning"));
|
|
182
|
+
break;
|
|
183
|
+
case CanvasGPUCompilationMessageType::CanvasGPUCompilationMessageTypeError:
|
|
184
|
+
info.GetReturnValue().Set(ConvertToV8String(isolate, "error"));
|
|
185
|
+
break;
|
|
186
|
+
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
info.GetReturnValue().Set(ConvertToV8String(isolate, "error"));
|
|
193
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Created by Osei Fortune on 14/06/2025.
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
#ifndef CANVAS_ANDROID_GPUCOMPILATIONMESSAGEIMPL_H
|
|
6
|
+
#define CANVAS_ANDROID_GPUCOMPILATIONMESSAGEIMPL_H
|
|
7
|
+
|
|
8
|
+
#include "Common.h"
|
|
9
|
+
#include "Helpers.h"
|
|
10
|
+
#include "ObjectWrapperImpl.h"
|
|
11
|
+
|
|
12
|
+
class GPUCompilationMessageImpl : ObjectWrapperImpl {
|
|
13
|
+
public:
|
|
14
|
+
explicit GPUCompilationMessageImpl(CanvasGPUCompilationMessage *message);
|
|
15
|
+
|
|
16
|
+
~GPUCompilationMessageImpl() {
|
|
17
|
+
canvas_native_webgpu_compilation_message_release(this->GetMessage());
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
CanvasGPUCompilationMessage *GetMessage();
|
|
21
|
+
|
|
22
|
+
static void Init(v8::Local<v8::Object> canvasModule, v8::Isolate *isolate);
|
|
23
|
+
|
|
24
|
+
static GPUCompilationMessageImpl *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, GPUCompilationMessageImpl *message) {
|
|
30
|
+
auto context = isolate->GetCurrentContext();
|
|
31
|
+
v8::EscapableHandleScope scope(isolate);
|
|
32
|
+
auto object = GPUCompilationMessageImpl::GetCtor(isolate)->GetFunction(
|
|
33
|
+
context).ToLocalChecked()->NewInstance(context).ToLocalChecked();
|
|
34
|
+
SetNativeType(message, NativeType::GPUCompilationMessage);
|
|
35
|
+
object->SetAlignedPointerInInternalField(0, message);
|
|
36
|
+
message->BindFinalizer(isolate, object);
|
|
37
|
+
return scope.Escape(object);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
static void GetLength(v8::Local<v8::Name> name,
|
|
41
|
+
const v8::PropertyCallbackInfo<v8::Value> &info);
|
|
42
|
+
|
|
43
|
+
static void GetLineNum(v8::Local<v8::Name> name,
|
|
44
|
+
const v8::PropertyCallbackInfo<v8::Value> &info);
|
|
45
|
+
|
|
46
|
+
static void GetLinePos(v8::Local<v8::Name> name,
|
|
47
|
+
const v8::PropertyCallbackInfo<v8::Value> &info);
|
|
48
|
+
|
|
49
|
+
static void GetMessage(v8::Local<v8::Name> name,
|
|
50
|
+
const v8::PropertyCallbackInfo<v8::Value> &info);
|
|
51
|
+
|
|
52
|
+
static void GetOffset(v8::Local<v8::Name> name,
|
|
53
|
+
const v8::PropertyCallbackInfo<v8::Value> &info);
|
|
54
|
+
|
|
55
|
+
static void GetType(v8::Local<v8::Name> name,
|
|
56
|
+
const v8::PropertyCallbackInfo<v8::Value> &info);
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
private:
|
|
60
|
+
CanvasGPUCompilationMessage *message_;
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
#endif //CANVAS_ANDROID_GPUCOMPILATIONMESSAGEIMPL_H
|
|
@@ -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
|
|