Crate bgfx_sys[][src]

Re-exports

pub use self::bgfx_fatal as bgfx_fatal_t;
pub use self::bgfx_renderer_type as bgfx_renderer_type_t;
pub use self::bgfx_access as bgfx_access_t;
pub use self::bgfx_attrib as bgfx_attrib_t;
pub use self::bgfx_attrib_type as bgfx_attrib_type_t;
pub use self::bgfx_texture_format as bgfx_texture_format_t;
pub use self::bgfx_uniform_type as bgfx_uniform_type_t;
pub use self::bgfx_backbuffer_ratio as bgfx_backbuffer_ratio_t;
pub use self::bgfx_occlusion_query_result as bgfx_occlusion_query_result_t;
pub use self::bgfx_topology as bgfx_topology_t;
pub use self::bgfx_topology_convert as bgfx_topology_convert_t;
pub use self::bgfx_topology_convert as bgfx_topology_convert_t;
pub use self::bgfx_topology_sort as bgfx_topology_sort_t;
pub use self::bgfx_view_mode as bgfx_view_mode_t;
pub use self::bgfx_render_frame as bgfx_render_frame_t;
pub use self::bgfx_render_frame as bgfx_render_frame_t;
pub use self::bgfx_function_id as bgfx_function_id_t;

Structs

Frame buffer texture attachment info.

GPU info.

Renderer runtime limits.

Renderer capabilities.

Encoders are used for submitting draw calls from multiple threads. Only one encoder per thread should be used. Use bgfx::begin() to obtain an encoder for a thread.

Encoder stats.

Configurable runtime limits parameters.

Initialization parameters used by bgfx::init.

Instance data buffer info.

Internal data.

Memory must be obtained by calling bgfx::alloc, bgfx::copy, or bgfx::makeRef. @attention It is illegal to create this structure on stack and pass it to any bgfx API.

Platform data.

Backbuffer resolution and reset parameters.

Renderer statistics data. @remarks All time values are high-resolution timestamps, while time frequencies define timestamps-per-second for that hardware.

Texture info.

Transform data.

Transient index buffer.

Transient vertex buffer.

Uniform info.

Vertex layout.

View stats.

Constants

( 2) Read and write.

( 1) Write.

( 0) Read.

( 2) a_tangent

( 3) a_bitangent

( 4) a_color0

( 5) a_color1

( 6) a_color2

(17) a_texcoord7

( 7) a_color3

( 0) a_position

( 1) a_normal

( 9) a_weight

(10) a_texcoord0

(11) a_texcoord1

(12) a_texcoord2

(13) a_texcoord3

(14) a_texcoord4

(15) a_texcoord5

(16) a_texcoord6

( 4) Float

( 3) Half, availability depends on: BGFX_CAPS_VERTEX_ATTRIB_HALF.

( 2) Int16

( 1) Uint10, availability depends on: BGFX_CAPS_VERTEX_ATTRIB_UINT10.

( 0) Uint8

( 8) a_indices

( 5) Double size of backbuffer.

( 4) One sixteenth size of backbuffer.

( 2) One quarter size of backbuffer.

( 0) Equal to backbuffer.

( 1) One half size of backbuffer.

( 3) One eighth size of backbuffer.

( 4)

( 3)

( 0)

( 2)

( 1)

( 2) Query result is not available yet.

( 1) Query passed test.

( 0) Query failed test.

( 0) No rendering.

(11) WebGPU

( 1) AGC

( 2) Direct3D 9.0

( 3) Direct3D 11.0

( 4) Direct3D 12.0

( 5) GNM

( 6) Metal

( 8) OpenGL ES 2.0+

( 7) NVN

( 9) OpenGL 2.1+

(10) Vulkan

( 3) Renderer context is getting destroyed.

( 2) Renderer context wait for main thread signal timed out without rendering.

( 0) Renderer context is not created yet.

( 1) Renderer context is created and rendering.

(27)

(19) ATCI RGBA 8 BPP interpolated alpha

(20) ASTC 4x4 8.0 BPP

(21) ASTC 5x5 5.12 BPP

(22) ASTC 6x6 3.56 BPP

(23) ASTC 8x5 3.20 BPP

(24) ASTC 8x6 2.67 BPP

(16) PVRTC2 RGBA 4BPP

(17) ATC RGB 4BPP

(18) ATCE RGBA 8 BPP explicit alpha

( 0) DXT1 R5G6B5A1

