Blender V5.0
GPUDevice Class Referenceabstract

#include <GPU_platform.hh>

Inherits Device.

Classes

struct  Mem

Public Member Functions

 ~GPUDevice () noexcept(false) override
virtual bool load_texture_info ()
Public Member Functions inherited from Device
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 (const uint kernel_features) const =0
virtual void const_copy_to (const char *name, void *host, const 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< ThreadKernelGlobalsCPU > &)
virtual OSLGlobals * get_cpu_osl_memory ()
virtual void build_bvh (BVH *bvh, Progress &progress, bool refit)
virtual void release_bvh (BVH *)
virtual bool set_bvh_limits (size_t, size_t)
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 (const GraphicsInteropDevice &, const bool=false)
virtual void * get_native_buffer (device_ptr)
virtual void * get_guiding_device () const
virtual void foreach_device (const std::function< void(Device *)> &callback)

Public Attributes

std::string identifier
int index
uint32_t vendor_id
uint32_t device_id
std::string name
device_vector< TextureInfotexture_info
thread_mutex texture_info_mutex
bool need_texture_info = false
Public Attributes inherited from Device
DeviceInfo info
Statsstats
Profilerprofiler
bool headless = true

Protected Types

using texMemObject = unsigned long long
using arrayMemObject = unsigned long long
using MemMap = map<device_memory *, Mem>

Protected Member Functions

 GPUDevice (const DeviceInfo &info_, Stats &stats_, Profiler &profiler_, bool headless_)
virtual void init_host_memory (const size_t preferred_texture_headroom=0, const size_t preferred_working_headroom=0)
virtual void move_textures_to_host (const size_t size, const size_t headroom, const bool for_texture)
virtual GPUDevice::Memgeneric_alloc (device_memory &mem, const size_t pitch_padding=0)
virtual void generic_free (device_memory &mem)
virtual void generic_copy_to (device_memory &mem)
virtual void get_device_memory_info (size_t &total, size_t &free)=0
virtual bool alloc_device (void *&device_pointer, const size_t size)=0
virtual void free_device (void *device_pointer)=0
virtual bool shared_alloc (void *&shared_pointer, const size_t size)=0
virtual void shared_free (void *shared_pointer)=0
bool is_shared (const void *shared_pointer, const device_ptr device_pointer, Device *sub_device) override
virtual void * shared_to_device_pointer (const void *shared_pointer)=0
virtual void copy_host_to_device (void *device_pointer, void *host_pointer, const size_t size)=0
Protected Member Functions inherited from Device
 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 * host_alloc (const MemoryType type, const size_t size)
