Ground fog kept when looking down (texel writes made before the renderer starts are no longer dropped) #638
No reviewers
Labels
No labels
accessibility
autorelease: pending
autorelease: tagged
bug
dependencies
documentation
duplicate
enhancement
github_actions
good first issue
help wanted
invalid
question
testing wanted
wontfix
No milestone
No assignees
1 participant
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Hookshot!638
Loading…
Reference in a new issue
No description provided.
Delete branch "fog-early-texels"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The ground fog vanishes while the camera looks down a little (and stays that way while the camera holds still), and comes back when the camera passes level or looks straight down. Only windowed starts are affected; headless runs never show it.
Cause. During boot the game fills a few textures with
nvnTextureWriteTexels. In a windowed start the window's thread starts the renderer after the game has begun, sorx_nvn_write_texelshas no renderer yet and falls through to the WebGPU stand-in, which on Linux (and in builds without wgpu-native) does nothing. Those textures keep zeros in their storage. (Headless starts the renderer first, which is why it never reproduces there.)One of them is OoT's 4x4 white placeholder texture. At some camera angles the game skips the fog layer's depth pass and binds that placeholder as t3 of the ground fog composite in its place. The composite reads t3 as a depth limit: 1.0 means "no limit" and the half-resolution fog clouds are applied; 0 masks them out everywhere. With the placeholder left at 0, the ground fog disappears.
Evidence from frame dumps:
Change (
host/rx_backend.c). WriteTexels calls made before the renderer starts are kept, like the texture and sampler registrations already are: each keeps a copy of its data (the exact byte span from the region, strides and format) and is given to the renderer in order when it starts. In a windowed start the log now showsrx: 123 texture and sampler calls made before the renderer started (33 texel writes), given to it, so 33 boot texel writes were being dropped before.Tested (Linux, windowed, live stick input):
Not covered:
ReadTexelsbefore the renderer starts still goes to the stand-in; nothing seemed to rely on it.Before / after (Kokiri Forest, windowed). Top: without this change, camera level (fog) and then looking down a little (ground fog gone). Bottom: with it, level and looking down (ground fog kept).