Table of Contents

Class RenderSessionHandle

Namespace
Maplibre.NativeFfi.Render
Assembly
Maplibre.NativeFfi.dll

Owner-thread render session handle bound to a map.

public sealed class RenderSessionHandle : IDisposable
Inheritance
RenderSessionHandle
Implements
Inherited Members

Properties

IsClosed

public bool IsClosed { get; }

Property Value

bool

Methods

AcquireMetalOwnedTextureFrame()

public MetalOwnedTextureFrameHandle AcquireMetalOwnedTextureFrame()

Returns

MetalOwnedTextureFrameHandle

AcquireOpenGLOwnedTextureFrame()

public OpenGLOwnedTextureFrameHandle AcquireOpenGLOwnedTextureFrame()

Returns

OpenGLOwnedTextureFrameHandle

AcquireVulkanOwnedTextureFrame()

public VulkanOwnedTextureFrameHandle AcquireVulkanOwnedTextureFrame()

Returns

VulkanOwnedTextureFrameHandle

AttachMetalBorrowedTexture(MapHandle, MetalBorrowedTextureDescriptor)

public static RenderSessionHandle AttachMetalBorrowedTexture(MapHandle map, MetalBorrowedTextureDescriptor descriptor)

Parameters

map MapHandle
descriptor MetalBorrowedTextureDescriptor

Returns

RenderSessionHandle

AttachMetalOwnedTexture(MapHandle, MetalOwnedTextureDescriptor)

public static RenderSessionHandle AttachMetalOwnedTexture(MapHandle map, MetalOwnedTextureDescriptor descriptor)

Parameters

map MapHandle
descriptor MetalOwnedTextureDescriptor

Returns

RenderSessionHandle

AttachMetalSurface(MapHandle, MetalSurfaceDescriptor)

public static RenderSessionHandle AttachMetalSurface(MapHandle map, MetalSurfaceDescriptor descriptor)

Parameters

map MapHandle
descriptor MetalSurfaceDescriptor

Returns

RenderSessionHandle

AttachOpenGLBorrowedTexture(MapHandle, OpenGLBorrowedTextureDescriptor)

public static RenderSessionHandle AttachOpenGLBorrowedTexture(MapHandle map, OpenGLBorrowedTextureDescriptor descriptor)

Parameters

map MapHandle
descriptor OpenGLBorrowedTextureDescriptor

Returns

RenderSessionHandle

AttachOpenGLOwnedTexture(MapHandle, OpenGLOwnedTextureDescriptor)

public static RenderSessionHandle AttachOpenGLOwnedTexture(MapHandle map, OpenGLOwnedTextureDescriptor descriptor)

Parameters

map MapHandle
descriptor OpenGLOwnedTextureDescriptor

Returns

RenderSessionHandle

AttachOpenGLSurface(MapHandle, OpenGLSurfaceDescriptor)

public static RenderSessionHandle AttachOpenGLSurface(MapHandle map, OpenGLSurfaceDescriptor descriptor)

Parameters

map MapHandle
descriptor OpenGLSurfaceDescriptor

Returns

RenderSessionHandle

AttachVulkanBorrowedTexture(MapHandle, VulkanBorrowedTextureDescriptor)

public static RenderSessionHandle AttachVulkanBorrowedTexture(MapHandle map, VulkanBorrowedTextureDescriptor descriptor)

Parameters

map MapHandle
descriptor VulkanBorrowedTextureDescriptor

Returns

RenderSessionHandle

AttachVulkanOwnedTexture(MapHandle, VulkanOwnedTextureDescriptor)

public static RenderSessionHandle AttachVulkanOwnedTexture(MapHandle map, VulkanOwnedTextureDescriptor descriptor)

Parameters

map MapHandle
descriptor VulkanOwnedTextureDescriptor

Returns

RenderSessionHandle

AttachVulkanSurface(MapHandle, VulkanSurfaceDescriptor)

public static RenderSessionHandle AttachVulkanSurface(MapHandle map, VulkanSurfaceDescriptor descriptor)

Parameters

map MapHandle
descriptor VulkanSurfaceDescriptor

Returns

RenderSessionHandle

ClearData()

public void ClearData()

Close()

Destroys the render session on the map owner thread.

public void Close()

Detach()

public void Detach()

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public void Dispose()

DumpDebugLogs()

public void DumpDebugLogs()

GetFeatureState(FeatureStateSelector)

public byte[] GetFeatureState(FeatureStateSelector selector)

Parameters

selector FeatureStateSelector

Returns

byte[]

QueryFeatureExtension(string, byte[], string, string, byte[]?)

Queries a feature extension from the latest render session state.

public byte[] QueryFeatureExtension(string sourceId, byte[] feature, string extension, string extensionField, byte[]? arguments)

Parameters

sourceId string
feature byte[]
extension string
extensionField string
arguments byte[]

Returns

byte[]

QueryRenderedFeatures(RenderedQueryGeometry, RenderedFeatureQueryOptions?)

public QueriedFeature[] QueryRenderedFeatures(RenderedQueryGeometry geometry, RenderedFeatureQueryOptions? options)

Parameters

geometry RenderedQueryGeometry
options RenderedFeatureQueryOptions

Returns

QueriedFeature[]

