KiCad PCB EDA Suite
Loading...
Searching...
No Matches
rhi_handle.h File Reference
#include <cstdint>
#include <mutex>
#include <vector>

Go to the source code of this file.

Classes

struct  RHI_HANDLE< Tag >
 Opaque GPU resource handle, typed by a tag struct so handles of different kinds cannot be mixed. More...
 
struct  RHI_TAG_BUFFER
 
struct  RHI_TAG_TEXTURE
 
struct  RHI_TAG_SHADER
 
struct  RHI_TAG_PIPELINE
 
struct  RHI_TAG_COMPUTE_PIPELINE
 
struct  RHI_TAG_RENDER_PASS
 
struct  RHI_TAG_BIND_GROUP_LAYOUT
 
struct  RHI_TAG_BIND_GROUP
 
struct  RHI_TAG_SURFACE
 
struct  RHI_TAG_SWAPCHAIN
 
struct  RHI_TAG_FRAMEBUFFER
 
class  RHI_HANDLE_POOL< Tag >
 Thread-safe pool that allocates and recycles generation-tracked handles for device implementations. More...
 
struct  RHI_HANDLE_POOL< Tag >::Entry
 

Typedefs

using RHI_BufferHandle = RHI_HANDLE<RHI_TAG_BUFFER>
 
using RHI_TextureHandle = RHI_HANDLE<RHI_TAG_TEXTURE>
 
using RHI_ShaderHandle = RHI_HANDLE<RHI_TAG_SHADER>
 
using RHI_PipelineHandle = RHI_HANDLE<RHI_TAG_PIPELINE>
 
using RHI_ComputePipelineHandle = RHI_HANDLE<RHI_TAG_COMPUTE_PIPELINE>
 
using RHI_RenderPassHandle = RHI_HANDLE<RHI_TAG_RENDER_PASS>
 
using RHI_BindGroupLayoutHandle = RHI_HANDLE<RHI_TAG_BIND_GROUP_LAYOUT>
 
using RHI_BindGroupHandle = RHI_HANDLE<RHI_TAG_BIND_GROUP>
 
using RHI_SurfaceHandle = RHI_HANDLE<RHI_TAG_SURFACE>
 
using RHI_SwapchainHandle = RHI_HANDLE<RHI_TAG_SWAPCHAIN>
 
using RHI_FramebufferHandle = RHI_HANDLE<RHI_TAG_FRAMEBUFFER>
 

Functions

template<typename Tag>
uint32_t RhiHandleIndex (RHI_HANDLE< Tag > h)
 
template<typename Tag>
uint32_t RhiHandleGeneration (RHI_HANDLE< Tag > h)
 
template<typename Tag>
RHI_HANDLE< Tag > RhiMakeHandle (uint32_t index, uint32_t generation)
 
template<typename MAP, typename Tag>
void RhiReleasePooledResource (MAP &aMap, RHI_HANDLE_POOL< Tag > &aPool, uint32_t aHandleValue)
 Release a deferred handle whose only teardown is dropping its table entry and recycling the pool slot, as for a resource that holds no native object or one that reference counting frees.
 

Variables

constexpr uint32_t RHI_HANDLE_INDEX_BITS = 20
 
constexpr uint32_t RHI_HANDLE_GEN_BITS = 12
 
constexpr uint32_t RHI_HANDLE_INDEX_MASK = ( 1u << RHI_HANDLE_INDEX_BITS ) - 1
 
constexpr uint32_t RHI_HANDLE_GEN_MASK = ( 1u << RHI_HANDLE_GEN_BITS ) - 1
 

Typedef Documentation

◆ RHI_BindGroupHandle

Definition at line 90 of file rhi_handle.h.

◆ RHI_BindGroupLayoutHandle

◆ RHI_BufferHandle

Definition at line 83 of file rhi_handle.h.

◆ RHI_ComputePipelineHandle

◆ RHI_FramebufferHandle

Definition at line 93 of file rhi_handle.h.

◆ RHI_PipelineHandle

Definition at line 86 of file rhi_handle.h.

◆ RHI_RenderPassHandle

Definition at line 88 of file rhi_handle.h.

◆ RHI_ShaderHandle

Definition at line 85 of file rhi_handle.h.

◆ RHI_SurfaceHandle

Definition at line 91 of file rhi_handle.h.

◆ RHI_SwapchainHandle

Definition at line 92 of file rhi_handle.h.

◆ RHI_TextureHandle

