diff options
author | Andrii Simiklit <andrii.simiklit@globallogic.com> | 2019-04-05 12:12:36 +0300 |
---|---|---|
committer | Eric Anholt <eric@anholt.net> | 2019-04-17 18:47:58 +0000 |
commit | 08da1d3c23a0b1332981b8a8dda0d12172ca045d (patch) | |
tree | f95c103279dd9d09509db27d4721f80d6ef7382a /tests/spec/ext_packed_depth_stencil | |
parent | a43a8693b9035a013f051707a72bb2bf801ff7ce (diff) |
packed_depth_stencil: warning for a non-zero 24-bit unused field
Spec just saying that it is an unused space.
OpenGl spec "8.4.4.2 Special Interpretations":
"the second word contains a packed 24-bit unused field,
followed by an 8-bit index"
I guess we need at least replace a fail by a warning for non-zero
value because at the moment test requires a driver to do
an unspecified by spec things.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=110305
Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Andrii Simiklit <andrii.simiklit@globallogic.com>
Diffstat (limited to 'tests/spec/ext_packed_depth_stencil')
-rw-r--r-- | tests/spec/ext_packed_depth_stencil/getteximage.c | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/tests/spec/ext_packed_depth_stencil/getteximage.c b/tests/spec/ext_packed_depth_stencil/getteximage.c index 40a12af4c..a08905d72 100644 --- a/tests/spec/ext_packed_depth_stencil/getteximage.c +++ b/tests/spec/ext_packed_depth_stencil/getteximage.c @@ -87,7 +87,7 @@ test_z24_s8(void) static bool -test_z32_s8(void) +test_z32_s8(bool *warn) { const double epsilon = 2.0 / (float) 0xffffff; /* 2-bit error */ GLuint tex[2 * WIDTH * HEIGHT]; @@ -96,6 +96,7 @@ test_z32_s8(void) GLfloat *ftex = (GLfloat *) tex; GLfloat *fbuf = (GLfloat *) buf; + *warn = false; /* init tex data */ for (i = 0; i < WIDTH * HEIGHT; i++) { GLuint s = 255 - (i & 255); @@ -122,18 +123,32 @@ test_z32_s8(void) /* compare */ for (i = 0; i < WIDTH * HEIGHT; i++) { + GLuint s = buf[i*2+1] & 0xffu; + GLuint unused = (buf[i*2+1] >> 8); if (fbuf[i*2+0] != ftex[i*2+0]) { printf("Wrong depth data at position %d: " "Expected %g, found %g\n", i, ftex[i*2+0], fbuf[i*2+0]); return false; } - if (buf[i*2+1] != tex[i*2+1]) { + if (s != tex[i*2+1]) { printf("Wrong stencil data at position %d: " "Expected 0x%08x, found 0x%08x\n", - i, tex[i*2+1], buf[i*2+1]); + i, tex[i*2+1], s); return false; } + if (unused != 0) { + /* OpenGl spec "8.4.4.2 Special Interpretations" is saying: + * the second word contains a packed 24-bit unused field, + * followed by an 8-bit index + * So we don't have any strict clarifications about this field + * behavior but it is safer to have a zero in this field + */ + printf("Warning: Unused 24-bit field at position %d: " + "Expected 0x0, found 0x%08x\n", + i, unused); + *warn = true; + } } /* read back the texture as depth24/stencil8 */ @@ -168,7 +183,7 @@ test_z32_s8(void) void piglit_init(int argc, char **argv) { - bool pass; + bool pass, warn; /* We can create depth/stencil textures if either: * 1. We have GL 3.0 or later @@ -186,10 +201,12 @@ piglit_init(int argc, char **argv) if (piglit_get_gl_version() >= 30 || piglit_is_extension_supported("GL_ARB_depth_buffer_float")) { - pass = test_z32_s8() && pass; + pass = test_z32_s8(&warn) && pass; + } else { + warn = false; } - piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL); + piglit_report_result(pass ? (warn ? PIGLIT_WARN : PIGLIT_PASS) : PIGLIT_FAIL); } |