@flighthq/render-wgpu 0.5.0-next.1944.cd6b6e7 → 0.5.1-edge.638.d4dbd4e
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 +2 -2
- package/dist/contract.d.ts +3 -0
- package/dist/contract.d.ts.map +1 -1
- package/dist/contract.js +3 -0
- package/dist/contract.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/wgpuAntialias.d.ts +8 -4
- package/dist/wgpuAntialias.d.ts.map +1 -1
- package/dist/wgpuAntialias.js +23 -4
- package/dist/wgpuAntialias.js.map +1 -1
- package/dist/wgpuBackground.d.ts +10 -4
- package/dist/wgpuBackground.d.ts.map +1 -1
- package/dist/wgpuBackground.js +87 -3
- package/dist/wgpuBackground.js.map +1 -1
- package/dist/wgpuCompressedTexture.js +9 -9
- package/dist/wgpuCompressedTexture.js.map +1 -1
- package/dist/wgpuDeviceLoss.d.ts +21 -0
- package/dist/wgpuDeviceLoss.d.ts.map +1 -0
- package/dist/wgpuDeviceLoss.js +62 -0
- package/dist/wgpuDeviceLoss.js.map +1 -0
- package/dist/wgpuDraw.d.ts +0 -1
- package/dist/wgpuDraw.d.ts.map +1 -1
- package/dist/wgpuDraw.js +73 -96
- package/dist/wgpuDraw.js.map +1 -1
- package/dist/wgpuElement.d.ts +5 -0
- package/dist/wgpuElement.d.ts.map +1 -1
- package/dist/wgpuElement.js +17 -6
- package/dist/wgpuElement.js.map +1 -1
- package/dist/wgpuExternalTexture.d.ts.map +1 -1
- package/dist/wgpuExternalTexture.js +12 -11
- package/dist/wgpuExternalTexture.js.map +1 -1
- package/dist/wgpuFullscreenPass.js +1 -1
- package/dist/wgpuFullscreenPass.js.map +1 -1
- package/dist/wgpuHost.d.ts +7 -0
- package/dist/wgpuHost.d.ts.map +1 -0
- package/dist/wgpuHost.js +80 -0
- package/dist/wgpuHost.js.map +1 -0
- package/dist/wgpuMipmap.js +3 -3
- package/dist/wgpuMipmap.js.map +1 -1
- package/dist/wgpuPipeline.d.ts +5 -0
- package/dist/wgpuPipeline.d.ts.map +1 -0
- package/dist/wgpuPipeline.js +29 -0
- package/dist/wgpuPipeline.js.map +1 -0
- package/dist/wgpuRenderState.d.ts +13 -6
- package/dist/wgpuRenderState.d.ts.map +1 -1
- package/dist/wgpuRenderState.js +220 -271
- package/dist/wgpuRenderState.js.map +1 -1
- package/dist/wgpuRenderTarget.d.ts.map +1 -1
- package/dist/wgpuRenderTarget.js +6 -5
- package/dist/wgpuRenderTarget.js.map +1 -1
- package/dist/wgpuRenderTexture.js +4 -4
- package/dist/wgpuRenderTexture.js.map +1 -1
- package/dist/wgpuShader.d.ts.map +1 -1
- package/dist/wgpuShader.js +6 -4
- package/dist/wgpuShader.js.map +1 -1
- package/dist/wgpuSurface.d.ts +5 -5
- package/dist/wgpuSurface.d.ts.map +1 -1
- package/dist/wgpuSurface.js +2 -2
- package/dist/wgpuSurface.js.map +1 -1
- package/dist/wgpuTestHelper.d.ts +2 -2
- package/dist/wgpuTestHelper.d.ts.map +1 -1
- package/dist/wgpuTestHelper.js +6 -2
- package/dist/wgpuTestHelper.js.map +1 -1
- package/package.json +11 -11
- package/src/wgpuAntialias.test.ts +26 -4
- package/src/wgpuBackground.test.ts +43 -73
- package/src/wgpuDeviceLoss.test.ts +240 -0
- package/src/wgpuDraw.test.ts +99 -24
- package/src/wgpuElement.test.ts +127 -13
- package/src/wgpuHost.test.ts +227 -0
- package/src/wgpuMaterialRegistry.test.ts +6 -3
- package/src/wgpuMipmap.test.ts +3 -3
- package/src/wgpuPipeline.test.ts +52 -0
- package/src/wgpuRenderState.test.ts +679 -88
- package/src/wgpuRenderTarget.test.ts +12 -8
- package/src/wgpuRenderTexture.test.ts +1 -1
- package/src/wgpuShader.test.ts +2 -2
|
@@ -2,6 +2,7 @@ import { createMatrix } from '@flighthq/geometry/contract';
|
|
|
2
2
|
import type { WgpuRenderTarget } from '@flighthq/types/contract';
|
|
3
3
|
|
|
4
4
|
import { renderWgpuBackground, submitWgpuRenderPass } from './wgpuBackground';
|
|
5
|
+
import { resolveWgpuSmoothingBindGroup } from './wgpuDraw';
|
|
5
6
|
import { getWgpuRenderStateRuntime } from './wgpuRenderState';
|
|
6
7
|
import {
|
|
7
8
|
getWgpuRenderTargetSupersampleScale,
|
|
@@ -49,12 +50,12 @@ describe('beginWgpuRenderPass', () => {
|
|
|
49
50
|
});
|
|
50
51
|
|
|
51
52
|
describe('createWgpuRenderTarget', () => {
|
|
52
|
-
it('returns a target with texture, view,
|
|
53
|
+
it('returns a target with texture, view, binding cache, and depth-stencil', async () => {
|
|
53
54
|
const state = await createWgpuRenderStateForTest();
|
|
54
55
|
const target = createWgpuRenderTarget(state, 256, 256);
|
|
55
56
|
expect(target.texture).toBeDefined();
|
|
56
57
|
expect(target.view).toBeDefined();
|
|
57
|
-
expect(target.
|
|
58
|
+
expect(target.bindings).toBeDefined();
|
|
58
59
|
expect(target.depthStencilTexture).toBeDefined();
|
|
59
60
|
expect(target.width).toBe(256);
|
|
60
61
|
expect(target.height).toBe(256);
|
|
@@ -200,24 +201,27 @@ describe('resizeWgpuRenderTarget', () => {
|
|
|
200
201
|
const target = createWgpuRenderTarget(state, 64, 64);
|
|
201
202
|
const texture = target.texture;
|
|
202
203
|
const depthStencilTexture = target.depthStencilTexture;
|
|
203
|
-
const
|
|
204
|
+
const sampler = getWgpuRenderStateRuntime(state).context.linearSampler;
|
|
205
|
+
const bindGroup = resolveWgpuSmoothingBindGroup(state, target, true);
|
|
204
206
|
|
|
205
207
|
resizeWgpuRenderTarget(state, target, 64, 64);
|
|
206
208
|
|
|
207
209
|
expect(target.texture).toBe(texture);
|
|
208
210
|
expect(target.depthStencilTexture).toBe(depthStencilTexture);
|
|
209
|
-
|
|
211
|
+
// The view survived, so its cached bindings must survive with it.
|
|
212
|
+
expect(target.bindings.get(sampler)).toBe(bindGroup);
|
|
210
213
|
});
|
|
211
214
|
|
|
212
|
-
it('updates width, height, and
|
|
215
|
+
it('updates width, height, and drops bindings that referenced the old view', async () => {
|
|
213
216
|
const state = await createWgpuRenderStateForTest();
|
|
214
217
|
const target = createWgpuRenderTarget(state, 64, 64);
|
|
215
|
-
const previousBindGroup = target
|
|
218
|
+
const previousBindGroup = resolveWgpuSmoothingBindGroup(state, target, true);
|
|
216
219
|
resizeWgpuRenderTarget(state, target, 200, 150);
|
|
217
220
|
expect(target.width).toBe(200);
|
|
218
221
|
expect(target.height).toBe(150);
|
|
219
|
-
|
|
220
|
-
expect(target.
|
|
222
|
+
// Reallocation replaces the view, so every binding over the old one is dropped and rebuilt.
|
|
223
|
+
expect(target.bindings.size).toBe(0);
|
|
224
|
+
expect(resolveWgpuSmoothingBindGroup(state, target, true)).not.toBe(previousBindGroup);
|
|
221
225
|
});
|
|
222
226
|
|
|
223
227
|
it('reallocates when the effective sample count changes', async () => {
|
|
@@ -61,7 +61,7 @@ describe('destroyWgpuRenderTexture', () => {
|
|
|
61
61
|
const renderTexture = texture();
|
|
62
62
|
renderWgpuBackground(state);
|
|
63
63
|
renderIntoWgpuRenderTexture(state, renderTexture, () => {});
|
|
64
|
-
const entry = getWgpuRenderStateRuntime(state).wgpuRenderTextureCache!.get(renderTexture)!;
|
|
64
|
+
const entry = getWgpuRenderStateRuntime(state).context.wgpuRenderTextureCache!.get(renderTexture)!;
|
|
65
65
|
const destroy = vi.spyOn(entry.target.texture, 'destroy');
|
|
66
66
|
|
|
67
67
|
destroyWgpuRenderTexture(state, renderTexture);
|
package/src/wgpuShader.test.ts
CHANGED
|
@@ -34,8 +34,8 @@ describe('createWgpuPipelineLayout', () => {
|
|
|
34
34
|
const runtime = getWgpuRenderStateRuntime(state);
|
|
35
35
|
const layout = createWgpuPipelineLayout(
|
|
36
36
|
state.device,
|
|
37
|
-
runtime.uniformBindGroupLayout,
|
|
38
|
-
runtime.textureBindGroupLayout,
|
|
37
|
+
runtime.context.uniformBindGroupLayout,
|
|
38
|
+
runtime.context.textureBindGroupLayout,
|
|
39
39
|
);
|
|
40
40
|
expect(layout).toBeDefined();
|
|
41
41
|
});
|