Definition at line 84 of file rhi_handle.h.

Function Documentation

◆ RhiHandleGeneration()

template<typename Tag>
uint32_t RhiHandleGeneration ( RHI_HANDLE< Tag > h)

◆ RhiHandleIndex()

template<typename Tag>
uint32_t RhiHandleIndex ( RHI_HANDLE< Tag > h)

Definition at line 50 of file rhi_handle.h.

References RHI_HANDLE_INDEX_MASK, and RHI_HANDLE< Tag >::value.

Referenced by RHI_VULKAN_DEVICE::BeginRenderPass(), RHI_VULKAN_DEVICE::BindGroup(), RHI_VULKAN_DEVICE::BindIndexBuffer(), RHI_VULKAN_DEVICE::BindPipeline(), RHI_VULKAN_DEVICE::BindVertexBuffer(), RHI_VULKAN_DEVICE::ComputePipelineLimits(), RHI_VULKAN_DEVICE::CopyFramebufferDepth(), RHI_VULKAN_DEVICE::CreateBindGroup(), RHI_VULKAN_DEVICE::CreateBindGroupLayout(), RHI_VULKAN_DEVICE::CreateComputePipeline(), RHI_VULKAN_DEVICE::CreateFramebuffer(), RHI_VULKAN_DEVICE::CreatePipeline(), RHI_VULKAN_DEVICE::CreateRenderPass(), RHI_VULKAN_DEVICE::CreateShader(), RHI_VULKAN_DEVICE::CreateSurface(), RHI_VULKAN_DEVICE::CreateSwapchain(), RHI_VULKAN_DEVICE::DestroyComputePipeline(), RHI_VULKAN_DEVICE::DestroySurface(), RHI_VULKAN_DEVICE::DestroySwapchain(), RHI_VULKAN_DEVICE::ExecuteCompute(), RHI_VULKAN_DEVICE::ExecuteDeferredRelease(), RHI_HANDLE_POOL< Tag >::findLive(), RHI_VULKAN_DEVICE::GetFramebufferColorTexture(), RHI_VULKAN_DEVICE::PollSurfaceExtent(), RHI_VULKAN_DEVICE::Present(), RHI_VULKAN_DEVICE::PresentReplacesQueued(), RHI_VULKAN_DEVICE::PresentWaitsForDisplay(), RHI_VULKAN_DEVICE::ReadbackFramebufferPixels(), RHI_VULKAN_DEVICE::RealizeBuffer(), RHI_VULKAN_DEVICE::RealizeTexture(), RHI_HANDLE_POOL< Tag >::Release(), RHI_VULKAN_DEVICE::ResizeSwapchain(), RHI_VULKAN_DEVICE::SetPushConstants(), RHI_VULKAN_DEVICE::UpdateBuffer(), RHI_VULKAN_DEVICE::UploadTexture(), and RHI_VULKAN_DEVICE::WaitForPresentSlot().

◆ RhiMakeHandle()

template<typename Tag>
RHI_HANDLE< Tag > RhiMakeHandle ( uint32_t index,
uint32_t generation )

◆ RhiReleasePooledResource()

template<typename MAP, typename Tag>
void RhiReleasePooledResource ( MAP & aMap,
RHI_HANDLE_POOL< Tag > & aPool,
uint32_t aHandleValue )

Release a deferred handle whose only teardown is dropping its table entry and recycling the pool slot, as for a resource that holds no native object or one that reference counting frees.

Definition at line 222 of file rhi_handle.h.

References RHI_HANDLE_POOL< Tag >::Release(), and RHI_HANDLE_INDEX_MASK.

Variable Documentation

◆ RHI_HANDLE_GEN_BITS

uint32_t RHI_HANDLE_GEN_BITS = 12
constexpr

Definition at line 44 of file rhi_handle.h.

◆ RHI_HANDLE_GEN_MASK

uint32_t RHI_HANDLE_GEN_MASK = ( 1u << RHI_HANDLE_GEN_BITS ) - 1
constexpr

◆ RHI_HANDLE_INDEX_BITS

uint32_t RHI_HANDLE_INDEX_BITS = 20
constexpr

Definition at line 43 of file rhi_handle.h.

Referenced by RhiHandleGeneration(), and RhiMakeHandle().

◆ RHI_HANDLE_INDEX_MASK

uint32_t RHI_HANDLE_INDEX_MASK = ( 1u << RHI_HANDLE_INDEX_BITS ) - 1
constexpr