[gegl] opencl: if there is a serious error, just disable opencl
- From: Victor Matheus de Araujo Oliveira <vmaolive src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl] opencl: if there is a serious error, just disable opencl
- Date: Sat, 12 Jan 2013 00:43:06 +0000 (UTC)
commit 7b1846d65711e96f60a363266e3cae8238ff76df
Author: Victor Oliveira <victormatheus gmail com>
Date: Fri Jan 11 22:40:35 2013 -0200
opencl: if there is a serious error, just disable opencl
gegl/buffer/gegl-buffer-cl-iterator.c | 6 ++++++
gegl/opencl/gegl-cl-init.c | 6 ++++++
gegl/opencl/gegl-cl-init.h | 2 ++
3 files changed, 14 insertions(+), 0 deletions(-)
---
diff --git a/gegl/buffer/gegl-buffer-cl-iterator.c b/gegl/buffer/gegl-buffer-cl-iterator.c
index fb7b92f..8f36975 100644
--- a/gegl/buffer/gegl-buffer-cl-iterator.c
+++ b/gegl/buffer/gegl-buffer-cl-iterator.c
@@ -34,6 +34,8 @@
#include "gegl-tile-storage.h"
#include "gegl-utils.h"
+#include "opencl/gegl-cl.h"
+
#define CL_ERROR {GEGL_NOTE (GEGL_DEBUG_OPENCL, "Error in %s:%d %s - %s\n", __FILE__, __LINE__, __func__, gegl_cl_errstring(cl_err)); goto error;}
typedef struct GeglBufferClIterators
@@ -594,6 +596,10 @@ error:
i->tex_op [no][j] = NULL;
}
+ /* something pretty bad happened, so it's better to just disable opencl at all for next operations */
+ GEGL_NOTE (GEGL_DEBUG_OPENCL, "Error: Disabling OpenCL!");
+ gegl_cl_disable();
+
*err = TRUE;
return FALSE;
}
diff --git a/gegl/opencl/gegl-cl-init.c b/gegl/opencl/gegl-cl-init.c
index 6a3bc42..c8dafbf 100644
--- a/gegl/opencl/gegl-cl-init.c
+++ b/gegl/opencl/gegl-cl-init.c
@@ -138,6 +138,12 @@ gegl_cl_is_accelerated (void)
return cl_state.is_accelerated && gegl_config()->use_opencl;
}
+void
+gegl_cl_disable (void)
+{
+ cl_state.is_accelerated = FALSE;
+}
+
cl_platform_id
gegl_cl_get_platform (void)
{
diff --git a/gegl/opencl/gegl-cl-init.h b/gegl/opencl/gegl-cl-init.h
index 2a707f4..16746aa 100644
--- a/gegl/opencl/gegl-cl-init.h
+++ b/gegl/opencl/gegl-cl-init.h
@@ -27,6 +27,8 @@ gboolean gegl_cl_init (GError **error);
gboolean gegl_cl_is_accelerated (void);
+void gegl_cl_disable (void);
+
cl_platform_id gegl_cl_get_platform (void);
cl_device_id gegl_cl_get_device (void);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]