12 Commits

Author SHA1 Message Date
Gregg Tavares
dcfd514975 Revert "Use direct attachment binding"
This reverts commit bdce233195.
2026-02-04 12:17:44 -08:00
Gregg Tavares
bdce233195 Use direct attachment binding 2026-01-21 21:47:35 -08:00
Gregg Tavares
9c9668e0e2 Use direct buffer binding
Now that all 3 major browsers support it, use
direct buffer binding.
2026-01-21 21:47:35 -08:00
Gregg Tavares
d4528f20d7 Add /* wgsl */ where appropriate 2025-10-03 21:09:02 -07:00
Gregg Tavares
bbf0df61e0 Revert "Use buffers directly for bind groups."
This reverts commit 0ea087a114.
2025-07-16 10:48:07 -07:00
Gregg Tavares
0ea087a114 Use buffers directly for bind groups.
The spec was changed to allow this. Valid as of Chrome 138
2025-07-10 20:26:21 -07:00
Gregg Tavares
cbbf0ff5e1 Fix code that centers text in a canvas.
The tradtional way to do this is to set

```js
ctx.textAlign = 'center';
ctx.textBaseline = 'middle';
ctx.fillText(text, centerX, centerY);
```

For various reasons this doesn't actually draw "in the center".

Instead we have to measure the text using the canvas API and then
center ourselves.

```
  ctx.textAlign = 'left';
  ctx.textBaseline = 'top';
  const m = ctx.measureText(text);
  ctx.fillText(
    text,
    (canvas.width - m.actualBoundingBoxRight + m.actualBoundingBoxLeft) / 2,
    (canvas.height - m.actualBoundingBoxDescent + m.actualBoundingBoxAscent) / 2
  );
```
2025-06-09 15:01:57 -07:00
Gregg Tavares
48050b7ce2 Rename RollingAverage to NonNegativeRollingAverage
And, make it discard negative values.

The spec says timestamp query can return a beginning timestamp
with a value greater than an ending timestamp and such values
should be discarded.

The easiest place to do this is in the RollingAverage class but
just doing it there without renaming it seemed bad since someone
might use RollingAverage for other purposes and not realize it
was discarding negative values.

Further, it's possible offsite samples are linking directly to
rolling-timing.js (which is the case if you export any sample)
so leave that implementation as is and put NonNegativeRollingAverage
in its own file.
2025-01-03 11:25:18 -08:00
Greggman
b90d3b3e47 Try to make optimization comparisons as far as possible (#133)
by requesting high-performance on both and turning on antialiasing
and alpha on WebGL.
2024-06-27 10:48:53 +09:00
Greggman
4d63b55139 Consider making optimal WebGL versions (#132)
1. Add more textures to all examples

2. Optimize WebGL examples
2024-06-27 10:22:27 +09:00
Gregg Tavares
53875877ba add textures 2024-06-18 21:08:16 -07:00
Greggman
6ac72a464e Optimization Article (#125) 2024-06-16 08:19:33 +09:00