dcp-client 4.3.4 → 4.3.5
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/bin/publish-docs.sh +2 -2
- package/dist/dcp-client-bundle.js +1 -1
- package/generated/sandbox-definitions.json +1 -1
- package/libexec/sandbox/calculate-capabilities.js +3 -18
- package/libexec/sandbox/script-load-wrapper.js +1 -1
- package/package.json +1 -1
- package/libexec/sandbox/webgpu-worker-environment.js +0 -122
|
@@ -1 +1 @@
|
|
|
1
|
-
{"browser":["deny-node","kvin/kvin.js","script-load-wrapper","wrap-event-listeners","timer-classes","event-loop-virtualization","unique-timing","access-lists","bravojs-init","bravojs/bravo.js","bravojs-env","calculate-capabilities","bootstrap"],"node":["kvin/kvin.js","sa-ww-simulation","script-load-wrapper","wrap-event-listeners","timer-classes","event-loop-virtualization","unique-timing","access-lists","bravojs-init","bravojs/bravo.js","bravojs-env","calculate-capabilities","bootstrap"],"native":["deny-node","kvin/kvin.js","sa-ww-simulation","script-load-wrapper","native-event-loop","wrap-event-listeners","timer-classes","event-loop-virtualization","unique-timing","access-lists","bravojs-init","bravojs/bravo.js","bravojs-env","calculate-capabilities","bootstrap"],"
|
|
1
|
+
{"browser":["deny-node","kvin/kvin.js","script-load-wrapper","wrap-event-listeners","timer-classes","event-loop-virtualization","unique-timing","access-lists","bravojs-init","bravojs/bravo.js","bravojs-env","calculate-capabilities","bootstrap"],"node":["kvin/kvin.js","sa-ww-simulation","script-load-wrapper","wrap-event-listeners","timer-classes","event-loop-virtualization","unique-timing","access-lists","bravojs-init","bravojs/bravo.js","bravojs-env","calculate-capabilities","bootstrap"],"native":["deny-node","kvin/kvin.js","sa-ww-simulation","script-load-wrapper","native-event-loop","wrap-event-listeners","timer-classes","event-loop-virtualization","unique-timing","access-lists","bravojs-init","bravojs/bravo.js","bravojs-env","calculate-capabilities","bootstrap"],"nodeTesting":["kvin/kvin.js","sa-ww-simulation","script-load-wrapper","wrap-event-listeners","timer-classes","event-loop-virtualization","unique-timing","access-lists","bravojs-init","bravojs/bravo.js","bravojs-env","calculate-capabilities","bootstrap","testing.js"],"testing":["deny-node","kvin/kvin.js","sa-ww-simulation","script-load-wrapper","native-event-loop","wrap-event-listeners","timer-classes","event-loop-virtualization","unique-timing","access-lists","bravojs-init","bravojs/bravo.js","bravojs-env","calculate-capabilities","bootstrap","testing.js"]}
|
|
@@ -49,28 +49,13 @@ self.wrapScriptLoading({ scriptName: 'calculate-capabilities' }, function calcul
|
|
|
49
49
|
});`
|
|
50
50
|
|
|
51
51
|
webgpu =
|
|
52
|
-
typeof GPU !== 'undefined' ||
|
|
53
52
|
(typeof navigator !== 'undefined' &&
|
|
54
53
|
typeof navigator.gpu !== 'undefined');
|
|
55
54
|
|
|
56
55
|
if (webgpu) {
|
|
57
56
|
try {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
if (typeof WebGPUWindow !== 'undefined') {
|
|
61
|
-
const gpuWindow = new WebGPUWindow({
|
|
62
|
-
width: 640,
|
|
63
|
-
height: 480,
|
|
64
|
-
title: 'DCP-evaluator',
|
|
65
|
-
visible: false,
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
const adapter = await GPU.requestAdapter({ window: gpuWindow });
|
|
69
|
-
await adapter.requestDevice(adapter.extensions);
|
|
70
|
-
} else {
|
|
71
|
-
const adapter = await navigator.gpu.requestAdapter();
|
|
72
|
-
await adapter.requestDevice();
|
|
73
|
-
}
|
|
57
|
+
const adapter = await navigator.gpu.requestAdapter();
|
|
58
|
+
await adapter.requestDevice();
|
|
74
59
|
} catch (err) {
|
|
75
60
|
// if glfw fails or the symbols exist but webgpu hasn't been
|
|
76
61
|
// properly enabled (mozilla)
|
|
@@ -119,7 +104,7 @@ self.wrapScriptLoading({ scriptName: 'calculate-capabilities' }, function calcul
|
|
|
119
104
|
}
|
|
120
105
|
|
|
121
106
|
if(eval(testCode)(1) !== 1)
|
|
122
|
-
useStrict = false;
|
|
107
|
+
useStrict = false;
|
|
123
108
|
|
|
124
109
|
return {
|
|
125
110
|
engine: {
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
delete self.wrapScriptLoading;
|
|
88
88
|
|
|
89
89
|
// The private '__sandboxLoaded' event is used by dcp-native; do not remove.
|
|
90
|
-
|
|
90
|
+
// Otherwise, do not use __sandboxLoaded.
|
|
91
91
|
ring0PostMessage({
|
|
92
92
|
request: '__sandboxLoaded', // SAVE
|
|
93
93
|
});
|
package/package.json
CHANGED
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file libexec/sandbox/webgpu-worker-environment.js
|
|
3
|
-
* @author Dominic Cerisano, dcerisano@kingsds.network
|
|
4
|
-
* @date May 2020
|
|
5
|
-
* @author Jason Erb, jason@kingsds.network
|
|
6
|
-
* @date February 2022
|
|
7
|
-
* @note Adapted from:
|
|
8
|
-
* https://github.com/Kings-Distributed-Systems/webgpu/blob/dcp/release/index.js
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
self.wrapScriptLoading({ scriptName: 'webgpu-evaluator' }, function webGpuWorkerEnvironment$$fn(protectedStorage, postMessage)
|
|
12
|
-
{
|
|
13
|
-
if (typeof GPU !== 'undefined') {
|
|
14
|
-
try {
|
|
15
|
-
if (typeof self.navigator === 'undefined')
|
|
16
|
-
{
|
|
17
|
-
self.navigator = {};
|
|
18
|
-
protectedStorage.createdNewNavigator = true;
|
|
19
|
-
}
|
|
20
|
-
self.navigator.gpu = GPU;
|
|
21
|
-
|
|
22
|
-
{
|
|
23
|
-
let devices = [];
|
|
24
|
-
|
|
25
|
-
//Timeouts for polyfills
|
|
26
|
-
//Negative numbers to signal clamping override in evaluator engine.
|
|
27
|
-
//nextTickTimeout is for process.nextTick() polyfill
|
|
28
|
-
//immediateTimeout is for setImmediate() polyfill
|
|
29
|
-
|
|
30
|
-
self.nextTickTimeout = -0;
|
|
31
|
-
self.immediateTimeout = -0;
|
|
32
|
-
|
|
33
|
-
function deviceTick()
|
|
34
|
-
{
|
|
35
|
-
if (devices) {
|
|
36
|
-
for (let ii = 0; ii < devices.length; ++ii) {
|
|
37
|
-
devices[ii].tick();
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
self.setTimeout(deviceTick, self.nextTickTimeout);
|
|
43
|
-
|
|
44
|
-
GPUAdapter.prototype.requestDevice = function() {
|
|
45
|
-
let args = arguments;
|
|
46
|
-
|
|
47
|
-
return new Promise((resolve, reject) => {
|
|
48
|
-
this._requestDevice(...args).then(device => {
|
|
49
|
-
device._onErrorCallback = function(type, msg) {
|
|
50
|
-
//Polyfill for process.nextTick
|
|
51
|
-
self.setTimeout(() => {
|
|
52
|
-
switch (type) {
|
|
53
|
-
case "Error": throw new Error(msg);
|
|
54
|
-
case "Type": throw new TypeError(msg);
|
|
55
|
-
case "Range": throw new RangeError(msg);
|
|
56
|
-
case "Reference": throw new ReferenceError(msg);
|
|
57
|
-
case "Internal": throw new InternalError(msg);
|
|
58
|
-
case "Syntax": throw new SyntaxError(msg);
|
|
59
|
-
default: throw new Error(msg);
|
|
60
|
-
};
|
|
61
|
-
}, self.immediateTimeout);
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
devices.push(device);
|
|
65
|
-
resolve(device);
|
|
66
|
-
});
|
|
67
|
-
});
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
//Return a promise instead of a callback
|
|
72
|
-
|
|
73
|
-
GPUFence.prototype.onCompletion = function(completionValue) {
|
|
74
|
-
return new Promise(resolve => {
|
|
75
|
-
//Polyfill for setImmediate
|
|
76
|
-
self.setTimeout(() => {
|
|
77
|
-
this._onCompletion(completionValue, resolve);
|
|
78
|
-
}, self.immediateTimeout);
|
|
79
|
-
});
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
GPUBuffer.prototype.mapReadAsync = function() {
|
|
83
|
-
return new Promise(resolve => {
|
|
84
|
-
//Polyfill for setImmediate
|
|
85
|
-
self.setTimeout(() => {
|
|
86
|
-
this._mapReadAsync(resolve);
|
|
87
|
-
}, self.immediateTimeout);
|
|
88
|
-
});
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
GPUBuffer.prototype.mapWriteAsync = function() {
|
|
92
|
-
return new Promise(resolve => {
|
|
93
|
-
//Polyfill for setImmediate
|
|
94
|
-
self.setTimeout(() => {
|
|
95
|
-
this._mapWriteAsync(resolve);
|
|
96
|
-
}, self.immediateTimeout);
|
|
97
|
-
});
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
GPUDevice.prototype.createBufferMappedAsync = function(descriptor) {
|
|
101
|
-
return new Promise(resolve => {
|
|
102
|
-
//Polyfill for setImmediate
|
|
103
|
-
self.setTimeout(() => {
|
|
104
|
-
this._createBufferMappedAsync(descriptor, resolve);
|
|
105
|
-
}, self.immediateTimeout);
|
|
106
|
-
});
|
|
107
|
-
};
|
|
108
|
-
|
|
109
|
-
GPUDevice.prototype.createBufferMapped = function(descriptor) {
|
|
110
|
-
return new Promise(resolve => {
|
|
111
|
-
//Polyfill for setImmediate
|
|
112
|
-
self.setTimeout(() => {
|
|
113
|
-
this._createBufferMapped(descriptor, resolve);
|
|
114
|
-
}, self.immediateTimeout);
|
|
115
|
-
});
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
} catch (err) {
|
|
119
|
-
console.log("ERROR: ", err);
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
});
|