<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body text="#000000" bgcolor="#FFFFFF">
Hi all,<br>
<br>
I'm a little new to Racket (and Lispy languages in general). I'm
working on extending the OpenCL module to add support for OpenGL
context sharing. <br>
<br>
My questions are somewhat specific to the OpenCL module, but
hopefully I can provide enough context to minimize that. <br>
<br>
Right now I'm working on clGetGLContextInfoKHR in, and it's been a
bit more challenging than I anticipated. It's a CL extension
function, so get-ffi-obj fails to find it. This hasn't been a huge
problem. I ended up creating an alternate version of define-opencl (
<meta http-equiv="content-type" content="text/html;
charset=ISO-8859-1">
<a
href="https://github.com/jeapostrophe/opencl/blob/master/opencl/c/lib.rkt#L17">https://github.com/jeapostrophe/opencl/blob/master/opencl/c/lib.rkt#L17</a>)
which I've called define-opencl-extension. Rather than calling
get-ffi-obj, it calls clGetExtensionFunctionAddress. That part works
great.<br>
<br>
The big problem that I'm having right now is with define-opencl-info
(
<meta http-equiv="content-type" content="text/html;
charset=ISO-8859-1">
<a
href="https://github.com/jeapostrophe/opencl/blob/master/opencl/c/syntax.rkt#L18">https://github.com/jeapostrophe/opencl/blob/master/opencl/c/syntax.rkt#L18</a>),
which essentially provides a convenient interface for the clGet*Info
functions (which all have similar arguments). clGetGLContextInfoKHR
follows that pattern with one exception. It's primary input argument
takes a vector of values, rather than a single value. <br>
<br>
A call to define-opencl-info looks like this:
<meta http-equiv="content-type" content="text/html;
charset=ISO-8859-1">
<a
href="https://github.com/jeapostrophe/opencl/blob/master/opencl/c/5-3.rkt#L76">https://github.com/jeapostrophe/opencl/blob/master/opencl/c/5-3.rkt#L76</a><br>
<br>
I thought I had the correct syntax by essentially replacing line 79
with the following:<br>
<br>
<meta http-equiv="content-type" content="text/html;
charset=ISO-8859-1">
(args [properties : (_vector i _cl_context_properties)
_cl_context_properties_vector/c])<br>
<br>
(I've also replaced the other types and argument names and whatnot,
but that all seems to work). <br>
Anyway, with the (_vector ...) call, I get the following error:<br>
<br>
; c/9-7.rkt:26:22: define: not an identifier, identifier with
default, or<br>
; keyword for procedure argument<br>
; at: (_vector i _cl_context_properties)<br>
; in: (define (clGetGLContextInfoKHR:generic (_vector i<br>
; _cl_context_properties) _cl_gl_context_info) (case (hash-ref<br>
; id-selector-map _cl_gl_context_info #f) ((_cl_device_id*)
(local ((define<br>
; len (clGetGLContextInfoKHR:length (_vector i
_cl_context_properties)...<br>
; [,bt for context]<br>
<br>
I'm not sure what that error is referring to, or how to fix it.<br>
Here's the backtrack, but it's not terribly helpful (that I can see,
anyway):<br>
<br>
; c/9-7.rkt:26:22: define: not an identifier, identifier with
default, or keyword for procedure argument<br>
; at: (_vector i _cl_context_properties)<br>
; in: (define (clGetGLContextInfoKHR:generic (_vector i
_cl_context_properties) _cl_gl_context_info) (case (hash-ref
id-selector-map _cl_gl_context_info #f) ((_cl_device_id*) (local
((define len (clGetGLContextInfoKHR:length (_vector i
_cl_context_properties)...<br>
; context...:<br>
;
/home/dane/encrypted/work/chematox/local/racket-5.90.0.6/collects/racket/private/norm-define.rkt:46:33:
simple-proto<br>
;
/home/dane/encrypted/work/chematox/local/racket-5.90.0.6/collects/racket/private/norm-define.rkt:134:33:
general-proto<br>
; try-next<br>
;
/home/dane/encrypted/work/chematox/local/racket-5.90.0.6/collects/racket/private/kw.rkt:804:2<br>
;
/home/dane/encrypted/work/chematox/local/racket-5.90.0.6/collects/racket/private/modbeg.rkt:46:4<br>
;
/home/dane/encrypted/work/chematox/local/racket-5.90.0.6/share/pkgs/xrepl-lib/xrepl/xrepl.rkt:1346:0<br>
; standard-module-name-resolver<br>
;
/home/dane/encrypted/work/chematox/local/racket-5.90.0.6/share/pkgs/xrepl-lib/xrepl/xrepl.rkt:1346:0<br>
; standard-module-name-resolver<br>
;
/home/dane/encrypted/work/chematox/local/racket-5.90.0.6/share/pkgs/xrepl-lib/xrepl/xrepl.rkt:1346:0<br>
; standard-module-name-resolver<br>
;
/home/dane/encrypted/work/chematox/local/racket-5.90.0.6/share/pkgs/xrepl-lib/xrepl/xrepl.rkt:1346:0<br>
;
/home/dane/encrypted/work/chematox/local/racket-5.90.0.6/collects/racket/private/misc.rkt:87:7<br>
<br>
In addition, when I replace the (_vector ...) stuff with a plain old
_cl_context_properties, everything works fine (but the contract
fails when I actually try to call clGetGLContextInfoKHR, as
expected).<br>
<br>
What am I doing wrong? It looks like (_vector i
_cl_context_properties) is just as much of a ctype as
_cl_context_properties, so why does it fail when I make it a vector?<br>
<br>
Thanks a ton,<br>
Dane Larsen<br>
</body>
</html>