[PR #5434] [MERGED] Native mods: render hook points (world drawn, render needs) #6287

Closed
opened 2026-11-03 06:17:48 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/5434
Author: @levzzz5154
Created: 10/31/2026
Status: ✅ Merged
Merged: 10/31/2026
Merged by: @levzzz5154

Base: main ← Head: mods/render-hooks


📝 Commits (2)

  • 1de5955 Native mods: render hook points (world drawn, render needs)
  • 09c3831 Merge remote-tracking branch 'hr/main' into mods/render-hooks

📊 Changes

6 files changed (+185 additions, -17 deletions)

View changed files

📝 crates/horizon-client-render/src/gfx.rs (+29 -1)
➕ crates/horizon-client-render/src/gfx/native_render.rs (+74 -0)
📝 crates/horizon-client/src/game/native_hooks.rs (+13 -7)
📝 crates/horizon-client/src/game/shader_packs.rs (+36 -9)
📝 docs/native-mods.md (+16 -0)
➕ tools/native-hook-fragments/render.json (+17 -0)

📄 Description

🤖 Opened by levzzz5154's AI agent (Claude Code, Claude Opus 5.5), not by levzzz5154 personally.

Two hook points in the renderer, so a native mod can draw effects that need the frame: post effects, motion blur, outlines, overlays.

  • native_world_drawn(&mut WorldDrawn) runs once the world is drawn (sky, terrain, entities, particles, weather, the world post pass), before the hand, the HUD and screens. It isn't called for the title panorama. It gets:
    • the device, queue and encoder;
    • the colour target and its format;
    • the world's reversed depth, and its size when the world draws scaled;
    • the camera position, and the matrices with and without TAA's jitter;
    • the frame's camera-relative entity quads with their runs by entity;
    • the entity atlas and the shared quad index buffer.
  • native_render_needs(&mut RenderNeeds): mods set entity_spans (entity runs without a shader pack; ids are a stable hash of the entity type, block entities get their state) and world_depth (keep the world pass's depth when nothing else does). It takes flags instead of returning a bool, so several mods can ask at once.

They live in the render crate (gfx/native_render.rs), since the renderer can't see Game. Bundles target them as horizon_client_render::gfx::native_render::native_<name>. catalog_matches_hook_points now accepts hook points there, so they're catalogued and versioned like the rest. The API number comes from the fragment tools/native-hook-fragments/render.json. There's a new section in docs/native-mods.md, "Render hook points".

Tested with a motion blur mod built on this branch: horizon-mixins 4342a0b, offscreen game driven by horizon-ctl. It uses both hooks, native_frame and the Options > Mods settings hooks. Its entity runs match from frame to frame, and the blur and velocity passes run every frame.

Self-check (tools/pr_ready.py --quick): 6 files, +185 −17. rustfmt and clippy pass; horizon-client and horizon-client-render tests pass (2304); Python tests pass (505).

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/5434 **Author:** [@levzzz5154](https://github.com/levzzz5154) **Created:** 10/31/2026 **Status:** ✅ Merged **Merged:** 10/31/2026 **Merged by:** [@levzzz5154](https://github.com/levzzz5154) **Base:** `main` ← **Head:** `mods/render-hooks` --- ### 📝 Commits (2) - [`1de5955`](https://github.com/horizon-rust/horizon/commit/1de5955c402339145d2b9f43eb6594196b0e364c) Native mods: render hook points (world drawn, render needs) - [`09c3831`](https://github.com/horizon-rust/horizon/commit/09c383118e408f22cf802c5020faf3aea53753d3) Merge remote-tracking branch 'hr/main' into mods/render-hooks ### 📊 Changes **6 files changed** (+185 additions, -17 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-render/src/gfx.rs` (+29 -1) ➕ `crates/horizon-client-render/src/gfx/native_render.rs` (+74 -0) 📝 `crates/horizon-client/src/game/native_hooks.rs` (+13 -7) 📝 `crates/horizon-client/src/game/shader_packs.rs` (+36 -9) 📝 `docs/native-mods.md` (+16 -0) ➕ `tools/native-hook-fragments/render.json` (+17 -0) </details> ### 📄 Description > 🤖 Opened by levzzz5154's AI agent (Claude Code, Claude Opus 5.5), not by levzzz5154 personally. Two hook points in the renderer, so a native mod can draw effects that need the frame: post effects, motion blur, outlines, overlays. - **`native_world_drawn(&mut WorldDrawn)`** runs once the world is drawn (sky, terrain, entities, particles, weather, the world post pass), before the hand, the HUD and screens. It isn't called for the title panorama. It gets: - the device, queue and encoder; - the colour target and its format; - the world's reversed depth, and its size when the world draws scaled; - the camera position, and the matrices with and without TAA's jitter; - the frame's camera-relative entity quads with their runs by entity; - the entity atlas and the shared quad index buffer. - **`native_render_needs(&mut RenderNeeds)`**: mods set `entity_spans` (entity runs without a shader pack; ids are a stable hash of the entity type, block entities get their state) and `world_depth` (keep the world pass's depth when nothing else does). It takes flags instead of returning a bool, so several mods can ask at once. They live in the render crate (`gfx/native_render.rs`), since the renderer can't see `Game`. Bundles target them as `horizon_client_render::gfx::native_render::native_<name>`. `catalog_matches_hook_points` now accepts hook points there, so they're catalogued and versioned like the rest. The API number comes from the fragment `tools/native-hook-fragments/render.json`. There's a new section in docs/native-mods.md, "Render hook points". Tested with a motion blur mod built on this branch: horizon-mixins `4342a0b`, offscreen game driven by horizon-ctl. It uses both hooks, `native_frame` and the Options > Mods settings hooks. Its entity runs match from frame to frame, and the blur and velocity passes run every frame. **Self-check** (`tools/pr_ready.py --quick`): 6 files, +185 −17. rustfmt and clippy pass; horizon-client and horizon-client-render tests pass (2304); Python tests pass (505). 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 06:17:48 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon#6287
No description provided.