Adding missing C99 API methods.

This commit is contained in:
Mike Popoloski 2015-05-16 19:07:10 -04:00
parent 4b18beb082
commit ad9e9fe111
3 changed files with 82 additions and 8 deletions

View file

@ -558,6 +558,9 @@ BGFX_C_API void bgfx_destroy_shader(bgfx_shader_handle_t _handle);
/**/
BGFX_C_API bgfx_program_handle_t bgfx_create_program(bgfx_shader_handle_t _vsh, bgfx_shader_handle_t _fsh, bool _destroyShaders);
/**/
BGFX_C_API bgfx_program_handle_t bgfx_create_compute_program(bgfx_shader_handle_t _csh, bool _destroyShaders);
/**/
BGFX_C_API void bgfx_destroy_program(bgfx_program_handle_t _handle);
@ -690,6 +693,12 @@ BGFX_C_API void bgfx_set_transient_vertex_buffer(const bgfx_transient_vertex_buf
/**/
BGFX_C_API void bgfx_set_instance_data_buffer(const bgfx_instance_data_buffer_t* _idb, uint32_t _num);
/**/
BGFX_C_API void bgfx_set_instance_data_from_vertex_buffer(bgfx_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _num);
/**/
BGFX_C_API void bgfx_set_instance_data_from_dynamic_vertex_buffer(bgfx_dynamic_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _num);
/**/
BGFX_C_API void bgfx_set_program(bgfx_program_handle_t _handle);
@ -711,6 +720,21 @@ BGFX_C_API void bgfx_set_image(uint8_t _stage, bgfx_uniform_handle_t _sampler, b
/**/
BGFX_C_API void bgfx_set_image_from_frame_buffer(uint8_t _stage, bgfx_uniform_handle_t _sampler, bgfx_frame_buffer_handle_t _handle, uint8_t _attachment, bgfx_access_t _access, bgfx_texture_format_t _format);
/**/
BGFX_C_API void bgfx_set_compute_index_buffer(uint8_t _stage, bgfx_index_buffer_handle_t _handle, bgfx_access_t _access);
/**/
BGFX_C_API void bgfx_set_compute_vertex_buffer(uint8_t _stage, bgfx_vertex_buffer_handle_t _handle, bgfx_access_t _access);
/**/
BGFX_C_API void bgfx_set_compute_dynamic_index_buffer(uint8_t _stage, bgfx_dynamic_index_buffer_handle_t _handle, bgfx_access_t _access);
/**/
BGFX_C_API void bgfx_set_compute_dynamic_vertex_buffer(uint8_t _stage, bgfx_dynamic_vertex_buffer_handle_t _handle, bgfx_access_t _access);
/**/
BGFX_C_API void bgfx_set_compute_indirect_buffer(uint8_t _stage, bgfx_indirect_buffer_handle_t _handle, bgfx_access_t _access);
/**/
BGFX_C_API uint32_t bgfx_dispatch(uint8_t _id, bgfx_program_handle_t _handle, uint16_t _numX, uint16_t _numY, uint16_t _numZ, uint8_t _flags);

View file

@ -994,7 +994,7 @@ namespace bgfx
/// program is destroyed.
/// @returns Program handle.
///
/// @attention C99 equivalent is ``.
/// @attention C99 equivalent is `bgfx_create_compute_program`.
///
ProgramHandle createProgram(ShaderHandle _csh, bool _destroyShader = false);
@ -1545,13 +1545,13 @@ namespace bgfx
/// Set instance data buffer for draw primitive.
///
/// @attention C99 equivalent is ``.
/// @attention C99 equivalent is `bgfx_set_instance_data_from_vertex_buffer`.
///
void setInstanceDataBuffer(VertexBufferHandle _handle, uint32_t _startVertex, uint32_t _num);
/// Set instance data buffer for draw primitive.
///
/// @attention C99 equivalent is ``.
/// @attention C99 equivalent is `bgfx_set_instance_data_from_dynamic_vertex_buffer`.
///
void setInstanceDataBuffer(DynamicVertexBufferHandle _handle, uint32_t _startVertex, uint32_t _num);
@ -1616,31 +1616,31 @@ namespace bgfx
///
///
/// @attention C99 equivalent is ``.
/// @attention C99 equivalent is `bgfx_set_compute_index_buffer`.
///
void setBuffer(uint8_t _stage, IndexBufferHandle _handle, Access::Enum _access);
///
///
/// @attention C99 equivalent is ``.
/// @attention C99 equivalent is `bgfx_set_compute_vertex_buffer`.
///
void setBuffer(uint8_t _stage, VertexBufferHandle _handle, Access::Enum _access);
///
///
/// @attention C99 equivalent is ``.
/// @attention C99 equivalent is `bgfx_set_compute_dynamic_index_buffer`.
///
void setBuffer(uint8_t _stage, DynamicIndexBufferHandle _handle, Access::Enum _access);
///
///
/// @attention C99 equivalent is ``.
/// @attention C99 equivalent is `bgfx_set_compute_dynamic_vertex_buffer`.
///
void setBuffer(uint8_t _stage, DynamicVertexBufferHandle _handle, Access::Enum _access);
///
///
/// @attention C99 equivalent is ``.
/// @attention C99 equivalent is `bgfx_set_compute_indirect_buffer`.
///
void setBuffer(uint8_t _stage, IndirectBufferHandle _handle, Access::Enum _access);

View file

@ -3364,6 +3364,14 @@ BGFX_C_API bgfx_program_handle_t bgfx_create_program(bgfx_shader_handle_t _vsh,
return handle.c;
}
BGFX_C_API bgfx_program_handle_t bgfx_create_compute_program(bgfx_shader_handle_t _csh, bool _destroyShaders)
{
union { bgfx_shader_handle_t c; bgfx::ShaderHandle cpp; } csh = { _csh };
union { bgfx_program_handle_t c; bgfx::ProgramHandle cpp; } handle;
handle.cpp = bgfx::createProgram(csh.cpp, _destroyShaders);
return handle.c;
}
BGFX_C_API void bgfx_destroy_program(bgfx_program_handle_t _handle)
{
union { bgfx_program_handle_t c; bgfx::ProgramHandle cpp; } handle = { _handle };
@ -3619,6 +3627,18 @@ BGFX_C_API void bgfx_set_instance_data_buffer(const bgfx_instance_data_buffer_t*
bgfx::setInstanceDataBuffer( (const bgfx::InstanceDataBuffer*)_idb, _num);
}
BGFX_C_API void bgfx_set_instance_data_from_vertex_buffer(bgfx_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _num)
{
union { bgfx_vertex_buffer_handle_t c; bgfx::VertexBufferHandle cpp; } handle = { _handle };
bgfx::setInstanceDataBuffer(handle.cpp, _startVertex, _num);
}
BGFX_C_API void bgfx_set_instance_data_from_dynamic_vertex_buffer(bgfx_dynamic_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _num)
{
union { bgfx_dynamic_vertex_buffer_handle_t c; bgfx::DynamicVertexBufferHandle cpp; } handle = { _handle };
bgfx::setInstanceDataBuffer(handle.cpp, _startVertex, _num);
}
BGFX_C_API void bgfx_set_program(bgfx_program_handle_t _handle)
{
union { bgfx_program_handle_t c; bgfx::ProgramHandle cpp; } handle = { _handle };
@ -3664,6 +3684,36 @@ BGFX_C_API void bgfx_set_image_from_frame_buffer(uint8_t _stage, bgfx_uniform_ha
bgfx::setImage(_stage, sampler.cpp, handle.cpp, _attachment, bgfx::Access::Enum(_access), bgfx::TextureFormat::Enum(_format) );
}
BGFX_C_API void bgfx_set_compute_index_buffer(uint8_t _stage, bgfx_index_buffer_handle_t _handle, bgfx_access_t _access)
{
union { bgfx_index_buffer_handle_t c; bgfx::IndexBufferHandle cpp; } handle = { _handle };
bgfx::setBuffer(_stage, handle.cpp, bgfx::Access::Enum(_access) );
}
BGFX_C_API void bgfx_set_compute_vertex_buffer(uint8_t _stage, bgfx_vertex_buffer_handle_t _handle, bgfx_access_t _access)
{
union { bgfx_vertex_buffer_handle_t c; bgfx::VertexBufferHandle cpp; } handle = { _handle };
bgfx::setBuffer(_stage, handle.cpp, bgfx::Access::Enum(_access) );
}
BGFX_C_API void bgfx_set_compute_dynamic_index_buffer(uint8_t _stage, bgfx_dynamic_index_buffer_handle_t _handle, bgfx_access_t _access)
{
union { bgfx_dynamic_index_buffer_handle_t c; bgfx::DynamicIndexBufferHandle cpp; } handle = { _handle };
bgfx::setBuffer(_stage, handle.cpp, bgfx::Access::Enum(_access) );
}
BGFX_C_API void bgfx_set_compute_dynamic_vertex_buffer(uint8_t _stage, bgfx_dynamic_vertex_buffer_handle_t _handle, bgfx_access_t _access)
{
union { bgfx_dynamic_vertex_buffer_handle_t c; bgfx::DynamicVertexBufferHandle cpp; } handle = { _handle };
bgfx::setBuffer(_stage, handle.cpp, bgfx::Access::Enum(_access) );
}
BGFX_C_API void bgfx_set_compute_indirect_buffer(uint8_t _stage, bgfx_indirect_buffer_handle_t _handle, bgfx_access_t _access)
{
union { bgfx_indirect_buffer_handle_t c; bgfx::IndirectBufferHandle cpp; } handle = { _handle };
bgfx::setBuffer(_stage, handle.cpp, bgfx::Access::Enum(_access) );
}
BGFX_C_API uint32_t bgfx_dispatch(uint8_t _id, bgfx_program_handle_t _handle, uint16_t _numX, uint16_t _numY, uint16_t _numZ, uint8_t _flags)
{
union { bgfx_program_handle_t c; bgfx::ProgramHandle cpp; } handle = { _handle };