Class bgfx | Project Tiny Rendering | 0.21.0-preview.4
docs.unity3d.com
    Show / Hide Table of Contents

    Class bgfx

    Inheritance
    Object
    bgfx
    Namespace: Bgfx
    Syntax
    public static class bgfx

    Methods

    alloc(UInt32)

    Allocate buffer to pass to bgfx calls. Data will be freed inside bgfx.

    Declaration
    public static bgfx.Memory*alloc(uint _size)
    Parameters
    Type Name Description
    UInt32 _size

    Size to allocate.

    Returns
    Type Description
    bgfx.Memory*

    alloc_instance_data_buffer(bgfx.InstanceDataBuffer*, UInt32, UInt16)

    Allocate instance data buffer.

    Declaration
    public static void alloc_instance_data_buffer(bgfx.InstanceDataBuffer*_idb, uint _num, ushort _stride)
    Parameters
    Type Name Description
    bgfx.InstanceDataBuffer* _idb

    InstanceDataBuffer structure is filled and is valid for duration of frame, and it can be reused for multiple draw calls.

    UInt32 _num

    Number of instances.

    UInt16 _stride

    Instance stride. Must be multiple of 16.

    alloc_transform(bgfx.Transform*, UInt16)

    Reserve matrices in internal matrix cache. @attention Pointer returned can be modifed until bgfx::frame is called.

    Declaration
    public static uint alloc_transform(bgfx.Transform*_transform, ushort _num)
    Parameters
    Type Name Description
    bgfx.Transform* _transform

    Pointer to Transform structure.

    UInt16 _num

    Number of matrices.

    Returns
    Type Description
    UInt32

    alloc_transient_buffers(bgfx.TransientVertexBuffer*, bgfx.VertexLayout*, UInt32, bgfx.TransientIndexBuffer*, UInt32)

    Check for required space and allocate transient vertex and index buffers. If both space requirements are satisfied function returns true. @remarks Only 16-bit index buffer is supported.

    Declaration
    public static bool alloc_transient_buffers(bgfx.TransientVertexBuffer*_tvb, bgfx.VertexLayout*_layout, uint _numVertices, bgfx.TransientIndexBuffer*_tib, uint _numIndices)
    Parameters
    Type Name Description
    bgfx.TransientVertexBuffer* _tvb

    TransientVertexBuffer structure is filled and is valid for the duration of frame, and it can be reused for multiple draw calls.

    bgfx.VertexLayout* _layout

    Vertex layout.

    UInt32 _numVertices

    Number of vertices to allocate.

    bgfx.TransientIndexBuffer* _tib

    TransientIndexBuffer structure is filled and is valid for the duration of frame, and it can be reused for multiple draw calls.

    UInt32 _numIndices

    Number of indices to allocate.

    Returns
    Type Description
    Boolean

    alloc_transient_index_buffer(bgfx.TransientIndexBuffer*, UInt32)

    Allocate transient index buffer. @remarks Only 16-bit index buffer is supported.

    Declaration
    public static void alloc_transient_index_buffer(bgfx.TransientIndexBuffer*_tib, uint _num)
    Parameters
    Type Name Description
    bgfx.TransientIndexBuffer* _tib

    TransientIndexBuffer structure is filled and is valid for the duration of frame, and it can be reused for multiple draw calls.

    UInt32 _num

    Number of indices to allocate.

    alloc_transient_vertex_buffer(bgfx.TransientVertexBuffer*, UInt32, bgfx.VertexLayout*)

    Allocate transient vertex buffer.

    Declaration
    public static void alloc_transient_vertex_buffer(bgfx.TransientVertexBuffer*_tvb, uint _num, bgfx.VertexLayout*_layout)
    Parameters
    Type Name Description
    bgfx.TransientVertexBuffer* _tvb

    TransientVertexBuffer structure is filled and is valid for the duration of frame, and it can be reused for multiple draw calls.

    UInt32 _num

    Number of vertices to allocate.

    bgfx.VertexLayout* _layout

    Vertex layout.

    attachment_init(bgfx.Attachment*, bgfx.TextureHandle, bgfx.Access, UInt16, UInt16, Byte)

    Init attachment.

    Declaration
    public static void attachment_init(bgfx.Attachment*_this, bgfx.TextureHandle _handle, bgfx.Access _access, ushort _layer, ushort _mip, byte _resolve)
    Parameters
    Type Name Description
    bgfx.Attachment* _this
    bgfx.TextureHandle _handle

    Render target texture handle.

    bgfx.Access _access

    Access. See Access::Enum.

    UInt16 _layer

    Cubemap side or depth layer/slice.

    UInt16 _mip

    Mip level.

    Byte _resolve

    Resolve flags. See: BGFX_RESOLVE_*

    blit(UInt16, bgfx.TextureHandle, Byte, UInt16, UInt16, UInt16, bgfx.TextureHandle, Byte, UInt16, UInt16, UInt16, UInt16, UInt16, UInt16)

    Blit 2D texture region between two 2D textures. @attention Destination texture must be created with BGFX_TEXTURE_BLIT_DST flag. @attention Availability depends on: BGFX_CAPS_TEXTURE_BLIT.

    Declaration
    public static void blit(ushort _id, bgfx.TextureHandle _dst, byte _dstMip, ushort _dstX, ushort _dstY, ushort _dstZ, bgfx.TextureHandle _src, byte _srcMip, ushort _srcX, ushort _srcY, ushort _srcZ, ushort _width, ushort _height, ushort _depth)
    Parameters
    Type Name Description
    UInt16 _id

    View id.

    bgfx.TextureHandle _dst

    Destination texture handle.

    Byte _dstMip

    Destination texture mip level.

    UInt16 _dstX

    Destination texture X position.

    UInt16 _dstY

    Destination texture Y position.

    UInt16 _dstZ

    If texture is 2D this argument should be 0. If destination texture is cube this argument represents destination texture cube face. For 3D texture this argument represents destination texture Z position.

    bgfx.TextureHandle _src

    Source texture handle.

    Byte _srcMip

    Source texture mip level.

    UInt16 _srcX

    Source texture X position.

    UInt16 _srcY

    Source texture Y position.

    UInt16 _srcZ

    If texture is 2D this argument should be 0. If source texture is cube this argument represents source texture cube face. For 3D texture this argument represents source texture Z position.

    UInt16 _width

    Width of region.

    UInt16 _height

    Height of region.

    UInt16 _depth

    If texture is 3D this argument represents depth of region, otherwise it's unused.

    calc_texture_size(bgfx.TextureInfo*, UInt16, UInt16, UInt16, Boolean, Boolean, UInt16, bgfx.TextureFormat)

    Calculate amount of memory required for texture.

    Declaration
    public static void calc_texture_size(bgfx.TextureInfo*_info, ushort _width, ushort _height, ushort _depth, bool _cubeMap, bool _hasMips, ushort _numLayers, bgfx.TextureFormat _format)
    Parameters
    Type Name Description
    bgfx.TextureInfo* _info

    Resulting texture info structure. See: TextureInfo.

    UInt16 _width

    Width.

    UInt16 _height

    Height.

    UInt16 _depth

    Depth dimension of volume texture.

    Boolean _cubeMap

    Indicates that texture contains cubemap.

    Boolean _hasMips

    Indicates that texture contains full mip-map chain.

    UInt16 _numLayers

    Number of layers in texture array.

    bgfx.TextureFormat _format

    Texture format. See: TextureFormat::Enum.

    CallbacksDeInit()

    Declaration
    public static void CallbacksDeInit()

    CallbacksInit()

    Declaration
    public static IntPtr CallbacksInit()
    Returns
    Type Description
    IntPtr

    CallbacksLock(Byte**, bgfx.CallbackEntry**)

    Declaration
    public static int CallbacksLock(byte **destMem, bgfx.CallbackEntry**destLog)
    Parameters
    Type Name Description
    Byte** destMem
    bgfx.CallbackEntry** destLog
    Returns
    Type Description
    Int32

    CallbacksUnlockAndClear()

    Declaration
    public static void CallbacksUnlockAndClear()

    copy(Void*, UInt32)

    Allocate buffer and copy data into it. Data will be freed inside bgfx.

    Declaration
    public static bgfx.Memory*copy(void *_data, uint _size)
    Parameters
    Type Name Description
    Void* _data

    Pointer to data to be copied.

    UInt32 _size

    Size of data to be copied.

    Returns
    Type Description
    bgfx.Memory*

    create_compute_program(bgfx.ShaderHandle, Boolean)

    Create program with compute shader.

    Declaration
    public static bgfx.ProgramHandle create_compute_program(bgfx.ShaderHandle _csh, bool _destroyShaders)
    Parameters
    Type Name Description
    bgfx.ShaderHandle _csh

    Compute shader.

    Boolean _destroyShaders

    If true, shaders will be destroyed when program is destroyed.

    Returns
    Type Description
    bgfx.ProgramHandle

    create_dynamic_index_buffer(UInt32, UInt16)

    Create empty dynamic index buffer.

    Declaration
    public static bgfx.DynamicIndexBufferHandle create_dynamic_index_buffer(uint _num, ushort _flags)
    Parameters
    Type Name Description
    UInt32 _num

    Number of indices.

    UInt16 _flags

    Buffer creation flags. - BGFX_BUFFER_NONE - No flags. - BGFX_BUFFER_COMPUTE_READ - Buffer will be read from by compute shader. - BGFX_BUFFER_COMPUTE_WRITE - Buffer will be written into by compute shader. When buffer is created with BGFX_BUFFER_COMPUTE_WRITE flag it cannot be updated from CPU. - BGFX_BUFFER_COMPUTE_READ_WRITE - Buffer will be used for read/write by compute shader. - BGFX_BUFFER_ALLOW_RESIZE - Buffer will resize on buffer update if a different amount of data is passed. If this flag is not specified, and more data is passed on update, the buffer will be trimmed to fit the existing buffer size. This flag has effect only on dynamic buffers. - BGFX_BUFFER_INDEX32 - Buffer is using 32-bit indices. This flag has effect only on index buffers.

    Returns
    Type Description
    bgfx.DynamicIndexBufferHandle

    create_dynamic_index_buffer_mem(bgfx.Memory*, UInt16)

    Create dynamic index buffer and initialized it.

    Declaration
    public static bgfx.DynamicIndexBufferHandle create_dynamic_index_buffer_mem(bgfx.Memory*_mem, ushort _flags)
    Parameters
    Type Name Description
    bgfx.Memory* _mem

    Index buffer data.

    UInt16 _flags

    Buffer creation flags. - BGFX_BUFFER_NONE - No flags. - BGFX_BUFFER_COMPUTE_READ - Buffer will be read from by compute shader. - BGFX_BUFFER_COMPUTE_WRITE - Buffer will be written into by compute shader. When buffer is created with BGFX_BUFFER_COMPUTE_WRITE flag it cannot be updated from CPU. - BGFX_BUFFER_COMPUTE_READ_WRITE - Buffer will be used for read/write by compute shader. - BGFX_BUFFER_ALLOW_RESIZE - Buffer will resize on buffer update if a different amount of data is passed. If this flag is not specified, and more data is passed on update, the buffer will be trimmed to fit the existing buffer size. This flag has effect only on dynamic buffers. - BGFX_BUFFER_INDEX32 - Buffer is using 32-bit indices. This flag has effect only on index buffers.

    Returns
    Type Description
    bgfx.DynamicIndexBufferHandle

    create_dynamic_vertex_buffer(UInt32, bgfx.VertexLayout*, UInt16)

    Create empty dynamic vertex buffer.

    Declaration
    public static bgfx.DynamicVertexBufferHandle create_dynamic_vertex_buffer(uint _num, bgfx.VertexLayout*_layout, ushort _flags)
    Parameters
    Type Name Description
    UInt32 _num

    Number of vertices.

    bgfx.VertexLayout* _layout

    Vertex layout.

    UInt16 _flags

    Buffer creation flags. - BGFX_BUFFER_NONE - No flags. - BGFX_BUFFER_COMPUTE_READ - Buffer will be read from by compute shader. - BGFX_BUFFER_COMPUTE_WRITE - Buffer will be written into by compute shader. When buffer is created with BGFX_BUFFER_COMPUTE_WRITE flag it cannot be updated from CPU. - BGFX_BUFFER_COMPUTE_READ_WRITE - Buffer will be used for read/write by compute shader. - BGFX_BUFFER_ALLOW_RESIZE - Buffer will resize on buffer update if a different amount of data is passed. If this flag is not specified, and more data is passed on update, the buffer will be trimmed to fit the existing buffer size. This flag has effect only on dynamic buffers. - BGFX_BUFFER_INDEX32 - Buffer is using 32-bit indices. This flag has effect only on index buffers.

    Returns
    Type Description
    bgfx.DynamicVertexBufferHandle

    create_dynamic_vertex_buffer_mem(bgfx.Memory*, bgfx.VertexLayout*, UInt16)

    Create dynamic vertex buffer and initialize it.

    Declaration
    public static bgfx.DynamicVertexBufferHandle create_dynamic_vertex_buffer_mem(bgfx.Memory*_mem, bgfx.VertexLayout*_layout, ushort _flags)
    Parameters
    Type Name Description
    bgfx.Memory* _mem

    Vertex buffer data.

    bgfx.VertexLayout* _layout

    Vertex layout.

    UInt16 _flags

    Buffer creation flags. - BGFX_BUFFER_NONE - No flags. - BGFX_BUFFER_COMPUTE_READ - Buffer will be read from by compute shader. - BGFX_BUFFER_COMPUTE_WRITE - Buffer will be written into by compute shader. When buffer is created with BGFX_BUFFER_COMPUTE_WRITE flag it cannot be updated from CPU. - BGFX_BUFFER_COMPUTE_READ_WRITE - Buffer will be used for read/write by compute shader. - BGFX_BUFFER_ALLOW_RESIZE - Buffer will resize on buffer update if a different amount of data is passed. If this flag is not specified, and more data is passed on update, the buffer will be trimmed to fit the existing buffer size. This flag has effect only on dynamic buffers. - BGFX_BUFFER_INDEX32 - Buffer is using 32-bit indices. This flag has effect only on index buffers.

    Returns
    Type Description
    bgfx.DynamicVertexBufferHandle

    create_frame_buffer(UInt16, UInt16, bgfx.TextureFormat, UInt64)

    Create frame buffer (simple).

    Declaration
    public static bgfx.FrameBufferHandle create_frame_buffer(ushort _width, ushort _height, bgfx.TextureFormat _format, ulong _textureFlags)
    Parameters
    Type Name Description
    UInt16 _width

    Texture width.

    UInt16 _height

    Texture height.

    bgfx.TextureFormat _format

    Texture format. See: TextureFormat::Enum.

    UInt64 _textureFlags

    Texture creation (see BGFX_TEXTURE_*.), and sampler (see BGFX_SAMPLER_*) flags. Default texture sampling mode is linear, and wrap mode is repeat. - BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP] - Mirror or clamp to edge wrap mode. - BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC] - Point or anisotropic sampling.

    Returns
    Type Description
    bgfx.FrameBufferHandle

    create_frame_buffer_from_attachment(Byte, bgfx.Attachment*, Boolean)

    Create MRT frame buffer from texture handles with specific layer and mip level.

    Declaration
    public static bgfx.FrameBufferHandle create_frame_buffer_from_attachment(byte _num, bgfx.Attachment*_attachment, bool _destroyTexture)
    Parameters
    Type Name Description
    Byte _num

    Number of attachements.

    bgfx.Attachment* _attachment

    Attachment texture info. See: bgfx::Attachment.

    Boolean _destroyTexture

    If true, textures will be destroyed when frame buffer is destroyed.

    Returns
    Type Description
    bgfx.FrameBufferHandle

    create_frame_buffer_from_handles(Byte, bgfx.TextureHandle*, Boolean)

    Create MRT frame buffer from texture handles (simple).

    Declaration
    public static bgfx.FrameBufferHandle create_frame_buffer_from_handles(byte _num, bgfx.TextureHandle*_handles, bool _destroyTexture)
    Parameters
    Type Name Description
    Byte _num

    Number of texture handles.

    bgfx.TextureHandle* _handles

    Texture attachments.

    Boolean _destroyTexture

    If true, textures will be destroyed when frame buffer is destroyed.

    Returns
    Type Description
    bgfx.FrameBufferHandle

    create_frame_buffer_from_nwh(Void*, UInt16, UInt16, bgfx.TextureFormat, bgfx.TextureFormat)

    Create frame buffer for multiple window rendering. @remarks Frame buffer cannot be used for sampling. @attention Availability depends on: BGFX_CAPS_SWAP_CHAIN.

    Declaration
    public static bgfx.FrameBufferHandle create_frame_buffer_from_nwh(void *_nwh, ushort _width, ushort _height, bgfx.TextureFormat _format, bgfx.TextureFormat _depthFormat)
    Parameters
    Type Name Description
    Void* _nwh

    OS' target native window handle.

    UInt16 _width

    Window back buffer width.

    UInt16 _height

    Window back buffer height.

    bgfx.TextureFormat _format

    Window back buffer color format.

    bgfx.TextureFormat _depthFormat

    Window back buffer depth format.

    Returns
    Type Description
    bgfx.FrameBufferHandle

    create_frame_buffer_scaled(bgfx.BackbufferRatio, bgfx.TextureFormat, UInt64)

    Create frame buffer with size based on backbuffer ratio. Frame buffer will maintain ratio if back buffer resolution changes.

    Declaration
    public static bgfx.FrameBufferHandle create_frame_buffer_scaled(bgfx.BackbufferRatio _ratio, bgfx.TextureFormat _format, ulong _textureFlags)
    Parameters
    Type Name Description
    bgfx.BackbufferRatio _ratio

    Frame buffer size in respect to back-buffer size. See: BackbufferRatio::Enum.

    bgfx.TextureFormat _format

    Texture format. See: TextureFormat::Enum.

    UInt64 _textureFlags

    Texture creation (see BGFX_TEXTURE_*.), and sampler (see BGFX_SAMPLER_*) flags. Default texture sampling mode is linear, and wrap mode is repeat. - BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP] - Mirror or clamp to edge wrap mode. - BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC] - Point or anisotropic sampling.

    Returns
    Type Description
    bgfx.FrameBufferHandle

    create_index_buffer(bgfx.Memory*, UInt16)

    Create static index buffer.

    Declaration
    public static bgfx.IndexBufferHandle create_index_buffer(bgfx.Memory*_mem, ushort _flags)
    Parameters
    Type Name Description
    bgfx.Memory* _mem

    Index buffer data.

    UInt16 _flags

    Buffer creation flags. - BGFX_BUFFER_NONE - No flags. - BGFX_BUFFER_COMPUTE_READ - Buffer will be read from by compute shader. - BGFX_BUFFER_COMPUTE_WRITE - Buffer will be written into by compute shader. When buffer is created with BGFX_BUFFER_COMPUTE_WRITE flag it cannot be updated from CPU. - BGFX_BUFFER_COMPUTE_READ_WRITE - Buffer will be used for read/write by compute shader. - BGFX_BUFFER_ALLOW_RESIZE - Buffer will resize on buffer update if a different amount of data is passed. If this flag is not specified, and more data is passed on update, the buffer will be trimmed to fit the existing buffer size. This flag has effect only on dynamic buffers. - BGFX_BUFFER_INDEX32 - Buffer is using 32-bit indices. This flag has effect only on index buffers.

    Returns
    Type Description
    bgfx.IndexBufferHandle

    create_indirect_buffer(UInt32)

    Create draw indirect buffer.

    Declaration
    public static bgfx.IndirectBufferHandle create_indirect_buffer(uint _num)
    Parameters
    Type Name Description
    UInt32 _num

    Number of indirect calls.

    Returns
    Type Description
    bgfx.IndirectBufferHandle

    create_occlusion_query()

    Create occlusion query.

    Declaration
    public static bgfx.OcclusionQueryHandle create_occlusion_query()
    Returns
    Type Description
    bgfx.OcclusionQueryHandle

    create_program(bgfx.ShaderHandle, bgfx.ShaderHandle, Boolean)

    Create program with vertex and fragment shaders.

    Declaration
    public static bgfx.ProgramHandle create_program(bgfx.ShaderHandle _vsh, bgfx.ShaderHandle _fsh, bool _destroyShaders)
    Parameters
    Type Name Description
    bgfx.ShaderHandle _vsh

    Vertex shader.

    bgfx.ShaderHandle _fsh

    Fragment shader.

    Boolean _destroyShaders

    If true, shaders will be destroyed when program is destroyed.

    Returns
    Type Description
    bgfx.ProgramHandle

    create_shader(bgfx.Memory*)

    Create shader from memory buffer.

    Declaration
    public static bgfx.ShaderHandle create_shader(bgfx.Memory*_mem)
    Parameters
    Type Name Description
    bgfx.Memory* _mem

    Shader binary.

    Returns
    Type Description
    bgfx.ShaderHandle

    create_texture(bgfx.Memory*, UInt64, Byte, bgfx.TextureInfo*)

    Create texture from memory buffer.

    Declaration
    public static bgfx.TextureHandle create_texture(bgfx.Memory*_mem, ulong _flags, byte _skip, bgfx.TextureInfo*_info)
    Parameters
    Type Name Description
    bgfx.Memory* _mem

    DDS, KTX or PVR texture binary data.

    UInt64 _flags

    Texture creation (see BGFX_TEXTURE_*.), and sampler (see BGFX_SAMPLER_*) flags. Default texture sampling mode is linear, and wrap mode is repeat. - BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP] - Mirror or clamp to edge wrap mode. - BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC] - Point or anisotropic sampling.

    Byte _skip

    Skip top level mips when parsing texture.

    bgfx.TextureInfo* _info

    When non-NULL is specified it returns parsed texture information.

    Returns
    Type Description
    bgfx.TextureHandle

    create_texture_2d(UInt16, UInt16, Boolean, UInt16, bgfx.TextureFormat, UInt64, bgfx.Memory*)

    Create 2D texture.

    Declaration
    public static bgfx.TextureHandle create_texture_2d(ushort _width, ushort _height, bool _hasMips, ushort _numLayers, bgfx.TextureFormat _format, ulong _flags, bgfx.Memory*_mem)
    Parameters
    Type Name Description
    UInt16 _width

    Width.

    UInt16 _height

    Height.

    Boolean _hasMips

    Indicates that texture contains full mip-map chain.

    UInt16 _numLayers

    Number of layers in texture array. Must be 1 if caps BGFX_CAPS_TEXTURE_2D_ARRAY flag is not set.

    bgfx.TextureFormat _format

    Texture format. See: TextureFormat::Enum.

    UInt64 _flags

    Texture creation (see BGFX_TEXTURE_*.), and sampler (see BGFX_SAMPLER_*) flags. Default texture sampling mode is linear, and wrap mode is repeat. - BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP] - Mirror or clamp to edge wrap mode. - BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC] - Point or anisotropic sampling.

    bgfx.Memory* _mem

    Texture data. If _mem is non-NULL, created texture will be immutable. If _mem is NULL content of the texture is uninitialized. When _numLayers is more than 1, expected memory layout is texture and all mips together for each array element.

    Returns
    Type Description
    bgfx.TextureHandle

    create_texture_2d_scaled(bgfx.BackbufferRatio, Boolean, UInt16, bgfx.TextureFormat, UInt64)

    Create texture with size based on backbuffer ratio. Texture will maintain ratio if back buffer resolution changes.

    Declaration
    public static bgfx.TextureHandle create_texture_2d_scaled(bgfx.BackbufferRatio _ratio, bool _hasMips, ushort _numLayers, bgfx.TextureFormat _format, ulong _flags)
    Parameters
    Type Name Description
    bgfx.BackbufferRatio _ratio

    Texture size in respect to back-buffer size. See: BackbufferRatio::Enum.

    Boolean _hasMips

    Indicates that texture contains full mip-map chain.

    UInt16 _numLayers

    Number of layers in texture array. Must be 1 if caps BGFX_CAPS_TEXTURE_2D_ARRAY flag is not set.

    bgfx.TextureFormat _format

    Texture format. See: TextureFormat::Enum.

    UInt64 _flags

    Texture creation (see BGFX_TEXTURE_*.), and sampler (see BGFX_SAMPLER_*) flags. Default texture sampling mode is linear, and wrap mode is repeat. - BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP] - Mirror or clamp to edge wrap mode. - BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC] - Point or anisotropic sampling.

    Returns
    Type Description
    bgfx.TextureHandle

    create_texture_3d(UInt16, UInt16, UInt16, Boolean, bgfx.TextureFormat, UInt64, bgfx.Memory*)

    Create 3D texture.

    Declaration
    public static bgfx.TextureHandle create_texture_3d(ushort _width, ushort _height, ushort _depth, bool _hasMips, bgfx.TextureFormat _format, ulong _flags, bgfx.Memory*_mem)
    Parameters
    Type Name Description
    UInt16 _width

    Width.

    UInt16 _height

    Height.

    UInt16 _depth

    Depth.

    Boolean _hasMips

    Indicates that texture contains full mip-map chain.

    bgfx.TextureFormat _format

    Texture format. See: TextureFormat::Enum.

    UInt64 _flags

    Texture creation (see BGFX_TEXTURE_*.), and sampler (see BGFX_SAMPLER_*) flags. Default texture sampling mode is linear, and wrap mode is repeat. - BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP] - Mirror or clamp to edge wrap mode. - BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC] - Point or anisotropic sampling.

    bgfx.Memory* _mem

    Texture data. If _mem is non-NULL, created texture will be immutable. If _mem is NULL content of the texture is uninitialized. When _numLayers is more than 1, expected memory layout is texture and all mips together for each array element.

    Returns
    Type Description
    bgfx.TextureHandle

    create_texture_cube(UInt16, Boolean, UInt16, bgfx.TextureFormat, UInt64, bgfx.Memory*)

    Create Cube texture.

    Declaration
    public static bgfx.TextureHandle create_texture_cube(ushort _size, bool _hasMips, ushort _numLayers, bgfx.TextureFormat _format, ulong _flags, bgfx.Memory*_mem)
    Parameters
    Type Name Description
    UInt16 _size

    Cube side size.

    Boolean _hasMips

    Indicates that texture contains full mip-map chain.

    UInt16 _numLayers

    Number of layers in texture array. Must be 1 if caps BGFX_CAPS_TEXTURE_2D_ARRAY flag is not set.

    bgfx.TextureFormat _format

    Texture format. See: TextureFormat::Enum.

    UInt64 _flags

    Texture creation (see BGFX_TEXTURE_*.), and sampler (see BGFX_SAMPLER_*) flags. Default texture sampling mode is linear, and wrap mode is repeat. - BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP] - Mirror or clamp to edge wrap mode. - BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC] - Point or anisotropic sampling.

    bgfx.Memory* _mem

    Texture data. If _mem is non-NULL, created texture will be immutable. If _mem is NULL content of the texture is uninitialized. When _numLayers is more than 1, expected memory layout is texture and all mips together for each array element.

    Returns
    Type Description
    bgfx.TextureHandle

    create_uniform(String, bgfx.UniformType, UInt16)

    Create shader uniform parameter. @remarks

    1. Uniform names are unique. It's valid to call bgfx::createUniform multiple times with the same uniform name. The library will always return the same handle, but the handle reference count will be incremented. This means that the same number of bgfx::destroyUniform must be called to properly destroy the uniform.
    2. Predefined uniforms (declared in bgfx_shader.sh):
    3. u_viewRect vec4(x, y, width, height) - view rectangle for current view, in pixels.
    4. u_viewTexel vec4(1.0/width, 1.0/height, undef, undef) - inverse width and height
    5. u_view mat4 - view matrix
    6. u_invView mat4 - inverted view matrix
    7. u_proj mat4 - projection matrix
    8. u_invProj mat4 - inverted projection matrix
    9. u_viewProj mat4 - concatenated view projection matrix
    10. u_invViewProj mat4 - concatenated inverted view projection matrix
    11. u_model mat4[BGFX_CONFIG_MAX_BONES] - array of model matrices.
    12. u_modelView mat4 - concatenated model view matrix, only first model matrix from array is used.
    13. u_modelViewProj mat4 - concatenated model view projection matrix.
    14. u_alphaRef float - alpha reference value for alpha test.
    Declaration
    public static bgfx.UniformHandle create_uniform(string _name, bgfx.UniformType _type, ushort _num)
    Parameters
    Type Name Description
    String _name

    Uniform name in shader.

    bgfx.UniformType _type

    Type of uniform (See: bgfx::UniformType).

    UInt16 _num

    Number of elements in array.

    Returns
    Type Description
    bgfx.UniformHandle

    create_vertex_buffer(bgfx.Memory*, bgfx.VertexLayout*, UInt16)

    Create static vertex buffer.

    Declaration
    public static bgfx.VertexBufferHandle create_vertex_buffer(bgfx.Memory*_mem, bgfx.VertexLayout*_layout, ushort _flags)
    Parameters
    Type Name Description
    bgfx.Memory* _mem

    Vertex buffer data.

    bgfx.VertexLayout* _layout

    Vertex layout.

    UInt16 _flags

    Buffer creation flags. - BGFX_BUFFER_NONE - No flags. - BGFX_BUFFER_COMPUTE_READ - Buffer will be read from by compute shader. - BGFX_BUFFER_COMPUTE_WRITE - Buffer will be written into by compute shader. When buffer is created with BGFX_BUFFER_COMPUTE_WRITE flag it cannot be updated from CPU. - BGFX_BUFFER_COMPUTE_READ_WRITE - Buffer will be used for read/write by compute shader. - BGFX_BUFFER_ALLOW_RESIZE - Buffer will resize on buffer update if a different amount of data is passed. If this flag is not specified, and more data is passed on update, the buffer will be trimmed to fit the existing buffer size. This flag has effect only on dynamic buffers. - BGFX_BUFFER_INDEX32 - Buffer is using 32-bit indices. This flag has effect only on index buffers.

    Returns
    Type Description
    bgfx.VertexBufferHandle

    create_vertex_layout(bgfx.VertexLayout*)

    Create vertex layout.

    Declaration
    public static bgfx.VertexLayoutHandle create_vertex_layout(bgfx.VertexLayout*_layout)
    Parameters
    Type Name Description
    bgfx.VertexLayout* _layout

    Vertex layout.

    Returns
    Type Description
    bgfx.VertexLayoutHandle

    dbg_text_clear(Byte, Boolean)

    Clear internal debug text buffer.

    Declaration
    public static void dbg_text_clear(byte _attr, bool _small)
    Parameters
    Type Name Description
    Byte _attr

    Background color.

    Boolean _small

    Default 8x16 or 8x8 font.

    dbg_text_image(UInt16, UInt16, UInt16, UInt16, Void*, UInt16)

    Draw image into internal debug text buffer.

    Declaration
    public static void dbg_text_image(ushort _x, ushort _y, ushort _width, ushort _height, void *_data, ushort _pitch)
    Parameters
    Type Name Description
    UInt16 _x

    Position x from the left corner of the window.

    UInt16 _y

    Position y from the top corner of the window.

    UInt16 _width

    Image width.

    UInt16 _height

    Image height.

    Void* _data

    Raw image data (character/attribute raw encoding).

    UInt16 _pitch

    Image pitch in bytes.

    dbg_text_printf(UInt16, UInt16, Byte, String, String)

    Print formatted data to internal debug text character-buffer (VGA-compatible text mode).

    Declaration
    public static void dbg_text_printf(ushort _x, ushort _y, byte _attr, string _format, string args)
    Parameters
    Type Name Description
    UInt16 _x

    Position x from the left corner of the window.

    UInt16 _y

    Position y from the top corner of the window.

    Byte _attr

    Color palette. Where top 4-bits represent index of background, and bottom 4-bits represent foreground color from standard VGA text palette (ANSI escape codes).

    String _format

    printf style format.

    String args

    dbg_text_vprintf(UInt16, UInt16, Byte, String, IntPtr)

    Print formatted data from variable argument list to internal debug text character-buffer (VGA-compatible text mode).

    Declaration
    public static void dbg_text_vprintf(ushort _x, ushort _y, byte _attr, string _format, IntPtr _argList)
    Parameters
    Type Name Description
    UInt16 _x

    Position x from the left corner of the window.

    UInt16 _y

    Position y from the top corner of the window.

    Byte _attr

    Color palette. Where top 4-bits represent index of background, and bottom 4-bits represent foreground color from standard VGA text palette (ANSI escape codes).

    String _format

    printf style format.

    IntPtr _argList

    Variable arguments list for format string.

    destroy_dynamic_index_buffer(bgfx.DynamicIndexBufferHandle)

    Destroy dynamic index buffer.

    Declaration
    public static void destroy_dynamic_index_buffer(bgfx.DynamicIndexBufferHandle _handle)
    Parameters
    Type Name Description
    bgfx.DynamicIndexBufferHandle _handle

    Dynamic index buffer handle.

    destroy_dynamic_vertex_buffer(bgfx.DynamicVertexBufferHandle)

    Destroy dynamic vertex buffer.

    Declaration
    public static void destroy_dynamic_vertex_buffer(bgfx.DynamicVertexBufferHandle _handle)
    Parameters
    Type Name Description
    bgfx.DynamicVertexBufferHandle _handle

    Dynamic vertex buffer handle.

    destroy_frame_buffer(bgfx.FrameBufferHandle)

    Destroy frame buffer.

    Declaration
    public static void destroy_frame_buffer(bgfx.FrameBufferHandle _handle)
    Parameters
    Type Name Description
    bgfx.FrameBufferHandle _handle

    Frame buffer handle.

    destroy_index_buffer(bgfx.IndexBufferHandle)

    Destroy static index buffer.

    Declaration
    public static void destroy_index_buffer(bgfx.IndexBufferHandle _handle)
    Parameters
    Type Name Description
    bgfx.IndexBufferHandle _handle

    Static index buffer handle.

    destroy_indirect_buffer(bgfx.IndirectBufferHandle)

    Destroy draw indirect buffer.

    Declaration
    public static void destroy_indirect_buffer(bgfx.IndirectBufferHandle _handle)
    Parameters
    Type Name Description
    bgfx.IndirectBufferHandle _handle

    Indirect buffer handle.

    destroy_occlusion_query(bgfx.OcclusionQueryHandle)

    Destroy occlusion query.

    Declaration
    public static void destroy_occlusion_query(bgfx.OcclusionQueryHandle _handle)
    Parameters
    Type Name Description
    bgfx.OcclusionQueryHandle _handle

    Handle to occlusion query object.

    destroy_program(bgfx.ProgramHandle)

    Destroy program.

    Declaration
    public static void destroy_program(bgfx.ProgramHandle _handle)
    Parameters
    Type Name Description
    bgfx.ProgramHandle _handle

    Program handle.

    destroy_shader(bgfx.ShaderHandle)

    Destroy shader. @remark Once a shader program is created with _handle, it is safe to destroy that shader.

    Declaration
    public static void destroy_shader(bgfx.ShaderHandle _handle)
    Parameters
    Type Name Description
    bgfx.ShaderHandle _handle

    Shader handle.

    destroy_texture(bgfx.TextureHandle)

    Destroy texture.

    Declaration
    public static void destroy_texture(bgfx.TextureHandle _handle)
    Parameters
    Type Name Description
    bgfx.TextureHandle _handle

    Texture handle.

    destroy_uniform(bgfx.UniformHandle)

    Destroy shader uniform parameter.

    Declaration
    public static void destroy_uniform(bgfx.UniformHandle _handle)
    Parameters
    Type Name Description
    bgfx.UniformHandle _handle

    Handle to uniform object.

    destroy_vertex_buffer(bgfx.VertexBufferHandle)

    Destroy static vertex buffer.

    Declaration
    public static void destroy_vertex_buffer(bgfx.VertexBufferHandle _handle)
    Parameters
    Type Name Description
    bgfx.VertexBufferHandle _handle

    Static vertex buffer handle.

    destroy_vertex_layout(bgfx.VertexLayoutHandle)

    Destroy vertex layout.

    Declaration
    public static void destroy_vertex_layout(bgfx.VertexLayoutHandle _layoutHandle)
    Parameters
    Type Name Description
    bgfx.VertexLayoutHandle _layoutHandle

    Vertex layout handle.

    discard()

    Discard all previously set state for draw or compute call.

    Declaration
    public static void discard()

    dispatch(UInt16, bgfx.ProgramHandle, UInt32, UInt32, UInt32)

    Dispatch compute.

    Declaration
    public static void dispatch(ushort _id, bgfx.ProgramHandle _program, uint _numX, uint _numY, uint _numZ)
    Parameters
    Type Name Description
    UInt16 _id

    View id.

    bgfx.ProgramHandle _program

    Compute program.

    UInt32 _numX

    Number of groups X.

    UInt32 _numY

    Number of groups Y.

    UInt32 _numZ

    Number of groups Z.

    dispatch_indirect(UInt16, bgfx.ProgramHandle, bgfx.IndirectBufferHandle, UInt16, UInt16)

    Dispatch compute indirect.

    Declaration
    public static void dispatch_indirect(ushort _id, bgfx.ProgramHandle _program, bgfx.IndirectBufferHandle _indirectHandle, ushort _start, ushort _num)
    Parameters
    Type Name Description
    UInt16 _id

    View id.

    bgfx.ProgramHandle _program

    Compute program.

    bgfx.IndirectBufferHandle _indirectHandle

    Indirect buffer.

    UInt16 _start

    First element in indirect buffer.

    UInt16 _num

    Number of dispatches.

    encoder_alloc_transform(bgfx.Encoder*, bgfx.Transform*, UInt16)

    Reserve matrices in internal matrix cache. @attention Pointer returned can be modifed until bgfx::frame is called.

    Declaration
    public static uint encoder_alloc_transform(bgfx.Encoder*_this, bgfx.Transform*_transform, ushort _num)
    Parameters
    Type Name Description
    bgfx.Encoder* _this
    bgfx.Transform* _transform

    Pointer to Transform structure.

    UInt16 _num

    Number of matrices.

    Returns
    Type Description
    UInt32

    encoder_begin(Boolean)

    Begin submitting draw calls from thread.

    Declaration
    public static bgfx.Encoder*encoder_begin(bool _forThread)
    Parameters
    Type Name Description
    Boolean _forThread

    Explicitly request an encoder for a worker thread.

    Returns
    Type Description
    bgfx.Encoder*

    encoder_blit(bgfx.Encoder*, UInt16, bgfx.TextureHandle, Byte, UInt16, UInt16, UInt16, bgfx.TextureHandle, Byte, UInt16, UInt16, UInt16, UInt16, UInt16, UInt16)

    Blit 2D texture region between two 2D textures. @attention Destination texture must be created with BGFX_TEXTURE_BLIT_DST flag. @attention Availability depends on: BGFX_CAPS_TEXTURE_BLIT.

    Declaration
    public static void encoder_blit(bgfx.Encoder*_this, ushort _id, bgfx.TextureHandle _dst, byte _dstMip, ushort _dstX, ushort _dstY, ushort _dstZ, bgfx.TextureHandle _src, byte _srcMip, ushort _srcX, ushort _srcY, ushort _srcZ, ushort _width, ushort _height, ushort _depth)
    Parameters
    Type Name Description
    bgfx.Encoder* _this
    UInt16 _id

    View id.

    bgfx.TextureHandle _dst

    Destination texture handle.

    Byte _dstMip

    Destination texture mip level.

    UInt16 _dstX

    Destination texture X position.

    UInt16 _dstY

    Destination texture Y position.

    UInt16 _dstZ

    If texture is 2D this argument should be 0. If destination texture is cube this argument represents destination texture cube face. For 3D texture this argument represents destination texture Z position.

    bgfx.TextureHandle _src

    Source texture handle.

    Byte _srcMip

    Source texture mip level.

    UInt16 _srcX

    Source texture X position.

    UInt16 _srcY

    Source texture Y position.

    UInt16 _srcZ

    If texture is 2D this argument should be 0. If source texture is cube this argument represents source texture cube face. For 3D texture this argument represents source texture Z position.

    UInt16 _width

    Width of region.

    UInt16 _height

    Height of region.

    UInt16 _depth

    If texture is 3D this argument represents depth of region, otherwise it's unused.

    encoder_discard(bgfx.Encoder*)

    Discard all previously set state for draw or compute call.

    Declaration
    public static void encoder_discard(bgfx.Encoder*_this)
    Parameters
    Type Name Description
    bgfx.Encoder* _this

    encoder_dispatch(bgfx.Encoder*, UInt16, bgfx.ProgramHandle, UInt32, UInt32, UInt32)

    Dispatch compute.

    Declaration
    public static void encoder_dispatch(bgfx.Encoder*_this, ushort _id, bgfx.ProgramHandle _program, uint _numX, uint _numY, uint _numZ)
    Parameters
    Type Name Description
    bgfx.Encoder* _this
    UInt16 _id

    View id.

    bgfx.ProgramHandle _program

    Compute program.

    UInt32 _numX

    Number of groups X.

    UInt32 _numY

    Number of groups Y.

    UInt32 _numZ

    Number of groups Z.

    encoder_dispatch_indirect(bgfx.Encoder*, UInt16, bgfx.ProgramHandle, bgfx.IndirectBufferHandle, UInt16, UInt16)

    Dispatch compute indirect.

    Declaration
    public static void encoder_dispatch_indirect(bgfx.Encoder*_this, ushort _id, bgfx.ProgramHandle _program, bgfx.IndirectBufferHandle _indirectHandle, ushort _start, ushort _num)
    Parameters
    Type Name Description
    bgfx.Encoder* _this
    UInt16 _id

    View id.

    bgfx.ProgramHandle _program

    Compute program.

    bgfx.IndirectBufferHandle _indirectHandle

    Indirect buffer.

    UInt16 _start

    First element in indirect buffer.

    UInt16 _num

    Number of dispatches.

    encoder_end(bgfx.Encoder*)

    End submitting draw calls from thread.

    Declaration
    public static void encoder_end(bgfx.Encoder*_encoder)
    Parameters
    Type Name Description
    bgfx.Encoder* _encoder

    Encoder.

    encoder_set_compute_dynamic_index_buffer(bgfx.Encoder*, Byte, bgfx.DynamicIndexBufferHandle, bgfx.Access)

    Set compute dynamic index buffer.

    Declaration
    public static void encoder_set_compute_dynamic_index_buffer(bgfx.Encoder*_this, byte _stage, bgfx.DynamicIndexBufferHandle _handle, bgfx.Access _access)
    Parameters
    Type Name Description
    bgfx.Encoder* _this
    Byte _stage

    Compute stage.

    bgfx.DynamicIndexBufferHandle _handle

    Dynamic index buffer handle.

    bgfx.Access _access

    Buffer access. See Access::Enum.

    encoder_set_compute_dynamic_vertex_buffer(bgfx.Encoder*, Byte, bgfx.DynamicVertexBufferHandle, bgfx.Access)

    Set compute dynamic vertex buffer.

    Declaration
    public static void encoder_set_compute_dynamic_vertex_buffer(bgfx.Encoder*_this, byte _stage, bgfx.DynamicVertexBufferHandle _handle, bgfx.Access _access)
    Parameters
    Type Name Description
    bgfx.Encoder* _this
    Byte _stage

    Compute stage.

    bgfx.DynamicVertexBufferHandle _handle

    Dynamic vertex buffer handle.

    bgfx.Access _access

    Buffer access. See Access::Enum.

    encoder_set_compute_index_buffer(bgfx.Encoder*, Byte, bgfx.IndexBufferHandle, bgfx.Access)

    Set compute index buffer.

    Declaration
    public static void encoder_set_compute_index_buffer(bgfx.Encoder*_this, byte _stage, bgfx.IndexBufferHandle _handle, bgfx.Access _access)
    Parameters
    Type Name Description
    bgfx.Encoder* _this
    Byte _stage

    Compute stage.

    bgfx.IndexBufferHandle _handle

    Index buffer handle.

    bgfx.Access _access

    Buffer access. See Access::Enum.

    encoder_set_compute_indirect_buffer(bgfx.Encoder*, Byte, bgfx.IndirectBufferHandle, bgfx.Access)

    Set compute indirect buffer.

    Declaration
    public static void encoder_set_compute_indirect_buffer(bgfx.Encoder*_this, byte _stage, bgfx.IndirectBufferHandle _handle, bgfx.Access _access)
    Parameters
    Type Name Description
    bgfx.Encoder* _this
    Byte _stage

    Compute stage.

    bgfx.IndirectBufferHandle _handle

    Indirect buffer handle.

    bgfx.Access _access

    Buffer access. See Access::Enum.

    encoder_set_compute_vertex_buffer(bgfx.Encoder*, Byte, bgfx.VertexBufferHandle, bgfx.Access)

    Set compute vertex buffer.

    Declaration
    public static void encoder_set_compute_vertex_buffer(bgfx.Encoder*_this, byte _stage, bgfx.VertexBufferHandle _handle, bgfx.Access _access)
    Parameters
    Type Name Description
    bgfx.Encoder* _this
    Byte _stage

    Compute stage.

    bgfx.VertexBufferHandle _handle

    Vertex buffer handle.

    bgfx.Access _access

    Buffer access. See Access::Enum.

    encoder_set_condition(bgfx.Encoder*, bgfx.OcclusionQueryHandle, Boolean)

    Set condition for rendering.

    Declaration
    public static void encoder_set_condition(bgfx.Encoder*_this, bgfx.OcclusionQueryHandle _handle, bool _visible)
    Parameters
    Type Name Description
    bgfx.Encoder* _this
    bgfx.OcclusionQueryHandle _handle

    Occlusion query handle.

    Boolean _visible

    Render if occlusion query is visible.

    encoder_set_dynamic_index_buffer(bgfx.Encoder*, bgfx.DynamicIndexBufferHandle, UInt32, UInt32)

    Set index buffer for draw primitive.

    Declaration
    public static void encoder_set_dynamic_index_buffer(bgfx.Encoder*_this, bgfx.DynamicIndexBufferHandle _handle, uint _firstIndex, uint _numIndices)
    Parameters
    Type Name Description
    bgfx.Encoder* _this
    bgfx.DynamicIndexBufferHandle _handle

    Dynamic index buffer.

    UInt32 _firstIndex

    First index to render.

    UInt32 _numIndices

    Number of indices to render.

    encoder_set_dynamic_vertex_buffer(bgfx.Encoder*, Byte, bgfx.DynamicVertexBufferHandle, UInt32, UInt32, bgfx.VertexLayoutHandle)

    Set vertex buffer for draw primitive.

    Declaration
    public static void encoder_set_dynamic_vertex_buffer(bgfx.Encoder*_this, byte _stream, bgfx.DynamicVertexBufferHandle _handle, uint _startVertex, uint _numVertices, bgfx.VertexLayoutHandle _layoutHandle)
    Parameters
    Type Name Description
    bgfx.Encoder* _this
    Byte _stream

    Vertex stream.

    bgfx.DynamicVertexBufferHandle _handle

    Dynamic vertex buffer.

    UInt32 _startVertex

    First vertex to render.

    UInt32 _numVertices

    Number of vertices to render.

    bgfx.VertexLayoutHandle _layoutHandle

    Vertex layout for aliasing vertex buffer.

    encoder_set_image(bgfx.Encoder*, Byte, bgfx.TextureHandle, Byte, bgfx.Access, bgfx.TextureFormat)

    Set compute image from texture.

    Declaration
    public static void encoder_set_image(bgfx.Encoder*_this, byte _stage, bgfx.TextureHandle _handle, byte _mip, bgfx.Access _access, bgfx.TextureFormat _format)
    Parameters
    Type Name Description
    bgfx.Encoder* _this
    Byte _stage

    Compute stage.

    bgfx.TextureHandle _handle

    Texture handle.

    Byte _mip

    Mip level.

    bgfx.Access _access

    Image access. See Access::Enum.

    bgfx.TextureFormat _format

    Texture format. See: TextureFormat::Enum.

    encoder_set_index_buffer(bgfx.Encoder*, bgfx.IndexBufferHandle, UInt32, UInt32)

    Set index buffer for draw primitive.

    Declaration
    public static void encoder_set_index_buffer(bgfx.Encoder*_this, bgfx.IndexBufferHandle _handle, uint _firstIndex, uint _numIndices)
    Parameters
    Type Name Description
    bgfx.Encoder* _this
    bgfx.IndexBufferHandle _handle

    Index buffer.

    UInt32 _firstIndex

    First index to render.

    UInt32 _numIndices

    Number of indices to render.

    encoder_set_instance_count(bgfx.Encoder*, UInt32)

    Set number of instances for auto generated instances use in conjuction with gl_InstanceID. @attention Availability depends on: BGFX_CAPS_VERTEX_ID.

    Declaration
    public static void encoder_set_instance_count(bgfx.Encoder*_this, uint _numInstances)
    Parameters
    Type Name Description
    bgfx.Encoder* _this
    UInt32 _numInstances

    encoder_set_instance_data_buffer(bgfx.Encoder*, bgfx.InstanceDataBuffer*, UInt32, UInt32)

    Set instance data buffer for draw primitive.

    Declaration
    public static void encoder_set_instance_data_buffer(bgfx.Encoder*_this, bgfx.InstanceDataBuffer*_idb, uint _start, uint _num)
    Parameters
    Type Name Description
    bgfx.Encoder* _this
    bgfx.InstanceDataBuffer* _idb

    Transient instance data buffer.

    UInt32 _start

    First instance data.

    UInt32 _num

    Number of data instances.

    encoder_set_instance_data_from_dynamic_vertex_buffer(bgfx.Encoder*, bgfx.DynamicVertexBufferHandle, UInt32, UInt32)

    Set instance data buffer for draw primitive.

    Declaration
    public static void encoder_set_instance_data_from_dynamic_vertex_buffer(bgfx.Encoder*_this, bgfx.DynamicVertexBufferHandle _handle, uint _startVertex, uint _num)
    Parameters
    Type Name Description
    bgfx.Encoder* _this
    bgfx.DynamicVertexBufferHandle _handle

    Dynamic vertex buffer.

    UInt32 _startVertex

    First instance data.

    UInt32 _num

    Number of data instances.

    encoder_set_instance_data_from_vertex_buffer(bgfx.Encoder*, bgfx.VertexBufferHandle, UInt32, UInt32)

    Set instance data buffer for draw primitive.

    Declaration
    public static void encoder_set_instance_data_from_vertex_buffer(bgfx.Encoder*_this, bgfx.VertexBufferHandle _handle, uint _startVertex, uint _num)
    Parameters
    Type Name Description
    bgfx.Encoder* _this
    bgfx.VertexBufferHandle _handle

    Vertex buffer.

    UInt32 _startVertex

    First instance data.

    UInt32 _num

    Number of data instances. Set instance data buffer for draw primitive.

    encoder_set_marker(bgfx.Encoder*, String)

    Sets a debug marker. This allows you to group graphics calls together for easy browsing in graphics debugging tools.

    Declaration
    public static void encoder_set_marker(bgfx.Encoder*_this, string _marker)
    Parameters
    Type Name Description
    bgfx.Encoder* _this
    String _marker

    Marker string.

    encoder_set_scissor(bgfx.Encoder*, UInt16, UInt16, UInt16, UInt16)

    Set scissor for draw primitive. @remark To scissor for all primitives in view see bgfx::setViewScissor.

    Declaration
    public static ushort encoder_set_scissor(bgfx.Encoder*_this, ushort _x, ushort _y, ushort _width, ushort _height)
    Parameters
    Type Name Description
    bgfx.Encoder* _this
    UInt16 _x

    Position x from the left corner of the window.

    UInt16 _y

    Position y from the top corner of the window.

    UInt16 _width

    Width of view scissor region.

    UInt16 _height

    Height of view scissor region.

    Returns
    Type Description
    UInt16

    encoder_set_scissor_cached(bgfx.Encoder*, UInt16)

    Set scissor from cache for draw primitive. @remark To scissor for all primitives in view see bgfx::setViewScissor.

    Declaration
    public static void encoder_set_scissor_cached(bgfx.Encoder*_this, ushort _cache)
    Parameters
    Type Name Description
    bgfx.Encoder* _this
    UInt16 _cache

    Index in scissor cache.

    encoder_set_state(bgfx.Encoder*, UInt64, UInt32)

    Set render states for draw primitive. @remarks

    1. To setup more complex states use: BGFX_STATE_ALPHA_REF(_ref), BGFX_STATE_POINT_SIZE(_size), BGFX_STATE_BLEND_FUNC(_src, _dst), BGFX_STATE_BLEND_FUNC_SEPARATE(_srcRGB, _dstRGB, _srcA, _dstA), BGFX_STATE_BLEND_EQUATION(_equation), BGFX_STATE_BLEND_EQUATION_SEPARATE(_equationRGB, _equationA)
    2. BGFX_STATE_BLEND_EQUATION_ADD is set when no other blend equation is specified.
    Declaration
    public static void encoder_set_state(bgfx.Encoder*_this, ulong _state, uint _rgba)
    Parameters
    Type Name Description
    bgfx.Encoder* _this
    UInt64 _state

    State flags. Default state for primitive type is triangles. See: BGFX_STATE_DEFAULT. - BGFX_STATE_DEPTH_TEST_* - Depth test function. - BGFX_STATE_BLEND_* - See remark 1 about BGFX_STATE_BLEND_FUNC. - BGFX_STATE_BLEND_EQUATION_* - See remark 2. - BGFX_STATE_CULL_* - Backface culling mode. - BGFX_STATE_WRITE_* - Enable R, G, B, A or Z write. - BGFX_STATE_MSAA - Enable hardware multisample antialiasing. - BGFX_STATE_PT_[TRISTRIP/LINES/POINTS] - Primitive type.

    UInt32 _rgba

    Sets blend factor used by BGFX_STATE_BLEND_FACTOR and BGFX_STATE_BLEND_INV_FACTOR blend modes.

    encoder_set_stencil(bgfx.Encoder*, UInt32, UInt32)

    Set stencil test state.

    Declaration
    public static void encoder_set_stencil(bgfx.Encoder*_this, uint _fstencil, uint _bstencil)
    Parameters
    Type Name Description
    bgfx.Encoder* _this
    UInt32 _fstencil

    Front stencil state.

    UInt32 _bstencil

    Back stencil state. If back is set to BGFX_STENCIL_NONE _fstencil is applied to both front and back facing primitives.

    encoder_set_texture(bgfx.Encoder*, Byte, bgfx.UniformHandle, bgfx.TextureHandle, UInt32)

    Set texture stage for draw primitive.

    Declaration
    public static void encoder_set_texture(bgfx.Encoder*_this, byte _stage, bgfx.UniformHandle _sampler, bgfx.TextureHandle _handle, uint _flags)
    Parameters
    Type Name Description
    bgfx.Encoder* _this
    Byte _stage

    Texture unit.

    bgfx.UniformHandle _sampler

    Program sampler.

    bgfx.TextureHandle _handle

    Texture handle.

    UInt32 _flags

    Texture sampling mode. Default value UINT32_MAX uses texture sampling settings from the texture. - BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP] - Mirror or clamp to edge wrap mode. - BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC] - Point or anisotropic sampling.

    encoder_set_transform(bgfx.Encoder*, Void*, UInt16)

    Set model matrix for draw primitive. If it is not called, the model will be rendered with an identity model matrix.

    Declaration
    public static uint encoder_set_transform(bgfx.Encoder*_this, void *_mtx, ushort _num)
    Parameters
    Type Name Description
    bgfx.Encoder* _this
    Void* _mtx

    Pointer to first matrix in array.

    UInt16 _num

    Number of matrices in array.

    Returns
    Type Description
    UInt32

    encoder_set_transform_cached(bgfx.Encoder*, UInt32, UInt16)

    Set model matrix from matrix cache for draw primitive.

    Declaration
    public static void encoder_set_transform_cached(bgfx.Encoder*_this, uint _cache, ushort _num)
    Parameters
    Type Name Description
    bgfx.Encoder* _this
    UInt32 _cache

    Index in matrix cache.

    UInt16 _num

    Number of matrices from cache.

    encoder_set_transient_index_buffer(bgfx.Encoder*, bgfx.TransientIndexBuffer*, UInt32, UInt32)

    Set index buffer for draw primitive.

    Declaration
    public static void encoder_set_transient_index_buffer(bgfx.Encoder*_this, bgfx.TransientIndexBuffer*_tib, uint _firstIndex, uint _numIndices)
    Parameters
    Type Name Description
    bgfx.Encoder* _this
    bgfx.TransientIndexBuffer* _tib

    Transient index buffer.

    UInt32 _firstIndex

    First index to render.

    UInt32 _numIndices

    Number of indices to render.

    encoder_set_transient_vertex_buffer(bgfx.Encoder*, Byte, bgfx.TransientVertexBuffer*, UInt32, UInt32, bgfx.VertexLayoutHandle)

    Set vertex buffer for draw primitive.

    Declaration
    public static void encoder_set_transient_vertex_buffer(bgfx.Encoder*_this, byte _stream, bgfx.TransientVertexBuffer*_tvb, uint _startVertex, uint _numVertices, bgfx.VertexLayoutHandle _layoutHandle)
    Parameters
    Type Name Description
    bgfx.Encoder* _this
    Byte _stream

    Vertex stream.

    bgfx.TransientVertexBuffer* _tvb

    Transient vertex buffer.

    UInt32 _startVertex

    First vertex to render.

    UInt32 _numVertices

    Number of vertices to render.

    bgfx.VertexLayoutHandle _layoutHandle

    Vertex layout for aliasing vertex buffer.

    encoder_set_uniform(bgfx.Encoder*, bgfx.UniformHandle, Void*, UInt16)

    Set shader uniform parameter for draw primitive.

    Declaration
    public static void encoder_set_uniform(bgfx.Encoder*_this, bgfx.UniformHandle _handle, void *_value, ushort _num)
    Parameters
    Type Name Description
    bgfx.Encoder* _this
    bgfx.UniformHandle _handle

    Uniform.

    Void* _value

    Pointer to uniform data.

    UInt16 _num

    Number of elements. Passing UINT16_MAX will use the _num passed on uniform creation.

    encoder_set_vertex_buffer(bgfx.Encoder*, Byte, bgfx.VertexBufferHandle, UInt32, UInt32, bgfx.VertexLayoutHandle)

    Set vertex buffer for draw primitive.

    Declaration
    public static void encoder_set_vertex_buffer(bgfx.Encoder*_this, byte _stream, bgfx.VertexBufferHandle _handle, uint _startVertex, uint _numVertices, bgfx.VertexLayoutHandle _layoutHandle)
    Parameters
    Type Name Description
    bgfx.Encoder* _this
    Byte _stream

    Vertex stream.

    bgfx.VertexBufferHandle _handle

    Vertex buffer.

    UInt32 _startVertex

    First vertex to render.

    UInt32 _numVertices

    Number of vertices to render.

    bgfx.VertexLayoutHandle _layoutHandle

    Vertex layout for aliasing vertex buffer.

    encoder_set_vertex_count(bgfx.Encoder*, UInt32)

    Set number of vertices for auto generated vertices use in conjuction with gl_VertexID. @attention Availability depends on: BGFX_CAPS_VERTEX_ID.

    Declaration
    public static void encoder_set_vertex_count(bgfx.Encoder*_this, uint _numVertices)
    Parameters
    Type Name Description
    bgfx.Encoder* _this
    UInt32 _numVertices

    Number of vertices.

    encoder_submit(bgfx.Encoder*, UInt16, bgfx.ProgramHandle, UInt32, Boolean)

    Submit primitive for rendering.

    Declaration
    public static void encoder_submit(bgfx.Encoder*_this, ushort _id, bgfx.ProgramHandle _program, uint _depth, bool _preserveState)
    Parameters
    Type Name Description
    bgfx.Encoder* _this
    UInt16 _id

    View id.

    bgfx.ProgramHandle _program

    Program.

    UInt32 _depth

    Depth for sorting.

    Boolean _preserveState

    Preserve internal draw state for next draw call submit.

    encoder_submit_indirect(bgfx.Encoder*, UInt16, bgfx.ProgramHandle, bgfx.IndirectBufferHandle, UInt16, UInt16, UInt32, Boolean)

    Submit primitive for rendering with index and instance data info from indirect buffer.

    Declaration
    public static void encoder_submit_indirect(bgfx.Encoder*_this, ushort _id, bgfx.ProgramHandle _program, bgfx.IndirectBufferHandle _indirectHandle, ushort _start, ushort _num, uint _depth, bool _preserveState)
    Parameters
    Type Name Description
    bgfx.Encoder* _this
    UInt16 _id

    View id.

    bgfx.ProgramHandle _program

    Program.

    bgfx.IndirectBufferHandle _indirectHandle

    Indirect buffer.

    UInt16 _start

    First element in indirect buffer.

    UInt16 _num

    Number of dispatches.

    UInt32 _depth

    Depth for sorting.

    Boolean _preserveState

    Preserve internal draw state for next draw call submit.

    encoder_submit_occlusion_query(bgfx.Encoder*, UInt16, bgfx.ProgramHandle, bgfx.OcclusionQueryHandle, UInt32, Boolean)

    Submit primitive with occlusion query for rendering.

    Declaration
    public static void encoder_submit_occlusion_query(bgfx.Encoder*_this, ushort _id, bgfx.ProgramHandle _program, bgfx.OcclusionQueryHandle _occlusionQuery, uint _depth, bool _preserveState)
    Parameters
    Type Name Description
    bgfx.Encoder* _this
    UInt16 _id

    View id.

    bgfx.ProgramHandle _program

    Program.

    bgfx.OcclusionQueryHandle _occlusionQuery

    Occlusion query.

    UInt32 _depth

    Depth for sorting.

    Boolean _preserveState

    Preserve internal draw state for next draw call submit.

    encoder_touch(bgfx.Encoder*, UInt16)

    Submit an empty primitive for rendering. Uniforms and draw state will be applied but no geometry will be submitted. @remark These empty draw calls will sort before ordinary draw calls.

    Declaration
    public static void encoder_touch(bgfx.Encoder*_this, ushort _id)
    Parameters
    Type Name Description
    bgfx.Encoder* _this
    UInt16 _id

    View id.

    frame(Boolean)

    Advance to next frame. When using multithreaded renderer, this call just swaps internal buffers, kicks render thread, and returns. In singlethreaded renderer this call does frame rendering.

    Declaration
    public static uint frame(bool _capture)
    Parameters
    Type Name Description
    Boolean _capture

    Capture frame with graphics debugger.

    Returns
    Type Description
    UInt32

    get_avail_instance_data_buffer(UInt32, UInt16)

    Returns number of requested or maximum available instance buffer slots.

    Declaration
    public static uint get_avail_instance_data_buffer(uint _num, ushort _stride)
    Parameters
    Type Name Description
    UInt32 _num

    Number of required instances.

    UInt16 _stride

    Stride per instance.

    Returns
    Type Description
    UInt32

    get_avail_transient_index_buffer(UInt32)

    Returns number of requested or maximum available indices.

    Declaration
    public static uint get_avail_transient_index_buffer(uint _num)
    Parameters
    Type Name Description
    UInt32 _num

    Number of required indices.

    Returns
    Type Description
    UInt32

    get_avail_transient_vertex_buffer(UInt32, bgfx.VertexLayout*)

    Returns number of requested or maximum available vertices.

    Declaration
    public static uint get_avail_transient_vertex_buffer(uint _num, bgfx.VertexLayout*_layout)
    Parameters
    Type Name Description
    UInt32 _num

    Number of required vertices.

    bgfx.VertexLayout* _layout

    Vertex layout.

    Returns
    Type Description
    UInt32

    get_caps()

    Returns renderer capabilities. @remarks Library must be initialized.

    Declaration
    public static bgfx.Caps*get_caps()
    Returns
    Type Description
    bgfx.Caps*

    get_direct_access_ptr(bgfx.TextureHandle)

    Returns texture direct access pointer. @attention Availability depends on: BGFX_CAPS_TEXTURE_DIRECT_ACCESS. This feature is available on GPUs that have unified memory architecture (UMA) support.

    Declaration
    public static void *get_direct_access_ptr(bgfx.TextureHandle _handle)
    Parameters
    Type Name Description
    bgfx.TextureHandle _handle

    Texture handle.

    Returns
    Type Description
    Void*

    get_internal_data()

    Get internal data for interop. @attention It's expected you understand some bgfx internals before you use this call. @warning Must be called only on render thread.

    Declaration
    public static bgfx.InternalData*get_internal_data()
    Returns
    Type Description
    bgfx.InternalData*

    get_renderer_name(bgfx.RendererType)

    Returns name of renderer.

    Declaration
    public static IntPtr get_renderer_name(bgfx.RendererType _type)
    Parameters
    Type Name Description
    bgfx.RendererType _type

    Renderer backend type. See: bgfx::RendererType

    Returns
    Type Description
    IntPtr

    get_renderer_type()

    Returns current renderer backend API type. @remarks Library must be initialized.

    Declaration
    public static bgfx.RendererType get_renderer_type()
    Returns
    Type Description
    bgfx.RendererType

    get_result(bgfx.OcclusionQueryHandle, Int32*)

    Retrieve occlusion query result from previous frame.

    Declaration
    public static bgfx.OcclusionQueryResult get_result(bgfx.OcclusionQueryHandle _handle, int *_result)
    Parameters
    Type Name Description
    bgfx.OcclusionQueryHandle _handle

    Handle to occlusion query object.

    Int32* _result

    Number of pixels that passed test. This argument can be NULL if result of occlusion query is not needed.

    Returns
    Type Description
    bgfx.OcclusionQueryResult

    get_shader_uniforms(bgfx.ShaderHandle, bgfx.UniformHandle*, UInt16)

    Returns the number of uniforms and uniform handles used inside a shader. @remarks Only non-predefined uniforms are returned.

    Declaration
    public static ushort get_shader_uniforms(bgfx.ShaderHandle _handle, bgfx.UniformHandle*_uniforms, ushort _max)
    Parameters
    Type Name Description
    bgfx.ShaderHandle _handle

    Shader handle.

    bgfx.UniformHandle* _uniforms

    UniformHandle array where data will be stored.

    UInt16 _max

    Maximum capacity of array.

    Returns
    Type Description
    UInt16

    get_stats()

    Returns performance counters. @attention Pointer returned is valid until bgfx::frame is called.

    Declaration
    public static bgfx.Stats*get_stats()
    Returns
    Type Description
    bgfx.Stats*

    get_supported_renderers(Byte, bgfx.RendererType*)

    Returns supported backend API renderers.

    Declaration
    public static byte get_supported_renderers(byte _max, bgfx.RendererType*_enum)
    Parameters
    Type Name Description
    Byte _max

    Maximum number of elements in _enum array.

    bgfx.RendererType* _enum

    Array where supported renderers will be written.

    Returns
    Type Description
    Byte

    get_texture(bgfx.FrameBufferHandle, Byte)

    Obtain texture handle of frame buffer attachment.

    Declaration
    public static bgfx.TextureHandle get_texture(bgfx.FrameBufferHandle _handle, byte _attachment)
    Parameters
    Type Name Description
    bgfx.FrameBufferHandle _handle

    Frame buffer handle.

    Byte _attachment
    Returns
    Type Description
    bgfx.TextureHandle

    get_uniform_info(bgfx.UniformHandle, bgfx.UniformInfo*)

    Retrieve uniform info.

    Declaration
    public static void get_uniform_info(bgfx.UniformHandle _handle, bgfx.UniformInfo*_info)
    Parameters
    Type Name Description
    bgfx.UniformHandle _handle

    Handle to uniform object.

    bgfx.UniformInfo* _info

    Uniform info.

    init(bgfx.Init*)

    Initialize bgfx library.

    Declaration
    public static bool init(bgfx.Init*_init)
    Parameters
    Type Name Description
    bgfx.Init* _init

    Initialization parameters. See: bgfx::Init for more info.

    Returns
    Type Description
    Boolean

    init_ctor(bgfx.Init*)

    Declaration
    public static void init_ctor(bgfx.Init*_init)
    Parameters
    Type Name Description
    bgfx.Init* _init

    is_texture_valid(UInt16, Boolean, UInt16, bgfx.TextureFormat, UInt64)

    Validate texture parameters.

    Declaration
    public static bool is_texture_valid(ushort _depth, bool _cubeMap, ushort _numLayers, bgfx.TextureFormat _format, ulong _flags)
    Parameters
    Type Name Description
    UInt16 _depth

    Depth dimension of volume texture.

    Boolean _cubeMap

    Indicates that texture contains cubemap.

    UInt16 _numLayers

    Number of layers in texture array.

    bgfx.TextureFormat _format

    Texture format. See: TextureFormat::Enum.

    UInt64 _flags

    Texture flags. See BGFX_TEXTURE_*.

    Returns
    Type Description
    Boolean

    make_ref(Void*, UInt32)

    Make reference to data to pass to bgfx. Unlike bgfx::alloc, this call doesn't allocate memory for data. It just copies the _data pointer. You can pass ReleaseFn function pointer to release this memory after it's consumed, otherwise you must make sure _data is available for at least 2 bgfx::frame calls. ReleaseFn function must be able to be called from any thread. @attention Data passed must be available for at least 2 bgfx::frame calls.

    Declaration
    public static bgfx.Memory*make_ref(void *_data, uint _size)
    Parameters
    Type Name Description
    Void* _data

    Pointer to data.

    UInt32 _size

    Size of data.

    Returns
    Type Description
    bgfx.Memory*

    make_ref_release(Void*, UInt32, IntPtr, Void*)

    Make reference to data to pass to bgfx. Unlike bgfx::alloc, this call doesn't allocate memory for data. It just copies the _data pointer. You can pass ReleaseFn function pointer to release this memory after it's consumed, otherwise you must make sure _data is available for at least 2 bgfx::frame calls. ReleaseFn function must be able to be called from any thread. @attention Data passed must be available for at least 2 bgfx::frame calls.

    Declaration
    public static bgfx.Memory*make_ref_release(void *_data, uint _size, IntPtr _releaseFn, void *_userData)
    Parameters
    Type Name Description
    Void* _data

    Pointer to data.

    UInt32 _size

    Size of data.

    IntPtr _releaseFn

    Callback function to release memory after use.

    Void* _userData

    User data to be passed to callback function.

    Returns
    Type Description
    bgfx.Memory*

    override_internal_texture(bgfx.TextureHandle, UInt16, UInt16, Byte, bgfx.TextureFormat, UInt64)

    Override internal texture by creating new texture. Previously created internal texture will released. @attention It's expected you understand some bgfx internals before you use this call. @returns Native API pointer to texture. If result is 0, texture is not created yet from the main thread. @warning Must be called only on render thread.

    Declaration
    public static UIntPtr override_internal_texture(bgfx.TextureHandle _handle, ushort _width, ushort _height, byte _numMips, bgfx.TextureFormat _format, ulong _flags)
    Parameters
    Type Name Description
    bgfx.TextureHandle _handle

    Texture handle.

    UInt16 _width

    Width.

    UInt16 _height

    Height.

    Byte _numMips

    Number of mip-maps.

    bgfx.TextureFormat _format

    Texture format. See: TextureFormat::Enum.

    UInt64 _flags

    Texture creation (see BGFX_TEXTURE_*.), and sampler (see BGFX_SAMPLER_*) flags. Default texture sampling mode is linear, and wrap mode is repeat. - BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP] - Mirror or clamp to edge wrap mode. - BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC] - Point or anisotropic sampling.

    Returns
    Type Description
    UIntPtr

    override_internal_texture_ptr(bgfx.TextureHandle, UIntPtr)

    Override internal texture with externally created texture. Previously created internal texture will released. @attention It's expected you understand some bgfx internals before you use this call. @warning Must be called only on render thread.

    Declaration
    public static UIntPtr override_internal_texture_ptr(bgfx.TextureHandle _handle, UIntPtr _ptr)
    Parameters
    Type Name Description
    bgfx.TextureHandle _handle

    Texture handle.

    UIntPtr _ptr

    Native API pointer to texture.

    Returns
    Type Description
    UIntPtr

    read_texture(bgfx.TextureHandle, Void*, Byte)

    Read back texture content. @attention Texture must be created with BGFX_TEXTURE_READ_BACK flag. @attention Availability depends on: BGFX_CAPS_TEXTURE_READ_BACK.

    Declaration
    public static uint read_texture(bgfx.TextureHandle _handle, void *_data, byte _mip)
    Parameters
    Type Name Description
    bgfx.TextureHandle _handle

    Texture handle.

    Void* _data

    Destination buffer.

    Byte _mip

    Mip level.

    Returns
    Type Description
    UInt32

    render_frame(Int32)

    Render frame. @attention bgfx::renderFrame is blocking call. It waits for bgfx::frame to be called from API thread to process frame. If timeout value is passed call will timeout and return even if bgfx::frame is not called. @warning This call should be only used on platforms that don't allow creating separate rendering thread. If it is called before to bgfx::init, render thread won't be created by bgfx::init call.

    Declaration
    public static bgfx.RenderFrame render_frame(int _msecs)
    Parameters
    Type Name Description
    Int32 _msecs

    Timeout in milliseconds.

    Returns
    Type Description
    bgfx.RenderFrame

    request_screen_shot(bgfx.FrameBufferHandle, String)

    Request screen shot of window back buffer. @remarks bgfx::CallbackI::screenShot must be implemented. @attention Frame buffer handle must be created with OS' target native window handle.

    Declaration
    public static void request_screen_shot(bgfx.FrameBufferHandle _handle, string _filePath)
    Parameters
    Type Name Description
    bgfx.FrameBufferHandle _handle

    Frame buffer handle. If handle is BGFX_INVALID_HANDLE request will be made for main window back buffer.

    String _filePath

    Will be passed to bgfx::CallbackI::screenShot callback.

    reset(UInt32, UInt32, UInt32, bgfx.TextureFormat)

    Reset graphic settings and back-buffer size. @attention This call doesn't actually change window size, it just resizes back-buffer. Windowing code has to change window size.

    Declaration
    public static void reset(uint _width, uint _height, uint _flags, bgfx.TextureFormat _format)
    Parameters
    Type Name Description
    UInt32 _width

    Back-buffer width.

    UInt32 _height

    Back-buffer height.

    UInt32 _flags

    See: BGFX_RESET_* for more info. - BGFX_RESET_NONE - No reset flags. - BGFX_RESET_FULLSCREEN - Not supported yet. - BGFX_RESET_MSAA_X[2/4/8/16] - Enable 2, 4, 8 or 16 x MSAA. - BGFX_RESET_VSYNC - Enable V-Sync. - BGFX_RESET_MAXANISOTROPY - Turn on/off max anisotropy. - BGFX_RESET_CAPTURE - Begin screen capture. - BGFX_RESET_FLUSH_AFTER_RENDER - Flush rendering after submitting to GPU. - BGFX_RESET_FLIP_AFTER_RENDER - This flag specifies where flip occurs. Default behavior is that flip occurs before rendering new frame. This flag only has effect when BGFX_CONFIG_MULTITHREADED=0. - BGFX_RESET_SRGB_BACKBUFFER - Enable sRGB backbuffer.

    bgfx.TextureFormat _format

    Texture format. See: TextureFormat::Enum.

    set_compute_dynamic_index_buffer(Byte, bgfx.DynamicIndexBufferHandle, bgfx.Access)

    Set compute dynamic index buffer.

    Declaration
    public static void set_compute_dynamic_index_buffer(byte _stage, bgfx.DynamicIndexBufferHandle _handle, bgfx.Access _access)
    Parameters
    Type Name Description
    Byte _stage

    Compute stage.

    bgfx.DynamicIndexBufferHandle _handle

    Dynamic index buffer handle.

    bgfx.Access _access

    Buffer access. See Access::Enum.

    set_compute_dynamic_vertex_buffer(Byte, bgfx.DynamicVertexBufferHandle, bgfx.Access)

    Set compute dynamic vertex buffer.

    Declaration
    public static void set_compute_dynamic_vertex_buffer(byte _stage, bgfx.DynamicVertexBufferHandle _handle, bgfx.Access _access)
    Parameters
    Type Name Description
    Byte _stage

    Compute stage.

    bgfx.DynamicVertexBufferHandle _handle

    Dynamic vertex buffer handle.

    bgfx.Access _access

    Buffer access. See Access::Enum.

    set_compute_index_buffer(Byte, bgfx.IndexBufferHandle, bgfx.Access)

    Set compute index buffer.

    Declaration
    public static void set_compute_index_buffer(byte _stage, bgfx.IndexBufferHandle _handle, bgfx.Access _access)
    Parameters
    Type Name Description
    Byte _stage

    Compute stage.

    bgfx.IndexBufferHandle _handle

    Index buffer handle.

    bgfx.Access _access

    Buffer access. See Access::Enum.

    set_compute_indirect_buffer(Byte, bgfx.IndirectBufferHandle, bgfx.Access)

    Set compute indirect buffer.

    Declaration
    public static void set_compute_indirect_buffer(byte _stage, bgfx.IndirectBufferHandle _handle, bgfx.Access _access)
    Parameters
    Type Name Description
    Byte _stage

    Compute stage.

    bgfx.IndirectBufferHandle _handle

    Indirect buffer handle.

    bgfx.Access _access

    Buffer access. See Access::Enum.

    set_compute_vertex_buffer(Byte, bgfx.VertexBufferHandle, bgfx.Access)

    Set compute vertex buffer.

    Declaration
    public static void set_compute_vertex_buffer(byte _stage, bgfx.VertexBufferHandle _handle, bgfx.Access _access)
    Parameters
    Type Name Description
    Byte _stage

    Compute stage.

    bgfx.VertexBufferHandle _handle

    Vertex buffer handle.

    bgfx.Access _access

    Buffer access. See Access::Enum.

    set_condition(bgfx.OcclusionQueryHandle, Boolean)

    Set condition for rendering.

    Declaration
    public static void set_condition(bgfx.OcclusionQueryHandle _handle, bool _visible)
    Parameters
    Type Name Description
    bgfx.OcclusionQueryHandle _handle

    Occlusion query handle.

    Boolean _visible

    Render if occlusion query is visible.

    set_debug(UInt32)

    Set debug flags.

    Declaration
    public static void set_debug(uint _debug)
    Parameters
    Type Name Description
    UInt32 _debug

    Available flags: - BGFX_DEBUG_IFH - Infinitely fast hardware. When this flag is set all rendering calls will be skipped. This is useful when profiling to quickly assess potential bottlenecks between CPU and GPU. - BGFX_DEBUG_PROFILER - Enable profiler. - BGFX_DEBUG_STATS - Display internal statistics. - BGFX_DEBUG_TEXT - Display debug text. - BGFX_DEBUG_WIREFRAME - Wireframe rendering. All rendering primitives will be rendered as lines.

    set_dynamic_index_buffer(bgfx.DynamicIndexBufferHandle, UInt32, UInt32)

    Set index buffer for draw primitive.

    Declaration
    public static void set_dynamic_index_buffer(bgfx.DynamicIndexBufferHandle _handle, uint _firstIndex, uint _numIndices)
    Parameters
    Type Name Description
    bgfx.DynamicIndexBufferHandle _handle

    Dynamic index buffer.

    UInt32 _firstIndex

    First index to render.

    UInt32 _numIndices

    Number of indices to render.

    set_dynamic_vertex_buffer(Byte, bgfx.DynamicVertexBufferHandle, UInt32, UInt32)

    Set vertex buffer for draw primitive.

    Declaration
    public static void set_dynamic_vertex_buffer(byte _stream, bgfx.DynamicVertexBufferHandle _handle, uint _startVertex, uint _numVertices)
    Parameters
    Type Name Description
    Byte _stream

    Vertex stream.

    bgfx.DynamicVertexBufferHandle _handle

    Dynamic vertex buffer.

    UInt32 _startVertex

    First vertex to render.

    UInt32 _numVertices

    Number of vertices to render.

    set_frame_buffer_name(bgfx.FrameBufferHandle, String, Int32)

    Set frame buffer debug name.

    Declaration
    public static void set_frame_buffer_name(bgfx.FrameBufferHandle _handle, string _name, int _len)
    Parameters
    Type Name Description
    bgfx.FrameBufferHandle _handle

    Frame buffer handle.

    String _name

    Frame buffer name.

    Int32 _len

    Frame buffer name length (if length is INT32_MAX, it's expected that _name is zero terminated string.

    set_image(Byte, bgfx.TextureHandle, Byte, bgfx.Access, bgfx.TextureFormat)

    Set compute image from texture.

    Declaration
    public static void set_image(byte _stage, bgfx.TextureHandle _handle, byte _mip, bgfx.Access _access, bgfx.TextureFormat _format)
    Parameters
    Type Name Description
    Byte _stage

    Compute stage.

    bgfx.TextureHandle _handle

    Texture handle.

    Byte _mip

    Mip level.

    bgfx.Access _access

    Image access. See Access::Enum.

    bgfx.TextureFormat _format

    Texture format. See: TextureFormat::Enum.

    set_index_buffer(bgfx.IndexBufferHandle, UInt32, UInt32)

    Set index buffer for draw primitive.

    Declaration
    public static void set_index_buffer(bgfx.IndexBufferHandle _handle, uint _firstIndex, uint _numIndices)
    Parameters
    Type Name Description
    bgfx.IndexBufferHandle _handle

    Index buffer.

    UInt32 _firstIndex

    First index to render.

    UInt32 _numIndices

    Number of indices to render.

    set_index_buffer_name(bgfx.IndexBufferHandle, String, Int32)

    Set static index buffer debug name.

    Declaration
    public static void set_index_buffer_name(bgfx.IndexBufferHandle _handle, string _name, int _len)
    Parameters
    Type Name Description
    bgfx.IndexBufferHandle _handle

    Static index buffer handle.

    String _name

    Static index buffer name.

    Int32 _len

    Static index buffer name length (if length is INT32_MAX, it's expected that _name is zero terminated string.

    set_instance_count(UInt32)

    Set number of instances for auto generated instances use in conjuction with gl_InstanceID. @attention Availability depends on: BGFX_CAPS_VERTEX_ID.

    Declaration
    public static void set_instance_count(uint _numInstances)
    Parameters
    Type Name Description
    UInt32 _numInstances

    set_instance_data_buffer(bgfx.InstanceDataBuffer*, UInt32, UInt32)

    Set instance data buffer for draw primitive.

    Declaration
    public static void set_instance_data_buffer(bgfx.InstanceDataBuffer*_idb, uint _start, uint _num)
    Parameters
    Type Name Description
    bgfx.InstanceDataBuffer* _idb

    Transient instance data buffer.

    UInt32 _start

    First instance data.

    UInt32 _num

    Number of data instances.

    set_instance_data_from_dynamic_vertex_buffer(bgfx.DynamicVertexBufferHandle, UInt32, UInt32)

    Set instance data buffer for draw primitive.

    Declaration
    public static void set_instance_data_from_dynamic_vertex_buffer(bgfx.DynamicVertexBufferHandle _handle, uint _startVertex, uint _num)
    Parameters
    Type Name Description
    bgfx.DynamicVertexBufferHandle _handle

    Dynamic vertex buffer.

    UInt32 _startVertex

    First instance data.

    UInt32 _num

    Number of data instances.

    set_instance_data_from_vertex_buffer(bgfx.VertexBufferHandle, UInt32, UInt32)

    Set instance data buffer for draw primitive.

    Declaration
    public static void set_instance_data_from_vertex_buffer(bgfx.VertexBufferHandle _handle, uint _startVertex, uint _num)
    Parameters
    Type Name Description
    bgfx.VertexBufferHandle _handle

    Vertex buffer.

    UInt32 _startVertex

    First instance data.

    UInt32 _num

    Number of data instances. Set instance data buffer for draw primitive.

    set_marker(String)

    Sets a debug marker. This allows you to group graphics calls together for easy browsing in graphics debugging tools.

    Declaration
    public static void set_marker(string _marker)
    Parameters
    Type Name Description
    String _marker

    Marker string.

    set_palette_color(Byte, Single)

    Set palette color value.

    Declaration
    public static void set_palette_color(byte _index, float _rgba)
    Parameters
    Type Name Description
    Byte _index

    Index into palette.

    Single _rgba

    RGBA floating point values.

    set_palette_color_rgba8(Byte, UInt32)

    Set palette color value.

    Declaration
    public static void set_palette_color_rgba8(byte _index, uint _rgba)
    Parameters
    Type Name Description
    Byte _index

    Index into palette.

    UInt32 _rgba

    Packed 32-bit RGBA value.

    set_platform_data(bgfx.PlatformData*)

    Set platform data. @warning Must be called before bgfx::init.

    Declaration
    public static void set_platform_data(bgfx.PlatformData*_data)
    Parameters
    Type Name Description
    bgfx.PlatformData* _data

    Platform data.

    set_scissor(UInt16, UInt16, UInt16, UInt16)

    Set scissor for draw primitive. @remark To scissor for all primitives in view see bgfx::setViewScissor.

    Declaration
    public static ushort set_scissor(ushort _x, ushort _y, ushort _width, ushort _height)
    Parameters
    Type Name Description
    UInt16 _x

    Position x from the left corner of the window.

    UInt16 _y

    Position y from the top corner of the window.

    UInt16 _width

    Width of view scissor region.

    UInt16 _height

    Height of view scissor region.

    Returns
    Type Description
    UInt16

    set_scissor_cached(UInt16)

    Set scissor from cache for draw primitive. @remark To scissor for all primitives in view see bgfx::setViewScissor.

    Declaration
    public static void set_scissor_cached(ushort _cache)
    Parameters
    Type Name Description
    UInt16 _cache

    Index in scissor cache.

    set_shader_name(bgfx.ShaderHandle, String, Int32)

    Set shader debug name.

    Declaration
    public static void set_shader_name(bgfx.ShaderHandle _handle, string _name, int _len)
    Parameters
    Type Name Description
    bgfx.ShaderHandle _handle

    Shader handle.

    String _name

    Shader name.

    Int32 _len

    Shader name length (if length is INT32_MAX, it's expected that _name is zero terminated string).

    set_state(UInt64, UInt32)

    Set render states for draw primitive. @remarks

    1. To setup more complex states use: BGFX_STATE_ALPHA_REF(_ref), BGFX_STATE_POINT_SIZE(_size), BGFX_STATE_BLEND_FUNC(_src, _dst), BGFX_STATE_BLEND_FUNC_SEPARATE(_srcRGB, _dstRGB, _srcA, _dstA), BGFX_STATE_BLEND_EQUATION(_equation), BGFX_STATE_BLEND_EQUATION_SEPARATE(_equationRGB, _equationA)
    2. BGFX_STATE_BLEND_EQUATION_ADD is set when no other blend equation is specified.
    Declaration
    public static void set_state(ulong _state, uint _rgba)
    Parameters
    Type Name Description
    UInt64 _state

    State flags. Default state for primitive type is triangles. See: BGFX_STATE_DEFAULT. - BGFX_STATE_DEPTH_TEST_* - Depth test function. - BGFX_STATE_BLEND_* - See remark 1 about BGFX_STATE_BLEND_FUNC. - BGFX_STATE_BLEND_EQUATION_* - See remark 2. - BGFX_STATE_CULL_* - Backface culling mode. - BGFX_STATE_WRITE_* - Enable R, G, B, A or Z write. - BGFX_STATE_MSAA - Enable hardware multisample antialiasing. - BGFX_STATE_PT_[TRISTRIP/LINES/POINTS] - Primitive type.

    UInt32 _rgba

    Sets blend factor used by BGFX_STATE_BLEND_FACTOR and BGFX_STATE_BLEND_INV_FACTOR blend modes.

    set_stencil(UInt32, UInt32)

    Set stencil test state.

    Declaration
    public static void set_stencil(uint _fstencil, uint _bstencil)
    Parameters
    Type Name Description
    UInt32 _fstencil

    Front stencil state.

    UInt32 _bstencil

    Back stencil state. If back is set to BGFX_STENCIL_NONE _fstencil is applied to both front and back facing primitives.

    set_texture(Byte, bgfx.UniformHandle, bgfx.TextureHandle, UInt32)

    Set texture stage for draw primitive.

    Declaration
    public static void set_texture(byte _stage, bgfx.UniformHandle _sampler, bgfx.TextureHandle _handle, uint _flags)
    Parameters
    Type Name Description
    Byte _stage

    Texture unit.

    bgfx.UniformHandle _sampler

    Program sampler.

    bgfx.TextureHandle _handle

    Texture handle.

    UInt32 _flags

    Texture sampling mode. Default value UINT32_MAX uses texture sampling settings from the texture. - BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP] - Mirror or clamp to edge wrap mode. - BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC] - Point or anisotropic sampling.

    set_texture_name(bgfx.TextureHandle, String, Int32)

    Set texture debug name.

    Declaration
    public static void set_texture_name(bgfx.TextureHandle _handle, string _name, int _len)
    Parameters
    Type Name Description
    bgfx.TextureHandle _handle

    Texture handle.

    String _name

    Texture name.

    Int32 _len

    Texture name length (if length is INT32_MAX, it's expected that _name is zero terminated string.

    set_transform(Void*, UInt16)

    Set model matrix for draw primitive. If it is not called, the model will be rendered with an identity model matrix.

    Declaration
    public static uint set_transform(void *_mtx, ushort _num)
    Parameters
    Type Name Description
    Void* _mtx

    Pointer to first matrix in array.

    UInt16 _num

    Number of matrices in array.

    Returns
    Type Description
    UInt32

    set_transform_cached(UInt32, UInt16)

    Set model matrix from matrix cache for draw primitive.

    Declaration
    public static void set_transform_cached(uint _cache, ushort _num)
    Parameters
    Type Name Description
    UInt32 _cache

    Index in matrix cache.

    UInt16 _num

    Number of matrices from cache.

    set_transient_index_buffer(bgfx.TransientIndexBuffer*, UInt32, UInt32)

    Set index buffer for draw primitive.

    Declaration
    public static void set_transient_index_buffer(bgfx.TransientIndexBuffer*_tib, uint _firstIndex, uint _numIndices)
    Parameters
    Type Name Description
    bgfx.TransientIndexBuffer* _tib

    Transient index buffer.

    UInt32 _firstIndex

    First index to render.

    UInt32 _numIndices

    Number of indices to render.

    set_transient_vertex_buffer(Byte, bgfx.TransientVertexBuffer*, UInt32, UInt32)

    Set vertex buffer for draw primitive.

    Declaration
    public static void set_transient_vertex_buffer(byte _stream, bgfx.TransientVertexBuffer*_tvb, uint _startVertex, uint _numVertices)
    Parameters
    Type Name Description
    Byte _stream

    Vertex stream.

    bgfx.TransientVertexBuffer* _tvb

    Transient vertex buffer.

    UInt32 _startVertex

    First vertex to render.

    UInt32 _numVertices

    Number of vertices to render.

    set_uniform(bgfx.UniformHandle, Void*, UInt16)

    Set shader uniform parameter for draw primitive.

    Declaration
    public static void set_uniform(bgfx.UniformHandle _handle, void *_value, ushort _num)
    Parameters
    Type Name Description
    bgfx.UniformHandle _handle

    Uniform.

    Void* _value

    Pointer to uniform data.

    UInt16 _num

    Number of elements. Passing UINT16_MAX will use the _num passed on uniform creation.

    set_vertex_buffer(Byte, bgfx.VertexBufferHandle, UInt32, UInt32)

    Set vertex buffer for draw primitive.

    Declaration
    public static void set_vertex_buffer(byte _stream, bgfx.VertexBufferHandle _handle, uint _startVertex, uint _numVertices)
    Parameters
    Type Name Description
    Byte _stream

    Vertex stream.

    bgfx.VertexBufferHandle _handle

    Vertex buffer.

    UInt32 _startVertex

    First vertex to render.

    UInt32 _numVertices

    Number of vertices to render.

    set_vertex_buffer_name(bgfx.VertexBufferHandle, String, Int32)

    Set static vertex buffer debug name.

    Declaration
    public static void set_vertex_buffer_name(bgfx.VertexBufferHandle _handle, string _name, int _len)
    Parameters
    Type Name Description
    bgfx.VertexBufferHandle _handle

    Static vertex buffer handle.

    String _name

    Static vertex buffer name.

    Int32 _len

    Static vertex buffer name length (if length is INT32_MAX, it's expected that _name is zero terminated string.

    set_vertex_count(UInt32)

    Set number of vertices for auto generated vertices use in conjuction with gl_VertexID. @attention Availability depends on: BGFX_CAPS_VERTEX_ID.

    Declaration
    public static void set_vertex_count(uint _numVertices)
    Parameters
    Type Name Description
    UInt32 _numVertices

    Number of vertices.

    set_view_clear(UInt16, UInt16, UInt32, Single, Byte)

    Set view clear flags.

    Declaration
    public static void set_view_clear(ushort _id, ushort _flags, uint _rgba, float _depth, byte _stencil)
    Parameters
    Type Name Description
    UInt16 _id

    View id.

    UInt16 _flags

    Clear flags. Use BGFX_CLEAR_NONE to remove any clear operation. See: BGFX_CLEAR_*.

    UInt32 _rgba

    Color clear value.

    Single _depth

    Depth clear value.

    Byte _stencil

    Stencil clear value.

    set_view_clear_mrt(UInt16, UInt16, Single, Byte, Byte, Byte, Byte, Byte, Byte, Byte, Byte, Byte)

    Set view clear flags with different clear color for each frame buffer texture. Must use bgfx::setPaletteColor to setup clear color palette.

    Declaration
    public static void set_view_clear_mrt(ushort _id, ushort _flags, float _depth, byte _stencil, byte _c0, byte _c1, byte _c2, byte _c3, byte _c4, byte _c5, byte _c6, byte _c7)
    Parameters
    Type Name Description
    UInt16 _id

    View id.

    UInt16 _flags

    Clear flags. Use BGFX_CLEAR_NONE to remove any clear operation. See: BGFX_CLEAR_*.

    Single _depth

    Depth clear value.

    Byte _stencil

    Stencil clear value.

    Byte _c0

    Palette index for frame buffer attachment 0.

    Byte _c1

    Palette index for frame buffer attachment 1.

    Byte _c2

    Palette index for frame buffer attachment 2.

    Byte _c3

    Palette index for frame buffer attachment 3.

    Byte _c4

    Palette index for frame buffer attachment 4.

    Byte _c5

    Palette index for frame buffer attachment 5.

    Byte _c6

    Palette index for frame buffer attachment 6.

    Byte _c7

    Palette index for frame buffer attachment 7.

    set_view_frame_buffer(UInt16, bgfx.FrameBufferHandle)

    Set view frame buffer. @remarks Not persistent after bgfx::reset call.

    Declaration
    public static void set_view_frame_buffer(ushort _id, bgfx.FrameBufferHandle _handle)
    Parameters
    Type Name Description
    UInt16 _id

    View id.

    bgfx.FrameBufferHandle _handle

    Frame buffer handle. Passing BGFX_INVALID_HANDLE as frame buffer handle will draw primitives from this view into default back buffer.

    set_view_mode(UInt16, bgfx.ViewMode)

    Set view sorting mode. @remarks View mode must be set prior calling bgfx::submit for the view.

    Declaration
    public static void set_view_mode(ushort _id, bgfx.ViewMode _mode)
    Parameters
    Type Name Description
    UInt16 _id

    View id.

    bgfx.ViewMode _mode

    View sort mode. See ViewMode::Enum.

    set_view_name(UInt16, String)

    Declaration
    public static void set_view_name(ushort _id, string _name)
    Parameters
    Type Name Description
    UInt16 _id
    String _name

    set_view_order(UInt16, UInt16, UInt16*)

    Post submit view reordering.

    Declaration
    public static void set_view_order(ushort _id, ushort _num, ushort *_order)
    Parameters
    Type Name Description
    UInt16 _id

    First view id.

    UInt16 _num

    Number of views to remap.

    UInt16* _order

    View remap id table. Passing NULL will reset view ids to default state.

    set_view_rect(UInt16, UInt16, UInt16, UInt16, UInt16)

    Set view rectangle. Draw primitive outside view will be clipped.

    Declaration
    public static void set_view_rect(ushort _id, ushort _x, ushort _y, ushort _width, ushort _height)
    Parameters
    Type Name Description
    UInt16 _id

    View id.

    UInt16 _x

    Position x from the left corner of the window.

    UInt16 _y

    Position y from the top corner of the window.

    UInt16 _width

    Width of view port region.

    UInt16 _height

    Height of view port region.

    set_view_rect_ratio(UInt16, UInt16, UInt16, bgfx.BackbufferRatio)

    Set view rectangle. Draw primitive outside view will be clipped.

    Declaration
    public static void set_view_rect_ratio(ushort _id, ushort _x, ushort _y, bgfx.BackbufferRatio _ratio)
    Parameters
    Type Name Description
    UInt16 _id

    View id.

    UInt16 _x

    Position x from the left corner of the window.

    UInt16 _y

    Position y from the top corner of the window.

    bgfx.BackbufferRatio _ratio

    Width and height will be set in respect to back-buffer size. See: BackbufferRatio::Enum.

    set_view_scissor(UInt16, UInt16, UInt16, UInt16, UInt16)

    Set view scissor. Draw primitive outside view will be clipped. When _x, _y, _width and _height are set to 0, scissor will be disabled.

    Declaration
    public static void set_view_scissor(ushort _id, ushort _x, ushort _y, ushort _width, ushort _height)
    Parameters
    Type Name Description
    UInt16 _id

    View id.

    UInt16 _x

    Position x from the left corner of the window.

    UInt16 _y

    Position y from the top corner of the window.

    UInt16 _width

    Width of view scissor region.

    UInt16 _height

    Height of view scissor region.

    set_view_transform(UInt16, Void*, Void*)

    Set view view and projection matrices, all draw primitives in this view will use these matrices.

    Declaration
    public static void set_view_transform(ushort _id, void *_view, void *_proj)
    Parameters
    Type Name Description
    UInt16 _id

    View id.

    Void* _view

    View matrix.

    Void* _proj

    Projection matrix.

    shutdown()

    Shutdown bgfx library.

    Declaration
    public static void shutdown()

    submit(UInt16, bgfx.ProgramHandle, UInt32, Boolean)

    Submit primitive for rendering.

    Declaration
    public static void submit(ushort _id, bgfx.ProgramHandle _program, uint _depth, bool _preserveState)
    Parameters
    Type Name Description
    UInt16 _id

    View id.

    bgfx.ProgramHandle _program

    Program.

    UInt32 _depth

    Depth for sorting.

    Boolean _preserveState

    Preserve internal draw state for next draw call submit.

    submit_indirect(UInt16, bgfx.ProgramHandle, bgfx.IndirectBufferHandle, UInt16, UInt16, UInt32, Boolean)

    Submit primitive for rendering with index and instance data info from indirect buffer.

    Declaration
    public static void submit_indirect(ushort _id, bgfx.ProgramHandle _program, bgfx.IndirectBufferHandle _indirectHandle, ushort _start, ushort _num, uint _depth, bool _preserveState)
    Parameters
    Type Name Description
    UInt16 _id

    View id.

    bgfx.ProgramHandle _program

    Program.

    bgfx.IndirectBufferHandle _indirectHandle

    Indirect buffer.

    UInt16 _start

    First element in indirect buffer.

    UInt16 _num

    Number of dispatches.

    UInt32 _depth

    Depth for sorting.

    Boolean _preserveState

    Preserve internal draw state for next draw call submit.

    submit_occlusion_query(UInt16, bgfx.ProgramHandle, bgfx.OcclusionQueryHandle, UInt32, Boolean)

    Submit primitive with occlusion query for rendering.

    Declaration
    public static void submit_occlusion_query(ushort _id, bgfx.ProgramHandle _program, bgfx.OcclusionQueryHandle _occlusionQuery, uint _depth, bool _preserveState)
    Parameters
    Type Name Description
    UInt16 _id

    View id.

    bgfx.ProgramHandle _program

    Program.

    bgfx.OcclusionQueryHandle _occlusionQuery

    Occlusion query.

    UInt32 _depth

    Depth for sorting.

    Boolean _preserveState

    Preserve internal draw state for next draw call submit.

    topology_convert(bgfx.TopologyConvert, Void*, UInt32, Void*, UInt32, Boolean)

    Convert index buffer for use with different primitive topologies.

    Declaration
    public static uint topology_convert(bgfx.TopologyConvert _conversion, void *_dst, uint _dstSize, void *_indices, uint _numIndices, bool _index32)
    Parameters
    Type Name Description
    bgfx.TopologyConvert _conversion

    Conversion type, see TopologyConvert::Enum.

    Void* _dst

    Destination index buffer. If this argument is NULL function will return number of indices after conversion.

    UInt32 _dstSize

    Destination index buffer in bytes. It must be large enough to contain output indices. If destination size is insufficient index buffer will be truncated.

    Void* _indices

    Source indices.

    UInt32 _numIndices

    Number of input indices.

    Boolean _index32

    Set to true if input indices are 32-bit.

    Returns
    Type Description
    UInt32

    topology_sort_tri_list(bgfx.TopologySort, Void*, UInt32, Single, Single, Void*, UInt32, Void*, UInt32, Boolean)

    Sort indices.

    Declaration
    public static void topology_sort_tri_list(bgfx.TopologySort _sort, void *_dst, uint _dstSize, float _dir, float _pos, void *_vertices, uint _stride, void *_indices, uint _numIndices, bool _index32)
    Parameters
    Type Name Description
    bgfx.TopologySort _sort

    Sort order, see TopologySort::Enum.

    Void* _dst

    Destination index buffer.

    UInt32 _dstSize

    Destination index buffer in bytes. It must be large enough to contain output indices. If destination size is insufficient index buffer will be truncated.

    Single _dir

    Direction (vector must be normalized).

    Single _pos

    Position.

    Void* _vertices

    Pointer to first vertex represented as float x, y, z. Must contain at least number of vertices referencende by index buffer.

    UInt32 _stride

    Vertex stride.

    Void* _indices

    Source indices.

    UInt32 _numIndices

    Number of input indices.

    Boolean _index32

    Set to true if input indices are 32-bit.

    touch(UInt16)

    Submit an empty primitive for rendering. Uniforms and draw state will be applied but no geometry will be submitted. @remark These empty draw calls will sort before ordinary draw calls.

    Declaration
    public static void touch(ushort _id)
    Parameters
    Type Name Description
    UInt16 _id

    View id.

    update_dynamic_index_buffer(bgfx.DynamicIndexBufferHandle, UInt32, bgfx.Memory*)

    Update dynamic index buffer.

    Declaration
    public static void update_dynamic_index_buffer(bgfx.DynamicIndexBufferHandle _handle, uint _startIndex, bgfx.Memory*_mem)
    Parameters
    Type Name Description
    bgfx.DynamicIndexBufferHandle _handle

    Dynamic index buffer handle.

    UInt32 _startIndex

    Start index.

    bgfx.Memory* _mem

    Index buffer data.

    update_dynamic_vertex_buffer(bgfx.DynamicVertexBufferHandle, UInt32, bgfx.Memory*)

    Update dynamic vertex buffer.

    Declaration
    public static void update_dynamic_vertex_buffer(bgfx.DynamicVertexBufferHandle _handle, uint _startVertex, bgfx.Memory*_mem)
    Parameters
    Type Name Description
    bgfx.DynamicVertexBufferHandle _handle

    Dynamic vertex buffer handle.

    UInt32 _startVertex

    Start vertex.

    bgfx.Memory* _mem

    Vertex buffer data.

    update_texture_2d(bgfx.TextureHandle, UInt16, Byte, UInt16, UInt16, UInt16, UInt16, bgfx.Memory*, UInt16)

    Update 2D texture. @attention It's valid to update only mutable texture. See bgfx::createTexture2D for more info.

    Declaration
    public static void update_texture_2d(bgfx.TextureHandle _handle, ushort _layer, byte _mip, ushort _x, ushort _y, ushort _width, ushort _height, bgfx.Memory*_mem, ushort _pitch)
    Parameters
    Type Name Description
    bgfx.TextureHandle _handle

    Texture handle.

    UInt16 _layer

    Layer in texture array.

    Byte _mip

    Mip level.

    UInt16 _x

    X offset in texture.

    UInt16 _y

    Y offset in texture.

    UInt16 _width

    Width of texture block.

    UInt16 _height

    Height of texture block.

    bgfx.Memory* _mem

    Texture update data.

    UInt16 _pitch

    Pitch of input image (bytes). When _pitch is set to UINT16_MAX, it will be calculated internally based on _width.

    update_texture_3d(bgfx.TextureHandle, Byte, UInt16, UInt16, UInt16, UInt16, UInt16, UInt16, bgfx.Memory*)

    Update 3D texture. @attention It's valid to update only mutable texture. See bgfx::createTexture3D for more info.

    Declaration
    public static void update_texture_3d(bgfx.TextureHandle _handle, byte _mip, ushort _x, ushort _y, ushort _z, ushort _width, ushort _height, ushort _depth, bgfx.Memory*_mem)
    Parameters
    Type Name Description
    bgfx.TextureHandle _handle

    Texture handle.

    Byte _mip

    Mip level.

    UInt16 _x

    X offset in texture.

    UInt16 _y

    Y offset in texture.

    UInt16 _z

    Z offset in texture.

    UInt16 _width

    Width of texture block.

    UInt16 _height

    Height of texture block.

    UInt16 _depth

    Depth of texture block.

    bgfx.Memory* _mem

    Texture update data.

    update_texture_cube(bgfx.TextureHandle, UInt16, Byte, Byte, UInt16, UInt16, UInt16, UInt16, bgfx.Memory*, UInt16)

    Declaration
    public static void update_texture_cube(bgfx.TextureHandle _handle, ushort _layer, byte _side, byte _mip, ushort _x, ushort _y, ushort _width, ushort _height, bgfx.Memory*_mem, ushort _pitch)
    Parameters
    Type Name Description
    bgfx.TextureHandle _handle
    UInt16 _layer
    Byte _side
    Byte _mip
    UInt16 _x
    UInt16 _y
    UInt16 _width
    UInt16 _height
    bgfx.Memory* _mem
    UInt16 _pitch

    vertex_convert(bgfx.VertexLayout*, Void*, bgfx.VertexLayout*, Void*, UInt32)

    Converts vertex stream data from one vertex stream format to another.

    Declaration
    public static void vertex_convert(bgfx.VertexLayout*_dstLayout, void *_dstData, bgfx.VertexLayout*_srcLayout, void *_srcData, uint _num)
    Parameters
    Type Name Description
    bgfx.VertexLayout* _dstLayout

    Destination vertex stream layout.

    Void* _dstData

    Destination vertex stream.

    bgfx.VertexLayout* _srcLayout

    Source vertex stream layout.

    Void* _srcData

    Source vertex stream data.

    UInt32 _num

    Number of vertices to convert from source to destination.

    vertex_layout_add(bgfx.VertexLayout*, bgfx.Attrib, Byte, bgfx.AttribType, Boolean, Boolean)

    Add attribute to VertexLayout. @remarks Must be called between begin/end.

    Declaration
    public static bgfx.VertexLayout*vertex_layout_add(bgfx.VertexLayout*_this, bgfx.Attrib _attrib, byte _num, bgfx.AttribType _type, bool _normalized, bool _asInt)
    Parameters
    Type Name Description
    bgfx.VertexLayout* _this
    bgfx.Attrib _attrib

    Attribute semantics. See: bgfx::Attrib

    Byte _num

    Number of elements 1, 2, 3 or 4.

    bgfx.AttribType _type

    Element type.

    Boolean _normalized

    When using fixed point AttribType (f.e. Uint8) value will be normalized for vertex shader usage. When normalized is set to true, AttribType::Uint8 value in range 0-255 will be in range 0.0-1.0 in vertex shader.

    Boolean _asInt

    Packaging rule for vertexPack, vertexUnpack, and vertexConvert for AttribType::Uint8 and AttribType::Int16. Unpacking code must be implemented inside vertex shader.

    Returns
    Type Description
    bgfx.VertexLayout*

    vertex_layout_begin(bgfx.VertexLayout*, bgfx.RendererType)

    Start VertexLayout.

    Declaration
    public static bgfx.VertexLayout*vertex_layout_begin(bgfx.VertexLayout*_this, bgfx.RendererType _rendererType)
    Parameters
    Type Name Description
    bgfx.VertexLayout* _this
    bgfx.RendererType _rendererType
    Returns
    Type Description
    bgfx.VertexLayout*

    vertex_layout_decode(bgfx.VertexLayout*, bgfx.Attrib, Byte*, bgfx.AttribType*, Boolean*, Boolean*)

    Decode attribute.

    Declaration
    public static void vertex_layout_decode(bgfx.VertexLayout*_this, bgfx.Attrib _attrib, byte *_num, bgfx.AttribType*_type, bool *_normalized, bool *_asInt)
    Parameters
    Type Name Description
    bgfx.VertexLayout* _this
    bgfx.Attrib _attrib

    Attribute semantics. See: bgfx::Attrib

    Byte* _num

    Number of elements.

    bgfx.AttribType* _type

    Element type.

    Boolean* _normalized

    Attribute is normalized.

    Boolean* _asInt

    Attribute is packed as int.

    vertex_layout_end(bgfx.VertexLayout*)

    End VertexLayout.

    Declaration
    public static void vertex_layout_end(bgfx.VertexLayout*_this)
    Parameters
    Type Name Description
    bgfx.VertexLayout* _this

    vertex_layout_has(bgfx.VertexLayout*, bgfx.Attrib)

    Returns true if VertexLayout contains attribute.

    Declaration
    public static bool vertex_layout_has(bgfx.VertexLayout*_this, bgfx.Attrib _attrib)
    Parameters
    Type Name Description
    bgfx.VertexLayout* _this
    bgfx.Attrib _attrib

    Attribute semantics. See: bgfx::Attrib

    Returns
    Type Description
    Boolean

    vertex_layout_skip(bgfx.VertexLayout*, Byte)

    Skip _num bytes in vertex stream.

    Declaration
    public static bgfx.VertexLayout*vertex_layout_skip(bgfx.VertexLayout*_this, byte _num)
    Parameters
    Type Name Description
    bgfx.VertexLayout* _this
    Byte _num
    Returns
    Type Description
    bgfx.VertexLayout*

    vertex_pack(Single, Boolean, bgfx.Attrib, bgfx.VertexLayout*, Void*, UInt32)

    Pack vertex attribute into vertex stream format.

    Declaration
    public static void vertex_pack(float _input, bool _inputNormalized, bgfx.Attrib _attr, bgfx.VertexLayout*_layout, void *_data, uint _index)
    Parameters
    Type Name Description
    Single _input

    Value to be packed into vertex stream.

    Boolean _inputNormalized

    true if input value is already normalized.

    bgfx.Attrib _attr

    Attribute to pack.

    bgfx.VertexLayout* _layout

    Vertex stream layout.

    Void* _data

    Destination vertex stream where data will be packed.

    UInt32 _index

    Vertex index that will be modified.

    vertex_unpack(Single, bgfx.Attrib, bgfx.VertexLayout*, Void*, UInt32)

    Unpack vertex attribute from vertex stream format.

    Declaration
    public static void vertex_unpack(float _output, bgfx.Attrib _attr, bgfx.VertexLayout*_layout, void *_data, uint _index)
    Parameters
    Type Name Description
    Single _output

    Result of unpacking.

    bgfx.Attrib _attr

    Attribute to unpack.

    bgfx.VertexLayout* _layout

    Vertex stream layout.

    Void* _data

    Source vertex stream from where data will be unpacked.

    UInt32 _index

    Vertex index that will be unpacked.

    weld_vertices(UInt16*, bgfx.VertexLayout*, Void*, UInt16, Single)

    Weld vertices.

    Declaration
    public static ushort weld_vertices(ushort *_output, bgfx.VertexLayout*_layout, void *_data, ushort _num, float _epsilon)
    Parameters
    Type Name Description
    UInt16* _output

    Welded vertices remapping table. The size of buffer must be the same as number of vertices.

    bgfx.VertexLayout* _layout

    Vertex stream layout.

    Void* _data

    Vertex stream.

    UInt16 _num

    Number of vertices in vertex stream.

    Single _epsilon

    Error tolerance for vertex position comparison.

    Returns
    Type Description
    UInt16
    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023