|
KiCad PCB EDA Suite
|
Process-wide compute service on its own headless device, separate from the canvas device. More...
#include <gpu_compute.h>
Public Member Functions | |
| ~GPU_COMPUTE () | |
| GPU_COMPUTE (const GPU_COMPUTE &)=delete | |
| GPU_COMPUTE & | operator= (const GPU_COMPUTE &)=delete |
| const RHI_COMPUTE_DEVICE_LIMITS & | DeviceLimits () const |
| RHI_COMPUTE_PIPELINE_LIMITS | PipelineLimits (RHI_ComputePipelineHandle aPipeline) |
| RHI_BufferHandle | CreateStorageBuffer (size_t aBytes) |
| RHI_ComputePipelineHandle | CreatePipeline (const RHI_COMPUTE_PIPELINE_DESC &aDesc) |
| RHI_BindGroupLayoutHandle | CreateBindGroupLayout (const RHI_BIND_GROUP_LAYOUT_DESC &aDesc) |
| RHI_BindGroupHandle | CreateBindGroup (const RHI_BIND_GROUP_DESC &aDesc) |
| void | DestroyBuffer (RHI_BufferHandle aBuffer) |
| void | DestroyPipeline (RHI_ComputePipelineHandle aPipeline) |
| void | DestroyBindGroupLayout (RHI_BindGroupLayoutHandle aLayout) |
| void | DestroyBindGroup (RHI_BindGroupHandle aGroup) |
| RHI_COMPUTE_RESULT | Submit (const RHI_COMPUTE_JOB &aJob) |
| Run the whole job and copy its readbacks before returning. | |
Static Public Member Functions | |
| static std::shared_ptr< GPU_COMPUTE > | Get () |
| Return nullptr if compute is unavailable; replace a lost instance on the next call. | |
Private Member Functions | |
| GPU_COMPUTE (std::unique_ptr< RHI_DEVICE > aDevice) | |
| template<typename F> | |
| void | destroy (F aDestroy) |
| Destroy under the lock, then retire the release at once since no job can still be using it. | |
Private Attributes | |
| std::mutex | m_mutex |
| std::unique_ptr< RHI_DEVICE > | m_device |
| RHI_COMPUTE_DEVICE_LIMITS | m_limits |
| std::atomic< bool > | m_lost { false } |
Process-wide compute service on its own headless device, separate from the canvas device.
Calls are serialised and block until done, so run long jobs from a worker thread.
Definition at line 33 of file gpu_compute.h.
|
default |
|
delete |
References GPU_COMPUTE().
Referenced by Get(), GPU_COMPUTE(), and operator=().
|
explicitprivate |
Definition at line 25 of file gpu_compute.cpp.
| RHI_BindGroupHandle GPU_COMPUTE::CreateBindGroup | ( | const RHI_BIND_GROUP_DESC & | aDesc | ) |
Definition at line 98 of file gpu_compute.cpp.
| RHI_BindGroupLayoutHandle GPU_COMPUTE::CreateBindGroupLayout | ( | const RHI_BIND_GROUP_LAYOUT_DESC & | aDesc | ) |
Definition at line 88 of file gpu_compute.cpp.
References m_device, m_mutex, and RhiValidateComputeBindGroupLayout().
| RHI_ComputePipelineHandle GPU_COMPUTE::CreatePipeline | ( | const RHI_COMPUTE_PIPELINE_DESC & | aDesc | ) |
Definition at line 81 of file gpu_compute.cpp.
| RHI_BufferHandle GPU_COMPUTE::CreateStorageBuffer | ( | size_t | aBytes | ) |
Destroy under the lock, then retire the release at once since no job can still be using it.
Definition at line 106 of file gpu_compute.cpp.
References F, m_device, m_mutex, and RHI_FRAMES_IN_FLIGHT.
Referenced by DestroyBindGroup(), DestroyBindGroupLayout(), DestroyBuffer(), and DestroyPipeline().
| void GPU_COMPUTE::DestroyBindGroup | ( | RHI_BindGroupHandle | aGroup | ) |
Definition at line 147 of file gpu_compute.cpp.
| void GPU_COMPUTE::DestroyBindGroupLayout | ( | RHI_BindGroupLayoutHandle | aLayout | ) |
Definition at line 137 of file gpu_compute.cpp.
| void GPU_COMPUTE::DestroyBuffer | ( | RHI_BufferHandle | aBuffer | ) |
Definition at line 117 of file gpu_compute.cpp.
| void GPU_COMPUTE::DestroyPipeline | ( | RHI_ComputePipelineHandle | aPipeline | ) |
Definition at line 127 of file gpu_compute.cpp.
|
inline |
Definition at line 43 of file gpu_compute.h.
References m_limits.
|
static |
Return nullptr if compute is unavailable; replace a lost instance on the next call.
Definition at line 35 of file gpu_compute.cpp.
References GPU_COMPUTE(), and RhiCreatePlatformDevice().
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and BOOST_AUTO_TEST_CASE().
|
delete |
References GPU_COMPUTE().
| RHI_COMPUTE_PIPELINE_LIMITS GPU_COMPUTE::PipelineLimits | ( | RHI_ComputePipelineHandle | aPipeline | ) |
Definition at line 64 of file gpu_compute.cpp.
| RHI_COMPUTE_RESULT GPU_COMPUTE::Submit | ( | const RHI_COMPUTE_JOB & | aJob | ) |
Run the whole job and copy its readbacks before returning.
A job can be submitted again.
Definition at line 157 of file gpu_compute.cpp.
References DEVICE_LOST, m_device, m_lost, m_mutex, and result.
|
private |
Definition at line 65 of file gpu_compute.h.
Referenced by CreateBindGroup(), CreateBindGroupLayout(), CreatePipeline(), CreateStorageBuffer(), destroy(), DestroyBindGroup(), DestroyBindGroupLayout(), DestroyBuffer(), DestroyPipeline(), GPU_COMPUTE(), PipelineLimits(), and Submit().
|
private |
Definition at line 66 of file gpu_compute.h.
Referenced by CreateStorageBuffer(), DeviceLimits(), and GPU_COMPUTE().
|
private |
Definition at line 67 of file gpu_compute.h.
Referenced by Submit().
|
private |
Definition at line 64 of file gpu_compute.h.
Referenced by CreateBindGroup(), CreateBindGroupLayout(), CreatePipeline(), CreateStorageBuffer(), destroy(), PipelineLimits(), and Submit().