opencl_ruby_ffi 1.0.9 → 1.1.0
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/Arithmetic_gen.rb +275 -0
- data/lib/opencl_ruby_ffi/CommandQueue.rb +15 -0
- data/lib/opencl_ruby_ffi/Context.rb +30 -1
- data/lib/opencl_ruby_ffi/Device.rb +42 -7
- data/lib/opencl_ruby_ffi/Event.rb +4 -0
- data/lib/opencl_ruby_ffi/Image.rb +9 -2
- data/lib/opencl_ruby_ffi/Kernel.rb +4 -0
- data/lib/opencl_ruby_ffi/Mem.rb +5 -0
- data/lib/opencl_ruby_ffi/Pipe.rb +6 -1
- data/lib/opencl_ruby_ffi/Platform.rb +4 -0
- data/lib/opencl_ruby_ffi/Program.rb +21 -8
- data/lib/opencl_ruby_ffi/SVM.rb +4 -0
- data/lib/opencl_ruby_ffi/Sampler.rb +16 -12
- data/lib/opencl_ruby_ffi/opencl_ruby_ffi_base.rb +15 -15
- data/lib/opencl_ruby_ffi/opencl_ruby_ffi_base_gen.rb +303 -205
- data/opencl_ruby_ffi.gemspec +1 -1
- metadata +2 -2
@@ -1055,6 +1055,11 @@ module OpenCL
|
|
1055
1055
|
include InnerGenerator
|
1056
1056
|
end
|
1057
1057
|
|
1058
|
+
def inspect
|
1059
|
+
p = properties
|
1060
|
+
return "#<#{self.class.name}: -> #{device.inspect}#{ 0 != p.to_i ? " (#{p})" : ""}>"
|
1061
|
+
end
|
1062
|
+
|
1058
1063
|
# Returns the Context associated to the CommandQueue
|
1059
1064
|
def context
|
1060
1065
|
ptr = FFI::MemoryPointer::new( Context )
|
@@ -1094,6 +1099,16 @@ module OpenCL
|
|
1094
1099
|
# Returns the :cl_command_queue_properties used to create the CommandQueue
|
1095
1100
|
eval get_info("CommandQueue", :cl_command_queue_properties, "PROPERTIES")
|
1096
1101
|
|
1102
|
+
##
|
1103
|
+
# :method: priority_khr
|
1104
|
+
# Returns the :cl_queue_priority_khr used to create the CommandQueue (2.1 and cl_khr_priority_hints required)
|
1105
|
+
eval get_info("CommandQueue", :cl_queue_priority_khr, "PRIORITY_KHR")
|
1106
|
+
|
1107
|
+
##
|
1108
|
+
# :method: throttle_khr
|
1109
|
+
# Returns the :cl_queue_throttle_khr used to create the CommandQueue (2.1 and cl_khr_throttle_hints required)
|
1110
|
+
eval get_info("CommandQueue", :cl_queue_throttle_khr, "THROTTLE_KHR")
|
1111
|
+
|
1097
1112
|
# Enqueues a kernel as a task using the CommandQueue
|
1098
1113
|
#
|
1099
1114
|
# ==== Attributes
|
@@ -62,6 +62,10 @@ module OpenCL
|
|
62
62
|
include InnerGenerator
|
63
63
|
end
|
64
64
|
|
65
|
+
def inspect
|
66
|
+
return "#<#{self.class.name}: #{self.devices}>"
|
67
|
+
end
|
68
|
+
|
65
69
|
##
|
66
70
|
# :method: reference_count
|
67
71
|
# Returns the reference count of the Context
|
@@ -72,7 +76,31 @@ module OpenCL
|
|
72
76
|
##
|
73
77
|
# :method: properties
|
74
78
|
# the Array of :cl_context_properties used to create the Context
|
75
|
-
|
79
|
+
def properties
|
80
|
+
ptr1 = FFI::MemoryPointer::new( :size_t, 1)
|
81
|
+
error = OpenCL.clGetContextInfo(self, PROPERTIES, 0, nil, ptr1)
|
82
|
+
error_check(error)
|
83
|
+
return [] if ptr1.read_size_t == 0
|
84
|
+
ptr2 = FFI::MemoryPointer::new( ptr1.read_size_t )
|
85
|
+
error = OpenCL.clGetContextInfo(self, PROPERTIES, ptr1.read_size_t, ptr2, nil)
|
86
|
+
error_check(error)
|
87
|
+
arr = ptr2.get_array_of_cl_context_properties(0, ptr1.read_size_t/ FFI.find_type(:cl_context_properties).size)
|
88
|
+
return arr if arr.length == 1 and arr[0].to_i == 0
|
89
|
+
arr_2 = []
|
90
|
+
while arr.length > 2 do
|
91
|
+
prop = arr.shift.to_i
|
92
|
+
arr_2.push Properties::new(prop)
|
93
|
+
return arr_2 if arr.length <= 0
|
94
|
+
if prop == Properties::PLATFORM then
|
95
|
+
arr_2.push Platform::new(arr.shift)
|
96
|
+
else
|
97
|
+
arr_2.push arr.shift.to_i
|
98
|
+
end
|
99
|
+
return arr_2 if arr.length <= 0
|
100
|
+
end
|
101
|
+
arr_2.push arr.shift.to_i if arr.length > 0
|
102
|
+
return arr_2
|
103
|
+
end
|
76
104
|
|
77
105
|
# Returns the platform associated to the Context
|
78
106
|
def platform
|
@@ -117,6 +145,7 @@ module OpenCL
|
|
117
145
|
# * +:flags+ - a single or an Array of :cl_mem_flags specifying the flags to be used when creating the Buffer
|
118
146
|
def supported_image_formats( image_type, options = {} )
|
119
147
|
flags = get_flags( options )
|
148
|
+
flags = Mem::Flags::READ_WRITE if flags.to_i == 0 #ensure default READ_WRITE, Intel bug.
|
120
149
|
num_image_formats = FFI::MemoryPointer::new( :cl_uint )
|
121
150
|
error = OpenCL.clGetSupportedImageFormats( self, flags, image_type, 0, nil, num_image_formats )
|
122
151
|
error_check(error)
|
@@ -54,6 +54,10 @@ module OpenCL
|
|
54
54
|
include InnerGenerator
|
55
55
|
end
|
56
56
|
|
57
|
+
def inspect
|
58
|
+
return "#<#{self.class.name}: #{name} (#{pointer.to_i})>"
|
59
|
+
end
|
60
|
+
|
57
61
|
#:stopdoc:
|
58
62
|
DRIVER_VERSION = 0x102D
|
59
63
|
#:startdoc:
|
@@ -189,7 +193,17 @@ module OpenCL
|
|
189
193
|
##
|
190
194
|
# :method: partition_properties()
|
191
195
|
# Returns the list of partition types supported by the Device
|
192
|
-
|
196
|
+
def partition_properties
|
197
|
+
ptr1 = FFI::MemoryPointer::new( :size_t, 1)
|
198
|
+
error = OpenCL.clGetDeviceInfo(self, PARTITION_PROPERTIES, 0, nil, ptr1)
|
199
|
+
error_check(error)
|
200
|
+
ptr2 = FFI::MemoryPointer::new( ptr1.read_size_t )
|
201
|
+
error = OpenCL.clGetDeviceInfo(self, PARTITION_PROPERTIES, ptr1.read_size_t, ptr2, nil)
|
202
|
+
error_check(error)
|
203
|
+
arr = ptr2.get_array_of_cl_device_partition_property(0, ptr1.read_size_t/ FFI.find_type(:cl_device_partition_property).size)
|
204
|
+
arr.reject! { |e| e.null? }
|
205
|
+
return arr.collect { |e| Partition::new(e.to_i) }
|
206
|
+
end
|
193
207
|
|
194
208
|
##
|
195
209
|
# :method: svm_capabilities()
|
@@ -198,17 +212,38 @@ module OpenCL
|
|
198
212
|
|
199
213
|
# Return an Array of partition properties names representing the partition type supported by the device
|
200
214
|
def partition_properties_names
|
201
|
-
|
202
|
-
props = self.partition_properties
|
203
|
-
%w( PARTITION_EQUALLY PARTITION_BY_COUNTS PARTITION_BY_AFFINITY_DOMAIN ).each { |prop|
|
204
|
-
prop_names.push(prop) if props.include?(Device.const_get(prop))
|
205
|
-
}
|
215
|
+
self.partition_properties.collect { |p| p.name }
|
206
216
|
end
|
207
217
|
|
208
218
|
##
|
209
219
|
# :method: partition_type()
|
210
220
|
# Returns a list of :cl_device_partition_property used to create the Device
|
211
|
-
|
221
|
+
def partition_type
|
222
|
+
ptr1 = FFI::MemoryPointer::new( :size_t, 1)
|
223
|
+
error = OpenCL.clGetDeviceInfo(self, PARTITION_TYPE, 0, nil, ptr1)
|
224
|
+
error_check(error)
|
225
|
+
ptr2 = FFI::MemoryPointer::new( ptr1.read_size_t )
|
226
|
+
error = OpenCL.clGetDeviceInfo(self, PARTITION_TYPE, ptr1.read_size_t, ptr2, nil)
|
227
|
+
error_check(error)
|
228
|
+
arr = ptr2.get_array_of_cl_device_partition_property(0, ptr1.read_size_t/ FFI.find_type(:cl_device_partition_property).size)
|
229
|
+
if arr.first.to_i == Partition::BY_NAMES_EXT then
|
230
|
+
arr_2 = []
|
231
|
+
arr_2.push(Partition::new(arr.first.to_i))
|
232
|
+
i = 1
|
233
|
+
return arr_2 if arr.length <= i
|
234
|
+
while arr[i].to_i - (0x1 << FFI::Pointer.size * 8) != Partition::BY_NAMES_LIST_END_EXT do
|
235
|
+
arr_2[i] = arr[i].to_i
|
236
|
+
i += 1
|
237
|
+
return arr_2 if arr.length <= i
|
238
|
+
end
|
239
|
+
arr_2[i] = Partition::new(Partition::BY_NAMES_LIST_END_EXT)
|
240
|
+
arr_2[i+1] = 0
|
241
|
+
return arr_2
|
242
|
+
else
|
243
|
+
return arr.collect { |e| Partition::new(e.to_i) }
|
244
|
+
end
|
245
|
+
end
|
246
|
+
#eval get_info_array("Device", :cl_device_partition_property, "PARTITION_TYPE")
|
212
247
|
|
213
248
|
# Returns the Platform the Device belongs to
|
214
249
|
def platform
|
@@ -73,6 +73,10 @@ module OpenCL
|
|
73
73
|
include InnerGenerator
|
74
74
|
end
|
75
75
|
|
76
|
+
def inspect
|
77
|
+
return "#<#{self.class.name}: #{command_type}>"
|
78
|
+
end
|
79
|
+
|
76
80
|
# Returns the CommandQueue associated with the Event, if it exists
|
77
81
|
def command_queue
|
78
82
|
ptr = FFI::MemoryPointer::new( CommandQueue )
|
@@ -120,7 +120,7 @@ module OpenCL
|
|
120
120
|
#
|
121
121
|
# ==== Options
|
122
122
|
#
|
123
|
-
# * +:flags+ - a single or an Array of :cl_mem_flags specifying the flags to be used when creating the Image
|
123
|
+
# * +:flags+ - a single or an Array of :cl_mem_flags specifying the flags to be used when creating the Image
|
124
124
|
def self.create_from_gl_render_buffer( context, renderbuffer, options = {} )
|
125
125
|
flags = get_flags( options )
|
126
126
|
error = FFI::MemoryPointer::new( :cl_int )
|
@@ -144,7 +144,7 @@ module OpenCL
|
|
144
144
|
# ==== Options
|
145
145
|
#
|
146
146
|
# * +:miplevel+ - a :GLint specifying the mipmap level to be used (default 0)
|
147
|
-
# * +:flags+ - a single or an Array of :cl_mem_flags specifying the flags to be used when creating the Image
|
147
|
+
# * +:flags+ - a single or an Array of :cl_mem_flags specifying the flags to be used when creating the Image
|
148
148
|
def self.create_from_gl_texture( context, texture_target, texture, options = {} )
|
149
149
|
if context.platform.version_number < 1.2 then
|
150
150
|
error_check(INVALID_OPERATION)
|
@@ -220,6 +220,13 @@ module OpenCL
|
|
220
220
|
# Maps the cl_mem OpenCL objects of type CL_MEM_OBJECT_IMAGE*
|
221
221
|
class Image #< Mem
|
222
222
|
|
223
|
+
def inspect
|
224
|
+
h = height
|
225
|
+
d = depth
|
226
|
+
f = flags
|
227
|
+
return "#<#{self.class.name}: #{format.channel_order}, #{format.channel_data_type}, #{width}#{h != 0 ? "x#{h}" : ""}#{d != 0 ? "x#{d}" : ""} (#{size})#{f.to_i != 0 ? " (#{f})" : "" }>"
|
228
|
+
end
|
229
|
+
|
223
230
|
##
|
224
231
|
# :method: element_size
|
225
232
|
# Returns the element_size of the Image
|
data/lib/opencl_ruby_ffi/Mem.rb
CHANGED
@@ -26,6 +26,11 @@ module OpenCL
|
|
26
26
|
include InnerGenerator
|
27
27
|
end
|
28
28
|
|
29
|
+
def inspect
|
30
|
+
f = flags
|
31
|
+
return "#<#{self.class.name}: #{size}#{ 0 != f.to_i ? " (#{f})" : ""}>"
|
32
|
+
end
|
33
|
+
|
29
34
|
# Returns the Context associated to the Mem
|
30
35
|
def context
|
31
36
|
ptr = FFI::MemoryPointer::new( Context )
|
data/lib/opencl_ruby_ffi/Pipe.rb
CHANGED
@@ -27,7 +27,12 @@ module OpenCL
|
|
27
27
|
class << self
|
28
28
|
include InnerGenerator
|
29
29
|
end
|
30
|
-
|
30
|
+
|
31
|
+
def inspect
|
32
|
+
f = flags
|
33
|
+
return "#<#{self.class.inspect}: #{packet_size}x#{max_packets}#{ 0 != f.to_i ? " (#{f})" : ""}>"
|
34
|
+
end
|
35
|
+
|
31
36
|
##
|
32
37
|
# :method: packet_size
|
33
38
|
# Returns the packet_size of the Pipe
|
@@ -77,6 +77,10 @@ module OpenCL
|
|
77
77
|
include InnerGenerator
|
78
78
|
end
|
79
79
|
|
80
|
+
def inspect
|
81
|
+
return "#<#{self.class.name}: #{self.name}>"
|
82
|
+
end
|
83
|
+
|
80
84
|
##
|
81
85
|
# :method: icd_suffix_khr()
|
82
86
|
# Returns a String containing the function name suffix used to identify extension functions to be directed to this platform by the ICD Loader
|
@@ -210,6 +210,15 @@ module OpenCL
|
|
210
210
|
class << self
|
211
211
|
include InnerGenerator
|
212
212
|
end
|
213
|
+
|
214
|
+
def inspect
|
215
|
+
success = false
|
216
|
+
build_status.each { |d,s|
|
217
|
+
success |= true if s.to_i == BuildStatus::SUCCESS
|
218
|
+
}
|
219
|
+
return "#<#{self.class.name}: #{success ? kernel_names : ""}>"
|
220
|
+
end
|
221
|
+
|
213
222
|
alias_method :orig_method_missing, :method_missing
|
214
223
|
|
215
224
|
# Intercepts a call to a missing method and tries to see if it is defined as a Kernel inside
|
@@ -237,14 +246,18 @@ module OpenCL
|
|
237
246
|
|
238
247
|
# Returns an Array of String representing the Kernel names inside the Program
|
239
248
|
def kernel_names
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
249
|
+
if context.platform.version_number < 1.2 then
|
250
|
+
return kernels.collect(&:name)
|
251
|
+
else
|
252
|
+
kernel_names_size = FFI::MemoryPointer::new( :size_t )
|
253
|
+
error = OpenCL.clGetProgramInfo( self, KERNEL_NAMES, 0, nil, kernel_names_size)
|
254
|
+
error_check(error)
|
255
|
+
k_names = FFI::MemoryPointer::new( kernel_names_size.read_size_t )
|
256
|
+
error = OpenCL.clGetProgramInfo( self, KERNEL_NAMES, kernel_names_size.read_size_t, k_names, nil)
|
257
|
+
error_check(error)
|
258
|
+
k_names_string = k_names.read_string
|
259
|
+
return k_names_string.split(";")
|
260
|
+
end
|
248
261
|
end
|
249
262
|
|
250
263
|
# Returns the concatenated Program sources
|
data/lib/opencl_ruby_ffi/SVM.rb
CHANGED
@@ -15,6 +15,10 @@ module OpenCL
|
|
15
15
|
@size = size
|
16
16
|
end
|
17
17
|
|
18
|
+
def inspect
|
19
|
+
return "#<#{self.class.name}: #{@size}>"
|
20
|
+
end
|
21
|
+
|
18
22
|
# creates a new SVMPointer relative to an existing one from an offset
|
19
23
|
def +( offset )
|
20
24
|
return SVMPointer::new( self.address + offset, @context, @size, @base )
|
@@ -29,30 +29,30 @@ module OpenCL
|
|
29
29
|
prop_size += 2 if options[:mip_filter_mode]
|
30
30
|
prop_size += 2 if options[:lod_min]
|
31
31
|
prop_size += 2 if options[:lod_max]
|
32
|
-
properties = FFI::MemoryPointer::new( :
|
33
|
-
properties[0].
|
34
|
-
properties[1].
|
35
|
-
properties[2].
|
36
|
-
properties[3].
|
37
|
-
properties[4].
|
38
|
-
properties[5].
|
32
|
+
properties = FFI::MemoryPointer::new( :cl_sampler_info )
|
33
|
+
properties[0].write_cl_sampler_info( Sampler::NORMALIZED_COORDS )
|
34
|
+
properties[1].write_cl_bool( normalized_coords )
|
35
|
+
properties[2].write_cl_sampler_info( Sampler::ADDRESSING_MODE )
|
36
|
+
properties[3].write_cl_addressing_mode( addressing_mode )
|
37
|
+
properties[4].write_cl_sampler_info( Sampler::FILTER_MODE )
|
38
|
+
properties[5].write_cl_filter_mode( filter_mode )
|
39
39
|
prop_indx = 6
|
40
40
|
if options[:mip_filter_mode] then
|
41
|
-
properties[prop_indx].
|
42
|
-
properties[prop_indx+1].
|
41
|
+
properties[prop_indx].write_cl_sampler_info( Sampler::MIP_FILTER_MODE )
|
42
|
+
properties[prop_indx+1].write_cl_filter_mode( options[:mip_filter_mode] )
|
43
43
|
prop_indx += 2
|
44
44
|
end
|
45
45
|
if options[:lod_min] then
|
46
|
-
properties[prop_indx].
|
46
|
+
properties[prop_indx].write_cl_sampler_info( Sampler::LOD_MIN )
|
47
47
|
properties[prop_indx+1].write_float( options[:lod_min] )
|
48
48
|
prop_indx += 2
|
49
49
|
end
|
50
50
|
if options[:lod_max] then
|
51
|
-
properties[prop_indx].
|
51
|
+
properties[prop_indx].write_cl_sampler_info( Sampler::LOD_MAX )
|
52
52
|
properties[prop_indx+1].write_float( options[:lod_max] )
|
53
53
|
prop_indx += 2
|
54
54
|
end
|
55
|
-
properties[prop_indx].
|
55
|
+
properties[prop_indx].write_cl_sampler_info( 0 )
|
56
56
|
sampler_ptr = clCreateSamplerWithProperties( context, properties, error )
|
57
57
|
end
|
58
58
|
error_check(error.read_cl_int)
|
@@ -67,6 +67,10 @@ module OpenCL
|
|
67
67
|
include InnerGenerator
|
68
68
|
end
|
69
69
|
|
70
|
+
def inspect
|
71
|
+
return "#<#{self.class.name}: #{addressing_mode} #{filter_mode} normalized: #{normalized_coords}>"
|
72
|
+
end
|
73
|
+
|
70
74
|
# Returns the context associated with the Sampler
|
71
75
|
def context
|
72
76
|
ptr = FFI::MemoryPointer::new( Context )
|
@@ -51,6 +51,10 @@ module OpenCL
|
|
51
51
|
layout :image_channel_order, :cl_channel_order,
|
52
52
|
:image_channel_data_type, :cl_channel_type
|
53
53
|
|
54
|
+
def inspect
|
55
|
+
return "#<#{self.class.name}: #{channel_order} #{channel_data_type}>"
|
56
|
+
end
|
57
|
+
|
54
58
|
# Creates a new ImageFormat from an image channel order and data type
|
55
59
|
def initialize( image_channel_order, image_channel_data_type )
|
56
60
|
super()
|
@@ -220,7 +224,7 @@ module OpenCL
|
|
220
224
|
if options[:properties] then
|
221
225
|
properties = FFI::MemoryPointer::new( :cl_context_properties, options[:properties].length + 1 )
|
222
226
|
options[:properties].each_with_index { |e,i|
|
223
|
-
properties[i].write_cl_context_properties(e)
|
227
|
+
properties[i].write_cl_context_properties(e.respond_to?(:to_ptr) ? e : e.to_i)
|
224
228
|
}
|
225
229
|
properties[options[:properties].length].write_cl_context_properties(0)
|
226
230
|
end
|
@@ -259,6 +263,8 @@ module OpenCL
|
|
259
263
|
:cl_device_local_mem_type => Device::LocalMemType,
|
260
264
|
:cl_device_exec_capabilities => Device::ExecCapabilities,
|
261
265
|
:cl_command_queue_properties => CommandQueue::Properties,
|
266
|
+
:cl_queue_priority_khr => CommandQueue::PriorityKHR,
|
267
|
+
:cl_queue_throttle_khr => CommandQueue::ThrottleKHR,
|
262
268
|
:cl_device_affinity_domain => Device::AffinityDomain,
|
263
269
|
:cl_device_svm_capabilities => Device::SVMCapabilities,
|
264
270
|
:cl_channel_order => ChannelOrder,
|
@@ -289,6 +295,14 @@ module OpenCL
|
|
289
295
|
private_constant :InnerInterface
|
290
296
|
extend InnerInterface
|
291
297
|
|
298
|
+
class Enum
|
299
|
+
include InnerInterface
|
300
|
+
end
|
301
|
+
|
302
|
+
class Bitfield
|
303
|
+
include InnerInterface
|
304
|
+
end
|
305
|
+
|
292
306
|
module InnerGenerator
|
293
307
|
|
294
308
|
private
|
@@ -324,24 +338,10 @@ EOF
|
|
324
338
|
ptr1 = FFI::MemoryPointer::new( :size_t, 1)
|
325
339
|
error = OpenCL.clGet#{klass_name}Info(self, #{klass}::#{name}, 0, nil, ptr1)
|
326
340
|
error_check(error)
|
327
|
-
EOF
|
328
|
-
if ( klass == "Device" and name == "PARTITION_TYPE" ) or ( klass == "Context" and name == "PROPERTIES" ) then
|
329
|
-
s+= <<EOF
|
330
|
-
return [] if ptr1.read_size_t == 0
|
331
|
-
EOF
|
332
|
-
end
|
333
|
-
s += <<EOF
|
334
341
|
ptr2 = FFI::MemoryPointer::new( ptr1.read_size_t )
|
335
342
|
error = OpenCL.clGet#{klass_name}Info(self, #{klass}::#{name}, ptr1.read_size_t, ptr2, nil)
|
336
343
|
error_check(error)
|
337
344
|
arr = ptr2.get_array_of_#{type}(0, ptr1.read_size_t/ FFI.find_type(:#{type}).size)
|
338
|
-
EOF
|
339
|
-
if ( klass == "Device" and ( name == "PARTITION_TYPE" or name == "PARTITION_PROPERTIES" ) ) or ( klass == "Context" and name == "PROPERTIES" ) then
|
340
|
-
s+= <<EOF
|
341
|
-
arr.reject! { |e| e.null? }
|
342
|
-
EOF
|
343
|
-
end
|
344
|
-
s+= <<EOF
|
345
345
|
return arr
|
346
346
|
end
|
347
347
|
EOF
|
@@ -252,6 +252,7 @@ module OpenCL
|
|
252
252
|
MEM_HOST_NO_ACCESS = (1 << 9)
|
253
253
|
MEM_SVM_FINE_GRAIN_BUFFER = (1 << 10)
|
254
254
|
MEM_SVM_ATOMICS = (1 << 11)
|
255
|
+
MEM_KERNEL_READ_AND_WRITE = (1 << 12)
|
255
256
|
MIGRATE_MEM_OBJECT_HOST = (1 << 0)
|
256
257
|
MIGRATE_MEM_OBJECT_CONTENT_UNDEFINED = (1 << 1)
|
257
258
|
R = 0x10B0
|
@@ -472,6 +473,10 @@ module OpenCL
|
|
472
473
|
GLX_DISPLAY_KHR = 0x200A
|
473
474
|
WGL_HDC_KHR = 0x200B
|
474
475
|
CGL_SHAREGROUP_KHR = 0x200C
|
476
|
+
COMMAND_GL_FENCE_SYNC_OBJECT_KHR = 0x200D
|
477
|
+
COMMAND_EGL_FENCE_SYNC_OBJECT_KHR = 0x202F
|
478
|
+
COMMAND_ACQUIRE_EGL_OBJECTS_KHR = 0x202D
|
479
|
+
COMMAND_RELEASE_EGL_OBJECTS_KHR = 0x202E
|
475
480
|
DEVICE_HALF_FP_CONFIG = 0x1033
|
476
481
|
PLATFORM_ICD_SUFFIX_KHR = 0x0920
|
477
482
|
PLATFORM_NOT_FOUND_KHR = -1001
|
@@ -508,6 +513,12 @@ module OpenCL
|
|
508
513
|
QUEUE_THROTTLE_HIGH_KHR = (1<<0)
|
509
514
|
QUEUE_THROTTLE_MED_KHR = (1<<1)
|
510
515
|
QUEUE_THROTTLE_LOW_KHR = (1<<2)
|
516
|
+
COMMAND_ACQUIRE_DX9_MEDIA_SURFACES_KHR = 0x202B
|
517
|
+
COMMAND_RELEASE_DX9_MEDIA_SURFACES_KHR = 0x202C
|
518
|
+
COMMAND_ACQUIRE_D3D10_OBJECTS_KHR = 0x4017
|
519
|
+
COMMAND_RELEASE_D3D10_OBJECTS_KHR = 0x4018
|
520
|
+
COMMAND_ACQUIRE_D3D11_OBJECTS_KHR = 0x4020
|
521
|
+
COMMAND_RELEASE_D3D11_OBJECTS_KHR = 0x4021
|
511
522
|
#:startdoc:
|
512
523
|
# Parent claas to map OpenCL errors, and is used to raise unknown errors
|
513
524
|
class Error < StandardError
|
@@ -543,6 +554,33 @@ module OpenCL
|
|
543
554
|
return "#{@code}"
|
544
555
|
end
|
545
556
|
|
557
|
+
# Represents the OpenCL CL_INVALID_PARTITION_NAME_EXT error
|
558
|
+
class INVALID_PARTITION_NAME_EXT
|
559
|
+
|
560
|
+
# Initilizes code to -1059
|
561
|
+
def initialize
|
562
|
+
super(-1059)
|
563
|
+
end
|
564
|
+
|
565
|
+
# Returns a string representing the name corresponding to the error classe
|
566
|
+
def self.name
|
567
|
+
return "INVALID_PARTITION_NAME_EXT"
|
568
|
+
end
|
569
|
+
|
570
|
+
# Returns a string representing the name corresponding to the error
|
571
|
+
def name
|
572
|
+
return "INVALID_PARTITION_NAME_EXT"
|
573
|
+
end
|
574
|
+
|
575
|
+
def self.code
|
576
|
+
return -1059
|
577
|
+
end
|
578
|
+
|
579
|
+
end
|
580
|
+
|
581
|
+
CLASSES[-1059] = INVALID_PARTITION_NAME_EXT
|
582
|
+
InvalidPartitionNameExt = INVALID_PARTITION_NAME_EXT
|
583
|
+
|
546
584
|
# Represents the OpenCL CL_PLATFORM_NOT_FOUND_KHR error
|
547
585
|
class PLATFORM_NOT_FOUND_KHR < Error
|
548
586
|
|
@@ -2345,22 +2383,27 @@ module OpenCL
|
|
2345
2383
|
FFI.typedef :cl_uint, :cl_gl_texture_info
|
2346
2384
|
FFI.typedef :cl_uint, :cl_gl_platform_info
|
2347
2385
|
FFI.typedef :cl_uint, :cl_gl_context_info
|
2386
|
+
FFI.typedef :cl_uint, :cl_queue_priority_khr
|
2387
|
+
FFI.typedef :cl_uint, :cl_queue_throttle_khr
|
2348
2388
|
# A parent class to represent OpenCL enums that use :cl_uint
|
2349
2389
|
class Enum
|
2350
2390
|
# extend FFI::DataConverter
|
2351
2391
|
# native_type :cl_uint
|
2352
|
-
|
2392
|
+
class << self
|
2393
|
+
attr_reader :codes
|
2394
|
+
end
|
2395
|
+
@codes = {}
|
2353
2396
|
|
2354
2397
|
# Initializes an enum with the given val
|
2355
2398
|
def initialize( val )
|
2356
|
-
|
2399
|
+
error_check( OpenCL::INVALID_VALUE ) if not self.class.codes[val]
|
2357
2400
|
super()
|
2358
2401
|
@val = val
|
2359
2402
|
end
|
2360
2403
|
|
2361
2404
|
# Sets the internal value of the enum
|
2362
2405
|
def val=(v)
|
2363
|
-
|
2406
|
+
error_check( OpenCL::INVALID_VALUE ) if not self.class.codes[val]
|
2364
2407
|
@val = v
|
2365
2408
|
end
|
2366
2409
|
|
@@ -2374,11 +2417,27 @@ module OpenCL
|
|
2374
2417
|
return true if @val == val
|
2375
2418
|
end
|
2376
2419
|
|
2420
|
+
# Returns a String corresponding to the Enum description
|
2421
|
+
def inspect
|
2422
|
+
return "#<#{self.class.name}: #{self.name}>"
|
2423
|
+
end
|
2424
|
+
|
2377
2425
|
# Returns a String corresponfing to the Enum value
|
2378
2426
|
def to_s
|
2379
2427
|
return "#{self.name}"
|
2380
2428
|
end
|
2381
2429
|
|
2430
|
+
# Returns a String representing the Enum value name
|
2431
|
+
def name
|
2432
|
+
return self.class.codes[@val]
|
2433
|
+
end
|
2434
|
+
|
2435
|
+
# Enum should be considered an integer
|
2436
|
+
def coerce(other)
|
2437
|
+
return [other, FFI::Pointer::new(self.to_i)] if other.is_a?(FFI::Pointer)
|
2438
|
+
return [other, self.to_i]
|
2439
|
+
end
|
2440
|
+
|
2382
2441
|
# Returns the integer representing the Enum value
|
2383
2442
|
def to_i
|
2384
2443
|
return @val
|
@@ -2436,9 +2495,14 @@ module OpenCL
|
|
2436
2495
|
return false
|
2437
2496
|
end
|
2438
2497
|
|
2498
|
+
# Returns a String corresponding to the Bitfield description
|
2499
|
+
def inspect
|
2500
|
+
return "#<#{self.class.name}: #{self}>"
|
2501
|
+
end
|
2502
|
+
|
2439
2503
|
# Returns a String corresponfing to the Bitfield value
|
2440
2504
|
def to_s
|
2441
|
-
return "#{self.names}"
|
2505
|
+
return "#{self.names.join('|')}"
|
2442
2506
|
end
|
2443
2507
|
|
2444
2508
|
# Returns the integer representing the Bitfield value
|
@@ -2451,6 +2515,11 @@ module OpenCL
|
|
2451
2515
|
return @val
|
2452
2516
|
end
|
2453
2517
|
|
2518
|
+
# Bitfield should be considered an integer
|
2519
|
+
def coerce(other)
|
2520
|
+
return [other, self.to_i]
|
2521
|
+
end
|
2522
|
+
|
2454
2523
|
# Returns the bitwise & operation between f and the internal Bitfield representation
|
2455
2524
|
def &(f)
|
2456
2525
|
return self.class::new( @val & f )
|
@@ -2696,6 +2765,23 @@ module OpenCL
|
|
2696
2765
|
end
|
2697
2766
|
|
2698
2767
|
class Device
|
2768
|
+
# Enum that maps the :cl_device_partition_property type
|
2769
|
+
class Partition < EnumInt
|
2770
|
+
EQUALLY = 0x1086
|
2771
|
+
BY_COUNTS = 0x1087
|
2772
|
+
BY_COUNTS_LIST_END = 0x0
|
2773
|
+
BY_AFFINITY_DOMAIN = 0x1088
|
2774
|
+
BY_NAMES_EXT = 0x4052
|
2775
|
+
BY_NAMES_LIST_END_EXT = -1
|
2776
|
+
@codes = {}
|
2777
|
+
@codes[0x1086] = 'EQUALLY'
|
2778
|
+
@codes[0x1087] = 'BY_COUNTS'
|
2779
|
+
@codes[0x0] = 'BY_COUNTS_LIST_END'
|
2780
|
+
@codes[0x1088] = 'BY_AFFINITY_DOMAIN'
|
2781
|
+
@codes[0x4052] = 'BY_NAMES_EXT'
|
2782
|
+
@codes[-1] = 'BY_NAMES_LIST_END_EXT'
|
2783
|
+
end
|
2784
|
+
|
2699
2785
|
# Bitfield that maps the :cl_device_type type
|
2700
2786
|
class Type < Bitfield
|
2701
2787
|
DEFAULT = (1 << 0)
|
@@ -2753,25 +2839,19 @@ module OpenCL
|
|
2753
2839
|
NONE = 0x0
|
2754
2840
|
READ_ONLY_CACHE = 0x1
|
2755
2841
|
READ_WRITE_CACHE = 0x2
|
2756
|
-
|
2757
|
-
|
2758
|
-
|
2759
|
-
|
2760
|
-
def name
|
2761
|
-
return @@codes[@val]
|
2762
|
-
end
|
2842
|
+
@codes = {}
|
2843
|
+
@codes[0x0] = 'NONE'
|
2844
|
+
@codes[0x1] = 'READ_ONLY_CACHE'
|
2845
|
+
@codes[0x2] = 'READ_WRITE_CACHE'
|
2763
2846
|
end
|
2764
2847
|
|
2765
2848
|
# Enum that maps the :cl_device_local_mem_type type
|
2766
2849
|
class LocalMemType < Enum
|
2767
2850
|
LOCAL = 0x1
|
2768
2851
|
GLOBAL = 0x2
|
2769
|
-
|
2770
|
-
|
2771
|
-
|
2772
|
-
def name
|
2773
|
-
return @@codes[@val]
|
2774
|
-
end
|
2852
|
+
@codes = {}
|
2853
|
+
@codes[0x1] = 'LOCAL'
|
2854
|
+
@codes[0x2] = 'GLOBAL'
|
2775
2855
|
end
|
2776
2856
|
|
2777
2857
|
# Bitfield that maps the :cl_device_affinity_domain type
|
@@ -2850,6 +2930,40 @@ module OpenCL
|
|
2850
2930
|
|
2851
2931
|
end
|
2852
2932
|
|
2933
|
+
class Context
|
2934
|
+
class Properties < Enum
|
2935
|
+
PLATFORM = 0x1084
|
2936
|
+
INTEROP_USER_SYNC = 0x1085
|
2937
|
+
D3D10_DEVICE_KHR = 0x4014
|
2938
|
+
ADAPTER_D3D9_KHR = 0x2025
|
2939
|
+
ADAPTER_D3D9EX_KHR = 0x2026
|
2940
|
+
ADAPTER_DXVA_KHR = 0x2027
|
2941
|
+
GL_CONTEXT_KHR = 0x2008
|
2942
|
+
CGL_SHAREGROUP_KHR = 0x200C
|
2943
|
+
EGL_DISPLAY_KHR = 0x2009
|
2944
|
+
GLX_DISPLAY_KHR = 0x200A
|
2945
|
+
WGL_HDC_KHR = 0x200B
|
2946
|
+
D3D11_DEVICE_KHR = 0x401D
|
2947
|
+
MEMORY_INITIALIZE_KHR = 0x2030
|
2948
|
+
TERMINATE_KHR = 0x2032
|
2949
|
+
@codes = {}
|
2950
|
+
@codes[0x1084] = 'PLATFORM'
|
2951
|
+
@codes[0x1085] = 'INTEROP_USER_SYNC'
|
2952
|
+
@codes[0x4014] = 'D3D10_DEVICE_KHR'
|
2953
|
+
@codes[0x2025] = 'ADAPTER_D3D9_KHR'
|
2954
|
+
@codes[0x2026] = 'ADAPTER_D3D9EX_KHR'
|
2955
|
+
@codes[0x2027] = 'ADAPTER_DXVA_KHR'
|
2956
|
+
@codes[0x2008] = 'GL_CONTEXT_KHR'
|
2957
|
+
@codes[0x200C] = 'CGL_SHAREGROUP_KHR'
|
2958
|
+
@codes[0x2009] = 'EGL_DISPLAY_KHR'
|
2959
|
+
@codes[0x200A] = 'GLX_DISPLAY_KHR'
|
2960
|
+
@codes[0x200B] = 'WGL_HDC_KHR'
|
2961
|
+
@codes[0x401D] = 'D3D11_DEVICE_KHR'
|
2962
|
+
@codes[0x2030] = 'MEMORY_INITIALIZE_KHR'
|
2963
|
+
@codes[0x2032] = 'TERMINATE_KHR'
|
2964
|
+
end
|
2965
|
+
end
|
2966
|
+
|
2853
2967
|
class CommandQueue < FFI::ManagedStruct
|
2854
2968
|
layout :dummy, :pointer
|
2855
2969
|
#:stopdoc:
|
@@ -2864,13 +2978,13 @@ module OpenCL
|
|
2864
2978
|
SIZE = 0x1094
|
2865
2979
|
DEVICE_DEFAULT = 0x1095
|
2866
2980
|
PRIORITY_KHR = 0x1096
|
2867
|
-
PRIORITY_HIGH_KHR = (1<<0)
|
2868
|
-
PRIORITY_MED_KHR = (1<<1)
|
2869
|
-
PRIORITY_LOW_KHR = (1<<2)
|
2981
|
+
PRIORITY_HIGH_KHR = (1 << 0)
|
2982
|
+
PRIORITY_MED_KHR = (1 << 1)
|
2983
|
+
PRIORITY_LOW_KHR = (1 << 2)
|
2870
2984
|
THROTTLE_KHR = 0x1097
|
2871
|
-
THROTTLE_HIGH_KHR = (1<<0)
|
2872
|
-
THROTTLE_MED_KHR = (1<<1)
|
2873
|
-
THROTTLE_LOW_KHR = (1<<2)
|
2985
|
+
THROTTLE_HIGH_KHR = (1 << 0)
|
2986
|
+
THROTTLE_MED_KHR = (1 << 1)
|
2987
|
+
THROTTLE_LOW_KHR = (1 << 2)
|
2874
2988
|
# Creates a new CommandQueue and retains it if specified and aplicable
|
2875
2989
|
def initialize(ptr, retain = true)
|
2876
2990
|
super(ptr)
|
@@ -2916,6 +3030,25 @@ module OpenCL
|
|
2916
3030
|
end
|
2917
3031
|
end
|
2918
3032
|
|
3033
|
+
class PriorityKHR < Enum
|
3034
|
+
PRIORITY_HIGH_KHR = (1 << 0)
|
3035
|
+
PRIORITY_MED_KHR = (1 << 1)
|
3036
|
+
PRIORITY_LOW_KHR = (1 << 2)
|
3037
|
+
@codes = {}
|
3038
|
+
@codes[(1 << 0)] = 'PRIORITY_HIGH_KHR'
|
3039
|
+
@codes[(1 << 1)] = 'PRIORITY_MED_KHR'
|
3040
|
+
@codes[(1 << 2)] = 'PRIORITY_LOW_KHR'
|
3041
|
+
end
|
3042
|
+
|
3043
|
+
class ThrottleKHR < Enum
|
3044
|
+
THROTTLE_HIGH_KHR = (1 << 0)
|
3045
|
+
THROTTLE_MED_KHR = (1 << 1)
|
3046
|
+
THROTTLE_LOW_KHR = (1 << 2)
|
3047
|
+
@codes = {}
|
3048
|
+
@codes[(1 << 0)] = 'THROTTLE_HIGH_KHR'
|
3049
|
+
@codes[(1 << 1)] = 'THROTTLE_MED_KHR'
|
3050
|
+
@codes[(1 << 2)] = 'THROTTLE_LOW_KHR'
|
3051
|
+
end
|
2919
3052
|
end
|
2920
3053
|
class Mem < FFI::ManagedStruct
|
2921
3054
|
layout :dummy, :pointer
|
@@ -2931,6 +3064,7 @@ module OpenCL
|
|
2931
3064
|
HOST_NO_ACCESS = (1 << 9)
|
2932
3065
|
SVM_FINE_GRAIN_BUFFER = (1 << 10)
|
2933
3066
|
SVM_ATOMICS = (1 << 11)
|
3067
|
+
KERNEL_READ_AND_WRITE = (1 << 12)
|
2934
3068
|
BUFFER = 0x10F0
|
2935
3069
|
IMAGE2D = 0x10F1
|
2936
3070
|
IMAGE3D = 0x10F2
|
@@ -2996,6 +3130,9 @@ module OpenCL
|
|
2996
3130
|
HOST_WRITE_ONLY = (1 << 7)
|
2997
3131
|
HOST_READ_ONLY = (1 << 8)
|
2998
3132
|
HOST_NO_ACCESS = (1 << 9)
|
3133
|
+
SVM_FINE_GRAIN_BUFFER = (1 << 10)
|
3134
|
+
SVM_ATOMICS = (1 << 11)
|
3135
|
+
KERNEL_READ_AND_WRITE = (1 << 12)
|
2999
3136
|
# Returns an Array of String representing the different flags set
|
3000
3137
|
def names
|
3001
3138
|
fs = []
|
@@ -3030,18 +3167,15 @@ module OpenCL
|
|
3030
3167
|
IMAGE1D_ARRAY = 0x10F5
|
3031
3168
|
IMAGE1D_BUFFER = 0x10F6
|
3032
3169
|
PIPE = 0x10F7
|
3033
|
-
|
3034
|
-
|
3035
|
-
|
3036
|
-
|
3037
|
-
|
3038
|
-
|
3039
|
-
|
3040
|
-
|
3041
|
-
|
3042
|
-
def name
|
3043
|
-
return @@codes[@val]
|
3044
|
-
end
|
3170
|
+
@codes = {}
|
3171
|
+
@codes[0x10F0] = 'BUFFER'
|
3172
|
+
@codes[0x10F1] = 'IMAGE2D'
|
3173
|
+
@codes[0x10F2] = 'IMAGE3D'
|
3174
|
+
@codes[0x10F3] = 'IMAGE2D_ARRAY'
|
3175
|
+
@codes[0x10F4] = 'IMAGE1D'
|
3176
|
+
@codes[0x10F5] = 'IMAGE1D_ARRAY'
|
3177
|
+
@codes[0x10F6] = 'IMAGE1D_BUFFER'
|
3178
|
+
@codes[0x10F7] = 'PIPE'
|
3045
3179
|
end
|
3046
3180
|
|
3047
3181
|
# Bitfield that maps the :cl_svm_mem_flags type
|
@@ -3123,15 +3257,12 @@ module OpenCL
|
|
3123
3257
|
LIBRARY = 0x2
|
3124
3258
|
EXECUTABLE = 0x4
|
3125
3259
|
INTERMEDIATE = 0x40E1
|
3126
|
-
|
3127
|
-
|
3128
|
-
|
3129
|
-
|
3130
|
-
|
3131
|
-
|
3132
|
-
def name
|
3133
|
-
return @@codes[@val]
|
3134
|
-
end
|
3260
|
+
@codes = {}
|
3261
|
+
@codes[0x0] = 'NONE'
|
3262
|
+
@codes[0x1] = 'COMPILED_OBJECT'
|
3263
|
+
@codes[0x2] = 'LIBRARY'
|
3264
|
+
@codes[0x4] = 'EXECUTABLE'
|
3265
|
+
@codes[0x40E1] = 'INTERMEDIATE'
|
3135
3266
|
end
|
3136
3267
|
|
3137
3268
|
end
|
@@ -3235,14 +3366,11 @@ module OpenCL
|
|
3235
3366
|
LOCAL = 0x119C
|
3236
3367
|
CONSTANT = 0x119D
|
3237
3368
|
PRIVATE = 0x119E
|
3238
|
-
|
3239
|
-
|
3240
|
-
|
3241
|
-
|
3242
|
-
|
3243
|
-
def name
|
3244
|
-
return @@codes[@val]
|
3245
|
-
end
|
3369
|
+
@codes = {}
|
3370
|
+
@codes[0x119B] = 'GLOBAL'
|
3371
|
+
@codes[0x119C] = 'LOCAL'
|
3372
|
+
@codes[0x119D] = 'CONSTANT'
|
3373
|
+
@codes[0x119E] = 'PRIVATE'
|
3246
3374
|
end
|
3247
3375
|
|
3248
3376
|
# Enum that maps the :cl_kernel_arg_access_qualifier type
|
@@ -3251,14 +3379,11 @@ module OpenCL
|
|
3251
3379
|
WRITE_ONLY = 0x11A1
|
3252
3380
|
READ_WRITE = 0x11A2
|
3253
3381
|
NONE = 0x11A3
|
3254
|
-
|
3255
|
-
|
3256
|
-
|
3257
|
-
|
3258
|
-
|
3259
|
-
def name
|
3260
|
-
return @@codes[@val]
|
3261
|
-
end
|
3382
|
+
@codes = {}
|
3383
|
+
@codes[0x11A0] = 'READ_ONLY'
|
3384
|
+
@codes[0x11A1] = 'WRITE_ONLY'
|
3385
|
+
@codes[0x11A2] = 'READ_WRITE'
|
3386
|
+
@codes[0x11A3] = 'NONE'
|
3262
3387
|
end
|
3263
3388
|
|
3264
3389
|
# Bitfield that maps the :cl_kernel_arg_type_qualifier type
|
@@ -3357,29 +3482,6 @@ module OpenCL
|
|
3357
3482
|
end
|
3358
3483
|
end
|
3359
3484
|
|
3360
|
-
end
|
3361
|
-
|
3362
|
-
class Sampler
|
3363
|
-
# Enum that maps the :cl_sampler_properties
|
3364
|
-
class Type < Enum
|
3365
|
-
NORMALIZED_COORDS = 0x1152
|
3366
|
-
ADDRESSING_MODE = 0x1153
|
3367
|
-
FILTER_MODE = 0x1154
|
3368
|
-
MIP_FILTER_MODE = 0x1155
|
3369
|
-
LOD_MIN = 0x1156
|
3370
|
-
LOD_MAX = 0x1157
|
3371
|
-
@@codes[0x1152] = 'NORMALIZED_COORDS'
|
3372
|
-
@@codes[0x1153] = 'ADDRESSING_MODE'
|
3373
|
-
@@codes[0x1154] = 'FILTER_MODE'
|
3374
|
-
@@codes[0x1155] = 'MIP_FILTER_MODE'
|
3375
|
-
@@codes[0x1156] = 'LOD_MIN'
|
3376
|
-
@@codes[0x1157] = 'LOD_MAX'
|
3377
|
-
# Returns a String representing the Enum value name
|
3378
|
-
def name
|
3379
|
-
return @@codes[@val]
|
3380
|
-
end
|
3381
|
-
end
|
3382
|
-
|
3383
3485
|
end
|
3384
3486
|
class GLsync < FFI::ManagedStruct
|
3385
3487
|
layout :dummy, :pointer
|
@@ -3437,30 +3539,27 @@ module OpenCL
|
|
3437
3539
|
return 0x10C2
|
3438
3540
|
end
|
3439
3541
|
ABGR = 0x10C3
|
3440
|
-
|
3441
|
-
|
3442
|
-
|
3443
|
-
|
3444
|
-
|
3445
|
-
|
3446
|
-
|
3447
|
-
|
3448
|
-
|
3449
|
-
|
3450
|
-
|
3451
|
-
|
3452
|
-
|
3453
|
-
|
3454
|
-
|
3455
|
-
|
3456
|
-
|
3457
|
-
|
3458
|
-
|
3459
|
-
|
3460
|
-
|
3461
|
-
def name
|
3462
|
-
return @@codes[@val]
|
3463
|
-
end
|
3542
|
+
@codes = {}
|
3543
|
+
@codes[0x10B0] = 'R'
|
3544
|
+
@codes[0x10B1] = 'A'
|
3545
|
+
@codes[0x10B2] = 'RG'
|
3546
|
+
@codes[0x10B3] = 'RA'
|
3547
|
+
@codes[0x10B4] = 'RGB'
|
3548
|
+
@codes[0x10B5] = 'RGBA'
|
3549
|
+
@codes[0x10B6] = 'BGRA'
|
3550
|
+
@codes[0x10B7] = 'ARGB'
|
3551
|
+
@codes[0x10B8] = 'INTENSITY'
|
3552
|
+
@codes[0x10B9] = 'LUMINANCE'
|
3553
|
+
@codes[0x10BA] = 'Rx'
|
3554
|
+
@codes[0x10BB] = 'RGx'
|
3555
|
+
@codes[0x10BC] = 'RGBx'
|
3556
|
+
@codes[0x10BD] = 'DEPTH'
|
3557
|
+
@codes[0x10BE] = 'DEPTH_STENCIL'
|
3558
|
+
@codes[0x10BF] = 'sRGB'
|
3559
|
+
@codes[0x10C0] = 'sRGBx'
|
3560
|
+
@codes[0x10C1] = 'sRGBA'
|
3561
|
+
@codes[0x10C2] = 'sBGRA'
|
3562
|
+
@codes[0x10C3] = 'ABGR'
|
3464
3563
|
end
|
3465
3564
|
|
3466
3565
|
# Enum that maps the :cl_channel_type type
|
@@ -3482,27 +3581,24 @@ module OpenCL
|
|
3482
3581
|
FLOAT = 0x10DE
|
3483
3582
|
UNORM_INT24 = 0x10DF
|
3484
3583
|
UNORM_INT_101010_2 = 0x10E0
|
3485
|
-
|
3486
|
-
|
3487
|
-
|
3488
|
-
|
3489
|
-
|
3490
|
-
|
3491
|
-
|
3492
|
-
|
3493
|
-
|
3494
|
-
|
3495
|
-
|
3496
|
-
|
3497
|
-
|
3498
|
-
|
3499
|
-
|
3500
|
-
|
3501
|
-
|
3502
|
-
|
3503
|
-
def name
|
3504
|
-
return @@codes[@val]
|
3505
|
-
end
|
3584
|
+
@codes = {}
|
3585
|
+
@codes[0x10D0] = 'SNORM_INT8'
|
3586
|
+
@codes[0x10D1] = 'SNORM_INT16'
|
3587
|
+
@codes[0x10D2] = 'UNORM_INT8'
|
3588
|
+
@codes[0x10D3] = 'UNORM_INT16'
|
3589
|
+
@codes[0x10D4] = 'UNORM_SHORT_565'
|
3590
|
+
@codes[0x10D5] = 'UNORM_SHORT_555'
|
3591
|
+
@codes[0x10D6] = 'UNORM_INT_101010'
|
3592
|
+
@codes[0x10D7] = 'SIGNED_INT8'
|
3593
|
+
@codes[0x10D8] = 'SIGNED_INT16'
|
3594
|
+
@codes[0x10D9] = 'SIGNED_INT32'
|
3595
|
+
@codes[0x10DA] = 'UNSIGNED_INT8'
|
3596
|
+
@codes[0x10DB] = 'UNSIGNED_INT16'
|
3597
|
+
@codes[0x10DC] = 'UNSIGNED_INT32'
|
3598
|
+
@codes[0x10DD] = 'HALF_FLOAT'
|
3599
|
+
@codes[0x10DE] = 'FLOAT'
|
3600
|
+
@codes[0x10DF] = 'UNORM_INT24'
|
3601
|
+
@codes[0x10E0] = 'UNORM_INT_101010_2'
|
3506
3602
|
end
|
3507
3603
|
|
3508
3604
|
# Enum that maps the :cl_addressing_mode type
|
@@ -3512,27 +3608,21 @@ module OpenCL
|
|
3512
3608
|
CLAMP = 0x1132
|
3513
3609
|
REPEAT = 0x1133
|
3514
3610
|
MIRRORED_REPEAT = 0x1134
|
3515
|
-
|
3516
|
-
|
3517
|
-
|
3518
|
-
|
3519
|
-
|
3520
|
-
|
3521
|
-
def name
|
3522
|
-
return @@codes[@val]
|
3523
|
-
end
|
3611
|
+
@codes = {}
|
3612
|
+
@codes[0x1130] = 'NONE'
|
3613
|
+
@codes[0x1131] = 'CLAMP_TO_EDGE'
|
3614
|
+
@codes[0x1132] = 'CLAMP'
|
3615
|
+
@codes[0x1133] = 'REPEAT'
|
3616
|
+
@codes[0x1134] = 'MIRRORED_REPEAT'
|
3524
3617
|
end
|
3525
3618
|
|
3526
3619
|
# Enum that maps the :cl_filter_mode type
|
3527
3620
|
class FilterMode < Enum
|
3528
3621
|
NEAREST = 0x1140
|
3529
3622
|
LINEAR = 0x1141
|
3530
|
-
|
3531
|
-
|
3532
|
-
|
3533
|
-
def name
|
3534
|
-
return @@codes[@val]
|
3535
|
-
end
|
3623
|
+
@codes = {}
|
3624
|
+
@codes[0x1140] = 'NEAREST'
|
3625
|
+
@codes[0x1141] = 'LINEAR'
|
3536
3626
|
end
|
3537
3627
|
|
3538
3628
|
# Bitfield that maps the :cl_map_flags type
|
@@ -3582,40 +3672,57 @@ module OpenCL
|
|
3582
3672
|
SVM_MEMFILL = 0x120B
|
3583
3673
|
SVM_MAP = 0x120C
|
3584
3674
|
SVM_UNMAP = 0x120D
|
3585
|
-
|
3586
|
-
|
3587
|
-
|
3588
|
-
|
3589
|
-
|
3590
|
-
|
3591
|
-
|
3592
|
-
|
3593
|
-
|
3594
|
-
|
3595
|
-
|
3596
|
-
|
3597
|
-
|
3598
|
-
|
3599
|
-
|
3600
|
-
|
3601
|
-
|
3602
|
-
|
3603
|
-
|
3604
|
-
|
3605
|
-
|
3606
|
-
|
3607
|
-
|
3608
|
-
|
3609
|
-
|
3610
|
-
|
3611
|
-
|
3612
|
-
|
3613
|
-
|
3614
|
-
|
3615
|
-
|
3616
|
-
|
3617
|
-
|
3618
|
-
|
3675
|
+
GL_FENCE_SYNC_OBJECT_KHR = 0x200D
|
3676
|
+
ACQUIRE_DX9_MEDIA_SURFACES_KHR = 0x202B
|
3677
|
+
RELEASE_DX9_MEDIA_SURFACES_KHR = 0x202C
|
3678
|
+
EGL_FENCE_SYNC_OBJECT_KHR = 0x202F
|
3679
|
+
ACQUIRE_EGL_OBJECTS_KHR = 0x202D
|
3680
|
+
RELEASE_EGL_OBJECTS_KHR = 0x202E
|
3681
|
+
ACQUIRE_D3D10_OBJECTS_KHR = 0x4017
|
3682
|
+
RELEASE_D3D10_OBJECTS_KHR = 0x4018
|
3683
|
+
ACQUIRE_D3D11_OBJECTS_KHR = 0x4020
|
3684
|
+
RELEASE_D3D11_OBJECTS_KHR = 0x4021
|
3685
|
+
@codes = {}
|
3686
|
+
@codes[0x11F0] = 'NDRANGE_KERNEL'
|
3687
|
+
@codes[0x11F1] = 'TASK'
|
3688
|
+
@codes[0x11F2] = 'NATIVE_KERNEL'
|
3689
|
+
@codes[0x11F3] = 'READ_BUFFER'
|
3690
|
+
@codes[0x11F4] = 'WRITE_BUFFER'
|
3691
|
+
@codes[0x11F5] = 'COPY_BUFFER'
|
3692
|
+
@codes[0x11F6] = 'READ_IMAGE'
|
3693
|
+
@codes[0x11F7] = 'WRITE_IMAGE'
|
3694
|
+
@codes[0x11F8] = 'COPY_IMAGE'
|
3695
|
+
@codes[0x11F9] = 'COPY_IMAGE_TO_BUFFER'
|
3696
|
+
@codes[0x11FA] = 'COPY_BUFFER_TO_IMAGE'
|
3697
|
+
@codes[0x11FB] = 'MAP_BUFFER'
|
3698
|
+
@codes[0x11FC] = 'MAP_IMAGE'
|
3699
|
+
@codes[0x11FD] = 'UNMAP_MEM_OBJECT'
|
3700
|
+
@codes[0x11FE] = 'MARKER'
|
3701
|
+
@codes[0x11FF] = 'ACQUIRE_GL_OBJECTS'
|
3702
|
+
@codes[0x1200] = 'RELEASE_GL_OBJECTS'
|
3703
|
+
@codes[0x1201] = 'READ_BUFFER_RECT'
|
3704
|
+
@codes[0x1202] = 'WRITE_BUFFER_RECT'
|
3705
|
+
@codes[0x1203] = 'COPY_BUFFER_RECT'
|
3706
|
+
@codes[0x1204] = 'USER'
|
3707
|
+
@codes[0x1205] = 'BARRIER'
|
3708
|
+
@codes[0x1206] = 'MIGRATE_MEM_OBJECTS'
|
3709
|
+
@codes[0x1207] = 'FILL_BUFFER'
|
3710
|
+
@codes[0x1208] = 'FILL_IMAGE'
|
3711
|
+
@codes[0x1209] = 'SVM_FREE'
|
3712
|
+
@codes[0x120A] = 'SVM_MEMCPY'
|
3713
|
+
@codes[0x120B] = 'SVM_MEMFILL'
|
3714
|
+
@codes[0x120C] = 'SVM_MAP'
|
3715
|
+
@codes[0x120D] = 'SVM_UNMAP'
|
3716
|
+
@codes[0x200D] = 'GL_FENCE_SYNC_OBJECT_KHR'
|
3717
|
+
@codes[0x202B] = 'ACQUIRE_DX9_MEDIA_SURFACES_KHR'
|
3718
|
+
@codes[0x202C] = 'RELEASE_DX9_MEDIA_SURFACES_KHR'
|
3719
|
+
@codes[0x202F] = 'EGL_FENCE_SYNC_OBJECT_KHR'
|
3720
|
+
@codes[0x202D] = 'ACQUIRE_EGL_OBJECTS_KHR'
|
3721
|
+
@codes[0x202E] = 'RELEASE_EGL_OBJECTS_KHR'
|
3722
|
+
@codes[0x4017] = 'ACQUIRE_D3D10_OBJECTS_KHR'
|
3723
|
+
@codes[0x4018] = 'RELEASE_D3D10_OBJECTS_KHR'
|
3724
|
+
@codes[0x4020] = 'ACQUIRE_D3D11_OBJECTS_KHR'
|
3725
|
+
@codes[0x4021] = 'RELEASE_D3D11_OBJECTS_KHR'
|
3619
3726
|
end
|
3620
3727
|
|
3621
3728
|
# Enum that maps the :cl_gl_object_type type
|
@@ -3628,18 +3735,15 @@ module OpenCL
|
|
3628
3735
|
TEXTURE1D = 0x200F
|
3629
3736
|
TEXTURE1D_ARRAY = 0x2010
|
3630
3737
|
TEXTURE_BUFFER = 0x2011
|
3631
|
-
|
3632
|
-
|
3633
|
-
|
3634
|
-
|
3635
|
-
|
3636
|
-
|
3637
|
-
|
3638
|
-
|
3639
|
-
|
3640
|
-
def name
|
3641
|
-
return @@codes[@val]
|
3642
|
-
end
|
3738
|
+
@codes = {}
|
3739
|
+
@codes[0x2000] = 'BUFFER'
|
3740
|
+
@codes[0x2001] = 'TEXTURE2D'
|
3741
|
+
@codes[0x2002] = 'TEXTURE3D'
|
3742
|
+
@codes[0x2003] = 'RENDERBUFFER'
|
3743
|
+
@codes[0x200E] = 'TEXTURE2D_ARRAY'
|
3744
|
+
@codes[0x200F] = 'TEXTURE1D'
|
3745
|
+
@codes[0x2010] = 'TEXTURE1D_ARRAY'
|
3746
|
+
@codes[0x2011] = 'TEXTURE_BUFFER'
|
3643
3747
|
end
|
3644
3748
|
|
3645
3749
|
# Enum that maps the :cl_build_status type
|
@@ -3648,14 +3752,11 @@ module OpenCL
|
|
3648
3752
|
NONE = -1
|
3649
3753
|
ERROR = -2
|
3650
3754
|
IN_PROGRESS = -3
|
3651
|
-
|
3652
|
-
|
3653
|
-
|
3654
|
-
|
3655
|
-
|
3656
|
-
def name
|
3657
|
-
return @@codes[@val]
|
3658
|
-
end
|
3755
|
+
@codes = {}
|
3756
|
+
@codes[0] = 'SUCCESS'
|
3757
|
+
@codes[-1] = 'NONE'
|
3758
|
+
@codes[-2] = 'ERROR'
|
3759
|
+
@codes[-3] = 'IN_PROGRESS'
|
3659
3760
|
end
|
3660
3761
|
|
3661
3762
|
# Enum that maps the command execution status logical type
|
@@ -3664,14 +3765,11 @@ module OpenCL
|
|
3664
3765
|
RUNNING = 0x1
|
3665
3766
|
SUBMITTED = 0x2
|
3666
3767
|
QUEUED = 0x3
|
3667
|
-
|
3668
|
-
|
3669
|
-
|
3670
|
-
|
3671
|
-
|
3672
|
-
def name
|
3673
|
-
return @@codes[@val]
|
3674
|
-
end
|
3768
|
+
@codes = {}
|
3769
|
+
@codes[0x0] = 'COMPLETE'
|
3770
|
+
@codes[0x1] = 'RUNNING'
|
3771
|
+
@codes[0x2] = 'SUBMITTED'
|
3772
|
+
@codes[0x3] = 'QUEUED'
|
3675
3773
|
end
|
3676
3774
|
|
3677
3775
|
class Image < Mem
|