@react-three/test-renderer 10.0.0-canary.979dc2d → 10.0.0-canary.98dbd28
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/README.md +23 -42
- package/dist/index.cjs +398 -82
- package/dist/index.mjs +402 -72
- package/dist/legacy.cjs +7 -19
- package/dist/legacy.mjs +8 -6
- package/dist/webgpu/index.cjs +7 -29
- package/dist/webgpu/index.d.cts +1 -1
- package/dist/webgpu/index.d.mts +1 -1
- package/dist/webgpu/index.d.ts +1 -1
- package/dist/webgpu/index.mjs +9 -7
- package/package.json +4 -3
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,389 @@
|
|
|
1
1
|
import { act } from 'react';
|
|
2
2
|
export { act } from 'react';
|
|
3
|
-
import
|
|
4
|
-
|
|
3
|
+
import { createRoot, _roots, reconciler } from '@react-three/fiber';
|
|
4
|
+
|
|
5
|
+
var __defProp$2 = Object.defineProperty;
|
|
6
|
+
var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
7
|
+
var __publicField$2 = (obj, key, value) => __defNormalProp$2(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
8
|
+
class MockGPUBuffer {
|
|
9
|
+
constructor(descriptor) {
|
|
10
|
+
__publicField$2(this, "size");
|
|
11
|
+
__publicField$2(this, "usage");
|
|
12
|
+
__publicField$2(this, "mapState", "unmapped");
|
|
13
|
+
this.size = descriptor.size;
|
|
14
|
+
this.usage = descriptor.usage;
|
|
15
|
+
}
|
|
16
|
+
getMappedRange(_offset, _size) {
|
|
17
|
+
return new ArrayBuffer(this.size);
|
|
18
|
+
}
|
|
19
|
+
unmap() {
|
|
20
|
+
}
|
|
21
|
+
destroy() {
|
|
22
|
+
}
|
|
23
|
+
async mapAsync(_mode, _offset, _size) {
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
class MockGPUTexture {
|
|
27
|
+
constructor(descriptor) {
|
|
28
|
+
__publicField$2(this, "width");
|
|
29
|
+
__publicField$2(this, "height");
|
|
30
|
+
__publicField$2(this, "depthOrArrayLayers");
|
|
31
|
+
__publicField$2(this, "mipLevelCount");
|
|
32
|
+
__publicField$2(this, "sampleCount");
|
|
33
|
+
__publicField$2(this, "dimension");
|
|
34
|
+
__publicField$2(this, "format");
|
|
35
|
+
__publicField$2(this, "usage");
|
|
36
|
+
this.width = typeof descriptor.size === "number" ? descriptor.size : descriptor.size.width ?? 1;
|
|
37
|
+
this.height = typeof descriptor.size === "number" ? 1 : descriptor.size.height ?? 1;
|
|
38
|
+
this.depthOrArrayLayers = typeof descriptor.size === "number" ? 1 : descriptor.size.depthOrArrayLayers ?? 1;
|
|
39
|
+
this.mipLevelCount = descriptor.mipLevelCount ?? 1;
|
|
40
|
+
this.sampleCount = descriptor.sampleCount ?? 1;
|
|
41
|
+
this.dimension = descriptor.dimension ?? "2d";
|
|
42
|
+
this.format = descriptor.format;
|
|
43
|
+
this.usage = descriptor.usage;
|
|
44
|
+
}
|
|
45
|
+
createView(_descriptor) {
|
|
46
|
+
return new MockGPUTextureView();
|
|
47
|
+
}
|
|
48
|
+
destroy() {
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
class MockGPUTextureView {
|
|
52
|
+
constructor() {
|
|
53
|
+
__publicField$2(this, "label");
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
class MockGPUSampler {
|
|
57
|
+
constructor(_descriptor) {
|
|
58
|
+
__publicField$2(this, "label");
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
class MockGPUShaderModule {
|
|
62
|
+
constructor(_descriptor) {
|
|
63
|
+
__publicField$2(this, "label");
|
|
64
|
+
}
|
|
65
|
+
getCompilationInfo() {
|
|
66
|
+
return Promise.resolve({ messages: [] });
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
class MockGPUBindGroupLayout {
|
|
70
|
+
constructor(_descriptor) {
|
|
71
|
+
__publicField$2(this, "label");
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
class MockGPUBindGroup {
|
|
75
|
+
constructor(_descriptor) {
|
|
76
|
+
__publicField$2(this, "label");
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
class MockGPUPipelineLayout {
|
|
80
|
+
constructor(_descriptor) {
|
|
81
|
+
__publicField$2(this, "label");
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
class MockGPURenderPipeline {
|
|
85
|
+
constructor(_descriptor) {
|
|
86
|
+
__publicField$2(this, "label");
|
|
87
|
+
}
|
|
88
|
+
getBindGroupLayout(_index) {
|
|
89
|
+
return new MockGPUBindGroupLayout({ entries: [] });
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
class MockGPUComputePipeline {
|
|
93
|
+
constructor(_descriptor) {
|
|
94
|
+
__publicField$2(this, "label");
|
|
95
|
+
}
|
|
96
|
+
getBindGroupLayout(_index) {
|
|
97
|
+
return new MockGPUBindGroupLayout({ entries: [] });
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
class MockGPUCommandEncoder {
|
|
101
|
+
constructor() {
|
|
102
|
+
__publicField$2(this, "label");
|
|
103
|
+
}
|
|
104
|
+
beginRenderPass(_descriptor) {
|
|
105
|
+
return new MockGPURenderPassEncoder();
|
|
106
|
+
}
|
|
107
|
+
beginComputePass(_descriptor) {
|
|
108
|
+
return new MockGPUComputePassEncoder();
|
|
109
|
+
}
|
|
110
|
+
copyBufferToBuffer(_source, _sourceOffset, _destination, _destinationOffset, _size) {
|
|
111
|
+
}
|
|
112
|
+
copyBufferToTexture(_source, _destination, _copySize) {
|
|
113
|
+
}
|
|
114
|
+
copyTextureToBuffer(_source, _destination, _copySize) {
|
|
115
|
+
}
|
|
116
|
+
copyTextureToTexture(_source, _destination, _copySize) {
|
|
117
|
+
}
|
|
118
|
+
finish(_descriptor) {
|
|
119
|
+
return new MockGPUCommandBuffer();
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
class MockGPURenderPassEncoder {
|
|
123
|
+
setPipeline(_pipeline) {
|
|
124
|
+
}
|
|
125
|
+
setBindGroup(_index, _bindGroup, _dynamicOffsets) {
|
|
126
|
+
}
|
|
127
|
+
setVertexBuffer(_slot, _buffer, _offset, _size) {
|
|
128
|
+
}
|
|
129
|
+
setIndexBuffer(_buffer, _indexFormat, _offset, _size) {
|
|
130
|
+
}
|
|
131
|
+
setViewport(_x, _y, _width, _height, _minDepth, _maxDepth) {
|
|
132
|
+
}
|
|
133
|
+
setScissorRect(_x, _y, _width, _height) {
|
|
134
|
+
}
|
|
135
|
+
setBlendConstant(_color) {
|
|
136
|
+
}
|
|
137
|
+
setStencilReference(_reference) {
|
|
138
|
+
}
|
|
139
|
+
draw(_vertexCount, _instanceCount, _firstVertex, _firstInstance) {
|
|
140
|
+
}
|
|
141
|
+
drawIndexed(_indexCount, _instanceCount, _firstIndex, _baseVertex, _firstInstance) {
|
|
142
|
+
}
|
|
143
|
+
drawIndirect(_indirectBuffer, _indirectOffset) {
|
|
144
|
+
}
|
|
145
|
+
drawIndexedIndirect(_indirectBuffer, _indirectOffset) {
|
|
146
|
+
}
|
|
147
|
+
end() {
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
class MockGPUComputePassEncoder {
|
|
151
|
+
setPipeline(_pipeline) {
|
|
152
|
+
}
|
|
153
|
+
setBindGroup(_index, _bindGroup, _dynamicOffsets) {
|
|
154
|
+
}
|
|
155
|
+
dispatchWorkgroups(_workgroupCountX, _workgroupCountY, _workgroupCountZ) {
|
|
156
|
+
}
|
|
157
|
+
dispatchWorkgroupsIndirect(_indirectBuffer, _indirectOffset) {
|
|
158
|
+
}
|
|
159
|
+
end() {
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
class MockGPUCommandBuffer {
|
|
163
|
+
constructor() {
|
|
164
|
+
__publicField$2(this, "label");
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
class MockGPUQueue {
|
|
168
|
+
constructor() {
|
|
169
|
+
__publicField$2(this, "label");
|
|
170
|
+
}
|
|
171
|
+
submit(_commandBuffers) {
|
|
172
|
+
}
|
|
173
|
+
writeBuffer(_buffer, _bufferOffset, _data, _dataOffset, _size) {
|
|
174
|
+
}
|
|
175
|
+
writeTexture(_destination, _data, _dataLayout, _size) {
|
|
176
|
+
}
|
|
177
|
+
copyExternalImageToTexture(_source, _destination, _copySize) {
|
|
178
|
+
}
|
|
179
|
+
onSubmittedWorkDone() {
|
|
180
|
+
return Promise.resolve();
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
class MockGPUQuerySet {
|
|
184
|
+
constructor(descriptor) {
|
|
185
|
+
__publicField$2(this, "type");
|
|
186
|
+
__publicField$2(this, "count");
|
|
187
|
+
this.type = descriptor.type;
|
|
188
|
+
this.count = descriptor.count;
|
|
189
|
+
}
|
|
190
|
+
destroy() {
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
class MockGPUDevice extends EventTarget {
|
|
194
|
+
constructor() {
|
|
195
|
+
super();
|
|
196
|
+
__publicField$2(this, "features", /* @__PURE__ */ new Set());
|
|
197
|
+
__publicField$2(this, "limits", createMockLimits());
|
|
198
|
+
__publicField$2(this, "queue", new MockGPUQueue());
|
|
199
|
+
__publicField$2(this, "lost");
|
|
200
|
+
__publicField$2(this, "label");
|
|
201
|
+
__publicField$2(this, "_destroyed", false);
|
|
202
|
+
this.lost = new Promise(() => {
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
destroy() {
|
|
206
|
+
this._destroyed = true;
|
|
207
|
+
}
|
|
208
|
+
// Buffer Creation --
|
|
209
|
+
createBuffer(descriptor) {
|
|
210
|
+
return new MockGPUBuffer(descriptor);
|
|
211
|
+
}
|
|
212
|
+
// Texture Creation --
|
|
213
|
+
createTexture(descriptor) {
|
|
214
|
+
return new MockGPUTexture(descriptor);
|
|
215
|
+
}
|
|
216
|
+
createSampler(descriptor) {
|
|
217
|
+
return new MockGPUSampler(descriptor);
|
|
218
|
+
}
|
|
219
|
+
// Shader/Pipeline Creation --
|
|
220
|
+
createShaderModule(descriptor) {
|
|
221
|
+
return new MockGPUShaderModule(descriptor);
|
|
222
|
+
}
|
|
223
|
+
createBindGroupLayout(descriptor) {
|
|
224
|
+
return new MockGPUBindGroupLayout(descriptor);
|
|
225
|
+
}
|
|
226
|
+
createBindGroup(descriptor) {
|
|
227
|
+
return new MockGPUBindGroup(descriptor);
|
|
228
|
+
}
|
|
229
|
+
createPipelineLayout(descriptor) {
|
|
230
|
+
return new MockGPUPipelineLayout(descriptor);
|
|
231
|
+
}
|
|
232
|
+
createRenderPipeline(descriptor) {
|
|
233
|
+
return new MockGPURenderPipeline(descriptor);
|
|
234
|
+
}
|
|
235
|
+
async createRenderPipelineAsync(descriptor) {
|
|
236
|
+
return new MockGPURenderPipeline(descriptor);
|
|
237
|
+
}
|
|
238
|
+
createComputePipeline(descriptor) {
|
|
239
|
+
return new MockGPUComputePipeline(descriptor);
|
|
240
|
+
}
|
|
241
|
+
async createComputePipelineAsync(descriptor) {
|
|
242
|
+
return new MockGPUComputePipeline(descriptor);
|
|
243
|
+
}
|
|
244
|
+
// Command Encoding --
|
|
245
|
+
createCommandEncoder(_descriptor) {
|
|
246
|
+
return new MockGPUCommandEncoder();
|
|
247
|
+
}
|
|
248
|
+
// Query Sets --
|
|
249
|
+
createQuerySet(descriptor) {
|
|
250
|
+
return new MockGPUQuerySet(descriptor);
|
|
251
|
+
}
|
|
252
|
+
// Error Handling --
|
|
253
|
+
pushErrorScope(_filter) {
|
|
254
|
+
}
|
|
255
|
+
popErrorScope() {
|
|
256
|
+
return Promise.resolve(null);
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
class MockGPUAdapter {
|
|
260
|
+
constructor() {
|
|
261
|
+
__publicField$2(this, "features", /* @__PURE__ */ new Set());
|
|
262
|
+
__publicField$2(this, "limits", createMockLimits());
|
|
263
|
+
__publicField$2(this, "isFallbackAdapter", false);
|
|
264
|
+
}
|
|
265
|
+
async requestDevice(_descriptor) {
|
|
266
|
+
return new MockGPUDevice();
|
|
267
|
+
}
|
|
268
|
+
async requestAdapterInfo() {
|
|
269
|
+
return {
|
|
270
|
+
vendor: "Mock",
|
|
271
|
+
architecture: "Mock",
|
|
272
|
+
device: "Mock Test Renderer",
|
|
273
|
+
description: "Mock WebGPU Adapter for Testing"
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
class MockGPU {
|
|
278
|
+
constructor() {
|
|
279
|
+
__publicField$2(this, "wgslLanguageFeatures", /* @__PURE__ */ new Set());
|
|
280
|
+
}
|
|
281
|
+
async requestAdapter(_options) {
|
|
282
|
+
return new MockGPUAdapter();
|
|
283
|
+
}
|
|
284
|
+
getPreferredCanvasFormat() {
|
|
285
|
+
return "bgra8unorm";
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
class MockGPUCanvasContext {
|
|
289
|
+
constructor(canvas) {
|
|
290
|
+
__publicField$2(this, "canvas");
|
|
291
|
+
__publicField$2(this, "_configuration", null);
|
|
292
|
+
this.canvas = canvas;
|
|
293
|
+
}
|
|
294
|
+
configure(configuration) {
|
|
295
|
+
this._configuration = configuration;
|
|
296
|
+
}
|
|
297
|
+
unconfigure() {
|
|
298
|
+
this._configuration = null;
|
|
299
|
+
}
|
|
300
|
+
getCurrentTexture() {
|
|
301
|
+
const width = this.canvas instanceof HTMLCanvasElement ? this.canvas.width : this.canvas.width;
|
|
302
|
+
const height = this.canvas instanceof HTMLCanvasElement ? this.canvas.height : this.canvas.height;
|
|
303
|
+
return new MockGPUTexture({
|
|
304
|
+
size: { width, height },
|
|
305
|
+
format: this._configuration?.format ?? "bgra8unorm",
|
|
306
|
+
usage: GPUTextureUsage.RENDER_ATTACHMENT
|
|
307
|
+
});
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
function createMockLimits() {
|
|
311
|
+
return {
|
|
312
|
+
maxTextureDimension1D: 8192,
|
|
313
|
+
maxTextureDimension2D: 8192,
|
|
314
|
+
maxTextureDimension3D: 2048,
|
|
315
|
+
maxTextureArrayLayers: 256,
|
|
316
|
+
maxBindGroups: 4,
|
|
317
|
+
maxBindGroupsPlusVertexBuffers: 24,
|
|
318
|
+
maxBindingsPerBindGroup: 1e3,
|
|
319
|
+
maxDynamicUniformBuffersPerPipelineLayout: 8,
|
|
320
|
+
maxDynamicStorageBuffersPerPipelineLayout: 4,
|
|
321
|
+
maxSampledTexturesPerShaderStage: 16,
|
|
322
|
+
maxSamplersPerShaderStage: 16,
|
|
323
|
+
maxStorageBuffersPerShaderStage: 8,
|
|
324
|
+
maxStorageTexturesPerShaderStage: 4,
|
|
325
|
+
maxUniformBuffersPerShaderStage: 12,
|
|
326
|
+
maxUniformBufferBindingSize: 65536,
|
|
327
|
+
maxStorageBufferBindingSize: 134217728,
|
|
328
|
+
minUniformBufferOffsetAlignment: 256,
|
|
329
|
+
minStorageBufferOffsetAlignment: 256,
|
|
330
|
+
maxVertexBuffers: 8,
|
|
331
|
+
maxBufferSize: 268435456,
|
|
332
|
+
maxVertexAttributes: 16,
|
|
333
|
+
maxVertexBufferArrayStride: 2048,
|
|
334
|
+
maxInterStageShaderVariables: 16,
|
|
335
|
+
maxColorAttachments: 8,
|
|
336
|
+
maxColorAttachmentBytesPerSample: 32,
|
|
337
|
+
maxComputeWorkgroupStorageSize: 16384,
|
|
338
|
+
maxComputeInvocationsPerWorkgroup: 256,
|
|
339
|
+
maxComputeWorkgroupSizeX: 256,
|
|
340
|
+
maxComputeWorkgroupSizeY: 256,
|
|
341
|
+
maxComputeWorkgroupSizeZ: 64,
|
|
342
|
+
maxComputeWorkgroupsPerDimension: 65535
|
|
343
|
+
};
|
|
344
|
+
}
|
|
345
|
+
function mockWebGPU() {
|
|
346
|
+
const mockGPU = new MockGPU();
|
|
347
|
+
if (typeof globalThis.navigator === "undefined") {
|
|
348
|
+
globalThis.navigator = {};
|
|
349
|
+
}
|
|
350
|
+
globalThis.navigator.gpu = mockGPU;
|
|
351
|
+
globalThis.GPUTextureUsage = {
|
|
352
|
+
COPY_SRC: 1,
|
|
353
|
+
COPY_DST: 2,
|
|
354
|
+
TEXTURE_BINDING: 4,
|
|
355
|
+
STORAGE_BINDING: 8,
|
|
356
|
+
RENDER_ATTACHMENT: 16
|
|
357
|
+
};
|
|
358
|
+
globalThis.GPUBufferUsage = {
|
|
359
|
+
MAP_READ: 1,
|
|
360
|
+
MAP_WRITE: 2,
|
|
361
|
+
COPY_SRC: 4,
|
|
362
|
+
COPY_DST: 8,
|
|
363
|
+
INDEX: 16,
|
|
364
|
+
VERTEX: 32,
|
|
365
|
+
UNIFORM: 64,
|
|
366
|
+
STORAGE: 128,
|
|
367
|
+
INDIRECT: 256,
|
|
368
|
+
QUERY_RESOLVE: 512
|
|
369
|
+
};
|
|
370
|
+
globalThis.GPUMapMode = {
|
|
371
|
+
READ: 1,
|
|
372
|
+
WRITE: 2
|
|
373
|
+
};
|
|
374
|
+
globalThis.GPUShaderStage = {
|
|
375
|
+
VERTEX: 1,
|
|
376
|
+
FRAGMENT: 2,
|
|
377
|
+
COMPUTE: 4
|
|
378
|
+
};
|
|
379
|
+
globalThis.GPUColorWrite = {
|
|
380
|
+
RED: 1,
|
|
381
|
+
GREEN: 2,
|
|
382
|
+
BLUE: 4,
|
|
383
|
+
ALPHA: 8,
|
|
384
|
+
ALL: 15
|
|
385
|
+
};
|
|
386
|
+
}
|
|
5
387
|
|
|
6
388
|
const lowerCaseFirstLetter = (str) => `${str.charAt(0).toLowerCase()}${str.slice(1)}`;
|
|
7
389
|
const toEventHandlerName = (eventName) => `on${eventName.charAt(0).toUpperCase()}${eventName.slice(1)}`;
|
|
@@ -45,9 +427,9 @@ const toGraph = (object) => {
|
|
|
45
427
|
});
|
|
46
428
|
};
|
|
47
429
|
|
|
48
|
-
var __defProp$
|
|
49
|
-
var __defNormalProp$
|
|
50
|
-
var __publicField$
|
|
430
|
+
var __defProp$1 = Object.defineProperty;
|
|
431
|
+
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
432
|
+
var __publicField$1 = (obj, key, value) => __defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
51
433
|
const functions = [
|
|
52
434
|
"activeTexture",
|
|
53
435
|
"attachShader",
|
|
@@ -767,18 +1149,18 @@ const extensions = {
|
|
|
767
1149
|
const returnsHandle = (method) => method.startsWith("create") || method === "fenceSync";
|
|
768
1150
|
class WebGL2RenderingContext {
|
|
769
1151
|
constructor(canvas) {
|
|
770
|
-
__publicField$
|
|
1152
|
+
__publicField$1(this, "getShaderPrecisionFormat", () => {
|
|
771
1153
|
return {
|
|
772
1154
|
rangeMin: 127,
|
|
773
1155
|
rangeMax: 127,
|
|
774
1156
|
precision: 23
|
|
775
1157
|
};
|
|
776
1158
|
});
|
|
777
|
-
__publicField$
|
|
778
|
-
__publicField$
|
|
779
|
-
__publicField$
|
|
780
|
-
__publicField$
|
|
781
|
-
__publicField$
|
|
1159
|
+
__publicField$1(this, "GL_VERSION", 7938);
|
|
1160
|
+
__publicField$1(this, "SCISSOR_BOX", 3088);
|
|
1161
|
+
__publicField$1(this, "VIEWPORT", 2978);
|
|
1162
|
+
__publicField$1(this, "getProgramInfoLog", () => "");
|
|
1163
|
+
__publicField$1(this, "getShaderInfoLog", () => "");
|
|
782
1164
|
this.canvas = canvas;
|
|
783
1165
|
this.drawingBufferWidth = canvas.width;
|
|
784
1166
|
this.drawingBufferHeight = canvas.height;
|
|
@@ -800,61 +1182,10 @@ class WebGL2RenderingContext {
|
|
|
800
1182
|
getExtension(ext) {
|
|
801
1183
|
return extensions[ext];
|
|
802
1184
|
}
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
var __publicField$1 = (obj, key, value) => __defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
808
|
-
class MockGPUTexture {
|
|
809
|
-
constructor(descriptor) {
|
|
810
|
-
__publicField$1(this, "width");
|
|
811
|
-
__publicField$1(this, "height");
|
|
812
|
-
__publicField$1(this, "depthOrArrayLayers");
|
|
813
|
-
__publicField$1(this, "mipLevelCount");
|
|
814
|
-
__publicField$1(this, "sampleCount");
|
|
815
|
-
__publicField$1(this, "dimension");
|
|
816
|
-
__publicField$1(this, "format");
|
|
817
|
-
__publicField$1(this, "usage");
|
|
818
|
-
this.width = typeof descriptor.size === "number" ? descriptor.size : descriptor.size.width ?? 1;
|
|
819
|
-
this.height = typeof descriptor.size === "number" ? 1 : descriptor.size.height ?? 1;
|
|
820
|
-
this.depthOrArrayLayers = typeof descriptor.size === "number" ? 1 : descriptor.size.depthOrArrayLayers ?? 1;
|
|
821
|
-
this.mipLevelCount = descriptor.mipLevelCount ?? 1;
|
|
822
|
-
this.sampleCount = descriptor.sampleCount ?? 1;
|
|
823
|
-
this.dimension = descriptor.dimension ?? "2d";
|
|
824
|
-
this.format = descriptor.format;
|
|
825
|
-
this.usage = descriptor.usage;
|
|
826
|
-
}
|
|
827
|
-
createView(_descriptor) {
|
|
828
|
-
return new MockGPUTextureView();
|
|
829
|
-
}
|
|
830
|
-
destroy() {
|
|
831
|
-
}
|
|
832
|
-
}
|
|
833
|
-
class MockGPUTextureView {
|
|
834
|
-
constructor() {
|
|
835
|
-
__publicField$1(this, "label");
|
|
836
|
-
}
|
|
837
|
-
}
|
|
838
|
-
class MockGPUCanvasContext {
|
|
839
|
-
constructor(canvas) {
|
|
840
|
-
__publicField$1(this, "canvas");
|
|
841
|
-
__publicField$1(this, "_configuration", null);
|
|
842
|
-
this.canvas = canvas;
|
|
843
|
-
}
|
|
844
|
-
configure(configuration) {
|
|
845
|
-
this._configuration = configuration;
|
|
846
|
-
}
|
|
847
|
-
unconfigure() {
|
|
848
|
-
this._configuration = null;
|
|
849
|
-
}
|
|
850
|
-
getCurrentTexture() {
|
|
851
|
-
const width = this.canvas instanceof HTMLCanvasElement ? this.canvas.width : this.canvas.width;
|
|
852
|
-
const height = this.canvas instanceof HTMLCanvasElement ? this.canvas.height : this.canvas.height;
|
|
853
|
-
return new MockGPUTexture({
|
|
854
|
-
size: { width, height },
|
|
855
|
-
format: this._configuration?.format ?? "bgra8unorm",
|
|
856
|
-
usage: GPUTextureUsage.RENDER_ATTACHMENT
|
|
857
|
-
});
|
|
1185
|
+
// WebGPURenderer's WebGL2 fallback backend lists the supported extensions up front and checks
|
|
1186
|
+
// them with `.includes()`, so this has to return an array rather than the no-op stub's undefined
|
|
1187
|
+
getSupportedExtensions() {
|
|
1188
|
+
return Object.keys(extensions);
|
|
858
1189
|
}
|
|
859
1190
|
}
|
|
860
1191
|
|
|
@@ -1044,6 +1375,7 @@ const createVirtualInstance = (object, parent) => {
|
|
|
1044
1375
|
object,
|
|
1045
1376
|
eventCount: 0,
|
|
1046
1377
|
handlers: {},
|
|
1378
|
+
previousVisible: void 0,
|
|
1047
1379
|
isHidden: false
|
|
1048
1380
|
};
|
|
1049
1381
|
if (object.children && object.children.length > 0) {
|
|
@@ -1127,8 +1459,7 @@ async function waitFor(callback, { interval = 50, timeout = 5e3 } = {}) {
|
|
|
1127
1459
|
}
|
|
1128
1460
|
|
|
1129
1461
|
function createTestRenderer(deps) {
|
|
1130
|
-
const {
|
|
1131
|
-
extend(THREE2);
|
|
1462
|
+
const { createRoot, mockRoots, reconciler, act, mode } = deps;
|
|
1132
1463
|
const create = async (element, options) => {
|
|
1133
1464
|
const canvas = createCanvas({ ...options, mode });
|
|
1134
1465
|
const _root = createRoot(canvas);
|
|
@@ -1216,15 +1547,14 @@ const index$1 = {
|
|
|
1216
1547
|
ReactThreeTestInstance: ReactThreeTestInstance
|
|
1217
1548
|
};
|
|
1218
1549
|
|
|
1550
|
+
mockWebGPU();
|
|
1219
1551
|
const renderer = createTestRenderer({
|
|
1220
|
-
THREE,
|
|
1221
1552
|
createRoot,
|
|
1222
1553
|
mockRoots: _roots,
|
|
1223
1554
|
reconciler,
|
|
1224
1555
|
act,
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
// Default uses WebGL context
|
|
1556
|
+
mode: "webgpu"
|
|
1557
|
+
// The root entry renders with WebGPURenderer
|
|
1228
1558
|
});
|
|
1229
1559
|
const { create } = renderer;
|
|
1230
1560
|
const index = { create, act, waitFor };
|
package/dist/legacy.cjs
CHANGED
|
@@ -3,23 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const react = require('react');
|
|
6
|
-
const THREE = require('three');
|
|
7
6
|
const legacy$1 = require('@react-three/fiber/legacy');
|
|
8
7
|
|
|
9
|
-
function _interopNamespaceCompat(e) {
|
|
10
|
-
if (e && typeof e === 'object' && 'default' in e) return e;
|
|
11
|
-
const n = Object.create(null);
|
|
12
|
-
if (e) {
|
|
13
|
-
for (const k in e) {
|
|
14
|
-
n[k] = e[k];
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
n.default = e;
|
|
18
|
-
return n;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const THREE__namespace = /*#__PURE__*/_interopNamespaceCompat(THREE);
|
|
22
|
-
|
|
23
8
|
const lowerCaseFirstLetter = (str) => `${str.charAt(0).toLowerCase()}${str.slice(1)}`;
|
|
24
9
|
const toEventHandlerName = (eventName) => `on${eventName.charAt(0).toUpperCase()}${eventName.slice(1)}`;
|
|
25
10
|
|
|
@@ -817,6 +802,11 @@ class WebGL2RenderingContext {
|
|
|
817
802
|
getExtension(ext) {
|
|
818
803
|
return extensions[ext];
|
|
819
804
|
}
|
|
805
|
+
// WebGPURenderer's WebGL2 fallback backend lists the supported extensions up front and checks
|
|
806
|
+
// them with `.includes()`, so this has to return an array rather than the no-op stub's undefined
|
|
807
|
+
getSupportedExtensions() {
|
|
808
|
+
return Object.keys(extensions);
|
|
809
|
+
}
|
|
820
810
|
}
|
|
821
811
|
|
|
822
812
|
var __defProp$1 = Object.defineProperty;
|
|
@@ -1061,6 +1051,7 @@ const createVirtualInstance = (object, parent) => {
|
|
|
1061
1051
|
object,
|
|
1062
1052
|
eventCount: 0,
|
|
1063
1053
|
handlers: {},
|
|
1054
|
+
previousVisible: void 0,
|
|
1064
1055
|
isHidden: false
|
|
1065
1056
|
};
|
|
1066
1057
|
if (object.children && object.children.length > 0) {
|
|
@@ -1144,8 +1135,7 @@ async function waitFor(callback, { interval = 50, timeout = 5e3 } = {}) {
|
|
|
1144
1135
|
}
|
|
1145
1136
|
|
|
1146
1137
|
function createTestRenderer(deps) {
|
|
1147
|
-
const {
|
|
1148
|
-
extend(THREE2);
|
|
1138
|
+
const { createRoot, mockRoots, reconciler, act, mode } = deps;
|
|
1149
1139
|
const create = async (element, options) => {
|
|
1150
1140
|
const canvas = createCanvas({ ...options, mode });
|
|
1151
1141
|
const _root = createRoot(canvas);
|
|
@@ -1234,12 +1224,10 @@ const index = {
|
|
|
1234
1224
|
};
|
|
1235
1225
|
|
|
1236
1226
|
const renderer = createTestRenderer({
|
|
1237
|
-
THREE: THREE__namespace,
|
|
1238
1227
|
createRoot: legacy$1.createRoot,
|
|
1239
1228
|
mockRoots: legacy$1._roots,
|
|
1240
1229
|
reconciler: legacy$1.reconciler,
|
|
1241
1230
|
act: react.act,
|
|
1242
|
-
extend: legacy$1.extend,
|
|
1243
1231
|
mode: "webgl"
|
|
1244
1232
|
});
|
|
1245
1233
|
const { create } = renderer;
|
package/dist/legacy.mjs
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { act } from 'react';
|
|
2
2
|
export { act } from 'react';
|
|
3
|
-
import
|
|
4
|
-
import { extend, createRoot, _roots, reconciler } from '@react-three/fiber/legacy';
|
|
3
|
+
import { createRoot, _roots, reconciler } from '@react-three/fiber/legacy';
|
|
5
4
|
|
|
6
5
|
const lowerCaseFirstLetter = (str) => `${str.charAt(0).toLowerCase()}${str.slice(1)}`;
|
|
7
6
|
const toEventHandlerName = (eventName) => `on${eventName.charAt(0).toUpperCase()}${eventName.slice(1)}`;
|
|
@@ -800,6 +799,11 @@ class WebGL2RenderingContext {
|
|
|
800
799
|
getExtension(ext) {
|
|
801
800
|
return extensions[ext];
|
|
802
801
|
}
|
|
802
|
+
// WebGPURenderer's WebGL2 fallback backend lists the supported extensions up front and checks
|
|
803
|
+
// them with `.includes()`, so this has to return an array rather than the no-op stub's undefined
|
|
804
|
+
getSupportedExtensions() {
|
|
805
|
+
return Object.keys(extensions);
|
|
806
|
+
}
|
|
803
807
|
}
|
|
804
808
|
|
|
805
809
|
var __defProp$1 = Object.defineProperty;
|
|
@@ -1044,6 +1048,7 @@ const createVirtualInstance = (object, parent) => {
|
|
|
1044
1048
|
object,
|
|
1045
1049
|
eventCount: 0,
|
|
1046
1050
|
handlers: {},
|
|
1051
|
+
previousVisible: void 0,
|
|
1047
1052
|
isHidden: false
|
|
1048
1053
|
};
|
|
1049
1054
|
if (object.children && object.children.length > 0) {
|
|
@@ -1127,8 +1132,7 @@ async function waitFor(callback, { interval = 50, timeout = 5e3 } = {}) {
|
|
|
1127
1132
|
}
|
|
1128
1133
|
|
|
1129
1134
|
function createTestRenderer(deps) {
|
|
1130
|
-
const {
|
|
1131
|
-
extend(THREE2);
|
|
1135
|
+
const { createRoot, mockRoots, reconciler, act, mode } = deps;
|
|
1132
1136
|
const create = async (element, options) => {
|
|
1133
1137
|
const canvas = createCanvas({ ...options, mode });
|
|
1134
1138
|
const _root = createRoot(canvas);
|
|
@@ -1217,12 +1221,10 @@ const index = {
|
|
|
1217
1221
|
};
|
|
1218
1222
|
|
|
1219
1223
|
const renderer = createTestRenderer({
|
|
1220
|
-
THREE,
|
|
1221
1224
|
createRoot,
|
|
1222
1225
|
mockRoots: _roots,
|
|
1223
1226
|
reconciler,
|
|
1224
1227
|
act,
|
|
1225
|
-
extend,
|
|
1226
1228
|
mode: "webgl"
|
|
1227
1229
|
});
|
|
1228
1230
|
const { create } = renderer;
|