From f4e23fa80b8f36dcd5635da9aa452286a8ac7060 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=91=D1=80=D0=B0=D0=BD=D0=B8=D0=BC=D0=B8=D1=80=20=D0=9A?= =?UTF-8?q?=D0=B0=D1=80=D0=B0=D1=9F=D0=B8=D1=9B?= Date: Tue, 14 May 2019 21:32:36 -0700 Subject: [PATCH] Fixed IDL to match PR #1767. --- include/bgfx/c99/bgfx.h | 28 ++++++++++++++-------------- scripts/codegen.lua | 7 ++++++- src/bgfx.idl.inl | 14 +++++++------- 3 files changed, 27 insertions(+), 22 deletions(-) diff --git a/include/bgfx/c99/bgfx.h b/include/bgfx/c99/bgfx.h index d30a7d7cc..877dd7e64 100644 --- a/include/bgfx/c99/bgfx.h +++ b/include/bgfx/c99/bgfx.h @@ -1068,7 +1068,7 @@ BGFX_C_API bool bgfx_init(const bgfx_init_t * _init); * Shutdown bgfx library. * */ -BGFX_C_API void bgfx_shutdown(); +BGFX_C_API void bgfx_shutdown(void); /** * Reset graphic settings and back-buffer size. @@ -1114,7 +1114,7 @@ BGFX_C_API uint32_t bgfx_frame(bool _capture); * Library must be initialized. * */ -BGFX_C_API bgfx_renderer_type_t bgfx_get_renderer_type(); +BGFX_C_API bgfx_renderer_type_t bgfx_get_renderer_type(void); /** * Returns renderer capabilities. @@ -1122,14 +1122,14 @@ BGFX_C_API bgfx_renderer_type_t bgfx_get_renderer_type(); * Library must be initialized. * */ -BGFX_C_API const bgfx_caps_t* bgfx_get_caps(); +BGFX_C_API const bgfx_caps_t* bgfx_get_caps(void); /** * Returns performance counters. * @attention Pointer returned is valid until `bgfx::frame` is called. * */ -BGFX_C_API const bgfx_stats_t* bgfx_get_stats(); +BGFX_C_API const bgfx_stats_t* bgfx_get_stats(void); /** * Allocate buffer to pass to bgfx calls. Data will be freed inside bgfx. @@ -2078,7 +2078,7 @@ BGFX_C_API void bgfx_destroy_uniform(bgfx_uniform_handle_t _handle); * Create occlusion query. * */ -BGFX_C_API bgfx_occlusion_query_handle_t bgfx_create_occlusion_query(); +BGFX_C_API bgfx_occlusion_query_handle_t bgfx_create_occlusion_query(void); /** * Retrieve occlusion query result from previous frame. @@ -2744,7 +2744,7 @@ BGFX_C_API void bgfx_set_platform_data(const bgfx_platform_data_t * _data); * @warning Must be called only on render thread. * */ -BGFX_C_API const bgfx_internal_data_t* bgfx_get_internal_data(); +BGFX_C_API const bgfx_internal_data_t* bgfx_get_internal_data(void); /** * Override internal texture with externally created texture. Previously @@ -3195,7 +3195,7 @@ BGFX_C_API void bgfx_dispatch_indirect(bgfx_view_id_t _id, bgfx_program_handle_t * Discard all previously set state for draw or compute call. * */ -BGFX_C_API void bgfx_discard(); +BGFX_C_API void bgfx_discard(void); /** * Blit 2D texture region between two 2D textures. @@ -3437,12 +3437,12 @@ struct bgfx_interface_vtbl 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 (*shutdown)(void); 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)(); + bgfx_renderer_type_t (*get_renderer_type)(void); + const bgfx_caps_t* (*get_caps)(void); + const bgfx_stats_t* (*get_stats)(void); 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); @@ -3509,7 +3509,7 @@ struct bgfx_interface_vtbl 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_handle_t (*create_occlusion_query)(void); 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[4]); @@ -3565,7 +3565,7 @@ struct bgfx_interface_vtbl 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)(); + const bgfx_internal_data_t* (*get_internal_data)(void); 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, uint64_t _flags); void (*set_marker)(const char* _marker); @@ -3602,7 +3602,7 @@ struct bgfx_interface_vtbl 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 (*discard)(void); 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); }; diff --git a/scripts/codegen.lua b/scripts/codegen.lua index e18955316..a54901617 100644 --- a/scripts/codegen.lua +++ b/scripts/codegen.lua @@ -440,6 +440,11 @@ local function codetemp(func) callfunc_c2c = func.cname end + outCargs = table.concat(cargs, ", ") + if outCargs == "" then + outCargs = "void" + end + return { RET = func.ret.fulltype, CRET = func.ret.ctype, @@ -447,7 +452,7 @@ local function codetemp(func) CFUNCNAMEUPPER = func.cname:upper(), CFUNCNAMECAML = underscorecase_to_camelcase(func.cname), FUNCNAME = func.name, - CARGS = table.concat(cargs, ", "), + CARGS = outCargs, CPPARGS = table.concat(args, ", "), ARGS = ARGS, CONVERSION = lines(conversion), diff --git a/src/bgfx.idl.inl b/src/bgfx.idl.inl index 33358b326..2ce7fa69a 100644 --- a/src/bgfx.idl.inl +++ b/src/bgfx.idl.inl @@ -140,7 +140,7 @@ BGFX_C_API const char* bgfx_get_renderer_name(bgfx_renderer_type_t _type) /* BGFX_C_API bool bgfx_init(const bgfx_init_t * _init) */ -BGFX_C_API void bgfx_shutdown() +BGFX_C_API void bgfx_shutdown(void) { bgfx::shutdown(); } @@ -155,17 +155,17 @@ BGFX_C_API uint32_t bgfx_frame(bool _capture) return bgfx::frame(_capture); } -BGFX_C_API bgfx_renderer_type_t bgfx_get_renderer_type() +BGFX_C_API bgfx_renderer_type_t bgfx_get_renderer_type(void) { 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(void) { 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(void) { return (const bgfx_stats_t*)bgfx::getStats(); } @@ -587,7 +587,7 @@ BGFX_C_API void bgfx_destroy_uniform(bgfx_uniform_handle_t _handle) bgfx::destroy(handle.cpp); } -BGFX_C_API bgfx_occlusion_query_handle_t bgfx_create_occlusion_query() +BGFX_C_API bgfx_occlusion_query_handle_t bgfx_create_occlusion_query(void) { union { bgfx_occlusion_query_handle_t c; bgfx::OcclusionQueryHandle cpp; } handle_ret; handle_ret.cpp = bgfx::createOcclusionQuery(); @@ -939,7 +939,7 @@ BGFX_C_API void bgfx_set_platform_data(const bgfx_platform_data_t * _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(void) { return (const bgfx_internal_data_t*)bgfx::getInternalData(); } @@ -1150,7 +1150,7 @@ BGFX_C_API void bgfx_dispatch_indirect(bgfx_view_id_t _id, bgfx_program_handle_t bgfx::dispatch((bgfx::ViewId)_id, program.cpp, indirectHandle.cpp, _start, _num); } -BGFX_C_API void bgfx_discard() +BGFX_C_API void bgfx_discard(void) { bgfx::discard(); }