[gegl] Bug in opencl cache in cl-iterator
- From: Ãyvind KolÃs <ok src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl] Bug in opencl cache in cl-iterator
- Date: Tue, 20 Mar 2012 13:54:20 +0000 (UTC)
commit ea022cd098cf1fb9fbb07ae0f2ac9cf620e1128b
Author: Victor Oliveira <victormatheus gmail com>
Date: Mon Mar 19 18:33:39 2012 -0300
Bug in opencl cache in cl-iterator
gegl/buffer/gegl-buffer-cl-iterator.c | 20 +++++++++++++++-----
1 files changed, 15 insertions(+), 5 deletions(-)
---
diff --git a/gegl/buffer/gegl-buffer-cl-iterator.c b/gegl/buffer/gegl-buffer-cl-iterator.c
index bbaae16..fdf2427 100644
--- a/gegl/buffer/gegl-buffer-cl-iterator.c
+++ b/gegl/buffer/gegl-buffer-cl-iterator.c
@@ -29,6 +29,9 @@ typedef struct GeglBufferClIterators
cl_mem tex_buf [GEGL_CL_BUFFER_MAX_ITERATORS][GEGL_CL_NTEX];
cl_mem tex_op [GEGL_CL_BUFFER_MAX_ITERATORS][GEGL_CL_NTEX];
+ /* don't free textures loaded from cache */
+ gboolean tex_buf_from_cache [GEGL_CL_BUFFER_MAX_ITERATORS][GEGL_CL_NTEX];
+
gint iterators;
gint iteration_no;
gboolean is_finished;
@@ -288,8 +291,11 @@ gegl_buffer_cl_iterator_next (GeglBufferClIterator *iterator, gboolean *err)
for (no=0; no < i->iterators; no++)
for (j=0; j < i->n; j++)
{
- if (i->tex_buf[no][j]) gegl_clReleaseMemObject (i->tex_buf[no][j]);
- if (i->tex_op [no][j]) gegl_clReleaseMemObject (i->tex_op [no][j]);
+ if (i->tex_buf[no][j] && !i->tex_buf_from_cache [no][j])
+ gegl_clReleaseMemObject (i->tex_buf[no][j]);
+
+ if (i->tex_op [no][j])
+ gegl_clReleaseMemObject (i->tex_op [no][j]);
i->tex [no][j] = NULL;
i->tex_buf[no][j] = NULL;
@@ -356,9 +362,11 @@ gegl_buffer_cl_iterator_next (GeglBufferClIterator *iterator, gboolean *err)
case GEGL_CL_COLOR_EQUAL:
{
- i->tex_buf[no][j] = gegl_buffer_cl_cache_get (i->buffer[no], &i->roi[no][j]);
+ i->tex_buf[no][j] = gegl_buffer_cl_cache_get (i->buffer[no], &i->roi[no][j]);\
- if (i->tex_buf[no][j] == NULL)
+ if (i->tex_buf[no][j])
+ i->tex_buf_from_cache [no][j] = TRUE; /* don't free texture from cache */
+ else
{
g_assert (i->tex_buf[no][j] == NULL);
i->tex_buf[no][j] = gegl_clCreateBuffer (gegl_cl_get_context (),
@@ -392,7 +400,9 @@ gegl_buffer_cl_iterator_next (GeglBufferClIterator *iterator, gboolean *err)
{
i->tex_buf[no][j] = gegl_buffer_cl_cache_get (i->buffer[no], &i->roi[no][j]);
- if (i->tex_buf[no][j] == NULL)
+ if (i->tex_buf[no][j])
+ i->tex_buf_from_cache [no][j] = TRUE; /* don't free texture from cache */
+ else
{
g_assert (i->tex_buf[no][j] == NULL);
i->tex_buf[no][j] = gegl_clCreateBuffer (gegl_cl_get_context (),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]