Blender V4.3
Device Class Referenceabstract

#include <device.h>

Inherited by CPUDevice, DummyDevice, GPUDevice, and MultiDevice.

Public Member Functions

virtual ~Device () noexcept(false)
virtual const string & error_message ()
bool have_error ()
virtual void set_error (const string &error)
virtual BVHLayoutMask get_bvh_layout_mask (uint kernel_features) const =0
virtual void const_copy_to (const char *name, void *host, size_t size)=0
virtual bool load_kernels (uint)
virtual bool load_osl_kernels ()
virtual void cancel ()
virtual bool is_ready (string &) const
virtual unique_ptr< DeviceQueuegpu_queue_create ()
virtual void get_cpu_kernel_thread_globals (vector< CPUKernelThreadGlobals > &)
virtual void * get_cpu_osl_memory ()
virtual void build_bvh (BVH *bvh, Progress &progress, bool refit)
virtual void release_bvh (BVH *)
virtual int device_number (Device *)
virtual void optimize_for_scene (Scene *)
virtual bool is_resident (device_ptr, Device *sub_device)
virtual bool check_peer_access (Device *)
virtual bool should_use_graphics_interop ()
virtual void * get_native_buffer (device_ptr)
virtual void * get_guiding_device () const
virtual void foreach_device (const function< void(Device *)> &callback)

Static Public Member Functions

static const CPUKernelsget_cpu_kernels ()
static Devicecreate (const DeviceInfo &info, Stats &stats, Profiler &profiler, bool headless)
static DeviceType type_from_string (const char *name)
static string string_from_type (DeviceType type)
static vector< DeviceTypeavailable_types ()
static vector< DeviceInfoavailable_devices (uint device_type_mask=DEVICE_MASK_ALL)
static DeviceInfo dummy_device (const string &error_msg="")
static string device_capabilities (uint device_type_mask=DEVICE_MASK_ALL)
static DeviceInfo get_multi_device (const vector< DeviceInfo > &subdevices, int threads, bool background)
static void tag_update ()
static void free_memory ()

Public Attributes

DeviceInfo info
Statsstats
Profilerprofiler
bool headless = true

Protected Member Functions

 Device (const DeviceInfo &info_, Stats &stats_, Profiler &profiler_, bool headless_)
virtual device_ptr mem_alloc_sub_ptr (device_memory &, size_t, size_t)
virtual void mem_free_sub_ptr (device_ptr)
virtual void mem_alloc (device_memory &mem)=0
virtual void mem_copy_to (device_memory &mem)=0
virtual void mem_copy_from (device_memory &mem, size_t y, size_t w, size_t h, size_t elem)=0
virtual void mem_zero (device_memory &mem)=0
virtual void mem_free (device_memory &mem)=0

Protected Attributes

string error_msg

Friends

class device_sub_ptr
class MultiDevice
class DeviceServer
class device_memory

Detailed Description

Definition at line 136 of file device/device.h.

Constructor & Destructor Documentation

◆ Device()

◆ ~Device()

Device::~Device ( )
virtual

Definition at line 50 of file device/device.cpp.

References false.

Member Function Documentation

◆ available_devices()

◆ available_types()

vector< DeviceType > Device::available_types ( )
static

◆ build_bvh()

void Device::build_bvh ( BVH * bvh,
Progress & progress,
bool refit )
virtual

◆ cancel()

virtual void Device::cancel ( )
inlinevirtual

Definition at line 199 of file device/device.h.

◆ check_peer_access()

virtual bool Device::check_peer_access ( Device * )
inlinevirtual

Definition at line 244 of file device/device.h.

References Device().

◆ const_copy_to()

virtual void Device::const_copy_to ( const char * name,
void * host,
size_t size )
pure virtual

◆ create()

◆ device_capabilities()

◆ device_number()

virtual int Device::device_number ( Device * )
inlinevirtual

Reimplemented in MultiDevice.

Definition at line 230 of file device/device.h.

References Device().

◆ dummy_device()

DeviceInfo Device::dummy_device ( const string & error_msg = "")
static

Definition at line 304 of file device/device.cpp.

References DEVICE_DUMMY, error_msg, and info.

Referenced by blender_device_info().

◆ error_message()

virtual const string & Device::error_message ( )
inlinevirtual

Reimplemented in MultiDevice.

Definition at line 161 of file device/device.h.

References error_message(), and error_msg.

Referenced by error_message(), MultiDevice::error_message(), and have_error().

◆ foreach_device()

virtual void Device::foreach_device ( const function< void(Device *)> & callback)
inlinevirtual

Reimplemented in MultiDevice.

Definition at line 283 of file device/device.h.

References Device().

Referenced by find_best_device(), and MultiDevice::foreach_device().

◆ free_memory()

void Device::free_memory ( )
static

Definition at line 457 of file device/device.cpp.

Referenced by exit_func(), and tag_update().

◆ get_bvh_layout_mask()

◆ get_cpu_kernel_thread_globals()

void Device::get_cpu_kernel_thread_globals ( vector< CPUKernelThreadGlobals > & )
virtual

Reimplemented in CPUDevice.

Definition at line 481 of file device/device.cpp.

References LOG.

Referenced by ShaderEval::eval_cpu().

◆ get_cpu_kernels()

const CPUKernels & Device::get_cpu_kernels ( )
static

Definition at line 474 of file device/device.cpp.

Referenced by CPUDevice::CPUDevice(), and ShaderEval::eval_cpu().