virtual void host_free (const MemoryType type, void *host_pointer, const size_t size)
virtual void mem_alloc (device_memory &mem)=0
virtual void mem_copy_to (device_memory &mem)=0
virtual void mem_move_to_host (device_memory &mem)=0
virtual void mem_copy_from (device_memory &mem, const size_t y, size_t w, const 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

bool can_map_host = false
size_t map_host_used = 0
size_t map_host_limit = 0
size_t device_texture_headroom = 0
size_t device_working_headroom = 0
MemMap device_mem_map
thread_mutex device_mem_map_mutex
size_t device_mem_in_use = 0
Protected Attributes inherited from Device
string error_msg

Friends

class device_memory

Additional Inherited Members

Static Public Member Functions inherited from Device
static const CPUKernelsget_cpu_kernels ()
static unique_ptr< 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 (const uint device_type_mask=DEVICE_MASK_ALL)
static DeviceInfo dummy_device (const string &error_msg="")
static string device_capabilities (const uint device_type_mask=DEVICE_MASK_ALL)
static DeviceInfo get_multi_device (const vector< DeviceInfo > &subdevices, const int threads, bool background)
static void tag_update ()
static void free_memory ()

Detailed Description

Definition at line 70 of file GPU_platform.hh.

Member Typedef Documentation

◆ arrayMemObject

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

◆ MemMap

using GPUDevice::MemMap = map<device_memory *, Mem>
protected

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

◆ texMemObject

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

Constructor & Destructor Documentation

◆ GPUDevice()

GPUDevice::GPUDevice ( const DeviceInfo & info_,
Stats & stats_,
Profiler & profiler_,
bool headless_ )
inlineprotected

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

References Device::Device(), MEM_GLOBAL, and texture_info.

Referenced by load_texture_info().

◆ ~GPUDevice()

GPUDevice::~GPUDevice ( )
overridedefault

References false, and override.

Member Function Documentation

◆ alloc_device()

virtual bool GPUDevice::alloc_device ( void *& device_pointer,
const size_t size )
protectedpure virtual

References size().

Referenced by generic_alloc().

◆ copy_host_to_device()

virtual void GPUDevice::copy_host_to_device ( void * device_pointer,
void * host_pointer,
const size_t size )
protectedpure virtual

References size().

Referenced by generic_copy_to().

◆ free_device()

virtual void GPUDevice::free_device ( void * device_pointer)
protectedpure virtual

Referenced by generic_free().

◆ generic_alloc()

◆ generic_copy_to()

◆ generic_free()

◆ get_device_memory_info()

virtual void GPUDevice::get_device_memory_info ( size_t & total,
size_t & free )
protectedpure virtual

References free().

Referenced by generic_alloc(), and move_textures_to_host().

◆ init_host_memory()

void GPUDevice::init_host_memory ( const size_t preferred_texture_headroom = 0,
const size_t preferred_working_headroom = 0 )
protectedvirtual

◆ is_shared()

bool GPUDevice::is_shared ( const void * shared_pointer,
const device_ptr device_pointer,
Device * sub_device )
overrideprotectedvirtual

Reimplemented from Device.

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

References Device::Device(), and shared_to_device_pointer().

◆ load_texture_info()

bool GPUDevice::load_texture_info ( )
virtual

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

References GPUDevice(), load_texture_info(), need_texture_info, and texture_info.

Referenced by load_texture_info().

◆ move_textures_to_host()

◆ shared_alloc()

virtual bool GPUDevice::shared_alloc ( void *& shared_pointer,
const size_t size )
protectedpure virtual

References size().

Referenced by generic_alloc().

◆ shared_free()

virtual void GPUDevice::shared_free ( void * shared_pointer)
protectedpure virtual

References Device::Device().

Referenced by generic_free().

◆ shared_to_device_pointer()

virtual void * GPUDevice::shared_to_device_pointer ( const void * shared_pointer)
protectedpure virtual

Referenced by generic_alloc(), and is_shared().

◆ device_memory

friend class device_memory
friend

Member Data Documentation

◆ can_map_host

bool GPUDevice::can_map_host = false
protected

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

Referenced by generic_alloc().

◆ device_id

uint32_t GPUDevice::device_id

Definition at line 74 of file GPU_platform.hh.

◆ device_mem_in_use

size_t GPUDevice::device_mem_in_use = 0
protected

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

Referenced by generic_alloc(), and generic_free().

◆ device_mem_map

MemMap GPUDevice::device_mem_map
protected

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

Referenced by generic_alloc(), generic_free(), and move_textures_to_host().

◆ device_mem_map_mutex

thread_mutex GPUDevice::device_mem_map_mutex
protected

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

Referenced by generic_alloc(), generic_free(), and move_textures_to_host().

◆ device_texture_headroom

size_t GPUDevice::device_texture_headroom = 0
protected

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

Referenced by generic_alloc(), and init_host_memory().

◆ device_working_headroom

size_t GPUDevice::device_working_headroom = 0
protected

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

Referenced by generic_alloc(), and init_host_memory().

◆ identifier

std::string GPUDevice::identifier

Definition at line 71 of file GPU_platform.hh.

◆ index

int GPUDevice::index

Definition at line 72 of file GPU_platform.hh.

◆ map_host_limit

size_t GPUDevice::map_host_limit = 0
protected

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

Referenced by generic_alloc(), and init_host_memory().

◆ map_host_used

size_t GPUDevice::map_host_used = 0
protected

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

Referenced by generic_alloc(), and generic_free().

◆ name

std::string GPUDevice::name

Definition at line 75 of file GPU_platform.hh.

Referenced by blender::gpu::init_device_list().

◆ need_texture_info

bool GPUDevice::need_texture_info = false

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

Referenced by load_texture_info(), and move_textures_to_host().

◆ texture_info

device_vector<TextureInfo> GPUDevice::texture_info

◆ texture_info_mutex

thread_mutex GPUDevice::texture_info_mutex

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

◆ vendor_id

uint32_t GPUDevice::vendor_id

Definition at line 73 of file GPU_platform.hh.


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