summaryrefslogtreecommitdiff
path: root/src/cl_context.c
diff options
context:
space:
mode:
authorSimon Richter <Simon.Richter@hogyros.de>2013-04-03 20:32:45 +0200
committerZhigang Gong <zhigang.gong@linux.intel.com>2013-04-18 11:21:01 +0800
commit0118a372252180fb6b8c597dd0874fb31b477435 (patch)
treefac60e7178e2948bf4d8c2aff8e906ff18b9cc8e /src/cl_context.c
parentcb618258d42fbde26bcb5f4437e2ccec1db4003f (diff)
downloadbeignet-0118a372252180fb6b8c597dd0874fb31b477435.tar.gz
Implement KHR ICD extension
This adds a pointer to the dispatch table at the beginning of every object of type - cl_command_queue - cl_context - cl_device_id - cl_event - cl_kernel - cl_mem - cl_platform_id - cl_program - cl_sampler as required by the ICD specification. The layout of the dispatch table comes from the OpenCL ICD loader by Brice Videau <brice.videau@imag.fr> and Vincent Danjean <Vincent.Danjean@ens-lyon.org>. To avoid dispatch table entries being overwritten with the ICD loader's implementations of the CL functions (as would be the proper behaviour for the ELF loader), the -Bsymbolic option is given to the linker. Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Diffstat (limited to 'src/cl_context.c')
-rw-r--r--src/cl_context.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/cl_context.c b/src/cl_context.c
index d9025372..4a1925c3 100644
--- a/src/cl_context.c
+++ b/src/cl_context.c
@@ -25,6 +25,7 @@
#include "cl_alloc.h"
#include "cl_utils.h"
#include "cl_driver.h"
+#include "cl_khr_icd.h"
#include "CL/cl.h"
#include "CL/cl_gl.h"
@@ -154,6 +155,7 @@ cl_context_new(struct _cl_context_prop *props)
TRY_ALLOC_NO_ERR (ctx, CALLOC(struct _cl_context));
TRY_ALLOC_NO_ERR (ctx->drv, cl_driver_new(props));
+ SET_ICD(ctx->dispatch)
ctx->props = *props;
ctx->magic = CL_MAGIC_CONTEXT_HEADER;
ctx->ref_n = 1;