mirror of
https://github.com/bkaradzic/bgfx.git
synced 2026-02-17 12:42:34 +01:00
D bindings: Fix nested struct methods, formatting, and Memory mutability (#3471)
Co-authored-by: IchorDev <ichordev@noreply.git.sleeping.town>
This commit is contained in:
@@ -12,6 +12,9 @@ trim_trailing_whitespace = true
|
|||||||
[include/bgfx/c99/*.h]
|
[include/bgfx/c99/*.h]
|
||||||
indent_style = space
|
indent_style = space
|
||||||
|
|
||||||
|
[scripts/bindings-d.lua]
|
||||||
|
trim_trailing_whitespace = false
|
||||||
|
|
||||||
[*.ninja]
|
[*.ninja]
|
||||||
indent_style = space
|
indent_style = space
|
||||||
|
|
||||||
|
|||||||
@@ -3,10 +3,22 @@
|
|||||||
+ │ AUTO GENERATED! DO NOT EDIT! │
|
+ │ AUTO GENERATED! DO NOT EDIT! │
|
||||||
+ └==============================┘
|
+ └==============================┘
|
||||||
+/
|
+/
|
||||||
module bgfx.fakeenum;
|
///Do NOT import this module! Use the symbols with the same names in `bgfx/package.d` instead.
|
||||||
|
module bgfx.impl;
|
||||||
|
|
||||||
|
import bindbc.bgfx.config;
|
||||||
|
import bgfx;
|
||||||
|
|
||||||
//NOTE: Do NOT use this module! Use the enums with the same names in `bgfx/package.d` instead.
|
|
||||||
package:
|
package:
|
||||||
|
|
||||||
|
mixin(joinFnBinds((){
|
||||||
|
FnBind[] ret = [
|
||||||
|
{q{const(Memory)*}, q{alloc}, q{uint size}, ext: `C++, "bgfx"`},
|
||||||
|
{q{const(Memory)*}, q{copy}, q{const(void)* data, uint size}, ext: `C++, "bgfx"`},
|
||||||
|
];
|
||||||
|
return ret;
|
||||||
|
}()));
|
||||||
|
|
||||||
extern(C++, "bgfx") package final abstract class Fatal{
|
extern(C++, "bgfx") package final abstract class Fatal{
|
||||||
enum Enum{
|
enum Enum{
|
||||||
debugCheck,invalidShader,unableToInitialize,unableToCreateTexture,deviceLost,count
|
debugCheck,invalidShader,unableToInitialize,unableToCreateTexture,deviceLost,count
|
||||||
@@ -5,10 +5,9 @@
|
|||||||
+/
|
+/
|
||||||
module bgfx;
|
module bgfx;
|
||||||
|
|
||||||
import bindbc.bgfx.config;
|
|
||||||
|
|
||||||
import bindbc.common.types: c_int64, c_uint64, va_list;
|
import bindbc.common.types: c_int64, c_uint64, va_list;
|
||||||
static import bgfx.fakeenum;
|
import bindbc.bgfx.config;
|
||||||
|
static import bgfx.impl;
|
||||||
|
|
||||||
enum uint apiVersion = 129;
|
enum uint apiVersion = 129;
|
||||||
|
|
||||||
@@ -16,7 +15,7 @@ alias ViewID = ushort;
|
|||||||
|
|
||||||
enum invalidHandle(T) = T(ushort.max);
|
enum invalidHandle(T) = T(ushort.max);
|
||||||
|
|
||||||
alias ReleaseFn = void function(void* ptr, void* userData);
|
alias ReleaseFn = extern(C++) void function(void* ptr, void* userData) nothrow;
|
||||||
|
|
||||||
///Memory release callback.
|
///Memory release callback.
|
||||||
|
|
||||||
@@ -577,74 +576,74 @@ enum CubeMap: CubeMap_{
|
|||||||
}
|
}
|
||||||
|
|
||||||
///Fatal error enum.
|
///Fatal error enum.
|
||||||
enum Fatal: bgfx.fakeenum.Fatal.Enum{
|
enum Fatal: bgfx.impl.Fatal.Enum{
|
||||||
debugCheck = bgfx.fakeenum.Fatal.Enum.debugCheck,
|
debugCheck = bgfx.impl.Fatal.Enum.debugCheck,
|
||||||
invalidShader = bgfx.fakeenum.Fatal.Enum.invalidShader,
|
invalidShader = bgfx.impl.Fatal.Enum.invalidShader,
|
||||||
unableToInitialize = bgfx.fakeenum.Fatal.Enum.unableToInitialize,
|
unableToInitialize = bgfx.impl.Fatal.Enum.unableToInitialize,
|
||||||
unableToInitialise = bgfx.fakeenum.Fatal.Enum.unableToInitialize,
|
unableToInitialise = bgfx.impl.Fatal.Enum.unableToInitialize,
|
||||||
unableToCreateTexture = bgfx.fakeenum.Fatal.Enum.unableToCreateTexture,
|
unableToCreateTexture = bgfx.impl.Fatal.Enum.unableToCreateTexture,
|
||||||
deviceLost = bgfx.fakeenum.Fatal.Enum.deviceLost,
|
deviceLost = bgfx.impl.Fatal.Enum.deviceLost,
|
||||||
count = bgfx.fakeenum.Fatal.Enum.count,
|
count = bgfx.impl.Fatal.Enum.count,
|
||||||
}
|
}
|
||||||
|
|
||||||
///Renderer backend type enum.
|
///Renderer backend type enum.
|
||||||
enum RendererType: bgfx.fakeenum.RendererType.Enum{
|
enum RendererType: bgfx.impl.RendererType.Enum{
|
||||||
noop = bgfx.fakeenum.RendererType.Enum.noop,
|
noop = bgfx.impl.RendererType.Enum.noop,
|
||||||
agc = bgfx.fakeenum.RendererType.Enum.agc,
|
agc = bgfx.impl.RendererType.Enum.agc,
|
||||||
direct3D11 = bgfx.fakeenum.RendererType.Enum.direct3D11,
|
direct3D11 = bgfx.impl.RendererType.Enum.direct3D11,
|
||||||
direct3D12 = bgfx.fakeenum.RendererType.Enum.direct3D12,
|
direct3D12 = bgfx.impl.RendererType.Enum.direct3D12,
|
||||||
gnm = bgfx.fakeenum.RendererType.Enum.gnm,
|
gnm = bgfx.impl.RendererType.Enum.gnm,
|
||||||
metal = bgfx.fakeenum.RendererType.Enum.metal,
|
metal = bgfx.impl.RendererType.Enum.metal,
|
||||||
nvn = bgfx.fakeenum.RendererType.Enum.nvn,
|
nvn = bgfx.impl.RendererType.Enum.nvn,
|
||||||
openGLES = bgfx.fakeenum.RendererType.Enum.openGLES,
|
openGLES = bgfx.impl.RendererType.Enum.openGLES,
|
||||||
openGL = bgfx.fakeenum.RendererType.Enum.openGL,
|
openGL = bgfx.impl.RendererType.Enum.openGL,
|
||||||
vulkan = bgfx.fakeenum.RendererType.Enum.vulkan,
|
vulkan = bgfx.impl.RendererType.Enum.vulkan,
|
||||||
count = bgfx.fakeenum.RendererType.Enum.count,
|
count = bgfx.impl.RendererType.Enum.count,
|
||||||
}
|
}
|
||||||
|
|
||||||
///Access mode enum.
|
///Access mode enum.
|
||||||
enum Access: bgfx.fakeenum.Access.Enum{
|
enum Access: bgfx.impl.Access.Enum{
|
||||||
read = bgfx.fakeenum.Access.Enum.read,
|
read = bgfx.impl.Access.Enum.read,
|
||||||
write = bgfx.fakeenum.Access.Enum.write,
|
write = bgfx.impl.Access.Enum.write,
|
||||||
readWrite = bgfx.fakeenum.Access.Enum.readWrite,
|
readWrite = bgfx.impl.Access.Enum.readWrite,
|
||||||
count = bgfx.fakeenum.Access.Enum.count,
|
count = bgfx.impl.Access.Enum.count,
|
||||||
}
|
}
|
||||||
|
|
||||||
///Vertex attribute enum.
|
///Vertex attribute enum.
|
||||||
enum Attrib: bgfx.fakeenum.Attrib.Enum{
|
enum Attrib: bgfx.impl.Attrib.Enum{
|
||||||
position = bgfx.fakeenum.Attrib.Enum.position,
|
position = bgfx.impl.Attrib.Enum.position,
|
||||||
normal = bgfx.fakeenum.Attrib.Enum.normal,
|
normal = bgfx.impl.Attrib.Enum.normal,
|
||||||
tangent = bgfx.fakeenum.Attrib.Enum.tangent,
|
tangent = bgfx.impl.Attrib.Enum.tangent,
|
||||||
bitangent = bgfx.fakeenum.Attrib.Enum.bitangent,
|
bitangent = bgfx.impl.Attrib.Enum.bitangent,
|
||||||
color0 = bgfx.fakeenum.Attrib.Enum.color0,
|
color0 = bgfx.impl.Attrib.Enum.color0,
|
||||||
colour0 = bgfx.fakeenum.Attrib.Enum.color0,
|
colour0 = bgfx.impl.Attrib.Enum.color0,
|
||||||
color1 = bgfx.fakeenum.Attrib.Enum.color1,
|
color1 = bgfx.impl.Attrib.Enum.color1,
|
||||||
colour1 = bgfx.fakeenum.Attrib.Enum.color1,
|
colour1 = bgfx.impl.Attrib.Enum.color1,
|
||||||
color2 = bgfx.fakeenum.Attrib.Enum.color2,
|
color2 = bgfx.impl.Attrib.Enum.color2,
|
||||||
colour2 = bgfx.fakeenum.Attrib.Enum.color2,
|
colour2 = bgfx.impl.Attrib.Enum.color2,
|
||||||
color3 = bgfx.fakeenum.Attrib.Enum.color3,
|
color3 = bgfx.impl.Attrib.Enum.color3,
|
||||||
colour3 = bgfx.fakeenum.Attrib.Enum.color3,
|
colour3 = bgfx.impl.Attrib.Enum.color3,
|
||||||
indices = bgfx.fakeenum.Attrib.Enum.indices,
|
indices = bgfx.impl.Attrib.Enum.indices,
|
||||||
weight = bgfx.fakeenum.Attrib.Enum.weight,
|
weight = bgfx.impl.Attrib.Enum.weight,
|
||||||
texCoord0 = bgfx.fakeenum.Attrib.Enum.texCoord0,
|
texCoord0 = bgfx.impl.Attrib.Enum.texCoord0,
|
||||||
texCoord1 = bgfx.fakeenum.Attrib.Enum.texCoord1,
|
texCoord1 = bgfx.impl.Attrib.Enum.texCoord1,
|
||||||
texCoord2 = bgfx.fakeenum.Attrib.Enum.texCoord2,
|
texCoord2 = bgfx.impl.Attrib.Enum.texCoord2,
|
||||||
texCoord3 = bgfx.fakeenum.Attrib.Enum.texCoord3,
|
texCoord3 = bgfx.impl.Attrib.Enum.texCoord3,
|
||||||
texCoord4 = bgfx.fakeenum.Attrib.Enum.texCoord4,
|
texCoord4 = bgfx.impl.Attrib.Enum.texCoord4,
|
||||||
texCoord5 = bgfx.fakeenum.Attrib.Enum.texCoord5,
|
texCoord5 = bgfx.impl.Attrib.Enum.texCoord5,
|
||||||
texCoord6 = bgfx.fakeenum.Attrib.Enum.texCoord6,
|
texCoord6 = bgfx.impl.Attrib.Enum.texCoord6,
|
||||||
texCoord7 = bgfx.fakeenum.Attrib.Enum.texCoord7,
|
texCoord7 = bgfx.impl.Attrib.Enum.texCoord7,
|
||||||
count = bgfx.fakeenum.Attrib.Enum.count,
|
count = bgfx.impl.Attrib.Enum.count,
|
||||||
}
|
}
|
||||||
|
|
||||||
///Vertex attribute type enum.
|
///Vertex attribute type enum.
|
||||||
enum AttribType: bgfx.fakeenum.AttribType.Enum{
|
enum AttribType: bgfx.impl.AttribType.Enum{
|
||||||
uint8 = bgfx.fakeenum.AttribType.Enum.uint8,
|
uint8 = bgfx.impl.AttribType.Enum.uint8,
|
||||||
uint10 = bgfx.fakeenum.AttribType.Enum.uint10,
|
uint10 = bgfx.impl.AttribType.Enum.uint10,
|
||||||
int16 = bgfx.fakeenum.AttribType.Enum.int16,
|
int16 = bgfx.impl.AttribType.Enum.int16,
|
||||||
half = bgfx.fakeenum.AttribType.Enum.half,
|
half = bgfx.impl.AttribType.Enum.half,
|
||||||
float_ = bgfx.fakeenum.AttribType.Enum.float_,
|
float_ = bgfx.impl.AttribType.Enum.float_,
|
||||||
count = bgfx.fakeenum.AttribType.Enum.count,
|
count = bgfx.impl.AttribType.Enum.count,
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -661,195 +660,195 @@ Notation:
|
|||||||
+-------- Components
|
+-------- Components
|
||||||
@attention Availability depends on Caps (see: formats).
|
@attention Availability depends on Caps (see: formats).
|
||||||
*/
|
*/
|
||||||
enum TextureFormat: bgfx.fakeenum.TextureFormat.Enum{
|
enum TextureFormat: bgfx.impl.TextureFormat.Enum{
|
||||||
bc1 = bgfx.fakeenum.TextureFormat.Enum.bc1,
|
bc1 = bgfx.impl.TextureFormat.Enum.bc1,
|
||||||
bc2 = bgfx.fakeenum.TextureFormat.Enum.bc2,
|
bc2 = bgfx.impl.TextureFormat.Enum.bc2,
|
||||||
bc3 = bgfx.fakeenum.TextureFormat.Enum.bc3,
|
bc3 = bgfx.impl.TextureFormat.Enum.bc3,
|
||||||
bc4 = bgfx.fakeenum.TextureFormat.Enum.bc4,
|
bc4 = bgfx.impl.TextureFormat.Enum.bc4,
|
||||||
bc5 = bgfx.fakeenum.TextureFormat.Enum.bc5,
|
bc5 = bgfx.impl.TextureFormat.Enum.bc5,
|
||||||
bc6h = bgfx.fakeenum.TextureFormat.Enum.bc6h,
|
bc6h = bgfx.impl.TextureFormat.Enum.bc6h,
|
||||||
bc7 = bgfx.fakeenum.TextureFormat.Enum.bc7,
|
bc7 = bgfx.impl.TextureFormat.Enum.bc7,
|
||||||
etc1 = bgfx.fakeenum.TextureFormat.Enum.etc1,
|
etc1 = bgfx.impl.TextureFormat.Enum.etc1,
|
||||||
etc2 = bgfx.fakeenum.TextureFormat.Enum.etc2,
|
etc2 = bgfx.impl.TextureFormat.Enum.etc2,
|
||||||
etc2a = bgfx.fakeenum.TextureFormat.Enum.etc2a,
|
etc2a = bgfx.impl.TextureFormat.Enum.etc2a,
|
||||||
etc2a1 = bgfx.fakeenum.TextureFormat.Enum.etc2a1,
|
etc2a1 = bgfx.impl.TextureFormat.Enum.etc2a1,
|
||||||
ptc12 = bgfx.fakeenum.TextureFormat.Enum.ptc12,
|
ptc12 = bgfx.impl.TextureFormat.Enum.ptc12,
|
||||||
ptc14 = bgfx.fakeenum.TextureFormat.Enum.ptc14,
|
ptc14 = bgfx.impl.TextureFormat.Enum.ptc14,
|
||||||
ptc12a = bgfx.fakeenum.TextureFormat.Enum.ptc12a,
|
ptc12a = bgfx.impl.TextureFormat.Enum.ptc12a,
|
||||||
ptc14a = bgfx.fakeenum.TextureFormat.Enum.ptc14a,
|
ptc14a = bgfx.impl.TextureFormat.Enum.ptc14a,
|
||||||
ptc22 = bgfx.fakeenum.TextureFormat.Enum.ptc22,
|
ptc22 = bgfx.impl.TextureFormat.Enum.ptc22,
|
||||||
ptc24 = bgfx.fakeenum.TextureFormat.Enum.ptc24,
|
ptc24 = bgfx.impl.TextureFormat.Enum.ptc24,
|
||||||
atc = bgfx.fakeenum.TextureFormat.Enum.atc,
|
atc = bgfx.impl.TextureFormat.Enum.atc,
|
||||||
atce = bgfx.fakeenum.TextureFormat.Enum.atce,
|
atce = bgfx.impl.TextureFormat.Enum.atce,
|
||||||
atci = bgfx.fakeenum.TextureFormat.Enum.atci,
|
atci = bgfx.impl.TextureFormat.Enum.atci,
|
||||||
astc4x4 = bgfx.fakeenum.TextureFormat.Enum.astc4x4,
|
astc4x4 = bgfx.impl.TextureFormat.Enum.astc4x4,
|
||||||
astc5x4 = bgfx.fakeenum.TextureFormat.Enum.astc5x4,
|
astc5x4 = bgfx.impl.TextureFormat.Enum.astc5x4,
|
||||||
astc5x5 = bgfx.fakeenum.TextureFormat.Enum.astc5x5,
|
astc5x5 = bgfx.impl.TextureFormat.Enum.astc5x5,
|
||||||
astc6x5 = bgfx.fakeenum.TextureFormat.Enum.astc6x5,
|
astc6x5 = bgfx.impl.TextureFormat.Enum.astc6x5,
|
||||||
astc6x6 = bgfx.fakeenum.TextureFormat.Enum.astc6x6,
|
astc6x6 = bgfx.impl.TextureFormat.Enum.astc6x6,
|
||||||
astc8x5 = bgfx.fakeenum.TextureFormat.Enum.astc8x5,
|
astc8x5 = bgfx.impl.TextureFormat.Enum.astc8x5,
|
||||||
astc8x6 = bgfx.fakeenum.TextureFormat.Enum.astc8x6,
|
astc8x6 = bgfx.impl.TextureFormat.Enum.astc8x6,
|
||||||
astc8x8 = bgfx.fakeenum.TextureFormat.Enum.astc8x8,
|
astc8x8 = bgfx.impl.TextureFormat.Enum.astc8x8,
|
||||||
astc10x5 = bgfx.fakeenum.TextureFormat.Enum.astc10x5,
|
astc10x5 = bgfx.impl.TextureFormat.Enum.astc10x5,
|
||||||
astc10x6 = bgfx.fakeenum.TextureFormat.Enum.astc10x6,
|
astc10x6 = bgfx.impl.TextureFormat.Enum.astc10x6,
|
||||||
astc10x8 = bgfx.fakeenum.TextureFormat.Enum.astc10x8,
|
astc10x8 = bgfx.impl.TextureFormat.Enum.astc10x8,
|
||||||
astc10x10 = bgfx.fakeenum.TextureFormat.Enum.astc10x10,
|
astc10x10 = bgfx.impl.TextureFormat.Enum.astc10x10,
|
||||||
astc12x10 = bgfx.fakeenum.TextureFormat.Enum.astc12x10,
|
astc12x10 = bgfx.impl.TextureFormat.Enum.astc12x10,
|
||||||
astc12x12 = bgfx.fakeenum.TextureFormat.Enum.astc12x12,
|
astc12x12 = bgfx.impl.TextureFormat.Enum.astc12x12,
|
||||||
unknown = bgfx.fakeenum.TextureFormat.Enum.unknown,
|
unknown = bgfx.impl.TextureFormat.Enum.unknown,
|
||||||
r1 = bgfx.fakeenum.TextureFormat.Enum.r1,
|
r1 = bgfx.impl.TextureFormat.Enum.r1,
|
||||||
a8 = bgfx.fakeenum.TextureFormat.Enum.a8,
|
a8 = bgfx.impl.TextureFormat.Enum.a8,
|
||||||
r8 = bgfx.fakeenum.TextureFormat.Enum.r8,
|
r8 = bgfx.impl.TextureFormat.Enum.r8,
|
||||||
r8i = bgfx.fakeenum.TextureFormat.Enum.r8i,
|
r8i = bgfx.impl.TextureFormat.Enum.r8i,
|
||||||
r8u = bgfx.fakeenum.TextureFormat.Enum.r8u,
|
r8u = bgfx.impl.TextureFormat.Enum.r8u,
|
||||||
r8s = bgfx.fakeenum.TextureFormat.Enum.r8s,
|
r8s = bgfx.impl.TextureFormat.Enum.r8s,
|
||||||
r16 = bgfx.fakeenum.TextureFormat.Enum.r16,
|
r16 = bgfx.impl.TextureFormat.Enum.r16,
|
||||||
r16i = bgfx.fakeenum.TextureFormat.Enum.r16i,
|
r16i = bgfx.impl.TextureFormat.Enum.r16i,
|
||||||
r16u = bgfx.fakeenum.TextureFormat.Enum.r16u,
|
r16u = bgfx.impl.TextureFormat.Enum.r16u,
|
||||||
r16f = bgfx.fakeenum.TextureFormat.Enum.r16f,
|
r16f = bgfx.impl.TextureFormat.Enum.r16f,
|
||||||
r16s = bgfx.fakeenum.TextureFormat.Enum.r16s,
|
r16s = bgfx.impl.TextureFormat.Enum.r16s,
|
||||||
r32i = bgfx.fakeenum.TextureFormat.Enum.r32i,
|
r32i = bgfx.impl.TextureFormat.Enum.r32i,
|
||||||
r32u = bgfx.fakeenum.TextureFormat.Enum.r32u,
|
r32u = bgfx.impl.TextureFormat.Enum.r32u,
|
||||||
r32f = bgfx.fakeenum.TextureFormat.Enum.r32f,
|
r32f = bgfx.impl.TextureFormat.Enum.r32f,
|
||||||
rg8 = bgfx.fakeenum.TextureFormat.Enum.rg8,
|
rg8 = bgfx.impl.TextureFormat.Enum.rg8,
|
||||||
rg8i = bgfx.fakeenum.TextureFormat.Enum.rg8i,
|
rg8i = bgfx.impl.TextureFormat.Enum.rg8i,
|
||||||
rg8u = bgfx.fakeenum.TextureFormat.Enum.rg8u,
|
rg8u = bgfx.impl.TextureFormat.Enum.rg8u,
|
||||||
rg8s = bgfx.fakeenum.TextureFormat.Enum.rg8s,
|
rg8s = bgfx.impl.TextureFormat.Enum.rg8s,
|
||||||
rg16 = bgfx.fakeenum.TextureFormat.Enum.rg16,
|
rg16 = bgfx.impl.TextureFormat.Enum.rg16,
|
||||||
rg16i = bgfx.fakeenum.TextureFormat.Enum.rg16i,
|
rg16i = bgfx.impl.TextureFormat.Enum.rg16i,
|
||||||
rg16u = bgfx.fakeenum.TextureFormat.Enum.rg16u,
|
rg16u = bgfx.impl.TextureFormat.Enum.rg16u,
|
||||||
rg16f = bgfx.fakeenum.TextureFormat.Enum.rg16f,
|
rg16f = bgfx.impl.TextureFormat.Enum.rg16f,
|
||||||
rg16s = bgfx.fakeenum.TextureFormat.Enum.rg16s,
|
rg16s = bgfx.impl.TextureFormat.Enum.rg16s,
|
||||||
rg32i = bgfx.fakeenum.TextureFormat.Enum.rg32i,
|
rg32i = bgfx.impl.TextureFormat.Enum.rg32i,
|
||||||
rg32u = bgfx.fakeenum.TextureFormat.Enum.rg32u,
|
rg32u = bgfx.impl.TextureFormat.Enum.rg32u,
|
||||||
rg32f = bgfx.fakeenum.TextureFormat.Enum.rg32f,
|
rg32f = bgfx.impl.TextureFormat.Enum.rg32f,
|
||||||
rgb8 = bgfx.fakeenum.TextureFormat.Enum.rgb8,
|
rgb8 = bgfx.impl.TextureFormat.Enum.rgb8,
|
||||||
rgb8i = bgfx.fakeenum.TextureFormat.Enum.rgb8i,
|
rgb8i = bgfx.impl.TextureFormat.Enum.rgb8i,
|
||||||
rgb8u = bgfx.fakeenum.TextureFormat.Enum.rgb8u,
|
rgb8u = bgfx.impl.TextureFormat.Enum.rgb8u,
|
||||||
rgb8s = bgfx.fakeenum.TextureFormat.Enum.rgb8s,
|
rgb8s = bgfx.impl.TextureFormat.Enum.rgb8s,
|
||||||
rgb9e5f = bgfx.fakeenum.TextureFormat.Enum.rgb9e5f,
|
rgb9e5f = bgfx.impl.TextureFormat.Enum.rgb9e5f,
|
||||||
bgra8 = bgfx.fakeenum.TextureFormat.Enum.bgra8,
|
bgra8 = bgfx.impl.TextureFormat.Enum.bgra8,
|
||||||
rgba8 = bgfx.fakeenum.TextureFormat.Enum.rgba8,
|
rgba8 = bgfx.impl.TextureFormat.Enum.rgba8,
|
||||||
rgba8i = bgfx.fakeenum.TextureFormat.Enum.rgba8i,
|
rgba8i = bgfx.impl.TextureFormat.Enum.rgba8i,
|
||||||
rgba8u = bgfx.fakeenum.TextureFormat.Enum.rgba8u,
|
rgba8u = bgfx.impl.TextureFormat.Enum.rgba8u,
|
||||||
rgba8s = bgfx.fakeenum.TextureFormat.Enum.rgba8s,
|
rgba8s = bgfx.impl.TextureFormat.Enum.rgba8s,
|
||||||
rgba16 = bgfx.fakeenum.TextureFormat.Enum.rgba16,
|
rgba16 = bgfx.impl.TextureFormat.Enum.rgba16,
|
||||||
rgba16i = bgfx.fakeenum.TextureFormat.Enum.rgba16i,
|
rgba16i = bgfx.impl.TextureFormat.Enum.rgba16i,
|
||||||
rgba16u = bgfx.fakeenum.TextureFormat.Enum.rgba16u,
|
rgba16u = bgfx.impl.TextureFormat.Enum.rgba16u,
|
||||||
rgba16f = bgfx.fakeenum.TextureFormat.Enum.rgba16f,
|
rgba16f = bgfx.impl.TextureFormat.Enum.rgba16f,
|
||||||
rgba16s = bgfx.fakeenum.TextureFormat.Enum.rgba16s,
|
rgba16s = bgfx.impl.TextureFormat.Enum.rgba16s,
|
||||||
rgba32i = bgfx.fakeenum.TextureFormat.Enum.rgba32i,
|
rgba32i = bgfx.impl.TextureFormat.Enum.rgba32i,
|
||||||
rgba32u = bgfx.fakeenum.TextureFormat.Enum.rgba32u,
|
rgba32u = bgfx.impl.TextureFormat.Enum.rgba32u,
|
||||||
rgba32f = bgfx.fakeenum.TextureFormat.Enum.rgba32f,
|
rgba32f = bgfx.impl.TextureFormat.Enum.rgba32f,
|
||||||
b5g6r5 = bgfx.fakeenum.TextureFormat.Enum.b5g6r5,
|
b5g6r5 = bgfx.impl.TextureFormat.Enum.b5g6r5,
|
||||||
r5g6b5 = bgfx.fakeenum.TextureFormat.Enum.r5g6b5,
|
r5g6b5 = bgfx.impl.TextureFormat.Enum.r5g6b5,
|
||||||
bgra4 = bgfx.fakeenum.TextureFormat.Enum.bgra4,
|
bgra4 = bgfx.impl.TextureFormat.Enum.bgra4,
|
||||||
rgba4 = bgfx.fakeenum.TextureFormat.Enum.rgba4,
|
rgba4 = bgfx.impl.TextureFormat.Enum.rgba4,
|
||||||
bgr5a1 = bgfx.fakeenum.TextureFormat.Enum.bgr5a1,
|
bgr5a1 = bgfx.impl.TextureFormat.Enum.bgr5a1,
|
||||||
rgb5a1 = bgfx.fakeenum.TextureFormat.Enum.rgb5a1,
|
rgb5a1 = bgfx.impl.TextureFormat.Enum.rgb5a1,
|
||||||
rgb10a2 = bgfx.fakeenum.TextureFormat.Enum.rgb10a2,
|
rgb10a2 = bgfx.impl.TextureFormat.Enum.rgb10a2,
|
||||||
rg11b10f = bgfx.fakeenum.TextureFormat.Enum.rg11b10f,
|
rg11b10f = bgfx.impl.TextureFormat.Enum.rg11b10f,
|
||||||
unknownDepth = bgfx.fakeenum.TextureFormat.Enum.unknownDepth,
|
unknownDepth = bgfx.impl.TextureFormat.Enum.unknownDepth,
|
||||||
d16 = bgfx.fakeenum.TextureFormat.Enum.d16,
|
d16 = bgfx.impl.TextureFormat.Enum.d16,
|
||||||
d24 = bgfx.fakeenum.TextureFormat.Enum.d24,
|
d24 = bgfx.impl.TextureFormat.Enum.d24,
|
||||||
d24s8 = bgfx.fakeenum.TextureFormat.Enum.d24s8,
|
d24s8 = bgfx.impl.TextureFormat.Enum.d24s8,
|
||||||
d32 = bgfx.fakeenum.TextureFormat.Enum.d32,
|
d32 = bgfx.impl.TextureFormat.Enum.d32,
|
||||||
d16f = bgfx.fakeenum.TextureFormat.Enum.d16f,
|
d16f = bgfx.impl.TextureFormat.Enum.d16f,
|
||||||
d24f = bgfx.fakeenum.TextureFormat.Enum.d24f,
|
d24f = bgfx.impl.TextureFormat.Enum.d24f,
|
||||||
d32f = bgfx.fakeenum.TextureFormat.Enum.d32f,
|
d32f = bgfx.impl.TextureFormat.Enum.d32f,
|
||||||
d0s8 = bgfx.fakeenum.TextureFormat.Enum.d0s8,
|
d0s8 = bgfx.impl.TextureFormat.Enum.d0s8,
|
||||||
count = bgfx.fakeenum.TextureFormat.Enum.count,
|
count = bgfx.impl.TextureFormat.Enum.count,
|
||||||
}
|
}
|
||||||
|
|
||||||
///Uniform type enum.
|
///Uniform type enum.
|
||||||
enum UniformType: bgfx.fakeenum.UniformType.Enum{
|
enum UniformType: bgfx.impl.UniformType.Enum{
|
||||||
sampler = bgfx.fakeenum.UniformType.Enum.sampler,
|
sampler = bgfx.impl.UniformType.Enum.sampler,
|
||||||
end = bgfx.fakeenum.UniformType.Enum.end,
|
end = bgfx.impl.UniformType.Enum.end,
|
||||||
vec4 = bgfx.fakeenum.UniformType.Enum.vec4,
|
vec4 = bgfx.impl.UniformType.Enum.vec4,
|
||||||
mat3 = bgfx.fakeenum.UniformType.Enum.mat3,
|
mat3 = bgfx.impl.UniformType.Enum.mat3,
|
||||||
mat4 = bgfx.fakeenum.UniformType.Enum.mat4,
|
mat4 = bgfx.impl.UniformType.Enum.mat4,
|
||||||
count = bgfx.fakeenum.UniformType.Enum.count,
|
count = bgfx.impl.UniformType.Enum.count,
|
||||||
}
|
}
|
||||||
|
|
||||||
///Backbuffer ratio enum.
|
///Backbuffer ratio enum.
|
||||||
enum BackbufferRatio: bgfx.fakeenum.BackbufferRatio.Enum{
|
enum BackbufferRatio: bgfx.impl.BackbufferRatio.Enum{
|
||||||
equal = bgfx.fakeenum.BackbufferRatio.Enum.equal,
|
equal = bgfx.impl.BackbufferRatio.Enum.equal,
|
||||||
half = bgfx.fakeenum.BackbufferRatio.Enum.half,
|
half = bgfx.impl.BackbufferRatio.Enum.half,
|
||||||
quarter = bgfx.fakeenum.BackbufferRatio.Enum.quarter,
|
quarter = bgfx.impl.BackbufferRatio.Enum.quarter,
|
||||||
eighth = bgfx.fakeenum.BackbufferRatio.Enum.eighth,
|
eighth = bgfx.impl.BackbufferRatio.Enum.eighth,
|
||||||
sixteenth = bgfx.fakeenum.BackbufferRatio.Enum.sixteenth,
|
sixteenth = bgfx.impl.BackbufferRatio.Enum.sixteenth,
|
||||||
double_ = bgfx.fakeenum.BackbufferRatio.Enum.double_,
|
double_ = bgfx.impl.BackbufferRatio.Enum.double_,
|
||||||
count = bgfx.fakeenum.BackbufferRatio.Enum.count,
|
count = bgfx.impl.BackbufferRatio.Enum.count,
|
||||||
}
|
}
|
||||||
|
|
||||||
///Occlusion query result.
|
///Occlusion query result.
|
||||||
enum OcclusionQueryResult: bgfx.fakeenum.OcclusionQueryResult.Enum{
|
enum OcclusionQueryResult: bgfx.impl.OcclusionQueryResult.Enum{
|
||||||
invisible = bgfx.fakeenum.OcclusionQueryResult.Enum.invisible,
|
invisible = bgfx.impl.OcclusionQueryResult.Enum.invisible,
|
||||||
visible = bgfx.fakeenum.OcclusionQueryResult.Enum.visible,
|
visible = bgfx.impl.OcclusionQueryResult.Enum.visible,
|
||||||
noResult = bgfx.fakeenum.OcclusionQueryResult.Enum.noResult,
|
noResult = bgfx.impl.OcclusionQueryResult.Enum.noResult,
|
||||||
count = bgfx.fakeenum.OcclusionQueryResult.Enum.count,
|
count = bgfx.impl.OcclusionQueryResult.Enum.count,
|
||||||
}
|
}
|
||||||
|
|
||||||
///Primitive topology.
|
///Primitive topology.
|
||||||
enum Topology: bgfx.fakeenum.Topology.Enum{
|
enum Topology: bgfx.impl.Topology.Enum{
|
||||||
triList = bgfx.fakeenum.Topology.Enum.triList,
|
triList = bgfx.impl.Topology.Enum.triList,
|
||||||
triStrip = bgfx.fakeenum.Topology.Enum.triStrip,
|
triStrip = bgfx.impl.Topology.Enum.triStrip,
|
||||||
lineList = bgfx.fakeenum.Topology.Enum.lineList,
|
lineList = bgfx.impl.Topology.Enum.lineList,
|
||||||
lineStrip = bgfx.fakeenum.Topology.Enum.lineStrip,
|
lineStrip = bgfx.impl.Topology.Enum.lineStrip,
|
||||||
pointList = bgfx.fakeenum.Topology.Enum.pointList,
|
pointList = bgfx.impl.Topology.Enum.pointList,
|
||||||
count = bgfx.fakeenum.Topology.Enum.count,
|
count = bgfx.impl.Topology.Enum.count,
|
||||||
}
|
}
|
||||||
|
|
||||||
///Topology conversion function.
|
///Topology conversion function.
|
||||||
enum TopologyConvert: bgfx.fakeenum.TopologyConvert.Enum{
|
enum TopologyConvert: bgfx.impl.TopologyConvert.Enum{
|
||||||
triListFlipWinding = bgfx.fakeenum.TopologyConvert.Enum.triListFlipWinding,
|
triListFlipWinding = bgfx.impl.TopologyConvert.Enum.triListFlipWinding,
|
||||||
triStripFlipWinding = bgfx.fakeenum.TopologyConvert.Enum.triStripFlipWinding,
|
triStripFlipWinding = bgfx.impl.TopologyConvert.Enum.triStripFlipWinding,
|
||||||
triListToLineList = bgfx.fakeenum.TopologyConvert.Enum.triListToLineList,
|
triListToLineList = bgfx.impl.TopologyConvert.Enum.triListToLineList,
|
||||||
triStripToTriList = bgfx.fakeenum.TopologyConvert.Enum.triStripToTriList,
|
triStripToTriList = bgfx.impl.TopologyConvert.Enum.triStripToTriList,
|
||||||
lineStripToLineList = bgfx.fakeenum.TopologyConvert.Enum.lineStripToLineList,
|
lineStripToLineList = bgfx.impl.TopologyConvert.Enum.lineStripToLineList,
|
||||||
count = bgfx.fakeenum.TopologyConvert.Enum.count,
|
count = bgfx.impl.TopologyConvert.Enum.count,
|
||||||
}
|
}
|
||||||
|
|
||||||
///Topology sort order.
|
///Topology sort order.
|
||||||
enum TopologySort: bgfx.fakeenum.TopologySort.Enum{
|
enum TopologySort: bgfx.impl.TopologySort.Enum{
|
||||||
directionFrontToBackMin = bgfx.fakeenum.TopologySort.Enum.directionFrontToBackMin,
|
directionFrontToBackMin = bgfx.impl.TopologySort.Enum.directionFrontToBackMin,
|
||||||
directionFrontToBackAvg = bgfx.fakeenum.TopologySort.Enum.directionFrontToBackAvg,
|
directionFrontToBackAvg = bgfx.impl.TopologySort.Enum.directionFrontToBackAvg,
|
||||||
directionFrontToBackMax = bgfx.fakeenum.TopologySort.Enum.directionFrontToBackMax,
|
directionFrontToBackMax = bgfx.impl.TopologySort.Enum.directionFrontToBackMax,
|
||||||
directionBackToFrontMin = bgfx.fakeenum.TopologySort.Enum.directionBackToFrontMin,
|
directionBackToFrontMin = bgfx.impl.TopologySort.Enum.directionBackToFrontMin,
|
||||||
directionBackToFrontAvg = bgfx.fakeenum.TopologySort.Enum.directionBackToFrontAvg,
|
directionBackToFrontAvg = bgfx.impl.TopologySort.Enum.directionBackToFrontAvg,
|
||||||
directionBackToFrontMax = bgfx.fakeenum.TopologySort.Enum.directionBackToFrontMax,
|
directionBackToFrontMax = bgfx.impl.TopologySort.Enum.directionBackToFrontMax,
|
||||||
distanceFrontToBackMin = bgfx.fakeenum.TopologySort.Enum.distanceFrontToBackMin,
|
distanceFrontToBackMin = bgfx.impl.TopologySort.Enum.distanceFrontToBackMin,
|
||||||
distanceFrontToBackAvg = bgfx.fakeenum.TopologySort.Enum.distanceFrontToBackAvg,
|
distanceFrontToBackAvg = bgfx.impl.TopologySort.Enum.distanceFrontToBackAvg,
|
||||||
distanceFrontToBackMax = bgfx.fakeenum.TopologySort.Enum.distanceFrontToBackMax,
|
distanceFrontToBackMax = bgfx.impl.TopologySort.Enum.distanceFrontToBackMax,
|
||||||
distanceBackToFrontMin = bgfx.fakeenum.TopologySort.Enum.distanceBackToFrontMin,
|
distanceBackToFrontMin = bgfx.impl.TopologySort.Enum.distanceBackToFrontMin,
|
||||||
distanceBackToFrontAvg = bgfx.fakeenum.TopologySort.Enum.distanceBackToFrontAvg,
|
distanceBackToFrontAvg = bgfx.impl.TopologySort.Enum.distanceBackToFrontAvg,
|
||||||
distanceBackToFrontMax = bgfx.fakeenum.TopologySort.Enum.distanceBackToFrontMax,
|
distanceBackToFrontMax = bgfx.impl.TopologySort.Enum.distanceBackToFrontMax,
|
||||||
count = bgfx.fakeenum.TopologySort.Enum.count,
|
count = bgfx.impl.TopologySort.Enum.count,
|
||||||
}
|
}
|
||||||
|
|
||||||
///View mode sets draw call sort order.
|
///View mode sets draw call sort order.
|
||||||
enum ViewMode: bgfx.fakeenum.ViewMode.Enum{
|
enum ViewMode: bgfx.impl.ViewMode.Enum{
|
||||||
default_ = bgfx.fakeenum.ViewMode.Enum.default_,
|
default_ = bgfx.impl.ViewMode.Enum.default_,
|
||||||
sequential = bgfx.fakeenum.ViewMode.Enum.sequential,
|
sequential = bgfx.impl.ViewMode.Enum.sequential,
|
||||||
depthAscending = bgfx.fakeenum.ViewMode.Enum.depthAscending,
|
depthAscending = bgfx.impl.ViewMode.Enum.depthAscending,
|
||||||
depthDescending = bgfx.fakeenum.ViewMode.Enum.depthDescending,
|
depthDescending = bgfx.impl.ViewMode.Enum.depthDescending,
|
||||||
count = bgfx.fakeenum.ViewMode.Enum.count,
|
count = bgfx.impl.ViewMode.Enum.count,
|
||||||
}
|
}
|
||||||
|
|
||||||
///Native window handle type.
|
///Native window handle type.
|
||||||
enum NativeWindowHandleType: bgfx.fakeenum.NativeWindowHandleType.Enum{
|
enum NativeWindowHandleType: bgfx.impl.NativeWindowHandleType.Enum{
|
||||||
default_ = bgfx.fakeenum.NativeWindowHandleType.Enum.default_,
|
default_ = bgfx.impl.NativeWindowHandleType.Enum.default_,
|
||||||
wayland = bgfx.fakeenum.NativeWindowHandleType.Enum.wayland,
|
wayland = bgfx.impl.NativeWindowHandleType.Enum.wayland,
|
||||||
count = bgfx.fakeenum.NativeWindowHandleType.Enum.count,
|
count = bgfx.impl.NativeWindowHandleType.Enum.count,
|
||||||
}
|
}
|
||||||
|
|
||||||
///Render frame enum.
|
///Render frame enum.
|
||||||
enum RenderFrame: bgfx.fakeenum.RenderFrame.Enum{
|
enum RenderFrame: bgfx.impl.RenderFrame.Enum{
|
||||||
noContext = bgfx.fakeenum.RenderFrame.Enum.noContext,
|
noContext = bgfx.impl.RenderFrame.Enum.noContext,
|
||||||
render = bgfx.fakeenum.RenderFrame.Enum.render,
|
render = bgfx.impl.RenderFrame.Enum.render,
|
||||||
timeout = bgfx.fakeenum.RenderFrame.Enum.timeout,
|
timeout = bgfx.impl.RenderFrame.Enum.timeout,
|
||||||
exiting = bgfx.fakeenum.RenderFrame.Enum.exiting,
|
exiting = bgfx.impl.RenderFrame.Enum.exiting,
|
||||||
count = bgfx.fakeenum.RenderFrame.Enum.count,
|
count = bgfx.impl.RenderFrame.Enum.count,
|
||||||
}
|
}
|
||||||
|
|
||||||
extern(C++, "bgfx") struct DynamicIndexBufferHandle{
|
extern(C++, "bgfx") struct DynamicIndexBufferHandle{
|
||||||
@@ -900,61 +899,82 @@ extern(C++, "bgfx") struct VertexLayoutHandle{
|
|||||||
ushort idx;
|
ushort idx;
|
||||||
}
|
}
|
||||||
|
|
||||||
pragma(inline,true) nothrow @nogc pure @safe{
|
pragma(inline,true) nothrow @nogc{
|
||||||
|
/**
|
||||||
|
Allocate a buffer to pass to bgfx. Data will be freed inside bgfx.
|
||||||
|
Params:
|
||||||
|
size = Size to allocate.
|
||||||
|
*/
|
||||||
|
MemoryRef alloc(uint size){
|
||||||
|
auto mem = bgfx.impl.alloc(__traits(parameters));
|
||||||
|
return MemoryRef(cast(ubyte[])mem.data[0..mem.size], mem);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
Allocate a buffer to pass to bgfx and copy `data` into it. Data will be freed inside bgfx.
|
||||||
|
Params:
|
||||||
|
data = Pointer to data to be copied.
|
||||||
|
size = Size of data to be copied.
|
||||||
|
*/
|
||||||
|
MemoryRef copy(const(void)* data, uint size){
|
||||||
|
auto mem = bgfx.impl.copy(__traits(parameters));
|
||||||
|
return MemoryRef(cast(ubyte[])mem.data[0..mem.size], mem);
|
||||||
|
}
|
||||||
|
|
||||||
|
pure @safe:
|
||||||
StateBlend_ blendFuncSeparate(StateBlend_ srcRGB, StateBlend_ dstRGB, StateBlend_ srcA, StateBlend_ dstA){
|
StateBlend_ blendFuncSeparate(StateBlend_ srcRGB, StateBlend_ dstRGB, StateBlend_ srcA, StateBlend_ dstA){
|
||||||
return (srcRGB | ((dstRGB) << 4)) | ((srcA | (dstA << 4)) << 8);
|
return (srcRGB | ((dstRGB) << 4)) | ((srcA | (dstA << 4)) << 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
///Blend equation separate.
|
///Blend equation separate.
|
||||||
StateBlendEquation_ blendEquationSeparate(StateBlendEquation_ equationRGB, StateBlendEquation_ equationA){
|
StateBlendEquation_ blendEquationSeparate(StateBlendEquation_ equationRGB, StateBlendEquation_ equationA){
|
||||||
return equationRGB | (equationA << 3);
|
return equationRGB | (equationA << 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
///Blend function.
|
///Blend function.
|
||||||
StateBlend_ blendFunc(StateBlend_ src, StateBlend_ dst){ return blendFuncSeparate(src, dst, src, dst); }
|
StateBlend_ blendFunc(StateBlend_ src, StateBlend_ dst){ return blendFuncSeparate(src, dst, src, dst); }
|
||||||
|
|
||||||
///Blend equation.
|
///Blend equation.
|
||||||
StateBlendEquation_ blendEquation(StateBlendEquation_ equation){ return blendEquationSeparate(equation, equation); }
|
StateBlendEquation_ blendEquation(StateBlendEquation_ equation){ return blendEquationSeparate(equation, equation); }
|
||||||
|
|
||||||
///Utility predefined blend modes.
|
///Utility predefined blend modes.
|
||||||
enum StateBlendFunc: StateBlend_{
|
enum StateBlendFunc: StateBlend_{
|
||||||
///Additive blending.
|
///Additive blending.
|
||||||
add = blendFunc(StateBlend.one, StateBlend.one),
|
add = blendFunc(StateBlend.one, StateBlend.one),
|
||||||
|
|
||||||
///Alpha blend.
|
///Alpha blend.
|
||||||
alpha = blendFunc(StateBlend.srcAlpha, StateBlend.invSrcAlpha),
|
alpha = blendFunc(StateBlend.srcAlpha, StateBlend.invSrcAlpha),
|
||||||
|
|
||||||
///Selects darker color of blend.
|
///Selects darker color of blend.
|
||||||
darken = blendFunc(StateBlend.one, StateBlend.one) | blendEquation(StateBlendEquation.min),
|
darken = blendFunc(StateBlend.one, StateBlend.one) | blendEquation(StateBlendEquation.min),
|
||||||
|
|
||||||
///Selects lighter color of blend.
|
///Selects lighter color of blend.
|
||||||
lighten = blendFunc(StateBlend.one, StateBlend.one) | blendEquation(StateBlendEquation.max),
|
lighten = blendFunc(StateBlend.one, StateBlend.one) | blendEquation(StateBlendEquation.max),
|
||||||
|
|
||||||
///Multiplies colors.
|
///Multiplies colors.
|
||||||
multiply = blendFunc(StateBlend.dstColor, StateBlend.zero),
|
multiply = blendFunc(StateBlend.dstColor, StateBlend.zero),
|
||||||
|
|
||||||
///Opaque pixels will cover the pixels directly below them without any math or algorithm applied to them.
|
///Opaque pixels will cover the pixels directly below them without any math or algorithm applied to them.
|
||||||
normal = blendFunc(StateBlend.one, StateBlend.invSrcAlpha),
|
normal = blendFunc(StateBlend.one, StateBlend.invSrcAlpha),
|
||||||
|
|
||||||
///Multiplies the inverse of the blend and base colors.
|
///Multiplies the inverse of the blend and base colors.
|
||||||
screen = blendFunc(StateBlend.one, StateBlend.invSrcColor),
|
screen = blendFunc(StateBlend.one, StateBlend.invSrcColor),
|
||||||
|
|
||||||
///Decreases the brightness of the base color based on the value of the blend color.
|
///Decreases the brightness of the base color based on the value of the blend color.
|
||||||
linearBurn = blendFunc(StateBlend.dstColor, StateBlend.invDstColor) | blendEquation(StateBlendEquation.sub),
|
linearBurn = blendFunc(StateBlend.dstColor, StateBlend.invDstColor) | blendEquation(StateBlendEquation.sub),
|
||||||
}
|
}
|
||||||
|
|
||||||
StateBlend_ blendFuncRTx(StateBlend_ src, StateBlend_ dst){
|
StateBlend_ blendFuncRTx(StateBlend_ src, StateBlend_ dst){
|
||||||
return cast(uint)(src >> StateBlend.shift) | (cast(uint)(dst >> StateBlend.shift) << 4);
|
return cast(uint)(src >> StateBlend.shift) | (cast(uint)(dst >> StateBlend.shift) << 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
StateBlend_ blendFuncRTxE(StateBlend_ src, StateBlend_ dst, StateBlendEquation_ equation){
|
StateBlend_ blendFuncRTxE(StateBlend_ src, StateBlend_ dst, StateBlendEquation_ equation){
|
||||||
return blendFuncRTx(src, dst) | (cast(uint)(equation >> StateBlendEquation.shift) << 8);
|
return blendFuncRTx(src, dst) | (cast(uint)(equation >> StateBlendEquation.shift) << 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
StateBlend_ blendFuncRT1(StateBlend_ src, StateBlend_ dst){ return blendFuncRTx(src, dst) << 0; }
|
StateBlend_ blendFuncRT1(StateBlend_ src, StateBlend_ dst){ return blendFuncRTx(src, dst) << 0; }
|
||||||
StateBlend_ blendFuncRT2(StateBlend_ src, StateBlend_ dst){ return blendFuncRTx(src, dst) << 11; }
|
StateBlend_ blendFuncRT2(StateBlend_ src, StateBlend_ dst){ return blendFuncRTx(src, dst) << 11; }
|
||||||
StateBlend_ blendFuncRT3(StateBlend_ src, StateBlend_ dst){ return blendFuncRTx(src, dst) << 22; }
|
StateBlend_ blendFuncRT3(StateBlend_ src, StateBlend_ dst){ return blendFuncRTx(src, dst) << 22; }
|
||||||
|
|
||||||
StateBlend_ blendFuncRT1E(StateBlend_ src, StateBlend_ dst, StateBlendEquation_ equation){
|
StateBlend_ blendFuncRT1E(StateBlend_ src, StateBlend_ dst, StateBlendEquation_ equation){
|
||||||
return blendFuncRTxE(src, dst, equation) << 0;
|
return blendFuncRTxE(src, dst, equation) << 0;
|
||||||
}
|
}
|
||||||
@@ -966,6 +986,16 @@ pragma(inline,true) nothrow @nogc pure @safe{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
A wrapper around `Memory` that allows you to mutate its `data`.
|
||||||
|
Do not create instances of this struct yourself.
|
||||||
|
*/
|
||||||
|
struct MemoryRef{
|
||||||
|
ubyte[] data;
|
||||||
|
const(Memory)* memory;
|
||||||
|
alias memory this;
|
||||||
|
}
|
||||||
|
|
||||||
///Renderer capabilities.
|
///Renderer capabilities.
|
||||||
extern(C++, "bgfx") struct Caps{
|
extern(C++, "bgfx") struct Caps{
|
||||||
///GPU info.
|
///GPU info.
|
||||||
@@ -1243,7 +1273,7 @@ extern(C++, "bgfx") struct Attachment{
|
|||||||
mip = Mip level.
|
mip = Mip level.
|
||||||
resolve = Resolve flags. See: `BGFX_RESOLVE_*`
|
resolve = Resolve flags. See: `BGFX_RESOLVE_*`
|
||||||
*/
|
*/
|
||||||
{q{void}, q{init}, q{TextureHandle handle, bgfx.fakeenum.Access.Enum access=Access.write, ushort layer=0, ushort numLayers=1, ushort mip=0, ubyte resolve=Resolve.autoGenMIPs}, ext: `C++`},
|
{q{void}, q{init}, q{TextureHandle handle, bgfx.impl.Access.Enum access=Access.write, ushort layer=0, ushort numLayers=1, ushort mip=0, ubyte resolve=Resolve.autoGenMIPs}, ext: `C++`},
|
||||||
];
|
];
|
||||||
return ret;
|
return ret;
|
||||||
}()));
|
}()));
|
||||||
@@ -1335,7 +1365,7 @@ extern(C++, "bgfx") struct VertexLayout{
|
|||||||
Params:
|
Params:
|
||||||
rendererType = Renderer backend type. See: `bgfx::RendererType`
|
rendererType = Renderer backend type. See: `bgfx::RendererType`
|
||||||
*/
|
*/
|
||||||
{q{VertexLayout*}, q{begin}, q{bgfx.fakeenum.RendererType.Enum rendererType=RendererType.noop}, ext: `C++`},
|
{q{VertexLayout*}, q{begin}, q{bgfx.impl.RendererType.Enum rendererType=RendererType.noop}, ext: `C++`},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Add attribute to VertexLayout.
|
Add attribute to VertexLayout.
|
||||||
@@ -1352,7 +1382,7 @@ extern(C++, "bgfx") struct VertexLayout{
|
|||||||
vertexConvert for AttribType::Uint8 and AttribType::Int16.
|
vertexConvert for AttribType::Uint8 and AttribType::Int16.
|
||||||
Unpacking code must be implemented inside vertex shader.
|
Unpacking code must be implemented inside vertex shader.
|
||||||
*/
|
*/
|
||||||
{q{VertexLayout*}, q{add}, q{bgfx.fakeenum.Attrib.Enum attrib, ubyte num, bgfx.fakeenum.AttribType.Enum type, bool normalised=false, bool asInt=false}, ext: `C++`},
|
{q{VertexLayout*}, q{add}, q{bgfx.impl.Attrib.Enum attrib, ubyte num, bgfx.impl.AttribType.Enum type, bool normalised=false, bool asInt=false}, ext: `C++`},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Decode attribute.
|
Decode attribute.
|
||||||
@@ -1363,7 +1393,7 @@ extern(C++, "bgfx") struct VertexLayout{
|
|||||||
normalised = Attribute is normalized.
|
normalised = Attribute is normalized.
|
||||||
asInt = Attribute is packed as int.
|
asInt = Attribute is packed as int.
|
||||||
*/
|
*/
|
||||||
{q{void}, q{decode}, q{bgfx.fakeenum.Attrib.Enum attrib, ref ubyte num, ref bgfx.fakeenum.AttribType.Enum type, ref bool normalised, ref bool asInt}, ext: `C++`, memAttr: q{const}},
|
{q{void}, q{decode}, q{bgfx.impl.Attrib.Enum attrib, ref ubyte num, ref bgfx.impl.AttribType.Enum type, ref bool normalised, ref bool asInt}, ext: `C++`, memAttr: q{const}},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Skip `_num` bytes in vertex stream.
|
Skip `_num` bytes in vertex stream.
|
||||||
@@ -1736,7 +1766,7 @@ extern(C++, "bgfx") struct Encoder{
|
|||||||
handle = Index buffer handle.
|
handle = Index buffer handle.
|
||||||
access = Buffer access. See `Access::Enum`.
|
access = Buffer access. See `Access::Enum`.
|
||||||
*/
|
*/
|
||||||
{q{void}, q{setBuffer}, q{ubyte stage, IndexBufferHandle handle, bgfx.fakeenum.Access.Enum access}, ext: `C++`},
|
{q{void}, q{setBuffer}, q{ubyte stage, IndexBufferHandle handle, bgfx.impl.Access.Enum access}, ext: `C++`},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Set compute vertex buffer.
|
Set compute vertex buffer.
|
||||||
@@ -1745,7 +1775,7 @@ extern(C++, "bgfx") struct Encoder{
|
|||||||
handle = Vertex buffer handle.
|
handle = Vertex buffer handle.
|
||||||
access = Buffer access. See `Access::Enum`.
|
access = Buffer access. See `Access::Enum`.
|
||||||
*/
|
*/
|
||||||
{q{void}, q{setBuffer}, q{ubyte stage, VertexBufferHandle handle, bgfx.fakeenum.Access.Enum access}, ext: `C++`},
|
{q{void}, q{setBuffer}, q{ubyte stage, VertexBufferHandle handle, bgfx.impl.Access.Enum access}, ext: `C++`},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Set compute dynamic index buffer.
|
Set compute dynamic index buffer.
|
||||||
@@ -1754,7 +1784,7 @@ extern(C++, "bgfx") struct Encoder{
|
|||||||
handle = Dynamic index buffer handle.
|
handle = Dynamic index buffer handle.
|
||||||
access = Buffer access. See `Access::Enum`.
|
access = Buffer access. See `Access::Enum`.
|
||||||
*/
|
*/
|
||||||
{q{void}, q{setBuffer}, q{ubyte stage, DynamicIndexBufferHandle handle, bgfx.fakeenum.Access.Enum access}, ext: `C++`},
|
{q{void}, q{setBuffer}, q{ubyte stage, DynamicIndexBufferHandle handle, bgfx.impl.Access.Enum access}, ext: `C++`},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Set compute dynamic vertex buffer.
|
Set compute dynamic vertex buffer.
|
||||||
@@ -1763,7 +1793,7 @@ extern(C++, "bgfx") struct Encoder{
|
|||||||
handle = Dynamic vertex buffer handle.
|
handle = Dynamic vertex buffer handle.
|
||||||
access = Buffer access. See `Access::Enum`.
|
access = Buffer access. See `Access::Enum`.
|
||||||
*/
|
*/
|
||||||
{q{void}, q{setBuffer}, q{ubyte stage, DynamicVertexBufferHandle handle, bgfx.fakeenum.Access.Enum access}, ext: `C++`},
|
{q{void}, q{setBuffer}, q{ubyte stage, DynamicVertexBufferHandle handle, bgfx.impl.Access.Enum access}, ext: `C++`},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Set compute indirect buffer.
|
Set compute indirect buffer.
|
||||||
@@ -1772,7 +1802,7 @@ extern(C++, "bgfx") struct Encoder{
|
|||||||
handle = Indirect buffer handle.
|
handle = Indirect buffer handle.
|
||||||
access = Buffer access. See `Access::Enum`.
|
access = Buffer access. See `Access::Enum`.
|
||||||
*/
|
*/
|
||||||
{q{void}, q{setBuffer}, q{ubyte stage, IndirectBufferHandle handle, bgfx.fakeenum.Access.Enum access}, ext: `C++`},
|
{q{void}, q{setBuffer}, q{ubyte stage, IndirectBufferHandle handle, bgfx.impl.Access.Enum access}, ext: `C++`},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Set compute image from texture.
|
Set compute image from texture.
|
||||||
@@ -1783,7 +1813,7 @@ extern(C++, "bgfx") struct Encoder{
|
|||||||
access = Image access. See `Access::Enum`.
|
access = Image access. See `Access::Enum`.
|
||||||
format = Texture format. See: `TextureFormat::Enum`.
|
format = Texture format. See: `TextureFormat::Enum`.
|
||||||
*/
|
*/
|
||||||
{q{void}, q{setImage}, q{ubyte stage, TextureHandle handle, ubyte mip, bgfx.fakeenum.Access.Enum access, bgfx.fakeenum.TextureFormat.Enum format=TextureFormat.count}, ext: `C++`},
|
{q{void}, q{setImage}, q{ubyte stage, TextureHandle handle, ubyte mip, bgfx.impl.Access.Enum access, bgfx.impl.TextureFormat.Enum format=TextureFormat.count}, ext: `C++`},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Dispatch compute.
|
Dispatch compute.
|
||||||
@@ -1876,7 +1906,7 @@ mixin(joinFnBinds((){
|
|||||||
data = Destination vertex stream where data will be packed.
|
data = Destination vertex stream where data will be packed.
|
||||||
index = Vertex index that will be modified.
|
index = Vertex index that will be modified.
|
||||||
*/
|
*/
|
||||||
{q{void}, q{vertexPack}, q{const(float)* input, bool inputNormalised, bgfx.fakeenum.Attrib.Enum attr, ref const VertexLayout layout, void* data, uint index=0}, ext: `C++, "bgfx"`},
|
{q{void}, q{vertexPack}, q{const(float)* input, bool inputNormalised, bgfx.impl.Attrib.Enum attr, ref const VertexLayout layout, void* data, uint index=0}, ext: `C++, "bgfx"`},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unpack vertex attribute from vertex stream format.
|
* Unpack vertex attribute from vertex stream format.
|
||||||
@@ -1887,7 +1917,7 @@ mixin(joinFnBinds((){
|
|||||||
data = Source vertex stream from where data will be unpacked.
|
data = Source vertex stream from where data will be unpacked.
|
||||||
index = Vertex index that will be unpacked.
|
index = Vertex index that will be unpacked.
|
||||||
*/
|
*/
|
||||||
{q{void}, q{vertexUnpack}, q{float* output, bgfx.fakeenum.Attrib.Enum attr, ref const VertexLayout layout, const(void)* data, uint index=0}, ext: `C++, "bgfx"`},
|
{q{void}, q{vertexUnpack}, q{float* output, bgfx.impl.Attrib.Enum attr, ref const VertexLayout layout, const(void)* data, uint index=0}, ext: `C++, "bgfx"`},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts vertex stream data from one vertex stream format to another.
|
* Converts vertex stream data from one vertex stream format to another.
|
||||||
@@ -1926,7 +1956,7 @@ mixin(joinFnBinds((){
|
|||||||
numIndices = Number of input indices.
|
numIndices = Number of input indices.
|
||||||
index32 = Set to `true` if input indices are 32-bit.
|
index32 = Set to `true` if input indices are 32-bit.
|
||||||
*/
|
*/
|
||||||
{q{uint}, q{topologyConvert}, q{bgfx.fakeenum.TopologyConvert.Enum conversion, void* dst, uint dstSize, const(void)* indices, uint numIndices, bool index32}, ext: `C++, "bgfx"`},
|
{q{uint}, q{topologyConvert}, q{bgfx.impl.TopologyConvert.Enum conversion, void* dst, uint dstSize, const(void)* indices, uint numIndices, bool index32}, ext: `C++, "bgfx"`},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sort indices.
|
* Sort indices.
|
||||||
@@ -1946,7 +1976,7 @@ mixin(joinFnBinds((){
|
|||||||
numIndices = Number of input indices.
|
numIndices = Number of input indices.
|
||||||
index32 = Set to `true` if input indices are 32-bit.
|
index32 = Set to `true` if input indices are 32-bit.
|
||||||
*/
|
*/
|
||||||
{q{void}, q{topologySortTriList}, q{bgfx.fakeenum.TopologySort.Enum sort, void* dst, uint dstSize, const(float)* dir, const(float)* pos, const(void)* vertices, uint stride, const(void)* indices, uint numIndices, bool index32}, ext: `C++, "bgfx"`},
|
{q{void}, q{topologySortTriList}, q{bgfx.impl.TopologySort.Enum sort, void* dst, uint dstSize, const(float)* dir, const(float)* pos, const(void)* vertices, uint stride, const(void)* indices, uint numIndices, bool index32}, ext: `C++, "bgfx"`},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns supported backend API renderers.
|
* Returns supported backend API renderers.
|
||||||
@@ -1954,14 +1984,14 @@ mixin(joinFnBinds((){
|
|||||||
max = Maximum number of elements in _enum array.
|
max = Maximum number of elements in _enum array.
|
||||||
enum_ = Array where supported renderers will be written.
|
enum_ = Array where supported renderers will be written.
|
||||||
*/
|
*/
|
||||||
{q{ubyte}, q{getSupportedRenderers}, q{ubyte max=0, bgfx.fakeenum.RendererType.Enum* enum_=null}, ext: `C++, "bgfx"`},
|
{q{ubyte}, q{getSupportedRenderers}, q{ubyte max=0, bgfx.impl.RendererType.Enum* enum_=null}, ext: `C++, "bgfx"`},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns name of renderer.
|
* Returns name of renderer.
|
||||||
Params:
|
Params:
|
||||||
type = Renderer backend type. See: `bgfx::RendererType`
|
type = Renderer backend type. See: `bgfx::RendererType`
|
||||||
*/
|
*/
|
||||||
{q{const(char)*}, q{getRendererName}, q{bgfx.fakeenum.RendererType.Enum type}, ext: `C++, "bgfx"`},
|
{q{const(char)*}, q{getRendererName}, q{bgfx.impl.RendererType.Enum type}, ext: `C++, "bgfx"`},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize the bgfx library.
|
* Initialize the bgfx library.
|
||||||
@@ -1996,7 +2026,7 @@ mixin(joinFnBinds((){
|
|||||||
- `BGFX_RESET_SRGB_BACKBUFFER` - Enable sRGB back-buffer.
|
- `BGFX_RESET_SRGB_BACKBUFFER` - Enable sRGB back-buffer.
|
||||||
format = Texture format. See: `TextureFormat::Enum`.
|
format = Texture format. See: `TextureFormat::Enum`.
|
||||||
*/
|
*/
|
||||||
{q{void}, q{reset}, q{uint width, uint height, uint flags=Reset.none, bgfx.fakeenum.TextureFormat.Enum format=TextureFormat.count}, ext: `C++, "bgfx"`},
|
{q{void}, q{reset}, q{uint width, uint height, uint flags=Reset.none, bgfx.impl.TextureFormat.Enum format=TextureFormat.count}, ext: `C++, "bgfx"`},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Advance to next frame. When using multithreaded renderer, this call
|
* Advance to next frame. When using multithreaded renderer, this call
|
||||||
@@ -2027,21 +2057,6 @@ mixin(joinFnBinds((){
|
|||||||
*/
|
*/
|
||||||
{q{const(Stats)*}, q{getStats}, q{}, ext: `C++, "bgfx"`},
|
{q{const(Stats)*}, q{getStats}, q{}, ext: `C++, "bgfx"`},
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocate buffer to pass to bgfx calls. Data will be freed inside bgfx.
|
|
||||||
Params:
|
|
||||||
size = Size to allocate.
|
|
||||||
*/
|
|
||||||
{q{const(Memory)*}, q{alloc}, q{uint size}, ext: `C++, "bgfx"`},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocate buffer and copy data into it. Data will be freed inside bgfx.
|
|
||||||
Params:
|
|
||||||
data = Pointer to data to be copied.
|
|
||||||
size = Size of data to be copied.
|
|
||||||
*/
|
|
||||||
{q{const(Memory)*}, q{copy}, q{const(void)* data, uint size}, ext: `C++, "bgfx"`},
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Make reference to data to pass to bgfx. Unlike `bgfx::alloc`, this call
|
* Make reference to data to pass to bgfx. Unlike `bgfx::alloc`, this call
|
||||||
* doesn't allocate memory for data. It just copies the _data pointer. You
|
* doesn't allocate memory for data. It just copies the _data pointer. You
|
||||||
@@ -2472,7 +2487,7 @@ mixin(joinFnBinds((){
|
|||||||
format = Texture format. See: `TextureFormat::Enum`.
|
format = Texture format. See: `TextureFormat::Enum`.
|
||||||
flags = Texture flags. See `BGFX_TEXTURE_*`.
|
flags = Texture flags. See `BGFX_TEXTURE_*`.
|
||||||
*/
|
*/
|
||||||
{q{bool}, q{isTextureValid}, q{ushort depth, bool cubeMap, ushort numLayers, bgfx.fakeenum.TextureFormat.Enum format, c_uint64 flags}, ext: `C++, "bgfx"`},
|
{q{bool}, q{isTextureValid}, q{ushort depth, bool cubeMap, ushort numLayers, bgfx.impl.TextureFormat.Enum format, c_uint64 flags}, ext: `C++, "bgfx"`},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Validate frame buffer parameters.
|
* Validate frame buffer parameters.
|
||||||
@@ -2494,7 +2509,7 @@ mixin(joinFnBinds((){
|
|||||||
numLayers = Number of layers in texture array.
|
numLayers = Number of layers in texture array.
|
||||||
format = Texture format. See: `TextureFormat::Enum`.
|
format = Texture format. See: `TextureFormat::Enum`.
|
||||||
*/
|
*/
|
||||||
{q{void}, q{calcTextureSize}, q{ref TextureInfo info, ushort width, ushort height, ushort depth, bool cubeMap, bool hasMIPs, ushort numLayers, bgfx.fakeenum.TextureFormat.Enum format}, ext: `C++, "bgfx"`},
|
{q{void}, q{calcTextureSize}, q{ref TextureInfo info, ushort width, ushort height, ushort depth, bool cubeMap, bool hasMIPs, ushort numLayers, bgfx.impl.TextureFormat.Enum format}, ext: `C++, "bgfx"`},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create texture from memory buffer.
|
* Create texture from memory buffer.
|
||||||
@@ -2530,7 +2545,7 @@ mixin(joinFnBinds((){
|
|||||||
`_mem` is NULL content of the texture is uninitialized. When `_numLayers` is more than
|
`_mem` is NULL content of the texture is uninitialized. When `_numLayers` is more than
|
||||||
1, expected memory layout is texture and all mips together for each array element.
|
1, expected memory layout is texture and all mips together for each array element.
|
||||||
*/
|
*/
|
||||||
{q{TextureHandle}, q{createTexture2D}, q{ushort width, ushort height, bool hasMIPs, ushort numLayers, bgfx.fakeenum.TextureFormat.Enum format, c_uint64 flags=Texture.none|Sampler.none, const(Memory)* mem=null}, ext: `C++, "bgfx"`},
|
{q{TextureHandle}, q{createTexture2D}, q{ushort width, ushort height, bool hasMIPs, ushort numLayers, bgfx.impl.TextureFormat.Enum format, c_uint64 flags=Texture.none|Sampler.none, const(Memory)* mem=null}, ext: `C++, "bgfx"`},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create texture with size based on back-buffer ratio. Texture will maintain ratio
|
* Create texture with size based on back-buffer ratio. Texture will maintain ratio
|
||||||
@@ -2548,7 +2563,7 @@ mixin(joinFnBinds((){
|
|||||||
- `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic
|
- `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic
|
||||||
sampling.
|
sampling.
|
||||||
*/
|
*/
|
||||||
{q{TextureHandle}, q{createTexture2D}, q{bgfx.fakeenum.BackbufferRatio.Enum ratio, bool hasMIPs, ushort numLayers, bgfx.fakeenum.TextureFormat.Enum format, c_uint64 flags=Texture.none|Sampler.none}, ext: `C++, "bgfx"`},
|
{q{TextureHandle}, q{createTexture2D}, q{bgfx.impl.BackbufferRatio.Enum ratio, bool hasMIPs, ushort numLayers, bgfx.impl.TextureFormat.Enum format, c_uint64 flags=Texture.none|Sampler.none}, ext: `C++, "bgfx"`},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create 3D texture.
|
* Create 3D texture.
|
||||||
@@ -2568,7 +2583,7 @@ mixin(joinFnBinds((){
|
|||||||
`_mem` is NULL content of the texture is uninitialized. When `_numLayers` is more than
|
`_mem` is NULL content of the texture is uninitialized. When `_numLayers` is more than
|
||||||
1, expected memory layout is texture and all mips together for each array element.
|
1, expected memory layout is texture and all mips together for each array element.
|
||||||
*/
|
*/
|
||||||
{q{TextureHandle}, q{createTexture3D}, q{ushort width, ushort height, ushort depth, bool hasMIPs, bgfx.fakeenum.TextureFormat.Enum format, c_uint64 flags=Texture.none|Sampler.none, const(Memory)* mem=null}, ext: `C++, "bgfx"`},
|
{q{TextureHandle}, q{createTexture3D}, q{ushort width, ushort height, ushort depth, bool hasMIPs, bgfx.impl.TextureFormat.Enum format, c_uint64 flags=Texture.none|Sampler.none, const(Memory)* mem=null}, ext: `C++, "bgfx"`},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create Cube texture.
|
* Create Cube texture.
|
||||||
@@ -2588,7 +2603,7 @@ mixin(joinFnBinds((){
|
|||||||
`_mem` is NULL content of the texture is uninitialized. When `_numLayers` is more than
|
`_mem` is NULL content of the texture is uninitialized. When `_numLayers` is more than
|
||||||
1, expected memory layout is texture and all mips together for each array element.
|
1, expected memory layout is texture and all mips together for each array element.
|
||||||
*/
|
*/
|
||||||
{q{TextureHandle}, q{createTextureCube}, q{ushort size, bool hasMIPs, ushort numLayers, bgfx.fakeenum.TextureFormat.Enum format, c_uint64 flags=Texture.none|Sampler.none, const(Memory)* mem=null}, ext: `C++, "bgfx"`},
|
{q{TextureHandle}, q{createTextureCube}, q{ushort size, bool hasMIPs, ushort numLayers, bgfx.impl.TextureFormat.Enum format, c_uint64 flags=Texture.none|Sampler.none, const(Memory)* mem=null}, ext: `C++, "bgfx"`},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update 2D texture.
|
* Update 2D texture.
|
||||||
@@ -2708,7 +2723,7 @@ mixin(joinFnBinds((){
|
|||||||
- `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic
|
- `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic
|
||||||
sampling.
|
sampling.
|
||||||
*/
|
*/
|
||||||
{q{FrameBufferHandle}, q{createFrameBuffer}, q{ushort width, ushort height, bgfx.fakeenum.TextureFormat.Enum format, c_uint64 textureFlags=SamplerU.clamp|SamplerV.clamp}, ext: `C++, "bgfx"`},
|
{q{FrameBufferHandle}, q{createFrameBuffer}, q{ushort width, ushort height, bgfx.impl.TextureFormat.Enum format, c_uint64 textureFlags=SamplerU.clamp|SamplerV.clamp}, ext: `C++, "bgfx"`},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create frame buffer with size based on back-buffer ratio. Frame buffer will maintain ratio
|
* Create frame buffer with size based on back-buffer ratio. Frame buffer will maintain ratio
|
||||||
@@ -2724,7 +2739,7 @@ mixin(joinFnBinds((){
|
|||||||
- `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic
|
- `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic
|
||||||
sampling.
|
sampling.
|
||||||
*/
|
*/
|
||||||
{q{FrameBufferHandle}, q{createFrameBuffer}, q{bgfx.fakeenum.BackbufferRatio.Enum ratio, bgfx.fakeenum.TextureFormat.Enum format, c_uint64 textureFlags=SamplerU.clamp|SamplerV.clamp}, ext: `C++, "bgfx"`},
|
{q{FrameBufferHandle}, q{createFrameBuffer}, q{bgfx.impl.BackbufferRatio.Enum ratio, bgfx.impl.TextureFormat.Enum format, c_uint64 textureFlags=SamplerU.clamp|SamplerV.clamp}, ext: `C++, "bgfx"`},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create MRT frame buffer from texture handles (simple).
|
* Create MRT frame buffer from texture handles (simple).
|
||||||
@@ -2759,7 +2774,7 @@ mixin(joinFnBinds((){
|
|||||||
format = Window back buffer color format.
|
format = Window back buffer color format.
|
||||||
depthFormat = Window back buffer depth format.
|
depthFormat = Window back buffer depth format.
|
||||||
*/
|
*/
|
||||||
{q{FrameBufferHandle}, q{createFrameBuffer}, q{void* nwh, ushort width, ushort height, bgfx.fakeenum.TextureFormat.Enum format=TextureFormat.count, bgfx.fakeenum.TextureFormat.Enum depthFormat=TextureFormat.count}, ext: `C++, "bgfx"`},
|
{q{FrameBufferHandle}, q{createFrameBuffer}, q{void* nwh, ushort width, ushort height, bgfx.impl.TextureFormat.Enum format=TextureFormat.count, bgfx.impl.TextureFormat.Enum depthFormat=TextureFormat.count}, ext: `C++, "bgfx"`},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set frame buffer debug name.
|
* Set frame buffer debug name.
|
||||||
@@ -2815,7 +2830,7 @@ mixin(joinFnBinds((){
|
|||||||
type = Type of uniform (See: `bgfx::UniformType`).
|
type = Type of uniform (See: `bgfx::UniformType`).
|
||||||
num = Number of elements in array.
|
num = Number of elements in array.
|
||||||
*/
|
*/
|
||||||
{q{UniformHandle}, q{createUniform}, q{const(char)* name, bgfx.fakeenum.UniformType.Enum type, ushort num=1}, ext: `C++, "bgfx"`},
|
{q{UniformHandle}, q{createUniform}, q{const(char)* name, bgfx.impl.UniformType.Enum type, ushort num=1}, ext: `C++, "bgfx"`},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve uniform info.
|
* Retrieve uniform info.
|
||||||
@@ -2917,7 +2932,7 @@ mixin(joinFnBinds((){
|
|||||||
ratio = Width and height will be set in respect to back-buffer size.
|
ratio = Width and height will be set in respect to back-buffer size.
|
||||||
See: `BackbufferRatio::Enum`.
|
See: `BackbufferRatio::Enum`.
|
||||||
*/
|
*/
|
||||||
{q{void}, q{setViewRect}, q{ViewID id, ushort x, ushort y, bgfx.fakeenum.BackbufferRatio.Enum ratio}, ext: `C++, "bgfx"`},
|
{q{void}, q{setViewRect}, q{ViewID id, ushort x, ushort y, bgfx.impl.BackbufferRatio.Enum ratio}, ext: `C++, "bgfx"`},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set view scissor. Draw primitive outside view will be clipped. When
|
* Set view scissor. Draw primitive outside view will be clipped. When
|
||||||
@@ -2972,7 +2987,7 @@ mixin(joinFnBinds((){
|
|||||||
id = View id.
|
id = View id.
|
||||||
mode = View sort mode. See `ViewMode::Enum`.
|
mode = View sort mode. See `ViewMode::Enum`.
|
||||||
*/
|
*/
|
||||||
{q{void}, q{setViewMode}, q{ViewID id, bgfx.fakeenum.ViewMode.Enum mode=ViewMode.default_}, ext: `C++, "bgfx"`},
|
{q{void}, q{setViewMode}, q{ViewID id, bgfx.impl.ViewMode.Enum mode=ViewMode.default_}, ext: `C++, "bgfx"`},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set view frame buffer.
|
* Set view frame buffer.
|
||||||
@@ -3100,7 +3115,7 @@ mixin(joinFnBinds((){
|
|||||||
- `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic
|
- `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic
|
||||||
sampling.
|
sampling.
|
||||||
*/
|
*/
|
||||||
{q{size_t}, q{overrideInternal}, q{TextureHandle handle, ushort width, ushort height, ubyte numMIPs, bgfx.fakeenum.TextureFormat.Enum format, c_uint64 flags=Texture.none | Sampler.none}, ext: `C++, "bgfx"`},
|
{q{size_t}, q{overrideInternal}, q{TextureHandle handle, ushort width, ushort height, ubyte numMIPs, bgfx.impl.TextureFormat.Enum format, c_uint64 flags=Texture.none | Sampler.none}, ext: `C++, "bgfx"`},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets a debug marker. This allows you to group graphics calls together for easy browsing in
|
* Sets a debug marker. This allows you to group graphics calls together for easy browsing in
|
||||||
@@ -3460,7 +3475,7 @@ mixin(joinFnBinds((){
|
|||||||
handle = Index buffer handle.
|
handle = Index buffer handle.
|
||||||
access = Buffer access. See `Access::Enum`.
|
access = Buffer access. See `Access::Enum`.
|
||||||
*/
|
*/
|
||||||
{q{void}, q{setBuffer}, q{ubyte stage, IndexBufferHandle handle, bgfx.fakeenum.Access.Enum access}, ext: `C++, "bgfx"`},
|
{q{void}, q{setBuffer}, q{ubyte stage, IndexBufferHandle handle, bgfx.impl.Access.Enum access}, ext: `C++, "bgfx"`},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set compute vertex buffer.
|
* Set compute vertex buffer.
|
||||||
@@ -3469,7 +3484,7 @@ mixin(joinFnBinds((){
|
|||||||
handle = Vertex buffer handle.
|
handle = Vertex buffer handle.
|
||||||
access = Buffer access. See `Access::Enum`.
|
access = Buffer access. See `Access::Enum`.
|
||||||
*/
|
*/
|
||||||
{q{void}, q{setBuffer}, q{ubyte stage, VertexBufferHandle handle, bgfx.fakeenum.Access.Enum access}, ext: `C++, "bgfx"`},
|
{q{void}, q{setBuffer}, q{ubyte stage, VertexBufferHandle handle, bgfx.impl.Access.Enum access}, ext: `C++, "bgfx"`},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set compute dynamic index buffer.
|
* Set compute dynamic index buffer.
|
||||||
@@ -3478,7 +3493,7 @@ mixin(joinFnBinds((){
|
|||||||
handle = Dynamic index buffer handle.
|
handle = Dynamic index buffer handle.
|
||||||
access = Buffer access. See `Access::Enum`.
|
access = Buffer access. See `Access::Enum`.
|
||||||
*/
|
*/
|
||||||
{q{void}, q{setBuffer}, q{ubyte stage, DynamicIndexBufferHandle handle, bgfx.fakeenum.Access.Enum access}, ext: `C++, "bgfx"`},
|
{q{void}, q{setBuffer}, q{ubyte stage, DynamicIndexBufferHandle handle, bgfx.impl.Access.Enum access}, ext: `C++, "bgfx"`},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set compute dynamic vertex buffer.
|
* Set compute dynamic vertex buffer.
|
||||||
@@ -3487,7 +3502,7 @@ mixin(joinFnBinds((){
|
|||||||
handle = Dynamic vertex buffer handle.
|
handle = Dynamic vertex buffer handle.
|
||||||
access = Buffer access. See `Access::Enum`.
|
access = Buffer access. See `Access::Enum`.
|
||||||
*/
|
*/
|
||||||
{q{void}, q{setBuffer}, q{ubyte stage, DynamicVertexBufferHandle handle, bgfx.fakeenum.Access.Enum access}, ext: `C++, "bgfx"`},
|
{q{void}, q{setBuffer}, q{ubyte stage, DynamicVertexBufferHandle handle, bgfx.impl.Access.Enum access}, ext: `C++, "bgfx"`},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set compute indirect buffer.
|
* Set compute indirect buffer.
|
||||||
@@ -3496,7 +3511,7 @@ mixin(joinFnBinds((){
|
|||||||
handle = Indirect buffer handle.
|
handle = Indirect buffer handle.
|
||||||
access = Buffer access. See `Access::Enum`.
|
access = Buffer access. See `Access::Enum`.
|
||||||
*/
|
*/
|
||||||
{q{void}, q{setBuffer}, q{ubyte stage, IndirectBufferHandle handle, bgfx.fakeenum.Access.Enum access}, ext: `C++, "bgfx"`},
|
{q{void}, q{setBuffer}, q{ubyte stage, IndirectBufferHandle handle, bgfx.impl.Access.Enum access}, ext: `C++, "bgfx"`},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set compute image from texture.
|
* Set compute image from texture.
|
||||||
@@ -3507,7 +3522,7 @@ mixin(joinFnBinds((){
|
|||||||
access = Image access. See `Access::Enum`.
|
access = Image access. See `Access::Enum`.
|
||||||
format = Texture format. See: `TextureFormat::Enum`.
|
format = Texture format. See: `TextureFormat::Enum`.
|
||||||
*/
|
*/
|
||||||
{q{void}, q{setImage}, q{ubyte stage, TextureHandle handle, ubyte mip, bgfx.fakeenum.Access.Enum access, bgfx.fakeenum.TextureFormat.Enum format=TextureFormat.count}, ext: `C++, "bgfx"`},
|
{q{void}, q{setImage}, q{ubyte stage, TextureHandle handle, ubyte mip, bgfx.impl.Access.Enum access, bgfx.impl.TextureFormat.Enum format=TextureFormat.count}, ext: `C++, "bgfx"`},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dispatch compute.
|
* Dispatch compute.
|
||||||
@@ -3586,13 +3601,13 @@ mixin(joinFnBinds((){
|
|||||||
|
|
||||||
];
|
];
|
||||||
return ret;
|
return ret;
|
||||||
}(), "Resolution, Limits, Init, Attachment, VertexLayout, Encoder, "));
|
}(), "Resolution, Init.Limits, Init, Attachment, VertexLayout, Encoder, "));
|
||||||
|
|
||||||
static if(!staticBinding):
|
static if(!staticBinding):
|
||||||
import bindbc.loader;
|
import bindbc.loader;
|
||||||
|
|
||||||
debug{
|
debug{
|
||||||
mixin(makeDynloadFns("Bgfx", makeLibPaths(["bgfx-shared-libDebug", "bgfxDebug", "bgfx"]), [__MODULE__]));
|
mixin(makeDynloadFns("Bgfx", makeLibPaths(["bgfx-shared-libDebug", "bgfxDebug", "bgfx"]), [__MODULE__, "bgfx.impl"]));
|
||||||
}else{
|
}else{
|
||||||
mixin(makeDynloadFns("Bgfx", makeLibPaths(["bgfx-shared-libRelease", "bgfxRelease", "bgfx"]), [__MODULE__]));
|
mixin(makeDynloadFns("Bgfx", makeLibPaths(["bgfx-shared-libRelease", "bgfxRelease", "bgfx"]), [__MODULE__, "bgfx.impl"]));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,10 +9,9 @@ local template = [[
|
|||||||
+/
|
+/
|
||||||
module bgfx;
|
module bgfx;
|
||||||
|
|
||||||
import bindbc.bgfx.config;
|
|
||||||
|
|
||||||
import bindbc.common.types: c_int64, c_uint64, va_list;
|
import bindbc.common.types: c_int64, c_uint64, va_list;
|
||||||
static import bgfx.fakeenum;
|
import bindbc.bgfx.config;
|
||||||
|
static import bgfx.impl;
|
||||||
|
|
||||||
$version
|
$version
|
||||||
|
|
||||||
@@ -20,64 +19,85 @@ alias ViewID = ushort;
|
|||||||
|
|
||||||
enum invalidHandle(T) = T(ushort.max);
|
enum invalidHandle(T) = T(ushort.max);
|
||||||
|
|
||||||
alias ReleaseFn = void function(void* ptr, void* userData);
|
alias ReleaseFn = extern(C++) void function(void* ptr, void* userData) nothrow;
|
||||||
|
|
||||||
$types
|
$types
|
||||||
pragma(inline,true) nothrow @nogc pure @safe{
|
pragma(inline,true) nothrow @nogc{
|
||||||
|
/**
|
||||||
|
Allocate a buffer to pass to bgfx. Data will be freed inside bgfx.
|
||||||
|
Params:
|
||||||
|
size = Size to allocate.
|
||||||
|
*/
|
||||||
|
MemoryRef alloc(uint size){
|
||||||
|
auto mem = bgfx.impl.alloc(__traits(parameters));
|
||||||
|
return MemoryRef(cast(ubyte[])mem.data[0..mem.size], mem);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
Allocate a buffer to pass to bgfx and copy `data` into it. Data will be freed inside bgfx.
|
||||||
|
Params:
|
||||||
|
data = Pointer to data to be copied.
|
||||||
|
size = Size of data to be copied.
|
||||||
|
*/
|
||||||
|
MemoryRef copy(const(void)* data, uint size){
|
||||||
|
auto mem = bgfx.impl.copy(__traits(parameters));
|
||||||
|
return MemoryRef(cast(ubyte[])mem.data[0..mem.size], mem);
|
||||||
|
}
|
||||||
|
|
||||||
|
pure @safe:
|
||||||
StateBlend_ blendFuncSeparate(StateBlend_ srcRGB, StateBlend_ dstRGB, StateBlend_ srcA, StateBlend_ dstA){
|
StateBlend_ blendFuncSeparate(StateBlend_ srcRGB, StateBlend_ dstRGB, StateBlend_ srcA, StateBlend_ dstA){
|
||||||
return (srcRGB | ((dstRGB) << 4)) | ((srcA | (dstA << 4)) << 8);
|
return (srcRGB | ((dstRGB) << 4)) | ((srcA | (dstA << 4)) << 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
///Blend equation separate.
|
///Blend equation separate.
|
||||||
StateBlendEquation_ blendEquationSeparate(StateBlendEquation_ equationRGB, StateBlendEquation_ equationA){
|
StateBlendEquation_ blendEquationSeparate(StateBlendEquation_ equationRGB, StateBlendEquation_ equationA){
|
||||||
return equationRGB | (equationA << 3);
|
return equationRGB | (equationA << 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
///Blend function.
|
///Blend function.
|
||||||
StateBlend_ blendFunc(StateBlend_ src, StateBlend_ dst){ return blendFuncSeparate(src, dst, src, dst); }
|
StateBlend_ blendFunc(StateBlend_ src, StateBlend_ dst){ return blendFuncSeparate(src, dst, src, dst); }
|
||||||
|
|
||||||
///Blend equation.
|
///Blend equation.
|
||||||
StateBlendEquation_ blendEquation(StateBlendEquation_ equation){ return blendEquationSeparate(equation, equation); }
|
StateBlendEquation_ blendEquation(StateBlendEquation_ equation){ return blendEquationSeparate(equation, equation); }
|
||||||
|
|
||||||
///Utility predefined blend modes.
|
///Utility predefined blend modes.
|
||||||
enum StateBlendFunc: StateBlend_{
|
enum StateBlendFunc: StateBlend_{
|
||||||
///Additive blending.
|
///Additive blending.
|
||||||
add = blendFunc(StateBlend.one, StateBlend.one),
|
add = blendFunc(StateBlend.one, StateBlend.one),
|
||||||
|
|
||||||
///Alpha blend.
|
///Alpha blend.
|
||||||
alpha = blendFunc(StateBlend.srcAlpha, StateBlend.invSrcAlpha),
|
alpha = blendFunc(StateBlend.srcAlpha, StateBlend.invSrcAlpha),
|
||||||
|
|
||||||
///Selects darker color of blend.
|
///Selects darker color of blend.
|
||||||
darken = blendFunc(StateBlend.one, StateBlend.one) | blendEquation(StateBlendEquation.min),
|
darken = blendFunc(StateBlend.one, StateBlend.one) | blendEquation(StateBlendEquation.min),
|
||||||
|
|
||||||
///Selects lighter color of blend.
|
///Selects lighter color of blend.
|
||||||
lighten = blendFunc(StateBlend.one, StateBlend.one) | blendEquation(StateBlendEquation.max),
|
lighten = blendFunc(StateBlend.one, StateBlend.one) | blendEquation(StateBlendEquation.max),
|
||||||
|
|
||||||
///Multiplies colors.
|
///Multiplies colors.
|
||||||
multiply = blendFunc(StateBlend.dstColor, StateBlend.zero),
|
multiply = blendFunc(StateBlend.dstColor, StateBlend.zero),
|
||||||
|
|
||||||
///Opaque pixels will cover the pixels directly below them without any math or algorithm applied to them.
|
///Opaque pixels will cover the pixels directly below them without any math or algorithm applied to them.
|
||||||
normal = blendFunc(StateBlend.one, StateBlend.invSrcAlpha),
|
normal = blendFunc(StateBlend.one, StateBlend.invSrcAlpha),
|
||||||
|
|
||||||
///Multiplies the inverse of the blend and base colors.
|
///Multiplies the inverse of the blend and base colors.
|
||||||
screen = blendFunc(StateBlend.one, StateBlend.invSrcColor),
|
screen = blendFunc(StateBlend.one, StateBlend.invSrcColor),
|
||||||
|
|
||||||
///Decreases the brightness of the base color based on the value of the blend color.
|
///Decreases the brightness of the base color based on the value of the blend color.
|
||||||
linearBurn = blendFunc(StateBlend.dstColor, StateBlend.invDstColor) | blendEquation(StateBlendEquation.sub),
|
linearBurn = blendFunc(StateBlend.dstColor, StateBlend.invDstColor) | blendEquation(StateBlendEquation.sub),
|
||||||
}
|
}
|
||||||
|
|
||||||
StateBlend_ blendFuncRTx(StateBlend_ src, StateBlend_ dst){
|
StateBlend_ blendFuncRTx(StateBlend_ src, StateBlend_ dst){
|
||||||
return cast(uint)(src >> StateBlend.shift) | (cast(uint)(dst >> StateBlend.shift) << 4);
|
return cast(uint)(src >> StateBlend.shift) | (cast(uint)(dst >> StateBlend.shift) << 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
StateBlend_ blendFuncRTxE(StateBlend_ src, StateBlend_ dst, StateBlendEquation_ equation){
|
StateBlend_ blendFuncRTxE(StateBlend_ src, StateBlend_ dst, StateBlendEquation_ equation){
|
||||||
return blendFuncRTx(src, dst) | (cast(uint)(equation >> StateBlendEquation.shift) << 8);
|
return blendFuncRTx(src, dst) | (cast(uint)(equation >> StateBlendEquation.shift) << 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
StateBlend_ blendFuncRT1(StateBlend_ src, StateBlend_ dst){ return blendFuncRTx(src, dst) << 0; }
|
StateBlend_ blendFuncRT1(StateBlend_ src, StateBlend_ dst){ return blendFuncRTx(src, dst) << 0; }
|
||||||
StateBlend_ blendFuncRT2(StateBlend_ src, StateBlend_ dst){ return blendFuncRTx(src, dst) << 11; }
|
StateBlend_ blendFuncRT2(StateBlend_ src, StateBlend_ dst){ return blendFuncRTx(src, dst) << 11; }
|
||||||
StateBlend_ blendFuncRT3(StateBlend_ src, StateBlend_ dst){ return blendFuncRTx(src, dst) << 22; }
|
StateBlend_ blendFuncRT3(StateBlend_ src, StateBlend_ dst){ return blendFuncRTx(src, dst) << 22; }
|
||||||
|
|
||||||
StateBlend_ blendFuncRT1E(StateBlend_ src, StateBlend_ dst, StateBlendEquation_ equation){
|
StateBlend_ blendFuncRT1E(StateBlend_ src, StateBlend_ dst, StateBlendEquation_ equation){
|
||||||
return blendFuncRTxE(src, dst, equation) << 0;
|
return blendFuncRTxE(src, dst, equation) << 0;
|
||||||
}
|
}
|
||||||
@@ -89,6 +109,16 @@ pragma(inline,true) nothrow @nogc pure @safe{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
A wrapper around `Memory` that allows you to mutate its `data`.
|
||||||
|
Do not create instances of this struct yourself.
|
||||||
|
*/
|
||||||
|
struct MemoryRef{
|
||||||
|
ubyte[] data;
|
||||||
|
const(Memory)* memory;
|
||||||
|
alias memory this;
|
||||||
|
}
|
||||||
|
|
||||||
$structs
|
$structs
|
||||||
mixin(joinFnBinds((){
|
mixin(joinFnBinds((){
|
||||||
FnBind[] ret = [
|
FnBind[] ret = [
|
||||||
@@ -101,9 +131,9 @@ static if(!staticBinding):
|
|||||||
import bindbc.loader;
|
import bindbc.loader;
|
||||||
|
|
||||||
debug{
|
debug{
|
||||||
mixin(makeDynloadFns("Bgfx", makeLibPaths(["bgfx-shared-libDebug", "bgfxDebug", "bgfx"]), [__MODULE__]));
|
mixin(makeDynloadFns("Bgfx", makeLibPaths(["bgfx-shared-libDebug", "bgfxDebug", "bgfx"]), [__MODULE__, "bgfx.impl"]));
|
||||||
}else{
|
}else{
|
||||||
mixin(makeDynloadFns("Bgfx", makeLibPaths(["bgfx-shared-libRelease", "bgfxRelease", "bgfx"]), [__MODULE__]));
|
mixin(makeDynloadFns("Bgfx", makeLibPaths(["bgfx-shared-libRelease", "bgfxRelease", "bgfx"]), [__MODULE__, "bgfx.impl"]));
|
||||||
}
|
}
|
||||||
]]
|
]]
|
||||||
|
|
||||||
@@ -216,7 +246,7 @@ local function hexStr(val, bits)
|
|||||||
str = str:sub(0, i) .. "_" .. str:sub(i+1)
|
str = str:sub(0, i) .. "_" .. str:sub(i+1)
|
||||||
i = i + 5
|
i = i + 5
|
||||||
end
|
end
|
||||||
|
|
||||||
return "0x" .. str
|
return "0x" .. str
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -248,14 +278,14 @@ local function convSomeType(arg, isFnArg)
|
|||||||
end
|
end
|
||||||
type = type:gsub("::Enum", "") --fix enums
|
type = type:gsub("::Enum", "") --fix enums
|
||||||
type = type:gsub("%s+%*", "*") --remove spacing before `*`
|
type = type:gsub("%s+%*", "*") --remove spacing before `*`
|
||||||
|
|
||||||
if isFnArg then
|
if isFnArg then
|
||||||
for _, enum in pairs(enumTypes) do --fix C++ linkage errors
|
for _, enum in pairs(enumTypes) do --fix C++ linkage errors
|
||||||
if type == enum then
|
if type == enum then
|
||||||
type = string.format("bgfx.fakeenum.%s.Enum", enum)
|
type = string.format("bgfx.impl.%s.Enum", enum)
|
||||||
else
|
else
|
||||||
type = (type:gsub("(" .. enum .. ")([^A-Za-z0-9_])", function(s0, s1)
|
type = (type:gsub("(" .. enum .. ")([^A-Za-z0-9_])", function(s0, s1)
|
||||||
return string.format("bgfx.fakeenum.%s.Enum", enum) .. s1
|
return string.format("bgfx.impl.%s.Enum", enum) .. s1
|
||||||
end))
|
end))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -272,7 +302,7 @@ local function convSomeType(arg, isFnArg)
|
|||||||
type = type:gsub("const%s+([A-Za-z_][A-Za-z0-9_]*)%s*%*", "const(%1)*") --change `const x*` to `const(x)*`
|
type = type:gsub("const%s+([A-Za-z_][A-Za-z0-9_]*)%s*%*", "const(%1)*") --change `const x*` to `const(x)*`
|
||||||
type = abbrevsToUpper(type)
|
type = abbrevsToUpper(type)
|
||||||
end
|
end
|
||||||
|
|
||||||
return type
|
return type
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -289,9 +319,9 @@ local valSubs = {
|
|||||||
UINT8_MAX = "ubyte.max",
|
UINT8_MAX = "ubyte.max",
|
||||||
UINT16_MAX = "ushort.max",
|
UINT16_MAX = "ushort.max",
|
||||||
UINT32_MAX = "uint.max",
|
UINT32_MAX = "uint.max",
|
||||||
|
|
||||||
BGFX_INVALID_HANDLE = "invalidHandle",
|
BGFX_INVALID_HANDLE = "invalidHandle",
|
||||||
|
|
||||||
BGFX_DISCARD_ALL = "Discard.all",
|
BGFX_DISCARD_ALL = "Discard.all",
|
||||||
BGFX_BUFFER_NONE = "Buffer.none",
|
BGFX_BUFFER_NONE = "Buffer.none",
|
||||||
BGFX_STENCIL_NONE = "Stencil.none",
|
BGFX_STENCIL_NONE = "Stencil.none",
|
||||||
@@ -318,7 +348,7 @@ local function convVal(arg, type)
|
|||||||
val = val:gsub("INT32_MAX", "int.max")
|
val = val:gsub("INT32_MAX", "int.max")
|
||||||
end
|
end
|
||||||
val = convArray(val)
|
val = convArray(val)
|
||||||
|
|
||||||
return val
|
return val
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -359,7 +389,7 @@ local function genStructMemberFn(func) --NOTE: this does not work on nested stru
|
|||||||
line = line:gsub("@(%l)(%l+)", function(a, b) return a:upper() .. b .. ":" end)
|
line = line:gsub("@(%l)(%l+)", function(a, b) return a:upper() .. b .. ":" end)
|
||||||
table.insert(st.fns, line)
|
table.insert(st.fns, line)
|
||||||
end
|
end
|
||||||
|
|
||||||
local hasParamsComments = false
|
local hasParamsComments = false
|
||||||
for _, arg in ipairs(func.args) do
|
for _, arg in ipairs(func.args) do
|
||||||
if arg.comment ~= nil then
|
if arg.comment ~= nil then
|
||||||
@@ -367,11 +397,11 @@ local function genStructMemberFn(func) --NOTE: this does not work on nested stru
|
|||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if hasParamsComments then
|
if hasParamsComments then
|
||||||
table.insert(st.fns, "Params:")
|
table.insert(st.fns, "Params:")
|
||||||
end
|
end
|
||||||
|
|
||||||
for _, arg in ipairs(func.args) do
|
for _, arg in ipairs(func.args) do
|
||||||
if arg.comment ~= nil then
|
if arg.comment ~= nil then
|
||||||
table.insert(st.fns, "\t" .. toIntlEnUncond(convName(arg.name:sub(2))) .. " = " .. arg.comment[1])
|
table.insert(st.fns, "\t" .. toIntlEnUncond(convName(arg.name:sub(2))) .. " = " .. arg.comment[1])
|
||||||
@@ -382,10 +412,10 @@ local function genStructMemberFn(func) --NOTE: this does not work on nested stru
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
table.insert(st.fns, "*/")
|
table.insert(st.fns, "*/")
|
||||||
end
|
end
|
||||||
|
|
||||||
local args = {}
|
local args = {}
|
||||||
for _, arg in ipairs(func.args) do
|
for _, arg in ipairs(func.args) do
|
||||||
local def = ""
|
local def = ""
|
||||||
@@ -398,14 +428,14 @@ local function genStructMemberFn(func) --NOTE: this does not work on nested stru
|
|||||||
table.insert(args, convFnArgType(arg) .. " " .. toIntlEnUncond(convName(arg.name:sub(2))) .. def)
|
table.insert(args, convFnArgType(arg) .. " " .. toIntlEnUncond(convName(arg.name:sub(2))) .. def)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if func.const ~= nil then
|
if func.const ~= nil then
|
||||||
attribs = "const"
|
attribs = "const"
|
||||||
end
|
end
|
||||||
if attribs ~= "" then
|
if attribs ~= "" then
|
||||||
attribs = ", memAttr: q{" .. attribs .. "}"
|
attribs = ", memAttr: q{" .. attribs .. "}"
|
||||||
end
|
end
|
||||||
|
|
||||||
table.insert(st.fns, string.format("{q{%s}, q{%s}, q{%s}, ext: `C++`%s},", convType(func.ret), func.name, table.concat(args, ", "), attribs))
|
table.insert(st.fns, string.format("{q{%s}, q{%s}, q{%s}, ext: `C++`%s},", convType(func.ret), func.name, table.concat(args, ", "), attribs))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -414,16 +444,28 @@ local converter = {}
|
|||||||
local yield = coroutine.yield
|
local yield = coroutine.yield
|
||||||
local gen = {}
|
local gen = {}
|
||||||
|
|
||||||
gen.fakeEnumFile = [[
|
gen.implFile = [[
|
||||||
/+
|
/+
|
||||||
+ ┌==============================┐
|
+ ┌==============================┐
|
||||||
+ │ AUTO GENERATED! DO NOT EDIT! │
|
+ │ AUTO GENERATED! DO NOT EDIT! │
|
||||||
+ └==============================┘
|
+ └==============================┘
|
||||||
+/
|
+/
|
||||||
module bgfx.fakeenum;
|
///Do NOT import this module! Use the symbols with the same names in `bgfx/package.d` instead.
|
||||||
|
module bgfx.impl;
|
||||||
|
|
||||||
|
import bindbc.bgfx.config;
|
||||||
|
import bgfx;
|
||||||
|
|
||||||
//NOTE: Do NOT use this module! Use the enums with the same names in `bgfx/package.d` instead.
|
|
||||||
package:
|
package:
|
||||||
|
|
||||||
|
mixin(joinFnBinds((){
|
||||||
|
FnBind[] ret = [
|
||||||
|
{q{const(Memory)*}, q{alloc}, q{uint size}, ext: `C++, "bgfx"`},
|
||||||
|
{q{const(Memory)*}, q{copy}, q{const(void)* data, uint size}, ext: `C++, "bgfx"`},
|
||||||
|
];
|
||||||
|
return ret;
|
||||||
|
}()));
|
||||||
|
|
||||||
]]
|
]]
|
||||||
|
|
||||||
function gen.gen()
|
function gen.gen()
|
||||||
@@ -431,7 +473,7 @@ function gen.gen()
|
|||||||
local idx = 1;
|
local idx = 1;
|
||||||
local r = template:gsub("$([a-zA-Z_]+)", function(what)
|
local r = template:gsub("$([a-zA-Z_]+)", function(what)
|
||||||
local tmp = {}
|
local tmp = {}
|
||||||
|
|
||||||
local ind_end = template:find("$"..what, idx, true)
|
local ind_end = template:find("$"..what, idx, true)
|
||||||
local ind_start = ind_end
|
local ind_start = ind_end
|
||||||
for j = 1, ind_end-1 do
|
for j = 1, ind_end-1 do
|
||||||
@@ -442,9 +484,9 @@ function gen.gen()
|
|||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
indent = string.sub(template, ind_start+1, ind_end-1)
|
indent = string.sub(template, ind_start+1, ind_end-1)
|
||||||
|
|
||||||
if what == "version" then
|
if what == "version" then
|
||||||
return genVersion()
|
return genVersion()
|
||||||
elseif what == "structs" then
|
elseif what == "structs" then
|
||||||
@@ -456,7 +498,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, true, indent:len())
|
local ok, v = coroutine.resume(co, allStructs[object.name], 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
|
||||||
@@ -494,23 +536,23 @@ function gen.gen()
|
|||||||
return r
|
return r
|
||||||
end
|
end
|
||||||
|
|
||||||
function converter.structs(st, name, topLvl)
|
function converter.structs(st, name, fullyQualifiedName, topLvl)
|
||||||
for _, line in ipairs(st.comments) do
|
for _, line in ipairs(st.comments) do
|
||||||
yield(line)
|
yield(line)
|
||||||
end
|
end
|
||||||
|
|
||||||
if topLvl then
|
if topLvl then
|
||||||
yield("extern(C++, \"bgfx\") struct " .. name .. "{")
|
yield("extern(C++, \"bgfx\") struct " .. name .. "{")
|
||||||
else
|
else
|
||||||
yield("extern(C++) struct " .. name .. "{")
|
yield("extern(C++) struct " .. name .. "{")
|
||||||
end
|
end
|
||||||
|
|
||||||
local subN = 0
|
local subN = 0
|
||||||
for _, subStruct in ipairs(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, subStruct.name, false)
|
local ok, v = coroutine.resume(co, subStruct, subStruct.name, name .. "." .. 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
|
||||||
@@ -521,13 +563,13 @@ function converter.structs(st, name, topLvl)
|
|||||||
if subN > 0 then
|
if subN > 0 then
|
||||||
yield("\t")
|
yield("\t")
|
||||||
end
|
end
|
||||||
|
|
||||||
for _, line in ipairs(st.fields) do
|
for _, line in ipairs(st.fields) do
|
||||||
yield(line)
|
yield(line)
|
||||||
end
|
end
|
||||||
|
|
||||||
if #st.fns > 0 then
|
if #st.fns > 0 then
|
||||||
membersWithFns = membersWithFns .. name .. ", "
|
membersWithFns = membersWithFns .. fullyQualifiedName .. ", "
|
||||||
yield("\textern(D) mixin(joinFnBinds((){")
|
yield("\textern(D) mixin(joinFnBinds((){")
|
||||||
yield("\t\tFnBind[] ret = [")
|
yield("\t\tFnBind[] ret = [")
|
||||||
for _, line in ipairs(st.fns) do
|
for _, line in ipairs(st.fns) do
|
||||||
@@ -553,13 +595,13 @@ function converter.types(typ)
|
|||||||
yield("*/")
|
yield("*/")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if typ.handle then ---hnadle
|
if typ.handle then ---hnadle
|
||||||
yield("extern(C++, \"bgfx\") struct " .. typ.name .. "{")
|
yield("extern(C++, \"bgfx\") struct " .. typ.name .. "{")
|
||||||
yield("\tushort idx;")
|
yield("\tushort idx;")
|
||||||
yield("}")
|
yield("}")
|
||||||
--yield(typ.name .. " invalidHandle(){ return " .. typ.name .. "(ushort.max); }")
|
--yield(typ.name .. " invalidHandle(){ return " .. typ.name .. "(ushort.max); }")
|
||||||
|
|
||||||
-- For some reason, this has never worked, so I'm commenting it out just in case it does start working suddenly. :P
|
-- For some reason, this has never worked, so I'm commenting it out just in case it does start working suddenly. :P
|
||||||
--[[
|
--[[
|
||||||
elseif typ.funcptr then
|
elseif typ.funcptr then
|
||||||
@@ -571,16 +613,16 @@ function converter.types(typ)
|
|||||||
table.insert(args, convFnArgType(arg) .. " " .. convName(arg.name:sub(2)) .. def)
|
table.insert(args, convFnArgType(arg) .. " " .. convName(arg.name:sub(2)) .. def)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
yield(string.format("alias %s = extern(C++) %s function(%s);", typ.name, convType(typ.ret), table.concat(args, ", ")))
|
yield(string.format("alias %s = extern(C++) %s function(%s);", typ.name, convType(typ.ret), table.concat(args, ", ")))
|
||||||
--]]
|
--]]
|
||||||
elseif typ.enum then
|
elseif typ.enum then
|
||||||
local typeName = abbrevsToUpper(typ.name:gsub("::Enum", ""))
|
local typeName = abbrevsToUpper(typ.name:gsub("::Enum", ""))
|
||||||
local otherName = string.format("bgfx.fakeenum.%s.Enum", typ.name:gsub("::Enum", ""))
|
local otherName = string.format("bgfx.impl.%s.Enum", typ.name:gsub("::Enum", ""))
|
||||||
|
|
||||||
yield("enum " .. typeName .. ": " .. otherName .. "{")
|
yield("enum " .. typeName .. ": " .. otherName .. "{")
|
||||||
table.insert(enumTypes, typeName)
|
table.insert(enumTypes, typeName)
|
||||||
|
|
||||||
local vals = ""
|
local vals = ""
|
||||||
for idx, enum in ipairs(typ.enum) do
|
for idx, enum in ipairs(typ.enum) do
|
||||||
local comments = ""
|
local comments = ""
|
||||||
@@ -598,30 +640,30 @@ function converter.types(typ)
|
|||||||
local name = convName(toCamelCase(enum.name))
|
local name = convName(toCamelCase(enum.name))
|
||||||
yield("\t" .. name .. " = " .. otherName .. "." .. name .. ",")
|
yield("\t" .. name .. " = " .. otherName .. "." .. name .. ",")
|
||||||
vals = vals .. name .. ","
|
vals = vals .. name .. ","
|
||||||
|
|
||||||
local intlName = toIntlEn(enum.name)
|
local intlName = toIntlEn(enum.name)
|
||||||
if intlName ~= nil then
|
if intlName ~= nil then
|
||||||
yield("\t" .. convName(toCamelCase(intlName)) .. " = " .. otherName .. "." .. name .. ",")
|
yield("\t" .. convName(toCamelCase(intlName)) .. " = " .. otherName .. "." .. name .. ",")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
gen.fakeEnumFile = gen.fakeEnumFile .. string.format([[
|
gen.implFile = gen.implFile .. string.format([[
|
||||||
extern(C++, "bgfx") package final abstract class %s{
|
extern(C++, "bgfx") package final abstract class %s{
|
||||||
enum Enum{
|
enum Enum{
|
||||||
%scount
|
%scount
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]], typeName, vals)
|
]], typeName, vals)
|
||||||
|
|
||||||
yield("\t" .. "count = " .. otherName .. ".count,")
|
yield("\t" .. "count = " .. otherName .. ".count,")
|
||||||
yield("}")
|
yield("}")
|
||||||
|
|
||||||
elseif typ.bits ~= nil then
|
elseif typ.bits ~= nil then
|
||||||
local typeName = convName(typ.name)
|
local typeName = convName(typ.name)
|
||||||
if typeName == "Caps" then
|
if typeName == "Caps" then
|
||||||
typeName = "CapFlags"
|
typeName = "CapFlags"
|
||||||
end
|
end
|
||||||
|
|
||||||
local enumType = "uint"
|
local enumType = "uint"
|
||||||
if typ.bits == 64 then
|
if typ.bits == 64 then
|
||||||
enumType = "ulong"
|
enumType = "ulong"
|
||||||
@@ -632,7 +674,7 @@ extern(C++, "bgfx") package final abstract class %s{
|
|||||||
elseif typ.bits == 8 then
|
elseif typ.bits == 8 then
|
||||||
enumType = "ubyte"
|
enumType = "ubyte"
|
||||||
end
|
end
|
||||||
|
|
||||||
local maxLen = 0
|
local maxLen = 0
|
||||||
if typ.shift then
|
if typ.shift then
|
||||||
maxLen = string.len("shift")
|
maxLen = string.len("shift")
|
||||||
@@ -642,10 +684,10 @@ extern(C++, "bgfx") package final abstract class %s{
|
|||||||
for _, flag in ipairs(typ.flag) do
|
for _, flag in ipairs(typ.flag) do
|
||||||
maxLen = math.max(maxLen, flag.name:len())
|
maxLen = math.max(maxLen, flag.name:len())
|
||||||
end
|
end
|
||||||
|
|
||||||
yield("alias " .. typeName .. "_ = " .. enumType .. ";")
|
yield("alias " .. typeName .. "_ = " .. enumType .. ";")
|
||||||
yield("enum " .. typeName .. ": " .. typeName .. "_{")
|
yield("enum " .. typeName .. ": " .. typeName .. "_{")
|
||||||
|
|
||||||
local function getValOr(name)
|
local function getValOr(name)
|
||||||
local t = typeName
|
local t = typeName
|
||||||
if typeName == "State" then
|
if typeName == "State" then
|
||||||
@@ -685,7 +727,7 @@ extern(C++, "bgfx") package final abstract class %s{
|
|||||||
end
|
end
|
||||||
return abbrevsToUpper(t) .. "." .. convName(toCamelCase(name))
|
return abbrevsToUpper(t) .. "." .. convName(toCamelCase(name))
|
||||||
end
|
end
|
||||||
|
|
||||||
for idx, flag in ipairs(typ.flag) do
|
for idx, flag in ipairs(typ.flag) do
|
||||||
local value = flag.value
|
local value = flag.value
|
||||||
if value ~= nil then
|
if value ~= nil then
|
||||||
@@ -699,7 +741,7 @@ extern(C++, "bgfx") package final abstract class %s{
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local comments = ""
|
local comments = ""
|
||||||
if flag.comment ~= nil then
|
if flag.comment ~= nil then
|
||||||
if #flag.comment == 1 then
|
if #flag.comment == 1 then
|
||||||
@@ -712,17 +754,17 @@ extern(C++, "bgfx") package final abstract class %s{
|
|||||||
yield("\t*/")
|
yield("\t*/")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local name = convName(toCamelCase(flag.name))
|
local name = convName(toCamelCase(flag.name))
|
||||||
yield("\t" .. name .. string.rep(" ", maxLen+2 - name:len()) .. "= " .. value .. "," .. comments)
|
yield("\t" .. name .. string.rep(" ", maxLen+2 - name:len()) .. "= " .. value .. "," .. comments)
|
||||||
|
|
||||||
local intlName = toIntlEn(name)
|
local intlName = toIntlEn(name)
|
||||||
if intlName ~= nil then
|
if intlName ~= nil then
|
||||||
intlName = intlName
|
intlName = intlName
|
||||||
yield("\t" .. intlName .. string.rep(" ", maxLen+2 - intlName:len()) .. "= " .. name .. ",")
|
yield("\t" .. intlName .. string.rep(" ", maxLen+2 - intlName:len()) .. "= " .. name .. ",")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if typ.shift then
|
if typ.shift then
|
||||||
local name = convName("shift")
|
local name = convName("shift")
|
||||||
local value = typ.shift
|
local value = typ.shift
|
||||||
@@ -742,12 +784,12 @@ extern(C++, "bgfx") package final abstract class %s{
|
|||||||
yield("\t" .. name .. string.rep(" ", maxLen+2 - name:len()) .. "= " .. value .. "," .. comments)
|
yield("\t" .. name .. string.rep(" ", maxLen+2 - name:len()) .. "= " .. value .. "," .. comments)
|
||||||
end
|
end
|
||||||
yield("}")
|
yield("}")
|
||||||
|
|
||||||
local intlName = toIntlEn(typeName)
|
local intlName = toIntlEn(typeName)
|
||||||
if intlName ~= nil then
|
if intlName ~= nil then
|
||||||
yield("alias " .. intlName .. " = " .. typeName .. ";")
|
yield("alias " .. intlName .. " = " .. typeName .. ";")
|
||||||
end
|
end
|
||||||
|
|
||||||
if typ.helper then
|
if typ.helper then
|
||||||
yield(string.format(
|
yield(string.format(
|
||||||
"%s_ to%s(%s v) nothrow @nogc pure @safe{ return (v << %s) & %s; }",
|
"%s_ to%s(%s v) nothrow @nogc pure @safe{ return (v << %s) & %s; }",
|
||||||
@@ -762,7 +804,7 @@ extern(C++, "bgfx") package final abstract class %s{
|
|||||||
end
|
end
|
||||||
elseif typ.struct ~= nil then
|
elseif typ.struct ~= nil then
|
||||||
local st = {name = typ.name, 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
|
||||||
table.insert(st.comments, "///" .. typ.comments[1])
|
table.insert(st.comments, "///" .. typ.comments[1])
|
||||||
@@ -774,7 +816,7 @@ extern(C++, "bgfx") package final abstract class %s{
|
|||||||
table.insert(st.comments, "*/")
|
table.insert(st.comments, "*/")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
for _, member in ipairs(typ.struct) do
|
for _, member in ipairs(typ.struct) do
|
||||||
local comments = ""
|
local comments = ""
|
||||||
if member.comment ~= nil then
|
if member.comment ~= nil then
|
||||||
@@ -793,11 +835,11 @@ extern(C++, "bgfx") package final abstract class %s{
|
|||||||
end
|
end
|
||||||
table.insert(st.fields, "\t" .. convStructMember(member) .. ";" .. comments)
|
table.insert(st.fields, "\t" .. convStructMember(member) .. ";" .. comments)
|
||||||
end
|
end
|
||||||
|
|
||||||
if typ.ctor ~= nil and typ.name ~= "PlatformData" then
|
if typ.ctor ~= nil and typ.name ~= "PlatformData" then
|
||||||
table.insert(st.fns, "{q{void}, q{this}, q{}, ext: `C++`},")
|
table.insert(st.fns, "{q{void}, q{this}, q{}, ext: `C++`},")
|
||||||
end
|
end
|
||||||
|
|
||||||
if typ.namespace ~= nil then --if this is a sub-struct
|
if typ.namespace ~= nil then --if this is a sub-struct
|
||||||
if allStructs[typ.namespace] ~= nil then
|
if allStructs[typ.namespace] ~= nil then
|
||||||
table.insert(allStructs[typ.namespace].subs, st)
|
table.insert(allStructs[typ.namespace].subs, st)
|
||||||
@@ -817,7 +859,7 @@ function converter.funcs(func)
|
|||||||
if func.class == nil and func.conly == nil and func.cppinline == 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") or func.name == "alloc" or func.name == "copy" then --what the is "cfunc" even meant to mean?
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
if func.comments ~= nil then
|
if func.comments ~= nil then
|
||||||
@@ -828,7 +870,7 @@ function converter.funcs(func)
|
|||||||
line = line:gsub("@(%l)(%l+)", function(a, b) return a:upper() .. b .. ":" end)
|
line = line:gsub("@(%l)(%l+)", function(a, b) return a:upper() .. b .. ":" end)
|
||||||
yield("* " .. line)
|
yield("* " .. line)
|
||||||
end
|
end
|
||||||
|
|
||||||
local hasParamsComments = false
|
local hasParamsComments = false
|
||||||
for _, arg in ipairs(func.args) do
|
for _, arg in ipairs(func.args) do
|
||||||
if arg.comment ~= nil then
|
if arg.comment ~= nil then
|
||||||
@@ -836,11 +878,11 @@ function converter.funcs(func)
|
|||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if hasParamsComments then
|
if hasParamsComments then
|
||||||
yield("Params:")
|
yield("Params:")
|
||||||
end
|
end
|
||||||
|
|
||||||
for _, arg in ipairs(func.args) do
|
for _, arg in ipairs(func.args) do
|
||||||
if arg.comment ~= nil then
|
if arg.comment ~= nil then
|
||||||
yield("\t" .. toIntlEnUncond(convName(arg.name:sub(2))) .. " = " .. arg.comment[1])
|
yield("\t" .. toIntlEnUncond(convName(arg.name:sub(2))) .. " = " .. arg.comment[1])
|
||||||
@@ -851,10 +893,10 @@ function converter.funcs(func)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
yield("*/")
|
yield("*/")
|
||||||
end
|
end
|
||||||
|
|
||||||
local args = {}
|
local args = {}
|
||||||
for _, arg in ipairs(func.args) do
|
for _, arg in ipairs(func.args) do
|
||||||
local def = ""
|
local def = ""
|
||||||
@@ -867,11 +909,11 @@ function converter.funcs(func)
|
|||||||
table.insert(args, convFnArgType(arg) .. " " .. toIntlEnUncond(convName(arg.name:sub(2))) .. def)
|
table.insert(args, convFnArgType(arg) .. " " .. toIntlEnUncond(convName(arg.name:sub(2))) .. def)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if attribs ~= "" then
|
if attribs ~= "" then
|
||||||
attribs = ", memAttr: q{" .. attribs .. "}"
|
attribs = ", memAttr: q{" .. attribs .. "}"
|
||||||
end
|
end
|
||||||
|
|
||||||
yield(string.format("{q{%s}, q{%s}, q{%s}, ext: `%s`%s},", convType(func.ret), func.name, table.concat(args, ", "), extern, attribs))
|
yield(string.format("{q{%s}, q{%s}, q{%s}, ext: `%s`%s},", convType(func.ret), func.name, table.concat(args, ", "), extern, attribs))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ newaction {
|
|||||||
|
|
||||||
local dgen = require "bindings-d"
|
local dgen = require "bindings-d"
|
||||||
dgen.write(dgen.gen(), "../bindings/d/package.d")
|
dgen.write(dgen.gen(), "../bindings/d/package.d")
|
||||||
dgen.write(dgen.fakeEnumFile, "../bindings/d/fakeenum.d")
|
dgen.write(dgen.implFile, "../bindings/d/impl.d")
|
||||||
|
|
||||||
local csgen = require "bindings-bf"
|
local csgen = require "bindings-bf"
|
||||||
csgen.write(csgen.gen(), "../bindings/bf/bgfx.bf")
|
csgen.write(csgen.gen(), "../bindings/bf/bgfx.bf")
|
||||||
|
|||||||
Reference in New Issue
Block a user