|
Blender V5.3
|
#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 () |
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.
|
strong |
| 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.
| blender::gpu::GPUWorker::GPUWorker | ( | uint32_t | threads_count, |
| ContextType | context_type, | ||
| WorkCallback | callback ) |
| threads_count | Number of threads to span. |
| context_type | The type of context each thread uses. |
| callback | The 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.
| blender::gpu::GPUWorker::~GPUWorker | ( | ) |
Definition at line 27 of file gpu_worker.cc.
References blender::BLI_assert(), blender::BLI_thread_queue_free(), blender::BLI_thread_queue_is_empty(), blender::BLI_thread_queue_nowait(), blender::BLI_thread_queue_wait_finish(), and thread::join().
| bool blender::gpu::GPUWorker::cancel_work | ( | WorkID | id | ) |
Definition at line 46 of file gpu_worker.cc.
References blender::BLI_thread_queue_cancel_work().
| bool blender::gpu::GPUWorker::is_empty | ( | ) |
Definition at line 51 of file gpu_worker.cc.
References blender::BLI_thread_queue_is_empty().
| 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().