( 1) DXT3 R5G6B5A4

( 2) DXT5 R5G6B5A8

( 3) LATC1/ATI1 R8

( 4) LATC2/ATI2 RG8

( 5) BC6H RGB16F

(57)

(84)

(83)

(76) Depth formats below.

(80)

(77)

(81)

(78)

(79)

(82)

( 6) BC7 RGB 4-7 bits per color channel, 0-8 bits alpha

( 7) ETC1 RGB8

( 8) ETC2 RGB8

( 9) ETC2 RGBA8

(10) ETC2 RGB8A1

(12) PVRTC1 RGB 4BPP

(11) PVRTC1 RGB 2BPP

(13) PVRTC1 RGBA 2BPP

(14) PVRTC1 RGBA 4BPP

(15) PVRTC2 RGBA 2BPP

(26) Compressed formats above.

(70)

(28)

(29)

(31)

(30)

(32)

(35)

(33)

(36)

(34)

(39)

(37)

(38)

(40)

(41)

(43)

(42)

(74)

(44)

(47)

(45)

(48)

(46)

(51)

(49)

(50)

(72)

(52)

(53)

(55)

(54)

(56)

(73)

(71)

(58)

(59)

(61)

(60)

(62)

(65)

(63)

(66)

(64)

(69)

(67)

(68)

(25) ASTC 10x5 2.56 BPP

(75)

( 4) Convert line strip to line list.

( 3) Convert triangle strip to triangle list.

( 1) Flip winding order of triangle strip.

( 0) Flip winding order of triangle list.

( 2) Convert triangle list to line list.

( 4) Point list.

( 1) Triangle strip.

( 2) Line list.

( 3) Line strip.

(11)

( 3)

( 4)

( 2)

( 0)

( 1)

( 9)

(10)

( 8)

( 6)

( 7)

( 5)

( 0) Triangle list.

( 4) 4x4 matrix.

( 0) Sampler.

( 2) 4 floats vector.

( 3) 3x3 matrix.

( 1) Reserved, do not use.

( 3) Sort draw call depth in descending order.

( 1) Sort in the same order in which submit calls were called.

( 2) Sort draw call depth in ascending order.

( 0) Default sort order.

Functions

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

Allocate instance data buffer.

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

Check for required space and allocate transient vertex and index buffers. If both space requirements are satisfied function returns true.

Allocate transient index buffer.

Allocate transient vertex buffer.

Init attachment.

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.

Calculate amount of memory required for texture.

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

Create program with compute shader.

Create empty dynamic index buffer.

Create dynamic index buffer and initialized it.

Create empty dynamic vertex buffer.

Create dynamic vertex buffer and initialize it.

Create frame buffer (simple).

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

Create MRT frame buffer from texture handles (simple).

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

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

Create static index buffer.

Create draw indirect buffer.

Create occlusion query.

Create program with vertex and fragment shaders.

Create shader from memory buffer.

Create texture from memory buffer.

Create 2D texture.

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

Create 3D texture.

Create Cube texture.

Create shader uniform parameter. @remarks

Create static vertex buffer.

Create vertex layout.

Clear internal debug text buffer.

Draw image into internal debug text buffer.

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

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

Destroy dynamic index buffer.

Destroy dynamic vertex buffer.

Destroy frame buffer.

Destroy static index buffer.

Destroy draw indirect buffer.

Destroy occlusion query.

Destroy program.

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

Destroy texture.

Destroy shader uniform parameter.

Destroy static vertex buffer.

Destroy vertex layout.

Discard previously set state for draw or compute call.

Dispatch compute.

Dispatch compute indirect.

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

Begin submitting draw calls from thread.

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.

Discard previously set state for draw or compute call.

Dispatch compute.

Dispatch compute indirect.

End submitting draw calls from thread.

Set compute dynamic index buffer.

Set compute dynamic vertex buffer.

Set compute index buffer.

Set compute indirect buffer.

Set compute vertex buffer.

Set condition for rendering.

Set index buffer for draw primitive.

Set vertex buffer for draw primitive.

Set compute image from texture.

Set index buffer for draw primitive.

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

Set instance data buffer for draw primitive.

Set instance data buffer for draw primitive.

Set instance data buffer for draw primitive.

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

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

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

Set render states for draw primitive. @remarks

Set stencil test state.

Set texture stage for draw primitive.

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

Set model matrix from matrix cache for draw primitive.

Set index buffer for draw primitive.

Set vertex buffer for draw primitive.

