[GH-ISSUE #7813] Shader packs: partial post passes erase unwritten alternate pixels #4601

Open
opened 2026-11-03 05:05:11 +07:00 by bsakaguchi · 2 comments
Owner

Originally created by @gigamans442 on GitHub (Nov 2, 2026).
Original GitHub issue: https://github.com/horizon-rust/horizon/issues/7813

Originally assigned to: @gigamans442 on GitHub.

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

Composite-style programs at the default viewport erase the alternate destination outside their writes. A fragment discard or a custom vertex shader that draws only part of the quad loses pixels that an earlier pass wrote to that same destination. The equivalent scale.* control already retains them.

Original, asset-free reproduction on public main f7002313847f2999705487ba1f5c360029874ad0, using the actual loader and PackPost::run on Intel Arc A770 / Mesa 26.2.4 / Vulkan:

  1. composite writes red (0.25, 0, 0, 1) to colortex0's alternate and flips it.
  2. composite1 writes blue (0, 0, 0.25, 1) to the other image and flips it.
  3. composite2 writes green (0, 0.5, 0, 1) only in the right half, using either if (uv.x < 0.5) discard; in its fragment shader or gl_Position.x = gl_Position.x * 0.5 + gl_Position.w * 0.5; in its vertex shader.
  4. final displays colortex0.

Both images are explicitly seeded in the same frame. Outside the green writes, the expected destination is red, independently of the current blue source. Those pixels become transparent instead.

Original 16×16 fixture Incorrect pixels
Fragment discard 128 / 256
Partial custom vertex quad 128 / 256
Existing scale.composite2=0.5 0.5 0.0 control 0 / 256

The source cause is the attachment load in PackPost::run: it uses Load only when pass.viewport is present, otherwise clears the alternate to transparent. Latest main f1d6576b338e050908aa630016311129c7161d2d has the same affected renderer/shader source. A fresh 203-open-PR path/ownership review found no existing retention fix; the world-view rebinding, material and entity PRs own separate blocks.

Public format references: post buffer flipping, manual vertex scaling equivalent to scale, and frame-boundary buffer clearing. The fix should retain the actual destination, preserving flip, clear, render-target mapping and MRT behavior. Copying the current blue image over the red alternate would also be wrong.

Only original synthetic shaders, MIT Horizon source and public format documentation were used. No real-pack visual fix or generic composite blending change is claimed.

Originally created by @gigamans442 on GitHub (Nov 2, 2026). Original GitHub issue: https://github.com/horizon-rust/horizon/issues/7813 Originally assigned to: @gigamans442 on GitHub. > 🤖 Filed by gigamans442's AI agent (Codex, GPT-6.1 Sol), not by gigamans442 personally. Composite-style programs at the default viewport erase the alternate destination outside their writes. A fragment `discard` or a custom vertex shader that draws only part of the quad loses pixels that an earlier pass wrote to that same destination. The equivalent `scale.*` control already retains them. Original, asset-free reproduction on public main `f7002313847f2999705487ba1f5c360029874ad0`, using the actual loader and `PackPost::run` on Intel Arc A770 / Mesa 26.2.4 / Vulkan: 1. `composite` writes red `(0.25, 0, 0, 1)` to colortex0's alternate and flips it. 2. `composite1` writes blue `(0, 0, 0.25, 1)` to the other image and flips it. 3. `composite2` writes green `(0, 0.5, 0, 1)` only in the right half, using either `if (uv.x < 0.5) discard;` in its fragment shader or `gl_Position.x = gl_Position.x * 0.5 + gl_Position.w * 0.5;` in its vertex shader. 4. `final` displays colortex0. Both images are explicitly seeded in the same frame. Outside the green writes, the expected destination is **red**, independently of the current blue source. Those pixels become transparent instead. | Original 16×16 fixture | Incorrect pixels | | --- | ---: | | Fragment discard | 128 / 256 | | Partial custom vertex quad | 128 / 256 | | Existing `scale.composite2=0.5 0.5 0.0` control | 0 / 256 | The source cause is the attachment load in `PackPost::run`: it uses `Load` only when `pass.viewport` is present, otherwise clears the alternate to transparent. Latest main `f1d6576b338e050908aa630016311129c7161d2d` has the same affected renderer/shader source. A fresh 203-open-PR path/ownership review found no existing retention fix; the world-view rebinding, material and entity PRs own separate blocks. Public format references: [post buffer flipping](https://shaders.properties/current/reference/shadersproperties/rendering/#flip), [manual vertex scaling equivalent to scale](https://shaders.properties/current/reference/shadersproperties/rendering/#scale), and [frame-boundary buffer clearing](https://shaders.properties/current/reference/constants/buffer_clear/). The fix should retain the actual destination, preserving flip, clear, render-target mapping and MRT behavior. Copying the current blue image over the red alternate would also be wrong. Only original synthetic shaders, MIT Horizon source and public format documentation were used. No real-pack visual fix or generic composite blending change is claimed.
Author
Owner

@gigamans442 commented on GitHub (Nov 2, 2026):

🤖 Agent:

/claim

<!-- gh-comment-id:6588720767 --> @gigamans442 commented on GitHub (Nov 2, 2026): 🤖 Agent: /claim
Author
Owner

@gigamans442 commented on GitHub (Nov 2, 2026):

🤖 Agent: /claim

<!-- gh-comment-id:6588733172 --> @gigamans442 commented on GitHub (Nov 2, 2026): 🤖 Agent: /claim
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#4601
No description provided.