Struct in ldk_renderer.h

LDKRendererTextureDesc

typedef struct LDKRendererTextureDesc{
  u32 width;
  u32 height;
  u32 channel_count;
  LDKRHIFormat format;
  u32 flags;
  void const *pixels;
  u64 byte_count;
  LDKRendererTextureOptions const *options;
}LDKRendererTextureDesc;
Enum in ldk_renderer.h

LDKRendererTextureFlag

typedef enum LDKRendererTextureFlag{
  LDK_RENDERER_TEXTURE_FLAG_NONE=0,
  LDK_RENDERER_TEXTURE_FLAG_SRGB=1<<0,
  LDK_RENDERER_TEXTURE_FLAG_RENDERABLE=1<<1
}LDKRendererTextureFlag;
Enum in ldk_renderer.h

LDKRendererWaterTexture

typedef enum LDKRendererWaterTexture{
  LDK_RENDERER_WATER_TEXTURE_NORMAL=0,
  LDK_RENDERER_WATER_TEXTURE_FOAM,
  LDK_RENDERER_WATER_TEXTURE_NOISE,
  LDK_RENDERER_WATER_TEXTURE_CAUSTICS,
  LDK_RENDERER_WATER_TEXTURE_COUNT
}LDKRendererWaterTexture;
Function in ldk_renderer.h

ldk_renderer_game_texture_get

Return the game render target color texture for UI rendering. The returned texture is owned by the renderer and remains valid until the game render target is recreated or the renderer is terminated.

LDK_API LDKUITextureHandle ldk_renderer_game_texture_get(LDKRenderer const *renderer);

Parameters

LDKRenderer const *renderer
Renderer instance.

Returns

Game color texture handle, or an invalid handle when unavailable.

Function in ldk_renderer.h

ldk_renderer_get_font_page_texture

Get or create the renderer texture for a font atlas page. The UI system renders text using font atlas pages generated by LDKFontInstance. This function returns a texture handle for the requested page, creating the underlying renderer/RHI texture on demand and caching it for later calls. The returned handle is intended for UI draw commands. It is owned by the renderer and must not be destroyed by the caller. Cached font page textures are released when the renderer is terminated.

LDK_API LDKUITextureHandle ldk_renderer_get_font_page_texture(
 LDKRenderer *renderer,
 LDKFontInstance *font,
 u32 page_index
);

Parameters

LDKRenderer *renderer
Renderer that owns the font page texture cache.
LDKFontInstance *font
Font instance that owns the requested atlas page.
u32 page_index
Index of the font atlas page.

Returns

UI texture handle for the atlas page, or an invalid handle on failure.

Function in ldk_renderer.h

ldk_renderer_get_font_page_texture_callback

Callback wrapper for ldk_renderer_get_font_page_texture(). This function matches the callback shape expected by the UI/font rendering code. The user pointer must be an LDKRenderer*.

LDK_API LDKUITextureHandle ldk_renderer_get_font_page_texture_callback(
 void *user,
 LDKFontInstance *font,
 u32 page_index
);

Parameters

void *user
Renderer pointer passed as opaque callback user data.
LDKFontInstance *font
Font instance that owns the requested atlas page.
u32 page_index
Index of the font atlas page.

Returns

UI texture handle for the atlas page, or an invalid handle on failure.

Function in ldk_renderer.h

ldk_renderer_texture_create

Create a renderer-owned texture resource. The renderer translates the high-level texture description into the appropriate RHI texture description, creates the underlying GPU texture, stores it in the renderer texture cache, and returns a renderer resource handle. The source pixel data is only needed during creation. After the texture is created, the returned resource does not depend on the original pixel buffer.

LDK_API LDKResourceTexture ldk_renderer_texture_create(
 LDKRenderer *renderer,
 LDKRendererTextureDesc const *desc
);

Parameters

LDKRenderer *renderer
Renderer that will own the texture resource.
LDKRendererTextureDesc const *desc
Texture creation description.

Returns

Texture resource handle, or an invalid handle on failure.

Function in ldk_renderer.h

ldk_renderer_texture_create_from_image

Create a renderer texture resource from an image with explicit options. Passing NULL for options uses ldk_renderer_texture_options_defaults().

LDK_API LDKResourceTexture ldk_renderer_texture_create_from_image(
 LDKRenderer *renderer,
 LDKImage const *image,
 LDKRendererTextureOptions const *options
);

Parameters

LDKRenderer *renderer
Renderer that will own the texture resource.
LDKImage const *image
Source CPU-side image.
LDKRendererTextureOptions const *options
Explicit texture sampling and mipmap options, or NULL.

Returns

