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



1609
1610
1611
1612
1613
# File 'lib/opencl_ruby_ffi/opencl_ruby_ffi_base_gen.rb', line 1609

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



1624
1625
1626
1627
1628
1629
1630
1631
1632
# File 'lib/opencl_ruby_ffi/opencl_ruby_ffi_base_gen.rb', line 1624

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}"
  OpenCL.error_check( error )
end

Instance Method Details

#contextObject

Returns the context associated with the Sampler



66
67
68
69
70
71
# File 'lib/opencl_ruby_ffi/Sampler.rb', line 66

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

#get_infoObject

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



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

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

#to_sObject



1615
1616
1617
1618
1619
1620
1621
# File 'lib/opencl_ruby_ffi/opencl_ruby_ffi_base_gen.rb', line 1615

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