Set vertex buffer for draw primitive.

Set shader uniform parameter for draw primitive.

Set vertex buffer for draw primitive.

Set vertex buffer for draw primitive.

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

Submit primitive for rendering.

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

Submit primitive with occlusion query for rendering.

Submit an empty primitive for rendering. Uniforms and draw state will be applied but no geometry will be submitted. Useful in cases when no other draw/compute primitive is submitted to view, but it’s desired to execute clear view. @remark These empty draw calls will sort before ordinary draw calls.

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.

Returns number of requested or maximum available instance buffer slots.

Returns number of requested or maximum available indices.

Returns number of requested or maximum available vertices.

Returns renderer capabilities. @remarks Library must be initialized.

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.

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.

Returns name of renderer.

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

Retrieve occlusion query result from previous frame.

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

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

Returns supported backend API renderers.

Obtain texture handle of frame buffer attachment.

Retrieve uniform info.

Initialize bgfx library.

Validate frame buffer parameters.

Validate texture parameters.

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.

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.

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.

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.

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

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.

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.

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.

Reset all view settings to default.

Set compute dynamic index buffer.

Set compute dynamic vertex buffer.

Set compute index buffer.

Set compute indirect buffer.

Set compute vertex buffer.

Set condition for rendering.

Set debug flags.

Set index buffer for draw primitive.

Set vertex buffer for draw primitive.

Set vertex buffer for draw primitive.

Set frame buffer debug name.

Set compute image from texture.

Set index buffer for draw primitive.

Set static index buffer debug name.

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

Set instance data buffer for draw primitive.

Set instance data buffer for draw primitive.

Set instance data buffer for draw primitive.

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

Set palette color value.

Set palette color value.

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

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

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

Set shader debug name.

Set render states for draw primitive. @remarks

Set stencil test state.

Set texture stage for draw primitive.

Set texture debug name.

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

Set model matrix from matrix cache for draw primitive.

Set index buffer for draw primitive.

Set vertex buffer for draw primitive.

Set vertex buffer for draw primitive.

Set shader uniform parameter for draw primitive.

Set vertex buffer for draw primitive.

Set static vertex buffer debug name.

Set vertex buffer for draw primitive.

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

Set view clear flags.

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

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

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

Set view name. @remarks This is debug only feature. In graphics debugger view name will appear as: “nnnc ” ^ ^ ^ | +— compute (C) +—— view id

Post submit view reordering.

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

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

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

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

Shutdown bgfx library.

Submit primitive for rendering.

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

Submit primitive with occlusion query for rendering.

Convert index buffer for use with different primitive topologies.

Sort indices.

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.

Update dynamic index buffer.

Update dynamic vertex buffer.

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

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

Update Cube texture. @attention It’s valid to update only mutable texture. See bgfx::createTextureCube for more info.

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

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

Start VertexLayout.

Decode attribute.

End VertexLayout.

Returns true if VertexLayout contains attribute.

Skip _num bytes in vertex stream.

Pack vertex attribute into vertex stream format.

Unpack vertex attribute from vertex stream format.

Weld vertices.

Type Definitions

Access mode enum.

Frame buffer texture attachment info.

Vertex attribute enum.

Vertex attribute type enum.

Backbuffer ratio enum.

GPU info.

Renderer runtime limits.

Renderer capabilities.

Encoder stats.

Fatal error enum.

Configurable runtime limits parameters.

Initialization parameters used by bgfx::init.

Instance data buffer info.

Internal data.

Memory must be obtained by calling bgfx::alloc, bgfx::copy, or bgfx::makeRef. @attention It is illegal to create this structure on stack and pass it to any bgfx API.

Occlusion query result.

Platform data.

Memory release callback.

Render frame enum.

Renderer backend type enum.

Backbuffer resolution and reset parameters.

Renderer statistics data. @remarks All time values are high-resolution timestamps, while time frequencies define timestamps-per-second for that hardware.

Texture format enum. Notation: RGBA16S ^ ^ ^ | | +– [ ]Unorm | | [F]loat | | [S]norm | | [I]nt | | [U]int | +–– Number of bits per component +–––– Components @attention Availability depends on Caps (see: formats).

Texture info.

Primitive topology.

Topology conversion function.

Topology sort order.

Transform data.

Transient index buffer.

Transient vertex buffer.

Uniform info.

Uniform type enum.

Vertex layout.

View mode sets draw call sort order.

View stats.

Unions