fix(shader): return 0 for an 8-bit sRGB bilinear cube comparison #3540
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3540"
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?
Imported from boykopovar/AnyPS5. Originally posted by ivica00 on 2026-10-11T12:43:30Z.
What
PPSA02456 (Subnautica Below Zero) stops on current
mainat:The texture is a 1x1 cube, six faces, format 130 (
Format8_8_8_8Srgb). An 8-bit sRGB compare (Format8Srgb,Format8_8Srgb,Format8_8_8_8Srgb) is already 0 for every texel and every compare function, measured withimage_sample_c_lzon gfx1035, so the face selected by a bilinear cube withoutDISABLE_CUBE_WRAPcannot change the result. Float, unorm and snorm bilinear cubes still throw.#3526is a different stop: a device that cannot sample8or8_8sRGB refuses the compare indecodeImageDescriptorbefore that 0 is reached.#3532skips the throw for a depth compare, which then fails mode matching (the descriptor issrgb 1and every emulated mode issrgb 0). This pull request does not change that path.Tested
Windows 11, AMD Radeon RX 9070 XT.
agc_driver_emulated_color_comparepasses: a bilinear unorm cube withoutDISABLE_CUBE_WRAPstill throws, and a bilinear8_8_8_8sRGB cube returns 0 for every compare function. The same run covers the8and8_8sRGB cubes on this GPU, which can sample those formats. PPSA02456 got past the cube throw; the title session was confirmed by hand.On lavapipe and on an RTX 4080 the existing
8/8_8sRGB rows still stop with the#3526refusal. The new8and8_8cube rows run after those, so they do not move that failure. The format 130 rows are not on the shader-decode path.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)Made with Cursor
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-11T12:50:21Z.
I reviewed the code, regression coverage, and debt note. The change is narrowly scoped to the measured 8-bit sRGB constant-zero case, while non-sRGB bilinear cubes retain the existing rejection; I did not find a code issue in this diff. One CI item is actionable: the conventions job fails because commit
bc70de0edis namedRevert "test(shader): run narrow sRGB cube compares after the 2D rows", which is not a Conventional Commit subject. Please rename/squash that revert commit and rerun conventions.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-11T13:11:16Z.
Update: current head
49ecb37ehas a Conventional Commit subject, and the conventions check now passes. My earlier note applied to the priorbc70de0head; thanks for fixing it.Imported from boykopovar/AnyPS5. Originally posted by ivica00 on 2026-10-11T13:35:23Z.
This does not build on #3532, so Depends on stays none.
Both edits are in
EmulatedColorCompare.cpp. This pull request adds the 8-bit sRGB bilinear cube rows, which return 0. #3532 changesRunSrgbZerofor the 2D rows, and its new cube rows still expect theDISABLE_CUBE_WRAPthrow. Whichever merges second has to rebase that test file. If #3532 lands first, those cube rows need to expect 0.Imported from boykopovar/AnyPS5. Originally posted by karanvora2599 on 2026-10-11T15:19:24Z.
Tested 49ecb37e (on
maina11c8f7f) on Windows 11, MinGW-w64 GCC 15.2.0, Release: an RTX 4060 Laptop (driver 591.86), an Intel UHD Graphics (Raptor Lake, driver 101.6790), and lavapipe from Mesa 25.2.8 (the version CI installs) and 26.2.4, both withGALLIUM_OVERRIDE_CPU_CAPS=avx.8_8_8_8sRGB cube rows return 0 on all four. The new8sRGB cube row also passes on the RTX 4060, which can sampleR8_SRGB.!eightBitSrgbterm removed, the first8_8_8_8cube row throwsbilinear cube comparison requires DISABLE_CUBE_WRAPon the RTX 4060 and on lavapipe, so the new rows cover the change.8or8_8sRGB sampling removed locally (the two new cube rows and the four 2D rows),agc_driver_emulated_color_comparepasses on all four devices.One correction to the description: the cube rows come before the 2D sRGB rows in
main()(L362-L363, L377-L380). So on a device that can't sample those formats, the #3526 refusal now first stops the test at the new cube rows: the RTX 4060 (noR8G8_SRGB) stops at the new8_8cube row, and the Intel UHD and both lavapipes at the new8cube row. It's the same refusal as onmain, just earlier, so whether the test passes on those devices doesn't change. The sentence saying the new rows run after the 2D rows matches the reverted commit, not this head.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T21:37:22Z.
Checked on the HW oracle (gfx1035): a bilinear cube without
DISABLE_CUBE_WRAPon8,8_8and8_8_8_8sRGB returns 0 for all 8 compare functions over edge and inner rows (0 of 6048 non-zero), so the check can't change the result. float/unorm/snorm still throw.mainnow has #3532's test, which expects the cube throw for those three formats. I rebased and replaced that expectation with this PR's rows that expect 0 (single commit, your authorship kept). Build and ctest pass; reverting theResourceMaterializer.cppchange makesagc_driver_emulated_color_comparefail. Merging once CI is green.