]> gitweb.factorcode.org Git - factor.git/commitdiff
opencl: cleanup strings>char*-array and fix cl-queue-read-buffer.
authorJohn Benediktsson <mrjbq7@gmail.com>
Wed, 15 Jul 2015 03:45:13 +0000 (20:45 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Wed, 15 Jul 2015 03:45:13 +0000 (20:45 -0700)
extra/opencl/opencl.factor

index 25c4cf85e199984ddf1f9fa0b59a18b395f8ff49..8325be9a9cf169765f4e7fdaa95026c33a6185c3 100644 (file)
@@ -3,12 +3,13 @@
 USING: accessors alien alien.c-types alien.data arrays
 byte-arrays combinators combinators.smart destructors
 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 ;
 IN: opencl
 SPECIALIZED-ARRAYS: void* char size_t ;
 
 <PRIVATE
+
 ERROR: cl-error 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 ;
 
 : 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 )
     [ handle>> ] dip [
@@ -499,7 +502,7 @@ PRIVATE>
         [ (current-cl-queue) handle>> ] dip
         [ buffer>> handle>> CL_FALSE ] [ offset>> ] [ size>> ] tri
     ] 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 ;
 
 : cl-queue-write-buffer ( buffer-range alien dependent-events -- event )