From d5fcbf98cf20cd95967dd4909d4e5fa76b39cc86 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: Sun, 14 Jul 2019 21:19:46 -0700 Subject: [PATCH] Updated IDL. --- bindings/cs/bgfx.cs | 6 ++++-- include/bgfx/defines.h | 8 +++++-- scripts/bgfx.idl | 6 ++++-- scripts/bindings-cs.lua | 40 ++++++++++++++-------------------- scripts/codegen.lua | 48 ++++++++++++++++++++--------------------- scripts/idl.lua | 11 +++------- 6 files changed, 56 insertions(+), 63 deletions(-) diff --git a/bindings/cs/bgfx.cs b/bindings/cs/bgfx.cs index 32681b7e8..70ed06a0a 100644 --- a/bindings/cs/bgfx.cs +++ b/bindings/cs/bgfx.cs @@ -538,7 +538,8 @@ public static partial class bgfx Wireframe = 0x00000001, /// - /// 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. + /// 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. /// Ifh = 0x00000002, @@ -917,7 +918,8 @@ public static partial class bgfx FlushAfterRender = 0x00002000, /// - /// 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`. /// FlipAfterRender = 0x00004000, diff --git a/include/bgfx/defines.h b/include/bgfx/defines.h index 96643a7c4..390f0ce29 100644 --- a/include/bgfx/defines.h +++ b/include/bgfx/defines.h @@ -245,7 +245,9 @@ #define BGFX_DEBUG_NONE UINT32_C(0x00000000) //!< No debug. #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. It’s 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_TEXT UINT32_C(0x00000008) //!< Enable debug text display. #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_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_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_HDR10 UINT32_C(0x00010000) //!< Enable HDR10 rendering. #define BGFX_RESET_HIDPI UINT32_C(0x00020000) //!< Enable HiDPI rendering. diff --git a/scripts/bgfx.idl b/scripts/bgfx.idl index 1dcb5bc86..56d6a7784 100644 --- a/scripts/bgfx.idl +++ b/scripts/bgfx.idl @@ -202,7 +202,8 @@ flag.Clear { bits = 16 } flag.Debug { bits = 32 } .None --- No debug. .Wireframe --- Enable wireframe for all primitives. - .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. + .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. .Text --- Enable debug text display. .Profiler --- Enable profiler. @@ -328,7 +329,8 @@ flag.Reset { bits = 32 } .Maxanisotropy (9) --- Turn on/off max anisotropy. .Capture (10) --- Begin screen capture. .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. .Hdr10 (17) --- Enable HDR10 rendering. .Hidpi (18) --- Enable HiDPI rendering. diff --git a/scripts/bindings-cs.lua b/scripts/bindings-cs.lua index e167527bd..8e6bfc47b 100644 --- a/scripts/bindings-cs.lua +++ b/scripts/bindings-cs.lua @@ -169,12 +169,9 @@ local function FlagBlock(typ) end yield("\t/// ") - if (type(flag.comment) == "table") then - comment = table.concat(flag.comment, "\n\t\t/// ") - else - comment = flag.comment + for _, comment in ipairs(flag.comment) do + yield("\t/// " .. comment) end - yield("\t/// " .. comment) yield("\t/// ") end @@ -259,7 +256,9 @@ function converter.types(typ) end yield("\t/// ") - yield("\t/// " .. enum.comment) + for _, comment in ipairs(enum.comment) do + yield("\t/// " .. comment) + end yield("\t/// ") end @@ -296,18 +295,11 @@ function converter.types(typ) end end lookup[flagName] = value - if flag.comment ~= nil then - table.insert(flags, { - name = flagName, - value = value, - comment = flag.comment, - }) - else - table.insert(flags, { - name = flagName, - value = value, - }) - end + table.insert(flags, { + name = flagName, + value = value, + comment = flag.comment, + }) end if typ.shift then @@ -381,12 +373,7 @@ function converter.funcs(func) for _, arg in ipairs(func.args) do if arg.comment ~= nil then - local comment = "" - if (type(arg.comment) == "table") then - comment = table.concat(arg.comment, " ") - else - comment = arg.comment - end + local comment = table.concat(arg.comment, " ") yield("/// 0 then if item.comment then - if type(item.comment) == "table" then - for _, c in ipairs(item.comment) do - s[#s+1] = "/// " .. c - end - else - s[#s+1] = "/// " .. item.comment + for _, c in ipairs(item.comment) do + s[#s+1] = "/// " .. c end end local sets = { "" } @@ -781,7 +773,13 @@ function codegen.gen_flag_cdefine(flag) else local comment = "" 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 value = string.format(flag.format, value) 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 local text = string.format("%s%s %s;", typename, namealign(typename), name) if item.comment then - if type(item.comment) == "table" then + if #item.comment > 1 then table.insert(items, "") if cstyle then table.insert(items, "/**") @@ -868,7 +866,7 @@ local function text_with_comments(items, item, cstyle, is_classmember) else text = string.format( 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 items[#items+1] = text diff --git a/scripts/idl.lua b/scripts/idl.lua index fc85f129a..b5bd2ae8a 100644 --- a/scripts/idl.lua +++ b/scripts/idl.lua @@ -68,15 +68,10 @@ 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 + if item.comment then + table.insert(item.comment, comment) else - item.comment = comment + item.comment = { comment } end end