Blender V5.3
blender::gpu::GPUWorker Class Reference

#include <GPU_worker.hh>

Public Types

enum class  ContextType { Main , PerThread }

Public Member Functions

 GPUWorker (uint32_t threads_count, ContextType context_type, WorkCallback callback)
 ~GPUWorker ()
WorkID push_work (void *work, ThreadQueueWorkPriority priority)
bool cancel_work (WorkID id)
bool is_empty ()

Detailed Description

Abstracts the creation and management of secondary threads with GPU contexts. Must be created from the main thread. Threads and their context remain alive until destruction.

Definition at line 32 of file GPU_worker.hh.

Member Enumeration Documentation

◆ ContextType

Enumerator
Main 

Use the main GPU context on the worker threads.

PerThread 

Use a different secondary GPU context for each worker thread.

Definition at line 39 of file GPU_worker.hh.

Constructor & Destructor Documentation

◆ GPUWorker()

blender::gpu::GPUWorker::GPUWorker ( uint32_t threads_count,
ContextType context_type,
WorkCallback callback )
Parameters
threads_countNumber of threads to span.
context_typeThe type of context each thread uses.
callbackThe callback function that will be called for each acquired work (passed as a void pointer).

Definition at line 13 of file gpu_worker.cc.

References blender::BLI_thread_queue_init(), blender::IndexRange::IndexRange(), PerThread, and UNUSED_VARS.

◆ ~GPUWorker()

Member Function Documentation

◆ cancel_work()

bool blender::gpu::GPUWorker::cancel_work ( WorkID id)

Definition at line 46 of file gpu_worker.cc.

References blender::BLI_thread_queue_cancel_work().

◆ is_empty()

bool blender::gpu::GPUWorker::is_empty ( )

Definition at line 51 of file gpu_worker.cc.

References blender::BLI_thread_queue_is_empty().

◆ push_work()

WorkID blender::gpu::GPUWorker::push_work ( void * work,
ThreadQueueWorkPriority priority )

Definition at line 41 of file gpu_worker.cc.

References blender::BLI_thread_queue_push().


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