This commit is contained in:
Бранимир Караџић
2019-04-20 21:04:36 -07:00
parent 56cbbb0283
commit 4a07ab392f
5 changed files with 106 additions and 64 deletions

View File

@@ -6,25 +6,27 @@ local codegen = require "codegen"
local doxygen = require "doxygen"
local func_actions = {
c99 = "\n",
c99decl = "\n",
cppdecl = "\n",
c99 = "\n",
c99decl = "\n",
cppdecl = "\n",
interface_struct = "\n\t",
interface_import = ",\n\t\t\t",
c99_interface = "\n",
cpp_interface = "\n",
c99_functionid = "\n\t",
cpp_functionid = "\n\t\t",
c99_interface = "\n",
cpp_interface = "\n",
c99_functionid = "\n\t",
cpp_functionid = "\n\t\t",
}
local type_actions = {
enums = "\n",
cenums = "\n",
structs = "\n",
cstructs = "\n",
handles = "\n",
chandles = "\n",
funcptrs = "\n",
enums = "\n",
cenums = "\n",
structs = "\n",
cstructs = "\n",
handles = "\n",
chandles = "\n",
funcptrs = "\n",
cfuncptrs = "\n",
}

View File

@@ -217,24 +217,24 @@ local function func(sets)
end
idl.funcptr = setmetatable({}, { __index = func(all_types) })
idl.func = setmetatable({}, { __index = func(all_funcs) })
idl.funcs = all_funcs
idl.func = setmetatable({}, { __index = func(all_funcs) })
idl.funcs = all_funcs
idl.vararg = "vararg"
idl.out = "out"
idl.inout = "inout"
idl.const = "const"
idl.ctor = "ctor"
idl.cfunc = "cfunc"
idl.vararg = "vararg"
idl.out = "out"
idl.inout = "inout"
idl.const = "const"
idl.ctor = "ctor"
idl.cfunc = "cfunc"
idl.underscore = "underscore"
idl.conly = "conly"
idl.cpponly = "cpponly"
idl.shortname = "shortname"
idl.NULL = "NULL"
idl.conly = "conly"
idl.cpponly = "cpponly"
idl.shortname = "shortname"
idl.NULL = "NULL"
idl.UINT16_MAX = "UINT16_MAX"
idl.INT32_MAX = "INT32_MAX"
idl.INT32_MAX = "INT32_MAX"
idl.UINT32_MAX = "UINT32_MAX"
idl.UINT8_MAX = "UINT8_MAX"
idl.UINT8_MAX = "UINT8_MAX"
return setmetatable(idl , { __index = function (_, keyword)
error (tostring(keyword) .. " is invalid")

View File

@@ -8,6 +8,44 @@
*
*/
#define BGFX_C99_ENUM_CHECK(_enum, _c99enumcount) \
BX_STATIC_ASSERT(_enum::Count == _enum::Enum(_c99enumcount) )
BGFX_C99_ENUM_CHECK(bgfx::Fatal, BGFX_FATAL_COUNT);
BGFX_C99_ENUM_CHECK(bgfx::RendererType, BGFX_RENDERER_TYPE_COUNT);
BGFX_C99_ENUM_CHECK(bgfx::Attrib, BGFX_ATTRIB_COUNT);
BGFX_C99_ENUM_CHECK(bgfx::AttribType, BGFX_ATTRIB_TYPE_COUNT);
BGFX_C99_ENUM_CHECK(bgfx::TextureFormat, BGFX_TEXTURE_FORMAT_COUNT);
BGFX_C99_ENUM_CHECK(bgfx::UniformType, BGFX_UNIFORM_TYPE_COUNT);
BGFX_C99_ENUM_CHECK(bgfx::BackbufferRatio, BGFX_BACKBUFFER_RATIO_COUNT);
BGFX_C99_ENUM_CHECK(bgfx::OcclusionQueryResult, BGFX_OCCLUSION_QUERY_RESULT_COUNT);
BGFX_C99_ENUM_CHECK(bgfx::Topology, BGFX_TOPOLOGY_COUNT);
BGFX_C99_ENUM_CHECK(bgfx::TopologyConvert, BGFX_TOPOLOGY_CONVERT_COUNT);
BGFX_C99_ENUM_CHECK(bgfx::RenderFrame, BGFX_RENDER_FRAME_COUNT);
#undef BGFX_C99_ENUM_CHECK
#define BGFX_C99_STRUCT_SIZE_CHECK(_cppstruct, _c99struct) \
BX_STATIC_ASSERT(sizeof(_cppstruct) == sizeof(_c99struct) )
BGFX_C99_STRUCT_SIZE_CHECK(bgfx::Memory, bgfx_memory_t);
BGFX_C99_STRUCT_SIZE_CHECK(bgfx::Transform, bgfx_transform_t);
BGFX_C99_STRUCT_SIZE_CHECK(bgfx::Stats, bgfx_stats_t);
BGFX_C99_STRUCT_SIZE_CHECK(bgfx::VertexDecl, bgfx_vertex_decl_t);
BGFX_C99_STRUCT_SIZE_CHECK(bgfx::TransientIndexBuffer, bgfx_transient_index_buffer_t);
BGFX_C99_STRUCT_SIZE_CHECK(bgfx::TransientVertexBuffer, bgfx_transient_vertex_buffer_t);
BGFX_C99_STRUCT_SIZE_CHECK(bgfx::InstanceDataBuffer, bgfx_instance_data_buffer_t);
BGFX_C99_STRUCT_SIZE_CHECK(bgfx::TextureInfo, bgfx_texture_info_t);
BGFX_C99_STRUCT_SIZE_CHECK(bgfx::UniformInfo, bgfx_uniform_info_t);
BGFX_C99_STRUCT_SIZE_CHECK(bgfx::Attachment, bgfx_attachment_t);
BGFX_C99_STRUCT_SIZE_CHECK(bgfx::Caps::GPU, bgfx_caps_gpu_t);
BGFX_C99_STRUCT_SIZE_CHECK(bgfx::Caps::Limits, bgfx_caps_limits_t);
BGFX_C99_STRUCT_SIZE_CHECK(bgfx::Caps, bgfx_caps_t);
BGFX_C99_STRUCT_SIZE_CHECK(bgfx::PlatformData, bgfx_platform_data_t);
BGFX_C99_STRUCT_SIZE_CHECK(bgfx::InternalData, bgfx_internal_data_t);
#undef BGFX_C99_STRUCT_SIZE_CHECK
$c99
/* user define functions */

View File

@@ -5233,42 +5233,6 @@ BX_STATIC_ASSERT( (0
#undef FLAGS_MASK_TEST
#define BGFX_C99_ENUM_CHECK(_enum, _c99enumcount) \
BX_STATIC_ASSERT(_enum::Count == _enum::Enum(_c99enumcount) )
BGFX_C99_ENUM_CHECK(bgfx::Fatal, BGFX_FATAL_COUNT);
BGFX_C99_ENUM_CHECK(bgfx::RendererType, BGFX_RENDERER_TYPE_COUNT);
BGFX_C99_ENUM_CHECK(bgfx::Attrib, BGFX_ATTRIB_COUNT);
BGFX_C99_ENUM_CHECK(bgfx::AttribType, BGFX_ATTRIB_TYPE_COUNT);
BGFX_C99_ENUM_CHECK(bgfx::TextureFormat, BGFX_TEXTURE_FORMAT_COUNT);
BGFX_C99_ENUM_CHECK(bgfx::UniformType, BGFX_UNIFORM_TYPE_COUNT);
BGFX_C99_ENUM_CHECK(bgfx::BackbufferRatio, BGFX_BACKBUFFER_RATIO_COUNT);
BGFX_C99_ENUM_CHECK(bgfx::OcclusionQueryResult, BGFX_OCCLUSION_QUERY_RESULT_COUNT);
BGFX_C99_ENUM_CHECK(bgfx::Topology, BGFX_TOPOLOGY_COUNT);
BGFX_C99_ENUM_CHECK(bgfx::TopologyConvert, BGFX_TOPOLOGY_CONVERT_COUNT);
BGFX_C99_ENUM_CHECK(bgfx::RenderFrame, BGFX_RENDER_FRAME_COUNT);
#undef BGFX_C99_ENUM_CHECK
#define BGFX_C99_STRUCT_SIZE_CHECK(_cppstruct, _c99struct) \
BX_STATIC_ASSERT(sizeof(_cppstruct) == sizeof(_c99struct) )
BGFX_C99_STRUCT_SIZE_CHECK(bgfx::Memory, bgfx_memory_t);
BGFX_C99_STRUCT_SIZE_CHECK(bgfx::Transform, bgfx_transform_t);
BGFX_C99_STRUCT_SIZE_CHECK(bgfx::Stats, bgfx_stats_t);
BGFX_C99_STRUCT_SIZE_CHECK(bgfx::VertexDecl, bgfx_vertex_decl_t);
BGFX_C99_STRUCT_SIZE_CHECK(bgfx::TransientIndexBuffer, bgfx_transient_index_buffer_t);
BGFX_C99_STRUCT_SIZE_CHECK(bgfx::TransientVertexBuffer, bgfx_transient_vertex_buffer_t);
BGFX_C99_STRUCT_SIZE_CHECK(bgfx::InstanceDataBuffer, bgfx_instance_data_buffer_t);
BGFX_C99_STRUCT_SIZE_CHECK(bgfx::TextureInfo, bgfx_texture_info_t);
BGFX_C99_STRUCT_SIZE_CHECK(bgfx::UniformInfo, bgfx_uniform_info_t);
BGFX_C99_STRUCT_SIZE_CHECK(bgfx::Attachment, bgfx_attachment_t);
BGFX_C99_STRUCT_SIZE_CHECK(bgfx::Caps::GPU, bgfx_caps_gpu_t);
BGFX_C99_STRUCT_SIZE_CHECK(bgfx::Caps::Limits, bgfx_caps_limits_t);
BGFX_C99_STRUCT_SIZE_CHECK(bgfx::Caps, bgfx_caps_t);
BGFX_C99_STRUCT_SIZE_CHECK(bgfx::PlatformData, bgfx_platform_data_t);
BGFX_C99_STRUCT_SIZE_CHECK(bgfx::InternalData, bgfx_internal_data_t);
#undef BGFX_C99_STRUCT_SIZE_CHECK
namespace bgfx
{
struct CallbackC99 : public CallbackI

View File

@@ -8,6 +8,44 @@
*
*/
#define BGFX_C99_ENUM_CHECK(_enum, _c99enumcount) \
BX_STATIC_ASSERT(_enum::Count == _enum::Enum(_c99enumcount) )
BGFX_C99_ENUM_CHECK(bgfx::Fatal, BGFX_FATAL_COUNT);
BGFX_C99_ENUM_CHECK(bgfx::RendererType, BGFX_RENDERER_TYPE_COUNT);
BGFX_C99_ENUM_CHECK(bgfx::Attrib, BGFX_ATTRIB_COUNT);
BGFX_C99_ENUM_CHECK(bgfx::AttribType, BGFX_ATTRIB_TYPE_COUNT);
BGFX_C99_ENUM_CHECK(bgfx::TextureFormat, BGFX_TEXTURE_FORMAT_COUNT);
BGFX_C99_ENUM_CHECK(bgfx::UniformType, BGFX_UNIFORM_TYPE_COUNT);
BGFX_C99_ENUM_CHECK(bgfx::BackbufferRatio, BGFX_BACKBUFFER_RATIO_COUNT);
BGFX_C99_ENUM_CHECK(bgfx::OcclusionQueryResult, BGFX_OCCLUSION_QUERY_RESULT_COUNT);
BGFX_C99_ENUM_CHECK(bgfx::Topology, BGFX_TOPOLOGY_COUNT);
BGFX_C99_ENUM_CHECK(bgfx::TopologyConvert, BGFX_TOPOLOGY_CONVERT_COUNT);
BGFX_C99_ENUM_CHECK(bgfx::RenderFrame, BGFX_RENDER_FRAME_COUNT);
#undef BGFX_C99_ENUM_CHECK
#define BGFX_C99_STRUCT_SIZE_CHECK(_cppstruct, _c99struct) \
BX_STATIC_ASSERT(sizeof(_cppstruct) == sizeof(_c99struct) )
BGFX_C99_STRUCT_SIZE_CHECK(bgfx::Memory, bgfx_memory_t);
BGFX_C99_STRUCT_SIZE_CHECK(bgfx::Transform, bgfx_transform_t);
BGFX_C99_STRUCT_SIZE_CHECK(bgfx::Stats, bgfx_stats_t);
BGFX_C99_STRUCT_SIZE_CHECK(bgfx::VertexDecl, bgfx_vertex_decl_t);
BGFX_C99_STRUCT_SIZE_CHECK(bgfx::TransientIndexBuffer, bgfx_transient_index_buffer_t);
BGFX_C99_STRUCT_SIZE_CHECK(bgfx::TransientVertexBuffer, bgfx_transient_vertex_buffer_t);
BGFX_C99_STRUCT_SIZE_CHECK(bgfx::InstanceDataBuffer, bgfx_instance_data_buffer_t);
BGFX_C99_STRUCT_SIZE_CHECK(bgfx::TextureInfo, bgfx_texture_info_t);
BGFX_C99_STRUCT_SIZE_CHECK(bgfx::UniformInfo, bgfx_uniform_info_t);
BGFX_C99_STRUCT_SIZE_CHECK(bgfx::Attachment, bgfx_attachment_t);
BGFX_C99_STRUCT_SIZE_CHECK(bgfx::Caps::GPU, bgfx_caps_gpu_t);
BGFX_C99_STRUCT_SIZE_CHECK(bgfx::Caps::Limits, bgfx_caps_limits_t);
BGFX_C99_STRUCT_SIZE_CHECK(bgfx::Caps, bgfx_caps_t);
BGFX_C99_STRUCT_SIZE_CHECK(bgfx::PlatformData, bgfx_platform_data_t);
BGFX_C99_STRUCT_SIZE_CHECK(bgfx::InternalData, bgfx_internal_data_t);
#undef BGFX_C99_STRUCT_SIZE_CHECK
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;