LDKRHIResource
typedef uintptr_t LDKRHIResource;
Thin Render Hardware Interface used by the engine renderer.
The RHI is the backend-agnostic layer that owns GPU-like resources and draw commands. It knows nothing about engine systems, modules or anything else except buffers, textures, samplers, shaders, pipelines, bindings, passes, and draw calls.
Typical frame flow:
ldk_rhi_frame_begin(&rhi);
ldk_rhi_pass_begin(&rhi, &pass);
ldk_rhi_pipeline_bind(&rhi, pipeline);
ldk_rhi_bindings_bind(&rhi, bindings);
ldk_rhi_vertex_buffer_bind(&rhi, vertex_buffer, 0);
ldk_rhi_index_buffer_bind(&rhi, index_buffer, 0, LDK_RHI_INDEX_TYPE_UINT32);
ldk_rhi_draw_indexed(&rhi, &draw_desc);
ldk_rhi_pass_end(&rhi);
ldk_rhi_frame_end(&rhi);
The RHI is stateful during a pass. A draw call uses the currently bound pipeline, bindings, vertex buffers, and index buffer.
Common tasks:
LDKRHIBufferDesc vertex_buffer_desc;
ldk_rhi_buffer_desc_defaults(&vertex_buffer_desc);
vertex_buffer_desc.size = vertex_data_size;
vertex_buffer_desc.usage = LDK_RHI_BUFFER_USAGE_VERTEX;
vertex_buffer_desc.memory_usage = LDK_RHI_MEMORY_USAGE_GPU;
vertex_buffer_desc.initial_data = vertex_data;
LDKRHIBuffer vertex_buffer = ldk_rhi_buffer_create(&rhi, &vertex_buffer_desc);
LDKRHIBufferDesc index_buffer_desc;
ldk_rhi_buffer_desc_defaults(&index_buffer_desc);
index_buffer_desc.size = index_data_size;
index_buffer_desc.usage = LDK_RHI_BUFFER_USAGE_INDEX;
index_buffer_desc.memory_usage = LDK_RHI_MEMORY_USAGE_GPU;
index_buffer_desc.initial_data = index_data;
LDKRHIBuffer index_buffer = ldk_rhi_buffer_create(&rhi, &index_buffer_desc);
LDKRHIBufferDesc uniform_buffer_desc;
ldk_rhi_buffer_desc_defaults(&uniform_buffer_desc);
uniform_buffer_desc.size = sizeof(MyUniformData);
uniform_buffer_desc.usage = LDK_RHI_BUFFER_USAGE_UNIFORM;
uniform_buffer_desc.memory_usage = LDK_RHI_MEMORY_USAGE_CPU_TO_GPU;
uniform_buffer_desc.initial_data = &uniform_data;
LDKRHIBuffer uniform_buffer = ldk_rhi_buffer_create(&rhi, &uniform_buffer_desc);
Uniform buffers can be updated later:
ldk_rhi_buffer_update(&rhi, uniform_buffer, 0, sizeof(MyUniformData), &uniform_data);
LDKRHITextureDesc texture_desc;
ldk_rhi_texture_desc_defaults(&texture_desc);
texture_desc.type = LDK_RHI_TEXTURE_TYPE_2D;
texture_desc.format = LDK_RHI_FORMAT_RGBA8_UNORM;
texture_desc.width = width;
texture_desc.height = height;
texture_desc.depth = 1;
texture_desc.mip_count = 1;
texture_desc.layer_count = 1;
texture_desc.usage = LDK_RHI_TEXTURE_USAGE_SAMPLED;
texture_desc.initial_data = pixels;
texture_desc.initial_data_size = pixel_data_size;
LDKRHITexture texture = ldk_rhi_texture_create(&rhi, &texture_desc);
LDKRHITextureDesc color_desc;
ldk_rhi_texture_desc_defaults(&color_desc);
color_desc.type = LDK_RHI_TEXTURE_TYPE_2D;
color_desc.format = LDK_RHI_FORMAT_RGBA8_UNORM;
color_desc.width = framebuffer_width;
color_desc.height = framebuffer_height;
color_desc.depth = 1;
color_desc.mip_count = 1;
color_desc.layer_count = 1;
color_desc.usage = LDK_RHI_TEXTURE_USAGE_RENDER_TARGET | LDK_RHI_TEXTURE_USAGE_SAMPLED;
LDKRHITexture color_target = ldk_rhi_texture_create(&rhi, &color_desc);
LDKRHITextureDesc depth_desc;
ldk_rhi_texture_desc_defaults(&depth_desc);
depth_desc.type = LDK_RHI_TEXTURE_TYPE_2D;
depth_desc.format = LDK_RHI_FORMAT_D32_FLOAT;
depth_desc.width = framebuffer_width;
depth_desc.height = framebuffer_height;
depth_desc.depth = 1;
depth_desc.mip_count = 1;
depth_desc.layer_count = 1;
depth_desc.usage = LDK_RHI_TEXTURE_USAGE_DEPTH_STENCIL;
LDKRHITexture depth_target = ldk_rhi_texture_create(&rhi, &depth_desc);
LDKRHIPassDesc pass;
ldk_rhi_pass_desc_defaults(&pass);
pass.color_attachment_count = 1;
pass.color_attachments[0].texture = LDK_RHI_INVALID_RESOURCE;
pass.color_attachments[0].load_op = LDK_RHI_LOAD_OP_CLEAR;
pass.color_attachments[0].store_op = LDK_RHI_STORE_OP_STORE;
pass.color_attachments[0].clear_color.r = 0.1f;
pass.color_attachments[0].clear_color.g = 0.1f;
pass.color_attachments[0].clear_color.b = 0.1f;
pass.color_attachments[0].clear_color.a = 1.0f;
pass.has_viewport = true;
pass.viewport.x = 0.0f;
pass.viewport.y = 0.0f;
pass.viewport.width = (float)framebuffer_width;
pass.viewport.height = (float)framebuffer_height;
pass.viewport.min_depth = 0.0f;
pass.viewport.max_depth = 1.0f;
ldk_rhi_pass_begin(&rhi, &pass);
LDKRHIPassDesc pass;
ldk_rhi_pass_desc_defaults(&pass);
pass.color_attachment_count = 1;
pass.color_attachments[0].texture = color_target;
pass.color_attachments[0].load_op = LDK_RHI_LOAD_OP_CLEAR;
pass.color_attachments[0].store_op = LDK_RHI_STORE_OP_STORE;
pass.color_attachments[0].clear_color.r = 0.0f;
pass.color_attachments[0].clear_color.g = 0.0f;
pass.color_attachments[0].clear_color.b = 0.0f;
pass.color_attachments[0].clear_color.a = 1.0f;
pass.depth_attachment.valid = true;
pass.depth_attachment.texture = depth_target;
pass.depth_attachment.depth_load_op = LDK_RHI_LOAD_OP_CLEAR;
pass.depth_attachment.depth_store_op = LDK_RHI_STORE_OP_STORE;
pass.depth_attachment.clear_depth = 1.0f;
pass.has_viewport = true;
pass.viewport.width = (float)framebuffer_width;
pass.viewport.height = (float)framebuffer_height;
pass.viewport.min_depth = 0.0f;
pass.viewport.max_depth = 1.0f;
ldk_rhi_pass_begin(&rhi, &pass);
LDKRHIBindingsLayoutDesc layout_desc;
ldk_rhi_bindings_layout_desc_defaults(&layout_desc);
layout_desc.entry_count = 2;
layout_desc.entries[0].slot = 0;
layout_desc.entries[0].type = LDK_RHI_BINDING_TYPE_UNIFORM_BUFFER;
layout_desc.entries[0].stages = LDK_RHI_SHADER_STAGE_VERTEX;
layout_desc.entries[1].slot = 1;
layout_desc.entries[1].type = LDK_RHI_BINDING_TYPE_TEXTURE_SAMPLER;
layout_desc.entries[1].stages = LDK_RHI_SHADER_STAGE_FRAGMENT;
LDKRHIBindingsLayout bindings_layout = ldk_rhi_bindings_layout_create(&rhi, &layout_desc);
LDKRHIBindingsDesc bindings_desc;
ldk_rhi_bindings_desc_defaults(&bindings_desc);
bindings_desc.layout = bindings_layout;
bindings_desc.binding_count = 2;
bindings_desc.bindings[0].slot = 0;
bindings_desc.bindings[0].buffer = uniform_buffer;
bindings_desc.bindings[0].buffer_offset = 0;
bindings_desc.bindings[0].buffer_size = sizeof(MyUniformData);
bindings_desc.bindings[1].slot = 1;
bindings_desc.bindings[1].texture = texture;
bindings_desc.bindings[1].sampler = sampler;
LDKRHIBindings bindings = ldk_rhi_bindings_create(&rhi, &bindings_desc);
LDKRHIPipelineDesc pipeline_desc;
ldk_rhi_pipeline_desc_defaults(&pipeline_desc);
pipeline_desc.vertex_shader_module = vertex_shader;
pipeline_desc.fragment_shader_module = fragment_shader;
pipeline_desc.bindings_layout = bindings_layout;
pipeline_desc.topology = LDK_RHI_PRIMITIVE_TOPOLOGY_TRIANGLES;
pipeline_desc.color_attachment_count = 1;
pipeline_desc.color_formats[0] = LDK_RHI_FORMAT_RGBA8_UNORM;
pipeline_desc.depth_format = LDK_RHI_FORMAT_D32_FLOAT;
pipeline_desc.vertex_layout.stride = sizeof(MyVertex);
pipeline_desc.vertex_layout.attribute_count = 3;
pipeline_desc.vertex_layout.input_rate = LDK_RHI_VERTEX_INPUT_RATE_PER_VERTEX;
pipeline_desc.vertex_layout.attributes[0].location = 0;
pipeline_desc.vertex_layout.attributes[0].format = LDK_RHI_VERTEX_FORMAT_FLOAT3;
pipeline_desc.vertex_layout.attributes[0].offset = offsetof(MyVertex, position);
pipeline_desc.vertex_layout.attributes[1].location = 1;
pipeline_desc.vertex_layout.attributes[1].format = LDK_RHI_VERTEX_FORMAT_FLOAT3;
pipeline_desc.vertex_layout.attributes[1].offset = offsetof(MyVertex, normal);
pipeline_desc.vertex_layout.attributes[2].location = 2;
pipeline_desc.vertex_layout.attributes[2].format = LDK_RHI_VERTEX_FORMAT_FLOAT2;
pipeline_desc.vertex_layout.attributes[2].offset = offsetof(MyVertex, uv);
LDKRHIPipeline pipeline = ldk_rhi_pipeline_create(&rhi, &pipeline_desc);
ldk_rhi_pipeline_bind(&rhi, pipeline);
ldk_rhi_bindings_bind(&rhi, bindings);
ldk_rhi_vertex_buffer_bind(&rhi, vertex_buffer, 0);
LDKRHIDrawDesc draw_desc;
draw_desc.vertex_count = vertex_count;
draw_desc.first_vertex = 0;
ldk_rhi_draw(&rhi, &draw_desc);
ldk_rhi_pipeline_bind(&rhi, pipeline);
ldk_rhi_bindings_bind(&rhi, bindings);
ldk_rhi_vertex_buffer_bind(&rhi, vertex_buffer, 0);
ldk_rhi_index_buffer_bind(&rhi, index_buffer, 0, LDK_RHI_INDEX_TYPE_UINT32);
LDKRHIDrawIndexedDesc draw_desc;
draw_desc.index_count = index_count;
draw_desc.first_index = 0;
draw_desc.vertex_offset = 0;
ldk_rhi_draw_indexed(&rhi, &draw_desc);
ldk_rhi_pipeline_bind(&rhi, pipeline);
ldk_rhi_bindings_bind(&rhi, bindings);
ldk_rhi_vertex_buffer_bind_at(&rhi, 0, vertex_buffer, 0);
ldk_rhi_vertex_buffer_bind_at(&rhi, 1, instance_buffer, 0);
ldk_rhi_index_buffer_bind(&rhi, index_buffer, 0, LDK_RHI_INDEX_TYPE_UINT32);
LDKRHIDrawIndexedInstancedDesc draw_desc;
draw_desc.index_count = index_count;
draw_desc.instance_count = instance_count;
draw_desc.first_index = 0;
draw_desc.vertex_offset = 0;
draw_desc.first_instance = 0;
ldk_rhi_draw_indexed_instanced(&rhi, &draw_desc);
Instanced rendering usually uses multiple vertex buffer layouts in the pipeline: one layout with LDKRHIVERTEXINPUTRATEPERVERTEX and another layout with LDKRHIVERTEXINPUTRATEPERINSTANCE.
ldk_rhi_pass_end(&rhi);
ldk_rhi_frame_end(&rhi);
Binding slots have no semantic meaning inside the RHI. The renderer defines the ABI for built-in shaders. The RHI only sees slot, binding type, shader stages, and resource handles.
Texture swizzle can be used for single-channel font atlases. An R8 atlas that stores glyph coverage in the red channel can be sampled as white RGB with alpha from red by using swizzle { ONE, ONE, ONE, R }.
Because different rendering APIs give things different names, here is how this API calls things:
Attachments: Textures bound as outputs in a pass. Bindings Layout: Defines which resources a pipeline expects and in which slots. Bindings: Actual resources assigned to those slots. Blend State: How new pixels combine with existing ones. Buffers: Raw GPU memory used for vertex, index, or uniform data. Depth State: Controls depth testing and writing. Draw Call: Command that renders geometry using current state. Indexed Draw Call: Draw call that uses an index buffer to reuse vertices. Load/Store Ops: Control how attachments are treated before/after a pass. Pass: Defines where and how rendering happens. Pipeline: Preconfigured rendering state. Raster State: Controls culling and polygon rendering rules. Resources: GPU objects referenced by handles. Samplers: Define how textures are read. Scissor: Clipping region that discards pixels outside it. Shader Modules: Compiled shader code for a single stage. Textures: Image data used as shader input or render output. Topology: How vertices form primitives. Vertex Layout: Describes how vertex data is structured in a buffer. Viewport: Region of the render target used for drawing.
typedef uintptr_t LDKRHIResource;
typedef LDKRHIResource LDKRHIBuffer;
typedef LDKRHIResource LDKRHITexture;
typedef LDKRHIResource LDKRHISampler;
typedef LDKRHIResource LDKRHIShaderModule;
typedef LDKRHIResource LDKRHIBindingsLayout;
typedef LDKRHIResource LDKRHIPipeline;
typedef LDKRHIResource LDKRHIBindings;
#define LDK_RHI_INVALID_RESOURCE 0
typedef struct LDKRHIContext LDKRHIContext;
typedef enum LDKRHIBackendType{
LDK_RHI_BACKEND_NONE=0,
LDK_RHI_BACKEND_OPENGL33
}LDKRHIBackendType;
typedef enum LDKRHIBufferUsage{
LDK_RHI_BUFFER_USAGE_NONE=0,
LDK_RHI_BUFFER_USAGE_VERTEX=1<<0,
LDK_RHI_BUFFER_USAGE_INDEX=1<<1,
LDK_RHI_BUFFER_USAGE_UNIFORM=1<<2,
LDK_RHI_BUFFER_USAGE_STORAGE=1<<3,
LDK_RHI_BUFFER_USAGE_TRANSFER_SRC=1<<4,
LDK_RHI_BUFFER_USAGE_TRANSFER_DST=1<<5
}LDKRHIBufferUsage;
typedef enum LDKRHIMemoryUsage{
LDK_RHI_MEMORY_USAGE_GPU=0,
LDK_RHI_MEMORY_USAGE_CPU_TO_GPU,
LDK_RHI_MEMORY_USAGE_GPU_TO_CPU
}LDKRHIMemoryUsage;
Optional diagnostic classification for per-frame buffer upload statistics.
typedef enum LDKRHIBufferStatsClass{
LDK_RHI_BUFFER_STATS_AUTO=0,
LDK_RHI_BUFFER_STATS_UNIFORM,
LDK_RHI_BUFFER_STATS_VERTEX,
LDK_RHI_BUFFER_STATS_INDEX,
LDK_RHI_BUFFER_STATS_INSTANCE,
LDK_RHI_BUFFER_STATS_OTHER
}LDKRHIBufferStatsClass;
typedef enum LDKRHITextureType{
LDK_RHI_TEXTURE_TYPE_2D=0,
LDK_RHI_TEXTURE_TYPE_3D,
LDK_RHI_TEXTURE_TYPE_CUBE
}LDKRHITextureType;
typedef enum LDKRHITextureUsage{
LDK_RHI_TEXTURE_USAGE_NONE=0,
LDK_RHI_TEXTURE_USAGE_SAMPLED=1<<0,
LDK_RHI_TEXTURE_USAGE_RENDER_TARGET=1<<1,
LDK_RHI_TEXTURE_USAGE_DEPTH_STENCIL=1<<2,
LDK_RHI_TEXTURE_USAGE_STORAGE=1<<3,
LDK_RHI_TEXTURE_USAGE_TRANSFER_SRC=1<<4,
LDK_RHI_TEXTURE_USAGE_TRANSFER_DST=1<<5
}LDKRHITextureUsage;
typedef enum LDKRHIFormat{
LDK_RHI_FORMAT_INVALID=0,
LDK_RHI_FORMAT_R8_UNORM,
LDK_RHI_FORMAT_RG8_UNORM,
LDK_RHI_FORMAT_RGBA8_UNORM,
LDK_RHI_FORMAT_RGBA8_SRGB,
LDK_RHI_FORMAT_BGRA8_UNORM,
LDK_RHI_FORMAT_BGRA8_SRGB,
LDK_RHI_FORMAT_R16_UNORM,
LDK_RHI_FORMAT_RG16_UNORM,
LDK_RHI_FORMAT_RGBA16_UNORM,
LDK_RHI_FORMAT_R16_FLOAT,
LDK_RHI_FORMAT_RG16_FLOAT,
LDK_RHI_FORMAT_RGBA16_FLOAT,
LDK_RHI_FORMAT_R32_FLOAT,
LDK_RHI_FORMAT_RG32_FLOAT,
LDK_RHI_FORMAT_RGBA32_FLOAT,
LDK_RHI_FORMAT_D24S8,
LDK_RHI_FORMAT_D32_FLOAT
}LDKRHIFormat;
typedef enum LDKRHITextureSwizzle{
LDK_RHI_TEXTURE_SWIZZLE_IDENTITY=0,
LDK_RHI_TEXTURE_SWIZZLE_ZERO,
LDK_RHI_TEXTURE_SWIZZLE_ONE,
LDK_RHI_TEXTURE_SWIZZLE_R,
LDK_RHI_TEXTURE_SWIZZLE_G,
LDK_RHI_TEXTURE_SWIZZLE_B,
LDK_RHI_TEXTURE_SWIZZLE_A
}LDKRHITextureSwizzle;
typedef enum LDKRHIFilter{
LDK_RHI_FILTER_NEAREST=0,
LDK_RHI_FILTER_LINEAR,
LDK_RHI_FILTER_NONE
}LDKRHIFilter;
typedef enum LDKRHIWrap{
LDK_RHI_WRAP_REPEAT=0,
LDK_RHI_WRAP_CLAMP_TO_EDGE,
LDK_RHI_WRAP_MIRROR,
LDK_RHI_WRAP_MIRRORED_REPEAT=LDK_RHI_WRAP_MIRROR
}LDKRHIWrap;
typedef enum LDKRHIShaderStage{
LDK_RHI_SHADER_STAGE_NONE=0,
LDK_RHI_SHADER_STAGE_VERTEX=1<<0,
LDK_RHI_SHADER_STAGE_FRAGMENT=1<<1,
LDK_RHI_SHADER_STAGE_COMPUTE=1<<2
}LDKRHIShaderStage;
typedef enum LDKRHIShaderCodeFormat{
LDK_RHI_SHADER_CODE_FORMAT_GLSL=0,
LDK_RHI_SHADER_CODE_FORMAT_SPIRV,
LDK_RHI_SHADER_CODE_FORMAT_DXIL,
LDK_RHI_SHADER_CODE_FORMAT_MSL
}LDKRHIShaderCodeFormat;
typedef enum LDKRHIPrimitiveTopology{
LDK_RHI_PRIMITIVE_TOPOLOGY_TRIANGLES=0,
LDK_RHI_PRIMITIVE_TOPOLOGY_LINES
}LDKRHIPrimitiveTopology;
typedef enum LDKRHICullMode{
LDK_RHI_CULL_MODE_NONE=0,
LDK_RHI_CULL_MODE_FRONT,
LDK_RHI_CULL_MODE_BACK
}LDKRHICullMode;
typedef enum LDKRHIPolygonMode{
LDK_RHI_POLYGON_MODE_FILL=0,
LDK_RHI_POLYGON_MODE_LINE
}LDKRHIPolygonMode;
typedef enum LDKRHIFrontFace{
LDK_RHI_FRONT_FACE_CCW=0,
LDK_RHI_FRONT_FACE_CW
}LDKRHIFrontFace;
typedef enum LDKRHICompareOp{
LDK_RHI_COMPARE_OP_NEVER=0,
LDK_RHI_COMPARE_OP_LESS,
LDK_RHI_COMPARE_OP_LESS_EQUAL,
LDK_RHI_COMPARE_OP_EQUAL,
LDK_RHI_COMPARE_OP_GREATER,
LDK_RHI_COMPARE_OP_GREATER_EQUAL,
LDK_RHI_COMPARE_OP_NOT_EQUAL,
LDK_RHI_COMPARE_OP_ALWAYS
}LDKRHICompareOp;
typedef enum LDKRHIBlendFactor{
LDK_RHI_BLEND_FACTOR_ZERO=0,
LDK_RHI_BLEND_FACTOR_ONE,
LDK_RHI_BLEND_FACTOR_SRC_COLOR,
LDK_RHI_BLEND_FACTOR_ONE_MINUS_SRC_COLOR,
LDK_RHI_BLEND_FACTOR_DST_COLOR,
LDK_RHI_BLEND_FACTOR_ONE_MINUS_DST_COLOR,
LDK_RHI_BLEND_FACTOR_SRC_ALPHA,
LDK_RHI_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA,
LDK_RHI_BLEND_FACTOR_DST_ALPHA,
LDK_RHI_BLEND_FACTOR_ONE_MINUS_DST_ALPHA
}LDKRHIBlendFactor;
typedef enum LDKRHIBlendOp{
LDK_RHI_BLEND_OP_ADD=0,
LDK_RHI_BLEND_OP_SUBTRACT,
LDK_RHI_BLEND_OP_REVERSE_SUBTRACT
}LDKRHIBlendOp;
typedef enum LDKRHIColorWriteMask{
LDK_RHI_COLOR_WRITE_MASK_NONE=0,
LDK_RHI_COLOR_WRITE_MASK_R=1<<0,
LDK_RHI_COLOR_WRITE_MASK_G=1<<1,
LDK_RHI_COLOR_WRITE_MASK_B=1<<2,
LDK_RHI_COLOR_WRITE_MASK_A=1<<3,
LDK_RHI_COLOR_WRITE_MASK_ALL=LDK_RHI_COLOR_WRITE_MASK_R|LDK_RHI_COLOR_WRITE_MASK_G|LDK_RHI_COLOR_WRITE_MASK_B|LDK_RHI_COLOR_WRITE_MASK_A
}LDKRHIColorWriteMask;
typedef enum LDKRHIVertexFormat{
LDK_RHI_VERTEX_FORMAT_FLOAT=0,
LDK_RHI_VERTEX_FORMAT_FLOAT2,
LDK_RHI_VERTEX_FORMAT_FLOAT3,
LDK_RHI_VERTEX_FORMAT_FLOAT4,
LDK_RHI_VERTEX_FORMAT_UBYTE4_NORM
}LDKRHIVertexFormat;
typedef enum LDKRHIVertexInputRate{
LDK_RHI_VERTEX_INPUT_RATE_PER_VERTEX=0,
LDK_RHI_VERTEX_INPUT_RATE_PER_INSTANCE
}LDKRHIVertexInputRate;
typedef enum LDKRHIBindingType{
LDK_RHI_BINDING_TYPE_UNIFORM_BUFFER=0,
LDK_RHI_BINDING_TYPE_STORAGE_BUFFER,
LDK_RHI_BINDING_TYPE_TEXTURE,
LDK_RHI_BINDING_TYPE_SAMPLER,
LDK_RHI_BINDING_TYPE_TEXTURE_SAMPLER
}LDKRHIBindingType;
typedef enum LDKRHILoadOp{
LDK_RHI_LOAD_OP_LOAD=0,
LDK_RHI_LOAD_OP_CLEAR,
LDK_RHI_LOAD_OP_DONT_CARE
}LDKRHILoadOp;
typedef enum LDKRHIStoreOp{
LDK_RHI_STORE_OP_STORE=0,
LDK_RHI_STORE_OP_DONT_CARE
}LDKRHIStoreOp;
typedef enum LDKRHIIndexType{
LDK_RHI_INDEX_TYPE_UINT16=0,
LDK_RHI_INDEX_TYPE_UINT32
}LDKRHIIndexType;
typedef struct LDKRHIColor{
float r;
float g;
float b;
float a;
}LDKRHIColor;
typedef struct LDKRHIViewport{
float x;
float y;
float width;
float height;
float min_depth;
float max_depth;
}LDKRHIViewport;
typedef struct LDKRHIRect{
int32_t x;
int32_t y;
int32_t width;
int32_t height;
}LDKRHIRect;
typedef struct LDKRHIBufferDesc{
uint32_t size;
uint32_t usage;
LDKRHIMemoryUsage memory_usage;
const void *initial_data;
LDKRHIBufferStatsClass stats_class;
}LDKRHIBufferDesc;
typedef struct LDKRHITextureDesc{
LDKRHITextureType type;
LDKRHIFormat format;
uint32_t width;
uint32_t height;
uint32_t depth;
uint32_t mip_count;
uint32_t layer_count;
uint32_t usage;
const void *initial_data;
uint32_t initial_data_size;
LDKRHITextureSwizzle swizzle_r;
LDKRHITextureSwizzle swizzle_g;
LDKRHITextureSwizzle swizzle_b;
LDKRHITextureSwizzle swizzle_a;
}LDKRHITextureDesc;
typedef struct LDKRHISamplerDesc{
LDKRHIFilter min_filter;
LDKRHIFilter mag_filter;
LDKRHIFilter mip_filter;
LDKRHIWrap wrap_u;
LDKRHIWrap wrap_v;
LDKRHIWrap wrap_w;
}LDKRHISamplerDesc;
typedef struct LDKRHIShaderModuleDesc{
uint32_t stage;
LDKRHIShaderCodeFormat code_format;
const void *code;
uint32_t code_size;
const char *entry_point;
}LDKRHIShaderModuleDesc;
typedef struct LDKRHIBlendState{
bool enabled;
LDKRHIBlendFactor src_color_factor;
LDKRHIBlendFactor dst_color_factor;
LDKRHIBlendOp color_op;
LDKRHIBlendFactor src_alpha_factor;
LDKRHIBlendFactor dst_alpha_factor;
LDKRHIBlendOp alpha_op;
uint32_t color_write_mask;
}LDKRHIBlendState;
typedef struct LDKRHIDepthState{
bool test_enabled;
bool write_enabled;
LDKRHICompareOp compare_op;
}LDKRHIDepthState;
typedef struct LDKRHIRasterState{
LDKRHICullMode cull_mode;
LDKRHIPolygonMode polygon_mode;
LDKRHIFrontFace front_face;
bool scissor_enabled;
bool depth_bias_enabled;
float depth_bias_slope_factor;
float depth_bias_constant_factor;
}LDKRHIRasterState;
typedef struct LDKRHIVertexAttributeDesc{
uint32_t location;
LDKRHIVertexFormat format;
uint32_t offset;
}LDKRHIVertexAttributeDesc;
#define LDK_RHI_VERTEX_ATTRIBUTE_MAX 16
#define LDK_RHI_VERTEX_BUFFER_LAYOUT_MAX 8
#define LDK_RHI_COLOR_ATTACHMENT_MAX 8
#define LDK_RHI_BINDING_MAX 16
typedef struct LDKRHIVertexBufferLayoutDesc{
uint32_t stride;
uint32_t attribute_count;
LDKRHIVertexAttributeDesc attributes[LDK_RHI_VERTEX_ATTRIBUTE_MAX];
LDKRHIVertexInputRate input_rate;
}LDKRHIVertexBufferLayoutDesc;
typedef struct LDKRHIBindingLayoutEntry{
uint32_t slot;
LDKRHIBindingType type;
uint32_t stages;
}LDKRHIBindingLayoutEntry;
typedef struct LDKRHIBindingsLayoutDesc{
uint32_t entry_count;
LDKRHIBindingLayoutEntry entries[LDK_RHI_BINDING_MAX];
}LDKRHIBindingsLayoutDesc;
typedef struct LDKRHIPipelineDesc{
LDKRHIShaderModule vertex_shader_module;
LDKRHIShaderModule fragment_shader_module;
LDKRHIBindingsLayout bindings_layout;
LDKRHIPrimitiveTopology topology;
LDKRHIBlendState blend_state;
LDKRHIDepthState depth_state;
LDKRHIRasterState raster_state;
LDKRHIVertexBufferLayoutDesc vertex_layout;
uint32_t vertex_buffer_layout_count;
LDKRHIVertexBufferLayoutDesc vertex_buffer_layouts[LDK_RHI_VERTEX_BUFFER_LAYOUT_MAX];
uint32_t color_attachment_count;
LDKRHIFormat color_formats[LDK_RHI_COLOR_ATTACHMENT_MAX];
LDKRHIFormat depth_format;
}LDKRHIPipelineDesc;
typedef struct LDKRHIBindingDesc{
uint32_t slot;
LDKRHIBuffer buffer;
uint32_t buffer_offset;
uint32_t buffer_size;
LDKRHITexture texture;
LDKRHISampler sampler;
}LDKRHIBindingDesc;
typedef struct LDKRHIBindingsDesc{
LDKRHIBindingsLayout layout;
uint32_t binding_count;
LDKRHIBindingDesc bindings[LDK_RHI_BINDING_MAX];
}LDKRHIBindingsDesc;
typedef struct LDKRHIPassColorAttachmentDesc{
LDKRHITexture texture;
uint32_t mip_level;
uint32_t layer;
LDKRHILoadOp load_op;
LDKRHIStoreOp store_op;
LDKRHIColor clear_color;
}LDKRHIPassColorAttachmentDesc;
typedef struct LDKRHIPassDepthAttachmentDesc{
bool valid;
LDKRHITexture texture;
uint32_t mip_level;
uint32_t layer;
LDKRHILoadOp depth_load_op;
LDKRHIStoreOp depth_store_op;
float clear_depth;
uint32_t clear_stencil;
}LDKRHIPassDepthAttachmentDesc;
typedef struct LDKRHIPassDesc{
uint32_t color_attachment_count;
LDKRHIPassColorAttachmentDesc color_attachments[LDK_RHI_COLOR_ATTACHMENT_MAX];
LDKRHIPassDepthAttachmentDesc depth_attachment;
bool has_viewport;
LDKRHIViewport viewport;
bool has_scissor;
LDKRHIRect scissor;
}LDKRHIPassDesc;
typedef struct LDKRHIContextDesc{
LDKRHIBackendType backend_type;
void *backend_api;
void *backend_user_data;
}LDKRHIContextDesc;
typedef struct LDKRHIDrawIndexedDesc{
uint32_t index_count;
uint32_t first_index;
int32_t vertex_offset;
}LDKRHIDrawIndexedDesc;
typedef struct LDKRHIDrawIndexedInstancedDesc{
uint32_t index_count;
uint32_t instance_count;
uint32_t first_index;
int32_t vertex_offset;
uint32_t first_instance;
}LDKRHIDrawIndexedInstancedDesc;
typedef struct LDKRHIDrawDesc{
uint32_t vertex_count;
uint32_t first_vertex;
}LDKRHIDrawDesc;
Per-frame backend resource activity, useful for spotting resource churn.
typedef struct LDKRHIFrameStats{
uint32_t buffer_create_count;
uint32_t buffer_destroy_count;
uint32_t buffer_update_count;
uint64_t buffer_update_bytes;
uint32_t uniform_buffer_update_count;
uint64_t uniform_buffer_update_bytes;
uint32_t vertex_buffer_update_count;
uint64_t vertex_buffer_update_bytes;
uint32_t index_buffer_update_count;
uint64_t index_buffer_update_bytes;
uint32_t instance_buffer_update_count;
uint64_t instance_buffer_update_bytes;
uint32_t other_buffer_update_count;
uint64_t other_buffer_update_bytes;
uint32_t texture_create_count;
uint32_t texture_destroy_count;
uint32_t framebuffer_create_count;
uint32_t framebuffer_destroy_count;
}LDKRHIFrameStats;
typedef struct LDKRHIDrawInstancedDesc{
uint32_t vertex_count;
uint32_t instance_count;
uint32_t first_vertex;
uint32_t first_instance;
}LDKRHIDrawInstancedDesc;
typedef struct LDKRHIFunctions{
void(*shutdown)(void *backend_user_data);
LDKRHIBuffer(*buffer_create)(void *backend_user_data, const LDKRHIBufferDesc *desc);
void(*buffer_destroy)(void *backend_user_data, LDKRHIBuffer buffer);
bool(*buffer_update)(void *backend_user_data, LDKRHIBuffer buffer, uint32_t offset, uint32_t size, const void *data);
LDKRHITexture(*texture_create)(void *backend_user_data, const LDKRHITextureDesc *desc);
void(*texture_destroy)(void *backend_user_data, LDKRHITexture texture);
bool(*texture_update)(void *backend_user_data, LDKRHITexture texture, uint32_t mip_level, uint32_t layer, const void *data, uint32_t size);
LDKRHISampler(*create_sampler)(void *backend_user_data, const LDKRHISamplerDesc *desc);
void(*destroy_sampler)(void *backend_user_data, LDKRHISampler sampler);
LDKRHIShaderModule(*shader_module_create)(void *backend_user_data, const LDKRHIShaderModuleDesc *desc);
void(*shader_module_destroy)(void *backend_user_data, LDKRHIShaderModule shader_module);
LDKRHIBindingsLayout(*bindings_layout_create)(void *backend_user_data, const LDKRHIBindingsLayoutDesc *desc);
void(*bindings_layout_destroy)(void *backend_user_data, LDKRHIBindingsLayout bindings_layout);
LDKRHIPipeline(*pipeline_create)(void *backend_user_data, const LDKRHIPipelineDesc *desc);
void(*pipeline_destroy)(void *backend_user_data, LDKRHIPipeline pipeline);
LDKRHIBindings(*bindings_create)(void *backend_user_data, const LDKRHIBindingsDesc *desc);
void(*bindings_destroy)(void *backend_user_data, LDKRHIBindings bindings);
void(*frame_begin)(void *backend_user_data);
void(*frame_end)(void *backend_user_data);
LDKRHIFrameStats(*frame_stats_get)(void *backend_user_data);
void(*pass_begin)(void *backend_user_data, const LDKRHIPassDesc *desc);
void(*pass_end)(void *backend_user_data);
void(*pipeline_bind)(void *backend_user_data, LDKRHIPipeline pipeline);
void(*bindings_bind)(void *backend_user_data, LDKRHIBindings bindings);
void(*vertex_buffer_bind)(void *backend_user_data, LDKRHIBuffer buffer, uint32_t offset);
void(*vertex_buffer_bind_at)(void *backend_user_data, uint32_t slot, LDKRHIBuffer buffer, uint32_t offset);
void(*index_buffer_bind)(void *backend_user_data, LDKRHIBuffer buffer, uint32_t offset, LDKRHIIndexType index_type);
void(*viewport_set)(void *backend_user_data, const LDKRHIViewport *viewport);
void(*scissor_set)(void *backend_user_data, const LDKRHIRect *scissor);
void(*line_width_set)(void *backend_user_data, float line_width);
void(*draw)(void *backend_user_data, const LDKRHIDrawDesc *desc);
void(*draw_instanced)(void *backend_user_data, const LDKRHIDrawInstancedDesc *desc);
void(*draw_indexed)(void *backend_user_data, const LDKRHIDrawIndexedDesc *desc);
void(*draw_indexed_instanced)(void *backend_user_data, const LDKRHIDrawIndexedInstancedDesc *desc);
}LDKRHIFunctions;
Initializes a buffer descriptor with default values.
LDK_API void ldk_rhi_buffer_desc_defaults(LDKRHIBufferDesc *desc);
LDKRHIBufferDesc *descInitializes a texture descriptor with default values.
LDK_API void ldk_rhi_texture_desc_defaults(LDKRHITextureDesc *desc);
LDKRHITextureDesc *descInitializes a sampler descriptor with default values.
LDK_API void ldk_rhi_sampler_desc_defaults(LDKRHISamplerDesc *desc);
LDKRHISamplerDesc *descInitializes a shader module descriptor with default values.
LDK_API void ldk_rhi_shader_module_desc_defaults(LDKRHIShaderModuleDesc *desc);
LDKRHIShaderModuleDesc *descInitializes a blend state with default values.
LDK_API void ldk_rhi_blend_state_defaults(LDKRHIBlendState *state);
LDKRHIBlendState *stateInitializes a depth state with default values.
LDK_API void ldk_rhi_depth_state_defaults(LDKRHIDepthState *state);
LDKRHIDepthState *stateInitializes a raster state with default values.
LDK_API void ldk_rhi_raster_state_defaults(LDKRHIRasterState *state);
LDKRHIRasterState *stateInitializes a pipeline descriptor with default values.
LDK_API void ldk_rhi_pipeline_desc_defaults(LDKRHIPipelineDesc *desc);
LDKRHIPipelineDesc *descInitializes a bindings layout descriptor with default values.
LDK_API void ldk_rhi_bindings_layout_desc_defaults(LDKRHIBindingsLayoutDesc *desc);
LDKRHIBindingsLayoutDesc *descInitializes a bindings descriptor with default values.
LDK_API void ldk_rhi_bindings_desc_defaults(LDKRHIBindingsDesc *desc);
LDKRHIBindingsDesc *descInitializes a pass descriptor with default values.
LDK_API void ldk_rhi_pass_desc_defaults(LDKRHIPassDesc *desc);
LDKRHIPassDesc *descInitializes the RHI context.
LDK_API bool ldk_rhi_initialize(
LDKRHIContext *context,
const LDKRHIContextDesc *desc,
const LDKRHIFunctions *functions
);
LDKRHIContext *contextconst LDKRHIContextDesc *descconst LDKRHIFunctions *functionstrue if initialization succeeded, false otherwise.
Terminates the RHI context.
LDK_API void ldk_rhi_terminate(LDKRHIContext *context);
LDKRHIContext *contextChecks if a buffer handle is valid.
LDK_API bool ldk_rhi_is_valid_buffer(LDKRHIBuffer buffer);
LDKRHIBuffer buffertrue if valid, false otherwise.
Checks if a texture handle is valid.
LDK_API bool ldk_rhi_is_valid_texture(LDKRHITexture texture);
LDKRHITexture texturetrue if valid, false otherwise.
Checks if a sampler handle is valid.
LDK_API bool ldk_rhi_is_valid_sampler(LDKRHISampler sampler);
LDKRHISampler samplertrue if valid, false otherwise.
Checks if a shader module handle is valid.
LDK_API bool ldk_rhi_is_valid_shader_module(LDKRHIShaderModule shader_module);
LDKRHIShaderModule shader_moduletrue if valid, false otherwise.
Checks if a bindings layout handle is valid.
LDK_API bool ldk_rhi_is_valid_bindings_layout(LDKRHIBindingsLayout bindings_layout);
LDKRHIBindingsLayout bindings_layouttrue if valid, false otherwise.
Checks if a pipeline handle is valid.
LDK_API bool ldk_rhi_is_valid_pipeline(LDKRHIPipeline pipeline);
LDKRHIPipeline pipelinetrue if valid, false otherwise.
Checks if a bindings handle is valid.
LDK_API bool ldk_rhi_is_valid_bindings(LDKRHIBindings bindings);
LDKRHIBindings bindingstrue if valid, false otherwise.
Validates a buffer descriptor.
LDK_API bool ldk_rhi_is_valid_buffer_desc(const LDKRHIBufferDesc *desc);
const LDKRHIBufferDesc *desctrue if valid, false otherwise.
Validates a texture descriptor.
LDK_API bool ldk_rhi_is_valid_texture_desc(const LDKRHITextureDesc *desc);
const LDKRHITextureDesc *desctrue if valid, false otherwise.
Validates a sampler descriptor.
LDK_API bool ldk_rhi_is_valid_sampler_desc(const LDKRHISamplerDesc *desc);
const LDKRHISamplerDesc *desctrue if valid, false otherwise.
Validates a shader module descriptor.
LDK_API bool ldk_rhi_is_valid_shader_module_desc(const LDKRHIShaderModuleDesc *desc);
const LDKRHIShaderModuleDesc *desctrue if valid, false otherwise.
Validates a bindings layout descriptor.
LDK_API bool ldk_rhi_is_valid_bindings_layout_desc(const LDKRHIBindingsLayoutDesc *desc);
const LDKRHIBindingsLayoutDesc *desctrue if valid, false otherwise.
Validates a pipeline descriptor.
LDK_API bool ldk_rhi_is_valid_pipeline_desc(const LDKRHIPipelineDesc *desc);
const LDKRHIPipelineDesc *desctrue if valid, false otherwise.
Validates a bindings descriptor.
LDK_API bool ldk_rhi_is_valid_bindings_desc(const LDKRHIBindingsDesc *desc);
const LDKRHIBindingsDesc *desctrue if valid, false otherwise.
Validates a pass descriptor.
LDK_API bool ldk_rhi_is_valid_pass_desc(const LDKRHIPassDesc *desc);
const LDKRHIPassDesc *desctrue if valid, false otherwise.
Creates a GPU buffer.
LDK_API LDKRHIBuffer ldk_rhi_buffer_create(
LDKRHIContext *context,
const LDKRHIBufferDesc *desc
);
LDKRHIContext *contextconst LDKRHIBufferDesc *descA valid buffer handle on success, or an invalid handle on failure.
Destroys a GPU buffer.
LDK_API void ldk_rhi_buffer_destroy(
LDKRHIContext *context,
LDKRHIBuffer buffer
);
LDKRHIContext *contextLDKRHIBuffer bufferUpdates a region of a buffer.
LDK_API bool ldk_rhi_buffer_update(
LDKRHIContext *context,
LDKRHIBuffer buffer,
uint32_t offset,
uint32_t size,
const void *data
);
LDKRHIContext *contextLDKRHIBuffer bufferuint32_t offsetuint32_t sizeconst void *datatrue if the update succeeded, false otherwise.
Creates a GPU texture.
LDK_API LDKRHITexture ldk_rhi_texture_create(
LDKRHIContext *context,
const LDKRHITextureDesc *desc
);
LDKRHIContext *contextconst LDKRHITextureDesc *descA valid texture handle on success, or an invalid handle on failure.
Destroys a GPU texture.
LDK_API void ldk_rhi_texture_destroy(
LDKRHIContext *context,
LDKRHITexture texture
);
LDKRHIContext *contextLDKRHITexture textureUpdates a texture subresource.
LDK_API bool ldk_rhi_texture_update(
LDKRHIContext *context,
LDKRHITexture texture,
uint32_t mip_level,
uint32_t layer,
const void *data,
uint32_t size
);
LDKRHIContext *contextLDKRHITexture textureuint32_t mip_leveluint32_t layerconst void *datauint32_t sizetrue if the update succeeded, false otherwise.
Creates a sampler object.
LDK_API LDKRHISampler ldk_rhi_create_sampler(
LDKRHIContext *context,
const LDKRHISamplerDesc *desc
);
LDKRHIContext *contextconst LDKRHISamplerDesc *descA valid sampler handle on success, or an invalid handle on failure.
Destroys a sampler object.
LDK_API void ldk_rhi_sampler_destroy(
LDKRHIContext *context,
LDKRHISampler sampler
);
LDKRHIContext *contextLDKRHISampler samplerCreates a shader module.
LDK_API LDKRHIShaderModule ldk_rhi_shader_module_create(
LDKRHIContext *context,
const LDKRHIShaderModuleDesc *desc
);
LDKRHIContext *contextconst LDKRHIShaderModuleDesc *descA valid shader module handle on success, or an invalid handle on failure.
Destroys a shader module.
LDK_API void ldk_rhi_shader_module_destroy(
LDKRHIContext *context,
LDKRHIShaderModule shader_module
);
LDKRHIContext *contextLDKRHIShaderModule shader_moduleCreates a bindings layout.
LDK_API LDKRHIBindingsLayout ldk_rhi_bindings_layout_create(
LDKRHIContext *context,
const LDKRHIBindingsLayoutDesc *desc
);
LDKRHIContext *contextconst LDKRHIBindingsLayoutDesc *descA valid layout handle on success, or an invalid handle on failure.
Destroys a bindings layout.
LDK_API void ldk_rhi_bindings_layout_destroy(
LDKRHIContext *context,
LDKRHIBindingsLayout bindings_layout
);
LDKRHIContext *contextLDKRHIBindingsLayout bindings_layoutCreates a pipeline.
LDK_API LDKRHIPipeline ldk_rhi_pipeline_create(
LDKRHIContext *context,
const LDKRHIPipelineDesc *desc
);
LDKRHIContext *contextconst LDKRHIPipelineDesc *descA valid pipeline handle on success, or an invalid handle on failure.
Destroys a pipeline.
LDK_API void ldk_rhi_pipeline_destroy(
LDKRHIContext *context,
LDKRHIPipeline pipeline
);
LDKRHIContext *contextLDKRHIPipeline pipelineCreates a bindings object.
LDK_API LDKRHIBindings ldk_rhi_bindings_create(
LDKRHIContext *context,
const LDKRHIBindingsDesc *desc
);
LDKRHIContext *contextconst LDKRHIBindingsDesc *descA valid bindings handle on success, or an invalid handle on failure.
Destroys a bindings object.
LDK_API void ldk_rhi_bindings_destroy(
LDKRHIContext *context,
LDKRHIBindings bindings
);
LDKRHIContext *contextLDKRHIBindings bindingsBegins a new frame.
LDK_API void ldk_rhi_frame_begin(LDKRHIContext *context);
LDKRHIContext *contextEnds the current frame.
LDK_API void ldk_rhi_frame_end(LDKRHIContext *context);
LDKRHIContext *contextReturns backend resource activity for the last completed RHI frame.
LDK_API LDKRHIFrameStats ldk_rhi_last_frame_stats_get(const LDKRHIContext *context);
const LDKRHIContext *contextPer-frame resource creation, destruction and upload counters.
Begins a rendering pass.
LDK_API void ldk_rhi_pass_begin(
LDKRHIContext *context,
const LDKRHIPassDesc *desc
);
LDKRHIContext *contextconst LDKRHIPassDesc *descEnds the current rendering pass.
LDK_API void ldk_rhi_pass_end(LDKRHIContext *context);
LDKRHIContext *contextBinds a pipeline.
LDK_API void ldk_rhi_pipeline_bind(
LDKRHIContext *context,
LDKRHIPipeline pipeline
);
LDKRHIContext *contextLDKRHIPipeline pipelineBinds resource bindings.
LDK_API void ldk_rhi_bindings_bind(
LDKRHIContext *context,
LDKRHIBindings bindings
);
LDKRHIContext *contextLDKRHIBindings bindingsBinds a vertex buffer.
LDK_API void ldk_rhi_vertex_buffer_bind(
LDKRHIContext *context,
LDKRHIBuffer buffer,
uint32_t offset
);
LDKRHIContext *contextLDKRHIBuffer bufferuint32_t offsetBinds a vertex buffer to a specific vertex buffer slot.
LDK_API void ldk_rhi_vertex_buffer_bind_at(
LDKRHIContext *context,
uint32_t slot,
LDKRHIBuffer buffer,
uint32_t offset
);
LDKRHIContext *contextuint32_t slotLDKRHIBuffer bufferuint32_t offsetBinds an index buffer.
LDK_API void ldk_rhi_index_buffer_bind(
LDKRHIContext *context,
LDKRHIBuffer buffer,
uint32_t offset,
LDKRHIIndexType index_type
);
LDKRHIContext *contextLDKRHIBuffer bufferuint32_t offsetLDKRHIIndexType index_typeSets the viewport.
LDK_API void ldk_rhi_viewport_set(
LDKRHIContext *context,
const LDKRHIViewport *viewport
);
LDKRHIContext *contextconst LDKRHIViewport *viewportSets the scissor rectangle.
LDK_API void ldk_rhi_scissor_set(
LDKRHIContext *context,
const LDKRHIRect *scissor
);
LDKRHIContext *contextconst LDKRHIRect *scissorSets rasterized line width dynamically.
LDK_API void ldk_rhi_line_width_set(
LDKRHIContext *context,
float line_width
);
LDKRHIContext *contextfloat line_widthIssues a non-indexed draw call.
LDK_API void ldk_rhi_draw(
LDKRHIContext *context,
const LDKRHIDrawDesc *desc
);
LDKRHIContext *contextconst LDKRHIDrawDesc *descIssues an instanced draw call.
LDK_API void ldk_rhi_draw_instanced(
LDKRHIContext *context,
const LDKRHIDrawInstancedDesc *desc
);
LDKRHIContext *contextconst LDKRHIDrawInstancedDesc *descIssues an indexed draw call.
LDK_API void ldk_rhi_draw_indexed(
LDKRHIContext *context,
const LDKRHIDrawIndexedDesc *desc
);
LDKRHIContext *contextconst LDKRHIDrawIndexedDesc *descIssues an indexed instanced draw call.
LDK_API void ldk_rhi_draw_indexed_instanced(
LDKRHIContext *context,
const LDKRHIDrawIndexedInstancedDesc *desc
);
LDKRHIContext *contextconst LDKRHIDrawIndexedInstancedDesc *descCreates a sampler object from filtering and wrapping state.
LDK_API LDKRHISampler ldk_rhi_sampler_create(
LDKRHIContext *context,
const LDKRHISamplerDesc *desc
);
LDKRHIContext *contextconst LDKRHISamplerDesc *descA valid sampler handle on success, or LDK_RHI_SAMPLER_INVALID on failure.