Updated IDL.

This commit is contained in:
Бранимир Караџић 2019-07-14 21:19:46 -07:00
parent 578d595a3b
commit d5fcbf98cf
6 changed files with 56 additions and 63 deletions

View File

@ -538,7 +538,8 @@ public static partial class bgfx
Wireframe = 0x00000001, Wireframe = 0x00000001,
/// <summary> /// <summary>
/// Enable infinitely fast hardware test. No draw calls will be submitted to driver. Its useful when profiling to quickly assess bottleneck between CPU and GPU. /// Enable infinitely fast hardware test. No draw calls will be submitted to driver.
/// It's useful when profiling to quickly assess bottleneck between CPU and GPU.
/// </summary> /// </summary>
Ifh = 0x00000002, Ifh = 0x00000002,
@ -917,7 +918,8 @@ public static partial class bgfx
FlushAfterRender = 0x00002000, FlushAfterRender = 0x00002000,
/// <summary> /// <summary>
/// This flag specifies where flip occurs. Default behavior is that flip occurs before rendering new frame. This flag only has effect when `BGFX_CONFIG_MULTITHREADED=0`. /// This flag specifies where flip occurs. Default behavior is that flip occurs
/// before rendering new frame. This flag only has effect when `BGFX_CONFIG_MULTITHREADED=0`.
/// </summary> /// </summary>
FlipAfterRender = 0x00004000, FlipAfterRender = 0x00004000,

View File

@ -245,7 +245,9 @@
#define BGFX_DEBUG_NONE UINT32_C(0x00000000) //!< No debug. #define BGFX_DEBUG_NONE UINT32_C(0x00000000) //!< No debug.
#define BGFX_DEBUG_WIREFRAME UINT32_C(0x00000001) //!< Enable wireframe for all primitives. #define BGFX_DEBUG_WIREFRAME UINT32_C(0x00000001) //!< Enable wireframe for all primitives.
#define BGFX_DEBUG_IFH UINT32_C(0x00000002) //!< Enable infinitely fast hardware test. No draw calls will be submitted to driver. Its useful when profiling to quickly assess bottleneck between CPU and GPU. /// Enable infinitely fast hardware test. No draw calls will be submitted to driver.
/// It's useful when profiling to quickly assess bottleneck between CPU and GPU.
#define BGFX_DEBUG_IFH UINT32_C(0x00000002)
#define BGFX_DEBUG_STATS UINT32_C(0x00000004) //!< Enable statistics display. #define BGFX_DEBUG_STATS UINT32_C(0x00000004) //!< Enable statistics display.
#define BGFX_DEBUG_TEXT UINT32_C(0x00000008) //!< Enable debug text display. #define BGFX_DEBUG_TEXT UINT32_C(0x00000008) //!< Enable debug text display.
#define BGFX_DEBUG_PROFILER UINT32_C(0x00000010) //!< Enable profiler. #define BGFX_DEBUG_PROFILER UINT32_C(0x00000010) //!< Enable profiler.
@ -417,7 +419,9 @@
#define BGFX_RESET_MAXANISOTROPY UINT32_C(0x00000100) //!< Turn on/off max anisotropy. #define BGFX_RESET_MAXANISOTROPY UINT32_C(0x00000100) //!< Turn on/off max anisotropy.
#define BGFX_RESET_CAPTURE UINT32_C(0x00000200) //!< Begin screen capture. #define BGFX_RESET_CAPTURE UINT32_C(0x00000200) //!< Begin screen capture.
#define BGFX_RESET_FLUSH_AFTER_RENDER UINT32_C(0x00002000) //!< Flush rendering after submitting to GPU. #define BGFX_RESET_FLUSH_AFTER_RENDER UINT32_C(0x00002000) //!< Flush rendering after submitting to GPU.
#define BGFX_RESET_FLIP_AFTER_RENDER UINT32_C(0x00004000) //!< This flag specifies where flip occurs. Default behavior is that flip occurs before rendering new frame. This flag only has effect when `BGFX_CONFIG_MULTITHREADED=0`. /// This flag specifies where flip occurs. Default behavior is that flip occurs
/// before rendering new frame. This flag only has effect when `BGFX_CONFIG_MULTITHREADED=0`.
#define BGFX_RESET_FLIP_AFTER_RENDER UINT32_C(0x00004000)
#define BGFX_RESET_SRGB_BACKBUFFER UINT32_C(0x00008000) //!< Enable sRGB backbuffer. #define BGFX_RESET_SRGB_BACKBUFFER UINT32_C(0x00008000) //!< Enable sRGB backbuffer.
#define BGFX_RESET_HDR10 UINT32_C(0x00010000) //!< Enable HDR10 rendering. #define BGFX_RESET_HDR10 UINT32_C(0x00010000) //!< Enable HDR10 rendering.
#define BGFX_RESET_HIDPI UINT32_C(0x00020000) //!< Enable HiDPI rendering. #define BGFX_RESET_HIDPI UINT32_C(0x00020000) //!< Enable HiDPI rendering.

