Skip to content

Commit 7d29272

Browse files
committed
Deploying to gh-pages from @ a1bee53 🚀
1 parent 6acd373 commit 7d29272

File tree

9 files changed

+9501
-1
lines changed

9 files changed

+9501
-1
lines changed

‎main.js

+17
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,22 @@ var bitonicSort = {
9595
],
9696
};
9797

98+
var blending = {
99+
name: 'Blending',
100+
description: `
101+
This example provides shows how to use blending in WebGPU. It draws a texture with diagonal lines
102+
on top of a canvas with a CSS based checkerboard background. It then draws a texture with
103+
3 blurry circles on top the first texture with [blending settings](https://gpuweb.github.io/gpuweb/#color-target-state).
104+
This lets you see both the effect of blending settings in WebGPU and the final result when composited on top of the canvas.
105+
See [this article](https://webgpufundamentals.org/webgpu/lessons/webgpu-transparency.html)
106+
for a more detailed explanation.
107+
The presets are equivalent to the 2d canvas context's
108+
[\`globalCompositingOperation\`](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/globalCompositeOperation).
109+
`,
110+
filename: "sample/blending",
111+
sources: [{ path: 'main.ts' }, { path: 'texturedQuad.wgsl' }],
112+
};
113+
98114
var bundleCulling = {
99115
name: 'Bundle Culling',
100116
description: `A demonstration of using frustum culling with render bundles through indirect instanced draw calls.`,
@@ -667,6 +683,7 @@ const pageCategories = [
667683
occlusionQuery,
668684
samplerParameters,
669685
timestampQuery,
686+
blending,
670687
},
671688
},
672689
// Samples that demonstrate the GPGPU functionality of WebGPU. These samples generally provide some

‎main.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎sample/blending/index.html

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
6+
<title>webgpu-samples: blending</title>
7+
<style>
8+
:root {
9+
color-scheme: light dark;
10+
}
11+
html, body {
12+
margin: 0; /* remove default margin */
13+
height: 100%; /* make body fill the browser window */
14+
display: flex;
15+
place-content: center center;
16+
}
17+
canvas {
18+
width: 600px;
19+
height: 600px;
20+
max-width: 100%;
21+
display: block;
22+
23+
/* give the canvas a checked background so we can see visualize blending the WebGPU texture with the canvas' background */
24+
background-color: #404040;
25+
background-image:
26+
linear-gradient(45deg, #808080 25%, transparent 25%),
27+
linear-gradient(-45deg, #808080 25%, transparent 25%),
28+
linear-gradient(45deg, transparent 75%, #808080 75%),
29+
linear-gradient(-45deg, transparent 75%, #808080 75%);
30+
background-size: 32px 32px;
31+
background-position: 0 0, 0 16px, 16px -16px, -16px 0px;
32+
33+
}
34+
</style>
35+
<script defer src="main.js" type="module"></script>
36+
<script defer type="module" src="../../js/iframe-helper.js"></script>
37+
</head>
38+
<body>
39+
<canvas></canvas>
40+
</body>
41+
</html>

0 commit comments

Comments
 (0)