Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 41 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ permissions:
contents: read

jobs:
test-node:
test-coverage:
runs-on: ubuntu-22.04
permissions:
checks: write
Expand Down Expand Up @@ -62,6 +62,46 @@ jobs:
github-token: ${{ secrets.GITHUB_TOKEN }}
fail-on-error: false

test-webgpu:
runs-on: ubuntu-22.04
permissions:
checks: write
contents: read

steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0

- name: Setup Node.js
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version-file: '.nvmrc'
cache: 'yarn'

- name: Enable Corepack
run: corepack enable yarn

- name: Install dependencies
run: yarn bootstrap

- name: Build packages
run: yarn build

- name: Run WebGPU tests
run: xvfb-run -a --server-args="-screen 0 1280x1024x24" yarn test-webgpu

- name: Upload render test failure images
if: failure()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: webgpu-render-test-failures
path: |
test/render/golden-images/*-fail.png
test/render/golden-images/*-diff.png
test/render/golden-images/**/*-fail.png
test/render/golden-images/**/*-diff.png
if-no-files-found: ignore
retention-days: 7

test-website:
runs-on: ubuntu-22.04
permissions:
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
"test-fast": "ocular-lint && ocular-test node",
"test-headless": "ocular-test headless",
"test-render": "ocular-test render",
"test-ci": "ocular-test node headless render --coverage",
"test-webgpu": "RENDER_TEST_DEVICE=webgpu ocular-test render",
"test-ci": "RENDER_TEST_DEVICE=webgl ocular-test node headless render --coverage",
"test-browser": "ocular-test browser",
"test-tape-compat": "ocular-test tape-compat",
"test-website": "cd website && yarn && yarn test-build && cd ..",
Expand Down
14 changes: 13 additions & 1 deletion test/modules/core/lib/attribute/attribute-buffer-groups.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ let webgpuDevice: Device;
beforeAll(async () => {
const testDevice = await getWebGPUTestDevice();
if (!testDevice) {
throw new Error('Attribute buffer group tests require WebGPU');
return;
}
webgpuDevice = testDevice;
});
Expand Down Expand Up @@ -64,6 +64,8 @@ test('AttributeManager buffer groups are ignored on WebGL', () => {
});

test('AttributeManager without groups keeps WebGPU layouts unchanged', () => {
if (!webgpuDevice) return;

const attributeManager = new AttributeManager(webgpuDevice);
attributeManager.addInstanced({
a: {size: 1, accessor: 'getA'},
Expand All @@ -83,6 +85,8 @@ test('AttributeManager without groups keeps WebGPU layouts unchanged', () => {
});

test('AttributeManager buffer groups pack IconLayer-style shader attributes', async () => {
if (!webgpuDevice) return;

const attributeManager = new AttributeManager(webgpuDevice);
attributeManager.addInstanced({
a: {size: 1, accessor: 'getA', bufferGroup: 'group-a'},
Expand Down Expand Up @@ -203,6 +207,8 @@ test('AttributeManager buffer groups pack IconLayer-style shader attributes', as
});

test('AttributeManager buffer groups are shared across model step modes', () => {
if (!webgpuDevice) return;

const attributeManager = new AttributeManager(webgpuDevice);
attributeManager.add({
a: {size: 1, stepMode: 'dynamic', accessor: 'getA', bufferGroup: 'group-a'},
Expand Down Expand Up @@ -233,6 +239,8 @@ test('AttributeManager buffer groups are shared across model step modes', () =>
});

test('AttributeManager buffer groups fall back for transitions and external buffers', () => {
if (!webgpuDevice) return;

const testDevice = webgpuDevice;
const attributeManager = new AttributeManager(testDevice);
addSimpleGroup(attributeManager);
Expand Down Expand Up @@ -291,6 +299,8 @@ test('AttributeManager buffer groups fall back for transitions and external buff
});

test('Layer grouped bindings preserve legacy fallback and index binding', () => {
if (!webgpuDevice) return;

const attributeManager = new AttributeManager(webgpuDevice);
attributeManager.add({
indices: {size: 1, isIndexed: true, accessor: 'getIndex'},
Expand Down Expand Up @@ -356,6 +366,8 @@ test('Layer grouped bindings preserve legacy fallback and index binding', () =>
});

test('IconLayer opts into grouped WebGPU layouts without changing WebGL layouts', () => {
if (!webgpuDevice) return;

const getLayouts = (testDevice: Device) => {
const attributeManager = new AttributeManager(testDevice);
const layer = new IconLayer({id: 'icon-layer', data: []});
Expand Down
Loading