Skip to content

Commit

Permalink
Compatibility Mode, the easy part.
Browse files Browse the repository at this point in the history
Enable WebGPU Compatibility Mode for all samples that can run
unmodified in that mode.
  • Loading branch information
SenorBlanco committed Jan 17, 2025
1 parent c6783d7 commit 2ff04ad
Show file tree
Hide file tree
Showing 26 changed files with 26 additions and 26 deletions.
2 changes: 1 addition & 1 deletion sample/animometer/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import animometerWGSL from './animometer.wgsl';
import { quitIfWebGPUNotAvailable } from '../util';

const canvas = document.querySelector('canvas') as HTMLCanvasElement;
const adapter = await navigator.gpu?.requestAdapter();
const adapter = await navigator.gpu?.requestAdapter({ featureLevel: 'compatibility' });

Check failure on line 6 in sample/animometer/main.ts

View workflow job for this annotation

GitHub Actions / build

Replace `·featureLevel:·'compatibility'·` with `⏎··featureLevel:·'compatibility',⏎`
const device = await adapter?.requestDevice();
quitIfWebGPUNotAvailable(adapter, device);

Expand Down
2 changes: 1 addition & 1 deletion sample/blending/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { GUI } from 'dat.gui';
import { quitIfWebGPUNotAvailable } from '../util';
import texturedQuadWGSL from './texturedQuad.wgsl';

const adapter = await navigator.gpu?.requestAdapter();
const adapter = await navigator.gpu?.requestAdapter({ featureLevel: 'compatibility' });

Check failure on line 6 in sample/blending/main.ts

View workflow job for this annotation

GitHub Actions / build

Replace `·featureLevel:·'compatibility'·` with `⏎··featureLevel:·'compatibility',⏎`
const device = await adapter?.requestDevice();
quitIfWebGPUNotAvailable(adapter, device);

Expand Down
2 changes: 1 addition & 1 deletion sample/cameras/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ gui.add(params, 'type', ['arcball', 'WASD']).onChange(() => {
oldCameraType = newCameraType;
});

const adapter = await navigator.gpu?.requestAdapter();
const adapter = await navigator.gpu?.requestAdapter({ featureLevel: 'compatibility' });

Check failure on line 43 in sample/cameras/main.ts

View workflow job for this annotation

GitHub Actions / build

Replace `·featureLevel:·'compatibility'·` with `⏎··featureLevel:·'compatibility',⏎`
const device = await adapter?.requestDevice();
quitIfWebGPUNotAvailable(adapter, device);
const context = canvas.getContext('webgpu') as GPUCanvasContext;
Expand Down
2 changes: 1 addition & 1 deletion sample/computeBoids/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import updateSpritesWGSL from './updateSprites.wgsl';
import { GUI } from 'dat.gui';

const canvas = document.querySelector('canvas') as HTMLCanvasElement;
const adapter = await navigator.gpu?.requestAdapter();
const adapter = await navigator.gpu?.requestAdapter({ featureLevel: 'compatibility' });

Check failure on line 7 in sample/computeBoids/main.ts

View workflow job for this annotation

GitHub Actions / build

Replace `·featureLevel:·'compatibility'·` with `⏎··featureLevel:·'compatibility',⏎`
quitIfAdapterNotAvailable(adapter);

const hasTimestampQuery = adapter.features.has('timestamp-query');
Expand Down
2 changes: 1 addition & 1 deletion sample/fractalCube/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import sampleSelfWGSL from './sampleSelf.frag.wgsl';
import { quitIfWebGPUNotAvailable } from '../util';

const canvas = document.querySelector('canvas') as HTMLCanvasElement;
const adapter = await navigator.gpu?.requestAdapter();
const adapter = await navigator.gpu?.requestAdapter({ featureLevel: 'compatibility' });

Check failure on line 16 in sample/fractalCube/main.ts

View workflow job for this annotation

GitHub Actions / build

Replace `·featureLevel:·'compatibility'·` with `⏎··featureLevel:·'compatibility',⏎`
const device = await adapter?.requestDevice();
quitIfWebGPUNotAvailable(adapter, device);

Expand Down
2 changes: 1 addition & 1 deletion sample/gameOfLife/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import fragWGSL from './frag.wgsl';
import { quitIfWebGPUNotAvailable } from '../util';

const canvas = document.querySelector('canvas') as HTMLCanvasElement;
const adapter = await navigator.gpu?.requestAdapter();
const adapter = await navigator.gpu?.requestAdapter({ featureLevel: 'compatibility' });

