mirror of https://github.com/bkaradzic/bgfx
D bindings: deterministic sub-struct order (#3127)
* Reformatted comments; fixed a couple of oversights * D bindings: deterministic sub-struct order * Added missing default to IDL * Fixed sub-struct linkage; regenerate D binds
This commit is contained in:
parent
c3b5b55a86
commit
c3dab115a8
|
@ -963,8 +963,13 @@ pragma(inline,true) nothrow @nogc pure @safe{
|
|||
|
||||
///Renderer capabilities.
|
||||
extern(C++, "bgfx") struct Caps{
|
||||
///GPU info.
|
||||
extern(C++) struct GPU{
|
||||
ushort vendorID; ///Vendor PCI id. See `BGFX_PCI_ID_*`.
|
||||
ushort deviceID; ///Device id.
|
||||
}
|
||||
///Renderer runtime limits.
|
||||
extern(C++, "bgfx") struct Limits{
|
||||
extern(C++) struct Limits{
|
||||
uint maxDrawCalls; ///Maximum number of draw calls.
|
||||
uint maxBlits; ///Maximum number of blit calls.
|
||||
uint maxTextureSize; ///Maximum texture size.
|
||||
|
@ -990,11 +995,6 @@ extern(C++, "bgfx") struct Caps{
|
|||
uint transientVBSize; ///Maximum transient vertex buffer size.
|
||||
uint transientIBSize; ///Maximum transient index buffer size.
|
||||
}
|
||||
///GPU info.
|
||||
extern(C++, "bgfx") struct GPU{
|
||||
ushort vendorID; ///Vendor PCI id. See `BGFX_PCI_ID_*`.
|
||||
ushort deviceID; ///Device id.
|
||||
}
|
||||
|
||||
RendererType rendererType; ///Renderer backend type. See: `bgfx::RendererType`
|
||||
|
||||
|
@ -1095,7 +1095,7 @@ extern(C++, "bgfx") struct Resolution{
|
|||
///Initialization parameters used by `bgfx::init`.
|
||||
extern(C++, "bgfx") struct Init{
|
||||
///Configurable runtime limits parameters.
|
||||
extern(C++, "bgfx") struct Limits{
|
||||
extern(C++) struct Limits{
|
||||
ushort maxEncoders; ///Maximum number of encoder threads.
|
||||
uint minResourceCBSize; ///Minimum resource command buffer size.
|
||||
uint transientVBSize; ///Maximum transient vertex buffer size.
|
||||
|
@ -3018,7 +3018,7 @@ mixin(joinFnBinds((){
|
|||
Params:
|
||||
forThread = Explicitly request an encoder for a worker thread.
|
||||
*/
|
||||
[q{Encoder*}, q{begin}, q{bool forThread}, `C++, "bgfx"`],
|
||||
[q{Encoder*}, q{begin}, q{bool forThread=false}, `C++, "bgfx"`],
|
||||
|
||||
/**
|
||||
* End submitting draw calls from thread.
|
||||
|
|
|
@ -2132,6 +2132,7 @@ func.resetView
|
|||
func.begin { cname = "encoder_begin" }
|
||||
"Encoder*" --- Encoder.
|
||||
.forThread "bool" --- Explicitly request an encoder for a worker thread.
|
||||
{ default = false }
|
||||
|
||||
--- End submitting draw calls from thread.
|
||||
func["end"] { cname = "encoder_end" }
|
||||
|
|
|
@ -445,7 +445,7 @@ function gen.gen()
|
|||
local co = coroutine.create(converter[what])
|
||||
local any
|
||||
while true do
|
||||
local ok, v = coroutine.resume(co, allStructs[object.name], object.name, indent:len())
|
||||
local ok, v = coroutine.resume(co, allStructs[object.name], object.name, true, indent:len())
|
||||
assert(ok, debug.traceback(co, v))
|
||||
if not v then
|
||||
break
|
||||
|
@ -483,19 +483,23 @@ function gen.gen()
|
|||
return r
|
||||
end
|
||||
|
||||
function converter.structs(st, name)
|
||||
function converter.structs(st, name, topLvl)
|
||||
for _, line in ipairs(st.comments) do
|
||||
yield(line)
|
||||
end
|
||||
|
||||
yield("extern(C++, \"bgfx\") struct " .. name .. "{")
|
||||
if topLvl then
|
||||
yield("extern(C++, \"bgfx\") struct " .. name .. "{")
|
||||
else
|
||||
yield("extern(C++) struct " .. name .. "{")
|
||||
end
|
||||
|
||||
local subN = 0
|
||||
for subName, subStruct in pairs(st.subs) do
|
||||
for _, subStruct in ipairs(st.subs) do
|
||||
subN = subN + 1
|
||||
local co = coroutine.create(converter.structs)
|
||||
while true do
|
||||
local ok, v = coroutine.resume(co, subStruct, subName)
|
||||
local ok, v = coroutine.resume(co, subStruct, subStruct.name, false)
|
||||
assert(ok, debug.traceback(co, v))
|
||||
if not v then
|
||||
break
|
||||
|
@ -747,7 +751,7 @@ extern(C++, "bgfx") package final abstract class %s{
|
|||
end
|
||||
end
|
||||
elseif typ.struct ~= nil then
|
||||
local st = {comments = {}, fields = {}, fns = {}, subs = {}}
|
||||
local st = {name = typ.name, comments = {}, fields = {}, fns = {}, subs = {}}
|
||||
|
||||
if typ.comments ~= nil then
|
||||
if #typ.comments == 1 then
|
||||
|
@ -784,13 +788,13 @@ extern(C++, "bgfx") package final abstract class %s{
|
|||
table.insert(st.fns, "[q{void}, q{this}, q{}, `C++`],")
|
||||
end
|
||||
|
||||
if typ.namespace ~= nil then
|
||||
if typ.namespace ~= nil then --if this is a sub-struct
|
||||
if allStructs[typ.namespace] ~= nil then
|
||||
allStructs[typ.namespace].subs[typ.name] = st
|
||||
table.insert(allStructs[typ.namespace].subs, st)
|
||||
else
|
||||
allStructs[typ.namespace] = {subs = {[typ.name] = st}}
|
||||
allStructs[typ.namespace] = {subs = {st}}
|
||||
end
|
||||
else
|
||||
else --otherwise it's top-level
|
||||
if allStructs[typ.name] ~= nil then
|
||||
st.subs = allStructs[typ.name].subs
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue