summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2015-02-23 12:28:36 +1000
committerDave Airlie <airlied@redhat.com>2015-07-27 13:23:38 +1000
commit904b3c94bbfc1396ee5c669a6ab65c4876fc2152 (patch)
tree8b929ac3e6c3621a922780552a1bf025cc1b1515
parentf42aa26555425901f44dbf2594b1e0c334739580 (diff)
piglit/util: add support for probing doubles in a buffer.
This is needed to test transform feedback with FP64. Signed-off-by: Dave Airlie <airlied@redhat.com>
-rw-r--r--tests/util/piglit-util-gl.c23
-rw-r--r--tests/util/piglit-util-gl.h4
2 files changed, 26 insertions, 1 deletions
diff --git a/tests/util/piglit-util-gl.c b/tests/util/piglit-util-gl.c
index 04915beb3..1a24067e8 100644
--- a/tests/util/piglit-util-gl.c
+++ b/tests/util/piglit-util-gl.c
@@ -1844,6 +1844,29 @@ bool piglit_probe_buffer(GLuint buf, GLenum target, const char *label,
return status;
}
+bool piglit_probe_buffer_doubles(GLuint buf, GLenum target, const char *label,
+ unsigned n, unsigned num_components,
+ const double *expected)
+{
+ double *ptr;
+ unsigned i;
+ bool status = true;
+
+ glBindBuffer(target, buf);
+ ptr = glMapBuffer(target, GL_READ_ONLY);
+
+ for (i = 0; i < n * num_components; i++) {
+ if (fabs(ptr[i] - expected[i % num_components]) > 0.01) {
+ printf("%s[%i]: %f, Expected: %f\n", label, i, ptr[i],
+ expected[i % num_components]);
+ status = false;
+ }
+ }
+
+ glUnmapBuffer(target);
+
+ return status;
+}
GLint piglit_ARBfp_pass_through = 0;
int piglit_use_fragment_program(void)
diff --git a/tests/util/piglit-util-gl.h b/tests/util/piglit-util-gl.h
index a03226e2e..ddba1bb69 100644
--- a/tests/util/piglit-util-gl.h
+++ b/tests/util/piglit-util-gl.h
@@ -174,7 +174,9 @@ int piglit_probe_rect_halves_equal_rgba(int x, int y, int w, int h);
bool piglit_probe_buffer(GLuint buf, GLenum target, const char *label,
unsigned n, unsigned num_components,
const float *expected);
-
+bool piglit_probe_buffer_doubles(GLuint buf, GLenum target, const char *label,
+ unsigned n, unsigned num_components,
+ const double *expected);
int piglit_use_fragment_program(void);
int piglit_use_vertex_program(void);
void piglit_require_fragment_program(void);