[PR #7858] Shader packs: retain unwritten post destinations and frame clears #7866

Open
opened 2026-11-03 07:25:42 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/7858
Author: @gigamans442
Created: 11/2/2026
Status: 🔄 Open

Base: main ← Head: fix/shader-post-destination-20261102


📝 Commits (2)

  • dc1c6fd fix(shaders): retain unwritten post destinations and frame clears
  • 01d13cb Merge remote-tracking branch 'origin/main' into fix/shader-post-destination-20261102

📊 Changes

3 files changed (+633 additions, -14 deletions)

View changed files

📝 crates/horizon-client-render/src/gfx/pack_post.rs (+47 -14)
➕ crates/horizon-client-render/src/gfx/pack_post/clear_budget_tests.rs (+130 -0)
➕ crates/horizon-client-render/src/gfx/pack_post/destination_tests.rs (+456 -0)

📄 Description

🤖 Opened by gigamans442's AI agent (Codex, GPT-6.1 Sol), not by gigamans442 personally.

What and why

A post shader that discards fragments or draws a partial quad currently clears the unwritten part of its alternate destination. Retain that destination for regular post and shadowcomp passes, matching the existing scaled-pass behavior. The destination can contain a different earlier result from the current main image, so it must be loaded directly.

Also keep configured frame-boundary main-image clears when the first touching post shader writes its alternate. Preserve the existing main-only clear policy, explicit flip=false behavior, custom clear colors and clear=false history.

The required clears are batched within the device's attachment-count and format-aligned byte budget, for both world-blit clears and separate same-size clears. Five legal sequential outputs must not become an invalid six-attachment clear pass.

Fixes #7813.

Kind

  • bug: a crash or a breakage

Vanilla reference

Shader-pack format compatibility; no vanilla gameplay change. Public format references: flip, scale, buffer clearing and clear colors.

Other projects' code

Original production changes and synthetic asset-free GLSL fixtures, using MIT Horizon source and public format/API documentation. Attachment accounting follows the public WebGPU color-attachment budget specification through wgpu's public TextureFormat cost/alignment API. No external translator implementation, Iris/GPL implementation, restricted shader-pack implementation, or player assets were read or copied for this change. Earlier private shader research exists in this workspace; this PR was independently reproduced against public Horizon and contains none of those implementations/assets.

Self-check

Focused GPU checks pass on the complete production candidate: 8/8 tests, covering 20 destination scenarios with 0/3200 wrong pixels, the three-frame clear/history controls and six count/format-budget controls. The new budget fixture failed all six cases natively before batching (attachment count 6/5 > 2 or format cost 48/40 > 32), passed all six after reversing only main-clear eligibility, and passes with both required main clears and safe batching. Preserved pre-fix baseline: 8/20 destination scenarios pass, 12 fail (960/3200 wrong pixels). Loading destinations alone fixes all 20 scenarios while the custom frame-clear fixture still fails; restoring main-clear eligibility passes both original tests. Actual device: Intel Arc A770 / Mesa 26.2.4-arch3.1 / Vulkan. Coverage includes full overwrite, fragment discard, custom vertex coverage, scale, nonzero output mapping, MRT, flip=false, resize, shadowcomp and three-frame clear/history controls. The unseeded first-frame clear=false area is explicitly excluded.

The focused GPU candidate was tested before merging fresh main 56afb1c0d; that merge changes none of the affected renderer/shader files. Local formatting and public tree/history checks pass.

Matching CI checks run 41539153073 passed on head 01d13cb9d459715a1ea626170fc8a3adde80d005: Python tooling tests, workspace formatting and all-target Clippy with warnings denied, client Clippy without default features, workspace library/binary/integration tests, ignored content-root tests, and documentation tests. The eight new test functions report ok in CI; GPU execution evidence is the separate hardware run above.

The local full pr_ready fallback was intentionally interrupted after matching CI started: Python tests and formatting passed, while local Clippy remained incomplete. No completed local self-check block is claimed. Launcher build/lint/test steps were not applicable; parity jobs were skipped by the workflow and are not claimed as passes. No whole-pack visual parity or gameplay check is claimed.

🤖 Generated with Codex


🔄 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/7858 **Author:** [@gigamans442](https://github.com/gigamans442) **Created:** 11/2/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/shader-post-destination-20261102` --- ### 📝 Commits (2) - [`dc1c6fd`](https://github.com/horizon-rust/horizon/commit/dc1c6fd5bf292b61dd4486936e706f13ddf7ef98) fix(shaders): retain unwritten post destinations and frame clears - [`01d13cb`](https://github.com/horizon-rust/horizon/commit/01d13cb9d459715a1ea626170fc8a3adde80d005) Merge remote-tracking branch 'origin/main' into fix/shader-post-destination-20261102 ### 📊 Changes **3 files changed** (+633 additions, -14 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-render/src/gfx/pack_post.rs` (+47 -14) ➕ `crates/horizon-client-render/src/gfx/pack_post/clear_budget_tests.rs` (+130 -0) ➕ `crates/horizon-client-render/src/gfx/pack_post/destination_tests.rs` (+456 -0) </details> ### 📄 Description > 🤖 Opened by gigamans442's AI agent (Codex, GPT-6.1 Sol), not by gigamans442 personally. ## What and why A post shader that discards fragments or draws a partial quad currently clears the unwritten part of its alternate destination. Retain that destination for regular post and shadowcomp passes, matching the existing scaled-pass behavior. The destination can contain a different earlier result from the current main image, so it must be loaded directly. Also keep configured frame-boundary main-image clears when the first touching post shader writes its alternate. Preserve the existing main-only clear policy, explicit flip=false behavior, custom clear colors and clear=false history. The required clears are batched within the device's attachment-count and format-aligned byte budget, for both world-blit clears and separate same-size clears. Five legal sequential outputs must not become an invalid six-attachment clear pass. Fixes #7813. ## Kind - [x] bug: a crash or a breakage ## Vanilla reference Shader-pack format compatibility; no vanilla gameplay change. Public format references: [flip](https://shaders.properties/current/reference/shadersproperties/rendering/#flip), [scale](https://shaders.properties/current/reference/shadersproperties/rendering/#scale), [buffer clearing](https://shaders.properties/current/reference/constants/buffer_clear/) and [clear colors](https://shaders.properties/current/reference/constants/buffer_clear_color/). ## Other projects' code Original production changes and synthetic asset-free GLSL fixtures, using MIT Horizon source and public format/API documentation. Attachment accounting follows the public [WebGPU color-attachment budget specification](https://gpuweb.github.io/gpuweb/#abstract-opdef-calculating-color-attachment-bytes-per-sample) through wgpu's public TextureFormat cost/alignment API. No external translator implementation, Iris/GPL implementation, restricted shader-pack implementation, or player assets were read or copied for this change. Earlier private shader research exists in this workspace; this PR was independently reproduced against public Horizon and contains none of those implementations/assets. ## Self-check Focused GPU checks pass on the complete production candidate: **8/8 tests**, covering 20 destination scenarios with **0/3200 wrong pixels**, the three-frame clear/history controls and six count/format-budget controls. The new budget fixture failed all six cases natively before batching (attachment count 6/5 > 2 or format cost 48/40 > 32), passed all six after reversing only main-clear eligibility, and passes with both required main clears and safe batching. Preserved pre-fix baseline: 8/20 destination scenarios pass, 12 fail (960/3200 wrong pixels). Loading destinations alone fixes all 20 scenarios while the custom frame-clear fixture still fails; restoring main-clear eligibility passes both original tests. Actual device: Intel Arc A770 / Mesa 26.2.4-arch3.1 / Vulkan. Coverage includes full overwrite, fragment discard, custom vertex coverage, scale, nonzero output mapping, MRT, flip=false, resize, shadowcomp and three-frame clear/history controls. The unseeded first-frame clear=false area is explicitly excluded. The focused GPU candidate was tested before merging fresh main `56afb1c0d`; that merge changes none of the affected renderer/shader files. Local formatting and public tree/history checks pass. Matching [CI checks run 41539153073](https://github.com/horizon-rust/horizon/actions/runs/41539153073) passed on head `01d13cb9d459715a1ea626170fc8a3adde80d005`: Python tooling tests, workspace formatting and all-target Clippy with warnings denied, client Clippy without default features, workspace library/binary/integration tests, ignored content-root tests, and documentation tests. The eight new test functions report `ok` in CI; GPU execution evidence is the separate hardware run above. The local full `pr_ready` fallback was intentionally interrupted after matching CI started: Python tests and formatting passed, while local Clippy remained incomplete. No completed local self-check block is claimed. Launcher build/lint/test steps were not applicable; parity jobs were skipped by the workflow and are not claimed as passes. No whole-pack visual parity or gameplay check is claimed. 🤖 Generated with [Codex](https://openai.com/codex/) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
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#7866
No description provided.