mirror of
https://github.com/bkaradzic/bgfx.git
synced 2026-02-17 20:52:36 +01:00
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:
@@ -963,8 +963,13 @@ pragma(inline,true) nothrow @nogc pure @safe{
|
|||||||
|
|
||||||
///Renderer capabilities.
|
///Renderer capabilities.
|
||||||
extern(C++, "bgfx") struct Caps{
|
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.
|
///Renderer runtime limits.
|
||||||
extern(C++, "bgfx") struct Limits{
|
extern(C++) struct Limits{
|
||||||
uint maxDrawCalls; ///Maximum number of draw calls.
|
uint maxDrawCalls; ///Maximum number of draw calls.
|
||||||
uint maxBlits; ///Maximum number of blit calls.
|
uint maxBlits; ///Maximum number of blit calls.
|
||||||
uint maxTextureSize; ///Maximum texture size.
|
uint maxTextureSize; ///Maximum texture size.
|
||||||
@@ -990,11 +995,6 @@ extern(C++, "bgfx") struct Caps{
|
|||||||
uint transientVBSize; ///Maximum transient vertex buffer size.
|
uint transientVBSize; ///Maximum transient vertex buffer size.
|
||||||
uint transientIBSize; ///Maximum transient index 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`
|
RendererType rendererType; ///Renderer backend type. See: `bgfx::RendererType`
|
||||||
|
|
||||||
@@ -1095,7 +1095,7 @@ extern(C++, "bgfx") struct Resolution{
|
|||||||
///Initialization parameters used by `bgfx::init`.
|
///Initialization parameters used by `bgfx::init`.
|
||||||
extern(C++, "bgfx") struct Init{
|
extern(C++, "bgfx") struct Init{
|
||||||
///Configurable runtime limits parameters.
|
///Configurable runtime limits parameters.
|
||||||
extern(C++, "bgfx") struct Limits{
|
extern(C++) struct Limits{
|
||||||
ushort maxEncoders; ///Maximum number of encoder threads.
|
ushort maxEncoders; ///Maximum number of encoder threads.
|
||||||
uint minResourceCBSize; ///Minimum resource command buffer size.
|
uint minResourceCBSize; ///Minimum resource command buffer size.
|
||||||
uint transientVBSize; ///Maximum transient vertex buffer size.
|
uint transientVBSize; ///Maximum transient vertex buffer size.
|
||||||
@@ -3018,7 +3018,7 @@ mixin(joinFnBinds((){
|
|||||||
Params:
|
Params:
|
||||||
forThread = Explicitly request an encoder for a worker thread.
|
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.
|
* End submitting draw calls from thread.
|
||||||
|
|||||||
@@ -2132,6 +2132,7 @@ func.resetView
|
|||||||
func.begin { cname = "encoder_begin" }
|
func.begin { cname = "encoder_begin" }
|
||||||
"Encoder*" --- Encoder.
|
"Encoder*" --- Encoder.
|
||||||
.forThread "bool" --- Explicitly request an encoder for a worker thread.
|
.forThread "bool" --- Explicitly request an encoder for a worker thread.
|
||||||
|
{ default = false }
|
||||||
|
|
||||||
--- End submitting draw calls from thread.
|
--- End submitting draw calls from thread.
|
||||||
func["end"] { cname = "encoder_end" }
|
func["end"] { cname = "encoder_end" }
|
||||||
|
|||||||
@@ -445,7 +445,7 @@ function gen.gen()
|
|||||||
local co = coroutine.create(converter[what])
|
local co = coroutine.create(converter[what])
|
||||||
local any
|
local any
|
||||||
while true do
|
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))
|
assert(ok, debug.traceback(co, v))
|
||||||
if not v then
|
if not v then
|
||||||
break
|
break
|
||||||
@@ -483,19 +483,23 @@ function gen.gen()
|
|||||||
return r
|
return r
|
||||||
end
|
end
|
||||||
|
|
||||||
function converter.structs(st, name)
|
function converter.structs(st, name, topLvl)
|
||||||
for _, line in ipairs(st.comments) do
|
for _, line in ipairs(st.comments) do
|
||||||
yield(line)
|
yield(line)
|
||||||
end
|
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
|
local subN = 0
|
||||||
for subName, subStruct in pairs(st.subs) do
|
for _, subStruct in ipairs(st.subs) do
|
||||||
subN = subN + 1
|
subN = subN + 1
|
||||||
local co = coroutine.create(converter.structs)
|
local co = coroutine.create(converter.structs)
|
||||||
while true do
|
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))
|
assert(ok, debug.traceback(co, v))
|
||||||
if not v then
|
if not v then
|
||||||
break
|
break
|
||||||
@@ -747,7 +751,7 @@ extern(C++, "bgfx") package final abstract class %s{
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
elseif typ.struct ~= nil then
|
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 ~= nil then
|
||||||
if #typ.comments == 1 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++`],")
|
table.insert(st.fns, "[q{void}, q{this}, q{}, `C++`],")
|
||||||
end
|
end
|
||||||
|
|
||||||
if typ.namespace ~= nil then
|
if typ.namespace ~= nil then --if this is a sub-struct
|
||||||
if allStructs[typ.namespace] ~= nil then
|
if allStructs[typ.namespace] ~= nil then
|
||||||
allStructs[typ.namespace].subs[typ.name] = st
|
table.insert(allStructs[typ.namespace].subs, st)
|
||||||
else
|
else
|
||||||
allStructs[typ.namespace] = {subs = {[typ.name] = st}}
|
allStructs[typ.namespace] = {subs = {st}}
|
||||||
end
|
end
|
||||||
else
|
else --otherwise it's top-level
|
||||||
if allStructs[typ.name] ~= nil then
|
if allStructs[typ.name] ~= nil then
|
||||||
st.subs = allStructs[typ.name].subs
|
st.subs = allStructs[typ.name].subs
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user