commit
13833626f2
File diff suppressed because it is too large
Load Diff
@ -1,734 +0,0 @@
|
|||||||
/*
|
|
||||||
* License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
*
|
|
||||||
* AUTO GENERATED! DO NOT EDIT!
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_vertex_decl_begin(bgfx_vertex_decl_t* _this, bgfx_renderer_type_t _renderer);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_vertex_decl_add(bgfx_vertex_decl_t* _this, bgfx_attrib_t _attrib, uint8_t _num, bgfx_attrib_type_t _type, bool _normalized, bool _asInt);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_vertex_decl_decode(const bgfx_vertex_decl_t* _this, bgfx_attrib_t _attrib, uint8_t * _num, bgfx_attrib_type_t * _type, bool * _normalized, bool * _asInt);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API bool bgfx_vertex_decl_has(const bgfx_vertex_decl_t* _this, bgfx_attrib_t _attrib);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_vertex_decl_skip(bgfx_vertex_decl_t* _this, uint8_t _num);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_vertex_decl_end(bgfx_vertex_decl_t* _this);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_vertex_pack(const float * _input, bool _inputNormalized, bgfx_attrib_t _attr, const bgfx_vertex_decl_t * _decl, void * _data, uint32_t _index);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_vertex_unpack(float * _output, bgfx_attrib_t _attr, const bgfx_vertex_decl_t * _decl, const void * _data, uint32_t _index);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_vertex_convert(const bgfx_vertex_decl_t * _dstDecl, void * _dstData, const bgfx_vertex_decl_t * _srcDecl, const void * _srcData, uint32_t _num);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API uint16_t bgfx_weld_vertices(uint16_t * _output, const bgfx_vertex_decl_t * _decl, const void * _data, uint16_t _num, float _epsilon);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API uint32_t bgfx_topology_convert(bgfx_topology_convert_t _conversion, void * _dst, uint32_t _dstSize, const void * _indices, uint32_t _numIndices, bool _index32);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_topology_sort_tri_list(bgfx_topology_sort_t _sort, void * _dst, uint32_t _dstSize, const float * _dir, const float * _pos, const void * _vertices, uint32_t _stride, const void * _indices, uint32_t _numIndices, bool _index32);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API uint8_t bgfx_get_supported_renderers(uint8_t _max, bgfx_renderer_type_t * _enum);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API const char * bgfx_get_renderer_name(bgfx_renderer_type_t _type);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_init_ctor(bgfx_init_t * _init);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API bool bgfx_init(const bgfx_init_t * _init);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_shutdown();
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_reset(uint32_t _width, uint32_t _height, uint32_t _flags, bgfx_texture_format_t _format);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API uint32_t bgfx_frame(bool _capture);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API bgfx_renderer_type_t bgfx_get_renderer_type();
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API const bgfx_caps_t * bgfx_get_caps();
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API const bgfx_stats_t * bgfx_get_stats();
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API const bgfx_memory_t * bgfx_alloc(uint32_t _size);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API const bgfx_memory_t * bgfx_copy(const void * _data, uint32_t _size);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API const bgfx_memory_t * bgfx_make_ref(const void * _data, uint32_t _size);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API const bgfx_memory_t * bgfx_make_ref_release(const void * _data, uint32_t _size, bgfx_release_fn_t _releaseFn, void * _userData);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_set_debug(uint32_t _debug);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_dbg_text_clear(uint8_t _attr, bool _small);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_dbg_text_printf(uint16_t _x, uint16_t _y, uint8_t _attr, const char * _format, ... );
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_dbg_text_vprintf(uint16_t _x, uint16_t _y, uint8_t _attr, const char * _format, va_list _argList);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_dbg_text_image(uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height, const void * _data, uint16_t _pitch);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API bgfx_index_buffer_handle_t bgfx_create_index_buffer(const bgfx_memory_t * _mem, uint16_t _flags);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_set_index_buffer_name(bgfx_index_buffer_handle_t _handle, const char * _name, int32_t _len);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_destroy_index_buffer(bgfx_index_buffer_handle_t _handle);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API bgfx_vertex_buffer_handle_t bgfx_create_vertex_buffer(const bgfx_memory_t * _mem, const bgfx_vertex_decl_t * _decl, uint16_t _flags);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_set_vertex_buffer_name(bgfx_vertex_buffer_handle_t _handle, const char * _name, int32_t _len);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_destroy_vertex_buffer(bgfx_vertex_buffer_handle_t _handle);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API bgfx_dynamic_index_buffer_handle_t bgfx_create_dynamic_index_buffer(uint32_t _num, uint16_t _flags);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API bgfx_dynamic_index_buffer_handle_t bgfx_create_dynamic_index_buffer_mem(const bgfx_memory_t * _mem, uint16_t _flags);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_update_dynamic_index_buffer(bgfx_dynamic_index_buffer_handle_t _handle, uint32_t _startIndex, const bgfx_memory_t * _mem);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_destroy_dynamic_index_buffer(bgfx_dynamic_index_buffer_handle_t _handle);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API bgfx_dynamic_vertex_buffer_handle_t bgfx_create_dynamic_vertex_buffer(uint32_t _num, const bgfx_vertex_decl_t * _decl, uint16_t _flags);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API bgfx_dynamic_vertex_buffer_handle_t bgfx_create_dynamic_vertex_buffer_mem(const bgfx_memory_t * _mem, const bgfx_vertex_decl_t * _decl, uint16_t _flags);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_update_dynamic_vertex_buffer(bgfx_dynamic_vertex_buffer_handle_t _handle, uint32_t _startVertex, const bgfx_memory_t * _mem);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_destroy_dynamic_vertex_buffer(bgfx_dynamic_vertex_buffer_handle_t _handle);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API uint32_t bgfx_get_avail_transient_index_buffer(uint32_t _num);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API uint32_t bgfx_get_avail_transient_vertex_buffer(uint32_t _num, const bgfx_vertex_decl_t * _decl);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API uint32_t bgfx_get_avail_instance_data_buffer(uint32_t _num, uint16_t _stride);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_alloc_transient_index_buffer(bgfx_transient_index_buffer_t * _tib, uint32_t _num);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_alloc_transient_vertex_buffer(bgfx_transient_vertex_buffer_t * _tvb, uint32_t _num, const bgfx_vertex_decl_t * _decl);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API bool bgfx_alloc_transient_buffers(bgfx_transient_vertex_buffer_t * _tvb, const bgfx_vertex_decl_t * _decl, uint32_t _numVertices, bgfx_transient_index_buffer_t * _tib, uint32_t _numIndices);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_alloc_instance_data_buffer(bgfx_instance_data_buffer_t * _idb, uint32_t _num, uint16_t _stride);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API bgfx_indirect_buffer_handle_t bgfx_create_indirect_buffer(uint32_t _num);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_destroy_indirect_buffer(bgfx_indirect_buffer_handle_t _handle);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API bgfx_shader_handle_t bgfx_create_shader(const bgfx_memory_t * _mem);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API uint16_t bgfx_get_shader_uniforms(bgfx_shader_handle_t _handle, bgfx_uniform_handle_t * _uniforms, uint16_t _max);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_set_shader_name(bgfx_shader_handle_t _handle, const char * _name, int32_t _len);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
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);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API bool bgfx_is_texture_valid(uint16_t _depth, bool _cubeMap, uint16_t _numLayers, bgfx_texture_format_t _format, uint64_t _flags);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_calc_texture_size(bgfx_texture_info_t * _info, uint16_t _width, uint16_t _height, uint16_t _depth, bool _cubeMap, bool _hasMips, uint16_t _numLayers, bgfx_texture_format_t _format);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API bgfx_texture_handle_t bgfx_create_texture(const bgfx_memory_t * _mem, uint64_t _flags, uint8_t _skip, bgfx_texture_info_t * _info);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API bgfx_texture_handle_t bgfx_create_texture_2d(uint16_t _width, uint16_t _height, bool _hasMips, uint16_t _numLayers, bgfx_texture_format_t _format, uint64_t _flags, const bgfx_memory_t * _mem);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API bgfx_texture_handle_t bgfx_create_texture_2d_scaled(bgfx_backbuffer_ratio_t _ratio, bool _hasMips, uint16_t _numLayers, bgfx_texture_format_t _format, uint64_t _flags);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API bgfx_texture_handle_t bgfx_create_texture_3d(uint16_t _width, uint16_t _height, uint16_t _depth, bool _hasMips, bgfx_texture_format_t _format, uint64_t _flags, const bgfx_memory_t * _mem);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API bgfx_texture_handle_t bgfx_create_texture_cube(uint16_t _size, bool _hasMips, uint16_t _numLayers, bgfx_texture_format_t _format, uint64_t _flags, const bgfx_memory_t * _mem);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_update_texture_2d(bgfx_texture_handle_t _handle, uint16_t _layer, uint8_t _mip, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height, const bgfx_memory_t * _mem, uint16_t _pitch);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_update_texture_3d(bgfx_texture_handle_t _handle, uint8_t _mip, uint16_t _x, uint16_t _y, uint16_t _z, uint16_t _width, uint16_t _height, uint16_t _depth, const bgfx_memory_t * _mem);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_update_texture_cube(bgfx_texture_handle_t _handle, uint16_t _layer, uint8_t _side, uint8_t _mip, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height, const bgfx_memory_t * _mem, uint16_t _pitch);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API uint32_t bgfx_read_texture(bgfx_texture_handle_t _handle, void * _data, uint8_t _mip);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_set_texture_name(bgfx_texture_handle_t _handle, const char * _name, int32_t _len);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void * bgfx_get_direct_access_ptr(bgfx_texture_handle_t _handle);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_destroy_texture(bgfx_texture_handle_t _handle);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API bgfx_frame_buffer_handle_t bgfx_create_frame_buffer(uint16_t _width, uint16_t _height, bgfx_texture_format_t _format, uint64_t _textureFlags);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API bgfx_frame_buffer_handle_t bgfx_create_frame_buffer_scaled(bgfx_backbuffer_ratio_t _ratio, bgfx_texture_format_t _format, uint64_t _textureFlags);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API bgfx_frame_buffer_handle_t bgfx_create_frame_buffer_from_handles(uint8_t _num, const bgfx_texture_handle_t * _handles, bool _destroyTexture);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API bgfx_frame_buffer_handle_t bgfx_create_frame_buffer_from_attachment(uint8_t _num, const bgfx_attachment_t * _handles, bool _destroyTexture);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API bgfx_frame_buffer_handle_t bgfx_create_frame_buffer_from_nwh(void * _nwh, uint16_t _width, uint16_t _height, bgfx_texture_format_t _format, bgfx_texture_format_t _depthFormat);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_set_frame_buffer_name(bgfx_frame_buffer_handle_t _handle, const char * _name, int32_t _len);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API bgfx_texture_handle_t bgfx_get_texture(bgfx_frame_buffer_handle_t _handle, uint8_t _attachment);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_destroy_frame_buffer(bgfx_frame_buffer_handle_t _handle);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API bgfx_uniform_handle_t bgfx_create_uniform(const char * _name, bgfx_uniform_type_t _type, uint16_t _num);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_get_uniform_info(bgfx_uniform_handle_t _handle, bgfx_uniform_info_t * _info);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_destroy_uniform(bgfx_uniform_handle_t _handle);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API bgfx_occlusion_query_handle_t bgfx_create_occlusion_query();
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API bgfx_occlusion_query_result_t bgfx_get_result(bgfx_occlusion_query_handle_t _handle, int32_t * _result);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_destroy_occlusion_query(bgfx_occlusion_query_handle_t _handle);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_set_palette_color(uint8_t _index, const float * _rgba);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_set_view_name(bgfx_view_id_t _id, const char * _name);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_set_view_rect(bgfx_view_id_t _id, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_set_view_rect_ratio(bgfx_view_id_t _id, uint16_t _x, uint16_t _y, bgfx_backbuffer_ratio_t _ratio);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_set_view_scissor(bgfx_view_id_t _id, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_set_view_clear(bgfx_view_id_t _id, uint16_t _flags, uint32_t _rgba, float _depth, uint8_t _stencil);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_set_view_clear_mrt(bgfx_view_id_t _id, uint16_t _flags, float _depth, uint8_t _stencil, uint8_t _c0, uint8_t _c1, uint8_t _c2, uint8_t _c3, uint8_t _c4, uint8_t _c5, uint8_t _c6, uint8_t _c7);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_set_view_mode(bgfx_view_id_t _id, bgfx_view_mode_t _mode);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_set_view_frame_buffer(bgfx_view_id_t _id, bgfx_frame_buffer_handle_t _handle);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_set_view_transform(bgfx_view_id_t _id, const void * _view, const void * _proj);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_set_view_order(bgfx_view_id_t _id, uint16_t _num, const bgfx_view_id_t * _order);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API bgfx_encoder_t * bgfx_encoder_begin(bool _forThread);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_encoder_end(bgfx_encoder_t * _encoder);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_encoder_set_marker(bgfx_encoder_t* _this, const char * _marker);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_encoder_set_state(bgfx_encoder_t* _this, uint64_t _state, uint32_t _rgba);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_encoder_set_condition(bgfx_encoder_t* _this, bgfx_occlusion_query_handle_t _handle, bool _visible);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_encoder_set_stencil(bgfx_encoder_t* _this, uint32_t _fstencil, uint32_t _bstencil);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API uint16_t bgfx_encoder_set_scissor(bgfx_encoder_t* _this, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_encoder_set_scissor_cached(bgfx_encoder_t* _this, uint16_t _cache);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API uint32_t bgfx_encoder_set_transform(bgfx_encoder_t* _this, const void * _mtx, uint16_t _num);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_encoder_set_transform_cached(bgfx_encoder_t* _this, uint32_t _cache, uint16_t _num);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API uint32_t bgfx_encoder_alloc_transform(bgfx_encoder_t* _this, bgfx_transform_t * _transform, uint16_t _num);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_encoder_set_uniform(bgfx_encoder_t* _this, bgfx_uniform_handle_t _handle, const void * _value, uint16_t _num);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_encoder_set_index_buffer(bgfx_encoder_t* _this, bgfx_index_buffer_handle_t _handle, uint32_t _firstIndex, uint32_t _numIndices);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_encoder_set_dynamic_index_buffer(bgfx_encoder_t* _this, bgfx_dynamic_index_buffer_handle_t _handle, uint32_t _firstIndex, uint32_t _numIndices);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_encoder_set_transient_index_buffer(bgfx_encoder_t* _this, const bgfx_transient_index_buffer_t * _tib, uint32_t _firstIndex, uint32_t _numIndices);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_encoder_set_vertex_buffer(bgfx_encoder_t* _this, uint8_t _stream, bgfx_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _numVertices);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_encoder_set_dynamic_vertex_buffer(bgfx_encoder_t* _this, uint8_t _stream, bgfx_dynamic_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _numVertices);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_encoder_set_transient_vertex_buffer(bgfx_encoder_t* _this, uint8_t _stream, const bgfx_transient_vertex_buffer_t * _tvb, uint32_t _startVertex, uint32_t _numVertices);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_encoder_set_vertex_count(bgfx_encoder_t* _this, uint32_t _numVertices);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_encoder_set_instance_data_buffer(bgfx_encoder_t* _this, const bgfx_instance_data_buffer_t * _idb, uint32_t _start, uint32_t _num);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_encoder_set_instance_data_from_vertex_buffer(bgfx_encoder_t* _this, bgfx_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _num);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_encoder_set_instance_data_from_dynamic_vertex_buffer(bgfx_encoder_t* _this, bgfx_dynamic_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _num);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_encoder_set_instance_count(bgfx_encoder_t* _this, uint32_t _numInstances);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_encoder_set_texture(bgfx_encoder_t* _this, uint8_t _stage, bgfx_uniform_handle_t _sampler, bgfx_texture_handle_t _handle, uint32_t _flags);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_encoder_touch(bgfx_encoder_t* _this, bgfx_view_id_t _id);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_encoder_submit(bgfx_encoder_t* _this, bgfx_view_id_t _id, bgfx_program_handle_t _program, uint32_t _depth, bool _preserveState);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_encoder_submit_occlusion_query(bgfx_encoder_t* _this, bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_occlusion_query_handle_t _occlusionQuery, uint32_t _depth, bool _preserveState);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_encoder_submit_indirect(bgfx_encoder_t* _this, bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_indirect_buffer_handle_t _indirectHandle, uint16_t _start, uint16_t _num, uint32_t _depth, bool _preserveState);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_encoder_set_compute_index_buffer(bgfx_encoder_t* _this, uint8_t _stage, bgfx_index_buffer_handle_t _handle, bgfx_access_t _access);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_encoder_set_compute_vertex_buffer(bgfx_encoder_t* _this, uint8_t _stage, bgfx_vertex_buffer_handle_t _handle, bgfx_access_t _access);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_encoder_set_compute_dynamic_index_buffer(bgfx_encoder_t* _this, uint8_t _stage, bgfx_dynamic_index_buffer_handle_t _handle, bgfx_access_t _access);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_encoder_set_compute_dynamic_vertex_buffer(bgfx_encoder_t* _this, uint8_t _stage, bgfx_dynamic_vertex_buffer_handle_t _handle, bgfx_access_t _access);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_encoder_set_compute_indirect_buffer(bgfx_encoder_t* _this, uint8_t _stage, bgfx_indirect_buffer_handle_t _handle, bgfx_access_t _access);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_encoder_set_image(bgfx_encoder_t* _this, uint8_t _stage, bgfx_texture_handle_t _handle, uint8_t _mip, bgfx_access_t _access, bgfx_texture_format_t _format);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_encoder_dispatch(bgfx_encoder_t* _this, bgfx_view_id_t _id, bgfx_program_handle_t _program, uint32_t _numX, uint32_t _numY, uint32_t _numZ);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_encoder_dispatch_indirect(bgfx_encoder_t* _this, bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_indirect_buffer_handle_t _indirectHandle, uint16_t _start, uint16_t _num);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_encoder_discard(bgfx_encoder_t* _this);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_encoder_blit(bgfx_encoder_t* _this, bgfx_view_id_t _id, bgfx_texture_handle_t _dst, uint8_t _dstMip, uint16_t _dstX, uint16_t _dstY, uint16_t _dstZ, bgfx_texture_handle_t _src, uint8_t _srcMip, uint16_t _srcX, uint16_t _srcY, uint16_t _srcZ, uint16_t _width, uint16_t _height, uint16_t _depth);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_request_screen_shot(bgfx_frame_buffer_handle_t _handle, const char * _filePath);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API bgfx_render_frame_t bgfx_render_frame(int32_t _msecs);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_set_platform_data(const bgfx_platform_data_t * _data);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API const bgfx_internal_data_t * bgfx_get_internal_data();
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API uintptr_t bgfx_override_internal_texture_ptr(bgfx_texture_handle_t _handle, uintptr_t _ptr);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API uintptr_t bgfx_override_internal_texture(bgfx_texture_handle_t _handle, uint16_t _width, uint16_t _height, uint8_t _numMips, bgfx_texture_format_t _format, uint32_t _flags);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_set_marker(const char * _marker);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_set_state(uint64_t _state, uint32_t _rgba);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_set_condition(bgfx_occlusion_query_handle_t _handle, bool _visible);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_set_stencil(uint32_t _fstencil, uint32_t _bstencil);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API uint16_t bgfx_set_scissor(uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_set_scissor_cached(uint16_t _cache);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API uint32_t bgfx_set_transform(const void * _mtx, uint16_t _num);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_set_transform_cached(uint32_t _cache, uint16_t _num);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API uint32_t bgfx_alloc_transform(bgfx_transform_t * _transform, uint16_t _num);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_set_uniform(bgfx_uniform_handle_t _handle, const void * _value, uint16_t _num);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_set_index_buffer(bgfx_index_buffer_handle_t _handle, uint32_t _firstIndex, uint32_t _numIndices);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_set_dynamic_index_buffer(bgfx_dynamic_index_buffer_handle_t _handle, uint32_t _firstIndex, uint32_t _numIndices);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_set_transient_index_buffer(const bgfx_transient_index_buffer_t * _tib, uint32_t _firstIndex, uint32_t _numIndices);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_set_vertex_buffer(uint8_t _stream, bgfx_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _numVertices);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_set_dynamic_vertex_buffer(uint8_t _stream, bgfx_dynamic_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _numVertices);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_set_transient_vertex_buffer(uint8_t _stream, const bgfx_transient_vertex_buffer_t * _tvb, uint32_t _startVertex, uint32_t _numVertices);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_set_vertex_count(uint32_t _numVertices);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_set_instance_data_buffer(const bgfx_instance_data_buffer_t * _idb, uint32_t _start, 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_instance_count(uint32_t _numInstances);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_set_texture(uint8_t _stage, bgfx_uniform_handle_t _sampler, bgfx_texture_handle_t _handle, uint32_t _flags);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_touch(bgfx_view_id_t _id);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_submit(bgfx_view_id_t _id, bgfx_program_handle_t _program, uint32_t _depth, bool _preserveState);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_submit_occlusion_query(bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_occlusion_query_handle_t _occlusionQuery, uint32_t _depth, bool _preserveState);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_submit_indirect(bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_indirect_buffer_handle_t _indirectHandle, uint16_t _start, uint16_t _num, uint32_t _depth, bool _preserveState);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
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 void bgfx_set_image(uint8_t _stage, bgfx_texture_handle_t _handle, uint8_t _mip, bgfx_access_t _access, bgfx_texture_format_t _format);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_dispatch(bgfx_view_id_t _id, bgfx_program_handle_t _program, uint32_t _numX, uint32_t _numY, uint32_t _numZ);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_dispatch_indirect(bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_indirect_buffer_handle_t _indirectHandle, uint16_t _start, uint16_t _num);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_discard();
|
|
||||||
|
|
||||||
/**/
|
|
||||||
BGFX_C_API void bgfx_blit(bgfx_view_id_t _id, bgfx_texture_handle_t _dst, uint8_t _dstMip, uint16_t _dstX, uint16_t _dstY, uint16_t _dstZ, bgfx_texture_handle_t _src, uint8_t _srcMip, uint16_t _srcX, uint16_t _srcY, uint16_t _srcZ, uint16_t _width, uint16_t _height, uint16_t _depth);
|
|
||||||
|
|
||||||
/**/
|
|
||||||
typedef struct bgfx_interface_vtbl
|
|
||||||
{
|
|
||||||
void (*vertex_decl_begin)(bgfx_vertex_decl_t* _this, bgfx_renderer_type_t _renderer);
|
|
||||||
void (*vertex_decl_add)(bgfx_vertex_decl_t* _this, bgfx_attrib_t _attrib, uint8_t _num, bgfx_attrib_type_t _type, bool _normalized, bool _asInt);
|
|
||||||
void (*vertex_decl_decode)(const bgfx_vertex_decl_t* _this, bgfx_attrib_t _attrib, uint8_t * _num, bgfx_attrib_type_t * _type, bool * _normalized, bool * _asInt);
|
|
||||||
bool (*vertex_decl_has)(const bgfx_vertex_decl_t* _this, bgfx_attrib_t _attrib);
|
|
||||||
void (*vertex_decl_skip)(bgfx_vertex_decl_t* _this, uint8_t _num);
|
|
||||||
void (*vertex_decl_end)(bgfx_vertex_decl_t* _this);
|
|
||||||
void (*vertex_pack)(const float * _input, bool _inputNormalized, bgfx_attrib_t _attr, const bgfx_vertex_decl_t * _decl, void * _data, uint32_t _index);
|
|
||||||
void (*vertex_unpack)(float * _output, bgfx_attrib_t _attr, const bgfx_vertex_decl_t * _decl, const void * _data, uint32_t _index);
|
|
||||||
void (*vertex_convert)(const bgfx_vertex_decl_t * _dstDecl, void * _dstData, const bgfx_vertex_decl_t * _srcDecl, const void * _srcData, uint32_t _num);
|
|
||||||
uint16_t (*weld_vertices)(uint16_t * _output, const bgfx_vertex_decl_t * _decl, const void * _data, uint16_t _num, float _epsilon);
|
|
||||||
uint32_t (*topology_convert)(bgfx_topology_convert_t _conversion, void * _dst, uint32_t _dstSize, const void * _indices, uint32_t _numIndices, bool _index32);
|
|
||||||
void (*topology_sort_tri_list)(bgfx_topology_sort_t _sort, void * _dst, uint32_t _dstSize, const float * _dir, const float * _pos, const void * _vertices, uint32_t _stride, const void * _indices, uint32_t _numIndices, bool _index32);
|
|
||||||
uint8_t (*get_supported_renderers)(uint8_t _max, bgfx_renderer_type_t * _enum);
|
|
||||||
const char * (*get_renderer_name)(bgfx_renderer_type_t _type);
|
|
||||||
void (*init_ctor)(bgfx_init_t * _init);
|
|
||||||
bool (*init)(const bgfx_init_t * _init);
|
|
||||||
void (*shutdown)();
|
|
||||||
void (*reset)(uint32_t _width, uint32_t _height, uint32_t _flags, bgfx_texture_format_t _format);
|
|
||||||
uint32_t (*frame)(bool _capture);
|
|
||||||
bgfx_renderer_type_t (*get_renderer_type)();
|
|
||||||
const bgfx_caps_t * (*get_caps)();
|
|
||||||
const bgfx_stats_t * (*get_stats)();
|
|
||||||
const bgfx_memory_t * (*alloc)(uint32_t _size);
|
|
||||||
const bgfx_memory_t * (*copy)(const void * _data, uint32_t _size);
|
|
||||||
const bgfx_memory_t * (*make_ref)(const void * _data, uint32_t _size);
|
|
||||||
const bgfx_memory_t * (*make_ref_release)(const void * _data, uint32_t _size, bgfx_release_fn_t _releaseFn, void * _userData);
|
|
||||||
void (*set_debug)(uint32_t _debug);
|
|
||||||
void (*dbg_text_clear)(uint8_t _attr, bool _small);
|
|
||||||
void (*dbg_text_printf)(uint16_t _x, uint16_t _y, uint8_t _attr, const char * _format, ... );
|
|
||||||
void (*dbg_text_vprintf)(uint16_t _x, uint16_t _y, uint8_t _attr, const char * _format, va_list _argList);
|
|
||||||
void (*dbg_text_image)(uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height, const void * _data, uint16_t _pitch);
|
|
||||||
bgfx_index_buffer_handle_t (*create_index_buffer)(const bgfx_memory_t * _mem, uint16_t _flags);
|
|
||||||
void (*set_index_buffer_name)(bgfx_index_buffer_handle_t _handle, const char * _name, int32_t _len);
|
|
||||||
void (*destroy_index_buffer)(bgfx_index_buffer_handle_t _handle);
|
|
||||||
bgfx_vertex_buffer_handle_t (*create_vertex_buffer)(const bgfx_memory_t * _mem, const bgfx_vertex_decl_t * _decl, uint16_t _flags);
|
|
||||||
void (*set_vertex_buffer_name)(bgfx_vertex_buffer_handle_t _handle, const char * _name, int32_t _len);
|
|
||||||
void (*destroy_vertex_buffer)(bgfx_vertex_buffer_handle_t _handle);
|
|
||||||
bgfx_dynamic_index_buffer_handle_t (*create_dynamic_index_buffer)(uint32_t _num, uint16_t _flags);
|
|
||||||
bgfx_dynamic_index_buffer_handle_t (*create_dynamic_index_buffer_mem)(const bgfx_memory_t * _mem, uint16_t _flags);
|
|
||||||
void (*update_dynamic_index_buffer)(bgfx_dynamic_index_buffer_handle_t _handle, uint32_t _startIndex, const bgfx_memory_t * _mem);
|
|
||||||
void (*destroy_dynamic_index_buffer)(bgfx_dynamic_index_buffer_handle_t _handle);
|
|
||||||
bgfx_dynamic_vertex_buffer_handle_t (*create_dynamic_vertex_buffer)(uint32_t _num, const bgfx_vertex_decl_t * _decl, uint16_t _flags);
|
|
||||||
bgfx_dynamic_vertex_buffer_handle_t (*create_dynamic_vertex_buffer_mem)(const bgfx_memory_t * _mem, const bgfx_vertex_decl_t * _decl, uint16_t _flags);
|
|
||||||
void (*update_dynamic_vertex_buffer)(bgfx_dynamic_vertex_buffer_handle_t _handle, uint32_t _startVertex, const bgfx_memory_t * _mem);
|
|
||||||
void (*destroy_dynamic_vertex_buffer)(bgfx_dynamic_vertex_buffer_handle_t _handle);
|
|
||||||
uint32_t (*get_avail_transient_index_buffer)(uint32_t _num);
|
|
||||||
uint32_t (*get_avail_transient_vertex_buffer)(uint32_t _num, const bgfx_vertex_decl_t * _decl);
|
|
||||||
uint32_t (*get_avail_instance_data_buffer)(uint32_t _num, uint16_t _stride);
|
|
||||||
void (*alloc_transient_index_buffer)(bgfx_transient_index_buffer_t * _tib, uint32_t _num);
|
|
||||||
void (*alloc_transient_vertex_buffer)(bgfx_transient_vertex_buffer_t * _tvb, uint32_t _num, const bgfx_vertex_decl_t * _decl);
|
|
||||||
bool (*alloc_transient_buffers)(bgfx_transient_vertex_buffer_t * _tvb, const bgfx_vertex_decl_t * _decl, uint32_t _numVertices, bgfx_transient_index_buffer_t * _tib, uint32_t _numIndices);
|
|
||||||
void (*alloc_instance_data_buffer)(bgfx_instance_data_buffer_t * _idb, uint32_t _num, uint16_t _stride);
|
|
||||||
bgfx_indirect_buffer_handle_t (*create_indirect_buffer)(uint32_t _num);
|
|
||||||
void (*destroy_indirect_buffer)(bgfx_indirect_buffer_handle_t _handle);
|
|
||||||
bgfx_shader_handle_t (*create_shader)(const bgfx_memory_t * _mem);
|
|
||||||
uint16_t (*get_shader_uniforms)(bgfx_shader_handle_t _handle, bgfx_uniform_handle_t * _uniforms, uint16_t _max);
|
|
||||||
void (*set_shader_name)(bgfx_shader_handle_t _handle, const char * _name, int32_t _len);
|
|
||||||
void (*destroy_shader)(bgfx_shader_handle_t _handle);
|
|
||||||
bgfx_program_handle_t (*create_program)(bgfx_shader_handle_t _vsh, bgfx_shader_handle_t _fsh, bool _destroyShaders);
|
|
||||||
bgfx_program_handle_t (*create_compute_program)(bgfx_shader_handle_t _csh, bool _destroyShaders);
|
|
||||||
void (*destroy_program)(bgfx_program_handle_t _handle);
|
|
||||||
bool (*is_texture_valid)(uint16_t _depth, bool _cubeMap, uint16_t _numLayers, bgfx_texture_format_t _format, uint64_t _flags);
|
|
||||||
void (*calc_texture_size)(bgfx_texture_info_t * _info, uint16_t _width, uint16_t _height, uint16_t _depth, bool _cubeMap, bool _hasMips, uint16_t _numLayers, bgfx_texture_format_t _format);
|
|
||||||
bgfx_texture_handle_t (*create_texture)(const bgfx_memory_t * _mem, uint64_t _flags, uint8_t _skip, bgfx_texture_info_t * _info);
|
|
||||||
bgfx_texture_handle_t (*create_texture_2d)(uint16_t _width, uint16_t _height, bool _hasMips, uint16_t _numLayers, bgfx_texture_format_t _format, uint64_t _flags, const bgfx_memory_t * _mem);
|
|
||||||
bgfx_texture_handle_t (*create_texture_2d_scaled)(bgfx_backbuffer_ratio_t _ratio, bool _hasMips, uint16_t _numLayers, bgfx_texture_format_t _format, uint64_t _flags);
|
|
||||||
bgfx_texture_handle_t (*create_texture_3d)(uint16_t _width, uint16_t _height, uint16_t _depth, bool _hasMips, bgfx_texture_format_t _format, uint64_t _flags, const bgfx_memory_t * _mem);
|
|
||||||
bgfx_texture_handle_t (*create_texture_cube)(uint16_t _size, bool _hasMips, uint16_t _numLayers, bgfx_texture_format_t _format, uint64_t _flags, const bgfx_memory_t * _mem);
|
|
||||||
void (*update_texture_2d)(bgfx_texture_handle_t _handle, uint16_t _layer, uint8_t _mip, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height, const bgfx_memory_t * _mem, uint16_t _pitch);
|
|
||||||
void (*update_texture_3d)(bgfx_texture_handle_t _handle, uint8_t _mip, uint16_t _x, uint16_t _y, uint16_t _z, uint16_t _width, uint16_t _height, uint16_t _depth, const bgfx_memory_t * _mem);
|
|
||||||
void (*update_texture_cube)(bgfx_texture_handle_t _handle, uint16_t _layer, uint8_t _side, uint8_t _mip, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height, const bgfx_memory_t * _mem, uint16_t _pitch);
|
|
||||||
uint32_t (*read_texture)(bgfx_texture_handle_t _handle, void * _data, uint8_t _mip);
|
|
||||||
void (*set_texture_name)(bgfx_texture_handle_t _handle, const char * _name, int32_t _len);
|
|
||||||
void * (*get_direct_access_ptr)(bgfx_texture_handle_t _handle);
|
|
||||||
void (*destroy_texture)(bgfx_texture_handle_t _handle);
|
|
||||||
bgfx_frame_buffer_handle_t (*create_frame_buffer)(uint16_t _width, uint16_t _height, bgfx_texture_format_t _format, uint64_t _textureFlags);
|
|
||||||
bgfx_frame_buffer_handle_t (*create_frame_buffer_scaled)(bgfx_backbuffer_ratio_t _ratio, bgfx_texture_format_t _format, uint64_t _textureFlags);
|
|
||||||
bgfx_frame_buffer_handle_t (*create_frame_buffer_from_handles)(uint8_t _num, const bgfx_texture_handle_t * _handles, bool _destroyTexture);
|
|
||||||
bgfx_frame_buffer_handle_t (*create_frame_buffer_from_attachment)(uint8_t _num, const bgfx_attachment_t * _handles, bool _destroyTexture);
|
|
||||||
bgfx_frame_buffer_handle_t (*create_frame_buffer_from_nwh)(void * _nwh, uint16_t _width, uint16_t _height, bgfx_texture_format_t _format, bgfx_texture_format_t _depthFormat);
|
|
||||||
void (*set_frame_buffer_name)(bgfx_frame_buffer_handle_t _handle, const char * _name, int32_t _len);
|
|
||||||
bgfx_texture_handle_t (*get_texture)(bgfx_frame_buffer_handle_t _handle, uint8_t _attachment);
|
|
||||||
void (*destroy_frame_buffer)(bgfx_frame_buffer_handle_t _handle);
|
|
||||||
bgfx_uniform_handle_t (*create_uniform)(const char * _name, bgfx_uniform_type_t _type, uint16_t _num);
|
|
||||||
void (*get_uniform_info)(bgfx_uniform_handle_t _handle, bgfx_uniform_info_t * _info);
|
|
||||||
void (*destroy_uniform)(bgfx_uniform_handle_t _handle);
|
|
||||||
bgfx_occlusion_query_handle_t (*create_occlusion_query)();
|
|
||||||
bgfx_occlusion_query_result_t (*get_result)(bgfx_occlusion_query_handle_t _handle, int32_t * _result);
|
|
||||||
void (*destroy_occlusion_query)(bgfx_occlusion_query_handle_t _handle);
|
|
||||||
void (*set_palette_color)(uint8_t _index, const float * _rgba);
|
|
||||||
void (*set_view_name)(bgfx_view_id_t _id, const char * _name);
|
|
||||||
void (*set_view_rect)(bgfx_view_id_t _id, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height);
|
|
||||||
void (*set_view_rect_ratio)(bgfx_view_id_t _id, uint16_t _x, uint16_t _y, bgfx_backbuffer_ratio_t _ratio);
|
|
||||||
void (*set_view_scissor)(bgfx_view_id_t _id, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height);
|
|
||||||
void (*set_view_clear)(bgfx_view_id_t _id, uint16_t _flags, uint32_t _rgba, float _depth, uint8_t _stencil);
|
|
||||||
void (*set_view_clear_mrt)(bgfx_view_id_t _id, uint16_t _flags, float _depth, uint8_t _stencil, uint8_t _c0, uint8_t _c1, uint8_t _c2, uint8_t _c3, uint8_t _c4, uint8_t _c5, uint8_t _c6, uint8_t _c7);
|
|
||||||
void (*set_view_mode)(bgfx_view_id_t _id, bgfx_view_mode_t _mode);
|
|
||||||
void (*set_view_frame_buffer)(bgfx_view_id_t _id, bgfx_frame_buffer_handle_t _handle);
|
|
||||||
void (*set_view_transform)(bgfx_view_id_t _id, const void * _view, const void * _proj);
|
|
||||||
void (*set_view_order)(bgfx_view_id_t _id, uint16_t _num, const bgfx_view_id_t * _order);
|
|
||||||
bgfx_encoder_t * (*encoder_begin)(bool _forThread);
|
|
||||||
void (*encoder_end)(bgfx_encoder_t * _encoder);
|
|
||||||
void (*encoder_set_marker)(bgfx_encoder_t* _this, const char * _marker);
|
|
||||||
void (*encoder_set_state)(bgfx_encoder_t* _this, uint64_t _state, uint32_t _rgba);
|
|
||||||
void (*encoder_set_condition)(bgfx_encoder_t* _this, bgfx_occlusion_query_handle_t _handle, bool _visible);
|
|
||||||
void (*encoder_set_stencil)(bgfx_encoder_t* _this, uint32_t _fstencil, uint32_t _bstencil);
|
|
||||||
uint16_t (*encoder_set_scissor)(bgfx_encoder_t* _this, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height);
|
|
||||||
void (*encoder_set_scissor_cached)(bgfx_encoder_t* _this, uint16_t _cache);
|
|
||||||
uint32_t (*encoder_set_transform)(bgfx_encoder_t* _this, const void * _mtx, uint16_t _num);
|
|
||||||
void (*encoder_set_transform_cached)(bgfx_encoder_t* _this, uint32_t _cache, uint16_t _num);
|
|
||||||
uint32_t (*encoder_alloc_transform)(bgfx_encoder_t* _this, bgfx_transform_t * _transform, uint16_t _num);
|
|
||||||
void (*encoder_set_uniform)(bgfx_encoder_t* _this, bgfx_uniform_handle_t _handle, const void * _value, uint16_t _num);
|
|
||||||
void (*encoder_set_index_buffer)(bgfx_encoder_t* _this, bgfx_index_buffer_handle_t _handle, uint32_t _firstIndex, uint32_t _numIndices);
|
|
||||||
void (*encoder_set_dynamic_index_buffer)(bgfx_encoder_t* _this, bgfx_dynamic_index_buffer_handle_t _handle, uint32_t _firstIndex, uint32_t _numIndices);
|
|
||||||
void (*encoder_set_transient_index_buffer)(bgfx_encoder_t* _this, const bgfx_transient_index_buffer_t * _tib, uint32_t _firstIndex, uint32_t _numIndices);
|
|
||||||
void (*encoder_set_vertex_buffer)(bgfx_encoder_t* _this, uint8_t _stream, bgfx_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _numVertices);
|
|
||||||
void (*encoder_set_dynamic_vertex_buffer)(bgfx_encoder_t* _this, uint8_t _stream, bgfx_dynamic_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _numVertices);
|
|
||||||
void (*encoder_set_transient_vertex_buffer)(bgfx_encoder_t* _this, uint8_t _stream, const bgfx_transient_vertex_buffer_t * _tvb, uint32_t _startVertex, uint32_t _numVertices);
|
|
||||||
void (*encoder_set_vertex_count)(bgfx_encoder_t* _this, uint32_t _numVertices);
|
|
||||||
void (*encoder_set_instance_data_buffer)(bgfx_encoder_t* _this, const bgfx_instance_data_buffer_t * _idb, uint32_t _start, uint32_t _num);
|
|
||||||
void (*encoder_set_instance_data_from_vertex_buffer)(bgfx_encoder_t* _this, bgfx_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _num);
|
|
||||||
void (*encoder_set_instance_data_from_dynamic_vertex_buffer)(bgfx_encoder_t* _this, bgfx_dynamic_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _num);
|
|
||||||
void (*encoder_set_instance_count)(bgfx_encoder_t* _this, uint32_t _numInstances);
|
|
||||||
void (*encoder_set_texture)(bgfx_encoder_t* _this, uint8_t _stage, bgfx_uniform_handle_t _sampler, bgfx_texture_handle_t _handle, uint32_t _flags);
|
|
||||||
void (*encoder_touch)(bgfx_encoder_t* _this, bgfx_view_id_t _id);
|
|
||||||
void (*encoder_submit)(bgfx_encoder_t* _this, bgfx_view_id_t _id, bgfx_program_handle_t _program, uint32_t _depth, bool _preserveState);
|
|
||||||
void (*encoder_submit_occlusion_query)(bgfx_encoder_t* _this, bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_occlusion_query_handle_t _occlusionQuery, uint32_t _depth, bool _preserveState);
|
|
||||||
void (*encoder_submit_indirect)(bgfx_encoder_t* _this, bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_indirect_buffer_handle_t _indirectHandle, uint16_t _start, uint16_t _num, uint32_t _depth, bool _preserveState);
|
|
||||||
void (*encoder_set_compute_index_buffer)(bgfx_encoder_t* _this, uint8_t _stage, bgfx_index_buffer_handle_t _handle, bgfx_access_t _access);
|
|
||||||
void (*encoder_set_compute_vertex_buffer)(bgfx_encoder_t* _this, uint8_t _stage, bgfx_vertex_buffer_handle_t _handle, bgfx_access_t _access);
|
|
||||||
void (*encoder_set_compute_dynamic_index_buffer)(bgfx_encoder_t* _this, uint8_t _stage, bgfx_dynamic_index_buffer_handle_t _handle, bgfx_access_t _access);
|
|
||||||
void (*encoder_set_compute_dynamic_vertex_buffer)(bgfx_encoder_t* _this, uint8_t _stage, bgfx_dynamic_vertex_buffer_handle_t _handle, bgfx_access_t _access);
|
|
||||||
void (*encoder_set_compute_indirect_buffer)(bgfx_encoder_t* _this, uint8_t _stage, bgfx_indirect_buffer_handle_t _handle, bgfx_access_t _access);
|
|
||||||
void (*encoder_set_image)(bgfx_encoder_t* _this, uint8_t _stage, bgfx_texture_handle_t _handle, uint8_t _mip, bgfx_access_t _access, bgfx_texture_format_t _format);
|
|
||||||
void (*encoder_dispatch)(bgfx_encoder_t* _this, bgfx_view_id_t _id, bgfx_program_handle_t _program, uint32_t _numX, uint32_t _numY, uint32_t _numZ);
|
|
||||||
void (*encoder_dispatch_indirect)(bgfx_encoder_t* _this, bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_indirect_buffer_handle_t _indirectHandle, uint16_t _start, uint16_t _num);
|
|
||||||
void (*encoder_discard)(bgfx_encoder_t* _this);
|
|
||||||
void (*encoder_blit)(bgfx_encoder_t* _this, bgfx_view_id_t _id, bgfx_texture_handle_t _dst, uint8_t _dstMip, uint16_t _dstX, uint16_t _dstY, uint16_t _dstZ, bgfx_texture_handle_t _src, uint8_t _srcMip, uint16_t _srcX, uint16_t _srcY, uint16_t _srcZ, uint16_t _width, uint16_t _height, uint16_t _depth);
|
|
||||||
void (*request_screen_shot)(bgfx_frame_buffer_handle_t _handle, const char * _filePath);
|
|
||||||
bgfx_render_frame_t (*render_frame)(int32_t _msecs);
|
|
||||||
void (*set_platform_data)(const bgfx_platform_data_t * _data);
|
|
||||||
const bgfx_internal_data_t * (*get_internal_data)();
|
|
||||||
uintptr_t (*override_internal_texture_ptr)(bgfx_texture_handle_t _handle, uintptr_t _ptr);
|
|
||||||
uintptr_t (*override_internal_texture)(bgfx_texture_handle_t _handle, uint16_t _width, uint16_t _height, uint8_t _numMips, bgfx_texture_format_t _format, uint32_t _flags);
|
|
||||||
void (*set_marker)(const char * _marker);
|
|
||||||
void (*set_state)(uint64_t _state, uint32_t _rgba);
|
|
||||||
void (*set_condition)(bgfx_occlusion_query_handle_t _handle, bool _visible);
|
|
||||||
void (*set_stencil)(uint32_t _fstencil, uint32_t _bstencil);
|
|
||||||
uint16_t (*set_scissor)(uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height);
|
|
||||||
void (*set_scissor_cached)(uint16_t _cache);
|
|
||||||
uint32_t (*set_transform)(const void * _mtx, uint16_t _num);
|
|
||||||
void (*set_transform_cached)(uint32_t _cache, uint16_t _num);
|
|
||||||
uint32_t (*alloc_transform)(bgfx_transform_t * _transform, uint16_t _num);
|
|
||||||
void (*set_uniform)(bgfx_uniform_handle_t _handle, const void * _value, uint16_t _num);
|
|
||||||
void (*set_index_buffer)(bgfx_index_buffer_handle_t _handle, uint32_t _firstIndex, uint32_t _numIndices);
|
|
||||||
void (*set_dynamic_index_buffer)(bgfx_dynamic_index_buffer_handle_t _handle, uint32_t _firstIndex, uint32_t _numIndices);
|
|
||||||
void (*set_transient_index_buffer)(const bgfx_transient_index_buffer_t * _tib, uint32_t _firstIndex, uint32_t _numIndices);
|
|
||||||
void (*set_vertex_buffer)(uint8_t _stream, bgfx_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _numVertices);
|
|
||||||
void (*set_dynamic_vertex_buffer)(uint8_t _stream, bgfx_dynamic_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _numVertices);
|
|
||||||
void (*set_transient_vertex_buffer)(uint8_t _stream, const bgfx_transient_vertex_buffer_t * _tvb, uint32_t _startVertex, uint32_t _numVertices);
|
|
||||||
void (*set_vertex_count)(uint32_t _numVertices);
|
|
||||||
void (*set_instance_data_buffer)(const bgfx_instance_data_buffer_t * _idb, uint32_t _start, uint32_t _num);
|
|
||||||
void (*set_instance_data_from_vertex_buffer)(bgfx_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _num);
|
|
||||||
void (*set_instance_data_from_dynamic_vertex_buffer)(bgfx_dynamic_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _num);
|
|
||||||
void (*set_instance_count)(uint32_t _numInstances);
|
|
||||||
void (*set_texture)(uint8_t _stage, bgfx_uniform_handle_t _sampler, bgfx_texture_handle_t _handle, uint32_t _flags);
|
|
||||||
void (*touch)(bgfx_view_id_t _id);
|
|
||||||
void (*submit)(bgfx_view_id_t _id, bgfx_program_handle_t _program, uint32_t _depth, bool _preserveState);
|
|
||||||
void (*submit_occlusion_query)(bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_occlusion_query_handle_t _occlusionQuery, uint32_t _depth, bool _preserveState);
|
|
||||||
void (*submit_indirect)(bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_indirect_buffer_handle_t _indirectHandle, uint16_t _start, uint16_t _num, uint32_t _depth, bool _preserveState);
|
|
||||||
void (*set_compute_index_buffer)(uint8_t _stage, bgfx_index_buffer_handle_t _handle, bgfx_access_t _access);
|
|
||||||
void (*set_compute_vertex_buffer)(uint8_t _stage, bgfx_vertex_buffer_handle_t _handle, bgfx_access_t _access);
|
|
||||||
void (*set_compute_dynamic_index_buffer)(uint8_t _stage, bgfx_dynamic_index_buffer_handle_t _handle, bgfx_access_t _access);
|
|
||||||
void (*set_compute_dynamic_vertex_buffer)(uint8_t _stage, bgfx_dynamic_vertex_buffer_handle_t _handle, bgfx_access_t _access);
|
|
||||||
void (*set_compute_indirect_buffer)(uint8_t _stage, bgfx_indirect_buffer_handle_t _handle, bgfx_access_t _access);
|
|
||||||
void (*set_image)(uint8_t _stage, bgfx_texture_handle_t _handle, uint8_t _mip, bgfx_access_t _access, bgfx_texture_format_t _format);
|
|
||||||
void (*dispatch)(bgfx_view_id_t _id, bgfx_program_handle_t _program, uint32_t _numX, uint32_t _numY, uint32_t _numZ);
|
|
||||||
void (*dispatch_indirect)(bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_indirect_buffer_handle_t _indirectHandle, uint16_t _start, uint16_t _num);
|
|
||||||
void (*discard)();
|
|
||||||
void (*blit)(bgfx_view_id_t _id, bgfx_texture_handle_t _dst, uint8_t _dstMip, uint16_t _dstX, uint16_t _dstY, uint16_t _dstZ, bgfx_texture_handle_t _src, uint8_t _srcMip, uint16_t _srcX, uint16_t _srcY, uint16_t _srcZ, uint16_t _width, uint16_t _height, uint16_t _depth);
|
|
||||||
} bgfx_interface_vtbl_t;
|
|
@ -6,7 +6,7 @@
|
|||||||
#ifndef BGFX_DEFINES_H_HEADER_GUARD
|
#ifndef BGFX_DEFINES_H_HEADER_GUARD
|
||||||
#define BGFX_DEFINES_H_HEADER_GUARD
|
#define BGFX_DEFINES_H_HEADER_GUARD
|
||||||
|
|
||||||
#define BGFX_API_VERSION UINT32_C(95)
|
#define BGFX_API_VERSION UINT32_C(96)
|
||||||
|
|
||||||
/// Color RGB/alpha/depth write. When it's not specified write will be disabled.
|
/// Color RGB/alpha/depth write. When it's not specified write will be disabled.
|
||||||
#define BGFX_STATE_WRITE_R UINT64_C(0x0000000000000001) //!< Enable R write.
|
#define BGFX_STATE_WRITE_R UINT64_C(0x0000000000000001) //!< Enable R write.
|
||||||
|
@ -1,97 +1,289 @@
|
|||||||
-- Copyright 2019 云风 https://github.com/cloudwu . All rights reserved.
|
-- Copyright 2019 云风 https://github.com/cloudwu . All rights reserved.
|
||||||
-- License (the same with bgfx) : https://github.com/bkaradzic/bgfx/blob/master/LICENSE
|
-- License (the same with bgfx) : https://github.com/bkaradzic/bgfx/blob/master/LICENSE
|
||||||
|
|
||||||
function doIdl()
|
local idl = require "idl"
|
||||||
|
local codegen = require "codegen"
|
||||||
|
local doxygen = require "doxygen"
|
||||||
|
|
||||||
local idl = require "idl"
|
local func_actions = {
|
||||||
local codegen = require "codegen"
|
c99 = "\n",
|
||||||
|
c99decl = "\n",
|
||||||
|
cppdecl = "\n",
|
||||||
|
interface_struct = "\n\t",
|
||||||
|
interface_import = ",\n\t\t\t",
|
||||||
|
c99_interface = "\n",
|
||||||
|
cpp_interface = "\n",
|
||||||
|
}
|
||||||
|
|
||||||
assert(loadfile("bgfx.idl" , "t", idl))()
|
local type_actions = {
|
||||||
|
enums = "\n",
|
||||||
|
cenums = "\n",
|
||||||
|
structs = "\n",
|
||||||
|
cstructs = "\n",
|
||||||
|
handles = "\n",
|
||||||
|
chandles = "\n",
|
||||||
|
funcptrs = "\n",
|
||||||
|
cfuncptrs = "\n",
|
||||||
|
}
|
||||||
|
|
||||||
codegen.nameconversion(idl.types, idl.funcs)
|
do
|
||||||
|
local source = doxygen.load "bgfx.idl"
|
||||||
|
local f = assert(load(source, "bgfx.idl" , "t", idl))
|
||||||
|
f()
|
||||||
|
end
|
||||||
|
|
||||||
local code_temp_include = [[
|
codegen.nameconversion(idl.types, idl.funcs)
|
||||||
/*
|
|
||||||
* License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
local function cfunc(f)
|
||||||
*
|
return function(func)
|
||||||
* AUTO GENERATED! DO NOT EDIT!
|
if not func.cpponly then
|
||||||
*
|
return f(func)
|
||||||
*/
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
$c99decl
|
local funcgen = {}
|
||||||
/**/
|
|
||||||
typedef struct bgfx_interface_vtbl
|
local functemp = {}
|
||||||
|
|
||||||
|
functemp.interface_struct = "$CRET (*$CFUNCNAME)($CARGS);"
|
||||||
|
functemp.interface_import = "bgfx_$CFUNCNAME"
|
||||||
|
functemp.c99_interface = [[
|
||||||
|
BGFX_C_API $CRET bgfx_$CFUNCNAME($CARGS)
|
||||||
{
|
{
|
||||||
$interface_struct
|
$CONVERSIONCTOC
|
||||||
} bgfx_interface_vtbl_t;
|
$PRERETCTOCg_interface->$CFUNCNAME($CALLARGS);
|
||||||
]]
|
$POSTRETCTOC
|
||||||
|
|
||||||
local code_temp_impl = [[
|
|
||||||
/*
|
|
||||||
* License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
*
|
|
||||||
* AUTO GENERATED! DO NOT EDIT!
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
$c99
|
|
||||||
/**/
|
|
||||||
BGFX_C_API bgfx_interface_vtbl_t* bgfx_get_interface(uint32_t _version)
|
|
||||||
{
|
|
||||||
if (_version == BGFX_API_VERSION)
|
|
||||||
{
|
|
||||||
static bgfx_interface_vtbl_t s_bgfx_interface =
|
|
||||||
{
|
|
||||||
$interface_import
|
|
||||||
};
|
|
||||||
|
|
||||||
return &s_bgfx_interface;
|
|
||||||
}
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
]]
|
]]
|
||||||
|
|
||||||
local function codes()
|
for action,temp in pairs(functemp) do
|
||||||
local temp = {}
|
funcgen[action] = cfunc(function(func)
|
||||||
local action = {
|
return codegen.apply_functemp(func, temp)
|
||||||
c99 = "\n",
|
end)
|
||||||
c99decl = "\n",
|
end
|
||||||
interface_struct = "\n\t",
|
|
||||||
interface_import = ",\n\t\t\t",
|
funcgen.cpp_interface= cfunc(function(func)
|
||||||
}
|
if not func.cfunc and not func.conly then
|
||||||
for k in pairs(action) do
|
return codegen.apply_functemp(func, [[
|
||||||
temp[k] = {}
|
$RET $CLASSNAME$FUNCNAME($CPPARGS)$CONST
|
||||||
end
|
{
|
||||||
for _, f in ipairs(idl.funcs) do
|
$CONVERSIONCTOCPP
|
||||||
for k in pairs(action) do
|
$PRERETCPPTOCg_interface->$CFUNCNAME($CALLARGSCPPTOC);
|
||||||
table.insert(temp[k], (codegen["gen_"..k](f)))
|
$POSTRETCPPTOC
|
||||||
|
}
|
||||||
|
]])
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
funcgen.c99 = cfunc(function(func)
|
||||||
|
local temp
|
||||||
|
if func.cfunc then
|
||||||
|
temp = "/* BGFX_C_API $CRET bgfx_$CFUNCNAME($CARGS) */\n"
|
||||||
|
else
|
||||||
|
temp = [[
|
||||||
|
BGFX_C_API $CRET bgfx_$CFUNCNAME($CARGS)
|
||||||
|
{
|
||||||
|
$CONVERSION
|
||||||
|
$PRERET$CPPFUNC($CALLARGSCTOCPP);
|
||||||
|
$POSTRET
|
||||||
|
}
|
||||||
|
]]
|
||||||
|
end
|
||||||
|
return codegen.apply_functemp(func, temp)
|
||||||
|
end)
|
||||||
|
|
||||||
|
local function cppdecl(func)
|
||||||
|
local doc = func.comments
|
||||||
|
if not doc and func.comment then
|
||||||
|
doc = { func.comment }
|
||||||
|
end
|
||||||
|
if doc then
|
||||||
|
local cname
|
||||||
|
if not func.cpponly then
|
||||||
|
if func.multicfunc then
|
||||||
|
cname = {}
|
||||||
|
for _, name in ipairs(func.multicfunc) do
|
||||||
|
cname[#cname+1] = "bgfx_" .. name
|
||||||
|
end
|
||||||
|
else
|
||||||
|
cname = "bgfx_" .. func.cname
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
doc = codegen.doxygen_type(doc, func, cname)
|
||||||
|
end
|
||||||
|
local funcdecl = codegen.apply_functemp(func, "$RET $FUNCNAME($ARGS)$CONST;\n")
|
||||||
|
if doc then
|
||||||
|
return doc .. "\n" .. funcdecl
|
||||||
|
else
|
||||||
|
return funcdecl
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
for k, ident in pairs(action) do
|
function funcgen.cppdecl(func)
|
||||||
temp[k] = table.concat(temp[k], ident)
|
-- Don't generate member functions here
|
||||||
|
if not func.class and not func.conly then
|
||||||
|
return cppdecl(func)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
funcgen.c99decl = cfunc(function(func)
|
||||||
|
local doc = func.comments
|
||||||
|
if not doc and func.comment then
|
||||||
|
doc = { func.comment }
|
||||||
|
end
|
||||||
|
if doc then
|
||||||
|
doc = codegen.doxygen_ctype(doc, func)
|
||||||
|
end
|
||||||
|
local funcdecl = codegen.apply_functemp(func, "BGFX_C_API $CRET bgfx_$CFUNCNAME($CARGS);")
|
||||||
|
if doc then
|
||||||
|
return "\n" .. doc .. "\n" .. funcdecl
|
||||||
|
else
|
||||||
|
return funcdecl
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
local typegen = {}
|
||||||
|
|
||||||
|
local function add_doxygen(typedef, define, cstyle, cname)
|
||||||
|
local func = cstyle and codegen.doxygen_ctype or codegen.doxygen_type
|
||||||
|
local doc = func(typedef.comments, typedef, cname or typedef.cname)
|
||||||
|
if doc then
|
||||||
|
return doc .. "\n" .. define
|
||||||
|
else
|
||||||
|
return define
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
return temp
|
function typegen.enums(typedef)
|
||||||
|
if typedef.enum then
|
||||||
|
return add_doxygen(typedef, codegen.gen_enum_define(typedef), false, "bgfx_" .. typedef.cname)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function typegen.cenums(typedef)
|
||||||
|
if typedef.enum then
|
||||||
|
return add_doxygen(typedef, codegen.gen_enum_cdefine(typedef), true)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function typegen.structs(typedef)
|
||||||
|
if typedef.struct and not typedef.namespace then
|
||||||
|
local methods = typedef.methods
|
||||||
|
if methods then
|
||||||
|
local m = {}
|
||||||
|
for _, func in ipairs(methods) do
|
||||||
|
m[#m+1] = cppdecl(func)
|
||||||
|
end
|
||||||
|
methods = m
|
||||||
|
end
|
||||||
|
return add_doxygen(typedef, codegen.gen_struct_define(typedef, methods))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function typegen.cstructs(typedef)
|
||||||
|
if typedef.struct then
|
||||||
|
return add_doxygen(typedef, codegen.gen_struct_cdefine(typedef), true)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function typegen.handles(typedef)
|
||||||
|
if typedef.handle then
|
||||||
|
return codegen.gen_handle(typedef)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function typegen.chandles(typedef)
|
||||||
|
if typedef.handle then
|
||||||
|
return codegen.gen_chandle(typedef)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function typegen.funcptrs(typedef)
|
||||||
|
if typedef.args then
|
||||||
|
return add_doxygen(typedef, codegen.gen_funcptr(typedef))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function typegen.cfuncptrs(typedef)
|
||||||
|
if typedef.args then
|
||||||
|
return add_doxygen(typedef, codegen.gen_cfuncptr(typedef), true)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function codes()
|
||||||
|
local temp = {}
|
||||||
|
for k in pairs(func_actions) do
|
||||||
|
temp[k] = {}
|
||||||
end
|
end
|
||||||
|
|
||||||
local codes_tbl = codes()
|
for k in pairs(type_actions) do
|
||||||
|
temp[k] = {}
|
||||||
|
end
|
||||||
|
|
||||||
for filename, temp in pairs {
|
-- call actions with func
|
||||||
["../include/bgfx/c99/bgfx.idl.h"] = code_temp_include ,
|
for _, f in ipairs(idl.funcs) do
|
||||||
["../src/bgfx.idl.inl"] = code_temp_impl } do
|
for k in pairs(func_actions) do
|
||||||
|
local funcgen = funcgen[k]
|
||||||
|
if funcgen then
|
||||||
|
table.insert(temp[k], (funcgen(f)))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
print ("Generate " .. filename)
|
-- call actions with type
|
||||||
local out = io.open(filename, "wb")
|
|
||||||
out:write((temp:gsub("$([%l%d_]+)", codes_tbl)))
|
for _, typedef in ipairs(idl.types) do
|
||||||
out:close()
|
for k in pairs(type_actions) do
|
||||||
|
local typegen = typegen[k]
|
||||||
|
if typegen then
|
||||||
|
table.insert(temp[k], (typegen(typedef)))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
for k, ident in pairs(func_actions) do
|
||||||
|
temp[k] = table.concat(temp[k], ident)
|
||||||
|
end
|
||||||
|
for k, ident in pairs(type_actions) do
|
||||||
|
temp[k] = table.concat(temp[k], ident)
|
||||||
|
end
|
||||||
|
|
||||||
|
return temp
|
||||||
|
end
|
||||||
|
|
||||||
|
local codes_tbl = codes()
|
||||||
|
|
||||||
|
local function add_path(filename)
|
||||||
|
local path
|
||||||
|
if type(paths) == "string" then
|
||||||
|
path = paths
|
||||||
|
else
|
||||||
|
path = assert(paths[filename])
|
||||||
|
end
|
||||||
|
return path .. "/" .. filename
|
||||||
|
end
|
||||||
|
|
||||||
|
local function genidl(filename, outputfile)
|
||||||
|
local tempfile = "temp." .. filename
|
||||||
|
print ("Generate", outputfile, "from", tempfile)
|
||||||
|
local f = assert(io.open(tempfile, "rb"))
|
||||||
|
local temp = f:read "a"
|
||||||
|
f:close()
|
||||||
|
local out = assert(io.open(outputfile, "wb"))
|
||||||
|
codes_tbl.source = tempfile
|
||||||
|
out:write((temp:gsub("$([%l%d_]+)", codes_tbl)))
|
||||||
|
out:close()
|
||||||
|
end
|
||||||
|
|
||||||
|
function doIdl()
|
||||||
|
local files = {
|
||||||
|
["bgfx.h"] = "../include/bgfx/c99",
|
||||||
|
["bgfx.idl.inl"] = "../src",
|
||||||
|
}
|
||||||
|
|
||||||
|
for filename, path in pairs (files) do
|
||||||
|
genidl(filename, path .. "/" .. filename)
|
||||||
end
|
end
|
||||||
|
|
||||||
os.exit()
|
os.exit()
|
||||||
|
2700
scripts/bgfx.idl
2700
scripts/bgfx.idl
File diff suppressed because it is too large
Load Diff
@ -3,6 +3,13 @@
|
|||||||
|
|
||||||
local codegen = {}
|
local codegen = {}
|
||||||
|
|
||||||
|
local NAMEALIGN = 20
|
||||||
|
|
||||||
|
local function namealign(name, align)
|
||||||
|
align = align or NAMEALIGN
|
||||||
|
return string.rep(" ", align - #name)
|
||||||
|
end
|
||||||
|
|
||||||
local function camelcase_to_underscorecase(name)
|
local function camelcase_to_underscorecase(name)
|
||||||
local tmp = {}
|
local tmp = {}
|
||||||
for v in name:gmatch "[%u%d]+%l*" do
|
for v in name:gmatch "[%u%d]+%l*" do
|
||||||
@ -11,20 +18,25 @@ local function camelcase_to_underscorecase(name)
|
|||||||
return table.concat(tmp, "_")
|
return table.concat(tmp, "_")
|
||||||
end
|
end
|
||||||
|
|
||||||
local function convert_typename(name)
|
|
||||||
if name:match "^%u" then
|
|
||||||
return "bgfx_" .. camelcase_to_underscorecase(name) .. "_t"
|
|
||||||
else
|
|
||||||
return name
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local function convert_funcname(name)
|
local function convert_funcname(name)
|
||||||
name = name:gsub("^%l", string.upper) -- Change to upper CamlCase
|
name = name:gsub("^%l", string.upper) -- Change to upper CamlCase
|
||||||
return camelcase_to_underscorecase(name)
|
return camelcase_to_underscorecase(name)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function convert_arg(all_types, arg, what)
|
local function convert_arg(all_types, arg, namespace)
|
||||||
|
local fulltype, array = arg.fulltype:match "(.-)%s*(%[%s*[%d%a_:]*%s*%])"
|
||||||
|
if array then
|
||||||
|
arg.fulltype = fulltype
|
||||||
|
arg.array = array
|
||||||
|
local enum, value = array:match "%[%s*([%a%d]+)::([%a%d]+)%]"
|
||||||
|
if enum then
|
||||||
|
local typedef = all_types[ enum .. "::Enum" ]
|
||||||
|
if typedef == nil then
|
||||||
|
error ("Unknown Enum " .. enum)
|
||||||
|
end
|
||||||
|
arg.carray = "[BGFX_" .. camelcase_to_underscorecase(enum):upper() .. "_" .. value:upper() .. "]"
|
||||||
|
end
|
||||||
|
end
|
||||||
local t, postfix = arg.fulltype:match "(%a[%a%d_:]*)%s*([*&]+)%s*$"
|
local t, postfix = arg.fulltype:match "(%a[%a%d_:]*)%s*([*&]+)%s*$"
|
||||||
if t then
|
if t then
|
||||||
arg.type = t
|
arg.type = t
|
||||||
@ -32,11 +44,23 @@ local function convert_arg(all_types, arg, what)
|
|||||||
arg.ref = true
|
arg.ref = true
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
arg.type = arg.fulltype
|
local prefix, t = arg.fulltype:match "^%s*(%a+)%s+(%S+)"
|
||||||
|
if prefix then
|
||||||
|
arg.type = t
|
||||||
|
else
|
||||||
|
arg.type = arg.fulltype
|
||||||
|
end
|
||||||
|
end
|
||||||
|
local ctype
|
||||||
|
local substruct = namespace.substruct
|
||||||
|
if substruct then
|
||||||
|
ctype = substruct[arg.type]
|
||||||
end
|
end
|
||||||
local ctype = all_types[arg.type]
|
|
||||||
if not ctype then
|
if not ctype then
|
||||||
error ("Undefined type " .. arg.fulltype .. " for " .. what)
|
ctype = all_types[arg.type]
|
||||||
|
end
|
||||||
|
if not ctype then
|
||||||
|
error ("Undefined type " .. arg.fulltype .. " in " .. namespace.name)
|
||||||
end
|
end
|
||||||
arg.ctype = arg.fulltype:gsub(arg.type, ctype.cname):gsub("&", "*")
|
arg.ctype = arg.fulltype:gsub(arg.type, ctype.cname):gsub("&", "*")
|
||||||
if ctype.cname ~= arg.type then
|
if ctype.cname ~= arg.type then
|
||||||
@ -60,45 +84,66 @@ end
|
|||||||
local function gen_arg_conversion(all_types, arg)
|
local function gen_arg_conversion(all_types, arg)
|
||||||
if arg.ctype == arg.fulltype then
|
if arg.ctype == arg.fulltype then
|
||||||
-- do not need conversion
|
-- do not need conversion
|
||||||
arg.aname = arg.name
|
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local ctype = all_types[arg.type]
|
local ctype = all_types[arg.type]
|
||||||
if ctype.handle and arg.type == arg.fulltype then
|
if ctype.handle and arg.type == arg.fulltype then
|
||||||
local aname = alternative_name(arg.name)
|
local aname = alternative_name(arg.name)
|
||||||
arg.aname = aname .. ".cpp"
|
arg.aname = aname .. ".cpp"
|
||||||
|
arg.aname_cpp2c = aname .. ".c"
|
||||||
arg.conversion = string.format(
|
arg.conversion = string.format(
|
||||||
"union { %s c; bgfx::%s cpp; } %s = { %s };" ,
|
"union { %s c; bgfx::%s cpp; } %s = { %s };" ,
|
||||||
ctype.cname, arg.type, aname, arg.name)
|
ctype.cname, arg.type, aname, arg.name)
|
||||||
|
arg.conversion_back = string.format(
|
||||||
|
"union { bgfx::%s cpp; %s c; } %s = { %s };" ,
|
||||||
|
arg.type, ctype.cname, aname, arg.name)
|
||||||
elseif arg.ref then
|
elseif arg.ref then
|
||||||
if ctype.cname == arg.type then
|
if ctype.cname == arg.type then
|
||||||
arg.aname = "*" .. arg.name
|
arg.aname = "*" .. arg.name
|
||||||
|
arg.aname_cpp2c = "&" .. arg.name
|
||||||
elseif arg.out and ctype.enum then
|
elseif arg.out and ctype.enum then
|
||||||
local aname = alternative_name(arg.name)
|
local aname = alternative_name(arg.name)
|
||||||
local cpptype = arg.cpptype:match "(.-)%s*&" -- remove &
|
local cpptype = arg.cpptype:match "(.-)%s*&" -- remove &
|
||||||
|
local c99type = arg.ctype:match "(.-)%s*%*" -- remove *
|
||||||
arg.aname = aname
|
arg.aname = aname
|
||||||
|
arg.aname_cpp2c = "&" .. aname
|
||||||
arg.conversion = string.format("%s %s;", cpptype, aname)
|
arg.conversion = string.format("%s %s;", cpptype, aname)
|
||||||
|
arg.conversion_back = string.format("%s %s;", c99type, aname);
|
||||||
arg.out_conversion = string.format("*%s = (%s)%s;", arg.name, ctype.cname, aname)
|
arg.out_conversion = string.format("*%s = (%s)%s;", arg.name, ctype.cname, aname)
|
||||||
|
arg.out_conversion_back = string.format("%s = (%s)%s;", arg.name, c99type, aname)
|
||||||
else
|
else
|
||||||
arg.aname = alternative_name(arg.name)
|
arg.aname = alternative_name(arg.name)
|
||||||
|
arg.aname_cpp2c = string.format("(%s)&%s" , arg.ctype , arg.name)
|
||||||
arg.conversion = string.format(
|
arg.conversion = string.format(
|
||||||
"%s %s = *(%s)%s;",
|
"%s %s = *(%s)%s;",
|
||||||
arg.cpptype, arg.aname, arg.ptype, arg.name)
|
arg.cpptype, arg.aname, arg.ptype, arg.name)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
local cpptype = arg.cpptype
|
||||||
|
local ctype = arg.ctype
|
||||||
|
if arg.array then
|
||||||
|
cpptype = cpptype .. "*"
|
||||||
|
ctype = ctype .. "*"
|
||||||
|
end
|
||||||
arg.aname = string.format(
|
arg.aname = string.format(
|
||||||
"(%s)%s",
|
"(%s)%s",
|
||||||
arg.cpptype, arg.name)
|
cpptype, arg.name)
|
||||||
|
arg.aname_cpp2c = string.format(
|
||||||
|
"(%s)%s",
|
||||||
|
ctype, arg.name)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function gen_ret_conversion(all_types, func)
|
local function gen_ret_conversion(all_types, func)
|
||||||
local postfix = { func.vararg and "va_end(argList);" }
|
local postfix = { func.vararg and "va_end(argList);" }
|
||||||
|
local postfix_cpp2c = { postfix[1] }
|
||||||
func.ret_postfix = postfix
|
func.ret_postfix = postfix
|
||||||
|
func.ret_postfix_cpp2c = postfix_cpp2c
|
||||||
|
|
||||||
for _, arg in ipairs(func.args) do
|
for _, arg in ipairs(func.args) do
|
||||||
if arg.out_conversion then
|
if arg.out_conversion then
|
||||||
postfix[#postfix+1] = arg.out_conversion
|
postfix[#postfix+1] = arg.out_conversion
|
||||||
|
postfix_cpp2c[#postfix_cpp2c+1] = arg.out_conversion_back
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -106,79 +151,182 @@ local function gen_ret_conversion(all_types, func)
|
|||||||
if ctype.handle then
|
if ctype.handle then
|
||||||
func.ret_conversion = string.format(
|
func.ret_conversion = string.format(
|
||||||
"union { %s c; bgfx::%s cpp; } handle_ret;" ,
|
"union { %s c; bgfx::%s cpp; } handle_ret;" ,
|
||||||
ctype.cname, func.ret.type)
|
ctype.cname, ctype.name)
|
||||||
|
func.ret_conversion_cpp2c = string.format(
|
||||||
|
"union { bgfx::%s cpp; %s c; } handle_ret;" ,
|
||||||
|
ctype.name, ctype.cname)
|
||||||
func.ret_prefix = "handle_ret.cpp = "
|
func.ret_prefix = "handle_ret.cpp = "
|
||||||
|
func.ret_prefix_cpp2c = "handle_ret.c = "
|
||||||
postfix[#postfix+1] = "return handle_ret.c;"
|
postfix[#postfix+1] = "return handle_ret.c;"
|
||||||
|
postfix_cpp2c[#postfix_cpp2c+1] = "return handle_ret.cpp;"
|
||||||
elseif func.ret.fulltype ~= "void" then
|
elseif func.ret.fulltype ~= "void" then
|
||||||
local ctype_conversion = func.ret.type == func.ret.ctype and "" or ("(" .. func.ret.ctype .. ")")
|
local ctype_conversion = ctype.name == ctype.cname and "" or ("(" .. func.ret.ctype .. ")")
|
||||||
|
local conversion_back = ctype.name == ctype.cname and "" or ("(" .. func.ret.cpptype .. ")")
|
||||||
if #postfix > 0 then
|
if #postfix > 0 then
|
||||||
func.ret_prefix = string.format("%s retValue = %s", func.ret.ctype , ctype_conversion)
|
func.ret_prefix = string.format("%s retValue = %s", func.ret.ctype , ctype_conversion)
|
||||||
postfix[#postfix+1] = "return retValue;"
|
func.ret_prefix_cpp2c = string.format("%s retValue = %s", func.ret.cpptype , conversion_back)
|
||||||
|
local ret = "return retValue;"
|
||||||
|
postfix[#postfix+1] = ret
|
||||||
|
postfix_cpp2c[#postfix_cpp2c+1] = ret
|
||||||
else
|
else
|
||||||
func.ret_prefix = string.format("return %s", ctype_conversion)
|
func.ret_prefix = string.format("return %s", ctype_conversion)
|
||||||
|
func.ret_prefix_cpp2c = string.format("return %s", conversion_back)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function convert_vararg(v)
|
||||||
|
if v.vararg then
|
||||||
|
local args = v.args
|
||||||
|
local vararg = {
|
||||||
|
name = "",
|
||||||
|
fulltype = "...",
|
||||||
|
type = "...",
|
||||||
|
ctype = "...",
|
||||||
|
aname = "argList",
|
||||||
|
conversion = string.format(
|
||||||
|
"va_list argList;\n\tva_start(argList, %s);",
|
||||||
|
args[#args].name),
|
||||||
|
}
|
||||||
|
args[#args + 1] = vararg
|
||||||
|
v.alter_name = v.vararg
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function codegen.nameconversion(all_types, all_funcs)
|
function codegen.nameconversion(all_types, all_funcs)
|
||||||
local enums = {}
|
for _,v in ipairs(all_types) do
|
||||||
for k,v in pairs(all_types) do
|
local name = v.name
|
||||||
if not v.cname then
|
local cname = v.cname
|
||||||
v.cname = convert_typename(k)
|
if cname == nil then
|
||||||
|
if name:match "^%u" then
|
||||||
|
cname = camelcase_to_underscorecase(name)
|
||||||
|
else
|
||||||
|
v.cname = name
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if cname then
|
||||||
|
if v.namespace then
|
||||||
|
cname = camelcase_to_underscorecase(v.namespace) .. "_" .. cname
|
||||||
|
end
|
||||||
|
v.cname = "bgfx_".. cname .. "_t"
|
||||||
end
|
end
|
||||||
if v.enum then
|
if v.enum then
|
||||||
enums[#enums+1] = k
|
v.name = v.name .. "::Enum"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
for _, e in ipairs(enums) do
|
|
||||||
local t = all_types[e]
|
-- make index
|
||||||
all_types[e] = nil
|
for _,v in ipairs(all_types) do
|
||||||
all_types[e .. "::Enum"] = t
|
if not v.namespace then
|
||||||
|
if all_types[v.name] then
|
||||||
|
error ("Duplicate type " .. v.name)
|
||||||
|
end
|
||||||
|
all_types[v.name] = v
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- make sub struct index
|
||||||
|
for _,v in ipairs(all_types) do
|
||||||
|
if v.namespace then
|
||||||
|
local super = all_types[v.namespace]
|
||||||
|
if not super then
|
||||||
|
error ("Define " .. v.namespace .. " first")
|
||||||
|
end
|
||||||
|
local substruct = super.substruct
|
||||||
|
if not substruct then
|
||||||
|
substruct = {}
|
||||||
|
super.substruct = substruct
|
||||||
|
end
|
||||||
|
if substruct[v.name] then
|
||||||
|
error ( "Duplicate sub struct " .. v.name .. " in " .. v.namespace)
|
||||||
|
end
|
||||||
|
substruct[#substruct+1] = v
|
||||||
|
substruct[v.name] = v
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
for _,v in ipairs(all_types) do
|
||||||
|
if v.struct then
|
||||||
|
for _, item in ipairs(v.struct) do
|
||||||
|
convert_arg(all_types, item, v)
|
||||||
|
end
|
||||||
|
elseif v.args then
|
||||||
|
-- funcptr
|
||||||
|
for _, arg in ipairs(v.args) do
|
||||||
|
convert_arg(all_types, arg, v)
|
||||||
|
end
|
||||||
|
convert_vararg(v)
|
||||||
|
convert_arg(all_types, v.ret, v)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local funcs = {}
|
||||||
|
local funcs_conly = {}
|
||||||
|
local funcs_alter = {}
|
||||||
|
|
||||||
for _,v in ipairs(all_funcs) do
|
for _,v in ipairs(all_funcs) do
|
||||||
if v.cname == nil then
|
if v.cname == nil then
|
||||||
v.cname = convert_funcname(v.name)
|
v.cname = convert_funcname(v.name)
|
||||||
end
|
end
|
||||||
if v.class then
|
if v.class then
|
||||||
v.cname = convert_funcname(v.class) .. "_" .. v.cname
|
v.cname = convert_funcname(v.class) .. "_" .. v.cname
|
||||||
|
local classtype = all_types[v.class]
|
||||||
|
if classtype then
|
||||||
|
local methods = classtype.methods
|
||||||
|
if not methods then
|
||||||
|
methods = {}
|
||||||
|
classtype.methods = methods
|
||||||
|
end
|
||||||
|
methods[#methods+1] = v
|
||||||
|
end
|
||||||
|
elseif not v.conly then
|
||||||
|
funcs[v.name] = v
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if v.conly then
|
||||||
|
table.insert(funcs_conly, v)
|
||||||
|
end
|
||||||
|
|
||||||
for _, arg in ipairs(v.args) do
|
for _, arg in ipairs(v.args) do
|
||||||
convert_arg(all_types, arg, v.name)
|
convert_arg(all_types, arg, v)
|
||||||
gen_arg_conversion(all_types, arg)
|
gen_arg_conversion(all_types, arg)
|
||||||
end
|
end
|
||||||
if v.vararg then
|
convert_vararg(v)
|
||||||
local args = v.args
|
if v.alter_name then
|
||||||
local vararg = {
|
funcs_alter[#funcs_alter+1] = v
|
||||||
name = "",
|
|
||||||
ctype = "...",
|
|
||||||
aname = "argList",
|
|
||||||
conversion = string.format(
|
|
||||||
"va_list argList;\n\tva_start(argList, %s);",
|
|
||||||
args[#args].name),
|
|
||||||
}
|
|
||||||
args[#args + 1] = vararg
|
|
||||||
v.implname = v.vararg
|
|
||||||
else
|
|
||||||
v.implname = v.name
|
|
||||||
end
|
end
|
||||||
convert_arg(all_types, v.ret, v.name .. "@rettype")
|
convert_arg(all_types, v.ret, v)
|
||||||
gen_ret_conversion(all_types, v)
|
gen_ret_conversion(all_types, v)
|
||||||
if v.class then
|
local namespace = v.class
|
||||||
local classname = v.class
|
if namespace then
|
||||||
|
local classname = namespace
|
||||||
if v.const then
|
if v.const then
|
||||||
classname = "const " .. classname
|
classname = "const " .. classname
|
||||||
end
|
end
|
||||||
local classtype = { fulltype = classname .. "*" }
|
local classtype = { fulltype = classname .. "*" }
|
||||||
convert_arg(all_types, classtype, "class member " .. v.name)
|
convert_arg(all_types, classtype, v)
|
||||||
v.this = classtype.ctype .. " _this"
|
v.this = classtype.ctype .. " _this"
|
||||||
v.this_conversion = string.format( "%s This = (%s)_this;", classtype.cpptype, classtype.cpptype)
|
v.this_conversion = string.format( "%s This = (%s)_this;", classtype.cpptype, classtype.cpptype)
|
||||||
|
v.this_to_c = string.format("(%s)this", classtype.ctype)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
for _, v in ipairs(funcs_conly) do
|
||||||
|
local func = funcs[v.name]
|
||||||
|
if func then
|
||||||
|
func.multicfunc = func.multicfunc or { func.cname }
|
||||||
|
table.insert(func.multicfunc, v.cname)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
for _, v in ipairs(funcs_alter) do
|
||||||
|
local func = funcs[v.alter_name]
|
||||||
|
v.alter_cname = func.cname
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function lines(tbl)
|
local function lines(tbl)
|
||||||
if #tbl == 0 then
|
if not tbl or #tbl == 0 then
|
||||||
return "//EMPTYLINE"
|
return "//EMPTYLINE"
|
||||||
else
|
else
|
||||||
return table.concat(tbl, "\n\t")
|
return table.concat(tbl, "\n\t")
|
||||||
@ -191,34 +339,113 @@ end
|
|||||||
|
|
||||||
local function codetemp(func)
|
local function codetemp(func)
|
||||||
local conversion = {}
|
local conversion = {}
|
||||||
|
local conversion_c2cpp = {}
|
||||||
local args = {}
|
local args = {}
|
||||||
|
local cargs = {}
|
||||||
|
local callargs_conversion = {}
|
||||||
|
local callargs_conversion_back = {}
|
||||||
local callargs = {}
|
local callargs = {}
|
||||||
local cppfunc
|
local cppfunc
|
||||||
|
local classname
|
||||||
|
|
||||||
if func.class then
|
if func.class then
|
||||||
-- It's a member function
|
-- It's a member function
|
||||||
args[1] = func.this
|
cargs[1] = func.this
|
||||||
conversion[1] = func.this_conversion
|
conversion[1] = func.this_conversion
|
||||||
cppfunc = "This->" .. func.name
|
cppfunc = "This->" .. func.name
|
||||||
|
callargs[1] = "_this"
|
||||||
|
callargs_conversion_back[1] = func.this_to_c
|
||||||
|
classname = func.class .. "::"
|
||||||
else
|
else
|
||||||
cppfunc = "bgfx::" .. func.implname
|
cppfunc = "bgfx::" .. tostring(func.alter_name or func.name)
|
||||||
|
classname = ""
|
||||||
end
|
end
|
||||||
for _, arg in ipairs(func.args) do
|
for _, arg in ipairs(func.args) do
|
||||||
conversion[#conversion+1] = arg.conversion
|
conversion[#conversion+1] = arg.conversion
|
||||||
args[#args+1] = arg.ctype .. " " .. arg.name
|
conversion_c2cpp[#conversion_c2cpp+1] = arg.conversion_back
|
||||||
callargs[#callargs+1] = arg.aname
|
local cname = arg.ctype .. " " .. arg.name
|
||||||
|
if arg.array then
|
||||||
|
cname = cname .. (arg.carray or arg.array)
|
||||||
|
end
|
||||||
|
local name = arg.fulltype .. " " .. arg.name
|
||||||
|
if arg.array then
|
||||||
|
name = name .. arg.array
|
||||||
|
end
|
||||||
|
if arg.default then
|
||||||
|
name = name .. " = " .. arg.default
|
||||||
|
end
|
||||||
|
cargs[#cargs+1] = cname
|
||||||
|
args[#args+1] = name
|
||||||
|
callargs_conversion[#callargs_conversion+1] = arg.aname or arg.name
|
||||||
|
callargs_conversion_back[#callargs_conversion_back+1] = arg.aname_cpp2c or arg.name
|
||||||
|
callargs[#callargs+1] = arg.name
|
||||||
end
|
end
|
||||||
conversion[#conversion+1] = func.ret_conversion
|
conversion[#conversion+1] = func.ret_conversion
|
||||||
|
conversion_c2cpp[#conversion_c2cpp+1] = func.ret_conversion_cpp2c
|
||||||
|
|
||||||
|
local ARGS
|
||||||
|
local args_n = #args
|
||||||
|
if args_n == 0 then
|
||||||
|
ARGS = ""
|
||||||
|
elseif args_n == 1 then
|
||||||
|
ARGS = args[1]
|
||||||
|
else
|
||||||
|
ARGS = "\n\t " .. table.concat(args, "\n\t, ") .. "\n\t"
|
||||||
|
end
|
||||||
|
|
||||||
|
local preret_c2c
|
||||||
|
local postret_c2c = {}
|
||||||
|
local conversion_c2c = {}
|
||||||
|
local callfunc_c2c
|
||||||
|
|
||||||
|
if func.vararg then
|
||||||
|
postret_c2c[1] = "va_end(argList);"
|
||||||
|
local vararg = func.args[#func.args]
|
||||||
|
callargs[#callargs] = vararg.aname
|
||||||
|
callargs_conversion_back[#callargs_conversion_back] = vararg.aname
|
||||||
|
conversion_c2c[1] = vararg.conversion
|
||||||
|
conversion_c2cpp[1] = vararg.conversion
|
||||||
|
|
||||||
|
if func.ret.fulltype == "void" then
|
||||||
|
preret_c2c = ""
|
||||||
|
else
|
||||||
|
preret_c2c = func.ret.ctype .. " retValue = "
|
||||||
|
postret_c2c[#postret_c2c+1] = "return retValue;"
|
||||||
|
end
|
||||||
|
callfunc_c2c = func.alter_cname or func.cname
|
||||||
|
else
|
||||||
|
if func.ret.fulltype == "void" then
|
||||||
|
preret_c2c = ""
|
||||||
|
else
|
||||||
|
preret_c2c = "return "
|
||||||
|
end
|
||||||
|
callfunc_c2c = func.cname
|
||||||
|
end
|
||||||
|
|
||||||
return {
|
return {
|
||||||
RET = func.ret.ctype,
|
RET = func.ret.fulltype,
|
||||||
FUNCNAME = func.cname,
|
CRET = func.ret.ctype,
|
||||||
ARGS = table.concat(args, ", "),
|
CFUNCNAME = func.cname,
|
||||||
|
FUNCNAME = func.name,
|
||||||
|
CARGS = table.concat(cargs, ", "),
|
||||||
|
CPPARGS = table.concat(args, ", "),
|
||||||
|
ARGS = ARGS,
|
||||||
CONVERSION = lines(conversion),
|
CONVERSION = lines(conversion),
|
||||||
|
CONVERSIONCTOC = lines(conversion_c2c),
|
||||||
|
CONVERSIONCTOCPP = lines(conversion_c2cpp),
|
||||||
PRERET = func.ret_prefix or "",
|
PRERET = func.ret_prefix or "",
|
||||||
|
PRERETCPPTOC = func.ret_prefix_cpp2c or "",
|
||||||
CPPFUNC = cppfunc,
|
CPPFUNC = cppfunc,
|
||||||
|
CALLFUNCCTOC = callfunc_c2c,
|
||||||
|
CALLARGSCTOCPP = table.concat(callargs_conversion, ", "),
|
||||||
|
CALLARGSCPPTOC = table.concat(callargs_conversion_back, ", "),
|
||||||
CALLARGS = table.concat(callargs, ", "),
|
CALLARGS = table.concat(callargs, ", "),
|
||||||
POSTRET = lines(func.ret_postfix),
|
POSTRET = lines(func.ret_postfix),
|
||||||
CODE = func.cfunc,
|
POSTRETCPPTOC = lines(func.ret_postfix_cpp2c),
|
||||||
|
PRERETCTOC = preret_c2c,
|
||||||
|
POSTRETCTOC = lines(postret_c2c),
|
||||||
|
CLASSNAME = classname,
|
||||||
|
CONST = func.const and " const" or "",
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -227,45 +454,315 @@ local function apply_template(func, temp)
|
|||||||
return (temp:gsub("$(%u+)", func.codetemp))
|
return (temp:gsub("$(%u+)", func.codetemp))
|
||||||
end
|
end
|
||||||
|
|
||||||
local c99temp = [[
|
function codegen.apply_functemp(func, temp)
|
||||||
BGFX_C_API $RET bgfx_$FUNCNAME($ARGS)
|
return remove_emptylines(apply_template(func, temp))
|
||||||
{
|
end
|
||||||
$CONVERSION
|
|
||||||
$PRERET$CPPFUNC($CALLARGS);
|
|
||||||
$POSTRET
|
|
||||||
}
|
|
||||||
]]
|
|
||||||
|
|
||||||
local c99usertemp = [[
|
function codegen.gen_funcptr(funcptr)
|
||||||
BGFX_C_API $RET bgfx_$FUNCNAME($ARGS)
|
return apply_template(funcptr, "typedef $RET (*$FUNCNAME)($ARGS);")
|
||||||
{
|
end
|
||||||
$CODE
|
|
||||||
}
|
|
||||||
]]
|
|
||||||
|
|
||||||
function codegen.gen_c99(func)
|
function codegen.gen_cfuncptr(funcptr)
|
||||||
if func.cfunc then
|
return apply_template(funcptr, "typedef $CRET (*$CFUNCNAME)($CARGS);")
|
||||||
return apply_template(func, c99usertemp)
|
end
|
||||||
else
|
|
||||||
return remove_emptylines(apply_template(func, c99temp))
|
local function doxygen_funcret(r, func, prefix)
|
||||||
|
if not func or func.ret.fulltype == "void" or func.ret.comment == nil then
|
||||||
|
return
|
||||||
end
|
end
|
||||||
|
r[#r+1] = prefix
|
||||||
|
if type(func.ret.comment) == "string" then
|
||||||
|
r[#r+1] = string.format("%s @returns %s", prefix, func.ret.comment)
|
||||||
|
else
|
||||||
|
r[#r+1] = string.format("%s @returns %s", prefix, func.ret.comment[1])
|
||||||
|
for i = 2,#func.ret.comment do
|
||||||
|
r[#r+1] = string.format("%s %s", prefix, func.ret.comment[i])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return r
|
||||||
end
|
end
|
||||||
|
|
||||||
local template_function_declaration = [[
|
local function doxygen_func(r, func, prefix)
|
||||||
/**/
|
if not func or not func.args or #func.args == 0 then
|
||||||
BGFX_C_API $RET bgfx_$FUNCNAME($ARGS);
|
return
|
||||||
|
end
|
||||||
|
r[#r+1] = prefix
|
||||||
|
for _, arg in ipairs(func.args) do
|
||||||
|
local inout
|
||||||
|
if arg.out then
|
||||||
|
inout = "out"
|
||||||
|
elseif arg.inout then
|
||||||
|
inout = "inout"
|
||||||
|
else
|
||||||
|
inout = "in"
|
||||||
|
end
|
||||||
|
local comment = string.format("%s @param[%s] %s", prefix, inout, arg.name)
|
||||||
|
if arg.comment then
|
||||||
|
if type(arg.comment) == "string" then
|
||||||
|
r[#r+1] = comment .. " " .. arg.comment
|
||||||
|
else
|
||||||
|
r[#r+1] = comment .. " " .. arg.comment[1]
|
||||||
|
for i = 2,#arg.comment do
|
||||||
|
r[#r+1] = string.format("%s %s", prefix, arg.comment[i])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
r[#r+1] = comment
|
||||||
|
end
|
||||||
|
end
|
||||||
|
doxygen_funcret(r, func, prefix)
|
||||||
|
return r
|
||||||
|
end
|
||||||
|
|
||||||
|
function codegen.doxygen_type(doxygen, func, cname)
|
||||||
|
if doxygen == nil then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local result = {}
|
||||||
|
for _, line in ipairs(doxygen) do
|
||||||
|
result[#result+1] = "/// " .. line
|
||||||
|
end
|
||||||
|
doxygen_func(result, func, "///")
|
||||||
|
if cname then
|
||||||
|
result[#result+1] = "///"
|
||||||
|
if type(cname) == "string" then
|
||||||
|
result[#result+1] = string.format("/// @attention C99 equivalent is `%s`.", cname)
|
||||||
|
else
|
||||||
|
local names = {}
|
||||||
|
for _, v in ipairs(cname) do
|
||||||
|
names[#names+1] = "`" .. v .. "`"
|
||||||
|
end
|
||||||
|
result[#result+1] = string.format("/// @attention C99 equivalent are %s.", table.concat(names, ","))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
result[#result+1] = "///"
|
||||||
|
return table.concat(result, "\n")
|
||||||
|
end
|
||||||
|
|
||||||
|
function codegen.doxygen_ctype(doxygen, func)
|
||||||
|
if doxygen == nil then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local result = {
|
||||||
|
"/**",
|
||||||
|
}
|
||||||
|
for _, line in ipairs(doxygen) do
|
||||||
|
result[#result+1] = " * " .. line
|
||||||
|
end
|
||||||
|
doxygen_func(result, func, " *")
|
||||||
|
result[#result+1] = " *"
|
||||||
|
result[#result+1] = " */"
|
||||||
|
return table.concat(result, "\n")
|
||||||
|
end
|
||||||
|
|
||||||
|
local enum_temp = [[
|
||||||
|
struct $NAME
|
||||||
|
{
|
||||||
|
$COMMENT
|
||||||
|
enum Enum
|
||||||
|
{
|
||||||
|
$ITEMS
|
||||||
|
|
||||||
|
Count
|
||||||
|
};
|
||||||
|
};
|
||||||
]]
|
]]
|
||||||
|
|
||||||
function codegen.gen_c99decl(func)
|
function codegen.gen_enum_define(enum)
|
||||||
return apply_template(func, template_function_declaration)
|
assert(type(enum.enum) == "table", "Not an enum")
|
||||||
|
local items = {}
|
||||||
|
for _, item in ipairs(enum.enum) do
|
||||||
|
local text
|
||||||
|
if not item.comment then
|
||||||
|
text = item.name .. ","
|
||||||
|
else
|
||||||
|
text = string.format("%s,%s //!< %s",
|
||||||
|
item.name, namealign(item.name), item.comment)
|
||||||
|
end
|
||||||
|
items[#items+1] = text
|
||||||
|
end
|
||||||
|
local comment = ""
|
||||||
|
if enum.comment then
|
||||||
|
comment = "/// " .. enum.comment
|
||||||
|
end
|
||||||
|
local temp = {
|
||||||
|
NAME = enum.name,
|
||||||
|
COMMENT = comment,
|
||||||
|
ITEMS = table.concat(items, "\n\t\t"),
|
||||||
|
}
|
||||||
|
return (enum_temp:gsub("$(%u+)", temp))
|
||||||
end
|
end
|
||||||
|
|
||||||
function codegen.gen_interface_struct(func)
|
local cenum_temp = [[
|
||||||
return apply_template(func, "$RET (*$FUNCNAME)($ARGS);")
|
typedef enum $NAME
|
||||||
|
{
|
||||||
|
$ITEMS
|
||||||
|
|
||||||
|
$COUNT
|
||||||
|
|
||||||
|
} $NAME_t;
|
||||||
|
]]
|
||||||
|
function codegen.gen_enum_cdefine(enum)
|
||||||
|
assert(type(enum.enum) == "table", "Not an enum")
|
||||||
|
local cname = enum.cname:match "(.-)_t$"
|
||||||
|
local uname = cname:upper()
|
||||||
|
local items = {}
|
||||||
|
for index , item in ipairs(enum.enum) do
|
||||||
|
local comment = item.comment or ""
|
||||||
|
local ename = item.cname
|
||||||
|
if not ename then
|
||||||
|
if enum.underscore then
|
||||||
|
ename = camelcase_to_underscorecase(item.name)
|
||||||
|
else
|
||||||
|
ename = item.name
|
||||||
|
end
|
||||||
|
ename = ename:upper()
|
||||||
|
end
|
||||||
|
local name = uname .. "_" .. ename
|
||||||
|
items[#items+1] = string.format("%s,%s /** (%2d) %s%s */",
|
||||||
|
name,
|
||||||
|
namealign(name, 40),
|
||||||
|
index - 1,
|
||||||
|
comment,
|
||||||
|
namealign(comment, 30))
|
||||||
|
end
|
||||||
|
|
||||||
|
local temp = {
|
||||||
|
NAME = cname,
|
||||||
|
COUNT = uname .. "_COUNT",
|
||||||
|
ITEMS = table.concat(items, "\n\t"),
|
||||||
|
}
|
||||||
|
|
||||||
|
return (cenum_temp:gsub("$(%u+)", temp))
|
||||||
end
|
end
|
||||||
|
|
||||||
function codegen.gen_interface_import(func)
|
local function text_with_comments(items, item, cstyle, is_classmember)
|
||||||
return "bgfx_" .. func.cname
|
local name = item.name
|
||||||
|
if item.array then
|
||||||
|
if cstyle then
|
||||||
|
name = name .. (item.carray or item.array)
|
||||||
|
else
|
||||||
|
name = name .. item.array
|
||||||
|
end
|
||||||
|
end
|
||||||
|
local typename
|
||||||
|
if cstyle then
|
||||||
|
typename = item.ctype
|
||||||
|
else
|
||||||
|
typename = item.fulltype
|
||||||
|
end
|
||||||
|
if is_classmember then
|
||||||
|
name = "m_" .. name
|
||||||
|
end
|
||||||
|
local text = string.format("%s%s %s;", typename, namealign(typename), name)
|
||||||
|
if item.comment then
|
||||||
|
if type(item.comment) == "table" then
|
||||||
|
table.insert(items, "")
|
||||||
|
if cstyle then
|
||||||
|
table.insert(items, "/**")
|
||||||
|
for _, c in ipairs(item.comment) do
|
||||||
|
table.insert(items, " * " .. c)
|
||||||
|
end
|
||||||
|
table.insert(items, " */")
|
||||||
|
else
|
||||||
|
for _, c in ipairs(item.comment) do
|
||||||
|
table.insert(items, "/// " .. c)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
text = string.format(
|
||||||
|
cstyle and "%s %s/** %s%s */" or "%s %s//!< %s",
|
||||||
|
text, namealign(text, 40), item.comment, namealign(item.comment, 40))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
items[#items+1] = text
|
||||||
|
end
|
||||||
|
|
||||||
|
local struct_temp = [[
|
||||||
|
struct $NAME
|
||||||
|
{
|
||||||
|
$METHODS
|
||||||
|
$SUBSTRUCTS
|
||||||
|
$ITEMS
|
||||||
|
};
|
||||||
|
]]
|
||||||
|
|
||||||
|
function codegen.gen_struct_define(struct, methods)
|
||||||
|
assert(type(struct.struct) == "table", "Not a struct")
|
||||||
|
local items = {}
|
||||||
|
for _, item in ipairs(struct.struct) do
|
||||||
|
text_with_comments(items, item, false, methods ~= nil)
|
||||||
|
end
|
||||||
|
local ctor = {}
|
||||||
|
if struct.ctor then
|
||||||
|
ctor[1] = struct.name .. "();"
|
||||||
|
ctor[2] = ""
|
||||||
|
end
|
||||||
|
if methods then
|
||||||
|
for _, m in ipairs(methods) do
|
||||||
|
if m:sub(-1) ~= "\n" then
|
||||||
|
m = m .. "\n"
|
||||||
|
end
|
||||||
|
for line in m:gmatch "(.-)\n" do
|
||||||
|
ctor[#ctor+1] = line
|
||||||
|
end
|
||||||
|
ctor[#ctor+1] = ""
|
||||||
|
end
|
||||||
|
end
|
||||||
|
local subs = {}
|
||||||
|
if struct.substruct then
|
||||||
|
for _, v in ipairs(struct.substruct) do
|
||||||
|
local s = codegen.gen_struct_define(v)
|
||||||
|
s = s:gsub("\n", "\n\t")
|
||||||
|
subs[#subs+1] = s
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local temp = {
|
||||||
|
NAME = struct.name,
|
||||||
|
SUBSTRUCTS = lines(subs),
|
||||||
|
ITEMS = table.concat(items, "\n\t"),
|
||||||
|
METHODS = lines(ctor),
|
||||||
|
}
|
||||||
|
return remove_emptylines(struct_temp:gsub("$(%u+)", temp))
|
||||||
|
end
|
||||||
|
|
||||||
|
local cstruct_temp = [[
|
||||||
|
typedef struct $NAME_s
|
||||||
|
{
|
||||||
|
$ITEMS
|
||||||
|
|
||||||
|
} $NAME_t;
|
||||||
|
]]
|
||||||
|
function codegen.gen_struct_cdefine(struct)
|
||||||
|
assert(type(struct.struct) == "table", "Not a struct")
|
||||||
|
local cname = struct.cname:match "(.-)_t$"
|
||||||
|
local items = {}
|
||||||
|
for _, item in ipairs(struct.struct) do
|
||||||
|
text_with_comments(items, item, true)
|
||||||
|
end
|
||||||
|
local temp = {
|
||||||
|
NAME = cname,
|
||||||
|
ITEMS = table.concat(items, "\n\t"),
|
||||||
|
}
|
||||||
|
return (cstruct_temp:gsub("$(%u+)", temp))
|
||||||
|
end
|
||||||
|
|
||||||
|
local chandle_temp = [[
|
||||||
|
typedef struct $NAME_s { uint16_t idx; } $NAME_t;
|
||||||
|
]]
|
||||||
|
function codegen.gen_chandle(handle)
|
||||||
|
assert(handle.handle, "Not a handle")
|
||||||
|
return (chandle_temp:gsub("$(%u+)", { NAME = handle.cname:match "(.-)_t$" }))
|
||||||
|
end
|
||||||
|
|
||||||
|
local handle_temp = [[
|
||||||
|
struct $NAME { uint16_t idx; };
|
||||||
|
inline bool isValid($NAME _handle) { return bgfx::kInvalidHandle != _handle.idx; }
|
||||||
|
]]
|
||||||
|
function codegen.gen_handle(handle)
|
||||||
|
assert(handle.handle, "Not a handle")
|
||||||
|
return (handle_temp:gsub("$(%u+)", { NAME = handle.name }))
|
||||||
end
|
end
|
||||||
|
|
||||||
return codegen
|
return codegen
|
||||||
|
21
scripts/doxygen.lua
Normal file
21
scripts/doxygen.lua
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
local idl = require "idl"
|
||||||
|
|
||||||
|
local doxygen = {}
|
||||||
|
|
||||||
|
function doxygen.load(filename)
|
||||||
|
local lines = {}
|
||||||
|
for line in io.lines(filename) do
|
||||||
|
local code, comment = line:match "(.-)%-%-%-[ \t](.*)"
|
||||||
|
if code then
|
||||||
|
if code == "" then
|
||||||
|
line = string.format("comment [[%s]]", comment)
|
||||||
|
else
|
||||||
|
line = string.format("%s [[%s]]", code, comment)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
lines[#lines+1] = line
|
||||||
|
end
|
||||||
|
return table.concat(lines, "\n")
|
||||||
|
end
|
||||||
|
|
||||||
|
return doxygen
|
261
scripts/idl.lua
261
scripts/idl.lua
@ -3,18 +3,51 @@
|
|||||||
|
|
||||||
local idl = {}
|
local idl = {}
|
||||||
|
|
||||||
|
local comments = {}
|
||||||
|
|
||||||
|
function idl.comment(c)
|
||||||
|
comments[#comments+1] = c
|
||||||
|
end
|
||||||
|
|
||||||
local all_types = {}
|
local all_types = {}
|
||||||
|
|
||||||
local function typedef(_, typename)
|
local function copy_attribs(to, from)
|
||||||
assert(all_types[typename] == nil, "Duplicate type")
|
assert(type(from) == "table", "Attribs should be a table")
|
||||||
local t = {}
|
for k, v in pairs(from) do
|
||||||
all_types[typename] = t
|
if type(k) == "number" then
|
||||||
local function type_attrib(attrib)
|
to[v] = true
|
||||||
assert(type(attrib) == "table", "type attrib should be a table")
|
else
|
||||||
for _, a in ipairs(attrib) do
|
to[k] = v
|
||||||
t[a] = true
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function classdef(item, def)
|
||||||
|
local function class(_, methodname)
|
||||||
|
item.class = item.name
|
||||||
|
item.name = methodname
|
||||||
|
return def
|
||||||
|
end
|
||||||
|
|
||||||
|
return setmetatable({} , { __index = class, __call = function(_, value) return def(value) end })
|
||||||
|
end
|
||||||
|
|
||||||
|
local function new_type(typename)
|
||||||
|
local t = { name = typename }
|
||||||
|
if #comments > 0 then
|
||||||
|
t.comments = comments
|
||||||
|
comments = {}
|
||||||
|
end
|
||||||
|
all_types[#all_types+1] = t
|
||||||
|
return t
|
||||||
|
end
|
||||||
|
|
||||||
|
local function typedef(_, typename)
|
||||||
|
local t = new_type(typename)
|
||||||
|
|
||||||
|
local function type_attrib(attrib)
|
||||||
|
copy_attribs(t, attrib)
|
||||||
|
end
|
||||||
return function(cname)
|
return function(cname)
|
||||||
local typ = type(cname)
|
local typ = type(cname)
|
||||||
if typ == "table" then
|
if typ == "table" then
|
||||||
@ -30,75 +63,177 @@ end
|
|||||||
idl.typedef = setmetatable({} , { __index = typedef, __call = typedef })
|
idl.typedef = setmetatable({} , { __index = typedef, __call = typedef })
|
||||||
idl.types = all_types
|
idl.types = all_types
|
||||||
|
|
||||||
|
local function add_comment(item, comment)
|
||||||
|
-- strip space
|
||||||
|
comment = comment:match "(.-)%s*$"
|
||||||
|
local last = item.comment
|
||||||
|
if last then
|
||||||
|
if type(last) == "string" then
|
||||||
|
item.comment = { last, comment }
|
||||||
|
else
|
||||||
|
table.insert(item.comment, comment)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
item.comment = comment
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function enumdef(_, typename)
|
||||||
|
local t = new_type(typename)
|
||||||
|
t.enum = {}
|
||||||
|
|
||||||
|
local function enum_attrib(obj, attribs)
|
||||||
|
copy_attribs(t, attribs)
|
||||||
|
return obj
|
||||||
|
end
|
||||||
|
|
||||||
|
local function new_enum_item(_, itemname)
|
||||||
|
local item = { name = itemname }
|
||||||
|
t.enum[#t.enum + 1] = item
|
||||||
|
local function add_attrib_or_comment(obj , attribs)
|
||||||
|
if type(attribs) == "string" then
|
||||||
|
add_comment(item, attribs)
|
||||||
|
elseif attribs then
|
||||||
|
copy_attribs(item, attribs)
|
||||||
|
end
|
||||||
|
return obj
|
||||||
|
end
|
||||||
|
return setmetatable({}, { __index = new_enum_item, __call = add_attrib_or_comment })
|
||||||
|
end
|
||||||
|
|
||||||
|
return setmetatable({}, { __index = new_enum_item , __call = enum_attrib })
|
||||||
|
end
|
||||||
|
|
||||||
|
idl.enum = setmetatable({} , { __index = enumdef, __call = enumdef })
|
||||||
|
|
||||||
|
local function structdef(_, typename)
|
||||||
|
local t = new_type(typename)
|
||||||
|
t.struct = {}
|
||||||
|
|
||||||
|
local function struct_attrib(obj, attribs)
|
||||||
|
copy_attribs(t, attribs)
|
||||||
|
return obj
|
||||||
|
end
|
||||||
|
|
||||||
|
local function new_struct_item(_, itemname)
|
||||||
|
local item = { name = itemname }
|
||||||
|
t.struct[#t.struct + 1] = item
|
||||||
|
|
||||||
|
local function item_attrib(obj, attribs)
|
||||||
|
if type(attribs) == "string" then
|
||||||
|
add_comment(item, attribs)
|
||||||
|
else
|
||||||
|
copy_attribs(item, attribs)
|
||||||
|
end
|
||||||
|
return obj
|
||||||
|
end
|
||||||
|
|
||||||
|
return function (itemtype)
|
||||||
|
item.fulltype = itemtype
|
||||||
|
return setmetatable({}, { __index = new_struct_item, __call = item_attrib })
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return setmetatable({}, { __index = new_struct_item , __call = struct_attrib })
|
||||||
|
end
|
||||||
|
|
||||||
|
idl.struct = setmetatable({}, { __index = structdef , __call = structdef })
|
||||||
|
|
||||||
|
local function handledef(_, typename)
|
||||||
|
local t = new_type(typename)
|
||||||
|
t.handle = true
|
||||||
|
|
||||||
|
return function (attribs)
|
||||||
|
copy_attribs(t, attribs)
|
||||||
|
return obj
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
idl.handle = setmetatable({} , { __index = handledef, __call = handledef })
|
||||||
|
|
||||||
local all_funcs = {}
|
local all_funcs = {}
|
||||||
|
|
||||||
local function duplicate_arg_name(name)
|
local function duplicate_arg_name(_, name)
|
||||||
error ("Duplicate arg name " .. name)
|
error ("Duplicate arg name " .. name)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function funcdef(_, funcname)
|
local function attribs_setter(args, arg, args_desc)
|
||||||
local f = { name = funcname , args = {} }
|
local attribs_setter
|
||||||
all_funcs[#all_funcs+1] = f
|
local function arg_attrib_or_comment(_, attrib_or_comment )
|
||||||
local args
|
if type(attrib_or_comment) == "string" then
|
||||||
local function args_desc(obj, args_name)
|
add_comment(arg, attrib_or_comment)
|
||||||
obj[args_name] = duplicate_arg_name
|
else
|
||||||
return function (fulltype)
|
copy_attribs(arg, attrib_or_comment)
|
||||||
local arg = {
|
|
||||||
name = "_" .. args_name,
|
|
||||||
fulltype = fulltype,
|
|
||||||
}
|
|
||||||
f.args[#f.args+1] = arg
|
|
||||||
local function arg_attrib(_, attrib )
|
|
||||||
assert(type(attrib) == "table", "Arg attributes should be a table")
|
|
||||||
for _, a in ipairs(attrib) do
|
|
||||||
arg[a] = true
|
|
||||||
end
|
|
||||||
return args
|
|
||||||
end
|
|
||||||
return setmetatable( {} , {
|
|
||||||
__index = function(_, name)
|
|
||||||
return args_desc(obj, name)
|
|
||||||
end
|
|
||||||
, __call = arg_attrib } )
|
|
||||||
end
|
end
|
||||||
|
return attribs_setter
|
||||||
end
|
end
|
||||||
args = setmetatable({}, { __index = args_desc })
|
-- next field (__index) or attrib/comment (__call)
|
||||||
local function rettype(value)
|
attribs_setter = setmetatable( {} , {
|
||||||
assert(type(value) == "string", "Need return type")
|
__index = function(_, name)
|
||||||
f.ret = { fulltype = value }
|
return args_desc(args, name)
|
||||||
return args
|
|
||||||
end
|
|
||||||
|
|
||||||
local function funcdef(value)
|
|
||||||
if type(value) == "table" then
|
|
||||||
for k,v in pairs(value) do
|
|
||||||
if type(k) == "number" then
|
|
||||||
f[v] = true
|
|
||||||
else
|
|
||||||
f[k] = v
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return rettype
|
|
||||||
end
|
end
|
||||||
return rettype(value)
|
, __call = arg_attrib_or_comment } )
|
||||||
end
|
return attribs_setter
|
||||||
|
|
||||||
local function classfunc(_, methodname)
|
|
||||||
f.class = f.name
|
|
||||||
f.name = methodname
|
|
||||||
return funcdef
|
|
||||||
end
|
|
||||||
|
|
||||||
return setmetatable({} , { __index = classfunc, __call = function(_, value) return funcdef(value) end })
|
|
||||||
end
|
end
|
||||||
|
|
||||||
idl.func = setmetatable({}, { __index = funcdef })
|
local function func(sets)
|
||||||
|
return function (_, funcname)
|
||||||
|
local f = { name = funcname , args = {} }
|
||||||
|
if #comments > 0 then
|
||||||
|
f.comments = comments
|
||||||
|
comments = {}
|
||||||
|
end
|
||||||
|
sets[#sets+1] = f
|
||||||
|
local args
|
||||||
|
local function args_desc(_, args_name)
|
||||||
|
args[args_name] = duplicate_arg_name
|
||||||
|
return function (fulltype)
|
||||||
|
local arg = {
|
||||||
|
name = "_" .. args_name,
|
||||||
|
fulltype = fulltype,
|
||||||
|
}
|
||||||
|
f.args[#f.args+1] = arg
|
||||||
|
return attribs_setter(args, arg, args_desc)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
args = setmetatable({}, { __index = args_desc })
|
||||||
|
local function rettype(value)
|
||||||
|
assert(type(value) == "string", "Need return type")
|
||||||
|
local ret = { fulltype = value }
|
||||||
|
f.ret = ret
|
||||||
|
return attribs_setter(args, ret, args_desc)
|
||||||
|
end
|
||||||
|
|
||||||
|
local function funcdef(value)
|
||||||
|
if type(value) == "table" then
|
||||||
|
copy_attribs(f, value)
|
||||||
|
return rettype
|
||||||
|
end
|
||||||
|
return rettype(value)
|
||||||
|
end
|
||||||
|
|
||||||
|
return classdef(f, funcdef)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
idl.funcptr = setmetatable({}, { __index = func(all_types) })
|
||||||
|
idl.func = setmetatable({}, { __index = func(all_funcs) })
|
||||||
idl.funcs = all_funcs
|
idl.funcs = all_funcs
|
||||||
|
|
||||||
idl.handle = "handle"
|
idl.vararg = "vararg"
|
||||||
idl.enum = "enum"
|
|
||||||
idl.out = "out"
|
idl.out = "out"
|
||||||
|
idl.inout = "inout"
|
||||||
idl.const = "const"
|
idl.const = "const"
|
||||||
|
idl.ctor = "ctor"
|
||||||
|
idl.cfunc = "cfunc"
|
||||||
|
idl.underscore = "underscore"
|
||||||
|
idl.conly = "conly"
|
||||||
|
idl.cpponly = "cpponly"
|
||||||
|
idl.NULL = "NULL"
|
||||||
|
idl.UINT16_MAX = "UINT16_MAX"
|
||||||
|
idl.INT32_MAX = "INT32_MAX"
|
||||||
|
idl.UINT32_MAX = "UINT32_MAX"
|
||||||
|
idl.UINT8_MAX = "UINT8_MAX"
|
||||||
|
|
||||||
return setmetatable(idl , { __index = function (_, keyword)
|
return setmetatable(idl , { __index = function (_, keyword)
|
||||||
error (tostring(keyword) .. " is invalid")
|
error (tostring(keyword) .. " is invalid")
|
||||||
|
127
scripts/temp.bgfx.h
Normal file
127
scripts/temp.bgfx.h
Normal file
@ -0,0 +1,127 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2011-2019 Branimir Karadzic. All rights reserved.
|
||||||
|
* License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE
|
||||||
|
*
|
||||||
|
* vim: set tabstop=4 expandtab:
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
* AUTO GENERATED! DO NOT EDIT! ( source : $source )
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef BGFX_C99_H_HEADER_GUARD
|
||||||
|
#define BGFX_C99_H_HEADER_GUARD
|
||||||
|
|
||||||
|
#include <stdarg.h> // va_list
|
||||||
|
#include <stdbool.h> // bool
|
||||||
|
#include <stdint.h> // uint32_t
|
||||||
|
#include <stdlib.h> // size_t
|
||||||
|
|
||||||
|
#include <bx/platform.h>
|
||||||
|
|
||||||
|
#if !defined(BGFX_INVALID_HANDLE)
|
||||||
|
# define BGFX_INVALID_HANDLE { UINT16_MAX }
|
||||||
|
#endif // !defined(BGFX_INVALID_HANDLE)
|
||||||
|
|
||||||
|
#ifndef BGFX_SHARED_LIB_BUILD
|
||||||
|
# define BGFX_SHARED_LIB_BUILD 0
|
||||||
|
#endif // BGFX_SHARED_LIB_BUILD
|
||||||
|
|
||||||
|
#ifndef BGFX_SHARED_LIB_USE
|
||||||
|
# define BGFX_SHARED_LIB_USE 0
|
||||||
|
#endif // BGFX_SHARED_LIB_USE
|
||||||
|
|
||||||
|
#if BX_PLATFORM_WINDOWS
|
||||||
|
# define BGFX_SYMBOL_EXPORT __declspec(dllexport)
|
||||||
|
# define BGFX_SYMBOL_IMPORT __declspec(dllimport)
|
||||||
|
#else
|
||||||
|
# define BGFX_SYMBOL_EXPORT __attribute__((visibility("default")))
|
||||||
|
# define BGFX_SYMBOL_IMPORT
|
||||||
|
#endif // BX_PLATFORM_WINDOWS
|
||||||
|
|
||||||
|
#if BGFX_SHARED_LIB_BUILD
|
||||||
|
# define BGFX_SHARED_LIB_API BGFX_SYMBOL_EXPORT
|
||||||
|
#elif BGFX_SHARED_LIB_USE
|
||||||
|
# define BGFX_SHARED_LIB_API BGFX_SYMBOL_IMPORT
|
||||||
|
#else
|
||||||
|
# define BGFX_SHARED_LIB_API
|
||||||
|
#endif // BGFX_SHARED_LIB_*
|
||||||
|
|
||||||
|
#if defined(__cplusplus)
|
||||||
|
# define BGFX_C_API extern "C" BGFX_SHARED_LIB_API
|
||||||
|
#else
|
||||||
|
# define BGFX_C_API BGFX_SHARED_LIB_API
|
||||||
|
#endif // defined(__cplusplus)
|
||||||
|
|
||||||
|
#include "../defines.h"
|
||||||
|
|
||||||
|
$cenums
|
||||||
|
|
||||||
|
/**/
|
||||||
|
typedef uint16_t bgfx_view_id_t;
|
||||||
|
|
||||||
|
/**/
|
||||||
|
typedef struct bgfx_allocator_interface_s
|
||||||
|
{
|
||||||
|
const struct bgfx_allocator_vtbl_s* vtbl;
|
||||||
|
|
||||||
|
} bgfx_allocator_interface_t;
|
||||||
|
|
||||||
|
/**/
|
||||||
|
typedef struct bgfx_allocator_vtbl_s
|
||||||
|
{
|
||||||
|
void* (*realloc)(bgfx_allocator_interface_t* _this, void* _ptr, size_t _size, size_t _align, const char* _file, uint32_t _line);
|
||||||
|
|
||||||
|
} bgfx_allocator_vtbl_t;
|
||||||
|
|
||||||
|
/**/
|
||||||
|
typedef struct bgfx_interface_vtbl bgfx_interface_vtbl_t;
|
||||||
|
|
||||||
|
/**/
|
||||||
|
typedef struct bgfx_callback_interface_s
|
||||||
|
{
|
||||||
|
const struct bgfx_callback_vtbl_s* vtbl;
|
||||||
|
|
||||||
|
} bgfx_callback_interface_t;
|
||||||
|
|
||||||
|
|
||||||
|
/**/
|
||||||
|
typedef struct bgfx_callback_vtbl_s
|
||||||
|
{
|
||||||
|
void (*fatal)(bgfx_callback_interface_t* _this, const char* _filePath, uint16_t _line, bgfx_fatal_t _code, const char* _str);
|
||||||
|
void (*trace_vargs)(bgfx_callback_interface_t* _this, const char* _filePath, uint16_t _line, const char* _format, va_list _argList);
|
||||||
|
void (*profiler_begin)(bgfx_callback_interface_t* _this, const char* _name, uint32_t _abgr, const char* _filePath, uint16_t _line);
|
||||||
|
void (*profiler_begin_literal)(bgfx_callback_interface_t* _this, const char* _name, uint32_t _abgr, const char* _filePath, uint16_t _line);
|
||||||
|
void (*profiler_end)(bgfx_callback_interface_t* _this);
|
||||||
|
uint32_t (*cache_read_size)(bgfx_callback_interface_t* _this, uint64_t _id);
|
||||||
|
bool (*cache_read)(bgfx_callback_interface_t* _this, uint64_t _id, void* _data, uint32_t _size);
|
||||||
|
void (*cache_write)(bgfx_callback_interface_t* _this, uint64_t _id, const void* _data, uint32_t _size);
|
||||||
|
void (*screen_shot)(bgfx_callback_interface_t* _this, const char* _filePath, uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _data, uint32_t _size, bool _yflip);
|
||||||
|
void (*capture_begin)(bgfx_callback_interface_t* _this, uint32_t _width, uint32_t _height, uint32_t _pitch, bgfx_texture_format_t _format, bool _yflip);
|
||||||
|
void (*capture_end)(bgfx_callback_interface_t* _this);
|
||||||
|
void (*capture_frame)(bgfx_callback_interface_t* _this, const void* _data, uint32_t _size);
|
||||||
|
|
||||||
|
} bgfx_callback_vtbl_t;
|
||||||
|
|
||||||
|
$chandles
|
||||||
|
|
||||||
|
$cfuncptrs
|
||||||
|
|
||||||
|
$cstructs
|
||||||
|
|
||||||
|
$c99decl
|
||||||
|
|
||||||
|
struct bgfx_interface_vtbl
|
||||||
|
{
|
||||||
|
$interface_struct
|
||||||
|
};
|
||||||
|
|
||||||
|
/**/
|
||||||
|
typedef bgfx_interface_vtbl_t* (*PFN_BGFX_GET_INTERFACE)(uint32_t _version);
|
||||||
|
|
||||||
|
/**/
|
||||||
|
BGFX_C_API bgfx_interface_vtbl_t* bgfx_get_interface(uint32_t _version);
|
||||||
|
|
||||||
|
#endif // BGFX_C99_H_HEADER_GUARD
|
59
scripts/temp.bgfx.idl.inl
Normal file
59
scripts/temp.bgfx.idl.inl
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
/*
|
||||||
|
* License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
* AUTO GENERATED! DO NOT EDIT!
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
$c99
|
||||||
|
|
||||||
|
/* user define functions */
|
||||||
|
BGFX_C_API void bgfx_init_ctor(bgfx_init_t* _init)
|
||||||
|
{
|
||||||
|
BX_PLACEMENT_NEW(_init, bgfx::Init);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
BGFX_C_API bool bgfx_init(const bgfx_init_t * _init)
|
||||||
|
{
|
||||||
|
bgfx_init_t init =*_init;
|
||||||
|
|
||||||
|
if (init.callback != NULL)
|
||||||
|
{
|
||||||
|
static bgfx::CallbackC99 s_callback;
|
||||||
|
s_callback.m_interface = init.callback;
|
||||||
|
init.callback = reinterpret_cast<bgfx_callback_interface_t*>(&s_callback);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (init.allocator != NULL)
|
||||||
|
{
|
||||||
|
static bgfx::AllocatorC99 s_allocator;
|
||||||
|
s_allocator.m_interface = init.allocator;
|
||||||
|
init.allocator = reinterpret_cast<bgfx_allocator_interface_t*>(&s_allocator);
|
||||||
|
}
|
||||||
|
|
||||||
|
union { const bgfx_init_t* c; const bgfx::Init* cpp; } in;
|
||||||
|
in.c = &init;
|
||||||
|
|
||||||
|
return bgfx::init(*in.cpp);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**/
|
||||||
|
BGFX_C_API bgfx_interface_vtbl_t* bgfx_get_interface(uint32_t _version)
|
||||||
|
{
|
||||||
|
if (_version == BGFX_API_VERSION)
|
||||||
|
{
|
||||||
|
static bgfx_interface_vtbl_t s_bgfx_interface =
|
||||||
|
{
|
||||||
|
$interface_import
|
||||||
|
};
|
||||||
|
|
||||||
|
return &s_bgfx_interface;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
314
src/bgfx.idl.inl
314
src/bgfx.idl.inl
@ -8,10 +8,17 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
BGFX_C_API void bgfx_vertex_decl_begin(bgfx_vertex_decl_t* _this, bgfx_renderer_type_t _renderer)
|
BGFX_C_API void bgfx_attachment_init(bgfx_attachment_t* _this, bgfx_texture_handle_t _handle, bgfx_access_t _access, uint16_t _layer, uint16_t _mip, uint8_t _resolve)
|
||||||
|
{
|
||||||
|
bgfx::Attachment* This = (bgfx::Attachment*)_this;
|
||||||
|
union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } handle = { _handle };
|
||||||
|
This->init(handle.cpp, (bgfx::Access::Enum)_access, _layer, _mip, _resolve);
|
||||||
|
}
|
||||||
|
|
||||||
|
BGFX_C_API void bgfx_vertex_decl_begin(bgfx_vertex_decl_t* _this, bgfx_renderer_type_t _rendererType)
|
||||||
{
|
{
|
||||||
bgfx::VertexDecl* This = (bgfx::VertexDecl*)_this;
|
bgfx::VertexDecl* This = (bgfx::VertexDecl*)_this;
|
||||||
This->begin((bgfx::RendererType::Enum)_renderer);
|
This->begin((bgfx::RendererType::Enum)_rendererType);
|
||||||
}
|
}
|
||||||
|
|
||||||
BGFX_C_API void bgfx_vertex_decl_add(bgfx_vertex_decl_t* _this, bgfx_attrib_t _attrib, uint8_t _num, bgfx_attrib_type_t _type, bool _normalized, bool _asInt)
|
BGFX_C_API void bgfx_vertex_decl_add(bgfx_vertex_decl_t* _this, bgfx_attrib_t _attrib, uint8_t _num, bgfx_attrib_type_t _type, bool _normalized, bool _asInt)
|
||||||
@ -46,81 +53,54 @@ BGFX_C_API void bgfx_vertex_decl_end(bgfx_vertex_decl_t* _this)
|
|||||||
This->end();
|
This->end();
|
||||||
}
|
}
|
||||||
|
|
||||||
BGFX_C_API void bgfx_vertex_pack(const float * _input, bool _inputNormalized, bgfx_attrib_t _attr, const bgfx_vertex_decl_t * _decl, void * _data, uint32_t _index)
|
BGFX_C_API void bgfx_vertex_pack(const float _input[4], bool _inputNormalized, bgfx_attrib_t _attr, const bgfx_vertex_decl_t * _decl, void* _data, uint32_t _index)
|
||||||
{
|
{
|
||||||
const bgfx::VertexDecl & decl = *(const bgfx::VertexDecl *)_decl;
|
const bgfx::VertexDecl & decl = *(const bgfx::VertexDecl *)_decl;
|
||||||
bgfx::vertexPack(_input, _inputNormalized, (bgfx::Attrib::Enum)_attr, decl, _data, _index);
|
bgfx::vertexPack(_input, _inputNormalized, (bgfx::Attrib::Enum)_attr, decl, _data, _index);
|
||||||
}
|
}
|
||||||
|
|
||||||
BGFX_C_API void bgfx_vertex_unpack(float * _output, bgfx_attrib_t _attr, const bgfx_vertex_decl_t * _decl, const void * _data, uint32_t _index)
|
BGFX_C_API void bgfx_vertex_unpack(float _output[4], bgfx_attrib_t _attr, const bgfx_vertex_decl_t * _decl, const void* _data, uint32_t _index)
|
||||||
{
|
{
|
||||||
const bgfx::VertexDecl & decl = *(const bgfx::VertexDecl *)_decl;
|
const bgfx::VertexDecl & decl = *(const bgfx::VertexDecl *)_decl;
|
||||||
bgfx::vertexUnpack(_output, (bgfx::Attrib::Enum)_attr, decl, _data, _index);
|
bgfx::vertexUnpack(_output, (bgfx::Attrib::Enum)_attr, decl, _data, _index);
|
||||||
}
|
}
|
||||||
|
|
||||||
BGFX_C_API void bgfx_vertex_convert(const bgfx_vertex_decl_t * _dstDecl, void * _dstData, const bgfx_vertex_decl_t * _srcDecl, const void * _srcData, uint32_t _num)
|
BGFX_C_API void bgfx_vertex_convert(const bgfx_vertex_decl_t * _dstDecl, void* _dstData, const bgfx_vertex_decl_t * _srcDecl, const void* _srcData, uint32_t _num)
|
||||||
{
|
{
|
||||||
const bgfx::VertexDecl & dstDecl = *(const bgfx::VertexDecl *)_dstDecl;
|
const bgfx::VertexDecl & dstDecl = *(const bgfx::VertexDecl *)_dstDecl;
|
||||||
const bgfx::VertexDecl & srcDecl = *(const bgfx::VertexDecl *)_srcDecl;
|
const bgfx::VertexDecl & srcDecl = *(const bgfx::VertexDecl *)_srcDecl;
|
||||||
bgfx::vertexConvert(dstDecl, _dstData, srcDecl, _srcData, _num);
|
bgfx::vertexConvert(dstDecl, _dstData, srcDecl, _srcData, _num);
|
||||||
}
|
}
|
||||||
|
|
||||||
BGFX_C_API uint16_t bgfx_weld_vertices(uint16_t * _output, const bgfx_vertex_decl_t * _decl, const void * _data, uint16_t _num, float _epsilon)
|
BGFX_C_API uint16_t bgfx_weld_vertices(uint16_t* _output, const bgfx_vertex_decl_t * _decl, const void* _data, uint16_t _num, float _epsilon)
|
||||||
{
|
{
|
||||||
const bgfx::VertexDecl & decl = *(const bgfx::VertexDecl *)_decl;
|
const bgfx::VertexDecl & decl = *(const bgfx::VertexDecl *)_decl;
|
||||||
return bgfx::weldVertices(_output, decl, _data, _num, _epsilon);
|
return bgfx::weldVertices(_output, decl, _data, _num, _epsilon);
|
||||||
}
|
}
|
||||||
|
|
||||||
BGFX_C_API uint32_t bgfx_topology_convert(bgfx_topology_convert_t _conversion, void * _dst, uint32_t _dstSize, const void * _indices, uint32_t _numIndices, bool _index32)
|
BGFX_C_API uint32_t bgfx_topology_convert(bgfx_topology_convert_t _conversion, void* _dst, uint32_t _dstSize, const void* _indices, uint32_t _numIndices, bool _index32)
|
||||||
{
|
{
|
||||||
return bgfx::topologyConvert((bgfx::TopologyConvert::Enum)_conversion, _dst, _dstSize, _indices, _numIndices, _index32);
|
return bgfx::topologyConvert((bgfx::TopologyConvert::Enum)_conversion, _dst, _dstSize, _indices, _numIndices, _index32);
|
||||||
}
|
}
|
||||||
|
|
||||||
BGFX_C_API void bgfx_topology_sort_tri_list(bgfx_topology_sort_t _sort, void * _dst, uint32_t _dstSize, const float * _dir, const float * _pos, const void * _vertices, uint32_t _stride, const void * _indices, uint32_t _numIndices, bool _index32)
|
BGFX_C_API void bgfx_topology_sort_tri_list(bgfx_topology_sort_t _sort, void* _dst, uint32_t _dstSize, const float _dir[3], const float _pos[3], const void* _vertices, uint32_t _stride, const void* _indices, uint32_t _numIndices, bool _index32)
|
||||||
{
|
{
|
||||||
bgfx::topologySortTriList((bgfx::TopologySort::Enum)_sort, _dst, _dstSize, _dir, _pos, _vertices, _stride, _indices, _numIndices, _index32);
|
bgfx::topologySortTriList((bgfx::TopologySort::Enum)_sort, _dst, _dstSize, _dir, _pos, _vertices, _stride, _indices, _numIndices, _index32);
|
||||||
}
|
}
|
||||||
|
|
||||||
BGFX_C_API uint8_t bgfx_get_supported_renderers(uint8_t _max, bgfx_renderer_type_t * _enum)
|
BGFX_C_API uint8_t bgfx_get_supported_renderers(uint8_t _max, bgfx_renderer_type_t* _enum)
|
||||||
{
|
{
|
||||||
return bgfx::getSupportedRenderers(_max, (bgfx::RendererType::Enum *)_enum);
|
return bgfx::getSupportedRenderers(_max, (bgfx::RendererType::Enum*)_enum);
|
||||||
}
|
}
|
||||||
|
|
||||||
BGFX_C_API const char * bgfx_get_renderer_name(bgfx_renderer_type_t _type)
|
BGFX_C_API const char* bgfx_get_renderer_name(bgfx_renderer_type_t _type)
|
||||||
{
|
{
|
||||||
return (const char *)bgfx::getRendererName((bgfx::RendererType::Enum)_type);
|
return bgfx::getRendererName((bgfx::RendererType::Enum)_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
BGFX_C_API void bgfx_init_ctor(bgfx_init_t * _init)
|
/* BGFX_C_API void bgfx_init_ctor(bgfx_init_t* _init) */
|
||||||
{
|
|
||||||
BX_PLACEMENT_NEW(_init, bgfx::Init);
|
|
||||||
|
|
||||||
}
|
/* BGFX_C_API bool bgfx_init(const bgfx_init_t * _init) */
|
||||||
|
|
||||||
BGFX_C_API bool bgfx_init(const bgfx_init_t * _init)
|
|
||||||
{
|
|
||||||
bgfx_init_t init = *_init;
|
|
||||||
|
|
||||||
if (init.callback != NULL)
|
|
||||||
{
|
|
||||||
static bgfx::CallbackC99 s_callback;
|
|
||||||
s_callback.m_interface = init.callback;
|
|
||||||
init.callback = reinterpret_cast<bgfx_callback_interface_t *>(&s_callback);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (init.allocator != NULL)
|
|
||||||
{
|
|
||||||
static bgfx::AllocatorC99 s_allocator;
|
|
||||||
s_allocator.m_interface = init.allocator;
|
|
||||||
init.allocator = reinterpret_cast<bgfx_allocator_interface_t *>(&s_allocator);
|
|
||||||
}
|
|
||||||
|
|
||||||
union { const bgfx_init_t* c; const bgfx::Init* cpp; } in;
|
|
||||||
in.c = &init;
|
|
||||||
|
|
||||||
return bgfx::init(*in.cpp);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
BGFX_C_API void bgfx_shutdown()
|
BGFX_C_API void bgfx_shutdown()
|
||||||
{
|
{
|
||||||
@ -142,34 +122,34 @@ BGFX_C_API bgfx_renderer_type_t bgfx_get_renderer_type()
|
|||||||
return (bgfx_renderer_type_t)bgfx::getRendererType();
|
return (bgfx_renderer_type_t)bgfx::getRendererType();
|
||||||
}
|
}
|
||||||
|
|
||||||
BGFX_C_API const bgfx_caps_t * bgfx_get_caps()
|
BGFX_C_API const bgfx_caps_t* bgfx_get_caps()
|
||||||
{
|
{
|
||||||
return (const bgfx_caps_t *)bgfx::getCaps();
|
return (const bgfx_caps_t*)bgfx::getCaps();
|
||||||
}
|
}
|
||||||
|
|
||||||
BGFX_C_API const bgfx_stats_t * bgfx_get_stats()
|
BGFX_C_API const bgfx_stats_t* bgfx_get_stats()
|
||||||
{
|
{
|
||||||
return (const bgfx_stats_t *)bgfx::getStats();
|
return (const bgfx_stats_t*)bgfx::getStats();
|
||||||
}
|
}
|
||||||
|
|
||||||
BGFX_C_API const bgfx_memory_t * bgfx_alloc(uint32_t _size)
|
BGFX_C_API const bgfx_memory_t* bgfx_alloc(uint32_t _size)
|
||||||
{
|
{
|
||||||
return (const bgfx_memory_t *)bgfx::alloc(_size);
|
return (const bgfx_memory_t*)bgfx::alloc(_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
BGFX_C_API const bgfx_memory_t * bgfx_copy(const void * _data, uint32_t _size)
|
BGFX_C_API const bgfx_memory_t* bgfx_copy(const void* _data, uint32_t _size)
|
||||||
{
|
{
|
||||||
return (const bgfx_memory_t *)bgfx::copy(_data, _size);
|
return (const bgfx_memory_t*)bgfx::copy(_data, _size);
|
||||||
}
|
}
|
||||||
|
|
||||||
BGFX_C_API const bgfx_memory_t * bgfx_make_ref(const void * _data, uint32_t _size)
|
BGFX_C_API const bgfx_memory_t* bgfx_make_ref(const void* _data, uint32_t _size)
|
||||||
{
|
{
|
||||||
return (const bgfx_memory_t *)bgfx::makeRef(_data, _size);
|
return (const bgfx_memory_t*)bgfx::makeRef(_data, _size);
|
||||||
}
|
}
|
||||||
|
|
||||||
BGFX_C_API const bgfx_memory_t * bgfx_make_ref_release(const void * _data, uint32_t _size, bgfx_release_fn_t _releaseFn, void * _userData)
|
BGFX_C_API const bgfx_memory_t* bgfx_make_ref_release(const void* _data, uint32_t _size, bgfx_release_fn_t _releaseFn, void* _userData)
|
||||||
{
|
{
|
||||||
return (const bgfx_memory_t *)bgfx::makeRef(_data, _size, (bgfx::ReleaseFn)_releaseFn, _userData);
|
return (const bgfx_memory_t*)bgfx::makeRef(_data, _size, (bgfx::ReleaseFn)_releaseFn, _userData);
|
||||||
}
|
}
|
||||||
|
|
||||||
BGFX_C_API void bgfx_set_debug(uint32_t _debug)
|
BGFX_C_API void bgfx_set_debug(uint32_t _debug)
|
||||||
@ -182,7 +162,7 @@ BGFX_C_API void bgfx_dbg_text_clear(uint8_t _attr, bool _small)
|
|||||||
bgfx::dbgTextClear(_attr, _small);
|
bgfx::dbgTextClear(_attr, _small);
|
||||||
}
|
}
|
||||||
|
|
||||||
BGFX_C_API void bgfx_dbg_text_printf(uint16_t _x, uint16_t _y, uint8_t _attr, const char * _format, ... )
|
BGFX_C_API void bgfx_dbg_text_printf(uint16_t _x, uint16_t _y, uint8_t _attr, const char* _format, ... )
|
||||||
{
|
{
|
||||||
va_list argList;
|
va_list argList;
|
||||||
va_start(argList, _format);
|
va_start(argList, _format);
|
||||||
@ -190,24 +170,24 @@ BGFX_C_API void bgfx_dbg_text_printf(uint16_t _x, uint16_t _y, uint8_t _attr, co
|
|||||||
va_end(argList);
|
va_end(argList);
|
||||||
}
|
}
|
||||||
|
|
||||||
BGFX_C_API void bgfx_dbg_text_vprintf(uint16_t _x, uint16_t _y, uint8_t _attr, const char * _format, va_list _argList)
|
BGFX_C_API void bgfx_dbg_text_vprintf(uint16_t _x, uint16_t _y, uint8_t _attr, const char* _format, va_list _argList)
|
||||||
{
|
{
|
||||||
bgfx::dbgTextPrintfVargs(_x, _y, _attr, _format, _argList);
|
bgfx::dbgTextPrintfVargs(_x, _y, _attr, _format, _argList);
|
||||||
}
|
}
|
||||||
|
|
||||||
BGFX_C_API void bgfx_dbg_text_image(uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height, const void * _data, uint16_t _pitch)
|
BGFX_C_API void bgfx_dbg_text_image(uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height, const void* _data, uint16_t _pitch)
|
||||||
{
|
{
|
||||||
bgfx::dbgTextImage(_x, _y, _width, _height, _data, _pitch);
|
bgfx::dbgTextImage(_x, _y, _width, _height, _data, _pitch);
|
||||||
}
|
}
|
||||||
|
|
||||||
BGFX_C_API bgfx_index_buffer_handle_t bgfx_create_index_buffer(const bgfx_memory_t * _mem, uint16_t _flags)
|
BGFX_C_API bgfx_index_buffer_handle_t bgfx_create_index_buffer(const bgfx_memory_t* _mem, uint16_t _flags)
|
||||||
{
|
{
|
||||||
union { bgfx_index_buffer_handle_t c; bgfx::IndexBufferHandle cpp; } handle_ret;
|
union { bgfx_index_buffer_handle_t c; bgfx::IndexBufferHandle cpp; } handle_ret;
|
||||||
handle_ret.cpp = bgfx::createIndexBuffer((const bgfx::Memory *)_mem, _flags);
|
handle_ret.cpp = bgfx::createIndexBuffer((const bgfx::Memory*)_mem, _flags);
|
||||||
return handle_ret.c;
|
return handle_ret.c;
|
||||||
}
|
}
|
||||||
|
|
||||||
BGFX_C_API void bgfx_set_index_buffer_name(bgfx_index_buffer_handle_t _handle, const char * _name, int32_t _len)
|
BGFX_C_API void bgfx_set_index_buffer_name(bgfx_index_buffer_handle_t _handle, const char* _name, int32_t _len)
|
||||||
{
|
{
|
||||||
union { bgfx_index_buffer_handle_t c; bgfx::IndexBufferHandle cpp; } handle = { _handle };
|
union { bgfx_index_buffer_handle_t c; bgfx::IndexBufferHandle cpp; } handle = { _handle };
|
||||||
bgfx::setName(handle.cpp, _name, _len);
|
bgfx::setName(handle.cpp, _name, _len);
|
||||||
@ -219,15 +199,15 @@ BGFX_C_API void bgfx_destroy_index_buffer(bgfx_index_buffer_handle_t _handle)
|
|||||||
bgfx::destroy(handle.cpp);
|
bgfx::destroy(handle.cpp);
|
||||||
}
|
}
|
||||||
|
|
||||||
BGFX_C_API bgfx_vertex_buffer_handle_t bgfx_create_vertex_buffer(const bgfx_memory_t * _mem, const bgfx_vertex_decl_t * _decl, uint16_t _flags)
|
BGFX_C_API bgfx_vertex_buffer_handle_t bgfx_create_vertex_buffer(const bgfx_memory_t* _mem, const bgfx_vertex_decl_t * _decl, uint16_t _flags)
|
||||||
{
|
{
|
||||||
const bgfx::VertexDecl & decl = *(const bgfx::VertexDecl *)_decl;
|
const bgfx::VertexDecl & decl = *(const bgfx::VertexDecl *)_decl;
|
||||||
union { bgfx_vertex_buffer_handle_t c; bgfx::VertexBufferHandle cpp; } handle_ret;
|
union { bgfx_vertex_buffer_handle_t c; bgfx::VertexBufferHandle cpp; } handle_ret;
|
||||||
handle_ret.cpp = bgfx::createVertexBuffer((const bgfx::Memory *)_mem, decl, _flags);
|
handle_ret.cpp = bgfx::createVertexBuffer((const bgfx::Memory*)_mem, decl, _flags);
|
||||||
return handle_ret.c;
|
return handle_ret.c;
|
||||||
}
|
}
|
||||||
|
|
||||||
BGFX_C_API void bgfx_set_vertex_buffer_name(bgfx_vertex_buffer_handle_t _handle, const char * _name, int32_t _len)
|
BGFX_C_API void bgfx_set_vertex_buffer_name(bgfx_vertex_buffer_handle_t _handle, const char* _name, int32_t _len)
|
||||||
{
|
{
|
||||||
union { bgfx_vertex_buffer_handle_t c; bgfx::VertexBufferHandle cpp; } handle = { _handle };
|
union { bgfx_vertex_buffer_handle_t c; bgfx::VertexBufferHandle cpp; } handle = { _handle };
|
||||||
bgfx::setName(handle.cpp, _name, _len);
|
bgfx::setName(handle.cpp, _name, _len);
|
||||||
@ -246,17 +226,17 @@ BGFX_C_API bgfx_dynamic_index_buffer_handle_t bgfx_create_dynamic_index_buffer(u
|
|||||||
return handle_ret.c;
|
return handle_ret.c;
|
||||||
}
|
}
|
||||||
|
|
||||||
BGFX_C_API bgfx_dynamic_index_buffer_handle_t bgfx_create_dynamic_index_buffer_mem(const bgfx_memory_t * _mem, uint16_t _flags)
|
BGFX_C_API bgfx_dynamic_index_buffer_handle_t bgfx_create_dynamic_index_buffer_mem(const bgfx_memory_t* _mem, uint16_t _flags)
|
||||||
{
|
{
|
||||||
union { bgfx_dynamic_index_buffer_handle_t c; bgfx::DynamicIndexBufferHandle cpp; } handle_ret;
|
union { bgfx_dynamic_index_buffer_handle_t c; bgfx::DynamicIndexBufferHandle cpp; } handle_ret;
|
||||||
handle_ret.cpp = bgfx::createDynamicIndexBuffer((const bgfx::Memory *)_mem, _flags);
|
handle_ret.cpp = bgfx::createDynamicIndexBuffer((const bgfx::Memory*)_mem, _flags);
|
||||||
return handle_ret.c;
|
return handle_ret.c;
|
||||||
}
|
}
|
||||||
|
|
||||||
BGFX_C_API void bgfx_update_dynamic_index_buffer(bgfx_dynamic_index_buffer_handle_t _handle, uint32_t _startIndex, const bgfx_memory_t * _mem)
|
BGFX_C_API void bgfx_update_dynamic_index_buffer(bgfx_dynamic_index_buffer_handle_t _handle, uint32_t _startIndex, const bgfx_memory_t* _mem)
|
||||||
{
|
{
|
||||||
union { bgfx_dynamic_index_buffer_handle_t c; bgfx::DynamicIndexBufferHandle cpp; } handle = { _handle };
|
union { bgfx_dynamic_index_buffer_handle_t c; bgfx::DynamicIndexBufferHandle cpp; } handle = { _handle };
|
||||||
bgfx::update(handle.cpp, _startIndex, (const bgfx::Memory *)_mem);
|
bgfx::update(handle.cpp, _startIndex, (const bgfx::Memory*)_mem);
|
||||||
}
|
}
|
||||||
|
|
||||||
BGFX_C_API void bgfx_destroy_dynamic_index_buffer(bgfx_dynamic_index_buffer_handle_t _handle)
|
BGFX_C_API void bgfx_destroy_dynamic_index_buffer(bgfx_dynamic_index_buffer_handle_t _handle)
|
||||||
@ -265,26 +245,26 @@ BGFX_C_API void bgfx_destroy_dynamic_index_buffer(bgfx_dynamic_index_buffer_hand
|
|||||||
bgfx::destroy(handle.cpp);
|
bgfx::destroy(handle.cpp);
|
||||||
}
|
}
|
||||||
|
|
||||||
BGFX_C_API bgfx_dynamic_vertex_buffer_handle_t bgfx_create_dynamic_vertex_buffer(uint32_t _num, const bgfx_vertex_decl_t * _decl, uint16_t _flags)
|
BGFX_C_API bgfx_dynamic_vertex_buffer_handle_t bgfx_create_dynamic_vertex_buffer(uint32_t _num, const bgfx_vertex_decl_t* _decl, uint16_t _flags)
|
||||||
{
|
{
|
||||||
const bgfx::VertexDecl & decl = *(const bgfx::VertexDecl *)_decl;
|
const bgfx::VertexDecl& decl = *(const bgfx::VertexDecl*)_decl;
|
||||||
union { bgfx_dynamic_vertex_buffer_handle_t c; bgfx::DynamicVertexBufferHandle cpp; } handle_ret;
|
union { bgfx_dynamic_vertex_buffer_handle_t c; bgfx::DynamicVertexBufferHandle cpp; } handle_ret;
|
||||||
handle_ret.cpp = bgfx::createDynamicVertexBuffer(_num, decl, _flags);
|
handle_ret.cpp = bgfx::createDynamicVertexBuffer(_num, decl, _flags);
|
||||||
return handle_ret.c;
|
return handle_ret.c;
|
||||||
}
|
}
|
||||||
|
|
||||||
BGFX_C_API bgfx_dynamic_vertex_buffer_handle_t bgfx_create_dynamic_vertex_buffer_mem(const bgfx_memory_t * _mem, const bgfx_vertex_decl_t * _decl, uint16_t _flags)
|
BGFX_C_API bgfx_dynamic_vertex_buffer_handle_t bgfx_create_dynamic_vertex_buffer_mem(const bgfx_memory_t* _mem, const bgfx_vertex_decl_t* _decl, uint16_t _flags)
|
||||||
{
|
{
|
||||||
const bgfx::VertexDecl & decl = *(const bgfx::VertexDecl *)_decl;
|
const bgfx::VertexDecl& decl = *(const bgfx::VertexDecl*)_decl;
|
||||||
union { bgfx_dynamic_vertex_buffer_handle_t c; bgfx::DynamicVertexBufferHandle cpp; } handle_ret;
|
union { bgfx_dynamic_vertex_buffer_handle_t c; bgfx::DynamicVertexBufferHandle cpp; } handle_ret;
|
||||||
handle_ret.cpp = bgfx::createDynamicVertexBuffer((const bgfx::Memory *)_mem, decl, _flags);
|
handle_ret.cpp = bgfx::createDynamicVertexBuffer((const bgfx::Memory*)_mem, decl, _flags);
|
||||||
return handle_ret.c;
|
return handle_ret.c;
|
||||||
}
|
}
|
||||||
|
|
||||||
BGFX_C_API void bgfx_update_dynamic_vertex_buffer(bgfx_dynamic_vertex_buffer_handle_t _handle, uint32_t _startVertex, const bgfx_memory_t * _mem)
|
BGFX_C_API void bgfx_update_dynamic_vertex_buffer(bgfx_dynamic_vertex_buffer_handle_t _handle, uint32_t _startVertex, const bgfx_memory_t* _mem)
|
||||||
{
|
{
|
||||||
union { bgfx_dynamic_vertex_buffer_handle_t c; bgfx::DynamicVertexBufferHandle cpp; } handle = { _handle };
|
union { bgfx_dynamic_vertex_buffer_handle_t c; bgfx::DynamicVertexBufferHandle cpp; } handle = { _handle };
|
||||||
bgfx::update(handle.cpp, _startVertex, (const bgfx::Memory *)_mem);
|
bgfx::update(handle.cpp, _startVertex, (const bgfx::Memory*)_mem);
|
||||||
}
|
}
|
||||||
|
|
||||||
BGFX_C_API void bgfx_destroy_dynamic_vertex_buffer(bgfx_dynamic_vertex_buffer_handle_t _handle)
|
BGFX_C_API void bgfx_destroy_dynamic_vertex_buffer(bgfx_dynamic_vertex_buffer_handle_t _handle)
|
||||||
@ -309,26 +289,26 @@ BGFX_C_API uint32_t bgfx_get_avail_instance_data_buffer(uint32_t _num, uint16_t
|
|||||||
return bgfx::getAvailInstanceDataBuffer(_num, _stride);
|
return bgfx::getAvailInstanceDataBuffer(_num, _stride);
|
||||||
}
|
}
|
||||||
|
|
||||||
BGFX_C_API void bgfx_alloc_transient_index_buffer(bgfx_transient_index_buffer_t * _tib, uint32_t _num)
|
BGFX_C_API void bgfx_alloc_transient_index_buffer(bgfx_transient_index_buffer_t* _tib, uint32_t _num)
|
||||||
{
|
{
|
||||||
bgfx::allocTransientIndexBuffer((bgfx::TransientIndexBuffer *)_tib, _num);
|
bgfx::allocTransientIndexBuffer((bgfx::TransientIndexBuffer*)_tib, _num);
|
||||||
}
|
}
|
||||||
|
|
||||||
BGFX_C_API void bgfx_alloc_transient_vertex_buffer(bgfx_transient_vertex_buffer_t * _tvb, uint32_t _num, const bgfx_vertex_decl_t * _decl)
|
BGFX_C_API void bgfx_alloc_transient_vertex_buffer(bgfx_transient_vertex_buffer_t* _tvb, uint32_t _num, const bgfx_vertex_decl_t * _decl)
|
||||||
{
|
{
|
||||||
const bgfx::VertexDecl & decl = *(const bgfx::VertexDecl *)_decl;
|
const bgfx::VertexDecl & decl = *(const bgfx::VertexDecl *)_decl;
|
||||||
bgfx::allocTransientVertexBuffer((bgfx::TransientVertexBuffer *)_tvb, _num, decl);
|
bgfx::allocTransientVertexBuffer((bgfx::TransientVertexBuffer*)_tvb, _num, decl);
|
||||||
}
|
}
|
||||||
|
|
||||||
BGFX_C_API bool bgfx_alloc_transient_buffers(bgfx_transient_vertex_buffer_t * _tvb, const bgfx_vertex_decl_t * _decl, uint32_t _numVertices, bgfx_transient_index_buffer_t * _tib, uint32_t _numIndices)
|
BGFX_C_API bool bgfx_alloc_transient_buffers(bgfx_transient_vertex_buffer_t* _tvb, const bgfx_vertex_decl_t * _decl, uint32_t _numVertices, bgfx_transient_index_buffer_t* _tib, uint32_t _numIndices)
|
||||||
{
|
{
|
||||||
const bgfx::VertexDecl & decl = *(const bgfx::VertexDecl *)_decl;
|
const bgfx::VertexDecl & decl = *(const bgfx::VertexDecl *)_decl;
|
||||||
return bgfx::allocTransientBuffers((bgfx::TransientVertexBuffer *)_tvb, decl, _numVertices, (bgfx::TransientIndexBuffer *)_tib, _numIndices);
|
return bgfx::allocTransientBuffers((bgfx::TransientVertexBuffer*)_tvb, decl, _numVertices, (bgfx::TransientIndexBuffer*)_tib, _numIndices);
|
||||||
}
|
}
|
||||||
|
|
||||||
BGFX_C_API void bgfx_alloc_instance_data_buffer(bgfx_instance_data_buffer_t * _idb, uint32_t _num, uint16_t _stride)
|
BGFX_C_API void bgfx_alloc_instance_data_buffer(bgfx_instance_data_buffer_t* _idb, uint32_t _num, uint16_t _stride)
|
||||||
{
|
{
|
||||||
bgfx::allocInstanceDataBuffer((bgfx::InstanceDataBuffer *)_idb, _num, _stride);
|
bgfx::allocInstanceDataBuffer((bgfx::InstanceDataBuffer*)_idb, _num, _stride);
|
||||||
}
|
}
|
||||||
|
|
||||||
BGFX_C_API bgfx_indirect_buffer_handle_t bgfx_create_indirect_buffer(uint32_t _num)
|
BGFX_C_API bgfx_indirect_buffer_handle_t bgfx_create_indirect_buffer(uint32_t _num)
|
||||||
@ -344,20 +324,20 @@ BGFX_C_API void bgfx_destroy_indirect_buffer(bgfx_indirect_buffer_handle_t _hand
|
|||||||
bgfx::destroy(handle.cpp);
|
bgfx::destroy(handle.cpp);
|
||||||
}
|
}
|
||||||
|
|
||||||
BGFX_C_API bgfx_shader_handle_t bgfx_create_shader(const bgfx_memory_t * _mem)
|
BGFX_C_API bgfx_shader_handle_t bgfx_create_shader(const bgfx_memory_t* _mem)
|
||||||
{
|
{
|
||||||
union { bgfx_shader_handle_t c; bgfx::ShaderHandle cpp; } handle_ret;
|
union { bgfx_shader_handle_t c; bgfx::ShaderHandle cpp; } handle_ret;
|
||||||
handle_ret.cpp = bgfx::createShader((const bgfx::Memory *)_mem);
|
handle_ret.cpp = bgfx::createShader((const bgfx::Memory*)_mem);
|
||||||
return handle_ret.c;
|
return handle_ret.c;
|
||||||
}
|
}
|
||||||
|
|
||||||
BGFX_C_API uint16_t bgfx_get_shader_uniforms(bgfx_shader_handle_t _handle, bgfx_uniform_handle_t * _uniforms, uint16_t _max)
|
BGFX_C_API uint16_t bgfx_get_shader_uniforms(bgfx_shader_handle_t _handle, bgfx_uniform_handle_t* _uniforms, uint16_t _max)
|
||||||
{
|
{
|
||||||
union { bgfx_shader_handle_t c; bgfx::ShaderHandle cpp; } handle = { _handle };
|
union { bgfx_shader_handle_t c; bgfx::ShaderHandle cpp; } handle = { _handle };
|
||||||
return bgfx::getShaderUniforms(handle.cpp, (bgfx::UniformHandle *)_uniforms, _max);
|
return bgfx::getShaderUniforms(handle.cpp, (bgfx::UniformHandle*)_uniforms, _max);
|
||||||
}
|
}
|
||||||
|
|
||||||
BGFX_C_API void bgfx_set_shader_name(bgfx_shader_handle_t _handle, const char * _name, int32_t _len)
|
BGFX_C_API void bgfx_set_shader_name(bgfx_shader_handle_t _handle, const char* _name, int32_t _len)
|
||||||
{
|
{
|
||||||
union { bgfx_shader_handle_t c; bgfx::ShaderHandle cpp; } handle = { _handle };
|
union { bgfx_shader_handle_t c; bgfx::ShaderHandle cpp; } handle = { _handle };
|
||||||
bgfx::setName(handle.cpp, _name, _len);
|
bgfx::setName(handle.cpp, _name, _len);
|
||||||
@ -403,17 +383,17 @@ BGFX_C_API void bgfx_calc_texture_size(bgfx_texture_info_t * _info, uint16_t _wi
|
|||||||
bgfx::calcTextureSize(info, _width, _height, _depth, _cubeMap, _hasMips, _numLayers, (bgfx::TextureFormat::Enum)_format);
|
bgfx::calcTextureSize(info, _width, _height, _depth, _cubeMap, _hasMips, _numLayers, (bgfx::TextureFormat::Enum)_format);
|
||||||
}
|
}
|
||||||
|
|
||||||
BGFX_C_API bgfx_texture_handle_t bgfx_create_texture(const bgfx_memory_t * _mem, uint64_t _flags, uint8_t _skip, bgfx_texture_info_t * _info)
|
BGFX_C_API bgfx_texture_handle_t bgfx_create_texture(const bgfx_memory_t* _mem, uint64_t _flags, uint8_t _skip, bgfx_texture_info_t* _info)
|
||||||
{
|
{
|
||||||
union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } handle_ret;
|
union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } handle_ret;
|
||||||
handle_ret.cpp = bgfx::createTexture((const bgfx::Memory *)_mem, _flags, _skip, (bgfx::TextureInfo *)_info);
|
handle_ret.cpp = bgfx::createTexture((const bgfx::Memory*)_mem, _flags, _skip, (bgfx::TextureInfo*)_info);
|
||||||
return handle_ret.c;
|
return handle_ret.c;
|
||||||
}
|
}
|
||||||
|
|
||||||
BGFX_C_API bgfx_texture_handle_t bgfx_create_texture_2d(uint16_t _width, uint16_t _height, bool _hasMips, uint16_t _numLayers, bgfx_texture_format_t _format, uint64_t _flags, const bgfx_memory_t * _mem)
|
BGFX_C_API bgfx_texture_handle_t bgfx_create_texture_2d(uint16_t _width, uint16_t _height, bool _hasMips, uint16_t _numLayers, bgfx_texture_format_t _format, uint64_t _flags, const bgfx_memory_t* _mem)
|
||||||
{
|
{
|
||||||
union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } handle_ret;
|
union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } handle_ret;
|
||||||
handle_ret.cpp = bgfx::createTexture2D(_width, _height, _hasMips, _numLayers, (bgfx::TextureFormat::Enum)_format, _flags, (const bgfx::Memory *)_mem);
|
handle_ret.cpp = bgfx::createTexture2D(_width, _height, _hasMips, _numLayers, (bgfx::TextureFormat::Enum)_format, _flags, (const bgfx::Memory*)_mem);
|
||||||
return handle_ret.c;
|
return handle_ret.c;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -424,54 +404,54 @@ BGFX_C_API bgfx_texture_handle_t bgfx_create_texture_2d_scaled(bgfx_backbuffer_r
|
|||||||
return handle_ret.c;
|
return handle_ret.c;
|
||||||
}
|
}
|
||||||
|
|
||||||
BGFX_C_API bgfx_texture_handle_t bgfx_create_texture_3d(uint16_t _width, uint16_t _height, uint16_t _depth, bool _hasMips, bgfx_texture_format_t _format, uint64_t _flags, const bgfx_memory_t * _mem)
|
BGFX_C_API bgfx_texture_handle_t bgfx_create_texture_3d(uint16_t _width, uint16_t _height, uint16_t _depth, bool _hasMips, bgfx_texture_format_t _format, uint64_t _flags, const bgfx_memory_t* _mem)
|
||||||
{
|
{
|
||||||
union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } handle_ret;
|
union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } handle_ret;
|
||||||
handle_ret.cpp = bgfx::createTexture3D(_width, _height, _depth, _hasMips, (bgfx::TextureFormat::Enum)_format, _flags, (const bgfx::Memory *)_mem);
|
handle_ret.cpp = bgfx::createTexture3D(_width, _height, _depth, _hasMips, (bgfx::TextureFormat::Enum)_format, _flags, (const bgfx::Memory*)_mem);
|
||||||
return handle_ret.c;
|
return handle_ret.c;
|
||||||
}
|
}
|
||||||
|
|
||||||
BGFX_C_API bgfx_texture_handle_t bgfx_create_texture_cube(uint16_t _size, bool _hasMips, uint16_t _numLayers, bgfx_texture_format_t _format, uint64_t _flags, const bgfx_memory_t * _mem)
|
BGFX_C_API bgfx_texture_handle_t bgfx_create_texture_cube(uint16_t _size, bool _hasMips, uint16_t _numLayers, bgfx_texture_format_t _format, uint64_t _flags, const bgfx_memory_t* _mem)
|
||||||
{
|
{
|
||||||
union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } handle_ret;
|
union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } handle_ret;
|
||||||
handle_ret.cpp = bgfx::createTextureCube(_size, _hasMips, _numLayers, (bgfx::TextureFormat::Enum)_format, _flags, (const bgfx::Memory *)_mem);
|
handle_ret.cpp = bgfx::createTextureCube(_size, _hasMips, _numLayers, (bgfx::TextureFormat::Enum)_format, _flags, (const bgfx::Memory*)_mem);
|
||||||
return handle_ret.c;
|
return handle_ret.c;
|
||||||
}
|
}
|
||||||
|
|
||||||
BGFX_C_API void bgfx_update_texture_2d(bgfx_texture_handle_t _handle, uint16_t _layer, uint8_t _mip, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height, const bgfx_memory_t * _mem, uint16_t _pitch)
|
BGFX_C_API void bgfx_update_texture_2d(bgfx_texture_handle_t _handle, uint16_t _layer, uint8_t _mip, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height, const bgfx_memory_t* _mem, uint16_t _pitch)
|
||||||
{
|
{
|
||||||
union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } handle = { _handle };
|
union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } handle = { _handle };
|
||||||
bgfx::updateTexture2D(handle.cpp, _layer, _mip, _x, _y, _width, _height, (const bgfx::Memory *)_mem, _pitch);
|
bgfx::updateTexture2D(handle.cpp, _layer, _mip, _x, _y, _width, _height, (const bgfx::Memory*)_mem, _pitch);
|
||||||
}
|
}
|
||||||
|
|
||||||
BGFX_C_API void bgfx_update_texture_3d(bgfx_texture_handle_t _handle, uint8_t _mip, uint16_t _x, uint16_t _y, uint16_t _z, uint16_t _width, uint16_t _height, uint16_t _depth, const bgfx_memory_t * _mem)
|
BGFX_C_API void bgfx_update_texture_3d(bgfx_texture_handle_t _handle, uint8_t _mip, uint16_t _x, uint16_t _y, uint16_t _z, uint16_t _width, uint16_t _height, uint16_t _depth, const bgfx_memory_t* _mem)
|
||||||
{
|
{
|
||||||
union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } handle = { _handle };
|
union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } handle = { _handle };
|
||||||
bgfx::updateTexture3D(handle.cpp, _mip, _x, _y, _z, _width, _height, _depth, (const bgfx::Memory *)_mem);
|
bgfx::updateTexture3D(handle.cpp, _mip, _x, _y, _z, _width, _height, _depth, (const bgfx::Memory*)_mem);
|
||||||
}
|
}
|
||||||
|
|
||||||
BGFX_C_API void bgfx_update_texture_cube(bgfx_texture_handle_t _handle, uint16_t _layer, uint8_t _side, uint8_t _mip, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height, const bgfx_memory_t * _mem, uint16_t _pitch)
|
BGFX_C_API void bgfx_update_texture_cube(bgfx_texture_handle_t _handle, uint16_t _layer, uint8_t _side, uint8_t _mip, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height, const bgfx_memory_t* _mem, uint16_t _pitch)
|
||||||
{
|
{
|
||||||
union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } handle = { _handle };
|
union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } handle = { _handle };
|
||||||
bgfx::updateTextureCube(handle.cpp, _layer, _side, _mip, _x, _y, _width, _height, (const bgfx::Memory *)_mem, _pitch);
|
bgfx::updateTextureCube(handle.cpp, _layer, _side, _mip, _x, _y, _width, _height, (const bgfx::Memory*)_mem, _pitch);
|
||||||
}
|
}
|
||||||
|
|
||||||
BGFX_C_API uint32_t bgfx_read_texture(bgfx_texture_handle_t _handle, void * _data, uint8_t _mip)
|
BGFX_C_API uint32_t bgfx_read_texture(bgfx_texture_handle_t _handle, void* _data, uint8_t _mip)
|
||||||
{
|
{
|
||||||
union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } handle = { _handle };
|
union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } handle = { _handle };
|
||||||
return bgfx::readTexture(handle.cpp, _data, _mip);
|
return bgfx::readTexture(handle.cpp, _data, _mip);
|
||||||
}
|
}
|
||||||
|
|
||||||
BGFX_C_API void bgfx_set_texture_name(bgfx_texture_handle_t _handle, const char * _name, int32_t _len)
|
BGFX_C_API void bgfx_set_texture_name(bgfx_texture_handle_t _handle, const char* _name, int32_t _len)
|
||||||
{
|
{
|
||||||
union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } handle = { _handle };
|
union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } handle = { _handle };
|
||||||
bgfx::setName(handle.cpp, _name, _len);
|
bgfx::setName(handle.cpp, _name, _len);
|
||||||
}
|
}
|
||||||
|
|
||||||
BGFX_C_API void * bgfx_get_direct_access_ptr(bgfx_texture_handle_t _handle)
|
BGFX_C_API void* bgfx_get_direct_access_ptr(bgfx_texture_handle_t _handle)
|
||||||
{
|
{
|
||||||
union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } handle = { _handle };
|
union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } handle = { _handle };
|
||||||
return (void *)bgfx::getDirectAccessPtr(handle.cpp);
|
return bgfx::getDirectAccessPtr(handle.cpp);
|
||||||
}
|
}
|
||||||
|
|
||||||
BGFX_C_API void bgfx_destroy_texture(bgfx_texture_handle_t _handle)
|
BGFX_C_API void bgfx_destroy_texture(bgfx_texture_handle_t _handle)
|
||||||
@ -494,28 +474,28 @@ BGFX_C_API bgfx_frame_buffer_handle_t bgfx_create_frame_buffer_scaled(bgfx_backb
|
|||||||
return handle_ret.c;
|
return handle_ret.c;
|
||||||
}
|
}
|
||||||
|
|
||||||
BGFX_C_API bgfx_frame_buffer_handle_t bgfx_create_frame_buffer_from_handles(uint8_t _num, const bgfx_texture_handle_t * _handles, bool _destroyTexture)
|
BGFX_C_API bgfx_frame_buffer_handle_t bgfx_create_frame_buffer_from_handles(uint8_t _num, const bgfx_texture_handle_t* _handles, bool _destroyTexture)
|
||||||
{
|
{
|
||||||
union { bgfx_frame_buffer_handle_t c; bgfx::FrameBufferHandle cpp; } handle_ret;
|
union { bgfx_frame_buffer_handle_t c; bgfx::FrameBufferHandle cpp; } handle_ret;
|
||||||
handle_ret.cpp = bgfx::createFrameBuffer(_num, (const bgfx::TextureHandle *)_handles, _destroyTexture);
|
handle_ret.cpp = bgfx::createFrameBuffer(_num, (const bgfx::TextureHandle*)_handles, _destroyTexture);
|
||||||
return handle_ret.c;
|
return handle_ret.c;
|
||||||
}
|
}
|
||||||
|
|
||||||
BGFX_C_API bgfx_frame_buffer_handle_t bgfx_create_frame_buffer_from_attachment(uint8_t _num, const bgfx_attachment_t * _handles, bool _destroyTexture)
|
BGFX_C_API bgfx_frame_buffer_handle_t bgfx_create_frame_buffer_from_attachment(uint8_t _num, const bgfx_attachment_t* _attachment, bool _destroyTexture)
|
||||||
{
|
{
|
||||||
union { bgfx_frame_buffer_handle_t c; bgfx::FrameBufferHandle cpp; } handle_ret;
|
union { bgfx_frame_buffer_handle_t c; bgfx::FrameBufferHandle cpp; } handle_ret;
|
||||||
handle_ret.cpp = bgfx::createFrameBuffer(_num, (const bgfx::Attachment *)_handles, _destroyTexture);
|
handle_ret.cpp = bgfx::createFrameBuffer(_num, (const bgfx::Attachment*)_attachment, _destroyTexture);
|
||||||
return handle_ret.c;
|
return handle_ret.c;
|
||||||
}
|
}
|
||||||
|
|
||||||
BGFX_C_API bgfx_frame_buffer_handle_t bgfx_create_frame_buffer_from_nwh(void * _nwh, uint16_t _width, uint16_t _height, bgfx_texture_format_t _format, bgfx_texture_format_t _depthFormat)
|
BGFX_C_API bgfx_frame_buffer_handle_t bgfx_create_frame_buffer_from_nwh(void* _nwh, uint16_t _width, uint16_t _height, bgfx_texture_format_t _format, bgfx_texture_format_t _depthFormat)
|
||||||
{
|
{
|
||||||
union { bgfx_frame_buffer_handle_t c; bgfx::FrameBufferHandle cpp; } handle_ret;
|
union { bgfx_frame_buffer_handle_t c; bgfx::FrameBufferHandle cpp; } handle_ret;
|
||||||
handle_ret.cpp = bgfx::createFrameBuffer(_nwh, _width, _height, (bgfx::TextureFormat::Enum)_format, (bgfx::TextureFormat::Enum)_depthFormat);
|
handle_ret.cpp = bgfx::createFrameBuffer(_nwh, _width, _height, (bgfx::TextureFormat::Enum)_format, (bgfx::TextureFormat::Enum)_depthFormat);
|
||||||
return handle_ret.c;
|
return handle_ret.c;
|
||||||
}
|
}
|
||||||
|
|
||||||
BGFX_C_API void bgfx_set_frame_buffer_name(bgfx_frame_buffer_handle_t _handle, const char * _name, int32_t _len)
|
BGFX_C_API void bgfx_set_frame_buffer_name(bgfx_frame_buffer_handle_t _handle, const char* _name, int32_t _len)
|
||||||
{
|
{
|
||||||
union { bgfx_frame_buffer_handle_t c; bgfx::FrameBufferHandle cpp; } handle = { _handle };
|
union { bgfx_frame_buffer_handle_t c; bgfx::FrameBufferHandle cpp; } handle = { _handle };
|
||||||
bgfx::setName(handle.cpp, _name, _len);
|
bgfx::setName(handle.cpp, _name, _len);
|
||||||
@ -535,7 +515,7 @@ BGFX_C_API void bgfx_destroy_frame_buffer(bgfx_frame_buffer_handle_t _handle)
|
|||||||
bgfx::destroy(handle.cpp);
|
bgfx::destroy(handle.cpp);
|
||||||
}
|
}
|
||||||
|
|
||||||
BGFX_C_API bgfx_uniform_handle_t bgfx_create_uniform(const char * _name, bgfx_uniform_type_t _type, uint16_t _num)
|
BGFX_C_API bgfx_uniform_handle_t bgfx_create_uniform(const char* _name, bgfx_uniform_type_t _type, uint16_t _num)
|
||||||
{
|
{
|
||||||
union { bgfx_uniform_handle_t c; bgfx::UniformHandle cpp; } handle_ret;
|
union { bgfx_uniform_handle_t c; bgfx::UniformHandle cpp; } handle_ret;
|
||||||
handle_ret.cpp = bgfx::createUniform(_name, (bgfx::UniformType::Enum)_type, _num);
|
handle_ret.cpp = bgfx::createUniform(_name, (bgfx::UniformType::Enum)_type, _num);
|
||||||
@ -562,7 +542,7 @@ BGFX_C_API bgfx_occlusion_query_handle_t bgfx_create_occlusion_query()
|
|||||||
return handle_ret.c;
|
return handle_ret.c;
|
||||||
}
|
}
|
||||||
|
|
||||||
BGFX_C_API bgfx_occlusion_query_result_t bgfx_get_result(bgfx_occlusion_query_handle_t _handle, int32_t * _result)
|
BGFX_C_API bgfx_occlusion_query_result_t bgfx_get_result(bgfx_occlusion_query_handle_t _handle, int32_t* _result)
|
||||||
{
|
{
|
||||||
union { bgfx_occlusion_query_handle_t c; bgfx::OcclusionQueryHandle cpp; } handle = { _handle };
|
union { bgfx_occlusion_query_handle_t c; bgfx::OcclusionQueryHandle cpp; } handle = { _handle };
|
||||||
return (bgfx_occlusion_query_result_t)bgfx::getResult(handle.cpp, _result);
|
return (bgfx_occlusion_query_result_t)bgfx::getResult(handle.cpp, _result);
|
||||||
@ -574,12 +554,17 @@ BGFX_C_API void bgfx_destroy_occlusion_query(bgfx_occlusion_query_handle_t _hand
|
|||||||
bgfx::destroy(handle.cpp);
|
bgfx::destroy(handle.cpp);
|
||||||
}
|
}
|
||||||
|
|
||||||
BGFX_C_API void bgfx_set_palette_color(uint8_t _index, const float * _rgba)
|
BGFX_C_API void bgfx_set_palette_color(uint8_t _index, const float _rgba[4])
|
||||||
{
|
{
|
||||||
bgfx::setPaletteColor(_index, _rgba);
|
bgfx::setPaletteColor(_index, _rgba);
|
||||||
}
|
}
|
||||||
|
|
||||||
BGFX_C_API void bgfx_set_view_name(bgfx_view_id_t _id, const char * _name)
|
BGFX_C_API void bgfx_set_palette_color_rgba8(uint8_t _index, uint32_t _rgba)
|
||||||
|
{
|
||||||
|
bgfx::setPaletteColor(_index, _rgba);
|
||||||
|
}
|
||||||
|
|
||||||
|
BGFX_C_API void bgfx_set_view_name(bgfx_view_id_t _id, const char* _name)
|
||||||
{
|
{
|
||||||
bgfx::setViewName((bgfx::ViewId)_id, _name);
|
bgfx::setViewName((bgfx::ViewId)_id, _name);
|
||||||
}
|
}
|
||||||
@ -620,27 +605,27 @@ BGFX_C_API void bgfx_set_view_frame_buffer(bgfx_view_id_t _id, bgfx_frame_buffer
|
|||||||
bgfx::setViewFrameBuffer((bgfx::ViewId)_id, handle.cpp);
|
bgfx::setViewFrameBuffer((bgfx::ViewId)_id, handle.cpp);
|
||||||
}
|
}
|
||||||
|
|
||||||
BGFX_C_API void bgfx_set_view_transform(bgfx_view_id_t _id, const void * _view, const void * _proj)
|
BGFX_C_API void bgfx_set_view_transform(bgfx_view_id_t _id, const void* _view, const void* _proj)
|
||||||
{
|
{
|
||||||
bgfx::setViewTransform((bgfx::ViewId)_id, _view, _proj);
|
bgfx::setViewTransform((bgfx::ViewId)_id, _view, _proj);
|
||||||
}
|
}
|
||||||
|
|
||||||
BGFX_C_API void bgfx_set_view_order(bgfx_view_id_t _id, uint16_t _num, const bgfx_view_id_t * _order)
|
BGFX_C_API void bgfx_set_view_order(bgfx_view_id_t _id, uint16_t _num, const bgfx_view_id_t* _order)
|
||||||
{
|
{
|
||||||
bgfx::setViewOrder((bgfx::ViewId)_id, _num, (const bgfx::ViewId *)_order);
|
bgfx::setViewOrder((bgfx::ViewId)_id, _num, (const bgfx::ViewId*)_order);
|
||||||
}
|
}
|
||||||
|
|
||||||
BGFX_C_API bgfx_encoder_t * bgfx_encoder_begin(bool _forThread)
|
BGFX_C_API bgfx_encoder_t* bgfx_encoder_begin(bool _forThread)
|
||||||
{
|
{
|
||||||
return (bgfx_encoder_t *)bgfx::begin(_forThread);
|
return (bgfx_encoder_t*)bgfx::begin(_forThread);
|
||||||
}
|
}
|
||||||
|
|
||||||
BGFX_C_API void bgfx_encoder_end(bgfx_encoder_t * _encoder)
|
BGFX_C_API void bgfx_encoder_end(bgfx_encoder_t* _encoder)
|
||||||
{
|
{
|
||||||
bgfx::end((bgfx::Encoder *)_encoder);
|
bgfx::end((bgfx::Encoder*)_encoder);
|
||||||
}
|
}
|
||||||
|
|
||||||
BGFX_C_API void bgfx_encoder_set_marker(bgfx_encoder_t* _this, const char * _marker)
|
BGFX_C_API void bgfx_encoder_set_marker(bgfx_encoder_t* _this, const char* _marker)
|
||||||
{
|
{
|
||||||
bgfx::Encoder* This = (bgfx::Encoder*)_this;
|
bgfx::Encoder* This = (bgfx::Encoder*)_this;
|
||||||
This->setMarker(_marker);
|
This->setMarker(_marker);
|
||||||
@ -677,7 +662,7 @@ BGFX_C_API void bgfx_encoder_set_scissor_cached(bgfx_encoder_t* _this, uint16_t
|
|||||||
This->setScissor(_cache);
|
This->setScissor(_cache);
|
||||||
}
|
}
|
||||||
|
|
||||||
BGFX_C_API uint32_t bgfx_encoder_set_transform(bgfx_encoder_t* _this, const void * _mtx, uint16_t _num)
|
BGFX_C_API uint32_t bgfx_encoder_set_transform(bgfx_encoder_t* _this, const void* _mtx, uint16_t _num)
|
||||||
{
|
{
|
||||||
bgfx::Encoder* This = (bgfx::Encoder*)_this;
|
bgfx::Encoder* This = (bgfx::Encoder*)_this;
|
||||||
return This->setTransform(_mtx, _num);
|
return This->setTransform(_mtx, _num);
|
||||||
@ -689,13 +674,13 @@ BGFX_C_API void bgfx_encoder_set_transform_cached(bgfx_encoder_t* _this, uint32_
|
|||||||
This->setTransform(_cache, _num);
|
This->setTransform(_cache, _num);
|
||||||
}
|
}
|
||||||
|
|
||||||
BGFX_C_API uint32_t bgfx_encoder_alloc_transform(bgfx_encoder_t* _this, bgfx_transform_t * _transform, uint16_t _num)
|
BGFX_C_API uint32_t bgfx_encoder_alloc_transform(bgfx_encoder_t* _this, bgfx_transform_t* _transform, uint16_t _num)
|
||||||
{
|
{
|
||||||
bgfx::Encoder* This = (bgfx::Encoder*)_this;
|
bgfx::Encoder* This = (bgfx::Encoder*)_this;
|
||||||
return This->allocTransform((bgfx::Transform *)_transform, _num);
|
return This->allocTransform((bgfx::Transform*)_transform, _num);
|
||||||
}
|
}
|
||||||
|
|
||||||
BGFX_C_API void bgfx_encoder_set_uniform(bgfx_encoder_t* _this, bgfx_uniform_handle_t _handle, const void * _value, uint16_t _num)
|
BGFX_C_API void bgfx_encoder_set_uniform(bgfx_encoder_t* _this, bgfx_uniform_handle_t _handle, const void* _value, uint16_t _num)
|
||||||
{
|
{
|
||||||
bgfx::Encoder* This = (bgfx::Encoder*)_this;
|
bgfx::Encoder* This = (bgfx::Encoder*)_this;
|
||||||
union { bgfx_uniform_handle_t c; bgfx::UniformHandle cpp; } handle = { _handle };
|
union { bgfx_uniform_handle_t c; bgfx::UniformHandle cpp; } handle = { _handle };
|
||||||
@ -716,10 +701,10 @@ BGFX_C_API void bgfx_encoder_set_dynamic_index_buffer(bgfx_encoder_t* _this, bgf
|
|||||||
This->setIndexBuffer(handle.cpp, _firstIndex, _numIndices);
|
This->setIndexBuffer(handle.cpp, _firstIndex, _numIndices);
|
||||||
}
|
}
|
||||||
|
|
||||||
BGFX_C_API void bgfx_encoder_set_transient_index_buffer(bgfx_encoder_t* _this, const bgfx_transient_index_buffer_t * _tib, uint32_t _firstIndex, uint32_t _numIndices)
|
BGFX_C_API void bgfx_encoder_set_transient_index_buffer(bgfx_encoder_t* _this, const bgfx_transient_index_buffer_t* _tib, uint32_t _firstIndex, uint32_t _numIndices)
|
||||||
{
|
{
|
||||||
bgfx::Encoder* This = (bgfx::Encoder*)_this;
|
bgfx::Encoder* This = (bgfx::Encoder*)_this;
|
||||||
This->setIndexBuffer((const bgfx::TransientIndexBuffer *)_tib, _firstIndex, _numIndices);
|
This->setIndexBuffer((const bgfx::TransientIndexBuffer*)_tib, _firstIndex, _numIndices);
|
||||||
}
|
}
|
||||||
|
|
||||||
BGFX_C_API void bgfx_encoder_set_vertex_buffer(bgfx_encoder_t* _this, uint8_t _stream, bgfx_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _numVertices)
|
BGFX_C_API void bgfx_encoder_set_vertex_buffer(bgfx_encoder_t* _this, uint8_t _stream, bgfx_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _numVertices)
|
||||||
@ -736,10 +721,10 @@ BGFX_C_API void bgfx_encoder_set_dynamic_vertex_buffer(bgfx_encoder_t* _this, ui
|
|||||||
This->setVertexBuffer(_stream, handle.cpp, _startVertex, _numVertices);
|
This->setVertexBuffer(_stream, handle.cpp, _startVertex, _numVertices);
|
||||||
}
|
}
|
||||||
|
|
||||||
BGFX_C_API void bgfx_encoder_set_transient_vertex_buffer(bgfx_encoder_t* _this, uint8_t _stream, const bgfx_transient_vertex_buffer_t * _tvb, uint32_t _startVertex, uint32_t _numVertices)
|
BGFX_C_API void bgfx_encoder_set_transient_vertex_buffer(bgfx_encoder_t* _this, uint8_t _stream, const bgfx_transient_vertex_buffer_t* _tvb, uint32_t _startVertex, uint32_t _numVertices)
|
||||||
{
|
{
|
||||||
bgfx::Encoder* This = (bgfx::Encoder*)_this;
|
bgfx::Encoder* This = (bgfx::Encoder*)_this;
|
||||||
This->setVertexBuffer(_stream, (const bgfx::TransientVertexBuffer *)_tvb, _startVertex, _numVertices);
|
This->setVertexBuffer(_stream, (const bgfx::TransientVertexBuffer*)_tvb, _startVertex, _numVertices);
|
||||||
}
|
}
|
||||||
|
|
||||||
BGFX_C_API void bgfx_encoder_set_vertex_count(bgfx_encoder_t* _this, uint32_t _numVertices)
|
BGFX_C_API void bgfx_encoder_set_vertex_count(bgfx_encoder_t* _this, uint32_t _numVertices)
|
||||||
@ -748,10 +733,10 @@ BGFX_C_API void bgfx_encoder_set_vertex_count(bgfx_encoder_t* _this, uint32_t _n
|
|||||||
This->setVertexCount(_numVertices);
|
This->setVertexCount(_numVertices);
|
||||||
}
|
}
|
||||||
|
|
||||||
BGFX_C_API void bgfx_encoder_set_instance_data_buffer(bgfx_encoder_t* _this, const bgfx_instance_data_buffer_t * _idb, uint32_t _start, uint32_t _num)
|
BGFX_C_API void bgfx_encoder_set_instance_data_buffer(bgfx_encoder_t* _this, const bgfx_instance_data_buffer_t* _idb, uint32_t _start, uint32_t _num)
|
||||||
{
|
{
|
||||||
bgfx::Encoder* This = (bgfx::Encoder*)_this;
|
bgfx::Encoder* This = (bgfx::Encoder*)_this;
|
||||||
This->setInstanceDataBuffer((const bgfx::InstanceDataBuffer *)_idb, _start, _num);
|
This->setInstanceDataBuffer((const bgfx::InstanceDataBuffer*)_idb, _start, _num);
|
||||||
}
|
}
|
||||||
|
|
||||||
BGFX_C_API void bgfx_encoder_set_instance_data_from_vertex_buffer(bgfx_encoder_t* _this, bgfx_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _num)
|
BGFX_C_API void bgfx_encoder_set_instance_data_from_vertex_buffer(bgfx_encoder_t* _this, bgfx_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _num)
|
||||||
@ -882,7 +867,7 @@ BGFX_C_API void bgfx_encoder_blit(bgfx_encoder_t* _this, bgfx_view_id_t _id, bgf
|
|||||||
This->blit((bgfx::ViewId)_id, dst.cpp, _dstMip, _dstX, _dstY, _dstZ, src.cpp, _srcMip, _srcX, _srcY, _srcZ, _width, _height, _depth);
|
This->blit((bgfx::ViewId)_id, dst.cpp, _dstMip, _dstX, _dstY, _dstZ, src.cpp, _srcMip, _srcX, _srcY, _srcZ, _width, _height, _depth);
|
||||||
}
|
}
|
||||||
|
|
||||||
BGFX_C_API void bgfx_request_screen_shot(bgfx_frame_buffer_handle_t _handle, const char * _filePath)
|
BGFX_C_API void bgfx_request_screen_shot(bgfx_frame_buffer_handle_t _handle, const char* _filePath)
|
||||||
{
|
{
|
||||||
union { bgfx_frame_buffer_handle_t c; bgfx::FrameBufferHandle cpp; } handle = { _handle };
|
union { bgfx_frame_buffer_handle_t c; bgfx::FrameBufferHandle cpp; } handle = { _handle };
|
||||||
bgfx::requestScreenShot(handle.cpp, _filePath);
|
bgfx::requestScreenShot(handle.cpp, _filePath);
|
||||||
@ -899,9 +884,9 @@ BGFX_C_API void bgfx_set_platform_data(const bgfx_platform_data_t * _data)
|
|||||||
bgfx::setPlatformData(data);
|
bgfx::setPlatformData(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
BGFX_C_API const bgfx_internal_data_t * bgfx_get_internal_data()
|
BGFX_C_API const bgfx_internal_data_t* bgfx_get_internal_data()
|
||||||
{
|
{
|
||||||
return (const bgfx_internal_data_t *)bgfx::getInternalData();
|
return (const bgfx_internal_data_t*)bgfx::getInternalData();
|
||||||
}
|
}
|
||||||
|
|
||||||
BGFX_C_API uintptr_t bgfx_override_internal_texture_ptr(bgfx_texture_handle_t _handle, uintptr_t _ptr)
|
BGFX_C_API uintptr_t bgfx_override_internal_texture_ptr(bgfx_texture_handle_t _handle, uintptr_t _ptr)
|
||||||
@ -910,13 +895,13 @@ BGFX_C_API uintptr_t bgfx_override_internal_texture_ptr(bgfx_texture_handle_t _h
|
|||||||
return bgfx::overrideInternal(handle.cpp, _ptr);
|
return bgfx::overrideInternal(handle.cpp, _ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
BGFX_C_API uintptr_t bgfx_override_internal_texture(bgfx_texture_handle_t _handle, uint16_t _width, uint16_t _height, uint8_t _numMips, bgfx_texture_format_t _format, uint32_t _flags)
|
BGFX_C_API uintptr_t bgfx_override_internal_texture(bgfx_texture_handle_t _handle, uint16_t _width, uint16_t _height, uint8_t _numMips, bgfx_texture_format_t _format, uint64_t _flags)
|
||||||
{
|
{
|
||||||
union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } handle = { _handle };
|
union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } handle = { _handle };
|
||||||
return bgfx::overrideInternal(handle.cpp, _width, _height, _numMips, (bgfx::TextureFormat::Enum)_format, _flags);
|
return bgfx::overrideInternal(handle.cpp, _width, _height, _numMips, (bgfx::TextureFormat::Enum)_format, _flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
BGFX_C_API void bgfx_set_marker(const char * _marker)
|
BGFX_C_API void bgfx_set_marker(const char* _marker)
|
||||||
{
|
{
|
||||||
bgfx::setMarker(_marker);
|
bgfx::setMarker(_marker);
|
||||||
}
|
}
|
||||||
@ -947,7 +932,7 @@ BGFX_C_API void bgfx_set_scissor_cached(uint16_t _cache)
|
|||||||
bgfx::setScissor(_cache);
|
bgfx::setScissor(_cache);
|
||||||
}
|
}
|
||||||
|
|
||||||
BGFX_C_API uint32_t bgfx_set_transform(const void * _mtx, uint16_t _num)
|
BGFX_C_API uint32_t bgfx_set_transform(const void* _mtx, uint16_t _num)
|
||||||
{
|
{
|
||||||
return bgfx::setTransform(_mtx, _num);
|
return bgfx::setTransform(_mtx, _num);
|
||||||
}
|
}
|
||||||
@ -957,12 +942,12 @@ BGFX_C_API void bgfx_set_transform_cached(uint32_t _cache, uint16_t _num)
|
|||||||
bgfx::setTransform(_cache, _num);
|
bgfx::setTransform(_cache, _num);
|
||||||
}
|
}
|
||||||
|
|
||||||
BGFX_C_API uint32_t bgfx_alloc_transform(bgfx_transform_t * _transform, uint16_t _num)
|
BGFX_C_API uint32_t bgfx_alloc_transform(bgfx_transform_t* _transform, uint16_t _num)
|
||||||
{
|
{
|
||||||
return bgfx::allocTransform((bgfx::Transform *)_transform, _num);
|
return bgfx::allocTransform((bgfx::Transform*)_transform, _num);
|
||||||
}
|
}
|
||||||
|
|
||||||
BGFX_C_API void bgfx_set_uniform(bgfx_uniform_handle_t _handle, const void * _value, uint16_t _num)
|
BGFX_C_API void bgfx_set_uniform(bgfx_uniform_handle_t _handle, const void* _value, uint16_t _num)
|
||||||
{
|
{
|
||||||
union { bgfx_uniform_handle_t c; bgfx::UniformHandle cpp; } handle = { _handle };
|
union { bgfx_uniform_handle_t c; bgfx::UniformHandle cpp; } handle = { _handle };
|
||||||
bgfx::setUniform(handle.cpp, _value, _num);
|
bgfx::setUniform(handle.cpp, _value, _num);
|
||||||
@ -980,9 +965,9 @@ BGFX_C_API void bgfx_set_dynamic_index_buffer(bgfx_dynamic_index_buffer_handle_t
|
|||||||
bgfx::setIndexBuffer(handle.cpp, _firstIndex, _numIndices);
|
bgfx::setIndexBuffer(handle.cpp, _firstIndex, _numIndices);
|
||||||
}
|
}
|
||||||
|
|
||||||
BGFX_C_API void bgfx_set_transient_index_buffer(const bgfx_transient_index_buffer_t * _tib, uint32_t _firstIndex, uint32_t _numIndices)
|
BGFX_C_API void bgfx_set_transient_index_buffer(const bgfx_transient_index_buffer_t* _tib, uint32_t _firstIndex, uint32_t _numIndices)
|
||||||
{
|
{
|
||||||
bgfx::setIndexBuffer((const bgfx::TransientIndexBuffer *)_tib, _firstIndex, _numIndices);
|
bgfx::setIndexBuffer((const bgfx::TransientIndexBuffer*)_tib, _firstIndex, _numIndices);
|
||||||
}
|
}
|
||||||
|
|
||||||
BGFX_C_API void bgfx_set_vertex_buffer(uint8_t _stream, bgfx_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _numVertices)
|
BGFX_C_API void bgfx_set_vertex_buffer(uint8_t _stream, bgfx_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _numVertices)
|
||||||
@ -997,9 +982,9 @@ BGFX_C_API void bgfx_set_dynamic_vertex_buffer(uint8_t _stream, bgfx_dynamic_ver
|
|||||||
bgfx::setVertexBuffer(_stream, handle.cpp, _startVertex, _numVertices);
|
bgfx::setVertexBuffer(_stream, handle.cpp, _startVertex, _numVertices);
|
||||||
}
|
}
|
||||||
|
|
||||||
BGFX_C_API void bgfx_set_transient_vertex_buffer(uint8_t _stream, const bgfx_transient_vertex_buffer_t * _tvb, uint32_t _startVertex, uint32_t _numVertices)
|
BGFX_C_API void bgfx_set_transient_vertex_buffer(uint8_t _stream, const bgfx_transient_vertex_buffer_t* _tvb, uint32_t _startVertex, uint32_t _numVertices)
|
||||||
{
|
{
|
||||||
bgfx::setVertexBuffer(_stream, (const bgfx::TransientVertexBuffer *)_tvb, _startVertex, _numVertices);
|
bgfx::setVertexBuffer(_stream, (const bgfx::TransientVertexBuffer*)_tvb, _startVertex, _numVertices);
|
||||||
}
|
}
|
||||||
|
|
||||||
BGFX_C_API void bgfx_set_vertex_count(uint32_t _numVertices)
|
BGFX_C_API void bgfx_set_vertex_count(uint32_t _numVertices)
|
||||||
@ -1007,9 +992,9 @@ BGFX_C_API void bgfx_set_vertex_count(uint32_t _numVertices)
|
|||||||
bgfx::setVertexCount(_numVertices);
|
bgfx::setVertexCount(_numVertices);
|
||||||
}
|
}
|
||||||
|
|
||||||
BGFX_C_API void bgfx_set_instance_data_buffer(const bgfx_instance_data_buffer_t * _idb, uint32_t _start, uint32_t _num)
|
BGFX_C_API void bgfx_set_instance_data_buffer(const bgfx_instance_data_buffer_t* _idb, uint32_t _start, uint32_t _num)
|
||||||
{
|
{
|
||||||
bgfx::setInstanceDataBuffer((const bgfx::InstanceDataBuffer *)_idb, _start, _num);
|
bgfx::setInstanceDataBuffer((const bgfx::InstanceDataBuffer*)_idb, _start, _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_vertex_buffer(bgfx_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _num)
|
||||||
@ -1122,6 +1107,39 @@ BGFX_C_API void bgfx_blit(bgfx_view_id_t _id, bgfx_texture_handle_t _dst, uint8_
|
|||||||
bgfx::blit((bgfx::ViewId)_id, dst.cpp, _dstMip, _dstX, _dstY, _dstZ, src.cpp, _srcMip, _srcX, _srcY, _srcZ, _width, _height, _depth);
|
bgfx::blit((bgfx::ViewId)_id, dst.cpp, _dstMip, _dstX, _dstY, _dstZ, src.cpp, _srcMip, _srcX, _srcY, _srcZ, _width, _height, _depth);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* user define functions */
|
||||||
|
BGFX_C_API void bgfx_init_ctor(bgfx_init_t* _init)
|
||||||
|
{
|
||||||
|
BX_PLACEMENT_NEW(_init, bgfx::Init);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
BGFX_C_API bool bgfx_init(const bgfx_init_t * _init)
|
||||||
|
{
|
||||||
|
bgfx_init_t init =*_init;
|
||||||
|
|
||||||
|
if (init.callback != NULL)
|
||||||
|
{
|
||||||
|
static bgfx::CallbackC99 s_callback;
|
||||||
|
s_callback.m_interface = init.callback;
|
||||||
|
init.callback = reinterpret_cast<bgfx_callback_interface_t*>(&s_callback);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (init.allocator != NULL)
|
||||||
|
{
|
||||||
|
static bgfx::AllocatorC99 s_allocator;
|
||||||
|
s_allocator.m_interface = init.allocator;
|
||||||
|
init.allocator = reinterpret_cast<bgfx_allocator_interface_t*>(&s_allocator);
|
||||||
|
}
|
||||||
|
|
||||||
|
union { const bgfx_init_t* c; const bgfx::Init* cpp; } in;
|
||||||
|
in.c = &init;
|
||||||
|
|
||||||
|
return bgfx::init(*in.cpp);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**/
|
/**/
|
||||||
BGFX_C_API bgfx_interface_vtbl_t* bgfx_get_interface(uint32_t _version)
|
BGFX_C_API bgfx_interface_vtbl_t* bgfx_get_interface(uint32_t _version)
|
||||||
{
|
{
|
||||||
@ -1129,6 +1147,7 @@ BGFX_C_API bgfx_interface_vtbl_t* bgfx_get_interface(uint32_t _version)
|
|||||||
{
|
{
|
||||||
static bgfx_interface_vtbl_t s_bgfx_interface =
|
static bgfx_interface_vtbl_t s_bgfx_interface =
|
||||||
{
|
{
|
||||||
|
bgfx_attachment_init,
|
||||||
bgfx_vertex_decl_begin,
|
bgfx_vertex_decl_begin,
|
||||||
bgfx_vertex_decl_add,
|
bgfx_vertex_decl_add,
|
||||||
bgfx_vertex_decl_decode,
|
bgfx_vertex_decl_decode,
|
||||||
@ -1219,6 +1238,7 @@ BGFX_C_API bgfx_interface_vtbl_t* bgfx_get_interface(uint32_t _version)
|
|||||||
bgfx_get_result,
|
bgfx_get_result,
|
||||||
bgfx_destroy_occlusion_query,
|
bgfx_destroy_occlusion_query,
|
||||||
bgfx_set_palette_color,
|
bgfx_set_palette_color,
|
||||||
|
bgfx_set_palette_color_rgba8,
|
||||||
bgfx_set_view_name,
|
bgfx_set_view_name,
|
||||||
bgfx_set_view_rect,
|
bgfx_set_view_rect,
|
||||||
bgfx_set_view_rect_ratio,
|
bgfx_set_view_rect_ratio,
|
||||||
|
Loading…
Reference in New Issue
Block a user