opencl_ruby_ffi 1.3.1 → 1.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/opencl_ruby_ffi/CommandQueue.rb +13 -2
- data/lib/opencl_ruby_ffi/Image.rb +8 -1
- data/opencl_ruby_ffi.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: acb95c841675fa710d38152d404a4793e719377d
|
4
|
+
data.tar.gz: 7210478d7cd4d25bc2a5927933cdd1f7baf9d615
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5d6a9321eb0a9ac0328be3d712226345b51e41ea49731171732134270bf638be47ed31dd3eb6bf3cb3643d2ae09ff62621bb5f5b27b1dfc9c2a122dcdca771c9
|
7
|
+
data.tar.gz: 60e325360ba6a96d9610803ef567354f77f735e99e7c30e25e51d4cc7031642551f3feea2f051c58b3b3b89474d0584c5a19e50052f01a2755bcc39ce4840391
|
@@ -141,7 +141,18 @@ module OpenCL
|
|
141
141
|
ptr = clEnqueueMapImage( command_queue, image, blocking, flags, origin, region, image_row_pitch, image_slice_pitch, num_events, events, event, error )
|
142
142
|
error_check( error.read_cl_int )
|
143
143
|
ev = Event::new( event.read_pointer, false )
|
144
|
-
|
144
|
+
size = nil
|
145
|
+
image_row_pitch = image_row_pitch.read_size_t
|
146
|
+
image_slice_pitch = image_slice_pitch.read_size_t
|
147
|
+
case image.type
|
148
|
+
when Mem::IMAGE1D_ARRAY, Mem::IMAGE1D_BUFFER, Mem::IMAGE1D
|
149
|
+
size = region[0].read_size_t*image.pixel_size
|
150
|
+
when Mem::IMAGE2D, Mem::IMAGE2D_ARRAY
|
151
|
+
size = region[1].read_size_t*image_row_pitch
|
152
|
+
when Mem::IMAGE3D
|
153
|
+
size = region[2].read_size_t*image_slice_pitch
|
154
|
+
end
|
155
|
+
return [ev, ptr.slice(0,size), image_row_pitch, image_slice_pitch]
|
145
156
|
end
|
146
157
|
|
147
158
|
# Enqueues a command to map aa Buffer into host memory
|
@@ -181,7 +192,7 @@ module OpenCL
|
|
181
192
|
ptr = clEnqueueMapBuffer( command_queue, buffer, blocking, flags, offset, size, num_events, events, event, error )
|
182
193
|
error_check( error.read_cl_int )
|
183
194
|
ev = Event::new( event.read_pointer, false )
|
184
|
-
return [ev, ptr]
|
195
|
+
return [ev, ptr.slice(0, size)]
|
185
196
|
end
|
186
197
|
|
187
198
|
# Enqueues a command to unmap a previously mapped region of a memory object
|
@@ -98,7 +98,7 @@ module OpenCL
|
|
98
98
|
slice_pitch = options[:slice_pitch] if options[:slice_pitch]
|
99
99
|
if context.platform.version_number > 1.1 then
|
100
100
|
desc = ImageDesc::new(Mem::IMAGE3D, width, height, depth, 0, row_pitch, slice_pitch, 0, 0, nil)
|
101
|
-
return create_image( context, format, desc,
|
101
|
+
return create_image( context, format, desc, options )
|
102
102
|
end
|
103
103
|
flags = get_flags( options )
|
104
104
|
host_ptr = options[:host_ptr]
|
@@ -243,6 +243,13 @@ module OpenCL
|
|
243
243
|
get_info("Image", :size_t, "height")
|
244
244
|
get_info("Image", :size_t, "depth")
|
245
245
|
|
246
|
+
def pixel_size
|
247
|
+
s = size / width
|
248
|
+
s /= height if height != 0
|
249
|
+
s /= depth if depth != 0
|
250
|
+
return s
|
251
|
+
end
|
252
|
+
|
246
253
|
module OpenCL12
|
247
254
|
extend InnerGenerator
|
248
255
|
|
data/opencl_ruby_ffi.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: opencl_ruby_ffi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brice Videau
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-05-
|
11
|
+
date: 2016-05-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: narray
|