diff --git a/include/bgfx/bgfx.h b/include/bgfx/bgfx.h index c5f16995b..3badf14ae 100644 --- a/include/bgfx/bgfx.h +++ b/include/bgfx/bgfx.h @@ -1304,13 +1304,13 @@ namespace bgfx /// /// @param[in] _stream Vertex stream. /// @param[in] _handle Vertex buffer. - /// @param[in] _offset First vertex to render. + /// @param[in] _offset Offset of first vertex to render. /// @param[in] _numVertices Number of vertices to render. /// @param[in] _layoutHandle Vertex layout for aliasing vertex buffer. If invalid handle is /// used, vertex layout used for creation of vertex buffer will be used. /// @param[in] _offset Offset of data in buffer. /// - /// @attention C99's equivalent binding is `bgfx_encoder_set_vertex_buffer`. + /// @attention C99's equivalent binding is `bgfx_encoder_set_vertex_buffer_with_offset`. /// void setVertexBufferWithOffset( uint8_t _stream @@ -1360,7 +1360,7 @@ namespace bgfx /// @param[in] _layoutHandle Vertex layout for aliasing vertex buffer. If invalid handle is /// used, vertex layout used for creation of vertex buffer will be used. /// - /// @attention C99's equivalent binding is `bgfx_encoder_set_dynamic_vertex_buffer`. + /// @attention C99's equivalent binding is `bgfx_encoder_set_dynamic_vertex_buffer_with_offset`. /// void setVertexBufferWithOffset( uint8_t _stream @@ -1454,7 +1454,7 @@ namespace bgfx /// @param[in] _num Number of data instances. /// @param[in] _stride Instance stride. Must be multiple of 16. /// - /// @attention C99's equivalent binding is `bgfx_encoder_set_instance_data_with_offset_from_vertex_buffer`. + /// @attention C99's equivalent binding is `bgfx_encoder_set_instance_data_from_vertex_buffer_with_offset`. /// void setInstanceDataBufferWithOffset( VertexBufferHandle _handle @@ -1470,7 +1470,7 @@ namespace bgfx /// @param[in] _start First instance data. /// @param[in] _num Number of data instances. /// - /// @attention C99's equivalent binding is `bgfx_encoder_set_instance_data_from_dynamic_vertex_buffer`. + /// @attention C99's equivalent binding is `bgfx_encoder_set_instance_data_from_dynamic_vertex_buffer_with_offset`. /// void setInstanceDataBuffer( DynamicVertexBufferHandle _handle @@ -2544,7 +2544,7 @@ namespace bgfx /// Create empty dynamic vertex buffer. /// - /// @param[in] _size Size of buffer + /// @param[in] _size Size of buffer. /// @param[in] _layout Vertex layout. /// @param[in] _flags Buffer creation flags. /// - `BGFX_BUFFER_NONE` - No flags. @@ -2560,7 +2560,7 @@ namespace bgfx /// index buffers. /// @returns Dynamic vertex buffer handle. /// - /// @attention C99's equivalent binding is `TODO`. + /// @attention C99's equivalent binding is `bgfx_create_dynamic_vertex_buffer_with_size`. /// DynamicVertexBufferHandle createDynamicVertexBufferWithSize( uint32_t _size @@ -2588,7 +2588,7 @@ namespace bgfx /// @param[in] _offset Offset of data. /// @param[in] _mem Vertex buffer data. /// - /// @attention C99's equivalent binding is `TODO`. + /// @attention C99's equivalent binding is `bgfx_update_dynamic_vertex_buffer_with_offset`. /// void updateWithOffset( DynamicVertexBufferHandle _handle @@ -2729,7 +2729,7 @@ namespace bgfx /// @param[in] _size Buffer size. /// @param[in] _stride Instance stride. Must be multiple of 16. /// - /// @attention C99's equivalent binding is `TODO`. + /// @attention C99's equivalent binding is `bgfx_alloc_instance_data_buffer_with_size`. /// void allocInstanceDataBufferWithSize( InstanceDataBuffer* _idb @@ -3928,7 +3928,7 @@ namespace bgfx /// @param[in] _layoutHandle Vertex layout for aliasing vertex buffer. If invalid handle is /// used, vertex layout used for creation of vertex buffer will be used. /// - /// @attention C99's equivalent binding is `TODO`. + /// @attention C99's equivalent binding is `bgfx_set_vertex_buffer_with_offset`. /// void setVertexBufferWithOffset( uint8_t _stream @@ -3978,7 +3978,7 @@ namespace bgfx /// @param[in] _layoutHandle Vertex layout for aliasing vertex buffer. If invalid handle is /// used, vertex layout used for creation of vertex buffer will be used. /// - /// @attention C99's equivalent binding is `TODO`. + /// @attention C99's equivalent binding is `bgfx_set_dynamic_vertex_buffer_with_offset`. /// void setVertexBufferWithOffset( uint8_t _stream @@ -4072,7 +4072,7 @@ namespace bgfx /// @param[in] _num Number of data instances. /// @param[in] _stride Instance stride. Must be multiple of 16. /// - /// @attention C99's equivalent binding is `bgfx_set_instance_data_from_vertex_buffer`. + /// @attention C99's equivalent binding is `bgfx_set_instance_data_from_vertex_buffer_with_offset`. /// void setInstanceDataBufferWithOffset( VertexBufferHandle _handle @@ -4102,7 +4102,7 @@ namespace bgfx /// @param[in] _num Number of data instances. /// @param[in] _stride Instance stride. Must be multiple of 16. /// - /// @attention C99's equivalent binding is `bgfx_set_instance_data_from_dynamic_vertex_buffer`. + /// @attention C99's equivalent binding is `bgfx_set_instance_data_from_dynamic_vertex_buffer_with_offset`. /// void setInstanceDataBufferWithOffset( DynamicVertexBufferHandle _handle diff --git a/scripts/bgfx.idl b/scripts/bgfx.idl index 93d9a356b..5c5afeb5d 100644 --- a/scripts/bgfx.idl +++ b/scripts/bgfx.idl @@ -1457,6 +1457,24 @@ func.createDynamicVertexBuffer --- - `BGFX_BUFFER_INDEX32` - Buffer is using 32-bit indices. This flag has effect only on --- index buffers. +--- Create empty dynamic vertex buffer. +func.createDynamicVertexBufferWithSize { cname = "create_dynamic_vertex_buffer_with_size" } + "DynamicVertexBufferHandle" --- Dynamic vertex buffer handle. + .size "uint32_t" --- Size of buffer. + .layout "const VertexLayout&" --- Vertex layout. + .flags "uint16_t" --- Buffer creation flags. + { default = "BGFX_BUFFER_NONE" } --- - `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. + --- Create dynamic vertex buffer and initialize it. func.createDynamicVertexBuffer { cname = "create_dynamic_vertex_buffer_mem" } "DynamicVertexBufferHandle" --- Dynamic vertex buffer handle. @@ -1482,6 +1500,13 @@ func.update { cname = "update_dynamic_vertex_buffer" } .startVertex "uint32_t" --- Start vertex. .mem "const Memory*" --- Vertex buffer data. +--- Update dynamic vertex buffer. +func.updateWithOffset { cname = "update_dynamic_vertex_buffer_with_offset" } + "void" + .handle "DynamicVertexBufferHandle" --- Dynamic vertex buffer handle. + .offset "uint32_t" --- Offset of data. + .mem "const Memory*" --- Vertex buffer data. + --- Destroy dynamic vertex buffer. func.destroy { cname = "destroy_dynamic_vertex_buffer" } "void" @@ -1506,6 +1531,12 @@ func.getAvailInstanceDataBuffer .num "uint32_t" --- Number of required instances. .stride "uint16_t" --- Stride per instance. +--- Returns number of requested or maximum available instance buffer bytes. +func.getAvailInstanceDataBufferSize + "uint32_t" --- Size of required instance buffer. + .size "uint32_t" --- Number of required instances. + .stride "uint16_t" --- Stride per instance. + --- Allocate transient index buffer. --- func.allocTransientIndexBuffer @@ -1553,6 +1584,15 @@ func.allocInstanceDataBuffer .num "uint32_t" --- Number of instances. .stride "uint16_t" --- Instance stride. Must be multiple of 16. +--- Allocate instance data buffer. +func.allocInstanceDataBufferWithSize + "void" + .idb "InstanceDataBuffer*" { out } --- InstanceDataBuffer structure will be filled, and will be valid + --- for duration of frame, and can be reused for multiple draw + --- calls. + .size "uint32_t" --- Buffer size. + .stride "uint16_t" --- Instance stride. Must be multiple of 16. + --- Create draw indirect buffer. func.createIndirectBuffer "IndirectBufferHandle" --- Indirect buffer handle. @@ -2316,6 +2356,18 @@ func.Encoder.setVertexBuffer { cname = "set_vertex_buffer_with_layout" } --- of vertex buffer will be used. { default = "BGFX_INVALID_HANDLE" } +--- Set vertex buffer for draw primitive. +func.Encoder.setVertexBufferWithOffset { cname = "set_vertex_buffer_with_offset" } + "void" + .stream "uint8_t" --- Vertex stream. + .handle "VertexBufferHandle" --- Vertex buffer. + .offset "uint32_t" --- Offset of first vertex to render. + .numVertices "uint32_t" --- Number of vertices to render. + .layoutHandle "VertexLayoutHandle" --- Vertex layout for aliasing vertex buffer. If invalid + --- handle is used, vertex layout used for creation + --- of vertex buffer will be used. + { default = "BGFX_INVALID_HANDLE" } + --- Set vertex buffer for draw primitive. func.Encoder.setVertexBuffer { cpponly } "void" @@ -2341,6 +2393,18 @@ func.Encoder.setVertexBuffer { cname = "set_dynamic_vertex_buffer_with_layout" } --- of vertex buffer will be used. { default = "BGFX_INVALID_HANDLE" } +--- Set vertex buffer for draw primitive. +func.Encoder.setVertexBufferWithOffset { cname = "set_dynamic_vertex_buffer_with_offset" } + "void" + .stream "uint8_t" --- Vertex stream. + .handle "DynamicVertexBufferHandle" --- Dynamic vertex buffer. + .offset "uint32_t" --- Offset of first vertex to render. + .numVertices "uint32_t" --- Number of vertices to render. + .layoutHandle "VertexLayoutHandle" --- Vertex layout for aliasing vertex buffer. If invalid + --- handle is used, vertex layout used for creation + --- of vertex buffer will be used. + { default = "BGFX_INVALID_HANDLE" } + --- Set vertex buffer for draw primitive. func.Encoder.setVertexBuffer { cpponly } "void" @@ -2395,6 +2459,14 @@ func.Encoder.setInstanceDataBuffer { cname = "set_instance_data_from_vertex_buff .startVertex "uint32_t" --- First instance data. .num "uint32_t" --- Number of data instances. +--- Set instance data buffer for draw primitive. +func.Encoder.setInstanceDataBufferWithOffset { cname = "set_instance_data_from_vertex_buffer_with_offset" } + "void" + .handle "VertexBufferHandle" --- Vertex buffer. + .offset "uint32_t" --- Offset of first instance data. + .num "uint32_t" --- Number of data instances. + .stride "uint16_t" --- Instance stride. Must be multiple of 16. + --- Set instance data buffer for draw primitive. func.Encoder.setInstanceDataBuffer { cname = "set_instance_data_from_dynamic_vertex_buffer" } "void" @@ -2402,6 +2474,14 @@ func.Encoder.setInstanceDataBuffer { cname = "set_instance_data_from_dynamic_ver .startVertex "uint32_t" --- First instance data. .num "uint32_t" --- Number of data instances. +--- Set instance data buffer for draw primitive. +func.Encoder.setInstanceDataBufferWithOffset { cname = "set_instance_data_from_dynamic_vertex_buffer_with_offset" } + "void" + .handle "DynamicVertexBufferHandle" --- Vertex buffer. + .offset "uint32_t" --- Offset of first instance data. + .num "uint32_t" --- Number of data instances. + .stride "uint16_t" --- Instance stride. Must be multiple of 16. + --- Set number of instances for auto generated instances use in conjunction --- with gl_InstanceID. --- @@ -2886,6 +2966,18 @@ func.setVertexBuffer { cname = "set_vertex_buffer_with_layout" } --- of vertex buffer will be used. { default = "BGFX_INVALID_HANDLE" } + --- Set vertex buffer for draw primitive. +func.setVertexBufferWithOffset { cname = "set_vertex_buffer_with_offset" } + "void" + .stream "uint8_t" --- Vertex stream. + .handle "VertexBufferHandle" --- Vertex buffer. + .offset "uint32_t" --- Offset of first vertex to render. + .numVertices "uint32_t" --- Number of vertices to render. + .layoutHandle "VertexLayoutHandle" --- Vertex layout for aliasing vertex buffer. If invalid + --- handle is used, vertex layout used for creation + --- of vertex buffer will be used. + { default = "BGFX_INVALID_HANDLE" } + --- Set vertex buffer for draw primitive. func.setVertexBuffer { cpponly } "void" @@ -2912,6 +3004,17 @@ func.setVertexBuffer { cname = "set_dynamic_vertex_buffer_with_layout" } --- of vertex buffer will be used. { default = "BGFX_INVALID_HANDLE" } +--- Set vertex buffer for draw primitive. +func.setVertexBufferWithOffset { cname = "set_dynamic_vertex_buffer_with_offset" } + "void" + .stream "uint8_t" --- Vertex stream. + .handle "DynamicVertexBufferHandle" --- Dynamic vertex buffer. + .offset "uint32_t" --- Offset of first vertex to render. + .numVertices "uint32_t" --- Number of vertices to render. + .layoutHandle "VertexLayoutHandle" --- Vertex layout for aliasing vertex buffer. If invalid + --- handle is used, vertex layout used for creation + --- of vertex buffer will be used. + { default = "BGFX_INVALID_HANDLE" } --- Set vertex buffer for draw primitive. func.setVertexBuffer { cpponly } @@ -2967,6 +3070,14 @@ func.setInstanceDataBuffer { cname = "set_instance_data_from_vertex_buffer" } .startVertex "uint32_t" --- First instance data. .num "uint32_t" --- Number of data instances. +--- Set instance data buffer for draw primitive. +func.setInstanceDataBufferWithOffset { cname = "set_instance_data_from_vertex_buffer_with_offset" } + "void" + .handle "VertexBufferHandle" --- Vertex buffer. + .offset "uint32_t" --- First instance data. + .num "uint32_t" --- Number of data instances. + .stride "uint16_t" --- Instance stride. Must be multiple of 16. + --- Set instance data buffer for draw primitive. func.setInstanceDataBuffer { cname = "set_instance_data_from_dynamic_vertex_buffer" } "void" @@ -2974,6 +3085,14 @@ func.setInstanceDataBuffer { cname = "set_instance_data_from_dynamic_vertex_buff .startVertex "uint32_t" --- First instance data. .num "uint32_t" --- Number of data instances. +--- Set instance data buffer for draw primitive. +func.setInstanceDataBufferWithOffset { cname = "set_instance_data_from_dynamic_vertex_buffer_with_offset" } + "void" + .handle "DynamicVertexBufferHandle" --- Dynamic vertex buffer. + .offset "uint32_t" --- First instance data. + .num "uint32_t" --- Number of data instances. + .stride "uint16_t" --- Instance stride. Must be multiple of 16. + --- Set number of instances for auto generated instances use in conjunction --- with gl_InstanceID. ---