diff --git a/src/sample/a-buffer/main.ts b/src/sample/a-buffer/main.ts index 90e16c36..0f585c5b 100644 --- a/src/sample/a-buffer/main.ts +++ b/src/sample/a-buffer/main.ts @@ -332,7 +332,7 @@ const init: SampleInit = async ({ canvas, pageState, gui }) => { }; const configure = () => { - let devicePixelRatio = window.devicePixelRatio || 1; + let devicePixelRatio = window.devicePixelRatio; // The default maximum storage buffer binding size is 128Mib. The amount // of memory we need to store transparent fragments depends on the size diff --git a/src/sample/animometer/main.ts b/src/sample/animometer/main.ts index 1b92c07c..f8772358 100644 --- a/src/sample/animometer/main.ts +++ b/src/sample/animometer/main.ts @@ -33,7 +33,7 @@ const init: SampleInit = async ({ canvas, pageState, gui }) => { const context = canvas.getContext('webgpu') as GPUCanvasContext; - const devicePixelRatio = window.devicePixelRatio || 1; + const devicePixelRatio = window.devicePixelRatio; canvas.width = canvas.clientWidth * devicePixelRatio; canvas.height = canvas.clientHeight * devicePixelRatio; const presentationFormat = navigator.gpu.getPreferredCanvasFormat(); diff --git a/src/sample/bitonicSort/utils.ts b/src/sample/bitonicSort/utils.ts index 764335a7..1c2dc65c 100644 --- a/src/sample/bitonicSort/utils.ts +++ b/src/sample/bitonicSort/utils.ts @@ -112,7 +112,7 @@ export const SampleInitFactoryWebGPU = async ( const device = await adapter.requestDevice(); if (!pageState.active) return; const context = canvas.getContext('webgpu') as GPUCanvasContext; - const devicePixelRatio = window.devicePixelRatio || 1; + const devicePixelRatio = window.devicePixelRatio; canvas.width = canvas.clientWidth * devicePixelRatio; canvas.height = canvas.clientHeight * devicePixelRatio; const presentationFormat = navigator.gpu.getPreferredCanvasFormat(); diff --git a/src/sample/cameras/main.ts b/src/sample/cameras/main.ts index 83cae0de..e4c59c8f 100644 --- a/src/sample/cameras/main.ts +++ b/src/sample/cameras/main.ts @@ -44,7 +44,7 @@ const init: SampleInit = async ({ canvas, pageState, gui }) => { const device = await adapter.requestDevice(); const context = canvas.getContext('webgpu') as GPUCanvasContext; - const devicePixelRatio = window.devicePixelRatio || 1; + const devicePixelRatio = window.devicePixelRatio; canvas.width = canvas.clientWidth * devicePixelRatio; canvas.height = canvas.clientHeight * devicePixelRatio; const presentationFormat = navigator.gpu.getPreferredCanvasFormat(); diff --git a/src/sample/computeBoids/main.ts b/src/sample/computeBoids/main.ts index 4e8ee909..53c27fe6 100644 --- a/src/sample/computeBoids/main.ts +++ b/src/sample/computeBoids/main.ts @@ -10,7 +10,7 @@ const init: SampleInit = async ({ canvas, pageState, gui }) => { if (!pageState.active) return; const context = canvas.getContext('webgpu') as GPUCanvasContext; - const devicePixelRatio = window.devicePixelRatio || 1; + const devicePixelRatio = window.devicePixelRatio; canvas.width = canvas.clientWidth * devicePixelRatio; canvas.height = canvas.clientHeight * devicePixelRatio; const presentationFormat = navigator.gpu.getPreferredCanvasFormat(); diff --git a/src/sample/cornell/main.ts b/src/sample/cornell/main.ts index 506951e9..40a9a995 100644 --- a/src/sample/cornell/main.ts +++ b/src/sample/cornell/main.ts @@ -39,7 +39,7 @@ const init: SampleInit = async ({ canvas, pageState, gui }) => { gui.add(params, 'renderer', ['rasterizer', 'raytracer']); gui.add(params, 'rotateCamera', true); - const devicePixelRatio = window.devicePixelRatio || 1; + const devicePixelRatio = window.devicePixelRatio; canvas.width = canvas.clientWidth * devicePixelRatio; canvas.height = canvas.clientHeight * devicePixelRatio; diff --git a/src/sample/cubemap/main.ts b/src/sample/cubemap/main.ts index 33dd2da1..7524fbea 100644 --- a/src/sample/cubemap/main.ts +++ b/src/sample/cubemap/main.ts @@ -19,7 +19,7 @@ const init: SampleInit = async ({ canvas, pageState }) => { if (!pageState.active) return; const context = canvas.getContext('webgpu') as GPUCanvasContext; - const devicePixelRatio = window.devicePixelRatio || 1; + const devicePixelRatio = window.devicePixelRatio; canvas.width = canvas.clientWidth * devicePixelRatio; canvas.height = canvas.clientHeight * devicePixelRatio; const presentationFormat = navigator.gpu.getPreferredCanvasFormat(); diff --git a/src/sample/deferredRendering/main.ts b/src/sample/deferredRendering/main.ts index 8e2382e2..072a3751 100644 --- a/src/sample/deferredRendering/main.ts +++ b/src/sample/deferredRendering/main.ts @@ -20,7 +20,7 @@ const init: SampleInit = async ({ canvas, pageState, gui }) => { if (!pageState.active) return; const context = canvas.getContext('webgpu') as GPUCanvasContext; - const devicePixelRatio = window.devicePixelRatio || 1; + const devicePixelRatio = window.devicePixelRatio; canvas.width = canvas.clientWidth * devicePixelRatio; canvas.height = canvas.clientHeight * devicePixelRatio; const aspect = canvas.width / canvas.height; diff --git a/src/sample/fractalCube/main.ts b/src/sample/fractalCube/main.ts index 32b2f7fb..3abc1149 100644 --- a/src/sample/fractalCube/main.ts +++ b/src/sample/fractalCube/main.ts @@ -19,7 +19,7 @@ const init: SampleInit = async ({ canvas, pageState }) => { if (!pageState.active) return; const context = canvas.getContext('webgpu') as GPUCanvasContext; - const devicePixelRatio = window.devicePixelRatio || 1; + const devicePixelRatio = window.devicePixelRatio; canvas.width = canvas.clientWidth * devicePixelRatio; canvas.height = canvas.clientHeight * devicePixelRatio; const presentationFormat = navigator.gpu.getPreferredCanvasFormat(); diff --git a/src/sample/gameOfLife/main.ts b/src/sample/gameOfLife/main.ts index 4d4d695a..f772b46f 100644 --- a/src/sample/gameOfLife/main.ts +++ b/src/sample/gameOfLife/main.ts @@ -8,7 +8,7 @@ const init: SampleInit = async ({ canvas, pageState, gui }) => { const device = await adapter.requestDevice(); if (!pageState.active) return; const context = canvas.getContext('webgpu') as GPUCanvasContext; - const devicePixelRatio = window.devicePixelRatio || 1; + const devicePixelRatio = window.devicePixelRatio; canvas.width = canvas.clientWidth * devicePixelRatio; canvas.height = canvas.clientHeight * devicePixelRatio; const presentationFormat = navigator.gpu.getPreferredCanvasFormat(); diff --git a/src/sample/helloTriangle/main.ts b/src/sample/helloTriangle/main.ts index 8f4d3a42..0330b4df 100644 --- a/src/sample/helloTriangle/main.ts +++ b/src/sample/helloTriangle/main.ts @@ -10,7 +10,7 @@ const init: SampleInit = async ({ canvas, pageState }) => { if (!pageState.active) return; const context = canvas.getContext('webgpu') as GPUCanvasContext; - const devicePixelRatio = window.devicePixelRatio || 1; + const devicePixelRatio = window.devicePixelRatio; canvas.width = canvas.clientWidth * devicePixelRatio; canvas.height = canvas.clientHeight * devicePixelRatio; const presentationFormat = navigator.gpu.getPreferredCanvasFormat(); diff --git a/src/sample/helloTriangleMSAA/main.ts b/src/sample/helloTriangleMSAA/main.ts index 6f217620..9b663118 100644 --- a/src/sample/helloTriangleMSAA/main.ts +++ b/src/sample/helloTriangleMSAA/main.ts @@ -10,7 +10,7 @@ const init: SampleInit = async ({ canvas, pageState }) => { if (!pageState.active) return; const context = canvas.getContext('webgpu') as GPUCanvasContext; - const devicePixelRatio = window.devicePixelRatio || 1; + const devicePixelRatio = window.devicePixelRatio; canvas.width = canvas.clientWidth * devicePixelRatio; canvas.height = canvas.clientHeight * devicePixelRatio; const presentationFormat = navigator.gpu.getPreferredCanvasFormat(); diff --git a/src/sample/imageBlur/main.ts b/src/sample/imageBlur/main.ts index 906c8f6d..2807f92f 100644 --- a/src/sample/imageBlur/main.ts +++ b/src/sample/imageBlur/main.ts @@ -14,7 +14,7 @@ const init: SampleInit = async ({ canvas, pageState, gui }) => { if (!pageState.active) return; const context = canvas.getContext('webgpu') as GPUCanvasContext; - const devicePixelRatio = window.devicePixelRatio || 1; + const devicePixelRatio = window.devicePixelRatio; canvas.width = canvas.clientWidth * devicePixelRatio; canvas.height = canvas.clientHeight * devicePixelRatio; const presentationFormat = navigator.gpu.getPreferredCanvasFormat(); diff --git a/src/sample/instancedCube/main.ts b/src/sample/instancedCube/main.ts index 8a1e9a5d..baec3e39 100644 --- a/src/sample/instancedCube/main.ts +++ b/src/sample/instancedCube/main.ts @@ -19,7 +19,7 @@ const init: SampleInit = async ({ canvas, pageState }) => { if (!pageState.active) return; const context = canvas.getContext('webgpu') as GPUCanvasContext; - const devicePixelRatio = window.devicePixelRatio || 1; + const devicePixelRatio = window.devicePixelRatio; canvas.width = canvas.clientWidth * devicePixelRatio; canvas.height = canvas.clientHeight * devicePixelRatio; const presentationFormat = navigator.gpu.getPreferredCanvasFormat(); diff --git a/src/sample/particles/main.ts b/src/sample/particles/main.ts index ef7b6c2d..76300b63 100644 --- a/src/sample/particles/main.ts +++ b/src/sample/particles/main.ts @@ -22,7 +22,7 @@ const init: SampleInit = async ({ canvas, pageState, gui }) => { if (!pageState.active) return; const context = canvas.getContext('webgpu') as GPUCanvasContext; - const devicePixelRatio = window.devicePixelRatio || 1; + const devicePixelRatio = window.devicePixelRatio; canvas.width = canvas.clientWidth * devicePixelRatio; canvas.height = canvas.clientHeight * devicePixelRatio; const presentationFormat = navigator.gpu.getPreferredCanvasFormat(); diff --git a/src/sample/renderBundles/main.ts b/src/sample/renderBundles/main.ts index 87b1bcf9..96d5c541 100644 --- a/src/sample/renderBundles/main.ts +++ b/src/sample/renderBundles/main.ts @@ -30,7 +30,7 @@ const init: SampleInit = async ({ canvas, pageState, gui, stats }) => { const context = canvas.getContext('webgpu') as GPUCanvasContext; - const devicePixelRatio = window.devicePixelRatio || 1; + const devicePixelRatio = window.devicePixelRatio; canvas.width = canvas.clientWidth * devicePixelRatio; canvas.height = canvas.clientHeight * devicePixelRatio; const presentationFormat = navigator.gpu.getPreferredCanvasFormat(); diff --git a/src/sample/resizeCanvas/main.ts b/src/sample/resizeCanvas/main.ts index 5a6b1ce5..ff09fa55 100644 --- a/src/sample/resizeCanvas/main.ts +++ b/src/sample/resizeCanvas/main.ts @@ -15,7 +15,7 @@ const init: SampleInit = async ({ canvas, pageState }) => { const presentationFormat = navigator.gpu.getPreferredCanvasFormat(); - const devicePixelRatio = window.devicePixelRatio || 1; + const devicePixelRatio = window.devicePixelRatio; canvas.width = canvas.clientWidth * devicePixelRatio; canvas.height = canvas.clientHeight * devicePixelRatio; diff --git a/src/sample/reversedZ/main.ts b/src/sample/reversedZ/main.ts index 9161c846..a5e4adbd 100644 --- a/src/sample/reversedZ/main.ts +++ b/src/sample/reversedZ/main.ts @@ -72,7 +72,7 @@ const init: SampleInit = async ({ canvas, pageState, gui }) => { const context = canvas.getContext('webgpu') as GPUCanvasContext; - const devicePixelRatio = window.devicePixelRatio || 1; + const devicePixelRatio = window.devicePixelRatio; canvas.width = canvas.clientWidth * devicePixelRatio; canvas.height = canvas.clientHeight * devicePixelRatio; const presentationFormat = navigator.gpu.getPreferredCanvasFormat(); diff --git a/src/sample/rotatingCube/main.ts b/src/sample/rotatingCube/main.ts index 349ffb50..fa92f556 100644 --- a/src/sample/rotatingCube/main.ts +++ b/src/sample/rotatingCube/main.ts @@ -19,7 +19,7 @@ const init: SampleInit = async ({ canvas, pageState }) => { if (!pageState.active) return; const context = canvas.getContext('webgpu') as GPUCanvasContext; - const devicePixelRatio = window.devicePixelRatio || 1; + const devicePixelRatio = window.devicePixelRatio; canvas.width = canvas.clientWidth * devicePixelRatio; canvas.height = canvas.clientHeight * devicePixelRatio; const presentationFormat = navigator.gpu.getPreferredCanvasFormat(); diff --git a/src/sample/shadowMapping/main.ts b/src/sample/shadowMapping/main.ts index 345a4b61..9322dff6 100644 --- a/src/sample/shadowMapping/main.ts +++ b/src/sample/shadowMapping/main.ts @@ -17,7 +17,7 @@ const init: SampleInit = async ({ canvas, pageState }) => { const context = canvas.getContext('webgpu') as GPUCanvasContext; - const devicePixelRatio = window.devicePixelRatio || 1; + const devicePixelRatio = window.devicePixelRatio; canvas.width = canvas.clientWidth * devicePixelRatio; canvas.height = canvas.clientHeight * devicePixelRatio; const aspect = canvas.width / canvas.height; diff --git a/src/sample/texturedCube/main.ts b/src/sample/texturedCube/main.ts index 2d82d1ee..750ca142 100644 --- a/src/sample/texturedCube/main.ts +++ b/src/sample/texturedCube/main.ts @@ -19,7 +19,7 @@ const init: SampleInit = async ({ canvas, pageState }) => { if (!pageState.active) return; const context = canvas.getContext('webgpu') as GPUCanvasContext; - const devicePixelRatio = window.devicePixelRatio || 1; + const devicePixelRatio = window.devicePixelRatio; canvas.width = canvas.clientWidth * devicePixelRatio; canvas.height = canvas.clientHeight * devicePixelRatio; const presentationFormat = navigator.gpu.getPreferredCanvasFormat(); diff --git a/src/sample/twoCubes/main.ts b/src/sample/twoCubes/main.ts index 967748e6..62064a1f 100644 --- a/src/sample/twoCubes/main.ts +++ b/src/sample/twoCubes/main.ts @@ -19,7 +19,7 @@ const init: SampleInit = async ({ canvas, pageState }) => { if (!pageState.active) return; const context = canvas.getContext('webgpu') as GPUCanvasContext; - const devicePixelRatio = window.devicePixelRatio || 1; + const devicePixelRatio = window.devicePixelRatio; canvas.width = canvas.clientWidth * devicePixelRatio; canvas.height = canvas.clientHeight * devicePixelRatio; const presentationFormat = navigator.gpu.getPreferredCanvasFormat(); diff --git a/src/sample/videoUploading/main.ts b/src/sample/videoUploading/main.ts index ee3a1257..8c0f2784 100644 --- a/src/sample/videoUploading/main.ts +++ b/src/sample/videoUploading/main.ts @@ -21,7 +21,7 @@ const init: SampleInit = async ({ canvas, pageState, gui }) => { if (!pageState.active) return; const context = canvas.getContext('webgpu') as GPUCanvasContext; - const devicePixelRatio = window.devicePixelRatio || 1; + const devicePixelRatio = window.devicePixelRatio; canvas.width = canvas.clientWidth * devicePixelRatio; canvas.height = canvas.clientHeight * devicePixelRatio; const presentationFormat = navigator.gpu.getPreferredCanvasFormat(); diff --git a/src/sample/videoUploadingWebCodecs/main.ts b/src/sample/videoUploadingWebCodecs/main.ts index d25f0224..c2098fea 100644 --- a/src/sample/videoUploadingWebCodecs/main.ts +++ b/src/sample/videoUploadingWebCodecs/main.ts @@ -21,7 +21,7 @@ const init: SampleInit = async ({ canvas, pageState, gui }) => { if (!pageState.active) return; const context = canvas.getContext('webgpu') as GPUCanvasContext; - const devicePixelRatio = window.devicePixelRatio || 1; + const devicePixelRatio = window.devicePixelRatio; canvas.width = canvas.clientWidth * devicePixelRatio; canvas.height = canvas.clientHeight * devicePixelRatio; const presentationFormat = navigator.gpu.getPreferredCanvasFormat(); diff --git a/src/sample/worker/main.ts b/src/sample/worker/main.ts index b2e63123..4a2cc95f 100644 --- a/src/sample/worker/main.ts +++ b/src/sample/worker/main.ts @@ -32,7 +32,7 @@ const init: SampleInit = async ({ canvas, pageState }) => { // Anything drawn to the OffscreenCanvas that call returns will automatically be displayed on // the source canvas on the page. const offscreenCanvas = canvas.transferControlToOffscreen(); - const devicePixelRatio = window.devicePixelRatio || 1; + const devicePixelRatio = window.devicePixelRatio; offscreenCanvas.width = canvas.clientWidth * devicePixelRatio; offscreenCanvas.height = canvas.clientHeight * devicePixelRatio;