Repository navigation
Lines wider than a pixel are drawn as shifted strokes: Mario Golf: Super Rush's putting and aiming grids - #2352
secretlemur28 wants to merge 1 commit into
Conversation
…s recorded, and a line of width w is drawn with the viewport moved by whole pixels across w columns and w rows (Mario Golf: Super Rush's putting and aiming grids are 4 pixels wide; as hairlines the moving dashes that show a green's slope could hardly be seen) Metal draws 1-pixel lines only and the width was ignored. OP_LINE_WIDTH carries it to the replay; draw() repeats a line draw 2w times (2w - 1 for an odd w) with the viewport shifted, so a line of any direction comes out about w pixels across, a little heavier where strokes overlap. DM_NVN_LINE_WIDTH=0 draws hairlines as before. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The profile moved from the provisional one the NSP script wrote, with subsdk0 in the build row (the NRO imports the movie API from it) and no patches. Played on an M6: the opening movie, the menus and Standard Golf on the Rookie Course's first hole at 60 fps (GPU p50 6.5 ms). The game note lists what is open: tessellated grass, Golf Adventure's Mii (#2361), the wide lines (#2352), an unexplained black first boot, no IPA. Reference entries found on this game now link to the note. Refs #814
Mario Golf: Super Rush draws its aiming grid at the tee and its putting grid on a green with SetLineWidth 4 and 5. Metal draws lines 1 pixel wide and the host dropped the width, so the grids were hairlines and the putting grid's moving dashes, which show a green's slope, could hardly be seen. SetLineWidth is recorded (OP_LINE_WIDTH) and kept in the replay's state. A draw of lines, a line loop or a line strip whose width rounds to 2 or more is the game's own draw, in its own render pass, with the vertex shader's new wide-line entry (dmsh_pull.py <entry>_wl, in the pulling library) and 6 vertices a segment. Each vertex finds its segment's endpoints from its vertex ID and a line block (the index buffer read on the GPU, restart, base vertex), runs the shader's body for both endpoints, clips the segment in front of the eye with its outputs interpolated as the clipper would, and widens its corner: OpenGL's non-antialiased wide line (Maxwell's), a parallelogram across the minor axis, or the rectangle across the segment when multisampling is on. Culling is off and the polygon offset is the one for lines. Indirect arguments are read on the CPU as the geometry path reads them; an indexed loop with restart, and a vertex shader without the entry, stay 1 pixel wide with a [RED] line. DM_NVN_LINE_WIDTH=0 draws every line 1 pixel wide. Checked: t_wline.m draws through the generated entry on the GPU (lists, loop, strip, indexed with restart and base vertex, 8-bit indices, instances, an endpoint behind the eye, the multisampled rectangle; 22 checks). test_dmsh_pull.py, both lints. Mario Golf on the M6: the tee and putting grids 4 pixels wide, frame time p50 16.67 ms with and without; on the green 2 fewer passes a frame that load and store everything than a first version that captured the endpoints in a pass of its own. regress.py check on Bastion and Return of the Obra Dinn: nothing newly failing, 0 MSL changes, fps equal, screenshots within their noise. Not checked: iOS, indirect wide lines (no game seen), multisampled wide lines in a game. PR #2352 and PR #2510 recorded the width and found the grids' SetLineWidth; the drawing is new. Co-authored-by: secretlemur28 <354896836+secretlemur28@users.noreply.github.com>
|
Landed on main as 7eaf791, with you as co-author. Thank you: recording the width ( The drawing itself is new. Instead of repeating the draw with the viewport moved, a line draw whose width rounds to 2 or more is drawn as one quad per segment, in the game's own render pass. The vertex shader gets a new wide-line entry in its pulling library ( Checked on Mario Golf (Mac, M6): the tee and putting grids are 4 pixels wide, at 16.67 ms per frame with and without. The details are in the commit message and in docs/reference/rendering.md ("Lines wider than a pixel"). |
What and why
Mario Golf: Super Rush (
0100C9C00E25C000, 4.0.0, #814) draws its aiming grid and its putting grid withSetLineWidth 4.0. Metal draws 1-pixel lines only, and the host ignored the width (SetLineWidth 4.00: Metal has only 1-pixel lines), so the grids were hairlines: on a green, the moving dashes along the grid lines, which show the slope, could hardly be seen.The width is now recorded (
OP_LINE_WIDTH) and kept in the replay's state.draw()repeats a line draw (primitive 1 or 3) of width w ≥ 1.5 with the viewport moved by whole pixels across w columns and then across w rows, 2w strokes (2w − 1 for an odd w): a plus-shaped pen, so a line of any direction comes out about w pixels across.DM_NVN_LINE_WIDTH=0draws hairlines as before; the width is capped at 8.What it is not: a quad expansion. Strokes overlap, so a blended line comes out heavier than one stroke would (Golf's white grid reads as solid white), and a line is not capped or mitred. It seemed the smallest change that makes the widths visible; a geometry-based version could replace it behind the same op.
Checked
mainat47607fe0with this change (and A subsdk a provisional profile gains from the NRO collection also goes into its build rows #2215, cra.py reads the 2021 layout of Camelot's archive (Mario Golf: Super Rush 4.0.0) #2216, which the game needs to build): the Rookie Course's aiming grid at the first tee is drawn 4 pixels wide (log:wide lines: width 4.00 drawn as 8 shifted strokes of 1-pixel lines), frame time p50 16.67 ms / p95 16.81. The putting grid was looked at on a branch that carries this with other changes, in the aiming view only; a green was not captured after the change.regress.pyreport; the graphics test suite; iOS. Games that set a width above 1 for lines now get 2w draws for each line draw.Docs
docs/reference/rendering.md("Image clears, dynamic stencil and line width") says what a width above 1 does now;DM_NVN_LINE_WIDTHis indocs/env_switches.tsv🤖 Generated with Claude Code