View File

@ -202,7 +202,8 @@ flag.Clear { bits = 16 }
flag.Debug { bits = 32 } flag.Debug { bits = 32 }
.None --- No debug. .None --- No debug.
.Wireframe --- Enable wireframe for all primitives. .Wireframe --- Enable wireframe for all primitives.
.Ifh --- Enable infinitely fast hardware test. No draw calls will be submitted to driver. Its useful when profiling to quickly assess bottleneck between CPU and GPU. .Ifh --- Enable infinitely fast hardware test. No draw calls will be submitted to driver.
--- It's useful when profiling to quickly assess bottleneck between CPU and GPU.
.Stats --- Enable statistics display. .Stats --- Enable statistics display.
.Text --- Enable debug text display. .Text --- Enable debug text display.
.Profiler --- Enable profiler. .Profiler --- Enable profiler.
@ -328,7 +329,8 @@ flag.Reset { bits = 32 }
.Maxanisotropy (9) --- Turn on/off max anisotropy. .Maxanisotropy (9) --- Turn on/off max anisotropy.
.Capture (10) --- Begin screen capture. .Capture (10) --- Begin screen capture.
.FlushAfterRender (14) --- Flush rendering after submitting to GPU. .FlushAfterRender (14) --- Flush rendering after submitting to GPU.
.FlipAfterRender (15) --- This flag specifies where flip occurs. Default behavior is that flip occurs before rendering new frame. This flag only has effect when `BGFX_CONFIG_MULTITHREADED=0`. .FlipAfterRender (15) --- This flag specifies where flip occurs. Default behavior is that flip occurs
--- before rendering new frame. This flag only has effect when `BGFX_CONFIG_MULTITHREADED=0`.
.SrgbBackbuffer (16) --- Enable sRGB backbuffer. .SrgbBackbuffer (16) --- Enable sRGB backbuffer.
.Hdr10 (17) --- Enable HDR10 rendering. .Hdr10 (17) --- Enable HDR10 rendering.
.Hidpi (18) --- Enable HiDPI rendering. .Hidpi (18) --- Enable HiDPI rendering.

View File

