@react-three/test-renderer 10.0.0-canary.f511bb4 → 10.0.0-canary.f744c1e
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 +19 -27
- package/dist/index.cjs +412 -66
- package/dist/index.d.cts +11 -1
- package/dist/index.d.mts +11 -1
- package/dist/index.d.ts +11 -1
- package/dist/index.mjs +411 -67
- package/dist/legacy.cjs +6 -0
- package/dist/legacy.mjs +6 -0
- package/package.json +3 -8
- package/dist/webgpu/index.cjs +0 -1575
- package/dist/webgpu/index.d.cts +0 -128
- package/dist/webgpu/index.d.mts +0 -126
- package/dist/webgpu/index.d.ts +0 -128
- package/dist/webgpu/index.mjs +0 -1566
package/dist/index.mjs
CHANGED
|
@@ -2,6 +2,399 @@ import { act } from 'react';
|
|
|
2
2
|
export { act } from 'react';
|
|
3
3
|
import { createRoot, _roots, reconciler } from '@react-three/fiber';
|
|
4
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
|
+
}
|
|
387
|
+
function unmockWebGPU() {
|
|
388
|
+
if (typeof globalThis.navigator !== "undefined") {
|
|
389
|
+
delete globalThis.navigator.gpu;
|
|
390
|
+
}
|
|
391
|
+
delete globalThis.GPUTextureUsage;
|
|
392
|
+
delete globalThis.GPUBufferUsage;
|
|
393
|
+
delete globalThis.GPUMapMode;
|
|
394
|
+
delete globalThis.GPUShaderStage;
|
|
395
|
+
delete globalThis.GPUColorWrite;
|
|
396
|
+
}
|
|
397
|
+
|
|
5
398
|
const lowerCaseFirstLetter = (str) => `${str.charAt(0).toLowerCase()}${str.slice(1)}`;
|
|
6
399
|
const toEventHandlerName = (eventName) => `on${eventName.charAt(0).toUpperCase()}${eventName.slice(1)}`;
|
|
7
400
|
|
|
@@ -44,9 +437,9 @@ const toGraph = (object) => {
|
|
|
44
437
|
});
|
|
45
438
|
};
|
|
46
439
|
|
|
47
|
-
var __defProp$
|
|
48
|
-
var __defNormalProp$
|
|
49
|
-
var __publicField$
|
|
440
|
+
var __defProp$1 = Object.defineProperty;
|
|
441
|
+
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
442
|
+
var __publicField$1 = (obj, key, value) => __defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
50
443
|
const functions = [
|
|
51
444
|
"activeTexture",
|
|
52
445
|
"attachShader",
|
|
@@ -766,18 +1159,18 @@ const extensions = {
|
|
|
766
1159
|
const returnsHandle = (method) => method.startsWith("create") || method === "fenceSync";
|
|
767
1160
|
class WebGL2RenderingContext {
|
|
768
1161
|
constructor(canvas) {
|
|
769
|
-
__publicField$
|
|
1162
|
+
__publicField$1(this, "getShaderPrecisionFormat", () => {
|
|
770
1163
|
return {
|
|
771
1164
|
rangeMin: 127,
|
|
772
1165
|
rangeMax: 127,
|
|
773
1166
|
precision: 23
|
|
774
1167
|
};
|
|
775
1168
|
});
|
|
776
|
-
__publicField$
|
|
777
|
-
__publicField$
|
|
778
|
-
__publicField$
|
|
779
|
-
__publicField$
|
|
780
|
-
__publicField$
|
|
1169
|
+
__publicField$1(this, "GL_VERSION", 7938);
|
|
1170
|
+
__publicField$1(this, "SCISSOR_BOX", 3088);
|
|
1171
|
+
__publicField$1(this, "VIEWPORT", 2978);
|
|
1172
|
+
__publicField$1(this, "getProgramInfoLog", () => "");
|
|
1173
|
+
__publicField$1(this, "getShaderInfoLog", () => "");
|
|
781
1174
|
this.canvas = canvas;
|
|
782
1175
|
this.drawingBufferWidth = canvas.width;
|
|
783
1176
|
this.drawingBufferHeight = canvas.height;
|
|
@@ -799,61 +1192,10 @@ class WebGL2RenderingContext {
|
|
|
799
1192
|
getExtension(ext) {
|
|
800
1193
|
return extensions[ext];
|
|
801
1194
|
}
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
var __publicField$1 = (obj, key, value) => __defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
807
|
-
class MockGPUTexture {
|
|
808
|
-
constructor(descriptor) {
|
|
809
|
-
__publicField$1(this, "width");
|
|
810
|
-
__publicField$1(this, "height");
|
|
811
|
-
__publicField$1(this, "depthOrArrayLayers");
|
|
812
|
-
__publicField$1(this, "mipLevelCount");
|
|
813
|
-
__publicField$1(this, "sampleCount");
|
|
814
|
-
__publicField$1(this, "dimension");
|
|
815
|
-
__publicField$1(this, "format");
|
|
816
|
-
__publicField$1(this, "usage");
|
|
817
|
-
this.width = typeof descriptor.size === "number" ? descriptor.size : descriptor.size.width ?? 1;
|
|
818
|
-
this.height = typeof descriptor.size === "number" ? 1 : descriptor.size.height ?? 1;
|
|
819
|
-
this.depthOrArrayLayers = typeof descriptor.size === "number" ? 1 : descriptor.size.depthOrArrayLayers ?? 1;
|
|
820
|
-
this.mipLevelCount = descriptor.mipLevelCount ?? 1;
|
|
821
|
-
this.sampleCount = descriptor.sampleCount ?? 1;
|
|
822
|
-
this.dimension = descriptor.dimension ?? "2d";
|
|
823
|
-
this.format = descriptor.format;
|
|
824
|
-
this.usage = descriptor.usage;
|
|
825
|
-
}
|
|
826
|
-
createView(_descriptor) {
|
|
827
|
-
return new MockGPUTextureView();
|
|
828
|
-
}
|
|
829
|
-
destroy() {
|
|
830
|
-
}
|
|
831
|
-
}
|
|
832
|
-
class MockGPUTextureView {
|
|
833
|
-
constructor() {
|
|
834
|
-
__publicField$1(this, "label");
|
|
835
|
-
}
|
|
836
|
-
}
|
|
837
|
-
class MockGPUCanvasContext {
|
|
838
|
-
constructor(canvas) {
|
|
839
|
-
__publicField$1(this, "canvas");
|
|
840
|
-
__publicField$1(this, "_configuration", null);
|
|
841
|
-
this.canvas = canvas;
|
|
842
|
-
}
|
|
843
|
-
configure(configuration) {
|
|
844
|
-
this._configuration = configuration;
|
|
845
|
-
}
|
|
846
|
-
unconfigure() {
|
|
847
|
-
this._configuration = null;
|
|
848
|
-
}
|
|
849
|
-
getCurrentTexture() {
|
|
850
|
-
const width = this.canvas instanceof HTMLCanvasElement ? this.canvas.width : this.canvas.width;
|
|
851
|
-
const height = this.canvas instanceof HTMLCanvasElement ? this.canvas.height : this.canvas.height;
|
|
852
|
-
return new MockGPUTexture({
|
|
853
|
-
size: { width, height },
|
|
854
|
-
format: this._configuration?.format ?? "bgra8unorm",
|
|
855
|
-
usage: GPUTextureUsage.RENDER_ATTACHMENT
|
|
856
|
-
});
|
|
1195
|
+
// WebGPURenderer's WebGL2 fallback backend lists the supported extensions up front and checks
|
|
1196
|
+
// them with `.includes()`, so this has to return an array rather than the no-op stub's undefined
|
|
1197
|
+
getSupportedExtensions() {
|
|
1198
|
+
return Object.keys(extensions);
|
|
857
1199
|
}
|
|
858
1200
|
}
|
|
859
1201
|
|
|
@@ -1043,6 +1385,7 @@ const createVirtualInstance = (object, parent) => {
|
|
|
1043
1385
|
object,
|
|
1044
1386
|
eventCount: 0,
|
|
1045
1387
|
handlers: {},
|
|
1388
|
+
previousVisible: void 0,
|
|
1046
1389
|
isHidden: false
|
|
1047
1390
|
};
|
|
1048
1391
|
if (object.children && object.children.length > 0) {
|
|
@@ -1214,15 +1557,16 @@ const index$1 = {
|
|
|
1214
1557
|
ReactThreeTestInstance: ReactThreeTestInstance
|
|
1215
1558
|
};
|
|
1216
1559
|
|
|
1560
|
+
mockWebGPU();
|
|
1217
1561
|
const renderer = createTestRenderer({
|
|
1218
1562
|
createRoot,
|
|
1219
1563
|
mockRoots: _roots,
|
|
1220
1564
|
reconciler,
|
|
1221
1565
|
act,
|
|
1222
|
-
mode: "
|
|
1223
|
-
// The root entry renders with
|
|
1566
|
+
mode: "webgpu"
|
|
1567
|
+
// The root entry renders with WebGPURenderer
|
|
1224
1568
|
});
|
|
1225
1569
|
const { create } = renderer;
|
|
1226
1570
|
const index = { create, act, waitFor };
|
|
1227
1571
|
|
|
1228
|
-
export { index$1 as ReactThreeTest, create, index as default, waitFor };
|
|
1572
|
+
export { index$1 as ReactThreeTest, create, index as default, mockWebGPU, unmockWebGPU, waitFor };
|
package/dist/legacy.cjs
CHANGED
|
@@ -802,6 +802,11 @@ class WebGL2RenderingContext {
|
|
|
802
802
|
getExtension(ext) {
|
|
803
803
|
return extensions[ext];
|
|
804
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
|
+
}
|
|
805
810
|
}
|
|
806
811
|
|
|
807
812
|
var __defProp$1 = Object.defineProperty;
|
|
@@ -1046,6 +1051,7 @@ const createVirtualInstance = (object, parent) => {
|
|
|
1046
1051
|
object,
|
|
1047
1052
|
eventCount: 0,
|
|
1048
1053
|
handlers: {},
|
|
1054
|
+
previousVisible: void 0,
|
|
1049
1055
|
isHidden: false
|
|
1050
1056
|
};
|
|
1051
1057
|
if (object.children && object.children.length > 0) {
|
package/dist/legacy.mjs
CHANGED
|
@@ -799,6 +799,11 @@ class WebGL2RenderingContext {
|
|
|
799
799
|
getExtension(ext) {
|
|
800
800
|
return extensions[ext];
|
|
801
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
|
+
}
|
|
802
807
|
}
|
|
803
808
|
|
|
804
809
|
var __defProp$1 = Object.defineProperty;
|
|
@@ -1043,6 +1048,7 @@ const createVirtualInstance = (object, parent) => {
|
|
|
1043
1048
|
object,
|
|
1044
1049
|
eventCount: 0,
|
|
1045
1050
|
handlers: {},
|
|
1051
|
+
previousVisible: void 0,
|
|
1046
1052
|
isHidden: false
|
|
1047
1053
|
};
|
|
1048
1054
|
if (object.children && object.children.length > 0) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-three/test-renderer",
|
|
3
|
-
"version": "10.0.0-canary.
|
|
3
|
+
"version": "10.0.0-canary.f744c1e",
|
|
4
4
|
"description": "Test Renderer for react-three-fiber",
|
|
5
5
|
"author": "Josh Ellis",
|
|
6
6
|
"license": "MIT",
|
|
@@ -19,11 +19,6 @@
|
|
|
19
19
|
"import": "./dist/legacy.mjs",
|
|
20
20
|
"require": "./dist/legacy.cjs"
|
|
21
21
|
},
|
|
22
|
-
"./webgpu": {
|
|
23
|
-
"types": "./dist/webgpu/index.d.ts",
|
|
24
|
-
"import": "./dist/webgpu/index.mjs",
|
|
25
|
-
"require": "./dist/webgpu/index.cjs"
|
|
26
|
-
},
|
|
27
22
|
"./package.json": "./package.json"
|
|
28
23
|
},
|
|
29
24
|
"bugs": {
|
|
@@ -47,8 +42,8 @@
|
|
|
47
42
|
"devDependencies": {
|
|
48
43
|
"@webgpu/types": "^0.1.64",
|
|
49
44
|
"three": ">=0.185.0",
|
|
50
|
-
"@react-three/fiber": "10.0.0-canary.
|
|
51
|
-
"@react-three/tsl": "10.0.0-canary.
|
|
45
|
+
"@react-three/fiber": "10.0.0-canary.f744c1e",
|
|
46
|
+
"@react-three/tsl": "10.0.0-canary.f744c1e"
|
|
52
47
|
},
|
|
53
48
|
"files": [
|
|
54
49
|
"dist",
|