Skip to content

Commit

Permalink
Use transparency in helloTriangle*, remove alphaMode on rest
Browse files Browse the repository at this point in the history
None of the samples used transparent canvases, so they shouldn't set
alphaMode.
  • Loading branch information
kainino0x committed Oct 1, 2024
1 parent 268c290 commit b3dcc79
Show file tree
Hide file tree
Showing 33 changed files with 2 additions and 33 deletions.
1 change: 0 additions & 1 deletion sample/alphaToCoverage/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ const context = canvas.getContext('webgpu') as GPUCanvasContext;
context.configure({
device,
format: presentationFormat,
alphaMode: 'premultiplied',
});

//
Expand Down
1 change: 0 additions & 1 deletion sample/animometer/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ const presentationFormat = navigator.gpu.getPreferredCanvasFormat();
context.configure({
device,
format: presentationFormat,
alphaMode: 'premultiplied',
usage: GPUTextureUsage.COPY_DST | GPUTextureUsage.RENDER_ATTACHMENT,
});

Expand Down
1 change: 0 additions & 1 deletion sample/bitonicSort/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ export const SampleInitFactoryWebGPU = async (
context.configure({
device,
format: presentationFormat,
alphaMode: 'premultiplied',
});

callback({
Expand Down
1 change: 0 additions & 1 deletion sample/cameras/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ const presentationFormat = navigator.gpu.getPreferredCanvasFormat();
context.configure({
device,
format: presentationFormat,
alphaMode: 'premultiplied',
});

// Create a vertex buffer from the cube data.
Expand Down
1 change: 0 additions & 1 deletion sample/computeBoids/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ const presentationFormat = navigator.gpu.getPreferredCanvasFormat();
context.configure({
device,
format: presentationFormat,
alphaMode: 'premultiplied',
});

const spriteShaderModule = device.createShaderModule({ code: spriteWGSL });
Expand Down
1 change: 0 additions & 1 deletion sample/cornell/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ context.configure({
device,
format: presentationFormat,
usage: GPUTextureUsage.RENDER_ATTACHMENT | GPUTextureUsage.STORAGE_BINDING,
alphaMode: 'premultiplied',
});

const framebuffer = device.createTexture({
Expand Down
1 change: 0 additions & 1 deletion sample/cubemap/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ const presentationFormat = navigator.gpu.getPreferredCanvasFormat();
context.configure({
device,
format: presentationFormat,
alphaMode: 'premultiplied',
});

// Create a vertex buffer from the cube data.
Expand Down
1 change: 0 additions & 1 deletion sample/deferredRendering/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ const presentationFormat = navigator.gpu.getPreferredCanvasFormat();
context.configure({
device,
format: presentationFormat,
alphaMode: 'premultiplied',
});

// Create the model vertex buffer.
Expand Down
1 change: 0 additions & 1 deletion sample/fractalCube/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ context.configure({
// Specify we want both RENDER_ATTACHMENT and COPY_SRC since we
// will copy out of the swapchain texture.
usage: GPUTextureUsage.RENDER_ATTACHMENT | GPUTextureUsage.COPY_SRC,
alphaMode: 'premultiplied',
});

// Create a vertex buffer from the cube data.
Expand Down
1 change: 0 additions & 1 deletion sample/gameOfLife/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ const presentationFormat = navigator.gpu.getPreferredCanvasFormat();
context.configure({
device,
format: presentationFormat,
alphaMode: 'premultiplied',
});

const GameOptions = {
Expand Down
2 changes: 1 addition & 1 deletion sample/helloTriangle/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ function frame() {
colorAttachments: [
{
view: textureView,
clearValue: [0, 0, 0, 1],
clearValue: [0, 0, 0, 0], // Clear to transparent
loadOp: 'clear',
storeOp: 'store',
},
Expand Down
2 changes: 1 addition & 1 deletion sample/helloTriangleMSAA/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ function frame() {
{
view,
resolveTarget: context.getCurrentTexture().createView(),
clearValue: [0, 0, 0, 1],
clearValue: [0, 0, 0, 0], // Clear to transparent
loadOp: 'clear',
storeOp: 'discard',
},
Expand Down
1 change: 0 additions & 1 deletion sample/imageBlur/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ const presentationFormat = navigator.gpu.getPreferredCanvasFormat();
context.configure({
device,
format: presentationFormat,
alphaMode: 'premultiplied',
});

const blurPipeline = device.createComputePipeline({
Expand Down
1 change: 0 additions & 1 deletion sample/instancedCube/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ const presentationFormat = navigator.gpu.getPreferredCanvasFormat();
context.configure({
device,
format: presentationFormat,
alphaMode: 'premultiplied',
});

// Create a vertex buffer from the cube data.
Expand Down
1 change: 0 additions & 1 deletion sample/normalMap/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ const presentationFormat = navigator.gpu.getPreferredCanvasFormat();
context.configure({
device,
format: presentationFormat,
alphaMode: 'premultiplied',
});

interface GUISettings {
Expand Down
1 change: 0 additions & 1 deletion sample/occlusionQuery/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ const presentationFormat = navigator.gpu.getPreferredCanvasFormat();
context.configure({
device,
format: presentationFormat,
alphaMode: 'premultiplied',
});
const depthFormat = 'depth24plus';

Expand Down
1 change: 0 additions & 1 deletion sample/particles/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ function configureContext() {
device,
format: presentationFormat,
toneMapping: { mode: simulationParams.toneMappingMode },
alphaMode: 'premultiplied',
});
}

Expand Down
1 change: 0 additions & 1 deletion sample/renderBundles/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ const presentationFormat = navigator.gpu.getPreferredCanvasFormat();
context.configure({
device,
format: presentationFormat,
alphaMode: 'premultiplied',
});

const shaderModule = device.createShaderModule({
Expand Down
1 change: 0 additions & 1 deletion sample/resizeCanvas/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ canvas.height = canvas.clientHeight * devicePixelRatio;
context.configure({
device,
format: presentationFormat,
alphaMode: 'premultiplied',
});

const sampleCount = 4;
Expand Down
1 change: 0 additions & 1 deletion sample/resizeObserverHDDPI/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ const presentationFormat = navigator.gpu.getPreferredCanvasFormat();
context.configure({
device,
format: presentationFormat,
alphaMode: 'premultiplied',
});

const module = device.createShaderModule({
Expand Down
1 change: 0 additions & 1 deletion sample/reversedZ/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ const presentationFormat = navigator.gpu.getPreferredCanvasFormat();
context.configure({
device,
format: presentationFormat,
alphaMode: 'premultiplied',
});

const verticesBuffer = device.createBuffer({
Expand Down
1 change: 0 additions & 1 deletion sample/rotatingCube/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ const presentationFormat = navigator.gpu.getPreferredCanvasFormat();
context.configure({
device,
format: presentationFormat,
alphaMode: 'premultiplied',
});

// Create a vertex buffer from the cube data.
Expand Down
1 change: 0 additions & 1 deletion sample/samplerParameters/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,6 @@ const context = canvas.getContext('webgpu') as GPUCanvasContext;
context.configure({
device,
format: presentationFormat,
alphaMode: 'premultiplied',
});

//
Expand Down
1 change: 0 additions & 1 deletion sample/shadowMapping/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ const presentationFormat = navigator.gpu.getPreferredCanvasFormat();
context.configure({
device,
format: presentationFormat,
alphaMode: 'premultiplied',
});

// Create the model vertex buffer.
Expand Down
1 change: 0 additions & 1 deletion sample/skinnedMesh/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ const presentationFormat = navigator.gpu.getPreferredCanvasFormat();
context.configure({
device,
format: presentationFormat,
alphaMode: 'premultiplied',
});

const settings = {
Expand Down
1 change: 0 additions & 1 deletion sample/textRenderingMsdf/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ const depthFormat = 'depth24plus';
context.configure({
device,
format: presentationFormat,
alphaMode: 'premultiplied',
});

const textRenderer = new MsdfTextRenderer(
Expand Down
1 change: 0 additions & 1 deletion sample/texturedCube/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ const presentationFormat = navigator.gpu.getPreferredCanvasFormat();
context.configure({
device,
format: presentationFormat,
alphaMode: 'premultiplied',
});

// Create a vertex buffer from the cube data.
Expand Down
1 change: 0 additions & 1 deletion sample/twoCubes/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ const presentationFormat = navigator.gpu.getPreferredCanvasFormat();
context.configure({
device,
format: presentationFormat,
alphaMode: 'premultiplied',
});

// Create a vertex buffer from the cube data.
Expand Down
1 change: 0 additions & 1 deletion sample/videoUploading/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ const presentationFormat = navigator.gpu.getPreferredCanvasFormat();
context.configure({
device,
format: presentationFormat,
alphaMode: 'premultiplied',
});

const pipeline = device.createRenderPipeline({
Expand Down
1 change: 0 additions & 1 deletion sample/videoUploading/video.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ export default async function ({ useVideoFrame }: { useVideoFrame: boolean }) {
context.configure({
device,
format: presentationFormat,
alphaMode: 'premultiplied',
});

const pipeline = device.createRenderPipeline({
Expand Down
1 change: 0 additions & 1 deletion sample/volumeRenderingTexture3D/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ const presentationFormat = navigator.gpu.getPreferredCanvasFormat();
context.configure({
device,
format: presentationFormat,
alphaMode: 'premultiplied',
});

const pipeline = device.createRenderPipeline({
Expand Down
1 change: 0 additions & 1 deletion sample/wireframe/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ const presentationFormat = navigator.gpu.getPreferredCanvasFormat();
context.configure({
device,
format: presentationFormat,
alphaMode: 'premultiplied',
});
const depthFormat = 'depth24plus';

Expand Down
1 change: 0 additions & 1 deletion sample/worker/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ async function init(canvas) {
context.configure({
device,
format: presentationFormat,
alphaMode: 'premultiplied',
});

// Create a vertex buffer from the cube data.
Expand Down

0 comments on commit b3dcc79

Please sign in to comment.