Skip to content

Commit

Permalink
Deploying to gh-pages from @ fa7b022 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
kainino0x committed Jul 20, 2024
1 parent 6167f4a commit e1593f7
Show file tree
Hide file tree
Showing 104 changed files with 2,606 additions and 165 deletions.
71 changes: 69 additions & 2 deletions sample/a-buffer/main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion sample/a-buffer/main.js.map

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions sample/a-buffer/main.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { mat4, vec3 } from 'wgpu-matrix';
import { GUI } from 'dat.gui';

import { quitIfWebGPUNotAvailable } from '../util';
import { mesh } from '../../meshes/teapot';

import opaqueWGSL from './opaque.wgsl';
Expand All @@ -12,8 +13,9 @@ function roundUp(n: number, k: number): number {
}

const canvas = document.querySelector('canvas') as HTMLCanvasElement;
const adapter = await navigator.gpu.requestAdapter();
const device = await adapter.requestDevice();
const adapter = await navigator.gpu?.requestAdapter();
const device = await adapter?.requestDevice();
quitIfWebGPUNotAvailable(adapter, device);

const context = canvas.getContext('webgpu') as GPUCanvasContext;
const presentationFormat = navigator.gpu.getPreferredCanvasFormat();
Expand Down
71 changes: 69 additions & 2 deletions sample/animometer/main.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion sample/animometer/main.js.map

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions sample/animometer/main.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import { GUI } from 'dat.gui';
import animometerWGSL from './animometer.wgsl';
import { quitIfWebGPUNotAvailable } from '../util';

const canvas = document.querySelector('canvas') as HTMLCanvasElement;
const adapter = await navigator.gpu.requestAdapter();
const device = await adapter.requestDevice();
const adapter = await navigator.gpu?.requestAdapter();
const device = await adapter?.requestDevice();
quitIfWebGPUNotAvailable(adapter, device);

const perfDisplayContainer = document.createElement('div');
perfDisplayContainer.style.color = 'white';
Expand Down
70 changes: 69 additions & 1 deletion sample/bitonicSort/main.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion sample/bitonicSort/main.js.map

Large diffs are not rendered by default.

7 changes: 6 additions & 1 deletion sample/bitonicSort/utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { GUI } from 'dat.gui';
import fullscreenTexturedQuad from '../../shaders/fullscreenTexturedQuad.wgsl';
import { quitIfAdapterNotAvailable, quitIfWebGPUNotAvailable } from '../util';

type BindGroupBindingLayout =
| GPUBufferBindingLayout
Expand Down Expand Up @@ -111,7 +112,9 @@ export const SampleInitFactoryWebGPU = async (
callback: SampleInitCallback3D
): Promise<SampleInit> => {
const init = async ({ canvas, gui, stats }) => {
const adapter = await navigator.gpu.requestAdapter();
const adapter = await navigator.gpu?.requestAdapter();
quitIfAdapterNotAvailable(adapter);

const timestampQueryAvailable = adapter.features.has('timestamp-query');
let device: GPUDevice;
if (timestampQueryAvailable) {
Expand All @@ -121,6 +124,8 @@ export const SampleInitFactoryWebGPU = async (
} else {
device = await adapter.requestDevice();
}
quitIfWebGPUNotAvailable(adapter, device);

const context = canvas.getContext('webgpu') as GPUCanvasContext;
const devicePixelRatio = window.devicePixelRatio;
canvas.width = canvas.clientWidth * devicePixelRatio;
Expand Down
71 changes: 69 additions & 2 deletions sample/cameras/main.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion sample/cameras/main.js.map

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions sample/cameras/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
import cubeWGSL from './cube.wgsl';
import { ArcballCamera, WASDCamera } from './camera';
import { createInputHandler } from './input';
import { quitIfWebGPUNotAvailable } from '../util';

const canvas = document.querySelector('canvas') as HTMLCanvasElement;

Expand Down Expand Up @@ -39,8 +40,9 @@ gui.add(params, 'type', ['arcball', 'WASD']).onChange(() => {
oldCameraType = newCameraType;
});

const adapter = await navigator.gpu.requestAdapter();
const device = await adapter.requestDevice();
const adapter = await navigator.gpu?.requestAdapter();
const device = await adapter?.requestDevice();
quitIfWebGPUNotAvailable(adapter, device);
const context = canvas.getContext('webgpu') as GPUCanvasContext;

const devicePixelRatio = window.devicePixelRatio;
Expand Down
Loading

0 comments on commit e1593f7

Please sign in to comment.