Repository navigation
fix(agc): round the color compare array layer half to even and compare NOT_EQUAL unordered - #5288
Closed
SandstromPL wants to merge 1 commit into
Closed
SandstromPL wants to merge 1 commit into
SandstromPL wants to merge 1 commit into
Conversation
…e NOT_EQUAL unordered The emulated comparison of a color texture picked the 2D array layer as floor(z + 0.5) and compared NOT_EQUAL ordered. adriadam10 measured both on RDNA2 (gfx1035) in boykopovar#907: the hardware selects clamp(roundEven(z), 0, layers - 1), and NOT_EQUAL is true when the reference, the texel or both are NaN. Carried from boykopovar#907 onto main. Its refusal of TRUNC_COORD with point sampling is left out: in boykopovar#1396, adriadam10 measured with non-comparison samples that the hardware with TRUNC_COORD set selects floor(t), as the emulation does, and that with it clear it selects texel k slightly below k. The debt entry records both TRUNC_COORD cases. Co-authored-by: Akhil Moola <24420588+ThisIsAkill@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Collaborator
|
Closing: no title is known to reach this. With the queue at 700+ open PRs, please hold off on new PRs that don't name a title needing the change until it's down. If a title stops on this on current main, reopen with the title ID and the log line. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
This carries #907 by @ThisIsAkill, the review follow-up to #668.
mainsince perf(agc): baseline shader recompilation on registration #639 (2026-10-08). oneandonlydean asked for a rebase on 2026-10-11 and noted that both fixes are still needed.The two fixes, both measured by adriadam10 in #907's review on RDNA2 (gfx1035,
image_sample_c_lzon a 32_FLOAT texture):floor(z + 0.5). The hardware usesclamp(roundEven(z), 0, layers - 1): z = 0.5 gives layer 0, 2.5 gives 2, and 0.49999997 gives 0 (in f32,0.49999997 + 0.5rounds to 1.0). The layer is nowGLSLstd450RoundEven, as that review suggested.OpFUnordNotEqual. fix(shader): emit ordered not-equal through an integer NaN check #1473's AMD Windows driver issue is with an ordered not-equal that feeds a ballot. This one feeds a select, as fix(shader): emit ordered not-equal through an integer NaN check #1473 notes.8-bit UNORM and sRGB textures return 0 for every function (#3438, #4267), so they are not affected.
TRUNC_COORD is not refused. This differs from #907, and from adriadam10's request there on 2026-10-07 ("keep the
TRUNC_COORDpart"). #907 threw forTRUNC_COORDwith point sampling, answering point 3 of #668's review. That throw is left out because of a later measurement. On 2026-10-08, in adriadam10's #1396 review (format 43,image_sample_lz/image_sample_l, gfx1035; non-comparison samples), the setting was measured both ways:floor."floorgives k - 1.The emulation picks a point-sampled texel with
floor. So #907's throw refused the case the emulation gets right, and accepted the case it gets wrong.That #1396 review asked to model the clear case or throw for it. Throwing would refuse the default S#, and modelling it needs the threshold below k, which is not measured. So this PR names the clear case in the debt entry, as adriadam10 suggested in #907 for
TRUNC_COORDunder bilinear filtering ("either throw for it too or name it in that sentence"). The debt entry also says thatTRUNC_COORDchanges the bilinear weights on hardware. A new test row samples withTRUNC_COORDset under point filtering and expectsfloor.Tested
Ubuntu 24.04, GCC 13.3, Release with
BUILD_TESTING=ON, onmain0214069. Locally, the libusb lines were removed fromCMakeLists.txt, because the libusb submodule isn't checked out here.agc_driver_emulated_color_comparegains these cases, adapted from #907:TRUNC_COORDset, expectingfloor. It replaces fix(agc): color compare emulation: review follow-up to #668 #907's check that this sampler is rejected.Each fix is needed:
main, the 2D array rows fail:2D array, point, clamp to edge: thread 4 compared to 1.000000, expected 0.000000 from layer 0(layer coordinate 0.5). A CPU model of the expected values shows that the rows also catch:floor(z + 0.5)at 0.49999997 and 2.5;floor(z)at 0.99 and 1.5.half float, NOT_EQUAL with NaN and signed zero: thread 1 compared to 0.000000, expected 1.000000.main.agc_driver_emulated_color_compare_srgb_decodepasses too.Full
cteston the RTX 3050 Ti at this head: 1,067 of 1,069 pass, 7 of them skipping themselves (VideoOut without a display,agc_driver_stencil_ref_export).guest_usbdandpatched_librariesare not built, because of the missing libusb submodule.Other checks:
git merge-tree. This branch adds no conflict to any of them, apart from fix(agc): color compare emulation: review follow-up to #668 #907 itself.tools/check_conventions.pyfrommainpasses with this title and body.Checklist
main; no other open PR implements the same functions (apart from fix(agc): color compare emulation: review follow-up to #668 #907, which this carries)NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code