Skip to content

tests: Compare sampled UNORM values with a tolerance - #13209

Merged
spencer-lunarg merged 1 commit into
KhronosGroup:mainfrom
apollo-2006:vl-unorm-tolerance
Sep 23, 2026
Merged

spencer-lunarg merged 1 commit into
KhronosGroup:mainfrom
apollo-2006:vl-unorm-tolerance

Conversation

@apollo-2006

@apollo-2006 apollo-2006 commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

The descriptor heap sampler tests clear an R8G8B8A8_UNORM image to {0.2, 0.4, 0.6, 0.8}, sample it, and compare with ASSERT_EQ. 0.2 is stored as 51 and read back as 51 / 255. lavapipe computes that as 51 * (1 / 255.0f) = 0.200000018, one ULP above 0.2f, so all 11 tests fail there, while RADV happens to round to 0.2f exactly.

The spec doesn't require the conversion to be exact to the last ULP, so this switches to ASSERT_NEAR with 0.0001f, the same tolerance descriptor_buffer_positive.cpp already 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.

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.
@apollo-2006
apollo-2006 requested a review from a team as a code owner September 23, 2026 16:28
@ci-tester-lunarg

Copy link
Copy Markdown
Collaborator

Author apollo-2006 not on autobuild list. Waiting for curator authorization before starting CI build.

@spencer-lunarg
spencer-lunarg merged commit e86affb into KhronosGroup:main Sep 23, 2026
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants