quake2ts 0.0.579 → 0.0.581
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/package.json +1 -1
- package/packages/test-utils/dist/index.cjs +242 -147
- package/packages/test-utils/dist/index.cjs.map +1 -1
- package/packages/test-utils/dist/index.d.cts +146 -2
- package/packages/test-utils/dist/index.d.ts +146 -2
- package/packages/test-utils/dist/index.js +241 -147
- package/packages/test-utils/dist/index.js.map +1 -1
package/package.json
CHANGED
|
@@ -34,6 +34,7 @@ __export(index_exports, {
|
|
|
34
34
|
InputInjector: () => InputInjector,
|
|
35
35
|
MockPointerLock: () => MockPointerLock,
|
|
36
36
|
MockTransport: () => MockTransport,
|
|
37
|
+
MockWebGL2RenderingContext: () => MockWebGL2RenderingContext,
|
|
37
38
|
captureAudioEvents: () => captureAudioEvents,
|
|
38
39
|
captureCanvasDrawCalls: () => captureCanvasDrawCalls,
|
|
39
40
|
captureGameScreenshot: () => captureGameScreenshot,
|
|
@@ -1656,128 +1657,221 @@ function createInputInjector(target) {
|
|
|
1656
1657
|
return new InputInjector(doc, win);
|
|
1657
1658
|
}
|
|
1658
1659
|
|
|
1659
|
-
// src/
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
RGBA
|
|
1681
|
-
UNSIGNED_BYTE
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
enable
|
|
1720
|
-
}
|
|
1721
|
-
|
|
1722
|
-
}
|
|
1723
|
-
depthMask
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
}
|
|
1731
|
-
|
|
1732
|
-
}
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
}
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
}
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
}
|
|
1754
|
-
getUniformLocation
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
}
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
}
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
}
|
|
1771
|
-
|
|
1772
|
-
}
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
}
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1660
|
+
// src/engine/mocks/webgl.ts
|
|
1661
|
+
var import_vitest10 = require("vitest");
|
|
1662
|
+
var MockWebGL2RenderingContext = class {
|
|
1663
|
+
constructor(canvas) {
|
|
1664
|
+
this.ARRAY_BUFFER = 34962;
|
|
1665
|
+
this.ELEMENT_ARRAY_BUFFER = 34963;
|
|
1666
|
+
this.STATIC_DRAW = 35044;
|
|
1667
|
+
this.DYNAMIC_DRAW = 35048;
|
|
1668
|
+
this.FLOAT = 5126;
|
|
1669
|
+
this.UNSIGNED_SHORT = 5123;
|
|
1670
|
+
this.TEXTURE_2D = 3553;
|
|
1671
|
+
this.TEXTURE_CUBE_MAP = 34067;
|
|
1672
|
+
this.TEXTURE_CUBE_MAP_POSITIVE_X = 34069;
|
|
1673
|
+
this.TEXTURE0 = 33984;
|
|
1674
|
+
this.TEXTURE_WRAP_S = 10242;
|
|
1675
|
+
this.TEXTURE_WRAP_T = 10243;
|
|
1676
|
+
this.TEXTURE_MIN_FILTER = 10241;
|
|
1677
|
+
this.TEXTURE_MAG_FILTER = 10240;
|
|
1678
|
+
this.LINEAR = 9729;
|
|
1679
|
+
this.NEAREST = 9728;
|
|
1680
|
+
this.CLAMP_TO_EDGE = 33071;
|
|
1681
|
+
this.RGBA = 6408;
|
|
1682
|
+
this.UNSIGNED_BYTE = 5121;
|
|
1683
|
+
this.FRAMEBUFFER = 36160;
|
|
1684
|
+
this.COLOR_ATTACHMENT0 = 36064;
|
|
1685
|
+
this.DEPTH_ATTACHMENT = 36096;
|
|
1686
|
+
this.RENDERBUFFER = 36161;
|
|
1687
|
+
this.DEPTH_COMPONENT24 = 33190;
|
|
1688
|
+
this.FRAMEBUFFER_COMPLETE = 36053;
|
|
1689
|
+
this.TRIANGLES = 4;
|
|
1690
|
+
this.DEPTH_TEST = 2929;
|
|
1691
|
+
this.CULL_FACE = 2884;
|
|
1692
|
+
this.BLEND = 3042;
|
|
1693
|
+
this.SRC_ALPHA = 770;
|
|
1694
|
+
this.ONE_MINUS_SRC_ALPHA = 771;
|
|
1695
|
+
this.ONE = 1;
|
|
1696
|
+
this.BACK = 1029;
|
|
1697
|
+
this.LEQUAL = 515;
|
|
1698
|
+
this.VERTEX_SHADER = 35633;
|
|
1699
|
+
this.FRAGMENT_SHADER = 35632;
|
|
1700
|
+
this.COMPILE_STATUS = 35713;
|
|
1701
|
+
this.LINK_STATUS = 35714;
|
|
1702
|
+
this.ONE_MINUS_SRC_COLOR = 769;
|
|
1703
|
+
this.TRIANGLE_STRIP = 5;
|
|
1704
|
+
this.QUERY_RESULT_AVAILABLE = 34919;
|
|
1705
|
+
this.QUERY_RESULT = 34918;
|
|
1706
|
+
// Constants commonly used in setup/webgl.ts
|
|
1707
|
+
this.TRIANGLE_FAN = 6;
|
|
1708
|
+
this.COLOR_BUFFER_BIT = 16384;
|
|
1709
|
+
this.DEPTH_BUFFER_BIT = 256;
|
|
1710
|
+
this.shaderCounter = 0;
|
|
1711
|
+
this.programCounter = 0;
|
|
1712
|
+
this.compileSucceeds = true;
|
|
1713
|
+
this.linkSucceeds = true;
|
|
1714
|
+
this.shaderInfoLog = "shader failed";
|
|
1715
|
+
this.programInfoLog = "program failed";
|
|
1716
|
+
this.extensions = /* @__PURE__ */ new Map();
|
|
1717
|
+
this.calls = [];
|
|
1718
|
+
this.uniformLocations = /* @__PURE__ */ new Map();
|
|
1719
|
+
this.attributeLocations = /* @__PURE__ */ new Map();
|
|
1720
|
+
this.enable = import_vitest10.vi.fn((cap) => this.calls.push(`enable:${cap}`));
|
|
1721
|
+
this.disable = import_vitest10.vi.fn((cap) => this.calls.push(`disable:${cap}`));
|
|
1722
|
+
this.depthFunc = import_vitest10.vi.fn((func) => this.calls.push(`depthFunc:${func}`));
|
|
1723
|
+
this.cullFace = import_vitest10.vi.fn((mode) => this.calls.push(`cullFace:${mode}`));
|
|
1724
|
+
this.depthMask = import_vitest10.vi.fn((flag) => this.calls.push(`depthMask:${flag}`));
|
|
1725
|
+
this.blendFuncSeparate = import_vitest10.vi.fn(
|
|
1726
|
+
(srcRGB, dstRGB, srcAlpha, dstAlpha) => this.calls.push(`blendFuncSeparate:${srcRGB}:${dstRGB}:${srcAlpha}:${dstAlpha}`)
|
|
1727
|
+
);
|
|
1728
|
+
this.blendFunc = import_vitest10.vi.fn((sfactor, dfactor) => this.calls.push(`blendFunc:${sfactor}:${dfactor}`));
|
|
1729
|
+
this.getExtension = import_vitest10.vi.fn((name) => this.extensions.get(name) ?? null);
|
|
1730
|
+
this.viewport = import_vitest10.vi.fn((x, y, w, h) => this.calls.push(`viewport:${x}:${y}:${w}:${h}`));
|
|
1731
|
+
this.clear = import_vitest10.vi.fn((mask) => this.calls.push(`clear:${mask}`));
|
|
1732
|
+
this.clearColor = import_vitest10.vi.fn((r, g, b, a) => this.calls.push(`clearColor:${r}:${g}:${b}:${a}`));
|
|
1733
|
+
this.createShader = import_vitest10.vi.fn((type) => ({ id: ++this.shaderCounter, type }));
|
|
1734
|
+
this.shaderSource = import_vitest10.vi.fn((shader, source) => this.calls.push(`shaderSource:${shader.id}:${source}`));
|
|
1735
|
+
this.compileShader = import_vitest10.vi.fn((shader) => this.calls.push(`compileShader:${shader.id}`));
|
|
1736
|
+
this.getShaderParameter = import_vitest10.vi.fn(
|
|
1737
|
+
(shader, pname) => pname === this.COMPILE_STATUS ? this.compileSucceeds : null
|
|
1738
|
+
);
|
|
1739
|
+
this.getShaderInfoLog = import_vitest10.vi.fn(() => this.compileSucceeds ? "" : this.shaderInfoLog);
|
|
1740
|
+
this.deleteShader = import_vitest10.vi.fn((shader) => this.calls.push(`deleteShader:${shader.id}`));
|
|
1741
|
+
this.createProgram = import_vitest10.vi.fn(() => ({ id: ++this.programCounter }));
|
|
1742
|
+
this.attachShader = import_vitest10.vi.fn(
|
|
1743
|
+
(program, shader) => this.calls.push(`attach:${program.id}:${shader.id}`)
|
|
1744
|
+
);
|
|
1745
|
+
this.bindAttribLocation = import_vitest10.vi.fn(
|
|
1746
|
+
(program, index, name) => this.calls.push(`bindAttribLocation:${program.id}:${index}:${name}`)
|
|
1747
|
+
);
|
|
1748
|
+
this.linkProgram = import_vitest10.vi.fn((program) => this.calls.push(`link:${program.id}`));
|
|
1749
|
+
this.getProgramParameter = import_vitest10.vi.fn(
|
|
1750
|
+
(program, pname) => pname === this.LINK_STATUS ? this.linkSucceeds : null
|
|
1751
|
+
);
|
|
1752
|
+
this.getProgramInfoLog = import_vitest10.vi.fn(() => this.linkSucceeds ? "" : this.programInfoLog);
|
|
1753
|
+
this.deleteProgram = import_vitest10.vi.fn((program) => this.calls.push(`deleteProgram:${program.id}`));
|
|
1754
|
+
this.useProgram = import_vitest10.vi.fn((program) => this.calls.push(`useProgram:${program?.id ?? "null"}`));
|
|
1755
|
+
this.getUniformLocation = import_vitest10.vi.fn((program, name) => {
|
|
1756
|
+
this.calls.push(`getUniformLocation:${program.id}:${name}`);
|
|
1757
|
+
return this.uniformLocations.get(name) ?? null;
|
|
1758
|
+
});
|
|
1759
|
+
this.getAttribLocation = import_vitest10.vi.fn((program, name) => {
|
|
1760
|
+
this.calls.push(`getAttribLocation:${program.id}:${name}`);
|
|
1761
|
+
return this.attributeLocations.get(name) ?? -1;
|
|
1762
|
+
});
|
|
1763
|
+
this.createBuffer = import_vitest10.vi.fn(() => ({ buffer: {} }));
|
|
1764
|
+
this.bindBuffer = import_vitest10.vi.fn((target, buffer) => this.calls.push(`bindBuffer:${target}:${!!buffer}`));
|
|
1765
|
+
this.bufferData = import_vitest10.vi.fn(
|
|
1766
|
+
(target, data, usage) => this.calls.push(`bufferData:${target}:${usage}:${typeof data === "number" ? data : "data"}`)
|
|
1767
|
+
);
|
|
1768
|
+
this.bufferSubData = import_vitest10.vi.fn(
|
|
1769
|
+
(target, offset, data) => this.calls.push(`bufferSubData:${target}:${offset}:${data.byteLength ?? "len"}`)
|
|
1770
|
+
);
|
|
1771
|
+
this.deleteBuffer = import_vitest10.vi.fn((buffer) => this.calls.push(`deleteBuffer:${!!buffer}`));
|
|
1772
|
+
this.createVertexArray = import_vitest10.vi.fn(() => ({ vao: {} }));
|
|
1773
|
+
this.bindVertexArray = import_vitest10.vi.fn((vao) => this.calls.push(`bindVertexArray:${!!vao}`));
|
|
1774
|
+
this.enableVertexAttribArray = import_vitest10.vi.fn((index) => this.calls.push(`enableAttrib:${index}`));
|
|
1775
|
+
this.vertexAttribPointer = import_vitest10.vi.fn(
|
|
1776
|
+
(index, size, type, normalized, stride, offset) => this.calls.push(`vertexAttribPointer:${index}:${size}:${type}:${normalized}:${stride}:${offset}`)
|
|
1777
|
+
);
|
|
1778
|
+
this.vertexAttribDivisor = import_vitest10.vi.fn((index, divisor) => this.calls.push(`divisor:${index}:${divisor}`));
|
|
1779
|
+
this.deleteVertexArray = import_vitest10.vi.fn((vao) => this.calls.push(`deleteVertexArray:${!!vao}`));
|
|
1780
|
+
this.createTexture = import_vitest10.vi.fn(() => ({ texture: {} }));
|
|
1781
|
+
this.activeTexture = import_vitest10.vi.fn((unit) => this.calls.push(`activeTexture:${unit}`));
|
|
1782
|
+
this.bindTexture = import_vitest10.vi.fn((target, texture) => this.calls.push(`bindTexture:${target}:${!!texture}`));
|
|
1783
|
+
this.texParameteri = import_vitest10.vi.fn(
|
|
1784
|
+
(target, pname, param) => this.calls.push(`texParameteri:${target}:${pname}:${param}`)
|
|
1785
|
+
);
|
|
1786
|
+
this.texImage2D = import_vitest10.vi.fn(
|
|
1787
|
+
(target, level, internalFormat, width, height, border, format, type, pixels) => this.calls.push(
|
|
1788
|
+
`texImage2D:${target}:${level}:${internalFormat}:${width}:${height}:${border}:${format}:${type}:${pixels ? "data" : "null"}`
|
|
1789
|
+
)
|
|
1790
|
+
);
|
|
1791
|
+
this.texImage3D = import_vitest10.vi.fn();
|
|
1792
|
+
// Stub for compatibility
|
|
1793
|
+
this.deleteTexture = import_vitest10.vi.fn((texture) => this.calls.push(`deleteTexture:${!!texture}`));
|
|
1794
|
+
this.createFramebuffer = import_vitest10.vi.fn(() => ({ fb: {} }));
|
|
1795
|
+
this.bindFramebuffer = import_vitest10.vi.fn(
|
|
1796
|
+
(target, framebuffer) => this.calls.push(`bindFramebuffer:${target}:${!!framebuffer}`)
|
|
1797
|
+
);
|
|
1798
|
+
this.framebufferTexture2D = import_vitest10.vi.fn(
|
|
1799
|
+
(target, attachment, textarget, texture, level) => this.calls.push(`framebufferTexture2D:${target}:${attachment}:${textarget}:${!!texture}:${level}`)
|
|
1800
|
+
);
|
|
1801
|
+
this.deleteFramebuffer = import_vitest10.vi.fn((fb) => this.calls.push(`deleteFramebuffer:${!!fb}`));
|
|
1802
|
+
this.checkFramebufferStatus = import_vitest10.vi.fn((target) => this.FRAMEBUFFER_COMPLETE);
|
|
1803
|
+
this.createRenderbuffer = import_vitest10.vi.fn(() => ({ rb: {} }));
|
|
1804
|
+
this.bindRenderbuffer = import_vitest10.vi.fn(
|
|
1805
|
+
(target, renderbuffer) => this.calls.push(`bindRenderbuffer:${target}:${!!renderbuffer}`)
|
|
1806
|
+
);
|
|
1807
|
+
this.renderbufferStorage = import_vitest10.vi.fn(
|
|
1808
|
+
(target, internalformat, width, height) => this.calls.push(`renderbufferStorage:${target}:${internalformat}:${width}:${height}`)
|
|
1809
|
+
);
|
|
1810
|
+
this.framebufferRenderbuffer = import_vitest10.vi.fn(
|
|
1811
|
+
(target, attachment, renderbuffertarget, renderbuffer) => this.calls.push(`framebufferRenderbuffer:${target}:${attachment}:${renderbuffertarget}:${!!renderbuffer}`)
|
|
1812
|
+
);
|
|
1813
|
+
this.deleteRenderbuffer = import_vitest10.vi.fn((rb) => this.calls.push(`deleteRenderbuffer:${!!rb}`));
|
|
1814
|
+
this.drawArrays = import_vitest10.vi.fn(
|
|
1815
|
+
(mode, first, count) => this.calls.push(`drawArrays:${mode}:${first}:${count}`)
|
|
1816
|
+
);
|
|
1817
|
+
this.drawElements = import_vitest10.vi.fn(
|
|
1818
|
+
(mode, count, type, offset) => this.calls.push(`drawElements:${mode}:${count}:${type}:${offset}`)
|
|
1819
|
+
);
|
|
1820
|
+
// Queries
|
|
1821
|
+
this.createQuery = import_vitest10.vi.fn(() => ({}));
|
|
1822
|
+
this.beginQuery = import_vitest10.vi.fn();
|
|
1823
|
+
this.endQuery = import_vitest10.vi.fn();
|
|
1824
|
+
this.deleteQuery = import_vitest10.vi.fn();
|
|
1825
|
+
this.getQueryParameter = import_vitest10.vi.fn();
|
|
1826
|
+
this.getParameter = import_vitest10.vi.fn();
|
|
1827
|
+
this.uniform1f = import_vitest10.vi.fn(
|
|
1828
|
+
(location, x) => this.calls.push(`uniform1f:${location ? "set" : "null"}:${x}`)
|
|
1829
|
+
);
|
|
1830
|
+
this.uniform1i = import_vitest10.vi.fn(
|
|
1831
|
+
(location, x) => this.calls.push(`uniform1i:${location ? "set" : "null"}:${x}`)
|
|
1832
|
+
);
|
|
1833
|
+
this.uniform4f = import_vitest10.vi.fn(
|
|
1834
|
+
(location, x, y, z, w) => this.calls.push(`uniform4f:${location ? "set" : "null"}:${x}:${y}:${z}:${w}`)
|
|
1835
|
+
);
|
|
1836
|
+
this.uniform3fv = import_vitest10.vi.fn(
|
|
1837
|
+
(location, data) => this.calls.push(`uniform3fv:${location ? "set" : "null"}:${Array.from(data).join(",")}`)
|
|
1838
|
+
);
|
|
1839
|
+
this.uniform3f = import_vitest10.vi.fn(
|
|
1840
|
+
(location, x, y, z) => this.calls.push(`uniform3f:${location ? "set" : "null"}:${x}:${y}:${z}`)
|
|
1841
|
+
);
|
|
1842
|
+
this.uniform2f = import_vitest10.vi.fn(
|
|
1843
|
+
(location, x, y) => this.calls.push(`uniform2f:${location ? "set" : "null"}:${x}:${y}`)
|
|
1844
|
+
);
|
|
1845
|
+
this.uniform4fv = import_vitest10.vi.fn(
|
|
1846
|
+
(location, data) => this.calls.push(`uniform4fv:${location ? "set" : "null"}:${Array.from(data).join(",")}`)
|
|
1847
|
+
);
|
|
1848
|
+
this.uniformMatrix4fv = import_vitest10.vi.fn(
|
|
1849
|
+
(location, transpose, data) => this.calls.push(`uniformMatrix4fv:${location ? "set" : "null"}:${transpose}:${Array.from(data).join(",")}`)
|
|
1850
|
+
);
|
|
1851
|
+
this.uniformBlockBinding = import_vitest10.vi.fn();
|
|
1852
|
+
this.isContextLost = import_vitest10.vi.fn(() => false);
|
|
1853
|
+
if (canvas) {
|
|
1854
|
+
this.canvas = canvas;
|
|
1855
|
+
this.drawingBufferWidth = canvas.width;
|
|
1856
|
+
this.drawingBufferHeight = canvas.height;
|
|
1857
|
+
} else {
|
|
1858
|
+
this.canvas = { width: 800, height: 600 };
|
|
1859
|
+
this.drawingBufferWidth = 800;
|
|
1860
|
+
this.drawingBufferHeight = 600;
|
|
1861
|
+
}
|
|
1862
|
+
}
|
|
1863
|
+
};
|
|
1864
|
+
function createMockWebGL2Context(overridesOrCanvas) {
|
|
1865
|
+
let context;
|
|
1866
|
+
if (overridesOrCanvas instanceof Object && "width" in overridesOrCanvas && "height" in overridesOrCanvas && "getContext" in overridesOrCanvas) {
|
|
1867
|
+
context = new MockWebGL2RenderingContext(overridesOrCanvas);
|
|
1868
|
+
} else {
|
|
1869
|
+
context = new MockWebGL2RenderingContext();
|
|
1870
|
+
if (overridesOrCanvas) {
|
|
1871
|
+
Object.assign(context, overridesOrCanvas);
|
|
1872
|
+
}
|
|
1873
|
+
}
|
|
1874
|
+
return context;
|
|
1781
1875
|
}
|
|
1782
1876
|
|
|
1783
1877
|
// src/setup/browser.ts
|
|
@@ -2035,10 +2129,10 @@ function createMockImage(width, height, src) {
|
|
|
2035
2129
|
}
|
|
2036
2130
|
|
|
2037
2131
|
// src/engine/mocks/webgpu.ts
|
|
2038
|
-
var
|
|
2132
|
+
var import_vitest11 = require("vitest");
|
|
2039
2133
|
function createMockGPUAdapter() {
|
|
2040
2134
|
return {
|
|
2041
|
-
requestDevice:
|
|
2135
|
+
requestDevice: import_vitest11.vi.fn().mockResolvedValue(createMockGPUDevice()),
|
|
2042
2136
|
features: /* @__PURE__ */ new Set(),
|
|
2043
2137
|
limits: {}
|
|
2044
2138
|
};
|
|
@@ -2048,40 +2142,40 @@ function createMockGPUDevice() {
|
|
|
2048
2142
|
features: /* @__PURE__ */ new Set(),
|
|
2049
2143
|
limits: {},
|
|
2050
2144
|
queue: {
|
|
2051
|
-
submit:
|
|
2052
|
-
writeBuffer:
|
|
2053
|
-
writeTexture:
|
|
2054
|
-
copyExternalImageToTexture:
|
|
2055
|
-
},
|
|
2056
|
-
createCommandEncoder:
|
|
2057
|
-
beginRenderPass:
|
|
2058
|
-
setPipeline:
|
|
2059
|
-
draw:
|
|
2060
|
-
end:
|
|
2145
|
+
submit: import_vitest11.vi.fn(),
|
|
2146
|
+
writeBuffer: import_vitest11.vi.fn(),
|
|
2147
|
+
writeTexture: import_vitest11.vi.fn(),
|
|
2148
|
+
copyExternalImageToTexture: import_vitest11.vi.fn()
|
|
2149
|
+
},
|
|
2150
|
+
createCommandEncoder: import_vitest11.vi.fn().mockReturnValue({
|
|
2151
|
+
beginRenderPass: import_vitest11.vi.fn().mockReturnValue({
|
|
2152
|
+
setPipeline: import_vitest11.vi.fn(),
|
|
2153
|
+
draw: import_vitest11.vi.fn(),
|
|
2154
|
+
end: import_vitest11.vi.fn()
|
|
2061
2155
|
}),
|
|
2062
|
-
finish:
|
|
2156
|
+
finish: import_vitest11.vi.fn()
|
|
2063
2157
|
}),
|
|
2064
|
-
createRenderPipeline:
|
|
2065
|
-
createShaderModule:
|
|
2066
|
-
createBindGroup:
|
|
2067
|
-
createBindGroupLayout:
|
|
2068
|
-
createBuffer:
|
|
2069
|
-
createTexture:
|
|
2070
|
-
createSampler:
|
|
2158
|
+
createRenderPipeline: import_vitest11.vi.fn(),
|
|
2159
|
+
createShaderModule: import_vitest11.vi.fn(),
|
|
2160
|
+
createBindGroup: import_vitest11.vi.fn(),
|
|
2161
|
+
createBindGroupLayout: import_vitest11.vi.fn(),
|
|
2162
|
+
createBuffer: import_vitest11.vi.fn(),
|
|
2163
|
+
createTexture: import_vitest11.vi.fn(),
|
|
2164
|
+
createSampler: import_vitest11.vi.fn()
|
|
2071
2165
|
};
|
|
2072
2166
|
}
|
|
2073
2167
|
function createMockGPUCanvasContext() {
|
|
2074
2168
|
return {
|
|
2075
|
-
configure:
|
|
2076
|
-
unconfigure:
|
|
2077
|
-
getCurrentTexture:
|
|
2169
|
+
configure: import_vitest11.vi.fn(),
|
|
2170
|
+
unconfigure: import_vitest11.vi.fn(),
|
|
2171
|
+
getCurrentTexture: import_vitest11.vi.fn()
|
|
2078
2172
|
};
|
|
2079
2173
|
}
|
|
2080
2174
|
function setupWebGPUMocks() {
|
|
2081
2175
|
const mockAdapter = createMockGPUAdapter();
|
|
2082
2176
|
const mockGpu = {
|
|
2083
|
-
requestAdapter:
|
|
2084
|
-
getPreferredCanvasFormat:
|
|
2177
|
+
requestAdapter: import_vitest11.vi.fn().mockResolvedValue(mockAdapter),
|
|
2178
|
+
getPreferredCanvasFormat: import_vitest11.vi.fn().mockReturnValue("bgra8unorm")
|
|
2085
2179
|
};
|
|
2086
2180
|
Object.defineProperty(global.navigator, "gpu", {
|
|
2087
2181
|
value: mockGpu,
|
|
@@ -3177,6 +3271,7 @@ function createVisualTestScenario(page, sceneName) {
|
|
|
3177
3271
|
InputInjector,
|
|
3178
3272
|
MockPointerLock,
|
|
3179
3273
|
MockTransport,
|
|
3274
|
+
MockWebGL2RenderingContext,
|
|
3180
3275
|
captureAudioEvents,
|
|
3181
3276
|
captureCanvasDrawCalls,
|
|
3182
3277
|
captureGameScreenshot,
|