diff --git a/bindings/cs/bgfx.cs b/bindings/cs/bgfx.cs
index 17693d419..32681b7e8 100644
--- a/bindings/cs/bgfx.cs
+++ b/bindings/cs/bgfx.cs
@@ -19,65 +19,249 @@ public static partial class bgfx
[Flags]
public enum StateFlags : ulong
{
+ ///
+ /// Enable R write.
+ ///
WriteR = 0x0000000000000001,
+
+ ///
+ /// Enable G write.
+ ///
WriteG = 0x0000000000000002,
+
+ ///
+ /// Enable B write.
+ ///
WriteB = 0x0000000000000004,
+
+ ///
+ /// Enable alpha write.
+ ///
WriteA = 0x0000000000000008,
+
+ ///
+ /// Enable depth write.
+ ///
WriteZ = 0x0000004000000000,
+
+ ///
+ /// Enable RGB write.
+ ///
WriteRgb = 0x0000000000000007,
+
+ ///
+ /// Write all channels mask.
+ ///
WriteMask = 0x000000400000000f,
+
+ ///
+ /// Enable depth test, less.
+ ///
DepthTestLess = 0x0000000000000010,
+
+ ///
+ /// Enable depth test, less or equal.
+ ///
DepthTestLequal = 0x0000000000000020,
+
+ ///
+ /// Enable depth test, equal.
+ ///
DepthTestEqual = 0x0000000000000030,
+
+ ///
+ /// Enable depth test, greater or equal.
+ ///
DepthTestGequal = 0x0000000000000040,
+
+ ///
+ /// Enable depth test, greater.
+ ///
DepthTestGreater = 0x0000000000000050,
+
+ ///
+ /// Enable depth test, not equal.
+ ///
DepthTestNotequal = 0x0000000000000060,
+
+ ///
+ /// Enable depth test, never.
+ ///
DepthTestNever = 0x0000000000000070,
+
+ ///
+ /// Enable depth test, always.
+ ///
DepthTestAlways = 0x0000000000000080,
DepthTestShift = 4,
DepthTestMask = 0x00000000000000f0,
+
+ ///
+ /// 0, 0, 0, 0
+ ///
BlendZero = 0x0000000000001000,
+
+ ///
+ /// 1, 1, 1, 1
+ ///
BlendOne = 0x0000000000002000,
+
+ ///
+ /// Rs, Gs, Bs, As
+ ///
BlendSrcColor = 0x0000000000003000,
+
+ ///
+ /// 1-Rs, 1-Gs, 1-Bs, 1-As
+ ///
BlendInvSrcColor = 0x0000000000004000,
+
+ ///
+ /// As, As, As, As
+ ///
BlendSrcAlpha = 0x0000000000005000,
+
+ ///
+ /// 1-As, 1-As, 1-As, 1-As
+ ///
BlendInvSrcAlpha = 0x0000000000006000,
+
+ ///
+ /// Ad, Ad, Ad, Ad
+ ///
BlendDstAlpha = 0x0000000000007000,
+
+ ///
+ /// 1-Ad, 1-Ad, 1-Ad ,1-Ad
+ ///
BlendInvDstAlpha = 0x0000000000008000,
+
+ ///
+ /// Rd, Gd, Bd, Ad
+ ///
BlendDstColor = 0x0000000000009000,
+
+ ///
+ /// 1-Rd, 1-Gd, 1-Bd, 1-Ad
+ ///
BlendInvDstColor = 0x000000000000a000,
+
+ ///
+ /// f, f, f, 1; f = min(As, 1-Ad)
+ ///
BlendSrcAlphaSat = 0x000000000000b000,
+
+ ///
+ /// Blend factor
+ ///
BlendFactor = 0x000000000000c000,
+
+ ///
+ /// 1-Blend factor
+ ///
BlendInvFactor = 0x000000000000d000,
BlendShift = 12,
BlendMask = 0x000000000ffff000,
+
+ ///
+ /// Blend add: src + dst.
+ ///
BlendEquationAdd = 0x0000000000000000,
+
+ ///
+ /// Blend subtract: src - dst.
+ ///
BlendEquationSub = 0x0000000010000000,
+
+ ///
+ /// Blend reverse subtract: dst - src.
+ ///
BlendEquationRevsub = 0x0000000020000000,
+
+ ///
+ /// Blend min: min(src, dst).
+ ///
BlendEquationMin = 0x0000000030000000,
+
+ ///
+ /// Blend max: max(src, dst).
+ ///
BlendEquationMax = 0x0000000040000000,
BlendEquationShift = 28,
BlendEquationMask = 0x00000003f0000000,
+
+ ///
+ /// Cull clockwise triangles.
+ ///
CullCw = 0x0000001000000000,
+
+ ///
+ /// Cull counter-clockwise triangles.
+ ///
CullCcw = 0x0000002000000000,
CullShift = 36,
CullMask = 0x0000003000000000,
AlphaRefShift = 40,
AlphaRefMask = 0x0000ff0000000000,
+
+ ///
+ /// Tristrip.
+ ///
PtTristrip = 0x0001000000000000,
+
+ ///
+ /// Lines.
+ ///
PtLines = 0x0002000000000000,
+
+ ///
+ /// Line strip.
+ ///
PtLinestrip = 0x0003000000000000,
+
+ ///
+ /// Points.
+ ///
PtPoints = 0x0004000000000000,
PtShift = 48,
PtMask = 0x0007000000000000,
PointSizeShift = 52,
PointSizeMask = 0x00f0000000000000,
+
+ ///
+ /// Enable MSAA rasterization.
+ ///
Msaa = 0x0100000000000000,
+
+ ///
+ /// Enable line AA rasterization.
+ ///
Lineaa = 0x0200000000000000,
+
+ ///
+ /// Enable conservative rasterization.
+ ///
ConservativeRaster = 0x0400000000000000,
+
+ ///
+ /// No state.
+ ///
None = 0x0000000000000000,
+
+ ///
+ /// Enable blend independent.
+ ///
BlendIndependent = 0x0000000400000000,
+
+ ///
+ /// Enable alpha to coverage.
+ ///
BlendAlphaToCoverage = 0x0000000800000000,
+
+ ///
+ /// Default state is write to RGB, alpha, and depth with depth test less enabled, with clockwise
+ /// culling and MSAA (when writing into MSAA frame buffer, otherwise this flag is ignored).
+ ///
Default = 0x010000500000001f,
Mask = 0xffffffffffffffff,
ReservedShift = 61,
@@ -94,43 +278,171 @@ public static partial class bgfx
None = 0x00000000,
Mask = 0xffffffff,
Default = 0x00000000,
+
+ ///
+ /// Enable stencil test, less.
+ ///
TestLess = 0x00010000,
+
+ ///
+ /// Enable stencil test, less or equal.
+ ///
TestLequal = 0x00020000,
+
+ ///
+ /// Enable stencil test, equal.
+ ///
TestEqual = 0x00030000,
+
+ ///
+ /// Enable stencil test, greater or equal.
+ ///
TestGequal = 0x00040000,
+
+ ///
+ /// Enable stencil test, greater.
+ ///
TestGreater = 0x00050000,
+
+ ///
+ /// Enable stencil test, not equal.
+ ///
TestNotequal = 0x00060000,
+
+ ///
+ /// Enable stencil test, never.
+ ///
TestNever = 0x00070000,
+
+ ///
+ /// Enable stencil test, always.
+ ///
TestAlways = 0x00080000,
TestShift = 16,
TestMask = 0x000f0000,
+
+ ///
+ /// Zero.
+ ///
OpFailSZero = 0x00000000,
+
+ ///
+ /// Keep.
+ ///
OpFailSKeep = 0x00100000,
+
+ ///
+ /// Replace.
+ ///
OpFailSReplace = 0x00200000,
+
+ ///
+ /// Increment and wrap.
+ ///
OpFailSIncr = 0x00300000,
+
+ ///
+ /// Increment and clamp.
+ ///
OpFailSIncrsat = 0x00400000,
+
+ ///
+ /// Decrement and wrap.
+ ///
OpFailSDecr = 0x00500000,
+
+ ///
+ /// Decrement and clamp.
+ ///
OpFailSDecrsat = 0x00600000,
+
+ ///
+ /// Invert.
+ ///
OpFailSInvert = 0x00700000,
OpFailSShift = 20,
OpFailSMask = 0x00f00000,
+
+ ///
+ /// Zero.
+ ///
OpFailZZero = 0x00000000,
+
+ ///
+ /// Keep.
+ ///
OpFailZKeep = 0x01000000,
+
+ ///
+ /// Replace.
+ ///
OpFailZReplace = 0x02000000,
+
+ ///
+ /// Increment and wrap.
+ ///
OpFailZIncr = 0x03000000,
+
+ ///
+ /// Increment and clamp.
+ ///
OpFailZIncrsat = 0x04000000,
+
+ ///
+ /// Decrement and wrap.
+ ///
OpFailZDecr = 0x05000000,
+
+ ///
+ /// Decrement and clamp.
+ ///
OpFailZDecrsat = 0x06000000,
+
+ ///
+ /// Invert.
+ ///
OpFailZInvert = 0x07000000,
OpFailZShift = 24,
OpFailZMask = 0x0f000000,
+
+ ///
+ /// Zero.
+ ///
OpPassZZero = 0x00000000,
+
+ ///
+ /// Keep.
+ ///
OpPassZKeep = 0x10000000,
+
+ ///
+ /// Replace.
+ ///
OpPassZReplace = 0x20000000,
+
+ ///
+ /// Increment and wrap.
+ ///
OpPassZIncr = 0x30000000,
+
+ ///
+ /// Increment and clamp.
+ ///
OpPassZIncrsat = 0x40000000,
+
+ ///
+ /// Decrement and wrap.
+ ///
OpPassZDecr = 0x50000000,
+
+ ///
+ /// Decrement and clamp.
+ ///
OpPassZDecrsat = 0x60000000,
+
+ ///
+ /// Invert.
+ ///
OpPassZInvert = 0x70000000,
OpPassZShift = 28,
OpPassZMask = 0xf0000000,
@@ -249,27 +561,94 @@ public static partial class bgfx
[Flags]
public enum BufferFlags : ushort
{
+ ///
+ /// 1 8-bit value
+ ///
ComputeFormat8x1 = 0x0001,
+
+ ///
+ /// 2 8-bit values
+ ///
ComputeFormat8x2 = 0x0002,
+
+ ///
+ /// 4 8-bit values
+ ///
ComputeFormat8x4 = 0x0003,
+
+ ///
+ /// 1 16-bit value
+ ///
ComputeFormat16x1 = 0x0004,
+
+ ///
+ /// 2 16-bit values
+ ///
ComputeFormat16x2 = 0x0005,
+
+ ///
+ /// 4 16-bit values
+ ///
ComputeFormat16x4 = 0x0006,
+
+ ///
+ /// 1 32-bit value
+ ///
ComputeFormat32x1 = 0x0007,
+
+ ///
+ /// 2 32-bit values
+ ///
ComputeFormat32x2 = 0x0008,
+
+ ///
+ /// 4 32-bit values
+ ///
ComputeFormat32x4 = 0x0009,
ComputeFormatShift = 0,
ComputeFormatMask = 0x000f,
+
+ ///
+ /// Type `int`.
+ ///
ComputeTypeInt = 0x0010,
+
+ ///
+ /// Type `uint`.
+ ///
ComputeTypeUint = 0x0020,
+
+ ///
+ /// Type `float`.
+ ///
ComputeTypeFloat = 0x0030,
ComputeTypeShift = 4,
ComputeTypeMask = 0x0030,
None = 0x0000,
+
+ ///
+ /// Buffer will be read by shader.
+ ///
ComputeRead = 0x0100,
+
+ ///
+ /// Buffer will be used for writing.
+ ///
ComputeWrite = 0x0200,
+
+ ///
+ /// Buffer will be used for storing draw indirect commands.
+ ///
DrawIndirect = 0x0400,
+
+ ///
+ /// Allow dynamic index/vertex buffer resize during update.
+ ///
AllowResize = 0x0800,
+
+ ///
+ /// Index buffer contains 32-bit indices.
+ ///
Index32 = 0x1000,
ComputeReadWrite = 0x0300,
}
@@ -278,18 +657,62 @@ public static partial class bgfx
public enum TextureFlags : ulong
{
None = 0x0000000000000000,
+
+ ///
+ /// Texture will be used for MSAA sampling.
+ ///
MsaaSample = 0x0000000800000000,
+
+ ///
+ /// Render target no MSAA.
+ ///
Rt = 0x0000001000000000,
+
+ ///
+ /// Texture will be used for compute write.
+ ///
ComputeWrite = 0x0000100000000000,
+
+ ///
+ /// Sample texture as sRGB.
+ ///
Srgb = 0x0000200000000000,
+
+ ///
+ /// Texture will be used as blit destination.
+ ///
BlitDst = 0x0000400000000000,
+
+ ///
+ /// Texture will be used for read back from GPU.
+ ///
ReadBack = 0x0000800000000000,
+
+ ///
+ /// Render target MSAAx2 mode.
+ ///
RtMsaaX2 = 0x0000002000000000,
+
+ ///
+ /// Render target MSAAx4 mode.
+ ///
RtMsaaX4 = 0x0000003000000000,
+
+ ///
+ /// Render target MSAAx8 mode.
+ ///
RtMsaaX8 = 0x0000004000000000,
+
+ ///
+ /// Render target MSAAx16 mode.
+ ///
RtMsaaX16 = 0x0000005000000000,
RtMsaaShift = 36,
RtMsaaMask = 0x0000007000000000,
+
+ ///
+ /// Render target will be used for writing
+ ///
RtWriteOnly = 0x0000008000000000,
RtShift = 36,
RtMask = 0x000000f000000000,
@@ -298,39 +721,126 @@ public static partial class bgfx
[Flags]
public enum SamplerFlags : uint
{
+ ///
+ /// Wrap U mode: Mirror
+ ///
UMirror = 0x00000001,
+
+ ///
+ /// Wrap U mode: Clamp
+ ///
UClamp = 0x00000002,
+
+ ///
+ /// Wrap U mode: Border
+ ///
UBorder = 0x00000003,
UShift = 0,
UMask = 0x00000003,
+
+ ///
+ /// Wrap V mode: Mirror
+ ///
VMirror = 0x00000004,
+
+ ///
+ /// Wrap V mode: Clamp
+ ///
VClamp = 0x00000008,
+
+ ///
+ /// Wrap V mode: Border
+ ///
VBorder = 0x0000000c,
VShift = 2,
VMask = 0x0000000c,
+
+ ///
+ /// Wrap W mode: Mirror
+ ///
WMirror = 0x00000010,
+
+ ///
+ /// Wrap W mode: Clamp
+ ///
WClamp = 0x00000020,
+
+ ///
+ /// Wrap W mode: Border
+ ///
WBorder = 0x00000030,
WShift = 4,
WMask = 0x00000030,
+
+ ///
+ /// Min sampling mode: Point
+ ///
MinPoint = 0x00000040,
+
+ ///
+ /// Min sampling mode: Anisotropic
+ ///
MinAnisotropic = 0x00000080,
MinShift = 6,
MinMask = 0x000000c0,
+
+ ///
+ /// Mag sampling mode: Point
+ ///
MagPoint = 0x00000100,
+
+ ///
+ /// Mag sampling mode: Anisotropic
+ ///
MagAnisotropic = 0x00000200,
MagShift = 8,
MagMask = 0x00000300,
+
+ ///
+ /// Mip sampling mode: Point
+ ///
MipPoint = 0x00000400,
MipShift = 10,
MipMask = 0x00000400,
+
+ ///
+ /// Compare when sampling depth texture: less.
+ ///
CompareLess = 0x00010000,
+
+ ///
+ /// Compare when sampling depth texture: less or equal.
+ ///
CompareLequal = 0x00020000,
+
+ ///
+ /// Compare when sampling depth texture: equal.
+ ///
CompareEqual = 0x00030000,
+
+ ///
+ /// Compare when sampling depth texture: greater or equal.
+ ///
CompareGequal = 0x00040000,
+
+ ///
+ /// Compare when sampling depth texture: greater.
+ ///
CompareGreater = 0x00050000,
+
+ ///
+ /// Compare when sampling depth texture: not equal.
+ ///
CompareNotequal = 0x00060000,
+
+ ///
+ /// Compare when sampling depth texture: never.
+ ///
CompareNever = 0x00070000,
+
+ ///
+ /// Compare when sampling depth texture: always.
+ ///
CompareAlways = 0x00080000,
CompareShift = 16,
CompareMask = 0x000f0000,
@@ -339,6 +849,10 @@ public static partial class bgfx
ReservedShift = 28,
ReservedMask = 0xf0000000,
None = 0x00000000,
+
+ ///
+ /// Sample stencil instead of depth.
+ ///
SampleStencil = 0x00100000,
Point = 0x00000540,
UvwMirror = 0x00000015,
@@ -350,23 +864,86 @@ public static partial class bgfx
[Flags]
public enum ResetFlags : uint
{
+ ///
+ /// Enable 2x MSAA.
+ ///
MsaaX2 = 0x00000010,
+
+ ///
+ /// Enable 4x MSAA.
+ ///
MsaaX4 = 0x00000020,
+
+ ///
+ /// Enable 8x MSAA.
+ ///
MsaaX8 = 0x00000030,
+
+ ///
+ /// Enable 16x MSAA.
+ ///
MsaaX16 = 0x00000040,
MsaaShift = 4,
MsaaMask = 0x00000070,
+
+ ///
+ /// No reset flags.
+ ///
None = 0x00000000,
+
+ ///
+ /// Not supported yet.
+ ///
Fullscreen = 0x00000001,
+
+ ///
+ /// Enable V-Sync.
+ ///
Vsync = 0x00000080,
+
+ ///
+ /// Turn on/off max anisotropy.
+ ///
Maxanisotropy = 0x00000100,
+
+ ///
+ /// Begin screen capture.
+ ///
Capture = 0x00000200,
+
+ ///
+ /// Flush rendering after submitting to GPU.
+ ///
FlushAfterRender = 0x00002000,
+
+ ///
+ /// This flag specifies where flip occurs. Default behavior is that flip occurs before rendering new frame. This flag only has effect when `BGFX_CONFIG_MULTITHREADED=0`.
+ ///
FlipAfterRender = 0x00004000,
+
+ ///
+ /// Enable sRGB backbuffer.
+ ///
SrgbBackbuffer = 0x00008000,
+
+ ///
+ /// Enable HDR10 rendering.
+ ///
Hdr10 = 0x00010000,
+
+ ///
+ /// Enable HiDPI rendering.
+ ///
Hidpi = 0x00020000,
+
+ ///
+ /// Enable depth clamp.
+ ///
DepthClamp = 0x00040000,
+
+ ///
+ /// Suspend rendering.
+ ///
Suspend = 0x00080000,
FullscreenShift = 0,
FullscreenMask = 0x00000001,
diff --git a/scripts/bgfx.idl b/scripts/bgfx.idl
index 43e1d3e5e..1dcb5bc86 100644
--- a/scripts/bgfx.idl
+++ b/scripts/bgfx.idl
@@ -328,7 +328,7 @@ flag.Reset { bits = 32 }
.Maxanisotropy (9) --- Turn on/off max anisotropy.
.Capture (10) --- Begin screen capture.
.FlushAfterRender (14) --- Flush rendering after submitting to GPU.
- .FlipAfterRender (15) --- This flag specifies where flip occurs. Default behavior is that flip occurs before rendering new frame. This flag only has effect when `BGFX_CONFIG_MULTITHREADED=0`.
+ .FlipAfterRender (15) --- This flag specifies where flip occurs. Default behavior is that flip occurs before rendering new frame. This flag only has effect when `BGFX_CONFIG_MULTITHREADED=0`.
.SrgbBackbuffer (16) --- Enable sRGB backbuffer.
.Hdr10 (17) --- Enable HDR10 rendering.
.Hidpi (18) --- Enable HiDPI rendering.
diff --git a/scripts/bindings-cs.lua b/scripts/bindings-cs.lua
index 60a2b385a..e167527bd 100644
--- a/scripts/bindings-cs.lua
+++ b/scripts/bindings-cs.lua
@@ -169,7 +169,12 @@ local function FlagBlock(typ)
end
yield("\t/// ")
- yield("\t/// " .. flag.comment)
+ if (type(flag.comment) == "table") then
+ comment = table.concat(flag.comment, "\n\t\t/// ")
+ else
+ comment = flag.comment
+ end
+ yield("\t/// " .. comment)
yield("\t/// ")
end
@@ -291,23 +296,35 @@ function converter.types(typ)
end
end
lookup[flagName] = value
- table.insert(flags, {
- name = flagName,
- value = value,
- })
+ if flag.comment ~= nil then
+ table.insert(flags, {
+ name = flagName,
+ value = value,
+ comment = flag.comment,
+ })
+ else
+ table.insert(flags, {
+ name = flagName,
+ value = value,
+ })
+ end
end
+
if typ.shift then
table.insert(flags, {
name = name .. "Shift",
value = typ.shift,
format = "%d",
+ comment = typ.comment,
})
end
+
if typ.mask then
-- generate Mask
table.insert(flags, {
name = name .. "Mask",
value = typ.mask,
+ comment = typ.comment,
})
lookup[name .. "Mask"] = typ.mask
end