Commit Graph

193 Commits

Author SHA1 Message Date
Ludovic Marie 0b1ed3cdf5 Merge pull request #2175 from rdbtCVS/t3/fix-breaking-crack-jitter
🤖 Agent: Gate check by Ludovic's AI agent (Claude). Checked: the crack overlay keeps its UVs aligned from one stage to the next. Its ignored GPU test passes here (macOS, Metal). Gate: this wave's 55 PRs merged on main in one tree: clippy `-D warnings` clean, 1186 horizon-client and 163 horizon-world tests pass, and of the 101 harnesses `parity.py --changed-files` picked, 100 pass (`block_removal` failed on one spawner case from #2199's orb merging, fixed there). `lan_e2e.py` passes 24 checks with the host on its server thread and in-frame (chest, xp, pvp, doors, villagers, beds, frames, projectiles, arrows, fishing, damage, mobs, blast, drops, elytra, breath, predict, cracks, barter, kills, hurt, contacts, underwater, plates), plus forced-levels on the server thread. Thanks @rdbtCVS!
2026-10-26 18:33:51 +01:00
Ludovic Marie 27f9120510 Merge pull request #2021 from senjinthedragon/hdr-output
🤖 Agent: Gate check by Ludovic's AI agent (Claude). I merged main and added `crates/horizon-hdr` to the workspace, and pushed caae02641 so that native material packs keep a light-emitting translucent face (nether portal) at its own alpha. HDR stays off by default. With it off, screenshots match main within noise, and the frame time does too (A/B, two runs each: p50 0.326 to 0.329 ms vs 0.317 to 0.345 ms). `section_mesh` passes. HDR on was not tested here (no HDR display on the Mac mini). Thanks @senjinthedragon!
2026-10-26 16:23:13 +01:00
Ludovic Marie aec52c85e9 Merge pull request #2041 from Domanffe/perf/uniform-values-reuse
🤖 Agent: contrib-gate-17 verified this head (26.3 sources, integration tree build, clippy, tests, parity; details in the PR comment). Thanks @Domanffe!
2026-10-26 14:44:52 +01:00
Ludovic Marie caae026416 HDR: keep native material packs' vertex tint opaque
The mesher now keeps a face's light emission in its colour's alpha byte. The
terrain shader drops it, but the native material path (merged since) passed
the colour through as the tint, so a light-emitting translucent face such as
a nether portal drew a little more transparent with HDR off.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 14:42:00 +01:00
Ludovic Marie 92ed365a19 Merge main into hdr-output
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 14:41:59 +01:00
rdbtCVS 6e0a49029f Keep block-breaking cracks aligned between stages
Restore integer atlas origins and sample local texel centers before nearest filtering. Cover the packed stage origins with a GPU sampling regression.

Fixes #1882.

Co-Authored-By: Codex GPT-6.1 Sol <noreply@openai.com>
2026-10-26 13:39:51 +00:00
Ludovic Marie aea0df9770 Merge pull request #2122 from ludovic111/feat/native-material-stage
🤖 Agent: verified: pr_ready --quick green at this head, 33/33 affected harnesses pass locally, CI verify green, A/B shows no frame cost without a pack. A Horizon shader pack's material stage now colours terrain in the game.
2026-10-26 13:38:03 +01:00
Alexander Krylov 02f147f137 Merge remote-tracking branch 'origin/main' into perf/uniform-values-reuse 2026-10-26 15:07:14 +03:00
Ludovic Marie 43929f3ff8 Merge pull request #2090 from ludovic111/perf/teleport-drop-off-frame
🤖 Agent: pr_ready passed (79 harnesses, 1299 client tests), lan_e2e passed in-frame and on the server thread (portals, levels, distance). Mass-drop frame at RD 32: 26-40 → 7-8.5 ms. Queued for merge.
2026-10-26 13:02:03 +01:00
Ludovic Marie c813261574 Horizon shader packs: the material stage runs in the game
A pack's `fn material(input: MaterialInput) -> Surface` now gives the lit
colour of every terrain surface: sections and distant tiles, solid,
cutout and translucent, in both the instanced and the flat draws. Terrain
keeps Horizon's meshes, culling and draw lists; only its pipelines change.
Their shader is the pack's stage, a prefixed copy of terrain.wgsl's
terrain section, and entries that hand the pack the texture, the vertex
tint, the light levels and the lightmap's colour apart, then apply the
alpha test and fog as `fs_solid` and `fs_translucent` do.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 11:35:15 +01:00
Ludovic Marie 08f4fd5c8e Teleports free their dropped columns off the frame and in batches
A teleport far away (or a storage that moves by more than its size) drops
every column in one frame: 3,725 at RD 32. That frame freed every column's
sections, then removed each section from the renderer one at a time, with
a few hash lookups per section and a free-list tree update per mesh range.

- The dropped columns, and a left dimension's whole chunk map, are freed on
  a short-lived thread of their own ("Chunk freeing").
- Renderer::remove_columns removes whole columns: one lookup per column for
  the tables kept by column, and the meshes' ranges go back to the arena in
  one sorted merge per page (FreeList::give_all) instead of a tree update
  each. Per-section Renderer::remove and Occlusion::remove had no other
  callers and are gone.
- The renderer's block-entity and detail-column tables use FxHashMap.

Mac mini (M4 Pro), RD 32, explored world, server thread, 3 alternated runs,
two long teleports each: the drop took 26.1-39.7 ms, now 6.9-8.5 ms.
Entering the Nether: 9.7-13.4 ms, now 4.0 ms or under 6 ms.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 11:10:25 +01:00
Senjin 728c6a62b3 HDR: the emission mark in the vertex colour's alpha, not a layer bit
EMISSIVE_LAYER took bit 14 of TerrainVertex::layer, halving the sprite
layers terrain vertices can index (32768 to 16384) and leaving no flag
bit free. The colour's alpha byte was always 0xFF: its low four bits now
hold 15 minus the light level the face emits (EMISSION_BITS), so 0xFF
still means none and the other four bits stay free. terrain.wgsl takes
only the colour's rgb and passes the level on; Java shader packs get
alpha 1; the section mesh fixture restores vanilla's 0xFF.

The HDR pass still lifts any emitting face the same way; the level is
there for scaling the lift by it later.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 11:03:16 +01:00
Senjin 9b863d6093 HDR output: scRGB swapchain, HDR metadata and emissive highlights
HDR (Graphics > Display, off by default) presents to an scRGB swapchain
where the surface offers it. The frame is drawn as in SDR, in vanilla's
gamma space; a last pass decodes it at the Paper White and lifts light
sources (blocks that emit light, lava, the sun and the moon) evenly
towards the Peak Brightness.

The mesher marks emitting faces with EMISSIVE_LAYER (bit 14 of the
layer); the frame's alpha carries the mark to the HDR pass, which lifts
only pixels that still show the world before the hand and HUD.

horizon-hdr sends HDR metadata through VK_EXT_hdr_metadata, which wgpu
doesn't: without it KWin clips scRGB content above 1.0 (80 nits).

Part of #1441.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 11:03:16 +01:00
Ludovic Marie acbcaad743 Horizon shader packs: one WGSL prefixer for copies of the renderer's shaders
The sky stage runs a copy of terrain.wgsl's sky beside the pack's code
with every name prefixed `horizon_sky_`. The prefixer moves to
`gfx/wgsl_prefix.rs` and now also renames module variables (bindings)
and overrides, so the material stage can copy the terrain section the
same way. The sky's shader is unchanged apart from where `globals` is
declared.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 10:56:39 +01:00
Ludovic Marie cad817c82d Horizon shader packs: the sky stage runs in the game
A pack's `sky` function gets vanilla's colour along each view ray and draws
where the vanilla sky dome draws, under the sun, moon, stars and clouds. The
pipeline's shader is the pack's checked stage (`CheckedStage::source`, new)
followed by a copy of terrain.wgsl's sky with every name prefixed
`horizon_sky_`, so none can meet a pack's; terrain.wgsl's `fs_sky` now calls
`sky_along_ray`, the same code as before.

A running pack is one `NativePack`: the frame every stage reads (written once
a frame), its sky and post stages and its pass timer. In a frame F3 times, the
sky draws in a pass of its own so the overlay can show its time; otherwise it
stays in the world's pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 08:42:57 +01:00
Ludovic Marie a68c2f587d Horizon shader packs: one frame uniform per pack, apart from its post passes
`NativePack` holds what a running pack needs: the `frame` every stage
reads (`NativeFrame`, written once a frame before the world draws), its
post passes and the timer of its passes. `NativePost` no longer owns the
frame buffer or the timer, so the sky stage can read the same frame and
be timed by the same timer. No change in what draws.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 08:42:46 +01:00
Alexander Krylov b59d9ada27 Shaders: the frame uniforms keep their buffer between frames
update rebuilt the values vector every frame for a fixed-length list: one
allocation and one free per frame for nothing. eval_custom already treats
the same vector as a buffer to truncate and extend.

Co-Authored-By: Hermes Agent (Nous Research) <noreply@nousresearch.com>
2026-10-26 09:49:41 +03:00
Ludovic Marie c3763ff1b3 F3 shows the shader pack's GPU time per pass, for either kind of pack
While the F3 overlay is open, the running pack's passes are timed on the GPU,
a shaders/ pack's or a native pack's, and the overlay lists the pack's total
and its costliest passes (the median of the last 15 timed frames). The timer
never waits: a timed frame's stamps are resolved once the GPU has finished it
and read back once mapped, then the next frame is timed. A native pack's first
pass counts from a mark that ends with the world's draws, so it does not carry
the time it waited for them. HORIZON_SHADER_PACK_TIMING still logs the medians.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 06:48:57 +01:00
Ludovic Marie 1aa6f21620 Horizon shader packs: the post stage runs in the game, with hot reload
A native pack named by HORIZON_SHADER_PACK (a folder with horizon-shaders.toml
or a .hshader in shaderpacks/) is checked, then its post passes run over the
world's own target, the one a shaders/ pack reads: no second target and no
extra pass, and without a pack the frame only tests one Option. The pack is
looked at twice a second; a saved file is checked and rebuilt in place, and a
version that fails is refused in the chat while the last good one keeps
drawing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 05:35:00 +01:00
Ludovic Marie 1dff593ac3 Merge feat/shader-packs-shadow-entities into feat/shader-packs-shadow-casters
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-26 03:05:49 +01:00
Ludovic Marie 4292806437 Merge feat/shader-packs-shadow-terrain into feat/shader-packs-shadow-entities
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-26 03:04:24 +01:00
Ludovic Marie c841ab6d56 Merge feat/shader-packs-shadow-buffers into feat/shader-packs-shadow-terrain
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-26 03:02:40 +01:00
Ludovic Marie 8b7315a6ff Merge feat/shader-packs-shadow-programs into feat/shader-packs-shadow-buffers
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-26 03:01:43 +01:00
Ludovic Marie 86a2f8e470 Merge feat/shader-packs-hand into feat/shader-packs-shadow-camera
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-26 02:58:53 +01:00
Ludovic Marie ffda62db09 Merge feat/shader-packs-held-items into feat/shader-packs-hand
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-26 02:53:39 +01:00
Ludovic Marie ae3bbe6bb4 Merge feat/shader-packs-weather into feat/shader-packs-held-items
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-26 02:52:31 +01:00
Ludovic Marie 34397fe09d Merge feat/shader-packs-clouds into feat/shader-packs-weather
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-26 02:50:35 +01:00
Ludovic Marie 94c1b5bfaa Merge feat/shader-packs-translucent-entities into feat/shader-packs-clouds
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-26 02:49:32 +01:00
Ludovic Marie eab457d0ae Merge feat/shader-packs-entities into feat/shader-packs-translucent-entities
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-26 02:48:31 +01:00
Ludovic Marie 02248f4314 Merge feat/shader-packs-alpha-test into feat/shader-packs-entities
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-26 02:45:08 +01:00
Ludovic Marie b0fd6e660e Merge feat/shader-packs-entity-spans into feat/shader-packs-alpha-test
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-26 02:41:50 +01:00
Ludovic Marie 91b0db48e7 Merge feat/shader-packs-sildurs into feat/shader-packs-entity-spans
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-26 02:38:42 +01:00
Ludovic Marie 01ef17a258 Merge feat/shader-packs-mip-current into feat/shader-packs-sildurs
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-26 02:37:36 +01:00
Ludovic Marie 2203c1777a Merge feat/shader-packs-biomes into feat/shader-packs-mip-current
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-26 02:36:22 +01:00
Ludovic Marie 04000cb4db Merge feat/shader-packs-normals into feat/shader-packs-biomes
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-26 02:35:21 +01:00
Ludovic Marie 3f10f57178 Merge feat/shader-packs-block-ids into feat/shader-packs-normals
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-26 02:34:28 +01:00
Ludovic Marie 2b05e2809b Merge feat/shader-packs-arena-storage into feat/shader-packs-block-ids
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-26 02:32:06 +01:00
Ludovic Marie b023ab934a Merge feat/shader-packs-sun-moon into feat/shader-packs-arena-storage
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-26 02:30:35 +01:00
Ludovic Marie 181d188324 Merge feat/shader-packs-sky into feat/shader-packs-sun-moon
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-26 02:28:17 +01:00
Ludovic Marie f299e18fc6 Merge feat/shader-packs-draw-uniforms into feat/shader-packs-sky
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-26 02:25:46 +01:00
Ludovic Marie 0f1ab46921 Merge feat/shader-packs-mipmaps into feat/shader-packs-draw-uniforms
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-26 02:24:37 +01:00
Ludovic Marie f1fc01ffcf Merge feat/shader-packs-timing into feat/shader-packs-mipmaps
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-26 02:23:46 +01:00
Ludovic Marie 4ee54d84a8 Merge feat/shader-packs-water into feat/shader-packs-timing
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-26 02:22:48 +01:00
Ludovic Marie e5f4d02549 Merge feat/shader-packs-real-buffers into feat/shader-packs-water
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-26 02:16:49 +01:00
Ludovic Marie f1a3409721 Merge feat/shader-packs-custom-uniforms into feat/shader-packs-real-buffers
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-26 02:14:28 +01:00
Ludovic Marie ff3d57ea9c Merge feat/shader-packs-run-globals into feat/shader-packs-custom-uniforms
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-26 02:12:44 +01:00
Ludovic Marie 7bbd715c8c Merge origin/main into feat/shader-packs-terrain-draw
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-26 01:48:29 +01:00
Ludovic Marie 21203de7f0 Animated sprites: the CPU path also when the driver cannot build the compute pipeline
An OpenGL driver can list compute shaders among its extensions while wgpu writes GLSL of its core
version, which has none (seen under MESA_GL_VERSION_OVERRIDE=3.3: the pipeline failed and the game
panicked). The pipeline is now created inside error scopes, and a failure falls back to the CPU path
with one warning.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 21:33:05 +01:00
Ludovic Marie 1a16e35aaa Animated sprites without compute shaders (OpenGL before 4.3)
SpriteAnimator wrote every changed sprite with a compute pass, which OpenGL 3.3 to 4.2 has no
equivalent for in wgpu: creating the pipeline failed. Without compute shaders and storage, the same
jobs now run on the CPU with animate.wgsl's integer mix, and each level is copied into its layer
through the upload belt. The GPU test runs both paths against the same CPU reference.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 21:25:37 +01:00
Ludovic Marie ac47b988c9 Shader packs, clean room 42: culled entities, the first-person player, shadowPlayer and shadowLightBlockEntities in the shadow pass
Entities Horizon's entity culling hides from the camera keep their vertices in a hidden span that
only the pack's shadow pass draws; the local player's model is built in first person, hidden from
the camera, while the pack casts entity shadows. shadowPlayer draws the player alone when
shadowEntities is off, shadowLightBlockEntities the light-emitting block entities when
shadowBlockEntities is off. Without a shader pack nothing changes.

Clean-room: implemented from cleanroom/shader-packs-spec.md revision 1, §2.4, §3.2; no other
loader's code read.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 21:21:05 +01:00