ludus::graphics::rhi::HostedSurfaceConsumer¶
Ludus Wiki · API overview · Browse API
Class
- macOS: the images are IOSurfaces received as Mach send rights through the session's Mach rendezvous; the consumer creates its textures on the given
id<MTLDevice>. IOSurfaces work across GPUs, so there is no adapter check. - Linux: the images are Vulkan memory exported as opaque file descriptors (
VK_KHR_external_memory_fd). They import only when the game'sdeviceUUIDanddriverUUIDequal the consumer's; otherwise the consumer refuses with AdapterMismatch. The consumer device must have been created withVK_KHR_external_memory_fdenabled, on Vulkan 1.1 or later.
Declared in modules/graphics/rhi/include/ludus/graphics/rhi/hosted_surface.h
#include <ludus/graphics/rhi/hosted_surface.h>
class ludus::graphics::rhi::HostedSurfaceConsumer final
Methods¶
HostedSurfaceConsumer¶
ludus::graphics::rhi::HostedSurfaceConsumer::HostedSurfaceConsumer() noexcept
Declared in modules/graphics/rhi/include/ludus/graphics/rhi/hosted_surface.h
~HostedSurfaceConsumer¶
ludus::graphics::rhi::HostedSurfaceConsumer::~HostedSurfaceConsumer() noexcept
Declared in modules/graphics/rhi/include/ludus/graphics/rhi/hosted_surface.h
HostedSurfaceConsumer¶
ludus::graphics::rhi::HostedSurfaceConsumer::HostedSurfaceConsumer(const HostedSurfaceConsumer &)=delete
Declared in modules/graphics/rhi/include/ludus/graphics/rhi/hosted_surface.h
operator=¶
HostedSurfaceConsumer & ludus::graphics::rhi::HostedSurfaceConsumer::operator=(const HostedSurfaceConsumer &)=delete
Related types: HostedSurfaceConsumer
Declared in modules/graphics/rhi/include/ludus/graphics/rhi/hosted_surface.h
HostedSurfaceConsumer¶
ludus::graphics::rhi::HostedSurfaceConsumer::HostedSurfaceConsumer(HostedSurfaceConsumer &&)=delete
Declared in modules/graphics/rhi/include/ludus/graphics/rhi/hosted_surface.h
operator=¶
HostedSurfaceConsumer & ludus::graphics::rhi::HostedSurfaceConsumer::operator=(HostedSurfaceConsumer &&)=delete
Related types: HostedSurfaceConsumer
Declared in modules/graphics/rhi/include/ludus/graphics/rhi/hosted_surface.h
Start¶
HostedConsumerStatus ludus::graphics::rhi::HostedSurfaceConsumer::Start(platform::HostedWindowEndpoint &inoutEndpoint, const NativeDeviceIdentity &device) noexcept
endpoint. | Parameter | Description |
|---|---|
inoutEndpoint |
Started endpoint, borrowed until Stop(); the consumer takes its surface events and sends releases through it. The caller keeps pumping it.
|
device |
The consumer's device. Metal:
Api Metal and Device an id<MTLDevice>. Vulkan: Api Vulkan with Instance, PhysicalDevice, Device, CommandQueue and its QueueFamily; the instance must use Vulkan 1.1 or later. The consumer submits its queue family transfers and release fences to that queue. |
Returns
Related types: platform::HostedWindowEndpoint · HostedConsumerStatus · NativeDeviceIdentity
Declared in modules/graphics/rhi/include/ludus/graphics/rhi/hosted_surface.h
Stop¶
void ludus::graphics::rhi::HostedSurfaceConsumer::Stop() noexcept
Precondition
Declared in modules/graphics/rhi/include/ludus/graphics/rhi/hosted_surface.h
Pump¶
HostedConsumerStatus ludus::graphics::rhi::HostedSurfaceConsumer::Pump() noexcept
Returns
Related types: HostedConsumerStatus
Declared in modules/graphics/rhi/include/ludus/graphics/rhi/hosted_surface.h
HasFrame¶
bool ludus::graphics::rhi::HostedSurfaceConsumer::HasFrame() const noexcept
Declared in modules/graphics/rhi/include/ludus/graphics/rhi/hosted_surface.h
AcquireFrame¶
HostedConsumerStatus ludus::graphics::rhi::HostedSurfaceConsumer::AcquireFrame(HostedFrame &outFrame) noexcept
| Parameter | Description |
|---|---|
outFrame |
The frame; unchanged unless Ok.
|
Returns
Related types: HostedConsumerStatus · HostedFrame
Declared in modules/graphics/rhi/include/ludus/graphics/rhi/hosted_surface.h
ReleaseFrame¶
HostedConsumerStatus ludus::graphics::rhi::HostedSurfaceConsumer::ReleaseFrame(const HostedFrame &frame) noexcept
Precondition
| Parameter | Description |
|---|---|
frame |
A frame from AcquireFrame() that is still held.
|
Returns
Related types: HostedConsumerStatus · HostedFrame
Declared in modules/graphics/rhi/include/ludus/graphics/rhi/hosted_surface.h
ReleaseFrameAfterQueue¶
HostedConsumerStatus ludus::graphics::rhi::HostedSurfaceConsumer::ReleaseFrameAfterQueue(const HostedFrame &frame) noexcept
CommandQueue, behind the editor's sampling of the frame; a later Pump() returns the image to the game once the marker completes. Metal commits an empty command buffer. Vulkan submits the image's release to the external queue family with a fence, which signals once all work submitted to the queue before it has completed. Call it right after the sampling work was submitted, for example after Qt's afterFrameEnd, on the thread that submits to that queue. No CPU wait. | Parameter | Description |
|---|---|
frame |
A frame from AcquireFrame() that is still held and not already queued.
|
Returns
CommandQueue in the identity), in which case the frame stays held. Related types: HostedConsumerStatus · HostedFrame
Declared in modules/graphics/rhi/include/ludus/graphics/rhi/hosted_surface.h
GetQueuedReleaseCount¶
foundation::usize ludus::graphics::rhi::HostedSurfaceConsumer::GetQueuedReleaseCount() const noexcept
Related types: foundation::usize
Declared in modules/graphics/rhi/include/ludus/graphics/rhi/hosted_surface.h
GetRefusal¶
HostedConsumerRefusal ludus::graphics::rhi::HostedSurfaceConsumer::GetRefusal() const noexcept
Related types: HostedConsumerRefusal
Declared in modules/graphics/rhi/include/ludus/graphics/rhi/hosted_surface.h
GetImportedGenerationCount¶
foundation::usize ludus::graphics::rhi::HostedSurfaceConsumer::GetImportedGenerationCount() const noexcept
Related types: foundation::usize
Declared in modules/graphics/rhi/include/ludus/graphics/rhi/hosted_surface.h