Check failure on line 8 in sample/gameOfLife/main.ts

View workflow job for this annotation

GitHub Actions / build

Replace `·featureLevel:·'compatibility'·` with `⏎··featureLevel:·'compatibility',⏎`
const device = await adapter?.requestDevice();
quitIfWebGPUNotAvailable(adapter, device);

Expand Down
2 changes: 1 addition & 1 deletion sample/helloTriangle/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import redFragWGSL from '../../shaders/red.frag.wgsl';
import { quitIfWebGPUNotAvailable } from '../util';

const canvas = document.querySelector('canvas') as HTMLCanvasElement;
const adapter = await navigator.gpu?.requestAdapter();
const adapter = await navigator.gpu?.requestAdapter({ featureLevel: 'compatibility' });

Check failure on line 6 in sample/helloTriangle/main.ts

View workflow job for this annotation

GitHub Actions / build

Replace `·featureLevel:·'compatibility'·` with `⏎··featureLevel:·'compatibility',⏎`
const device = await adapter?.requestDevice();
quitIfWebGPUNotAvailable(adapter, device);

Expand Down
2 changes: 1 addition & 1 deletion sample/helloTriangleMSAA/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import redFragWGSL from '../../shaders/red.frag.wgsl';
import { quitIfWebGPUNotAvailable } from '../util';

const canvas = document.querySelector('canvas') as HTMLCanvasElement;
const adapter = await navigator.gpu?.requestAdapter();
const adapter = await navigator.gpu?.requestAdapter({ featureLevel: 'compatibility' });

Check failure on line 6 in sample/helloTriangleMSAA/main.ts

View workflow job for this annotation

GitHub Actions / build

Replace `·featureLevel:·'compatibility'·` with `⏎··featureLevel:·'compatibility',⏎`
const device = await adapter?.requestDevice();
quitIfWebGPUNotAvailable(adapter, device);

Expand Down
2 changes: 1 addition & 1 deletion sample/imageBlur/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const tileDim = 128;
const batch = [4, 4];

const canvas = document.querySelector('canvas') as HTMLCanvasElement;
const adapter = await navigator.gpu?.requestAdapter();
const adapter = await navigator.gpu?.requestAdapter({ featureLevel: 'compatibility' });

Check failure on line 11 in sample/imageBlur/main.ts

View workflow job for this annotation

GitHub Actions / build

Replace `·featureLevel:·'compatibility'·` with `⏎··featureLevel:·'compatibility',⏎`
const device = await adapter?.requestDevice();
quitIfWebGPUNotAvailable(adapter, device);

Expand Down
2 changes: 1 addition & 1 deletion sample/instancedCube/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import vertexPositionColorWGSL from '../../shaders/vertexPositionColor.frag.wgsl
import { quitIfWebGPUNotAvailable } from '../util';

const canvas = document.querySelector('canvas') as HTMLCanvasElement;
const adapter = await navigator.gpu?.requestAdapter();
const adapter = await navigator.gpu?.requestAdapter({ featureLevel: 'compatibility' });

Check failure on line 16 in sample/instancedCube/main.ts

View workflow job for this annotation

GitHub Actions / build

Replace `·featureLevel:·'compatibility'·` with `⏎··featureLevel:·'compatibility',⏎`
const device = await adapter?.requestDevice();
quitIfWebGPUNotAvailable(adapter, device);

Expand Down
2 changes: 1 addition & 1 deletion sample/multipleCanvases/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ function createVertexAndIndexBuffer(
};
}

const adapter = await navigator.gpu?.requestAdapter();
const adapter = await navigator.gpu?.requestAdapter({ featureLevel: 'compatibility' });
const device = await adapter?.requestDevice();
quitIfWebGPUNotAvailable(adapter, device);

Expand Down
2 changes: 1 addition & 1 deletion sample/normalMap/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ enum TextureAtlas {
}

const canvas = document.querySelector('canvas') as HTMLCanvasElement;
const adapter = await navigator.gpu?.requestAdapter();
const adapter = await navigator.gpu?.requestAdapter({ featureLevel: 'compatibility' });
const device = await adapter?.requestDevice();
quitIfWebGPUNotAvailable(adapter, device);
const context = canvas.getContext('webgpu') as GPUCanvasContext;
Expand Down
2 changes: 1 addition & 1 deletion sample/occlusionQuery/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export type TypedArrayConstructor =

const info = document.querySelector('#info');