◆ get_cpu_osl_memory()

void * Device::get_cpu_osl_memory ( )
virtual

Reimplemented in CPUDevice, and MultiDevice.

Definition at line 487 of file device/device.cpp.

Referenced by GeometryManager::device_free(), and GeometryManager::update_osl_globals().

◆ get_guiding_device()

virtual void * Device::get_guiding_device ( ) const
inlinevirtual

Reimplemented in CPUDevice.

Definition at line 272 of file device/device.h.

References LOG.

◆ get_multi_device()

◆ get_native_buffer()

virtual void * Device::get_native_buffer ( device_ptr )
inlinevirtual

Definition at line 264 of file device/device.h.

◆ gpu_queue_create()

unique_ptr< DeviceQueue > Device::gpu_queue_create ( )
virtual

Definition at line 468 of file device/device.cpp.

References LOG.

Referenced by DenoiserGPU::DenoiserGPU(), and ShaderEval::eval_gpu().

◆ have_error()

bool Device::have_error ( )
inline

Definition at line 165 of file device/device.h.

References error_message().

Referenced by PathTrace::path_trace(), and set_error().

◆ is_ready()

virtual bool Device::is_ready ( string & ) const
inlinevirtual

Definition at line 202 of file device/device.h.

◆ is_resident()

virtual bool Device::is_resident ( device_ptr ,
Device * sub_device )
inlinevirtual

Reimplemented in MultiDevice.

Definition at line 238 of file device/device.h.

References Device().

◆ load_kernels()

virtual bool Device::load_kernels ( uint )
inlinevirtual

Reimplemented in CPUDevice, and MultiDevice.

Definition at line 188 of file device/device.h.

Referenced by MultiDevice::load_kernels().

◆ load_osl_kernels()

virtual bool Device::load_osl_kernels ( )
inlinevirtual

Reimplemented in MultiDevice.

Definition at line 193 of file device/device.h.

Referenced by MultiDevice::load_osl_kernels().

◆ mem_alloc()

virtual void Device::mem_alloc ( device_memory & mem)
protectedpure virtual

Implemented in CPUDevice, DummyDevice, and MultiDevice.

References device_memory.

Referenced by MultiDevice::mem_alloc().

◆ mem_alloc_sub_ptr()

virtual device_ptr Device::mem_alloc_sub_ptr ( device_memory & ,
size_t ,
size_t  )
inlineprotectedvirtual

Reimplemented in CPUDevice.

Definition at line 147 of file device/device.h.

References device_memory.

◆ mem_copy_from()

virtual void Device::mem_copy_from ( device_memory & mem,
size_t y,
size_t w,
size_t h,
size_t elem )
protectedpure virtual

Implemented in CPUDevice, DummyDevice, and MultiDevice.

References device_memory, w(), and y.

Referenced by MultiDevice::mem_copy_from().

◆ mem_copy_to()

virtual void Device::mem_copy_to ( device_memory & mem)
protectedpure virtual

Implemented in CPUDevice, DummyDevice, and MultiDevice.

References device_memory.

Referenced by MultiDevice::mem_copy_to().

◆ mem_free()

virtual void Device::mem_free ( device_memory & mem)
protectedpure virtual

Implemented in CPUDevice, DummyDevice, and MultiDevice.

References device_memory, and thread_mutex.

Referenced by MultiDevice::mem_free().

◆ mem_free_sub_ptr()

virtual void Device::mem_free_sub_ptr ( device_ptr )
inlineprotectedvirtual

Definition at line 153 of file device/device.h.

◆ mem_zero()

virtual void Device::mem_zero ( device_memory & mem)
protectedpure virtual

Implemented in CPUDevice, DummyDevice, and MultiDevice.

References device_memory.

Referenced by MultiDevice::mem_zero().

◆ optimize_for_scene()

virtual void Device::optimize_for_scene ( Scene * )
inlinevirtual

Definition at line 236 of file device/device.h.

◆ release_bvh()

virtual void Device::release_bvh ( BVH * )
inlinevirtual

Definition at line 227 of file device/device.h.

◆ set_error()

virtual void Device::set_error ( const string & error)
inlinevirtual

Definition at line 169 of file device/device.h.

References error(), error_msg, and have_error().

Referenced by GPUDevice::generic_alloc().

◆ should_use_graphics_interop()

virtual bool Device::should_use_graphics_interop ( )
inlinevirtual

◆ string_from_type()

string Device::string_from_type ( DeviceType type)
static

◆ tag_update()

void Device::tag_update ( )
static

Definition at line 452 of file device/device.cpp.

References free_memory().

◆ type_from_string()

DeviceType Device::type_from_string ( const char * name)
static

◆ device_memory

◆ device_sub_ptr

friend class device_sub_ptr
friend

Definition at line 137 of file device/device.h.

References device_sub_ptr.

Referenced by device_sub_ptr.

◆ DeviceServer

friend class DeviceServer
friend

Definition at line 309 of file device/device.h.

References DeviceServer.

Referenced by DeviceServer.

◆ MultiDevice

friend class MultiDevice
friend

Definition at line 308 of file device/device.h.

References MultiDevice.

Referenced by MultiDevice.

Member Data Documentation

◆ error_msg

string Device::error_msg
protected

◆ headless

bool Device::headless = true

Definition at line 182 of file device/device.h.

Referenced by create(), Device(), and MultiDevice::MultiDevice().

◆ info

◆ profiler

◆ stats


The documentation for this class was generated from the following files: