[gegl] opencl: Separate enabled / loaded state in cl_init
- From: Daniel Sabo <daniels src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl] opencl: Separate enabled / loaded state in cl_init
- Date: Sat, 12 Oct 2013 14:00:56 +0000 (UTC)
commit e5a6bc6e0ea55c8f332498bba0b75e6c9cb19172
Author: Daniel Sabo <DanielSabo gmail com>
Date: Sat Oct 12 06:44:51 2013 -0700
opencl: Separate enabled / loaded state in cl_init
gegl/opencl/gegl-cl-init.c | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/gegl/opencl/gegl-cl-init.c b/gegl/opencl/gegl-cl-init.c
index f21f480..5ab3df0 100644
--- a/gegl/opencl/gegl-cl-init.c
+++ b/gegl/opencl/gegl-cl-init.c
@@ -117,6 +117,7 @@ const char *gegl_cl_errstring(cl_int err) {
typedef struct
{
gboolean is_accelerated;
+ gboolean is_loaded;
cl_context ctx;
cl_platform_id platform;
cl_device_id device;
@@ -134,7 +135,7 @@ typedef struct
}
GeglClState;
-static GeglClState cl_state = {FALSE, NULL, NULL, NULL, NULL, FALSE, 0, 0, 0, 0, "", "", "", ""};
+static GeglClState cl_state = { 0, };
static GHashTable *cl_program_hash = NULL;
gboolean
@@ -234,7 +235,7 @@ gegl_cl_init (GError **error)
{
cl_int err;
- if (!cl_state.is_accelerated)
+ if (!cl_state.is_loaded)
{
#ifdef G_OS_WIN32
HINSTANCE module;
@@ -373,7 +374,7 @@ gegl_cl_init (GError **error)
return FALSE;
}
- cl_state.is_accelerated = TRUE;
+ cl_state.is_loaded = TRUE;
/* XXX: this dict is being leaked */
cl_program_hash = g_hash_table_new (g_str_hash, g_str_equal);
@@ -384,6 +385,9 @@ gegl_cl_init (GError **error)
GEGL_NOTE (GEGL_DEBUG_OPENCL, "OK");
}
+ if (cl_state.is_loaded)
+ cl_state.is_accelerated = TRUE;
+
return TRUE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]