Skip to content

Commit 4b8190d

Browse files
committed
gpu
1 parent 5cbbbe2 commit 4b8190d

7 files changed

Lines changed: 10 additions & 1 deletion

File tree

content/posts/forbidden.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,19 @@ Graphing `y = pow(sin(x), 2.5)`. The same issue occurs, breaking the function wh
3131

3232
<iframe width="640" height="360" frameborder="0" src="https://www.shadertoy.com/embed/33GSDc?gui=true&t=10&paused=true&muted=false" allowfullscreen></iframe>
3333
</div>
34-
3534
<br>
3635
*<small>Note: If a shader appears broken, try refreshing the page as Shadertoy can sometimes be unstable.</small>*
3736

37+
This variance across platforms, which can depend on the GPU hardware or its drivers, is a key reason to handle these edge cases proactively with `abs()` or other methods, as the output is not guaranteed. For example, while most desktop GPUs produce clean gaps, some GPUs (like on an iPhone 6s in the example below) handle the error differently. Notice how the `sqrt()` error is avoided entirely, but the `pow()` error still renders artifacts—not as empty gaps, but this time as large black columns!
38+
39+
<div align="center" style="display: flex; justify-content: center; gap: 10px; flex-wrap: wrap;">
40+
<img src="/images/iphone6s_1.jpg" width="48%" alt="iPhone 6s screenshot of sqrt shader without gaps">
41+
<img src="/images/iphone6s_2.jpg" width="48%" alt="iPhone 6s screenshot of pow shader with black columns">
42+
</div>
43+
<center>
44+
*<small>Screenshot from an iPhone 6s: in contrast to modern desktop GPUs, this older mobile hardware appears to fill the gaps in the `sqrt` example, yet produces distinct vertical artifacts for the `pow` function.</small>*
45+
</center>
46+
3847
### The Technical Reality Behind the Error
3948

4049
Using `abs()` fixes the black pixels, but it's crucial to understand *why* the failure occurs to write better code.

public/.DS_Store

0 Bytes
Binary file not shown.

public/images/iphone6s_1.jpg

137 KB
Loading

public/images/iphone6s_2.jpg

103 KB
Loading

static/.DS_Store

0 Bytes
Binary file not shown.

static/images/iphone6s_1.jpg

137 KB
Loading

static/images/iphone6s_2.jpg

103 KB
Loading

0 commit comments

Comments
 (0)