cogl/tests: Avoid rounding/truncation ambiguity in 8/16bpc conversion
The OpenGL specs say rounding is preferred, but not required. Let's avoid that uncertainty by choosing a test value that rounds and truncates to the same integer either way. Only green needs fixing since our red, blue and alpha values already follow this rule. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3903>
This commit is contained in:
parent
5360c58fe5
commit
7df6b5c4ed
1 changed files with 2 additions and 3 deletions
|
@ -58,7 +58,7 @@ test_offscreen_texture_formats_store_rgba16161616 (void)
|
|||
GError *error = NULL;
|
||||
uint8_t readback[8 * 4];
|
||||
const uint16_t rgba16_red = 515;
|
||||
const uint16_t rgba16_green = 61133;
|
||||
const uint16_t rgba16_green = 60987;
|
||||
const uint16_t rgba16_blue = 2;
|
||||
const uint16_t rgba16_alpha = 1111;
|
||||
int i;
|
||||
|
@ -125,8 +125,7 @@ test_offscreen_texture_formats_store_rgba16161616 (void)
|
|||
uint8_t *pixel_data = (uint8_t *) &readback[i * 4];
|
||||
|
||||
g_assert_cmpint (pixel_data[0], ==, rgb16_to_rgb8 (rgba16_red));
|
||||
/* this one is off by one, no idea why */
|
||||
/* g_assert_cmpint (pixel_data[1], ==, rgb16_to_rgb8 (rgba16_green)); */
|
||||
g_assert_cmpint (pixel_data[1], ==, rgb16_to_rgb8 (rgba16_green));
|
||||
g_assert_cmpint (pixel_data[2], ==, rgb16_to_rgb8 (rgba16_blue));
|
||||
g_assert_cmpint (pixel_data[3], ==, rgb16_to_rgb8 (rgba16_alpha));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue