tests: Compare sampled UNORM values with a tolerance - #13209
Merged
Merged
Conversation
0.2 is stored as 51 and lavapipe returns 51 * (1 / 255.0f) = 0.200000018, so ASSERT_EQ against 0.2f fails 11 tests. Use ASSERT_NEAR, as descriptor_buffer_positive.cpp does.
Collaborator
|
Author apollo-2006 not on autobuild list. Waiting for curator authorization before starting CI build. |
spencer-lunarg
approved these changes
Sep 23, 2026
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.
The descriptor heap sampler tests clear an
R8G8B8A8_UNORMimage to{0.2, 0.4, 0.6, 0.8}, sample it, and compare withASSERT_EQ. 0.2 is stored as 51 and read back as 51 / 255. lavapipe computes that as51 * (1 / 255.0f) = 0.200000018, one ULP above0.2f, so all 11 tests fail there, while RADV happens to round to0.2fexactly.The spec doesn't require the conversion to be exact to the last ULP, so this switches to
ASSERT_NEARwith0.0001f, the same tolerancedescriptor_buffer_positive.cppalready uses for this kind of check.Found by running the test suite on lavapipe.
Tested: all 11 pass on lavapipe and RADV, and the full suite passes with the mock ICD and max_profile.json.