|
KiCad PCB EDA Suite
|
UI-thread access to GPU resources without touching the device, which only the render thread may mutate. More...
#include <rhi_device_proxy.h>
Public Member Functions | |
| RHI_DEVICE_PROXY (RENDER_THREAD &aRenderThread) | |
| RHI_DEVICE_PROXY (const RHI_DEVICE_PROXY &)=delete | |
| RHI_DEVICE_PROXY & | operator= (const RHI_DEVICE_PROXY &)=delete |
| RHI_BufferHandle | CreateBuffer (const RHI_BUFFER_DESC &aDesc) |
| RHI_TextureHandle | CreateTexture (const RHI_TEXTURE_DESC &aDesc) |
| void | UpdateBuffer (RHI_BufferHandle aHandle, const void *aData, size_t aSize) |
| The data is copied, so the caller may reuse it immediately. | |
| void | UploadTexture (RHI_TextureHandle aHandle, const void *aData, size_t aSize) |
| void | DestroyBuffer (RHI_BufferHandle aHandle) |
| Queued behind the handle's create and uploads. | |
| void | DestroyTexture (RHI_TextureHandle aHandle) |
| RHI_BACKEND | GetBackend () const |
| uint32_t | MaxTextureSize () const |
| bool | IsInitialized () const |
Private Attributes | |
| RENDER_THREAD & | m_renderThread |
UI-thread access to GPU resources without touching the device, which only the render thread may mutate.
Handles are reserved immediately from the thread-safe pool and the real work is queued to the render thread. Queue order guarantees a resource exists before the same frame's uploads or draws use it. Nothing here exposes a device pointer, so UI code cannot race the render thread on the device maps.
Definition at line 41 of file rhi_device_proxy.h.
|
inlineexplicit |
Definition at line 44 of file rhi_device_proxy.h.
References m_renderThread.
Referenced by operator=(), and RHI_DEVICE_PROXY().
|
delete |
References RHI_DEVICE_PROXY().
| RHI_BufferHandle RHI_DEVICE_PROXY::CreateBuffer | ( | const RHI_BUFFER_DESC & | aDesc | ) |
Definition at line 30 of file rhi_device_proxy.cpp.
References RHI_BUFFER_CREATE::desc, RHI_BUFFER_CREATE::handle, and m_renderThread.
| RHI_TextureHandle RHI_DEVICE_PROXY::CreateTexture | ( | const RHI_TEXTURE_DESC & | aDesc | ) |
Definition at line 46 of file rhi_device_proxy.cpp.
References RHI_TEXTURE_CREATE::desc, RHI_TEXTURE_CREATE::handle, and m_renderThread.
| void RHI_DEVICE_PROXY::DestroyBuffer | ( | RHI_BufferHandle | aHandle | ) |
Queued behind the handle's create and uploads.
The GPU resource is freed once no in-flight frame can still use it.
Definition at line 86 of file rhi_device_proxy.cpp.
References m_renderThread.
| void RHI_DEVICE_PROXY::DestroyTexture | ( | RHI_TextureHandle | aHandle | ) |
Definition at line 93 of file rhi_device_proxy.cpp.
References m_renderThread.
| RHI_BACKEND RHI_DEVICE_PROXY::GetBackend | ( | ) | const |
Definition at line 100 of file rhi_device_proxy.cpp.
References m_renderThread.
| bool RHI_DEVICE_PROXY::IsInitialized | ( | ) | const |
Definition at line 112 of file rhi_device_proxy.cpp.
References m_renderThread.
| uint32_t RHI_DEVICE_PROXY::MaxTextureSize | ( | ) | const |
Definition at line 106 of file rhi_device_proxy.cpp.
References m_renderThread.
|
delete |
References RHI_DEVICE_PROXY().
| void RHI_DEVICE_PROXY::UpdateBuffer | ( | RHI_BufferHandle | aHandle, |
| const void * | aData, | ||
| size_t | aSize ) |
The data is copied, so the caller may reuse it immediately.
The buffer must have been created through this proxy in the same or an earlier frame.
Definition at line 62 of file rhi_device_proxy.cpp.
References m_renderThread, RhiUploadCopyStaging(), and RHI_GEOMETRY_UPLOAD::targetBuffer.
| void RHI_DEVICE_PROXY::UploadTexture | ( | RHI_TextureHandle | aHandle, |
| const void * | aData, | ||
| size_t | aSize ) |
Definition at line 74 of file rhi_device_proxy.cpp.
References m_renderThread, RhiUploadCopyStaging(), and RHI_TEXTURE_UPLOAD::targetTexture.
|
private |
Definition at line 84 of file rhi_device_proxy.h.
Referenced by CreateBuffer(), CreateTexture(), DestroyBuffer(), DestroyTexture(), GetBackend(), IsInitialized(), MaxTextureSize(), RHI_DEVICE_PROXY(), UpdateBuffer(), and UploadTexture().