Repository navigation
BUILD-1151: sample explicit sRGB DDS textures correctly in First Light - #4055
jeremygold02 wants to merge 2 commits into
Conversation
Carry the DDS transfer function to the sampled Vulkan image, view and texture descriptor. Decode RGB before bilinear interpolation in the CPU reference and preserve linear alpha and legacy manifest behavior. Refs: ItsNotRexed#3918
Kam471
left a comment
There was a problem hiding this comment.
Ran this at 6d398841 on Windows 11: python -I tests/test_first_light.py -> 21 tests, OK (4 skipped); compileall and git diff --check clean.
The new unit case distinguishes the two orders exactly: encoded-byte filtering gives ~0.214 for the green midpoint, while decoding the sRGB endpoints first gives 0.5; the test pins 0.5 (red), the sRGB transfer for green/blue, and alpha staying linear. The manifest override case covers inherited VKH_TEX_SRGB for None/False/True, and the legacy DDS path asserts srgb false. The 4 skips are the host/GPU-only cases.
The only coupling worth knowing is dds_png._SRGB_TO_LINEAR (private but in the same tools tree); no blocking issue.
Flyander
left a comment
There was a problem hiding this comment.
Reviewed at 6d39884. I independently ran python -I tests/test_first_light.py: 21 tests passed with 4 expected host/GPU skips; git diff --check is clean. The change consistently carries the explicit DDS sRGB declaration through the Vulkan format, descriptor, manifest, and linear-light CPU reference, while preserving the legacy UNORM default.
|
Tested 6d39884 on NVIDIA RTX 4080, driver 610.88, Windows 11: pass This covers the four GPU/package-gated tests the two earlier checks skipped. Ran (MSVC 19.44 / VS 2022 BuildTools, Ninja, RelWithDebInfo, Vulkan SDK 1.4.363.0):
Review: no findings. Explicit linear formats, legacy headers and manifests without the field all map to Game data stayed local; counts and exit codes only. AI-assisted. |
|
Tested
On main the DXGI 28 and 29 frames are byte-identical, which is the bug. The PR's DXGI 28 frame is byte-identical to main's. The manifest records One thing I noticed, which is not this PR's doing and is already on main: AI-assisted (Claude Code). |
|
Merged upstream I rebuilt the Vulkan harness with MSVC and ran the stock First Light CLI on a synthetic off-centre triangle with two otherwise identical RGBA8 DDS files. Each 64×64 draw covered 253 pixels and passed all four probes. Across every covered pixel, RGB was 0.215820 with the sRGB header and 0.501953 with the linear header. Alpha was 0.250977 in both. Flipping only the prepared sRGB manifest’s transfer flag made the first RGBA probe fail, as expected. GPU execution used the NVIDIA GeForce RTX 5070 (621.01, subgroup 32) on Windows 11 Home 25H2 build 26200.9974 with an Intel Core Ultra 7 265K. With the harness and prepared output configured, the focused Windows suite ran 30 tests with four symlink cases skipped for local privileges. AI-assisted by GPT-6.2 Astra. |
|
Tested I checked the sampling path with a synthetic 2×2 RGBA8 texture whose four texels differ in every channel. I rendered it twice at 64×64 with the harness built from this head, changing only All 4,096 pixels in each draw were within 2/255 per channel of the reference. Maximum absolute channel error was 0.00173 or less for linear sampling and 0.00406 or less for sRGB. Alpha was identical between draws at every pixel. Both shaders passed spirv-val. The separate First Light Python suite had 26 passes and 4 skips. The GPU comparison supplied raw synthetic texels directly to the harness. AI-assisted verification. |
|
Tested I also combined the two-texel filtering control with the off-centre probe path through the stock First Light CLI. I used the translated shader pair from my 1.0.2.1 copy, a synthetic triangle with UV (0.5, 0.5) at all three vertices, and identical two-texel DDS payloads. Each 64×64 draw left the centre clear and passed four off-centre probes. Every one of the 253 covered pixels returned the same raw RGBA within each draw:
The black/white red channel retained its 0.5 midpoint, the mid-grey and low-intensity channels followed their respective transfer branches, and alpha retained its midpoint. Flipping only the prepared sRGB manifest’s transfer flag made AI-assisted. |
|
Tested ff53bd3 (merge base 98fa503) on AMD Radeon 780M (RADV PHOENIX, Mesa 26.2.6) and NVIDIA GeForce RTX 4070 Laptop (620.70.06), CachyOS Linux 7.3.4: pass. Harness built from the PR tree; it merges cleanly with current main 3faac55.
Synthetic inputs only, no game data. AI-assisted. |
BUILD-1151. First Light decoded explicitly sRGB and linear DDS inputs into the same RGBA8 upload layout and always sampled that upload as UNORM. In the independent BC1 control, changing only the DDS declaration between DXGI 71 and 72 produced identical frames on the original implementation. Coordination claim
The manifest now records
texture.srgbfrom the DDS DXGI format. First Light passes the sampling mode to the Vulkan harness, which uses the corresponding format for the sampled image, view and T# descriptor. The CPU reference converts each RGB texel to linear light before bilinear interpolation. Alpha stays linear. Explicit linear formats, legacy DDS headers and old manifests use UNORM, including when the parent process has an sRGB override. Thetexture.rgbabyte layout is unchanged.Based directly on main
aa2988cc. #2806 and #2906 cover earlier textured draw paths. #3863 concerns filtering PNG previews. This PR has no open PR dependency.Verification at
6d39884183c39926f6a19189c5870bce8e6b3f8eVKH_TEX_SRGB=1inherited.git diff --checkpassed.Windows 11 Home 25H2 (26200.9974), Python 3.12.10, Intel Core Ultra 7 265K. GPU draws ran on NVIDIA GeForce RTX 5070, driver 621.01, subgroup 32. Integrated Intel Graphics (32.0.101.9150) was present and unused. GPT-6 Luna implemented the native harness format selection. A separate GPT-6.2 Astra chat performed the independent reference-scene replay.
AI-assisted by GPT-6.2 Astra.