const adapter = await navigator.gpu?.requestAdapter();
const adapter = await navigator.gpu?.requestAdapter({ featureLevel: 'compatibility' });
const device = await adapter?.requestDevice();
quitIfWebGPUNotAvailable(adapter, device);

Expand Down
2 changes: 1 addition & 1 deletion sample/points/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ function createFibonacciSphereVertices({
return new Float32Array(vertices);
}

const adapter = await navigator.gpu?.requestAdapter();
const adapter = await navigator.gpu?.requestAdapter({ featureLevel: 'compatibility' });
const device = await adapter?.requestDevice();
quitIfWebGPUNotAvailable(adapter, device);

Expand Down
2 changes: 1 addition & 1 deletion sample/renderBundles/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ interface Renderable {
}

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

Expand Down
2 changes: 1 addition & 1 deletion sample/resizeCanvas/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import redFragWGSL from '../../shaders/red.frag.wgsl';
import { quitIfWebGPUNotAvailable } from '../util';

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

Expand Down
2 changes: 1 addition & 1 deletion sample/resizeObserverHDDPI/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import checkerWGSL from './checker.wgsl';
import { quitIfWebGPUNotAvailable } from '../util';

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

Expand Down
2 changes: 1 addition & 1 deletion sample/rotatingCube/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import vertexPositionColorWGSL from '../../shaders/vertexPositionColor.frag.wgsl
import { quitIfWebGPUNotAvailable } from '../util';

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

Expand Down
2 changes: 1 addition & 1 deletion sample/shadowMapping/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { quitIfWebGPUNotAvailable } from '../util';
const shadowDepthTextureSize = 1024;

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

Expand Down
2 changes: 1 addition & 1 deletion sample/texturedCube/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import sampleTextureMixColorWGSL from './sampleTextureMixColor.frag.wgsl';
import { quitIfWebGPUNotAvailable } from '../util';

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

Expand Down
2 changes: 1 addition & 1 deletion sample/transparentCanvas/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import vertexPositionColorWGSL from '../../shaders/vertexPositionColor.frag.wgsl
import { quitIfWebGPUNotAvailable } from '../util';

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

Expand Down
2 changes: 1 addition & 1 deletion sample/twoCubes/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import vertexPositionColorWGSL from '../../shaders/vertexPositionColor.frag.wgsl
import { quitIfWebGPUNotAvailable } from '../util';

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

Expand Down
2 changes: 1 addition & 1 deletion sample/videoUploading/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import fullscreenTexturedQuadWGSL from '../../shaders/fullscreenTexturedQuad.wgs
import sampleExternalTextureWGSL from '../../shaders/sampleExternalTexture.frag.wgsl';
import { quitIfWebGPUNotAvailable } from '../util';

const adapter = await navigator.gpu?.requestAdapter();
const adapter = await navigator.gpu?.requestAdapter({ featureLevel: 'compatibility' });
const device = await adapter?.requestDevice();
quitIfWebGPUNotAvailable(adapter, device);

Expand Down
2 changes: 1 addition & 1 deletion sample/volumeRenderingTexture3D/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ gui.add(params, 'rotateCamera', true);
gui.add(params, 'near', 2.0, 7.0);
gui.add(params, 'far', 2.0, 7.0);

const adapter = await navigator.gpu?.requestAdapter();
const adapter = await navigator.gpu?.requestAdapter({ featureLevel: 'compatibility' });
const device = await adapter?.requestDevice();
quitIfWebGPUNotAvailable(adapter, device);
const context = canvas.getContext('webgpu') as GPUCanvasContext;
Expand Down
2 changes: 1 addition & 1 deletion sample/worker/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ self.addEventListener('message', (ev) => {
// to the init() method for all the other samples. The remainder of this file is largely identical
// to the rotatingCube sample.
async function init(canvas) {
const adapter = await navigator.gpu?.requestAdapter();
const adapter = await navigator.gpu?.requestAdapter({ featureLevel: 'compatibility' });
const device = await adapter?.requestDevice();
quitIfWebGPUNotAvailable(adapter, device);
const context = canvas.getContext('webgpu');
Expand Down
2 changes: 1 addition & 1 deletion sample/workloadSimulator/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,7 @@ <h2><center>Web graphics workload simulator</center></h2>
try {
if (deviceRequested) return;
deviceRequested = true;
let adapter = await navigator.gpu.requestAdapter();
let adapter = await navigator.gpu.requestAdapter({ featureLevel: 'compatibility' });
featuresAndLimits.textContent = JSON.stringify(
{
name: adapter.name,
Expand Down

0 comments on commit 2ff04ad

Please sign in to comment.