KiCad PCB EDA Suite
Loading...
Searching...
No Matches
KIGFX::RHI_DEVICE_PROXY Class Reference

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
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ RHI_DEVICE_PROXY() [1/2]

KIGFX::RHI_DEVICE_PROXY::RHI_DEVICE_PROXY ( RENDER_THREAD & aRenderThread)
inlineexplicit

Definition at line 44 of file rhi_device_proxy.h.

References m_renderThread.

Referenced by operator=(), and RHI_DEVICE_PROXY().

◆ RHI_DEVICE_PROXY() [2/2]

KIGFX::RHI_DEVICE_PROXY::RHI_DEVICE_PROXY ( const RHI_DEVICE_PROXY & )
delete

References RHI_DEVICE_PROXY().

Member Function Documentation

◆ CreateBuffer()

RHI_BufferHandle RHI_DEVICE_PROXY::CreateBuffer ( const RHI_BUFFER_DESC & aDesc)
Returns
the reserved handle, or a null handle if the pool is exhausted or there is no device.

Definition at line 30 of file rhi_device_proxy.cpp.

References RHI_BUFFER_CREATE::desc, RHI_BUFFER_CREATE::handle, and m_renderThread.

◆ CreateTexture()

RHI_TextureHandle RHI_DEVICE_PROXY::CreateTexture ( const RHI_TEXTURE_DESC & aDesc)

◆ DestroyBuffer()

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.

◆ DestroyTexture()

void RHI_DEVICE_PROXY::DestroyTexture ( RHI_TextureHandle aHandle)

Definition at line 93 of file rhi_device_proxy.cpp.

References m_renderThread.

◆ GetBackend()

RHI_BACKEND RHI_DEVICE_PROXY::GetBackend ( ) const

Definition at line 100 of file rhi_device_proxy.cpp.

References m_renderThread.

◆ IsInitialized()

bool RHI_DEVICE_PROXY::IsInitialized ( ) const
Returns
true if the render thread is running with a device.

Definition at line 112 of file rhi_device_proxy.cpp.

References m_renderThread.

◆ MaxTextureSize()

uint32_t RHI_DEVICE_PROXY::MaxTextureSize ( ) const
Returns
the largest texture dimension the device supports, or 0 without a device.

Definition at line 106 of file rhi_device_proxy.cpp.

References m_renderThread.

◆ operator=()

RHI_DEVICE_PROXY & KIGFX::RHI_DEVICE_PROXY::operator= ( const RHI_DEVICE_PROXY & )
delete

References RHI_DEVICE_PROXY().

◆ UpdateBuffer()

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.

◆ UploadTexture()

void RHI_DEVICE_PROXY::UploadTexture ( RHI_TextureHandle aHandle,
const void * aData,
size_t aSize )

Member Data Documentation

◆ m_renderThread


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