QuerySourceFeatures(string, SourceFeatureQueryOptions?)

public QueriedFeature[] QuerySourceFeatures(string sourceId, SourceFeatureQueryOptions? options)

Parameters

sourceId string
options SourceFeatureQueryOptions

Returns

QueriedFeature[]

ReadPremultipliedRgba8(NativeBuffer)

public TextureImageInfo ReadPremultipliedRgba8(NativeBuffer buffer)

Parameters

buffer NativeBuffer

Returns

TextureImageInfo

ReduceMemoryUse()

public void ReduceMemoryUse()

RemoveFeatureState(FeatureStateSelector)

public void RemoveFeatureState(FeatureStateSelector selector)

Parameters

selector FeatureStateSelector

RenderUpdate()

Renders the latest available map render update into this session's render target. The map retains its latest update, so repeated calls re-render it and report Rendered again. Every other result names the wake to wait for: NoUpdate and SizePending resolve on a render-update-available event, and TargetNotReady resolves when the host changes the render target. The returned NeedsRepaint flag tells whether the map asked for another frame while it rendered this one.

public RenderUpdate RenderUpdate()

Returns

RenderUpdate

Resize(uint, uint, double)

Resizes this attached render session. Surface and owned-texture sessions resize in place; a borrowed texture target throws an unsupported-feature error, since its owner sizes it — hand over a new texture with the backend's set-target method instead. A resize keeps the session's renderer and renderer-held state such as feature state, unless the scale factor changes, which starts a new renderer with that state empty.

public void Resize(uint width, uint height, double scaleFactor)

Parameters

width uint
height uint
scaleFactor double

SetFeatureState(FeatureStateSelector, byte[])

public void SetFeatureState(FeatureStateSelector selector, byte[] value)

Parameters

selector FeatureStateSelector
value byte[]

SetMetalBorrowedTextureTarget(MetalBorrowedTextureDescriptor)

Renders this attached texture session into a new caller-owned texture, keeping the session's renderer unless the scale factor changes, which starts a new renderer. The replacement must belong to the device this session attached with, which throws an invalid-argument error otherwise, and carry the pixel format it attached with, which throws an unsupported-feature error otherwise; both leave this session rendering into the texture it has. The caller owns the replacement and keeps it valid until the next replacement, detach, or dispose. The outgoing texture is neither read nor released here.

public void SetMetalBorrowedTextureTarget(MetalBorrowedTextureDescriptor descriptor)

Parameters

descriptor MetalBorrowedTextureDescriptor

SetMetalSurfaceTarget(MetalSurfaceDescriptor)

Presents this attached surface session through a new surface, keeping the session's renderer and its cached state. The descriptor must name the same graphics context this session attached with; one whose context device is neither null nor this session's device throws an invalid-argument error and leaves this session rendering into the surface it has. The descriptor's extent applies as Resize(uint, uint, double) applies one.

public void SetMetalSurfaceTarget(MetalSurfaceDescriptor descriptor)

Parameters

descriptor MetalSurfaceDescriptor

SetOpenGLBorrowedTextureTarget(OpenGLBorrowedTextureDescriptor)

Renders this attached texture session into a new caller-owned texture. See SetMetalBorrowedTextureTarget(MetalBorrowedTextureDescriptor) for what replacing a target preserves. The replacement belongs to the context this session attached with, or one in its share group, and the host context must be current on this thread.

public void SetOpenGLBorrowedTextureTarget(OpenGLBorrowedTextureDescriptor descriptor)

Parameters

descriptor OpenGLBorrowedTextureDescriptor

SetOpenGLSurfaceTarget(OpenGLSurfaceDescriptor)

Presents this attached surface session through a new surface. See SetMetalSurfaceTarget(MetalSurfaceDescriptor) for what replacing a surface preserves. The new surface is made current on the next render, so a host may hand over a replacement for one it has already destroyed, and an unusable surface is reported by the next RenderUpdate().

public void SetOpenGLSurfaceTarget(OpenGLSurfaceDescriptor descriptor)

Parameters

descriptor OpenGLSurfaceDescriptor

SetVulkanBorrowedTextureTarget(VulkanBorrowedTextureDescriptor)

Renders this attached texture session into a new caller-owned image. See SetMetalBorrowedTextureTarget(MetalBorrowedTextureDescriptor) for what replacing a target preserves. The replacement must carry the format and both layouts this session attached with, since its render pass was built around them.

public void SetVulkanBorrowedTextureTarget(VulkanBorrowedTextureDescriptor descriptor)

Parameters

descriptor VulkanBorrowedTextureDescriptor

SetVulkanSurfaceTarget(VulkanSurfaceDescriptor)

Presents this attached surface session through a new surface. See SetMetalSurfaceTarget(MetalSurfaceDescriptor) for what replacing a surface preserves. The outgoing VkSurfaceKHR must still be valid, since this session holds a swapchain built from it. The replacement must report the color format and surface-transform support this session compiled a render pass and shaders for, or it throws an unsupported-feature error.

public void SetVulkanSurfaceTarget(VulkanSurfaceDescriptor descriptor)

Parameters

descriptor VulkanSurfaceDescriptor

TextureImageInfo()

public TextureImageInfo TextureImageInfo()

Returns

TextureImageInfo