opencl: cleanup strings>char*-array and fix cl-queue-read-buffer.
parent
58695edbd6
commit
6bb65fcfd3
|
@ -3,12 +3,13 @@
|
||||||
USING: accessors alien alien.c-types alien.data arrays
|
USING: accessors alien alien.c-types alien.data arrays
|
||||||
byte-arrays combinators combinators.smart destructors
|
byte-arrays combinators combinators.smart destructors
|
||||||
io.encodings.ascii io.encodings.string kernel libc locals make
|
io.encodings.ascii io.encodings.string kernel libc locals make
|
||||||
math namespaces opencl.ffi sequences shuffle specialized-arrays
|
math namespaces opencl.ffi sequences specialized-arrays
|
||||||
variants ;
|
variants ;
|
||||||
IN: opencl
|
IN: opencl
|
||||||
SPECIALIZED-ARRAYS: void* char size_t ;
|
SPECIALIZED-ARRAYS: void* char size_t ;
|
||||||
|
|
||||||
<PRIVATE
|
<PRIVATE
|
||||||
|
|
||||||
ERROR: cl-error err ;
|
ERROR: cl-error err ;
|
||||||
|
|
||||||
: cl-success ( err -- )
|
: cl-success ( err -- )
|
||||||
|
@ -334,8 +335,10 @@ M: cl-filter-linear filter-mode-constant drop CL_FILTER_LINEAR ;
|
||||||
CL_PROGRAM_BUILD_LOG program-build-info-string ;
|
CL_PROGRAM_BUILD_LOG program-build-info-string ;
|
||||||
|
|
||||||
: strings>char*-array ( strings -- char*-array )
|
: strings>char*-array ( strings -- char*-array )
|
||||||
[ ascii encode dup length dup malloc [ cl-not-null ]
|
[
|
||||||
keep &free [ -rot memcpy ] keep ] void*-array{ } map-as ;
|
ascii encode dup length dup malloc
|
||||||
|
[ cl-not-null ] keep &free [ -rot memcpy ] keep
|
||||||
|
] void*-array{ } map-as ;
|
||||||
|
|
||||||
: (program) ( cl-context sources -- program-handle )
|
: (program) ( cl-context sources -- program-handle )
|
||||||
[ handle>> ] dip [
|
[ handle>> ] dip [
|
||||||
|
@ -499,7 +502,7 @@ PRIVATE>
|
||||||
[ (current-cl-queue) handle>> ] dip
|
[ (current-cl-queue) handle>> ] dip
|
||||||
[ buffer>> handle>> CL_FALSE ] [ offset>> ] [ size>> ] tri
|
[ buffer>> handle>> CL_FALSE ] [ offset>> ] [ size>> ] tri
|
||||||
] 2dip [ length ] keep [ f ] [ [ handle>> ] void*-array{ } map-as ] if-empty
|
] 2dip [ length ] keep [ f ] [ [ handle>> ] void*-array{ } map-as ] if-empty
|
||||||
f void* <ref> [ clEnqueueReadBuffer cl-success ] keep void* <ref> cl-event
|
f void* <ref> [ clEnqueueReadBuffer cl-success ] keep void* deref cl-event
|
||||||
new-disposable swap >>handle ;
|
new-disposable swap >>handle ;
|
||||||
|
|
||||||
: cl-queue-write-buffer ( buffer-range alien dependent-events -- event )
|
: cl-queue-write-buffer ( buffer-range alien dependent-events -- event )
|
||||||
|
|
Loading…
Reference in New Issue