Let Texture size feed the Vertex output to scale about the middle (#409)
game-maker / gate (push) Successful in 4m16s
game-maker / suite (push) Successful in 17m10s

A scale about the picture's middle moves each corner by its distance
to the middle times (scale - 1). In pixels that distance needs the
picture's size, and Texture size was locked at the Vertex output as a
per-pixel node. So the size had to be typed in by hand and was only
right for pictures of exactly that size.

- At a corner Texture size reads the uniform uPictureSize. It holds
  the size the Vertex output counts its pixels in, the same number the
  node gives in the fragment. The offset is divided by that size again,
  so a scale comes out right for every picture and sprite size.
- A node can say what it is at a corner through emitPerCorner. The
  walker takes it there and emit everywhere else.
- Fed a Pass's picture, Texture size stays locked at the Vertex output.
  A Pass has no picture at a corner.
- 9-slice, field and camera shaders do not move corners. Their size is
  0 there and nothing changes for them.

Tests:
- Unit shader-vertex: the node compiles at a corner to uPictureSize
  and the Output still reads textureSize. shader-passes: a Pass's
  picture into Texture size at the Vertex output is refused.
- Against the old perPixel flag the new unit test fails.
- e2e 28l-iv: width * 0.5 at x moves the 32 px picture as far as the
  constant 16 did, same three colours. With the size forced to 0 on
  the GPU the check fails and the picture stands still.
- The case "Texture size is refused at a corner" left the it.each
  that lists refused nodes, so the test count stays the same.
- e2e 28 on melektaus-atx: ALL PASSED, 101 checks.
- Gate on melektaus-atx: CHECK EXIT 0, 297 files, 4562 tests.
- tsc, eslint, Prettier clean.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
adminandClaude Opus 5.5 committed 2026-10-11 18:35:20 +02:00
1 parent b9fcf48097
commit 8118b8042b
7 files changed
+82 -10

No files matched your search

+20
View File
@@ -893,6 +893,26 @@ export async function shader(t) {
colourDistance(bare.left, LEFT) < 12,
{ moved, bare },
);
// The picture's size reaches the corner (#409): half its width is the 16 from before.
await cornered(
[node('size', 'ShaderTextureSize', {}, 0, 260), node('half', 'ShaderMultiply', { b: 0.5 }, 260, 260)],
[edge('size', 'width', 'half', 'a'), edge('half', 'result', 'vout', 'x')],
8,
);
const sized = {
left: await pixel(-0.3, -0.3),
right: await pixel(0.3, -0.3),
past: await pixel(0.8, -0.3),
problem: await json("__gm.shader.nodeProblem('vout')"),
};
check(
'half of a Texture size at the Vertex output moves the picture as far as 16 does',
colourDistance(sized.left, LEFT) > 60 &&
colourDistance(sized.right, LEFT) < 12 &&
colourDistance(sized.past, RIGHT) < 12 &&
!sized.problem,
{ sized },
);
const lowerHalf = async (subdivisions) => {
await cornered(
[