diff --git a/bindings/cs/bgfx.cs b/bindings/cs/bgfx.cs index bc61532b2..6f1fa59dc 100644 --- a/bindings/cs/bgfx.cs +++ b/bindings/cs/bgfx.cs @@ -852,12 +852,20 @@ internal struct bgfx /// /// Init attachment. /// + /// + /// Render target texture handle. + /// Access. See `Access::Enum`. + /// Cubemap side or depth layer/slice. + /// Mip level. + /// Resolve flags. See: `BGFX_RESOLVE_*` + /// [DllImport(DllName, EntryPoint="bgfx_attachment_init", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void attachment_init(Attachment* _this, TextureHandle _handle, Access _access, ushort _layer, ushort _mip, byte _resolve); /// /// Start VertexDecl. /// + /// [DllImport(DllName, EntryPoint="bgfx_vertex_decl_begin", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe VertexDecl* vertex_decl_begin(VertexDecl* _this, RendererType _rendererType); @@ -865,18 +873,35 @@ internal struct bgfx /// Add attribute to VertexDecl. /// @remarks Must be called between begin/end. /// + /// + /// Attribute semantics. See: `bgfx::Attrib` + /// Number of elements 1, 2, 3 or 4. + /// Element type. + /// 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. + /// Packaging rule for vertexPack, vertexUnpack, and vertexConvert for AttribType::Uint8 and AttribType::Int16. Unpacking code must be implemented inside vertex shader. + /// [DllImport(DllName, EntryPoint="bgfx_vertex_decl_add", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe VertexDecl* vertex_decl_add(VertexDecl* _this, Attrib _attrib, byte _num, AttribType _type, bool _normalized, bool _asInt); /// /// Decode attribute. /// + /// + /// Attribute semantics. See: `bgfx::Attrib` + /// Number of elements. + /// Element type. + /// Attribute is normalized. + /// Attribute is packed as int. + /// [DllImport(DllName, EntryPoint="bgfx_vertex_decl_decode", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void vertex_decl_decode(VertexDecl* _this, Attrib _attrib, byte * _num, AttribType* _type, bool* _normalized, bool* _asInt); /// /// Returns true if VertexDecl contains attribute. /// + /// + /// Attribute semantics. See: `bgfx::Attrib` + /// [DllImport(DllName, EntryPoint="bgfx_vertex_decl_has", CallingConvention = CallingConvention.Cdecl)] [return: MarshalAs(UnmanagedType.I1)] internal static extern unsafe bool vertex_decl_has(VertexDecl* _this, Attrib _attrib); @@ -884,60 +909,118 @@ internal struct bgfx /// /// Skip `_num` bytes in vertex stream. /// + /// [DllImport(DllName, EntryPoint="bgfx_vertex_decl_skip", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe VertexDecl* vertex_decl_skip(VertexDecl* _this, byte _num); /// /// End VertexDecl. /// + /// [DllImport(DllName, EntryPoint="bgfx_vertex_decl_end", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void vertex_decl_end(VertexDecl* _this); /// /// Pack vertex attribute into vertex stream format. /// + /// + /// Value to be packed into vertex stream. + /// `true` if input value is already normalized. + /// Attribute to pack. + /// Vertex stream declaration. + /// Destination vertex stream where data will be packed. + /// Vertex index that will be modified. + /// [DllImport(DllName, EntryPoint="bgfx_vertex_pack", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void vertex_pack(float _input, bool _inputNormalized, Attrib _attr, VertexDecl* _decl, void* _data, uint _index); /// /// Unpack vertex attribute from vertex stream format. /// + /// + /// Result of unpacking. + /// Attribute to unpack. + /// Vertex stream declaration. + /// Source vertex stream from where data will be unpacked. + /// Vertex index that will be unpacked. + /// [DllImport(DllName, EntryPoint="bgfx_vertex_unpack", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void vertex_unpack(float _output, Attrib _attr, VertexDecl* _decl, void* _data, uint _index); /// /// Converts vertex stream data from one vertex stream format to another. /// + /// + /// Destination vertex stream declaration. + /// Destination vertex stream. + /// Source vertex stream declaration. + /// Source vertex stream data. + /// Number of vertices to convert from source to destination. + /// [DllImport(DllName, EntryPoint="bgfx_vertex_convert", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void vertex_convert(VertexDecl* _dstDecl, void* _dstData, VertexDecl* _srcDecl, void* _srcData, uint _num); /// /// Weld vertices. /// + /// + /// Welded vertices remapping table. The size of buffer must be the same as number of vertices. + /// Vertex stream declaration. + /// Vertex stream. + /// Number of vertices in vertex stream. + /// Error tolerance for vertex position comparison. + /// [DllImport(DllName, EntryPoint="bgfx_weld_vertices", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe ushort weld_vertices(ushort* _output, VertexDecl* _decl, void* _data, ushort _num, float _epsilon); /// /// Convert index buffer for use with different primitive topologies. /// + /// + /// Conversion type, see `TopologyConvert::Enum`. + /// Destination index buffer. If this argument is NULL function will return number of indices after conversion. + /// Destination index buffer in bytes. It must be large enough to contain output indices. If destination size is insufficient index buffer will be truncated. + /// Source indices. + /// Number of input indices. + /// Set to `true` if input indices are 32-bit. + /// [DllImport(DllName, EntryPoint="bgfx_topology_convert", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe uint topology_convert(TopologyConvert _conversion, void* _dst, uint _dstSize, void* _indices, uint _numIndices, bool _index32); /// /// Sort indices. /// + /// + /// Sort order, see `TopologySort::Enum`. + /// Destination index buffer. + /// Destination index buffer in bytes. It must be large enough to contain output indices. If destination size is insufficient index buffer will be truncated. + /// Direction (vector must be normalized). + /// Position. + /// Pointer to first vertex represented as float x, y, z. Must contain at least number of vertices referencende by index buffer. + /// Vertex stride. + /// Source indices. + /// Number of input indices. + /// Set to `true` if input indices are 32-bit. + /// [DllImport(DllName, EntryPoint="bgfx_topology_sort_tri_list", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void topology_sort_tri_list(TopologySort _sort, void* _dst, uint _dstSize, float _dir, float _pos, void* _vertices, uint _stride, void* _indices, uint _numIndices, bool _index32); /// /// Returns supported backend API renderers. /// + /// + /// Maximum number of elements in _enum array. + /// Array where supported renderers will be written. + /// [DllImport(DllName, EntryPoint="bgfx_get_supported_renderers", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe byte get_supported_renderers(byte _max, RendererType* _enum); /// /// Returns name of renderer. /// + /// + /// Renderer backend type. See: `bgfx::RendererType` + /// [DllImport(DllName, EntryPoint="bgfx_get_renderer_name", CallingConvention = CallingConvention.Cdecl)] [return: MarshalAs(UnmanagedType.LPStr)] internal static extern unsafe string get_renderer_name(RendererType _type); @@ -948,6 +1031,9 @@ internal struct bgfx /// /// Initialize bgfx library. /// + /// + /// Initialization parameters. See: `bgfx::Init` for more info. + /// [DllImport(DllName, EntryPoint="bgfx_init", CallingConvention = CallingConvention.Cdecl)] [return: MarshalAs(UnmanagedType.I1)] internal static extern unsafe bool init(Init* _init); @@ -955,6 +1041,7 @@ internal struct bgfx /// /// Shutdown bgfx library. /// + /// [DllImport(DllName, EntryPoint="bgfx_shutdown", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void shutdown(); @@ -963,6 +1050,12 @@ internal struct bgfx /// @attention This call doesn't actually change window size, it just /// resizes back-buffer. Windowing code has to change window size. /// + /// + /// Back-buffer width. + /// Back-buffer height. + /// 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. + /// Texture format. See: `TextureFormat::Enum`. + /// [DllImport(DllName, EntryPoint="bgfx_reset", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void reset(uint _width, uint _height, uint _flags, TextureFormat _format); @@ -971,6 +1064,9 @@ internal struct bgfx /// just swaps internal buffers, kicks render thread, and returns. In /// singlethreaded renderer this call does frame rendering. /// + /// + /// Capture frame with graphics debugger. + /// [DllImport(DllName, EntryPoint="bgfx_frame", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe uint frame(bool _capture); @@ -979,6 +1075,7 @@ internal struct bgfx /// @remarks /// Library must be initialized. /// + /// [DllImport(DllName, EntryPoint="bgfx_get_renderer_type", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe RendererType get_renderer_type(); @@ -987,6 +1084,7 @@ internal struct bgfx /// @remarks /// Library must be initialized. /// + /// [DllImport(DllName, EntryPoint="bgfx_get_caps", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe Caps* get_caps(); @@ -994,18 +1092,26 @@ internal struct bgfx /// Returns performance counters. /// @attention Pointer returned is valid until `bgfx::frame` is called. /// + /// [DllImport(DllName, EntryPoint="bgfx_get_stats", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe Stats* get_stats(); /// /// Allocate buffer to pass to bgfx calls. Data will be freed inside bgfx. /// + /// + /// Size to allocate. + /// [DllImport(DllName, EntryPoint="bgfx_alloc", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe Memory* alloc(uint _size); /// /// Allocate buffer and copy data into it. Data will be freed inside bgfx. /// + /// + /// Pointer to data to be copied. + /// Size of data to be copied. + /// [DllImport(DllName, EntryPoint="bgfx_copy", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe Memory* copy(void* _data, uint _size); @@ -1018,6 +1124,10 @@ internal struct bgfx /// from any thread. /// @attention Data passed must be available for at least 2 `bgfx::frame` calls. /// + /// + /// Pointer to data. + /// Size of data. + /// [DllImport(DllName, EntryPoint="bgfx_make_ref", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe Memory* make_ref(void* _data, uint _size); @@ -1030,150 +1140,260 @@ internal struct bgfx /// from any thread. /// @attention Data passed must be available for at least 2 `bgfx::frame` calls. /// + /// + /// Pointer to data. + /// Size of data. + /// Callback function to release memory after use. + /// User data to be passed to callback function. + /// [DllImport(DllName, EntryPoint="bgfx_make_ref_release", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe Memory* make_ref_release(void* _data, uint _size, IntPtr _releaseFn, void* _userData); /// /// Set debug flags. /// + /// + /// 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. + /// [DllImport(DllName, EntryPoint="bgfx_set_debug", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void set_debug(uint _debug); /// /// Clear internal debug text buffer. /// + /// + /// Background color. + /// Default 8x16 or 8x8 font. + /// [DllImport(DllName, EntryPoint="bgfx_dbg_text_clear", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void dbg_text_clear(byte _attr, bool _small); /// /// Print formatted data to internal debug text character-buffer (VGA-compatible text mode). /// + /// + /// Position x from the left corner of the window. + /// Position y from the top corner of the window. + /// 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). + /// `printf` style format. + /// [DllImport(DllName, EntryPoint="bgfx_dbg_text_printf", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void dbg_text_printf(ushort _x, ushort _y, byte _attr, [MarshalAs(UnmanagedType.LPStr)] string _format, [MarshalAs(UnmanagedType.LPStr)] string args ); /// /// Print formatted data from variable argument list to internal debug text character-buffer (VGA-compatible text mode). /// + /// + /// Position x from the left corner of the window. + /// Position y from the top corner of the window. + /// 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). + /// `printf` style format. + /// Variable arguments list for format string. + /// [DllImport(DllName, EntryPoint="bgfx_dbg_text_vprintf", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void dbg_text_vprintf(ushort _x, ushort _y, byte _attr, [MarshalAs(UnmanagedType.LPStr)] string _format, IntPtr _argList); /// /// Draw image into internal debug text buffer. /// + /// + /// Position x from the left corner of the window. + /// Position y from the top corner of the window. + /// Image width. + /// Image height. + /// Raw image data (character/attribute raw encoding). + /// Image pitch in bytes. + /// [DllImport(DllName, EntryPoint="bgfx_dbg_text_image", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void dbg_text_image(ushort _x, ushort _y, ushort _width, ushort _height, void* _data, ushort _pitch); /// /// Create static index buffer. /// + /// + /// Index buffer data. + /// 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. + /// [DllImport(DllName, EntryPoint="bgfx_create_index_buffer", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe IndexBufferHandle create_index_buffer(Memory* _mem, ushort _flags); /// /// Set static index buffer debug name. /// + /// + /// Static index buffer handle. + /// Static index buffer name. + /// Static index buffer name length (if length is INT32_MAX, it's expected that _name is zero terminated string. + /// [DllImport(DllName, EntryPoint="bgfx_set_index_buffer_name", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void set_index_buffer_name(IndexBufferHandle _handle, [MarshalAs(UnmanagedType.LPStr)] string _name, int _len); /// /// Destroy static index buffer. /// + /// + /// Static index buffer handle. + /// [DllImport(DllName, EntryPoint="bgfx_destroy_index_buffer", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void destroy_index_buffer(IndexBufferHandle _handle); /// /// Create vertex declaration. /// + /// + /// Vertex declaration. + /// [DllImport(DllName, EntryPoint="bgfx_create_vertex_decl", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe VertexDeclHandle create_vertex_decl(VertexDecl* _decl); /// /// Destroy vertex declaration. /// + /// + /// Vertex declaration handle. + /// [DllImport(DllName, EntryPoint="bgfx_destroy_vertex_decl", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void destroy_vertex_decl(VertexDeclHandle _handle); /// /// Create static vertex buffer. /// + /// + /// Vertex buffer data. + /// Vertex declaration. + /// 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. + /// [DllImport(DllName, EntryPoint="bgfx_create_vertex_buffer", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe VertexBufferHandle create_vertex_buffer(Memory* _mem, VertexDecl* _decl, ushort _flags); /// /// Set static vertex buffer debug name. /// + /// + /// Static vertex buffer handle. + /// Static vertex buffer name. + /// Static vertex buffer name length (if length is INT32_MAX, it's expected that _name is zero terminated string. + /// [DllImport(DllName, EntryPoint="bgfx_set_vertex_buffer_name", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void set_vertex_buffer_name(VertexBufferHandle _handle, [MarshalAs(UnmanagedType.LPStr)] string _name, int _len); /// /// Destroy static vertex buffer. /// + /// + /// Static vertex buffer handle. + /// [DllImport(DllName, EntryPoint="bgfx_destroy_vertex_buffer", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void destroy_vertex_buffer(VertexBufferHandle _handle); /// /// Create empty dynamic index buffer. /// + /// + /// Number of indices. + /// 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. + /// [DllImport(DllName, EntryPoint="bgfx_create_dynamic_index_buffer", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe DynamicIndexBufferHandle create_dynamic_index_buffer(uint _num, ushort _flags); /// /// Create dynamic index buffer and initialized it. /// + /// + /// Index buffer data. + /// 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. + /// [DllImport(DllName, EntryPoint="bgfx_create_dynamic_index_buffer_mem", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe DynamicIndexBufferHandle create_dynamic_index_buffer_mem(Memory* _mem, ushort _flags); /// /// Update dynamic index buffer. /// + /// + /// Dynamic index buffer handle. + /// Start index. + /// Index buffer data. + /// [DllImport(DllName, EntryPoint="bgfx_update_dynamic_index_buffer", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void update_dynamic_index_buffer(DynamicIndexBufferHandle _handle, uint _startIndex, Memory* _mem); /// /// Destroy dynamic index buffer. /// + /// + /// Dynamic index buffer handle. + /// [DllImport(DllName, EntryPoint="bgfx_destroy_dynamic_index_buffer", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void destroy_dynamic_index_buffer(DynamicIndexBufferHandle _handle); /// /// Create empty dynamic vertex buffer. /// + /// + /// Number of vertices. + /// Vertex declaration. + /// 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. + /// [DllImport(DllName, EntryPoint="bgfx_create_dynamic_vertex_buffer", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe DynamicVertexBufferHandle create_dynamic_vertex_buffer(uint _num, VertexDecl* _decl, ushort _flags); /// /// Create dynamic vertex buffer and initialize it. /// + /// + /// Vertex buffer data. + /// Vertex declaration. + /// 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. + /// [DllImport(DllName, EntryPoint="bgfx_create_dynamic_vertex_buffer_mem", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe DynamicVertexBufferHandle create_dynamic_vertex_buffer_mem(Memory* _mem, VertexDecl* _decl, ushort _flags); /// /// Update dynamic vertex buffer. /// + /// + /// Dynamic vertex buffer handle. + /// Start vertex. + /// Vertex buffer data. + /// [DllImport(DllName, EntryPoint="bgfx_update_dynamic_vertex_buffer", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void update_dynamic_vertex_buffer(DynamicVertexBufferHandle _handle, uint _startVertex, Memory* _mem); /// /// Destroy dynamic vertex buffer. /// + /// + /// Dynamic vertex buffer handle. + /// [DllImport(DllName, EntryPoint="bgfx_destroy_dynamic_vertex_buffer", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void destroy_dynamic_vertex_buffer(DynamicVertexBufferHandle _handle); /// /// Returns number of requested or maximum available indices. /// + /// + /// Number of required indices. + /// [DllImport(DllName, EntryPoint="bgfx_get_avail_transient_index_buffer", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe uint get_avail_transient_index_buffer(uint _num); /// /// Returns number of requested or maximum available vertices. /// + /// + /// Number of required vertices. + /// Vertex declaration. + /// [DllImport(DllName, EntryPoint="bgfx_get_avail_transient_vertex_buffer", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe uint get_avail_transient_vertex_buffer(uint _num, VertexDecl* _decl); /// /// Returns number of requested or maximum available instance buffer slots. /// + /// + /// Number of required instances. + /// Stride per instance. + /// [DllImport(DllName, EntryPoint="bgfx_get_avail_instance_data_buffer", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe uint get_avail_instance_data_buffer(uint _num, ushort _stride); @@ -1182,12 +1402,21 @@ internal struct bgfx /// @remarks /// Only 16-bit index buffer is supported. /// + /// + /// TransientIndexBuffer structure is filled and is valid for the duration of frame, and it can be reused for multiple draw calls. + /// Number of indices to allocate. + /// [DllImport(DllName, EntryPoint="bgfx_alloc_transient_index_buffer", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void alloc_transient_index_buffer(TransientIndexBuffer* _tib, uint _num); /// /// Allocate transient vertex buffer. /// + /// + /// TransientVertexBuffer structure is filled and is valid for the duration of frame, and it can be reused for multiple draw calls. + /// Number of vertices to allocate. + /// Vertex declaration. + /// [DllImport(DllName, EntryPoint="bgfx_alloc_transient_vertex_buffer", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void alloc_transient_vertex_buffer(TransientVertexBuffer* _tvb, uint _num, VertexDecl* _decl); @@ -1198,6 +1427,13 @@ internal struct bgfx /// @remarks /// Only 16-bit index buffer is supported. /// + /// + /// TransientVertexBuffer structure is filled and is valid for the duration of frame, and it can be reused for multiple draw calls. + /// Number of vertices to allocate. + /// Vertex declaration. + /// TransientIndexBuffer structure is filled and is valid for the duration of frame, and it can be reused for multiple draw calls. + /// Number of indices to allocate. + /// [DllImport(DllName, EntryPoint="bgfx_alloc_transient_buffers", CallingConvention = CallingConvention.Cdecl)] [return: MarshalAs(UnmanagedType.I1)] internal static extern unsafe bool alloc_transient_buffers(TransientVertexBuffer* _tvb, VertexDecl* _decl, uint _numVertices, TransientIndexBuffer* _tib, uint _numIndices); @@ -1205,24 +1441,38 @@ internal struct bgfx /// /// Allocate instance data buffer. /// + /// + /// InstanceDataBuffer structure is filled and is valid for duration of frame, and it can be reused for multiple draw calls. + /// Number of instances. + /// Instance stride. Must be multiple of 16. + /// [DllImport(DllName, EntryPoint="bgfx_alloc_instance_data_buffer", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void alloc_instance_data_buffer(InstanceDataBuffer* _idb, uint _num, ushort _stride); /// /// Create draw indirect buffer. /// + /// + /// Number of indirect calls. + /// [DllImport(DllName, EntryPoint="bgfx_create_indirect_buffer", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe IndirectBufferHandle create_indirect_buffer(uint _num); /// /// Destroy draw indirect buffer. /// + /// + /// Indirect buffer handle. + /// [DllImport(DllName, EntryPoint="bgfx_destroy_indirect_buffer", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void destroy_indirect_buffer(IndirectBufferHandle _handle); /// /// Create shader from memory buffer. /// + /// + /// Shader binary. + /// [DllImport(DllName, EntryPoint="bgfx_create_shader", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe ShaderHandle create_shader(Memory* _mem); @@ -1231,12 +1481,22 @@ internal struct bgfx /// @remarks /// Only non-predefined uniforms are returned. /// + /// + /// Shader handle. + /// UniformHandle array where data will be stored. + /// Maximum capacity of array. + /// [DllImport(DllName, EntryPoint="bgfx_get_shader_uniforms", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe ushort get_shader_uniforms(ShaderHandle _handle, UniformHandle* _uniforms, ushort _max); /// /// Set shader debug name. /// + /// + /// Shader handle. + /// Shader name. + /// Shader name length (if length is INT32_MAX, it's expected that _name is zero terminated string). + /// [DllImport(DllName, EntryPoint="bgfx_set_shader_name", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void set_shader_name(ShaderHandle _handle, [MarshalAs(UnmanagedType.LPStr)] string _name, int _len); @@ -1245,30 +1505,52 @@ internal struct bgfx /// @remark Once a shader program is created with _handle, /// it is safe to destroy that shader. /// + /// + /// Shader handle. + /// [DllImport(DllName, EntryPoint="bgfx_destroy_shader", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void destroy_shader(ShaderHandle _handle); /// /// Create program with vertex and fragment shaders. /// + /// + /// Vertex shader. + /// Fragment shader. + /// If true, shaders will be destroyed when program is destroyed. + /// [DllImport(DllName, EntryPoint="bgfx_create_program", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe ProgramHandle create_program(ShaderHandle _vsh, ShaderHandle _fsh, bool _destroyShaders); /// /// Create program with compute shader. /// + /// + /// Compute shader. + /// If true, shaders will be destroyed when program is destroyed. + /// [DllImport(DllName, EntryPoint="bgfx_create_compute_program", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe ProgramHandle create_compute_program(ShaderHandle _csh, bool _destroyShaders); /// /// Destroy program. /// + /// + /// Program handle. + /// [DllImport(DllName, EntryPoint="bgfx_destroy_program", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void destroy_program(ProgramHandle _handle); /// /// Validate texture parameters. /// + /// + /// Depth dimension of volume texture. + /// Indicates that texture contains cubemap. + /// Number of layers in texture array. + /// Texture format. See: `TextureFormat::Enum`. + /// Texture flags. See `BGFX_TEXTURE_*`. + /// [DllImport(DllName, EntryPoint="bgfx_is_texture_valid", CallingConvention = CallingConvention.Cdecl)] [return: MarshalAs(UnmanagedType.I1)] internal static extern unsafe bool is_texture_valid(ushort _depth, bool _cubeMap, ushort _numLayers, TextureFormat _format, ulong _flags); @@ -1276,18 +1558,43 @@ internal struct bgfx /// /// Calculate amount of memory required for texture. /// + /// + /// Resulting texture info structure. See: `TextureInfo`. + /// Width. + /// Height. + /// Depth dimension of volume texture. + /// Indicates that texture contains cubemap. + /// Indicates that texture contains full mip-map chain. + /// Number of layers in texture array. + /// Texture format. See: `TextureFormat::Enum`. + /// [DllImport(DllName, EntryPoint="bgfx_calc_texture_size", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void calc_texture_size(TextureInfo* _info, ushort _width, ushort _height, ushort _depth, bool _cubeMap, bool _hasMips, ushort _numLayers, TextureFormat _format); /// /// Create texture from memory buffer. /// + /// + /// DDS, KTX or PVR texture binary data. + /// 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. + /// Skip top level mips when parsing texture. + /// When non-`NULL` is specified it returns parsed texture information. + /// [DllImport(DllName, EntryPoint="bgfx_create_texture", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe TextureHandle create_texture(Memory* _mem, ulong _flags, byte _skip, TextureInfo* _info); /// /// Create 2D texture. /// + /// + /// Width. + /// Height. + /// Indicates that texture contains full mip-map chain. + /// Number of layers in texture array. Must be 1 if caps `BGFX_CAPS_TEXTURE_2D_ARRAY` flag is not set. + /// Texture format. See: `TextureFormat::Enum`. + /// 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. + /// 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. + /// [DllImport(DllName, EntryPoint="bgfx_create_texture_2d", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe TextureHandle create_texture_2d(ushort _width, ushort _height, bool _hasMips, ushort _numLayers, TextureFormat _format, ulong _flags, Memory* _mem); @@ -1295,18 +1602,42 @@ internal struct bgfx /// Create texture with size based on backbuffer ratio. Texture will maintain ratio /// if back buffer resolution changes. /// + /// + /// Texture size in respect to back-buffer size. See: `BackbufferRatio::Enum`. + /// Indicates that texture contains full mip-map chain. + /// Number of layers in texture array. Must be 1 if caps `BGFX_CAPS_TEXTURE_2D_ARRAY` flag is not set. + /// Texture format. See: `TextureFormat::Enum`. + /// 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. + /// [DllImport(DllName, EntryPoint="bgfx_create_texture_2d_scaled", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe TextureHandle create_texture_2d_scaled(BackbufferRatio _ratio, bool _hasMips, ushort _numLayers, TextureFormat _format, ulong _flags); /// /// Create 3D texture. /// + /// + /// Width. + /// Height. + /// Depth. + /// Indicates that texture contains full mip-map chain. + /// Texture format. See: `TextureFormat::Enum`. + /// 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. + /// 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. + /// [DllImport(DllName, EntryPoint="bgfx_create_texture_3d", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe TextureHandle create_texture_3d(ushort _width, ushort _height, ushort _depth, bool _hasMips, TextureFormat _format, ulong _flags, Memory* _mem); /// /// Create Cube texture. /// + /// + /// Cube side size. + /// Indicates that texture contains full mip-map chain. + /// Number of layers in texture array. Must be 1 if caps `BGFX_CAPS_TEXTURE_2D_ARRAY` flag is not set. + /// Texture format. See: `TextureFormat::Enum`. + /// 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. + /// 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. + /// [DllImport(DllName, EntryPoint="bgfx_create_texture_cube", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe TextureHandle create_texture_cube(ushort _size, bool _hasMips, ushort _numLayers, TextureFormat _format, ulong _flags, Memory* _mem); @@ -1314,6 +1645,17 @@ internal struct bgfx /// Update 2D texture. /// @attention It's valid to update only mutable texture. See `bgfx::createTexture2D` for more info. /// + /// + /// Texture handle. + /// Layer in texture array. + /// Mip level. + /// X offset in texture. + /// Y offset in texture. + /// Width of texture block. + /// Height of texture block. + /// Texture update data. + /// Pitch of input image (bytes). When _pitch is set to UINT16_MAX, it will be calculated internally based on _width. + /// [DllImport(DllName, EntryPoint="bgfx_update_texture_2d", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void update_texture_2d(TextureHandle _handle, ushort _layer, byte _mip, ushort _x, ushort _y, ushort _width, ushort _height, Memory* _mem, ushort _pitch); @@ -1321,6 +1663,17 @@ internal struct bgfx /// Update 3D texture. /// @attention It's valid to update only mutable texture. See `bgfx::createTexture3D` for more info. /// + /// + /// Texture handle. + /// Mip level. + /// X offset in texture. + /// Y offset in texture. + /// Z offset in texture. + /// Width of texture block. + /// Height of texture block. + /// Depth of texture block. + /// Texture update data. + /// [DllImport(DllName, EntryPoint="bgfx_update_texture_3d", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void update_texture_3d(TextureHandle _handle, byte _mip, ushort _x, ushort _y, ushort _z, ushort _width, ushort _height, ushort _depth, Memory* _mem); @@ -1328,6 +1681,18 @@ internal struct bgfx /// Update Cube texture. /// @attention It's valid to update only mutable texture. See `bgfx::createTextureCube` for more info. /// + /// + /// Texture handle. + /// Layer in texture array. + /// Cubemap side `BGFX_CUBE_MAP__`, where 0 is +X, 1 is -X, 2 is +Y, 3 is -Y, 4 is +Z, and 5 is -Z. +----------+ |-z 2| | ^ +y | | | | Unfolded cube: | +---->+x | +----------+----------+----------+----------+ |+y 1|+y 4|+y 0|+y 5| | ^ -x | ^ +z | ^ +x | ^ -z | | | | | | | | | | | +---->+z | +---->+x | +---->-z | +---->-x | +----------+----------+----------+----------+ |+z 3| | ^ -y | | | | | +---->+x | +----------+ + /// Mip level. + /// X offset in texture. + /// Y offset in texture. + /// Width of texture block. + /// Height of texture block. + /// Texture update data. + /// Pitch of input image (bytes). When _pitch is set to UINT16_MAX, it will be calculated internally based on _width. + /// [DllImport(DllName, EntryPoint="bgfx_update_texture_cube", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void update_texture_cube(TextureHandle _handle, ushort _layer, byte _side, byte _mip, ushort _x, ushort _y, ushort _width, ushort _height, Memory* _mem, ushort _pitch); @@ -1336,12 +1701,22 @@ internal struct bgfx /// @attention Texture must be created with `BGFX_TEXTURE_READ_BACK` flag. /// @attention Availability depends on: `BGFX_CAPS_TEXTURE_READ_BACK`. /// + /// + /// Texture handle. + /// Destination buffer. + /// Mip level. + /// [DllImport(DllName, EntryPoint="bgfx_read_texture", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe uint read_texture(TextureHandle _handle, void* _data, byte _mip); /// /// Set texture debug name. /// + /// + /// Texture handle. + /// Texture name. + /// Texture name length (if length is INT32_MAX, it's expected that _name is zero terminated string. + /// [DllImport(DllName, EntryPoint="bgfx_set_texture_name", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void set_texture_name(TextureHandle _handle, [MarshalAs(UnmanagedType.LPStr)] string _name, int _len); @@ -1350,18 +1725,30 @@ internal struct bgfx /// @attention Availability depends on: `BGFX_CAPS_TEXTURE_DIRECT_ACCESS`. This feature /// is available on GPUs that have unified memory architecture (UMA) support. /// + /// + /// Texture handle. + /// [DllImport(DllName, EntryPoint="bgfx_get_direct_access_ptr", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void* get_direct_access_ptr(TextureHandle _handle); /// /// Destroy texture. /// + /// + /// Texture handle. + /// [DllImport(DllName, EntryPoint="bgfx_destroy_texture", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void destroy_texture(TextureHandle _handle); /// /// Create frame buffer (simple). /// + /// + /// Texture width. + /// Texture height. + /// Texture format. See: `TextureFormat::Enum`. + /// 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. + /// [DllImport(DllName, EntryPoint="bgfx_create_frame_buffer", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe FrameBufferHandle create_frame_buffer(ushort _width, ushort _height, TextureFormat _format, ulong _textureFlags); @@ -1369,12 +1756,22 @@ internal struct bgfx /// Create frame buffer with size based on backbuffer ratio. Frame buffer will maintain ratio /// if back buffer resolution changes. /// + /// + /// Frame buffer size in respect to back-buffer size. See: `BackbufferRatio::Enum`. + /// Texture format. See: `TextureFormat::Enum`. + /// 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. + /// [DllImport(DllName, EntryPoint="bgfx_create_frame_buffer_scaled", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe FrameBufferHandle create_frame_buffer_scaled(BackbufferRatio _ratio, TextureFormat _format, ulong _textureFlags); /// /// Create MRT frame buffer from texture handles (simple). /// + /// + /// Number of texture handles. + /// Texture attachments. + /// If true, textures will be destroyed when frame buffer is destroyed. + /// [DllImport(DllName, EntryPoint="bgfx_create_frame_buffer_from_handles", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe FrameBufferHandle create_frame_buffer_from_handles(byte _num, TextureHandle* _handles, bool _destroyTexture); @@ -1382,6 +1779,11 @@ internal struct bgfx /// Create MRT frame buffer from texture handles with specific layer and /// mip level. /// + /// + /// Number of attachements. + /// Attachment texture info. See: `bgfx::Attachment`. + /// If true, textures will be destroyed when frame buffer is destroyed. + /// [DllImport(DllName, EntryPoint="bgfx_create_frame_buffer_from_attachment", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe FrameBufferHandle create_frame_buffer_from_attachment(byte _num, Attachment* _attachment, bool _destroyTexture); @@ -1391,24 +1793,42 @@ internal struct bgfx /// Frame buffer cannot be used for sampling. /// @attention Availability depends on: `BGFX_CAPS_SWAP_CHAIN`. /// + /// + /// OS' target native window handle. + /// Window back buffer width. + /// Window back buffer height. + /// Window back buffer color format. + /// Window back buffer depth format. + /// [DllImport(DllName, EntryPoint="bgfx_create_frame_buffer_from_nwh", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe FrameBufferHandle create_frame_buffer_from_nwh(void* _nwh, ushort _width, ushort _height, TextureFormat _format, TextureFormat _depthFormat); /// /// Set frame buffer debug name. /// + /// + /// Frame buffer handle. + /// Frame buffer name. + /// Frame buffer name length (if length is INT32_MAX, it's expected that _name is zero terminated string. + /// [DllImport(DllName, EntryPoint="bgfx_set_frame_buffer_name", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void set_frame_buffer_name(FrameBufferHandle _handle, [MarshalAs(UnmanagedType.LPStr)] string _name, int _len); /// /// Obtain texture handle of frame buffer attachment. /// + /// + /// Frame buffer handle. + /// [DllImport(DllName, EntryPoint="bgfx_get_texture", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe TextureHandle get_texture(FrameBufferHandle _handle, byte _attachment); /// /// Destroy frame buffer. /// + /// + /// Frame buffer handle. + /// [DllImport(DllName, EntryPoint="bgfx_destroy_frame_buffer", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void destroy_frame_buffer(FrameBufferHandle _handle); @@ -1437,48 +1857,76 @@ internal struct bgfx /// - `u_modelViewProj mat4` - concatenated model view projection matrix. /// - `u_alphaRef float` - alpha reference value for alpha test. /// + /// + /// Uniform name in shader. + /// Type of uniform (See: `bgfx::UniformType`). + /// Number of elements in array. + /// [DllImport(DllName, EntryPoint="bgfx_create_uniform", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe UniformHandle create_uniform([MarshalAs(UnmanagedType.LPStr)] string _name, UniformType _type, ushort _num); /// /// Retrieve uniform info. /// + /// + /// Handle to uniform object. + /// Uniform info. + /// [DllImport(DllName, EntryPoint="bgfx_get_uniform_info", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void get_uniform_info(UniformHandle _handle, UniformInfo* _info); /// /// Destroy shader uniform parameter. /// + /// + /// Handle to uniform object. + /// [DllImport(DllName, EntryPoint="bgfx_destroy_uniform", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void destroy_uniform(UniformHandle _handle); /// /// Create occlusion query. /// + /// [DllImport(DllName, EntryPoint="bgfx_create_occlusion_query", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe OcclusionQueryHandle create_occlusion_query(); /// /// Retrieve occlusion query result from previous frame. /// + /// + /// Handle to occlusion query object. + /// Number of pixels that passed test. This argument can be `NULL` if result of occlusion query is not needed. + /// [DllImport(DllName, EntryPoint="bgfx_get_result", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe OcclusionQueryResult get_result(OcclusionQueryHandle _handle, int* _result); /// /// Destroy occlusion query. /// + /// + /// Handle to occlusion query object. + /// [DllImport(DllName, EntryPoint="bgfx_destroy_occlusion_query", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void destroy_occlusion_query(OcclusionQueryHandle _handle); /// /// Set palette color value. /// + /// + /// Index into palette. + /// RGBA floating point values. + /// [DllImport(DllName, EntryPoint="bgfx_set_palette_color", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void set_palette_color(byte _index, float _rgba); /// /// Set palette color value. /// + /// + /// Index into palette. + /// Packed 32-bit RGBA value. + /// [DllImport(DllName, EntryPoint="bgfx_set_palette_color_rgba8", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void set_palette_color_rgba8(byte _index, uint _rgba); @@ -1492,18 +1940,35 @@ internal struct bgfx /// | +--- compute (C) /// +------ view id /// + /// + /// View id. + /// View name. + /// [DllImport(DllName, EntryPoint="bgfx_set_view_name", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void set_view_name(ushort _id, [MarshalAs(UnmanagedType.LPStr)] string _name); /// /// Set view rectangle. Draw primitive outside view will be clipped. /// + /// + /// View id. + /// Position x from the left corner of the window. + /// Position y from the top corner of the window. + /// Width of view port region. + /// Height of view port region. + /// [DllImport(DllName, EntryPoint="bgfx_set_view_rect", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void set_view_rect(ushort _id, ushort _x, ushort _y, ushort _width, ushort _height); /// /// Set view rectangle. Draw primitive outside view will be clipped. /// + /// + /// View id. + /// Position x from the left corner of the window. + /// Position y from the top corner of the window. + /// Width and height will be set in respect to back-buffer size. See: `BackbufferRatio::Enum`. + /// [DllImport(DllName, EntryPoint="bgfx_set_view_rect_ratio", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void set_view_rect_ratio(ushort _id, ushort _x, ushort _y, BackbufferRatio _ratio); @@ -1511,12 +1976,26 @@ internal struct bgfx /// Set view scissor. Draw primitive outside view will be clipped. When /// _x, _y, _width and _height are set to 0, scissor will be disabled. /// + /// + /// View id. + /// Position x from the left corner of the window. + /// Position y from the top corner of the window. + /// Width of view scissor region. + /// Height of view scissor region. + /// [DllImport(DllName, EntryPoint="bgfx_set_view_scissor", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void set_view_scissor(ushort _id, ushort _x, ushort _y, ushort _width, ushort _height); /// /// Set view clear flags. /// + /// + /// View id. + /// Clear flags. Use `BGFX_CLEAR_NONE` to remove any clear operation. See: `BGFX_CLEAR_*`. + /// Color clear value. + /// Depth clear value. + /// Stencil clear value. + /// [DllImport(DllName, EntryPoint="bgfx_set_view_clear", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void set_view_clear(ushort _id, ushort _flags, uint _rgba, float _depth, byte _stencil); @@ -1525,6 +2004,20 @@ internal struct bgfx /// frame buffer texture. Must use `bgfx::setPaletteColor` to setup clear color /// palette. /// + /// + /// View id. + /// Clear flags. Use `BGFX_CLEAR_NONE` to remove any clear operation. See: `BGFX_CLEAR_*`. + /// Depth clear value. + /// Stencil clear value. + /// Palette index for frame buffer attachment 0. + /// Palette index for frame buffer attachment 1. + /// Palette index for frame buffer attachment 2. + /// Palette index for frame buffer attachment 3. + /// Palette index for frame buffer attachment 4. + /// Palette index for frame buffer attachment 5. + /// Palette index for frame buffer attachment 6. + /// Palette index for frame buffer attachment 7. + /// [DllImport(DllName, EntryPoint="bgfx_set_view_clear_mrt", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe 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); @@ -1533,6 +2026,10 @@ internal struct bgfx /// @remarks /// View mode must be set prior calling `bgfx::submit` for the view. /// + /// + /// View id. + /// View sort mode. See `ViewMode::Enum`. + /// [DllImport(DllName, EntryPoint="bgfx_set_view_mode", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void set_view_mode(ushort _id, ViewMode _mode); @@ -1541,6 +2038,10 @@ internal struct bgfx /// @remarks /// Not persistent after `bgfx::reset` call. /// + /// + /// View id. + /// Frame buffer handle. Passing `BGFX_INVALID_HANDLE` as frame buffer handle will draw primitives from this view into default back buffer. + /// [DllImport(DllName, EntryPoint="bgfx_set_view_frame_buffer", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void set_view_frame_buffer(ushort _id, FrameBufferHandle _handle); @@ -1548,24 +2049,40 @@ internal struct bgfx /// Set view view and projection matrices, all draw primitives in this /// view will use these matrices. /// + /// + /// View id. + /// View matrix. + /// Projection matrix. + /// [DllImport(DllName, EntryPoint="bgfx_set_view_transform", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void set_view_transform(ushort _id, void* _view, void* _proj); /// /// Post submit view reordering. /// + /// + /// First view id. + /// Number of views to remap. + /// View remap id table. Passing `NULL` will reset view ids to default state. + /// [DllImport(DllName, EntryPoint="bgfx_set_view_order", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void set_view_order(ushort _id, ushort _num, ushort* _order); /// /// Begin submitting draw calls from thread. /// + /// + /// Explicitly request an encoder for a worker thread. + /// [DllImport(DllName, EntryPoint="bgfx_encoder_begin", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe Encoder* encoder_begin(bool _forThread); /// /// End submitting draw calls from thread. /// + /// + /// Encoder. + /// [DllImport(DllName, EntryPoint="bgfx_encoder_end", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void encoder_end(Encoder* _encoder); @@ -1573,6 +2090,9 @@ internal struct bgfx /// Sets a debug marker. This allows you to group graphics calls together for easy browsing in /// graphics debugging tools. /// + /// + /// Marker string. + /// [DllImport(DllName, EntryPoint="bgfx_encoder_set_marker", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void encoder_set_marker(Encoder* _this, [MarshalAs(UnmanagedType.LPStr)] string _marker); @@ -1589,18 +2109,30 @@ internal struct bgfx /// 2. `BGFX_STATE_BLEND_EQUATION_ADD` is set when no other blend /// equation is specified. /// + /// + /// 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. + /// Sets blend factor used by `BGFX_STATE_BLEND_FACTOR` and `BGFX_STATE_BLEND_INV_FACTOR` blend modes. + /// [DllImport(DllName, EntryPoint="bgfx_encoder_set_state", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void encoder_set_state(Encoder* _this, ulong _state, uint _rgba); /// /// Set condition for rendering. /// + /// + /// Occlusion query handle. + /// Render if occlusion query is visible. + /// [DllImport(DllName, EntryPoint="bgfx_encoder_set_condition", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void encoder_set_condition(Encoder* _this, OcclusionQueryHandle _handle, bool _visible); /// /// Set stencil test state. /// + /// + /// Front stencil state. + /// Back stencil state. If back is set to `BGFX_STENCIL_NONE` _fstencil is applied to both front and back facing primitives. + /// [DllImport(DllName, EntryPoint="bgfx_encoder_set_stencil", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void encoder_set_stencil(Encoder* _this, uint _fstencil, uint _bstencil); @@ -1609,6 +2141,12 @@ internal struct bgfx /// @remark /// To scissor for all primitives in view see `bgfx::setViewScissor`. /// + /// + /// Position x from the left corner of the window. + /// Position y from the top corner of the window. + /// Width of view scissor region. + /// Height of view scissor region. + /// [DllImport(DllName, EntryPoint="bgfx_encoder_set_scissor", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe ushort encoder_set_scissor(Encoder* _this, ushort _x, ushort _y, ushort _width, ushort _height); @@ -1617,6 +2155,9 @@ internal struct bgfx /// @remark /// To scissor for all primitives in view see `bgfx::setViewScissor`. /// + /// + /// Index in scissor cache. + /// [DllImport(DllName, EntryPoint="bgfx_encoder_set_scissor_cached", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void encoder_set_scissor_cached(Encoder* _this, ushort _cache); @@ -1624,12 +2165,20 @@ internal struct bgfx /// Set model matrix for draw primitive. If it is not called, /// the model will be rendered with an identity model matrix. /// + /// + /// Pointer to first matrix in array. + /// Number of matrices in array. + /// [DllImport(DllName, EntryPoint="bgfx_encoder_set_transform", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe uint encoder_set_transform(Encoder* _this, void* _mtx, ushort _num); /// /// Set model matrix from matrix cache for draw primitive. /// + /// + /// Index in matrix cache. + /// Number of matrices from cache. + /// [DllImport(DllName, EntryPoint="bgfx_encoder_set_transform_cached", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void encoder_set_transform_cached(Encoder* _this, uint _cache, ushort _num); @@ -1637,48 +2186,93 @@ internal struct bgfx /// Reserve matrices in internal matrix cache. /// @attention Pointer returned can be modifed until `bgfx::frame` is called. /// + /// + /// Pointer to `Transform` structure. + /// Number of matrices. + /// [DllImport(DllName, EntryPoint="bgfx_encoder_alloc_transform", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe uint encoder_alloc_transform(Encoder* _this, Transform* _transform, ushort _num); /// /// Set shader uniform parameter for draw primitive. /// + /// + /// Uniform. + /// Pointer to uniform data. + /// Number of elements. Passing `UINT16_MAX` will use the _num passed on uniform creation. + /// [DllImport(DllName, EntryPoint="bgfx_encoder_set_uniform", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void encoder_set_uniform(Encoder* _this, UniformHandle _handle, void* _value, ushort _num); /// /// Set index buffer for draw primitive. /// + /// + /// Index buffer. + /// First index to render. + /// Number of indices to render. + /// [DllImport(DllName, EntryPoint="bgfx_encoder_set_index_buffer", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void encoder_set_index_buffer(Encoder* _this, IndexBufferHandle _handle, uint _firstIndex, uint _numIndices); /// /// Set index buffer for draw primitive. /// + /// + /// Dynamic index buffer. + /// First index to render. + /// Number of indices to render. + /// [DllImport(DllName, EntryPoint="bgfx_encoder_set_dynamic_index_buffer", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void encoder_set_dynamic_index_buffer(Encoder* _this, DynamicIndexBufferHandle _handle, uint _firstIndex, uint _numIndices); /// /// Set index buffer for draw primitive. /// + /// + /// Transient index buffer. + /// First index to render. + /// Number of indices to render. + /// [DllImport(DllName, EntryPoint="bgfx_encoder_set_transient_index_buffer", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void encoder_set_transient_index_buffer(Encoder* _this, TransientIndexBuffer* _tib, uint _firstIndex, uint _numIndices); /// /// Set vertex buffer for draw primitive. /// + /// + /// Vertex stream. + /// Vertex buffer. + /// First vertex to render. + /// Number of vertices to render. + /// VertexDecl handle for aliasing vertex buffer. + /// [DllImport(DllName, EntryPoint="bgfx_encoder_set_vertex_buffer", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void encoder_set_vertex_buffer(Encoder* _this, byte _stream, VertexBufferHandle _handle, uint _startVertex, uint _numVertices, VertexDeclHandle _declHandle); /// /// Set vertex buffer for draw primitive. /// + /// + /// Vertex stream. + /// Dynamic vertex buffer. + /// First vertex to render. + /// Number of vertices to render. + /// VertexDecl handle for aliasing vertex buffer. + /// [DllImport(DllName, EntryPoint="bgfx_encoder_set_dynamic_vertex_buffer", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void encoder_set_dynamic_vertex_buffer(Encoder* _this, byte _stream, DynamicVertexBufferHandle _handle, uint _startVertex, uint _numVertices, VertexDeclHandle _declHandle); /// /// Set vertex buffer for draw primitive. /// + /// + /// Vertex stream. + /// Transient vertex buffer. + /// First vertex to render. + /// Number of vertices to render. + /// VertexDecl handle for aliasing vertex buffer. + /// [DllImport(DllName, EntryPoint="bgfx_encoder_set_transient_vertex_buffer", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void encoder_set_transient_vertex_buffer(Encoder* _this, byte _stream, TransientVertexBuffer* _tvb, uint _startVertex, uint _numVertices, VertexDeclHandle _declHandle); @@ -1687,24 +2281,42 @@ internal struct bgfx /// with gl_VertexID. /// @attention Availability depends on: `BGFX_CAPS_VERTEX_ID`. /// + /// + /// Number of vertices. + /// [DllImport(DllName, EntryPoint="bgfx_encoder_set_vertex_count", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void encoder_set_vertex_count(Encoder* _this, uint _numVertices); /// /// Set instance data buffer for draw primitive. /// + /// + /// Transient instance data buffer. + /// First instance data. + /// Number of data instances. + /// [DllImport(DllName, EntryPoint="bgfx_encoder_set_instance_data_buffer", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void encoder_set_instance_data_buffer(Encoder* _this, InstanceDataBuffer* _idb, uint _start, uint _num); /// /// Set instance data buffer for draw primitive. /// + /// + /// Vertex buffer. + /// First instance data. + /// Number of data instances. Set instance data buffer for draw primitive. + /// [DllImport(DllName, EntryPoint="bgfx_encoder_set_instance_data_from_vertex_buffer", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void encoder_set_instance_data_from_vertex_buffer(Encoder* _this, VertexBufferHandle _handle, uint _startVertex, uint _num); /// /// Set instance data buffer for draw primitive. /// + /// + /// Dynamic vertex buffer. + /// First instance data. + /// Number of data instances. + /// [DllImport(DllName, EntryPoint="bgfx_encoder_set_instance_data_from_dynamic_vertex_buffer", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void encoder_set_instance_data_from_dynamic_vertex_buffer(Encoder* _this, DynamicVertexBufferHandle _handle, uint _startVertex, uint _num); @@ -1713,12 +2325,19 @@ internal struct bgfx /// with gl_InstanceID. /// @attention Availability depends on: `BGFX_CAPS_VERTEX_ID`. /// + /// [DllImport(DllName, EntryPoint="bgfx_encoder_set_instance_count", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void encoder_set_instance_count(Encoder* _this, uint _numInstances); /// /// Set texture stage for draw primitive. /// + /// + /// Texture unit. + /// Program sampler. + /// Texture handle. + /// 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. + /// [DllImport(DllName, EntryPoint="bgfx_encoder_set_texture", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void encoder_set_texture(Encoder* _this, byte _stage, UniformHandle _sampler, TextureHandle _handle, uint _flags); @@ -1728,18 +2347,34 @@ internal struct bgfx /// @remark /// These empty draw calls will sort before ordinary draw calls. /// + /// + /// View id. + /// [DllImport(DllName, EntryPoint="bgfx_encoder_touch", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void encoder_touch(Encoder* _this, ushort _id); /// /// Submit primitive for rendering. /// + /// + /// View id. + /// Program. + /// Depth for sorting. + /// Preserve internal draw state for next draw call submit. + /// [DllImport(DllName, EntryPoint="bgfx_encoder_submit", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void encoder_submit(Encoder* _this, ushort _id, ProgramHandle _program, uint _depth, bool _preserveState); /// /// Submit primitive with occlusion query for rendering. /// + /// + /// View id. + /// Program. + /// Occlusion query. + /// Depth for sorting. + /// Preserve internal draw state for next draw call submit. + /// [DllImport(DllName, EntryPoint="bgfx_encoder_submit_occlusion_query", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void encoder_submit_occlusion_query(Encoder* _this, ushort _id, ProgramHandle _program, OcclusionQueryHandle _occlusionQuery, uint _depth, bool _preserveState); @@ -1747,60 +2382,116 @@ internal struct bgfx /// Submit primitive for rendering with index and instance data info from /// indirect buffer. /// + /// + /// View id. + /// Program. + /// Indirect buffer. + /// First element in indirect buffer. + /// Number of dispatches. + /// Depth for sorting. + /// Preserve internal draw state for next draw call submit. + /// [DllImport(DllName, EntryPoint="bgfx_encoder_submit_indirect", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void encoder_submit_indirect(Encoder* _this, ushort _id, ProgramHandle _program, IndirectBufferHandle _indirectHandle, ushort _start, ushort _num, uint _depth, bool _preserveState); /// /// Set compute index buffer. /// + /// + /// Compute stage. + /// Index buffer handle. + /// Buffer access. See `Access::Enum`. + /// [DllImport(DllName, EntryPoint="bgfx_encoder_set_compute_index_buffer", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void encoder_set_compute_index_buffer(Encoder* _this, byte _stage, IndexBufferHandle _handle, Access _access); /// /// Set compute vertex buffer. /// + /// + /// Compute stage. + /// Vertex buffer handle. + /// Buffer access. See `Access::Enum`. + /// [DllImport(DllName, EntryPoint="bgfx_encoder_set_compute_vertex_buffer", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void encoder_set_compute_vertex_buffer(Encoder* _this, byte _stage, VertexBufferHandle _handle, Access _access); /// /// Set compute dynamic index buffer. /// + /// + /// Compute stage. + /// Dynamic index buffer handle. + /// Buffer access. See `Access::Enum`. + /// [DllImport(DllName, EntryPoint="bgfx_encoder_set_compute_dynamic_index_buffer", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void encoder_set_compute_dynamic_index_buffer(Encoder* _this, byte _stage, DynamicIndexBufferHandle _handle, Access _access); /// /// Set compute dynamic vertex buffer. /// + /// + /// Compute stage. + /// Dynamic vertex buffer handle. + /// Buffer access. See `Access::Enum`. + /// [DllImport(DllName, EntryPoint="bgfx_encoder_set_compute_dynamic_vertex_buffer", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void encoder_set_compute_dynamic_vertex_buffer(Encoder* _this, byte _stage, DynamicVertexBufferHandle _handle, Access _access); /// /// Set compute indirect buffer. /// + /// + /// Compute stage. + /// Indirect buffer handle. + /// Buffer access. See `Access::Enum`. + /// [DllImport(DllName, EntryPoint="bgfx_encoder_set_compute_indirect_buffer", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void encoder_set_compute_indirect_buffer(Encoder* _this, byte _stage, IndirectBufferHandle _handle, Access _access); /// /// Set compute image from texture. /// + /// + /// Compute stage. + /// Texture handle. + /// Mip level. + /// Image access. See `Access::Enum`. + /// Texture format. See: `TextureFormat::Enum`. + /// [DllImport(DllName, EntryPoint="bgfx_encoder_set_image", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void encoder_set_image(Encoder* _this, byte _stage, TextureHandle _handle, byte _mip, Access _access, TextureFormat _format); /// /// Dispatch compute. /// + /// + /// View id. + /// Compute program. + /// Number of groups X. + /// Number of groups Y. + /// Number of groups Z. + /// [DllImport(DllName, EntryPoint="bgfx_encoder_dispatch", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void encoder_dispatch(Encoder* _this, ushort _id, ProgramHandle _program, uint _numX, uint _numY, uint _numZ); /// /// Dispatch compute indirect. /// + /// + /// View id. + /// Compute program. + /// Indirect buffer. + /// First element in indirect buffer. + /// Number of dispatches. + /// [DllImport(DllName, EntryPoint="bgfx_encoder_dispatch_indirect", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void encoder_dispatch_indirect(Encoder* _this, ushort _id, ProgramHandle _program, IndirectBufferHandle _indirectHandle, ushort _start, ushort _num); /// /// Discard all previously set state for draw or compute call. /// + /// [DllImport(DllName, EntryPoint="bgfx_encoder_discard", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void encoder_discard(Encoder* _this); @@ -1809,6 +2500,22 @@ internal struct bgfx /// @attention Destination texture must be created with `BGFX_TEXTURE_BLIT_DST` flag. /// @attention Availability depends on: `BGFX_CAPS_TEXTURE_BLIT`. /// + /// + /// View id. + /// Destination texture handle. + /// Destination texture mip level. + /// Destination texture X position. + /// Destination texture Y position. + /// 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. + /// Source texture handle. + /// Source texture mip level. + /// Source texture X position. + /// Source texture Y position. + /// 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. + /// Width of region. + /// Height of region. + /// If texture is 3D this argument represents depth of region, otherwise it's unused. + /// [DllImport(DllName, EntryPoint="bgfx_encoder_blit", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void encoder_blit(Encoder* _this, ushort _id, TextureHandle _dst, byte _dstMip, ushort _dstX, ushort _dstY, ushort _dstZ, TextureHandle _src, byte _srcMip, ushort _srcX, ushort _srcY, ushort _srcZ, ushort _width, ushort _height, ushort _depth); @@ -1818,6 +2525,10 @@ internal struct bgfx /// `bgfx::CallbackI::screenShot` must be implemented. /// @attention Frame buffer handle must be created with OS' target native window handle. /// + /// + /// Frame buffer handle. If handle is `BGFX_INVALID_HANDLE` request will be made for main window back buffer. + /// Will be passed to `bgfx::CallbackI::screenShot` callback. + /// [DllImport(DllName, EntryPoint="bgfx_request_screen_shot", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void request_screen_shot(FrameBufferHandle _handle, [MarshalAs(UnmanagedType.LPStr)] string _filePath); @@ -1831,6 +2542,9 @@ internal struct bgfx /// allow creating separate rendering thread. If it is called before /// to bgfx::init, render thread won't be created by bgfx::init call. /// + /// + /// Timeout in milliseconds. + /// [DllImport(DllName, EntryPoint="bgfx_render_frame", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe RenderFrame render_frame(int _msecs); @@ -1838,6 +2552,9 @@ internal struct bgfx /// Set platform data. /// @warning Must be called before `bgfx::init`. /// + /// + /// Platform data. + /// [DllImport(DllName, EntryPoint="bgfx_set_platform_data", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void set_platform_data(PlatformData* _data); @@ -1847,6 +2564,7 @@ internal struct bgfx /// use this call. /// @warning Must be called only on render thread. /// + /// [DllImport(DllName, EntryPoint="bgfx_get_internal_data", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe InternalData* get_internal_data(); @@ -1857,6 +2575,10 @@ internal struct bgfx /// use this call. /// @warning Must be called only on render thread. /// + /// + /// Texture handle. + /// Native API pointer to texture. + /// [DllImport(DllName, EntryPoint="bgfx_override_internal_texture_ptr", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe UIntPtr override_internal_texture_ptr(TextureHandle _handle, UIntPtr _ptr); @@ -1869,6 +2591,14 @@ internal struct bgfx /// main thread. /// @warning Must be called only on render thread. /// + /// + /// Texture handle. + /// Width. + /// Height. + /// Number of mip-maps. + /// Texture format. See: `TextureFormat::Enum`. + /// 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. + /// [DllImport(DllName, EntryPoint="bgfx_override_internal_texture", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe UIntPtr override_internal_texture(TextureHandle _handle, ushort _width, ushort _height, byte _numMips, TextureFormat _format, ulong _flags); @@ -1876,6 +2606,9 @@ internal struct bgfx /// Sets a debug marker. This allows you to group graphics calls together for easy browsing in /// graphics debugging tools. /// + /// + /// Marker string. + /// [DllImport(DllName, EntryPoint="bgfx_set_marker", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void set_marker([MarshalAs(UnmanagedType.LPStr)] string _marker); @@ -1892,18 +2625,30 @@ internal struct bgfx /// 2. `BGFX_STATE_BLEND_EQUATION_ADD` is set when no other blend /// equation is specified. /// + /// + /// 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. + /// Sets blend factor used by `BGFX_STATE_BLEND_FACTOR` and `BGFX_STATE_BLEND_INV_FACTOR` blend modes. + /// [DllImport(DllName, EntryPoint="bgfx_set_state", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void set_state(ulong _state, uint _rgba); /// /// Set condition for rendering. /// + /// + /// Occlusion query handle. + /// Render if occlusion query is visible. + /// [DllImport(DllName, EntryPoint="bgfx_set_condition", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void set_condition(OcclusionQueryHandle _handle, bool _visible); /// /// Set stencil test state. /// + /// + /// Front stencil state. + /// Back stencil state. If back is set to `BGFX_STENCIL_NONE` _fstencil is applied to both front and back facing primitives. + /// [DllImport(DllName, EntryPoint="bgfx_set_stencil", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void set_stencil(uint _fstencil, uint _bstencil); @@ -1912,6 +2657,12 @@ internal struct bgfx /// @remark /// To scissor for all primitives in view see `bgfx::setViewScissor`. /// + /// + /// Position x from the left corner of the window. + /// Position y from the top corner of the window. + /// Width of view scissor region. + /// Height of view scissor region. + /// [DllImport(DllName, EntryPoint="bgfx_set_scissor", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe ushort set_scissor(ushort _x, ushort _y, ushort _width, ushort _height); @@ -1920,6 +2671,9 @@ internal struct bgfx /// @remark /// To scissor for all primitives in view see `bgfx::setViewScissor`. /// + /// + /// Index in scissor cache. + /// [DllImport(DllName, EntryPoint="bgfx_set_scissor_cached", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void set_scissor_cached(ushort _cache); @@ -1927,12 +2681,20 @@ internal struct bgfx /// Set model matrix for draw primitive. If it is not called, /// the model will be rendered with an identity model matrix. /// + /// + /// Pointer to first matrix in array. + /// Number of matrices in array. + /// [DllImport(DllName, EntryPoint="bgfx_set_transform", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe uint set_transform(void* _mtx, ushort _num); /// /// Set model matrix from matrix cache for draw primitive. /// + /// + /// Index in matrix cache. + /// Number of matrices from cache. + /// [DllImport(DllName, EntryPoint="bgfx_set_transform_cached", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void set_transform_cached(uint _cache, ushort _num); @@ -1940,48 +2702,90 @@ internal struct bgfx /// Reserve matrices in internal matrix cache. /// @attention Pointer returned can be modifed until `bgfx::frame` is called. /// + /// + /// Pointer to `Transform` structure. + /// Number of matrices. + /// [DllImport(DllName, EntryPoint="bgfx_alloc_transform", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe uint alloc_transform(Transform* _transform, ushort _num); /// /// Set shader uniform parameter for draw primitive. /// + /// + /// Uniform. + /// Pointer to uniform data. + /// Number of elements. Passing `UINT16_MAX` will use the _num passed on uniform creation. + /// [DllImport(DllName, EntryPoint="bgfx_set_uniform", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void set_uniform(UniformHandle _handle, void* _value, ushort _num); /// /// Set index buffer for draw primitive. /// + /// + /// Index buffer. + /// First index to render. + /// Number of indices to render. + /// [DllImport(DllName, EntryPoint="bgfx_set_index_buffer", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void set_index_buffer(IndexBufferHandle _handle, uint _firstIndex, uint _numIndices); /// /// Set index buffer for draw primitive. /// + /// + /// Dynamic index buffer. + /// First index to render. + /// Number of indices to render. + /// [DllImport(DllName, EntryPoint="bgfx_set_dynamic_index_buffer", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void set_dynamic_index_buffer(DynamicIndexBufferHandle _handle, uint _firstIndex, uint _numIndices); /// /// Set index buffer for draw primitive. /// + /// + /// Transient index buffer. + /// First index to render. + /// Number of indices to render. + /// [DllImport(DllName, EntryPoint="bgfx_set_transient_index_buffer", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void set_transient_index_buffer(TransientIndexBuffer* _tib, uint _firstIndex, uint _numIndices); /// /// Set vertex buffer for draw primitive. /// + /// + /// Vertex stream. + /// Vertex buffer. + /// First vertex to render. + /// Number of vertices to render. + /// [DllImport(DllName, EntryPoint="bgfx_set_vertex_buffer", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void set_vertex_buffer(byte _stream, VertexBufferHandle _handle, uint _startVertex, uint _numVertices); /// /// Set vertex buffer for draw primitive. /// + /// + /// Vertex stream. + /// Dynamic vertex buffer. + /// First vertex to render. + /// Number of vertices to render. + /// [DllImport(DllName, EntryPoint="bgfx_set_dynamic_vertex_buffer", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void set_dynamic_vertex_buffer(byte _stream, DynamicVertexBufferHandle _handle, uint _startVertex, uint _numVertices); /// /// Set vertex buffer for draw primitive. /// + /// + /// Vertex stream. + /// Transient vertex buffer. + /// First vertex to render. + /// Number of vertices to render. + /// [DllImport(DllName, EntryPoint="bgfx_set_transient_vertex_buffer", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void set_transient_vertex_buffer(byte _stream, TransientVertexBuffer* _tvb, uint _startVertex, uint _numVertices); @@ -1990,24 +2794,42 @@ internal struct bgfx /// with gl_VertexID. /// @attention Availability depends on: `BGFX_CAPS_VERTEX_ID`. /// + /// + /// Number of vertices. + /// [DllImport(DllName, EntryPoint="bgfx_set_vertex_count", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void set_vertex_count(uint _numVertices); /// /// Set instance data buffer for draw primitive. /// + /// + /// Transient instance data buffer. + /// First instance data. + /// Number of data instances. + /// [DllImport(DllName, EntryPoint="bgfx_set_instance_data_buffer", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void set_instance_data_buffer(InstanceDataBuffer* _idb, uint _start, uint _num); /// /// Set instance data buffer for draw primitive. /// + /// + /// Vertex buffer. + /// First instance data. + /// Number of data instances. Set instance data buffer for draw primitive. + /// [DllImport(DllName, EntryPoint="bgfx_set_instance_data_from_vertex_buffer", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void set_instance_data_from_vertex_buffer(VertexBufferHandle _handle, uint _startVertex, uint _num); /// /// Set instance data buffer for draw primitive. /// + /// + /// Dynamic vertex buffer. + /// First instance data. + /// Number of data instances. + /// [DllImport(DllName, EntryPoint="bgfx_set_instance_data_from_dynamic_vertex_buffer", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void set_instance_data_from_dynamic_vertex_buffer(DynamicVertexBufferHandle _handle, uint _startVertex, uint _num); @@ -2016,12 +2838,19 @@ internal struct bgfx /// with gl_InstanceID. /// @attention Availability depends on: `BGFX_CAPS_VERTEX_ID`. /// + /// [DllImport(DllName, EntryPoint="bgfx_set_instance_count", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void set_instance_count(uint _numInstances); /// /// Set texture stage for draw primitive. /// + /// + /// Texture unit. + /// Program sampler. + /// Texture handle. + /// 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. + /// [DllImport(DllName, EntryPoint="bgfx_set_texture", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void set_texture(byte _stage, UniformHandle _sampler, TextureHandle _handle, uint _flags); @@ -2031,18 +2860,34 @@ internal struct bgfx /// @remark /// These empty draw calls will sort before ordinary draw calls. /// + /// + /// View id. + /// [DllImport(DllName, EntryPoint="bgfx_touch", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void touch(ushort _id); /// /// Submit primitive for rendering. /// + /// + /// View id. + /// Program. + /// Depth for sorting. + /// Preserve internal draw state for next draw call submit. + /// [DllImport(DllName, EntryPoint="bgfx_submit", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void submit(ushort _id, ProgramHandle _program, uint _depth, bool _preserveState); /// /// Submit primitive with occlusion query for rendering. /// + /// + /// View id. + /// Program. + /// Occlusion query. + /// Depth for sorting. + /// Preserve internal draw state for next draw call submit. + /// [DllImport(DllName, EntryPoint="bgfx_submit_occlusion_query", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void submit_occlusion_query(ushort _id, ProgramHandle _program, OcclusionQueryHandle _occlusionQuery, uint _depth, bool _preserveState); @@ -2050,60 +2895,116 @@ internal struct bgfx /// Submit primitive for rendering with index and instance data info from /// indirect buffer. /// + /// + /// View id. + /// Program. + /// Indirect buffer. + /// First element in indirect buffer. + /// Number of dispatches. + /// Depth for sorting. + /// Preserve internal draw state for next draw call submit. + /// [DllImport(DllName, EntryPoint="bgfx_submit_indirect", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void submit_indirect(ushort _id, ProgramHandle _program, IndirectBufferHandle _indirectHandle, ushort _start, ushort _num, uint _depth, bool _preserveState); /// /// Set compute index buffer. /// + /// + /// Compute stage. + /// Index buffer handle. + /// Buffer access. See `Access::Enum`. + /// [DllImport(DllName, EntryPoint="bgfx_set_compute_index_buffer", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void set_compute_index_buffer(byte _stage, IndexBufferHandle _handle, Access _access); /// /// Set compute vertex buffer. /// + /// + /// Compute stage. + /// Vertex buffer handle. + /// Buffer access. See `Access::Enum`. + /// [DllImport(DllName, EntryPoint="bgfx_set_compute_vertex_buffer", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void set_compute_vertex_buffer(byte _stage, VertexBufferHandle _handle, Access _access); /// /// Set compute dynamic index buffer. /// + /// + /// Compute stage. + /// Dynamic index buffer handle. + /// Buffer access. See `Access::Enum`. + /// [DllImport(DllName, EntryPoint="bgfx_set_compute_dynamic_index_buffer", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void set_compute_dynamic_index_buffer(byte _stage, DynamicIndexBufferHandle _handle, Access _access); /// /// Set compute dynamic vertex buffer. /// + /// + /// Compute stage. + /// Dynamic vertex buffer handle. + /// Buffer access. See `Access::Enum`. + /// [DllImport(DllName, EntryPoint="bgfx_set_compute_dynamic_vertex_buffer", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void set_compute_dynamic_vertex_buffer(byte _stage, DynamicVertexBufferHandle _handle, Access _access); /// /// Set compute indirect buffer. /// + /// + /// Compute stage. + /// Indirect buffer handle. + /// Buffer access. See `Access::Enum`. + /// [DllImport(DllName, EntryPoint="bgfx_set_compute_indirect_buffer", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void set_compute_indirect_buffer(byte _stage, IndirectBufferHandle _handle, Access _access); /// /// Set compute image from texture. /// + /// + /// Compute stage. + /// Texture handle. + /// Mip level. + /// Image access. See `Access::Enum`. + /// Texture format. See: `TextureFormat::Enum`. + /// [DllImport(DllName, EntryPoint="bgfx_set_image", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void set_image(byte _stage, TextureHandle _handle, byte _mip, Access _access, TextureFormat _format); /// /// Dispatch compute. /// + /// + /// View id. + /// Compute program. + /// Number of groups X. + /// Number of groups Y. + /// Number of groups Z. + /// [DllImport(DllName, EntryPoint="bgfx_dispatch", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void dispatch(ushort _id, ProgramHandle _program, uint _numX, uint _numY, uint _numZ); /// /// Dispatch compute indirect. /// + /// + /// View id. + /// Compute program. + /// Indirect buffer. + /// First element in indirect buffer. + /// Number of dispatches. + /// [DllImport(DllName, EntryPoint="bgfx_dispatch_indirect", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void dispatch_indirect(ushort _id, ProgramHandle _program, IndirectBufferHandle _indirectHandle, ushort _start, ushort _num); /// /// Discard all previously set state for draw or compute call. /// + /// [DllImport(DllName, EntryPoint="bgfx_discard", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void discard(); @@ -2112,6 +3013,22 @@ internal struct bgfx /// @attention Destination texture must be created with `BGFX_TEXTURE_BLIT_DST` flag. /// @attention Availability depends on: `BGFX_CAPS_TEXTURE_BLIT`. /// + /// + /// View id. + /// Destination texture handle. + /// Destination texture mip level. + /// Destination texture X position. + /// Destination texture Y position. + /// 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. + /// Source texture handle. + /// Source texture mip level. + /// Source texture X position. + /// Source texture Y position. + /// 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. + /// Width of region. + /// Height of region. + /// If texture is 3D this argument represents depth of region, otherwise it's unused. + /// [DllImport(DllName, EntryPoint="bgfx_blit", CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void blit(ushort _id, TextureHandle _dst, byte _dstMip, ushort _dstX, ushort _dstY, ushort _dstZ, TextureHandle _src, byte _srcMip, ushort _srcX, ushort _srcY, ushort _srcZ, ushort _width, ushort _height, ushort _depth); diff --git a/scripts/bindings-cs.lua b/scripts/bindings-cs.lua index 58857cf78..1c3e577d2 100644 --- a/scripts/bindings-cs.lua +++ b/scripts/bindings-cs.lua @@ -286,6 +286,33 @@ function converter.funcs(func) yield("/// " .. line) end yield("/// ") + yield("///") + + local hasParams = false + + for _, arg in ipairs(func.args) do + if arg.comment ~= nil then + local comment = "" + if (type(arg.comment) == "table") then + comment = table.concat(arg.comment, " ") + else + comment = arg.comment + end + + yield("/// " + .. comment + .. "" + ) + + hasParams = true + end + end + + if hasParams then + yield("///") + end end yield("[DllImport(DllName, EntryPoint=\"bgfx_" .. func.cname .. "\", CallingConvention = CallingConvention.Cdecl)]")