Culled D bindings for header-only C++ functions (#3130)
* 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 * Culled D bindings for header-only C++ functions * Added missing default to bgfx.idl * cppinline now supported by all auto-gen bindings The pattern "func.cppinline and not func.conly" is to make sure that C bindings for `bgfx_vertex_layout_has` are still generated.
This commit is contained in:
parent
faf69bbe20
commit
878767e751
@ -1357,13 +1357,6 @@ extern(C++, "bgfx") struct VertexLayout{
|
|||||||
*/
|
*/
|
||||||
[q{void}, q{decode}, q{bgfx.fakeenum.Attrib.Enum attrib, ref ubyte num, ref bgfx.fakeenum.AttribType.Enum type, ref bool normalized, ref bool asInt}, `C++`, q{const}],
|
[q{void}, q{decode}, q{bgfx.fakeenum.Attrib.Enum attrib, ref ubyte num, ref bgfx.fakeenum.AttribType.Enum type, ref bool normalized, ref bool asInt}, `C++`, q{const}],
|
||||||
|
|
||||||
/**
|
|
||||||
Returns `true` if VertexLayout contains attribute.
|
|
||||||
Params:
|
|
||||||
attrib = Attribute semantics. See: `bgfx::Attrib`
|
|
||||||
*/
|
|
||||||
[q{bool}, q{has}, q{bgfx.fakeenum.Attrib.Enum attrib}, `C++`, q{const}],
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Skip `_num` bytes in vertex stream.
|
Skip `_num` bytes in vertex stream.
|
||||||
Params:
|
Params:
|
||||||
@ -1375,25 +1368,6 @@ extern(C++, "bgfx") struct VertexLayout{
|
|||||||
End VertexLayout.
|
End VertexLayout.
|
||||||
*/
|
*/
|
||||||
[q{void}, q{end}, q{}, `C++`],
|
[q{void}, q{end}, q{}, `C++`],
|
||||||
|
|
||||||
/**
|
|
||||||
Returns relative attribute offset from the vertex.
|
|
||||||
Params:
|
|
||||||
attrib = Attribute semantics. See: `bgfx::Attrib`
|
|
||||||
*/
|
|
||||||
[q{ushort}, q{getOffset}, q{bgfx.fakeenum.Attrib.Enum attrib}, `C++`, q{const}],
|
|
||||||
|
|
||||||
/**
|
|
||||||
Returns vertex stride.
|
|
||||||
*/
|
|
||||||
[q{ushort}, q{getStride}, q{}, `C++`, q{const}],
|
|
||||||
|
|
||||||
/**
|
|
||||||
Returns size of vertex buffer for number of vertices.
|
|
||||||
Params:
|
|
||||||
num = Number of vertices.
|
|
||||||
*/
|
|
||||||
[q{uint}, q{getSize}, q{uint num}, `C++`, q{const}],
|
|
||||||
], true);
|
], true);
|
||||||
return ret;
|
return ret;
|
||||||
}(), typeof(this).stringof));
|
}(), typeof(this).stringof));
|
||||||
@ -1487,7 +1461,7 @@ extern(C++, "bgfx") struct Encoder{
|
|||||||
mtx = Pointer to first matrix in array.
|
mtx = Pointer to first matrix in array.
|
||||||
num = Number of matrices in array.
|
num = Number of matrices in array.
|
||||||
*/
|
*/
|
||||||
[q{uint}, q{setTransform}, q{const(void)* mtx, ushort num}, `C++`],
|
[q{uint}, q{setTransform}, q{const(void)* mtx, ushort num=1}, `C++`],
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Set model matrix from matrix cache for draw primitive.
|
Set model matrix from matrix cache for draw primitive.
|
||||||
|
@ -32,7 +32,7 @@ local type_actions = {
|
|||||||
|
|
||||||
local function cfunc(f)
|
local function cfunc(f)
|
||||||
return function(func)
|
return function(func)
|
||||||
if not func.cpponly then
|
if (not func.cpponly) and (not func.cppinline or func.conly) then
|
||||||
return f(func)
|
return f(func)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -1039,7 +1039,7 @@ func.VertexLayout.decode { const }
|
|||||||
.asInt "bool &" { out } --- Attribute is packed as int.
|
.asInt "bool &" { out } --- Attribute is packed as int.
|
||||||
|
|
||||||
--- Returns `true` if VertexLayout contains attribute.
|
--- Returns `true` if VertexLayout contains attribute.
|
||||||
func.VertexLayout.has { const }
|
func.VertexLayout.has { const, conly, cppinline }
|
||||||
"bool" --- True if VertexLayout contains attribute.
|
"bool" --- True if VertexLayout contains attribute.
|
||||||
.attrib "Attrib::Enum" --- Attribute semantics. See: `bgfx::Attrib`
|
.attrib "Attrib::Enum" --- Attribute semantics. See: `bgfx::Attrib`
|
||||||
|
|
||||||
@ -1054,16 +1054,16 @@ func.VertexLayout["end"]
|
|||||||
"void"
|
"void"
|
||||||
|
|
||||||
--- Returns relative attribute offset from the vertex.
|
--- Returns relative attribute offset from the vertex.
|
||||||
func.VertexLayout.getOffset { const , cpponly }
|
func.VertexLayout.getOffset { const, cppinline }
|
||||||
"uint16_t" --- Relative attribute offset from the vertex.
|
"uint16_t" --- Relative attribute offset from the vertex.
|
||||||
.attrib "Attrib::Enum" --- Attribute semantics. See: `bgfx::Attrib`
|
.attrib "Attrib::Enum" --- Attribute semantics. See: `bgfx::Attrib`
|
||||||
|
|
||||||
--- Returns vertex stride.
|
--- Returns vertex stride.
|
||||||
func.VertexLayout.getStride { const , cpponly }
|
func.VertexLayout.getStride { const, cppinline }
|
||||||
"uint16_t" --- Vertex stride.
|
"uint16_t" --- Vertex stride.
|
||||||
|
|
||||||
--- Returns size of vertex buffer for number of vertices.
|
--- Returns size of vertex buffer for number of vertices.
|
||||||
func.VertexLayout.getSize { const, cpponly }
|
func.VertexLayout.getSize { const, cppinline }
|
||||||
"uint32_t" --- Size of vertex buffer for number of vertices.
|
"uint32_t" --- Size of vertex buffer for number of vertices.
|
||||||
.num "uint32_t" --- Number of vertices.
|
.num "uint32_t" --- Number of vertices.
|
||||||
|
|
||||||
@ -2216,6 +2216,7 @@ func.Encoder.setTransform
|
|||||||
--- to be used for other draw primitive call.
|
--- to be used for other draw primitive call.
|
||||||
.mtx "const void*" --- Pointer to first matrix in array.
|
.mtx "const void*" --- Pointer to first matrix in array.
|
||||||
.num "uint16_t" --- Number of matrices in array.
|
.num "uint16_t" --- Number of matrices in array.
|
||||||
|
{ default = 1 }
|
||||||
|
|
||||||
--- Set model matrix from matrix cache for draw primitive.
|
--- Set model matrix from matrix cache for draw primitive.
|
||||||
func.Encoder.setTransform { cname = "set_transform_cached" }
|
func.Encoder.setTransform { cname = "set_transform_cached" }
|
||||||
|
@ -357,6 +357,8 @@ function converter.funcs(func)
|
|||||||
|
|
||||||
if func.cpponly then
|
if func.cpponly then
|
||||||
return
|
return
|
||||||
|
elseif func.cppinline and not func.conly then
|
||||||
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if func.comments ~= nil then
|
if func.comments ~= nil then
|
||||||
|
@ -387,6 +387,8 @@ function converter.funcs(func)
|
|||||||
|
|
||||||
if func.cpponly then
|
if func.cpponly then
|
||||||
return
|
return
|
||||||
|
elseif func.cppinline and not func.conly then
|
||||||
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if func.comments ~= nil then
|
if func.comments ~= nil then
|
||||||
|
@ -334,7 +334,7 @@ local function genVersion()
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function genStructMemberFn(func) --NOTE: this does not work on nested structs
|
local function genStructMemberFn(func) --NOTE: this does not work on nested structs
|
||||||
if func.class ~= nil and func.conly == nil then
|
if func.class ~= nil and func.conly == nil and func.cppinline == nil then
|
||||||
local st = allStructs[func.class]
|
local st = allStructs[func.class]
|
||||||
local attribs = ""
|
local attribs = ""
|
||||||
if func.comments ~= nil then
|
if func.comments ~= nil then
|
||||||
@ -804,7 +804,7 @@ extern(C++, "bgfx") package final abstract class %s{
|
|||||||
end
|
end
|
||||||
|
|
||||||
function converter.funcs(func)
|
function converter.funcs(func)
|
||||||
if func.class == nil and func.conly == nil then
|
if func.class == nil and func.conly == nil and func.cppinline == nil then
|
||||||
local extern = "C++, \"bgfx\""
|
local extern = "C++, \"bgfx\""
|
||||||
local attribs = ""
|
local attribs = ""
|
||||||
if func.cfunc ~= nil and func.name ~= "init" then --what the is "cfunc" even meant to mean?
|
if func.cfunc ~= nil and func.name ~= "init" then --what the is "cfunc" even meant to mean?
|
||||||
|
@ -405,6 +405,8 @@ function converter.funcs(params)
|
|||||||
local func = params.obj
|
local func = params.obj
|
||||||
if func.cpponly then
|
if func.cpponly then
|
||||||
return
|
return
|
||||||
|
elseif func.cppinline and not func.conly then
|
||||||
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
-- skip for now, don't know how to handle variadic functions
|
-- skip for now, don't know how to handle variadic functions
|
||||||
|
@ -235,6 +235,7 @@ idl.cfunc = "cfunc"
|
|||||||
idl.underscore = "underscore"
|
idl.underscore = "underscore"
|
||||||
idl.conly = "conly"
|
idl.conly = "conly"
|
||||||
idl.cpponly = "cpponly"
|
idl.cpponly = "cpponly"
|
||||||
|
idl.cppinline = "cppinline"
|
||||||
idl.shortname = "shortname"
|
idl.shortname = "shortname"
|
||||||
idl.NULL = "NULL"
|
idl.NULL = "NULL"
|
||||||
idl.UINT16_MAX = "UINT16_MAX"
|
idl.UINT16_MAX = "UINT16_MAX"
|
||||||
|
Loading…
Reference in New Issue
Block a user