[gegl/gsoc2011-opencl: 18/18] OpenCL Unit-Tests: GeglBuffer



commit a213773e4c19cbdee6d500c97a237d7187c52b40
Author: Victor Oliveira <victormatheus gmail com>
Date:   Tue Jul 26 10:22:06 2011 -0300

    OpenCL Unit-Tests: GeglBuffer

 tests/opencl/Makefile.am              |    3 +-
 tests/opencl/test-gegl-buffer-blank.c |   55 +++++++++++++++++++++++++++++++++
 2 files changed, 57 insertions(+), 1 deletions(-)
---
diff --git a/tests/opencl/Makefile.am b/tests/opencl/Makefile.am
index 48432a6..92a1692 100644
--- a/tests/opencl/Makefile.am
+++ b/tests/opencl/Makefile.am
@@ -13,7 +13,8 @@ noinst_PROGRAMS = \
 	test-gegl-tile-lock-mode-write-then-read \
 	test-gegl-tile-lock-mode-cl-write-then-read \
 	test-gegl-tile-lock-mode-write-then-cl-read \
-	test-gegl-tile-lock-mode-cl-write-then-cl-read
+	test-gegl-tile-lock-mode-cl-write-then-cl-read \
+	test-gegl-buffer-blank
 
 TESTS = $(noinst_PROGRAMS)
 
diff --git a/tests/opencl/test-gegl-buffer-blank.c b/tests/opencl/test-gegl-buffer-blank.c
new file mode 100644
index 0000000..b34b741
--- /dev/null
+++ b/tests/opencl/test-gegl-buffer-blank.c
@@ -0,0 +1,55 @@
+/* This file is part of GEGL.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with GEGL; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Copyright 2011 Victor M. de Araujo Oliveira <victormatheus gmail com>
+ */
+
+#include <string.h>
+#include <babl/babl.h>
+
+#include "gegl.h"
+#include "gegl-types.h"
+#include "gegl-utils.h"
+#include "gegl-cl-init.h"
+#include "gegl-cl-texture.h"
+
+#define SUCCESS 0
+#define FAILURE (-1)
+
+gint
+main (gint    argc,
+      gchar **argv)
+{
+  gint retval = SUCCESS;
+
+  GeglBuffer    *buffer;
+  GeglBufferIterator *i;
+  GeglRectangle  rect = {0, 0, 20, 20};
+
+  gegl_init (&argc, &argv);
+  gegl_cl_init (NULL);
+
+  buffer = gegl_buffer_new (&rect, babl_format ("RGBA float"));
+
+  i = gegl_buffer_iterator_new (buffer, &rect, NULL, GEGL_BUFFER_CL_WRITE);
+  while (gegl_buffer_iterator_next (i))
+    gegl_cl_texture_clear(i->cl_data[0], NULL);
+
+  gegl_buffer_destroy (buffer);
+
+  gegl_exit ();
+
+  return retval;
+}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]