Skip to content

Commit fbc83db

Browse files
authored
chore: update for deno 2.2 (#19)
1 parent e8498aa commit fbc83db

File tree

8 files changed

+14
-10
lines changed

8 files changed

+14
-10
lines changed

.github/workflows/ci.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ on: [push, pull_request]
44

55
jobs:
66
check:
7-
runs-on: ubuntu-latest
7+
runs-on: macos-latest
88
steps:
99
- name: Clone repository
1010
uses: actions/checkout@v3
1111

1212
- name: Install Deno
13-
uses: denoland/setup-deno@v1
13+
uses: denoland/setup-deno@v2
1414
with:
15-
deno-version: v1.x
15+
deno-version: v2.x
1616

1717
- name: Check formatting
1818
run: deno fmt --check

boids/output.png

2.25 KB
Loading

framework.ts

+8-4
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { createCapture } from "std/webgpu";
44
export class Framework {
55
device: GPUDevice;
66
dimensions: Dimensions;
7+
errors: GPUError[] = [];
78

89
static async getDevice({
910
requiredFeatures,
@@ -26,16 +27,15 @@ export class Framework {
2627
throw new Error("no suitable adapter found");
2728
}
2829

29-
device.addEventListener("uncaughterror", (e) => {
30-
throw e.error;
31-
});
32-
3330
return device;
3431
}
3532

3633
constructor(dimensions: Dimensions, device: GPUDevice) {
3734
this.dimensions = dimensions;
3835
this.device = device;
36+
device.addEventListener("uncapturederror", (e) => {
37+
this.errors.push(e.error);
38+
});
3939
}
4040

4141
async init() {}
@@ -54,5 +54,9 @@ export class Framework {
5454
this.device.queue.submit([encoder.finish()]);
5555

5656
await createPng(outputBuffer, this.dimensions);
57+
58+
if (this.errors.length > 0) {
59+
throw new AggregateError(this.errors, "uncaught gpu errors");
60+
}
5761
}
5862
}

run.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import $ from "dax";
22

33
for await (const entry of $.path(".").readDir()) {
44
if (entry.isDirectory && !entry.name.startsWith(".")) {
5-
await $`deno run --allow-read=. --allow-write=. --unstable-webgpu mod.ts`
5+
await $`deno run --allow-read=. --allow-write=. --allow-import=deno.land,crux.land,jsr.io mod.ts`
66
.cwd(
77
entry.path,
88
);

shadow/output.png

2 Bytes
Loading

shadow/shader.wgsl

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ fn vs_main(
3535
let w = u_entity.world;
3636
let world_pos = u_entity.world * vec4<f32>(position);
3737
var result: VertexOutput;
38-
result.world_normal = mat3x3<f32>(w.x.xyz, w.y.xyz, w.z.xyz) * vec3<f32>(normal.xyz);
38+
result.world_normal = mat3x3<f32>(w[0].xyz, w[1].xyz, w[2].xyz) * vec3<f32>(normal.xyz);
3939
result.world_position = world_pos;
4040
result.proj_position = u_globals.view_proj * world_pos;
4141
return result;

skybox/output.png

127 KB
Loading

skybox/shader.wgsl

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ fn vs_sky(@builtin(vertex_index) vertex_index: u32) -> SkyOutput {
3030
);
3131

3232
// transposition = inversion for this orthonormal matrix
33-
let inv_model_view = transpose(mat3x3<f32>(r_data.view.x.xyz, r_data.view.y.xyz, r_data.view.z.xyz));
33+
let inv_model_view = transpose(mat3x3<f32>(r_data.view[0].xyz, r_data.view[1].xyz, r_data.view[2].xyz));
3434
let unprojected = r_data.proj_inv * pos;
3535

3636
var result: SkyOutput;

0 commit comments

Comments
 (0)