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

Remove superfluous || 1 after devicePixelRatio #308

Merged
merged 1 commit into from
Oct 27, 2023
Merged
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
2 changes: 1 addition & 1 deletion src/sample/a-buffer/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/sample/animometer/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion src/sample/bitonicSort/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
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();
Expand All @@ -137,7 +137,7 @@

export abstract class Base2DRendererClass {
abstract switchBindGroup(name: string): void;
abstract startRun(commandEncoder: GPUCommandEncoder, ...args: any[]): void;

Check warning on line 140 in src/sample/bitonicSort/utils.ts

View workflow job for this annotation

GitHub Actions / build

Unexpected any. Specify a different type
renderPassDescriptor: GPURenderPassDescriptor;
pipeline: GPURenderPipeline;
bindGroupMap: Record<string, GPUBindGroup>;
Expand Down
2 changes: 1 addition & 1 deletion src/sample/cameras/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion src/sample/computeBoids/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion src/sample/cornell/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion src/sample/cubemap/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion src/sample/deferredRendering/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/sample/fractalCube/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion src/sample/gameOfLife/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion src/sample/helloTriangle/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion src/sample/helloTriangleMSAA/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion src/sample/imageBlur/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion src/sample/instancedCube/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion src/sample/particles/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion src/sample/renderBundles/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion src/sample/resizeCanvas/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion src/sample/reversedZ/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion src/sample/rotatingCube/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion src/sample/shadowMapping/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/sample/texturedCube/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion src/sample/twoCubes/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion src/sample/videoUploading/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion src/sample/videoUploadingWebCodecs/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion src/sample/worker/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Loading