@ -169,12 +169,9 @@ local function FlagBlock(typ)
end end
yield("\t/// <summary>") yield("\t/// <summary>")
if (type(flag.comment) == "table") then for _, comment in ipairs(flag.comment) do
comment = table.concat(flag.comment, "\n\t\t/// ") yield("\t/// " .. comment)
else
comment = flag.comment
end end
yield("\t/// " .. comment)
yield("\t/// </summary>") yield("\t/// </summary>")
end end
@ -259,7 +256,9 @@ function converter.types(typ)
end end
yield("\t/// <summary>") yield("\t/// <summary>")
yield("\t/// " .. enum.comment) for _, comment in ipairs(enum.comment) do
yield("\t/// " .. comment)
end
yield("\t/// </summary>") yield("\t/// </summary>")
end end
@ -296,18 +295,11 @@ function converter.types(typ)
end end
end end
lookup[flagName] = value lookup[flagName] = value
if flag.comment ~= nil then table.insert(flags, {
table.insert(flags, { name = flagName,
name = flagName, value = value,
value = value, comment = flag.comment,
comment = flag.comment, })
})
else
table.insert(flags, {
name = flagName,
value = value,
})
end
end end
if typ.shift then if typ.shift then
@ -381,12 +373,7 @@ function converter.funcs(func)
for _, arg in ipairs(func.args) do for _, arg in ipairs(func.args) do
if arg.comment ~= nil then if arg.comment ~= nil then
local comment = "" local comment = table.concat(arg.comment, " ")
if (type(arg.comment) == "table") then
comment = table.concat(arg.comment, " ")
else
comment = arg.comment
end
yield("/// <param name=\"" yield("/// <param name=\""
.. arg.name .. arg.name
@ -430,4 +417,9 @@ function gen.write(codes, outputfile)
out:close() out:close()
end end
if (...) == nil then
-- run `lua bindings-cs.lua` in command line
print(gen.gen())
end
return gen return gen

View File

@ -576,13 +576,9 @@ local function doxygen_funcret(r, func, prefix)
return return
end end
r[#r+1] = prefix r[#r+1] = prefix
if type(func.ret.comment) == "string" then r[#r+1] = string.format("%s @returns %s", prefix, func.ret.comment[1])
r[#r+1] = string.format("%s @returns %s", prefix, func.ret.comment) for i = 2,#func.ret.comment do
else r[#r+1] = string.format("%s %s", prefix, func.ret.comment[i])
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 end
return r return r
end end
@ -603,13 +599,9 @@ local function doxygen_func(r, func, prefix)
end end
local comment = string.format("%s @param[%s] %s", prefix, inout, arg.name) local comment = string.format("%s @param[%s] %s", prefix, inout, arg.name)
if arg.comment then if arg.comment then
if type(arg.comment) == "string" then r[#r+1] = comment .. " " .. arg.comment[1]
r[#r+1] = comment .. " " .. arg.comment for i = 2,#arg.comment do
else r[#r+1] = string.format("%s %s", prefix, arg.comment[i])
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 end
else else
r[#r+1] = comment r[#r+1] = comment
@ -681,8 +673,9 @@ function codegen.gen_enum_define(enum)
if not item.comment then if not item.comment then
text = item.name .. "," text = item.name .. ","
else else
local comment = table.concat(item.comment, " ")
text = string.format("%s,%s //!< %s", text = string.format("%s,%s //!< %s",
item.name, namealign(item.name), item.comment) item.name, namealign(item.name), comment)
end end
items[#items+1] = text items[#items+1] = text
end end
@ -713,7 +706,10 @@ function codegen.gen_enum_cdefine(enum)
local uname = cname:upper() local uname = cname:upper()
local items = {} local items = {}
for index , item in ipairs(enum.enum) do for index , item in ipairs(enum.enum) do
local comment = item.comment or "" local comment = ""
if item.comment then
comment = table.concat(item.comment, " ")
end
local ename = item.cname local ename = item.cname
if not ename then if not ename then
if enum.underscore then if enum.underscore then
@ -765,12 +761,8 @@ function codegen.gen_flag_cdefine(flag)
-- combine flags -- combine flags
if #item > 0 then if #item > 0 then
if item.comment then if item.comment then
if type(item.comment) == "table" then for _, c in ipairs(item.comment) do
for _, c in ipairs(item.comment) do s[#s+1] = "/// " .. c
s[#s+1] = "/// " .. c
end
else
s[#s+1] = "/// " .. item.comment
end end
end end
local sets = { "" } local sets = { "" }
@ -781,7 +773,13 @@ function codegen.gen_flag_cdefine(flag)
else else
local comment = "" local comment = ""
if item.comment then if item.comment then
comment = " //!< " .. item.comment if #item.comment > 1 then
for _, c in ipairs(item.comment) do
s[#s+1] = "/// " .. c
end
else
comment = " //!< " .. item.comment[1]
end
end end
value = string.format(flag.format, value) value = string.format(flag.format, value)
local code = string.format("#define %s %sUINT%d_C(0x%s)%s", local code = string.format("#define %s %sUINT%d_C(0x%s)%s",
@ -852,7 +850,7 @@ local function text_with_comments(items, item, cstyle, is_classmember)
end end
local text = string.format("%s%s %s;", typename, namealign(typename), name) local text = string.format("%s%s %s;", typename, namealign(typename), name)
if item.comment then if item.comment then
if type(item.comment) == "table" then if #item.comment > 1 then
table.insert(items, "") table.insert(items, "")
if cstyle then if cstyle then
table.insert(items, "/**") table.insert(items, "/**")
@ -868,7 +866,7 @@ local function text_with_comments(items, item, cstyle, is_classmember)
else else
text = string.format( text = string.format(
cstyle and "%s %s/** %s%s */" or "%s %s//!< %s", cstyle and "%s %s/** %s%s */" or "%s %s//!< %s",
text, namealign(text, 40), item.comment, namealign(item.comment, 40)) text, namealign(text, 40), item.comment[1], namealign(item.comment[1], 40))
end end
end end
items[#items+1] = text items[#items+1] = text

View File

@ -68,15 +68,10 @@ idl.types = all_types
local function add_comment(item, comment) local function add_comment(item, comment)
-- strip space -- strip space
comment = comment:match "(.-)%s*$" comment = comment:match "(.-)%s*$"
local last = item.comment if item.comment then
if last then table.insert(item.comment, comment)
if type(last) == "string" then
item.comment = { last, comment }
else
table.insert(item.comment, comment)
end
else else
item.comment = comment item.comment = { comment }
end end
end end