Texture resource handle, or an invalid handle on failure.

Function in ldk_renderer.h

ldk_renderer_texture_destroy

Destroy a renderer-owned texture resource. The renderer resolves the texture handle, destroys the underlying RHI texture, and releases the renderer texture cache slot. Destroying an invalid or already-dead texture handle is a no-op. Texture resources are also destroyed automatically when the renderer is terminated.

LDK_API void ldk_renderer_texture_destroy(
 LDKRenderer *renderer,
 LDKResourceTexture texture
);

Parameters

LDKRenderer *renderer
Renderer that owns the texture resource.
LDKResourceTexture texture
Texture resource handle to destroy.
Function in ldk_renderer.h

ldk_renderer_texture_is_valid

Check whether a texture resource handle refers to a live renderer texture. The handle is validated against the renderer that owns the texture resource. A non-zero handle is not enough to prove validity; the resource must still exist in the renderer texture cache.

LDK_API bool ldk_renderer_texture_is_valid(
 LDKRenderer *renderer,
 LDKResourceTexture texture
);

Parameters

LDKRenderer *renderer
Renderer that owns the texture resource.
LDKResourceTexture texture
Texture resource handle to validate.

Returns

true if the texture is valid and alive, false otherwise.

Function in ldk_renderer.h

ldk_renderer_texture_null

Return an invalid texture resource handle. This is the renderer texture equivalent of a null handle. It can be used to initialize texture fields or to represent the absence of a texture.

LDK_API LDKResourceTexture ldk_renderer_texture_null(void);

Returns

Invalid texture resource handle.

Function in ldk_renderer.h

ldk_renderer_texture_options_defaults

Initialize renderer texture options with default values. Defaults preserve the renderer's existing texture behavior: nearest filtering, clamp-to-edge wrapping, and no generated mipmaps.

LDK_API void ldk_renderer_texture_options_defaults(LDKRendererTextureOptions *options);

Parameters

LDKRendererTextureOptions *options
Texture options to initialize.
Function in ldk_renderer.h

ldk_renderer_texture_ui_handle

Resolve a renderer texture resource to a UI draw texture handle. The returned handle is a frame-local draw token suitable for UI draw commands. The UI system must treat it as opaque and must not store it as a persistent engine resource. The renderer owns the original texture resource. If the resource is invalid or no longer alive, this function returns an invalid UI texture handle.

LDK_API LDKUITextureHandle ldk_renderer_texture_ui_handle(
 LDKRenderer *renderer,
 LDKResourceTexture texture
);

Parameters

LDKRenderer *renderer
Renderer that owns the texture resource.
LDKResourceTexture texture
Texture resource handle to resolve.

Returns

UI texture handle for draw commands, or an invalid handle on failure.

Function in ldk_renderer.h

ldk_renderer_texture_update

Update the pixel contents of an existing renderer texture resource. The texture handle is resolved through the renderer texture cache, then the underlying RHI texture is updated with the supplied pixel data. The texture dimensions, format, channel count, and flags are not changed by this call. The supplied byte count must match the expected data size for the existing texture.

LDK_API bool ldk_renderer_texture_update(
 LDKRenderer *renderer,
 LDKResourceTexture texture,
 void const *pixels,
 u64 byte_count
);

Parameters

LDKRenderer *renderer
Renderer that owns the texture resource.
LDKResourceTexture texture
Texture resource handle to update.
void const *pixels
New pixel data.
u64 byte_count
Size of the pixel data in bytes.

Returns

true if the texture was updated, false otherwise.

Function in ldk_renderer.h

ldk_renderer_view_texture_get

Return the color texture rendered for a submitted view. The view identifier is supplied by the caller when the view is submitted. The returned texture is owned by the renderer and remains valid until the view is removed, the game resolution changes, or the renderer terminates.

LDK_API LDKUITextureHandle ldk_renderer_view_texture_get(
 LDKRenderer const *renderer,
 LDKRendererViewId view_id
);

Parameters

LDKRenderer const *renderer
Renderer instance.
LDKRendererViewId view_id
Identifier of the submitted view.

Returns

View color texture handle, or an invalid handle when unavailable.

Function in ldk_renderer.h

ldk_renderer_view_texture_uv_get

Return the UV rectangle used to display renderer view textures. View textures are render targets and their storage origin may differ from ordinary image textures. Callers that display a view texture through the UI should use this rectangle instead of assuming a texture origin.

LDK_API LDKUIRect ldk_renderer_view_texture_uv_get(LDKRenderer const *renderer);

Parameters

LDKRenderer const *renderer
Renderer instance that owns the view texture.

Returns

Normalized UV rectangle for sampling a renderer view texture.