Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update for deno 2.2 #19

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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
9 changes: 6 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,24 @@ on: [push, pull_request]

jobs:
check:
runs-on: ubuntu-latest
runs-on: windows-latest
steps:
- name: Clone repository
uses: actions/checkout@v3

- name: Install Deno
uses: denoland/setup-deno@v1
uses: denoland/setup-deno@v2
with:
deno-version: v1.x
deno-version: v2.x

- name: Check formatting
run: deno fmt --check
shell: "bash"

- name: Lint
run: deno lint
shell: "bash"

- name: Run
run: deno task run
shell: "bash"
Binary file modified boids/output.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 8 additions & 4 deletions framework.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { createCapture } from "std/webgpu";
export class Framework {
device: GPUDevice;
dimensions: Dimensions;
errors: GPUError[] = [];

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

device.addEventListener("uncaughterror", (e) => {
throw e.error;
});

return device;
}

constructor(dimensions: Dimensions, device: GPUDevice) {
this.dimensions = dimensions;
this.device = device;
device.addEventListener("uncapturederror", (e) => {
this.errors.push(e.error);
});
}

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

await createPng(outputBuffer, this.dimensions);

if (this.errors.length > 0) {
throw new AggregateError(this.errors, "uncaught gpu errors");
}
}
}
2 changes: 1 addition & 1 deletion run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import $ from "dax";

for await (const entry of $.path(".").readDir()) {
if (entry.isDirectory && !entry.name.startsWith(".")) {
await $`deno run --allow-read=. --allow-write=. --unstable-webgpu mod.ts`
await $`deno run --allow-read=. --allow-write=. --allow-import=deno.land,crux.land,jsr.io mod.ts`
.cwd(
entry.path,
);
Expand Down
Binary file modified shadow/output.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion shadow/shader.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ fn vs_main(
let w = u_entity.world;
let world_pos = u_entity.world * vec4<f32>(position);
var result: VertexOutput;
result.world_normal = mat3x3<f32>(w.x.xyz, w.y.xyz, w.z.xyz) * vec3<f32>(normal.xyz);
result.world_normal = mat3x3<f32>(w[0].xyz, w[1].xyz, w[2].xyz) * vec3<f32>(normal.xyz);
result.world_position = world_pos;
result.proj_position = u_globals.view_proj * world_pos;
return result;
Expand Down
Binary file modified skybox/output.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion skybox/shader.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ fn vs_sky(@builtin(vertex_index) vertex_index: u32) -> SkyOutput {
);

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

var result: SkyOutput;
Expand Down
Loading