[Piglit] [PATCH] ext_render_snorm-render: fix read back assumptions
Tapani Pälli
tapani.palli at intel.com
Tue Aug 28 06:58:14 UTC 2018
Test assumed that we can read back directly from R8, RG8 fbo but
this is not actually enabled by the extension. Patch introduces
additional read from window to sanity check fbo contents.
Signed-off-by: Tapani Pälli <tapani.palli at intel.com>
---
tests/spec/ext_render_snorm/render.c | 32 ++++++++++++++++++++++++++++----
1 file changed, 28 insertions(+), 4 deletions(-)
diff --git a/tests/spec/ext_render_snorm/render.c b/tests/spec/ext_render_snorm/render.c
index 1d4a69c2d..ad309f17c 100644
--- a/tests/spec/ext_render_snorm/render.c
+++ b/tests/spec/ext_render_snorm/render.c
@@ -82,10 +82,11 @@ static const struct fmt_test {
GLenum iformat;
GLenum base_format;
unsigned bpp;
+ bool can_read;
} tests[] = {
- { GL_R8_SNORM, GL_RED, 1, },
- { GL_RG8_SNORM, GL_RG, 2, },
- { GL_RGBA8_SNORM, GL_RGBA, 4, },
+ { GL_R8_SNORM, GL_RED, 1, false },
+ { GL_RG8_SNORM, GL_RG, 2, false },
+ { GL_RGBA8_SNORM, GL_RGBA, 4, true },
};
static GLuint prog;
@@ -229,6 +230,25 @@ verify_contents(const struct fmt_test *test)
return result;
}
+static bool
+verify_contents_float(const struct fmt_test *test)
+{
+ /* Setup expected value, alpha is always max in the test. */
+ char value[4] = { 0, 0, 0, SCHAR_MAX };
+ value_for_format(test, value);
+
+ const float expected[4] = {
+ value[0] / SCHAR_MAX,
+ value[1] / SCHAR_MAX,
+ value[2] / SCHAR_MAX,
+ value[3] / SCHAR_MAX,
+ };
+
+ bool res = piglit_probe_rect_rgba(0, 0, piglit_width, piglit_height,
+ expected);
+ return res;
+}
+
static bool
test_format(const struct fmt_test *test)
{
@@ -282,13 +302,17 @@ test_format(const struct fmt_test *test)
glDeleteTextures(1, &tmp_tex);
/* Verify contents. */
- pass &= verify_contents(test);
+ if (test->can_read)
+ pass &= verify_contents(test);
glDeleteFramebuffers(1, &fbo);
/* Render fbo contents to window. */
render_texture(fbo_tex, GL_TEXTURE_2D, 0);
+ /* Verify window contents. */
+ pass &= verify_contents_float(test);
+
piglit_present_results();
glDeleteTextures(1, &fbo_tex);
--
2.14.4
More information about the Piglit
mailing list