Class: OpenCL::Sampler

Inherits:
FFI::ManagedStruct
  • Object
show all
Defined in:
lib/opencl_ruby_ffi/Sampler.rb,
lib/opencl_ruby_ffi/opencl_ruby_ffi_base_gen.rb,
lib/opencl_ruby_ffi/opencl_ruby_ffi_base_gen.rb

Overview

Maps the cl_smapler object of OpenCL

Defined Under Namespace

Classes: Type

Constant Summary collapse

REFERENCE_COUNT =

:stopdoc:

0x1150
CONTEXT =
0x1151
NORMALIZED_COORDS =
0x1152
ADDRESSING_MODE =
0x1153
FILTER_MODE =
0x1154
MIP_FILTER_MODE =
0x1155
LOD_MIN =
0x1156
LOD_MAX =
0x1157

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ptr, retain = true) ⇒ Sampler

Creates a new Sampler and retains it if specified and aplicable



3273
3274
3275
3276
3277
# File 'lib/opencl_ruby_ffi/opencl_ruby_ffi_base_gen.rb', line 3273

def initialize(ptr, retain = true)
  super(ptr)
  OpenCL.clRetainSampler(ptr) if retain
  #STDERR.puts "Allocating Sampler: #{ptr}"
end

Class Method Details

.release(ptr) ⇒ Object

method called at Sampler deletion, releases the object if aplicable



3280
3281
3282
3283
3284
3285
3286
3287
3288
# File 'lib/opencl_ruby_ffi/opencl_ruby_ffi_base_gen.rb', line 3280

def self.release(ptr)
  #STDERR.puts "Releasing Sampler: #{ptr}"
  #ref_count = FFI::MemoryPointer::new( :cl_uint ) 
  #OpenCL.clGetSamplerInfo(ptr, OpenCL::Sampler::REFERENCE_COUNT, ref_count.size, ref_count, nil)
  #STDERR.puts "reference counter: #{ref_count.read_cl_uint}"
  error = OpenCL.clReleaseSampler(ptr)
  #STDERR.puts "Object released! #{error}"
  error_check( error )
end

Instance Method Details

#contextObject

Returns the context associated with the Sampler



71
72
73
74
75
76
# File 'lib/opencl_ruby_ffi/Sampler.rb', line 71

def context
  ptr = FFI::MemoryPointer::new( Context )
  error = OpenCL.clGetSamplerInfo(self, CONTEXT, Context.size, ptr, nil)
  error_check(error)
  return Context::new( ptr.read_pointer )
end

#get_infoObject

:method: filter_mode() returns a FilterMode representing the filtering mode used by the Sampler



81
# File 'lib/opencl_ruby_ffi/Sampler.rb', line 81

eval get_info("Sampler", :cl_uint, "REFERENCE_COUNT")

#to_sObject

:startdoc:



3291
3292
3293
3294
3295
3296
3297
# File 'lib/opencl_ruby_ffi/opencl_ruby_ffi_base_gen.rb', line 3291

def to_s
  if self.respond_to?(:name) then
    return self.name
  else
    return super
  end
end