Reformatted comments; fixed a couple of oversights (#3125)

This commit is contained in:
IchorDev 2023-07-08 02:40:22 +07:00 committed by GitHub
parent e2c5b1d3e1
commit d485a56f61
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 102 additions and 103 deletions

View File

@ -12,10 +12,12 @@ static import bgfx.fakeenum;
enum uint apiVersion = 121; enum uint apiVersion = 121;
alias ViewId = ushort; alias ViewID = ushort;
deprecated("Please use `ViewID` instead.") 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 = void function(void* ptr, void* userData);
///Memory release callback. ///Memory release callback.
@ -47,8 +49,8 @@ enum StateDepthTest: StateDepthTest_{
} }
/** /**
* Use BGFX_STATE_BLEND_FUNC(_src, _dst) or BGFX_STATE_BLEND_FUNC_SEPARATE(_srcRGB, _dstRGB, _srcA, _dstA) Use BGFX_STATE_BLEND_FUNC(_src, _dst) or BGFX_STATE_BLEND_FUNC_SEPARATE(_srcRGB, _dstRGB, _srcA, _dstA)
* helper macros. helper macros.
*/ */
alias StateBlend_ = ulong; alias StateBlend_ = ulong;
enum StateBlend: StateBlend_{ enum StateBlend: StateBlend_{
@ -74,8 +76,8 @@ enum StateBlend: StateBlend_{
} }
/** /**
* Use BGFX_STATE_BLEND_EQUATION(_equation) or BGFX_STATE_BLEND_EQUATION_SEPARATE(_equationRGB, _equationA) Use BGFX_STATE_BLEND_EQUATION(_equation) or BGFX_STATE_BLEND_EQUATION_SEPARATE(_equationRGB, _equationA)
* helper macros. helper macros.
*/ */
alias StateBlendEquation_ = ulong; alias StateBlendEquation_ = ulong;
enum StateBlendEquation: StateBlendEquation_{ enum StateBlendEquation: StateBlendEquation_{
@ -93,6 +95,7 @@ alias StateCull_ = ulong;
enum StateCull: StateCull_{ enum StateCull: StateCull_{
cw = 0x0000_0010_0000_0000, ///Cull clockwise triangles. cw = 0x0000_0010_0000_0000, ///Cull clockwise triangles.
ccw = 0x0000_0020_0000_0000, ///Cull counter-clockwise triangles. ccw = 0x0000_0020_0000_0000, ///Cull counter-clockwise triangles.
acw = ccw,
shift = 36, ///Culling mode bit shift shift = 36, ///Culling mode bit shift
mask = 0x0000_0030_0000_0000, ///Culling mode bit mask mask = 0x0000_0030_0000_0000, ///Culling mode bit mask
} }
@ -124,8 +127,8 @@ enum StatePointSize: StatePointSize_{
StatePointSize_ toStatePointSize(ulong v){ return (v << StatePointSize.shift) & StatePointSize.mask; } StatePointSize_ toStatePointSize(ulong v){ return (v << StatePointSize.shift) & StatePointSize.mask; }
/** /**
* Enable MSAA write when writing into MSAA frame buffer. Enable MSAA write when writing into MSAA frame buffer.
* This flag is ignored when not writing into MSAA frame buffer. This flag is ignored when not writing into MSAA frame buffer.
*/ */
alias State_ = ulong; alias State_ = ulong;
enum State: State_{ enum State: State_{
@ -134,6 +137,7 @@ enum State: State_{
conservativeRaster = 0x0400_0000_0000_0000, ///Enable conservative rasterization. conservativeRaster = 0x0400_0000_0000_0000, ///Enable conservative rasterization.
none = 0x0000_0000_0000_0000, ///No state. none = 0x0000_0000_0000_0000, ///No state.
frontCCW = 0x0000_0080_0000_0000, ///Front counter-clockwise (default is clockwise). frontCCW = 0x0000_0080_0000_0000, ///Front counter-clockwise (default is clockwise).
frontACW = frontCCW,
blendIndependent = 0x0000_0004_0000_0000, ///Enable blend independent. blendIndependent = 0x0000_0004_0000_0000, ///Enable blend independent.
blendAlphaToCoverage = 0x0000_0008_0000_0000, ///Enable alpha to coverage. blendAlphaToCoverage = 0x0000_0008_0000_0000, ///Enable alpha to coverage.
/** /**
@ -261,8 +265,8 @@ enum Clear: Clear_{
} }
/** /**
* Rendering state discard. When state is preserved in submit, rendering states can be discarded Rendering state discard. When state is preserved in submit, rendering states can be discarded
* on a finer grain. on a finer grain.
*/ */
alias Discard_ = ubyte; alias Discard_ = ubyte;
enum Discard: Discard_{ enum Discard: Discard_{
@ -510,7 +514,7 @@ enum CapFlags: CapFlags_{
textureBlit = 0x0000_0000_0004_0000, ///Texture blit is supported. textureBlit = 0x0000_0000_0004_0000, ///Texture blit is supported.
transparentBackbuffer = 0x0000_0000_0008_0000, ///Transparent back buffer supported. transparentBackbuffer = 0x0000_0000_0008_0000, ///Transparent back buffer supported.
textureCompareReserved = 0x0000_0000_0010_0000, textureCompareReserved = 0x0000_0000_0010_0000,
textureCompareLequal = 0x0000_0000_0020_0000, ///Texture compare less equal mode is supported. textureCompareLEqual = 0x0000_0000_0020_0000, ///Texture compare less equal mode is supported.
textureCubeArray = 0x0000_0000_0040_0000, ///Cubemap texture array is supported. textureCubeArray = 0x0000_0000_0040_0000, ///Cubemap texture array is supported.
textureDirectAccess = 0x0000_0000_0080_0000, ///CPU direct access to GPU texture memory. textureDirectAccess = 0x0000_0000_0080_0000, ///CPU direct access to GPU texture memory.
textureReadBack = 0x0000_0000_0100_0000, ///Read-back texture is supported. textureReadBack = 0x0000_0000_0100_0000, ///Read-back texture is supported.
@ -573,7 +577,6 @@ enum CubeMap: CubeMap_{
} }
///Fatal error enum. ///Fatal error enum.
enum Fatal: bgfx.fakeenum.Fatal.Enum{ enum Fatal: bgfx.fakeenum.Fatal.Enum{
debugCheck = bgfx.fakeenum.Fatal.Enum.debugCheck, debugCheck = bgfx.fakeenum.Fatal.Enum.debugCheck,
invalidShader = bgfx.fakeenum.Fatal.Enum.invalidShader, invalidShader = bgfx.fakeenum.Fatal.Enum.invalidShader,
@ -585,7 +588,6 @@ enum Fatal: bgfx.fakeenum.Fatal.Enum{
} }
///Renderer backend type enum. ///Renderer backend type enum.
enum RendererType: bgfx.fakeenum.RendererType.Enum{ enum RendererType: bgfx.fakeenum.RendererType.Enum{
noop = bgfx.fakeenum.RendererType.Enum.noop, noop = bgfx.fakeenum.RendererType.Enum.noop,
agc = bgfx.fakeenum.RendererType.Enum.agc, agc = bgfx.fakeenum.RendererType.Enum.agc,
@ -603,7 +605,6 @@ enum RendererType: bgfx.fakeenum.RendererType.Enum{
} }
///Access mode enum. ///Access mode enum.
enum Access: bgfx.fakeenum.Access.Enum{ enum Access: bgfx.fakeenum.Access.Enum{
read = bgfx.fakeenum.Access.Enum.read, read = bgfx.fakeenum.Access.Enum.read,
write = bgfx.fakeenum.Access.Enum.write, write = bgfx.fakeenum.Access.Enum.write,
@ -612,7 +613,6 @@ enum Access: bgfx.fakeenum.Access.Enum{
} }
///Vertex attribute enum. ///Vertex attribute enum.
enum Attrib: bgfx.fakeenum.Attrib.Enum{ enum Attrib: bgfx.fakeenum.Attrib.Enum{
position = bgfx.fakeenum.Attrib.Enum.position, position = bgfx.fakeenum.Attrib.Enum.position,
normal = bgfx.fakeenum.Attrib.Enum.normal, normal = bgfx.fakeenum.Attrib.Enum.normal,
@ -640,7 +640,6 @@ enum Attrib: bgfx.fakeenum.Attrib.Enum{
} }
///Vertex attribute type enum. ///Vertex attribute type enum.
enum AttribType: bgfx.fakeenum.AttribType.Enum{ enum AttribType: bgfx.fakeenum.AttribType.Enum{
uint8 = bgfx.fakeenum.AttribType.Enum.uint8, uint8 = bgfx.fakeenum.AttribType.Enum.uint8,
uint10 = bgfx.fakeenum.AttribType.Enum.uint10, uint10 = bgfx.fakeenum.AttribType.Enum.uint10,
@ -651,20 +650,19 @@ enum AttribType: bgfx.fakeenum.AttribType.Enum{
} }
/** /**
* Texture format enum. Texture format enum.
* Notation: Notation:
* RGBA16S RGBA16S
* ^ ^ ^ ^ ^ ^
* | | +-- [ ]Unorm | | +-- [ ]Unorm
* | | [F]loat | | [F]loat
* | | [S]norm | | [S]norm
* | | [I]nt | | [I]nt
* | | [U]int | | [U]int
* | +---- Number of bits per component | +---- Number of bits per component
* +-------- 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.fakeenum.TextureFormat.Enum{
bc1 = bgfx.fakeenum.TextureFormat.Enum.bc1, bc1 = bgfx.fakeenum.TextureFormat.Enum.bc1,
bc2 = bgfx.fakeenum.TextureFormat.Enum.bc2, bc2 = bgfx.fakeenum.TextureFormat.Enum.bc2,
@ -766,7 +764,6 @@ enum TextureFormat: bgfx.fakeenum.TextureFormat.Enum{
} }
///Uniform type enum. ///Uniform type enum.
enum UniformType: bgfx.fakeenum.UniformType.Enum{ enum UniformType: bgfx.fakeenum.UniformType.Enum{
sampler = bgfx.fakeenum.UniformType.Enum.sampler, sampler = bgfx.fakeenum.UniformType.Enum.sampler,
end = bgfx.fakeenum.UniformType.Enum.end, end = bgfx.fakeenum.UniformType.Enum.end,
@ -777,7 +774,6 @@ enum UniformType: bgfx.fakeenum.UniformType.Enum{
} }
///Backbuffer ratio enum. ///Backbuffer ratio enum.
enum BackbufferRatio: bgfx.fakeenum.BackbufferRatio.Enum{ enum BackbufferRatio: bgfx.fakeenum.BackbufferRatio.Enum{
equal = bgfx.fakeenum.BackbufferRatio.Enum.equal, equal = bgfx.fakeenum.BackbufferRatio.Enum.equal,
half = bgfx.fakeenum.BackbufferRatio.Enum.half, half = bgfx.fakeenum.BackbufferRatio.Enum.half,
@ -789,7 +785,6 @@ enum BackbufferRatio: bgfx.fakeenum.BackbufferRatio.Enum{
} }
///Occlusion query result. ///Occlusion query result.
enum OcclusionQueryResult: bgfx.fakeenum.OcclusionQueryResult.Enum{ enum OcclusionQueryResult: bgfx.fakeenum.OcclusionQueryResult.Enum{
invisible = bgfx.fakeenum.OcclusionQueryResult.Enum.invisible, invisible = bgfx.fakeenum.OcclusionQueryResult.Enum.invisible,
visible = bgfx.fakeenum.OcclusionQueryResult.Enum.visible, visible = bgfx.fakeenum.OcclusionQueryResult.Enum.visible,
@ -798,7 +793,6 @@ enum OcclusionQueryResult: bgfx.fakeenum.OcclusionQueryResult.Enum{
} }
///Primitive topology. ///Primitive topology.
enum Topology: bgfx.fakeenum.Topology.Enum{ enum Topology: bgfx.fakeenum.Topology.Enum{
triList = bgfx.fakeenum.Topology.Enum.triList, triList = bgfx.fakeenum.Topology.Enum.triList,
triStrip = bgfx.fakeenum.Topology.Enum.triStrip, triStrip = bgfx.fakeenum.Topology.Enum.triStrip,
@ -809,7 +803,6 @@ enum Topology: bgfx.fakeenum.Topology.Enum{
} }
///Topology conversion function. ///Topology conversion function.
enum TopologyConvert: bgfx.fakeenum.TopologyConvert.Enum{ enum TopologyConvert: bgfx.fakeenum.TopologyConvert.Enum{
triListFlipWinding = bgfx.fakeenum.TopologyConvert.Enum.triListFlipWinding, triListFlipWinding = bgfx.fakeenum.TopologyConvert.Enum.triListFlipWinding,
triStripFlipWinding = bgfx.fakeenum.TopologyConvert.Enum.triStripFlipWinding, triStripFlipWinding = bgfx.fakeenum.TopologyConvert.Enum.triStripFlipWinding,
@ -820,7 +813,6 @@ enum TopologyConvert: bgfx.fakeenum.TopologyConvert.Enum{
} }
///Topology sort order. ///Topology sort order.
enum TopologySort: bgfx.fakeenum.TopologySort.Enum{ enum TopologySort: bgfx.fakeenum.TopologySort.Enum{
directionFrontToBackMin = bgfx.fakeenum.TopologySort.Enum.directionFrontToBackMin, directionFrontToBackMin = bgfx.fakeenum.TopologySort.Enum.directionFrontToBackMin,
directionFrontToBackAvg = bgfx.fakeenum.TopologySort.Enum.directionFrontToBackAvg, directionFrontToBackAvg = bgfx.fakeenum.TopologySort.Enum.directionFrontToBackAvg,
@ -838,7 +830,6 @@ enum TopologySort: bgfx.fakeenum.TopologySort.Enum{
} }
///View mode sets draw call sort order. ///View mode sets draw call sort order.
enum ViewMode: bgfx.fakeenum.ViewMode.Enum{ enum ViewMode: bgfx.fakeenum.ViewMode.Enum{
default_ = bgfx.fakeenum.ViewMode.Enum.default_, default_ = bgfx.fakeenum.ViewMode.Enum.default_,
sequential = bgfx.fakeenum.ViewMode.Enum.sequential, sequential = bgfx.fakeenum.ViewMode.Enum.sequential,
@ -848,7 +839,6 @@ enum ViewMode: bgfx.fakeenum.ViewMode.Enum{
} }
///Render frame enum. ///Render frame enum.
enum RenderFrame: bgfx.fakeenum.RenderFrame.Enum{ enum RenderFrame: bgfx.fakeenum.RenderFrame.Enum{
noContext = bgfx.fakeenum.RenderFrame.Enum.noContext, noContext = bgfx.fakeenum.RenderFrame.Enum.noContext,
render = bgfx.fakeenum.RenderFrame.Enum.render, render = bgfx.fakeenum.RenderFrame.Enum.render,
@ -996,9 +986,9 @@ extern(C++, "bgfx") struct Caps{
uint maxUniforms; ///Maximum number of uniform handles. uint maxUniforms; ///Maximum number of uniform handles.
uint maxOcclusionQueries; ///Maximum number of occlusion query handles. uint maxOcclusionQueries; ///Maximum number of occlusion query handles.
uint maxEncoders; ///Maximum number of encoder threads. uint maxEncoders; ///Maximum number of encoder threads.
uint minResourceCbSize; ///Minimum resource command buffer size. uint minResourceCBSize; ///Minimum resource command buffer size.
uint transientVbSize; ///Maximum transient vertex buffer size. uint transientVBSize; ///Maximum transient vertex buffer size.
uint transientIbSize; ///Maximum transient index buffer size. uint transientIBSize; ///Maximum transient index buffer size.
} }
///GPU info. ///GPU info.
extern(C++, "bgfx") struct GPU{ extern(C++, "bgfx") struct GPU{
@ -1107,9 +1097,9 @@ extern(C++, "bgfx") struct Init{
///Configurable runtime limits parameters. ///Configurable runtime limits parameters.
extern(C++, "bgfx") struct Limits{ extern(C++, "bgfx") struct Limits{
ushort maxEncoders; ///Maximum number of encoder threads. ushort maxEncoders; ///Maximum number of encoder threads.
uint minResourceCbSize; ///Minimum resource command buffer size. uint minResourceCBSize; ///Minimum resource command buffer size.
uint transientVbSize; ///Maximum transient vertex buffer size. uint transientVBSize; ///Maximum transient vertex buffer size.
uint transientIbSize; ///Maximum transient index buffer size. uint transientIBSize; ///Maximum transient index buffer size.
} }
/** /**
@ -1259,7 +1249,7 @@ extern(C++, "bgfx") struct Transform{
///View stats. ///View stats.
extern(C++, "bgfx") struct ViewStats{ extern(C++, "bgfx") struct ViewStats{
char[256] name; ///View name. char[256] name; ///View name.
ViewId view; ///View id. ViewID view; ///View id.
long cpuTimeBegin; ///CPU (submit) begin time. long cpuTimeBegin; ///CPU (submit) begin time.
long cpuTimeEnd; ///CPU (submit) end time. long cpuTimeEnd; ///CPU (submit) end time.
long gpuTimeBegin; ///GPU begin time. long gpuTimeBegin; ///GPU begin time.
@ -1306,8 +1296,8 @@ extern(C++, "bgfx") struct Stats{
ushort numVertexLayouts; ///Number of used vertex layouts. ushort numVertexLayouts; ///Number of used vertex layouts.
long textureMemoryUsed; ///Estimate of texture memory used. long textureMemoryUsed; ///Estimate of texture memory used.
long rtMemoryUsed; ///Estimate of render target memory used. long rtMemoryUsed; ///Estimate of render target memory used.
int transientVbUsed; ///Amount of transient vertex buffer used. int transientVBUsed; ///Amount of transient vertex buffer used.
int transientIbUsed; ///Amount of transient index buffer used. int transientIBUsed; ///Amount of transient index buffer used.
uint[Topology.count] numPrims; ///Number of primitives rendered. uint[Topology.count] numPrims; ///Number of primitives rendered.
long gpuMemoryMax; ///Maximum available GPU memory for application. long gpuMemoryMax; ///Maximum available GPU memory for application.
long gpuMemoryUsed; ///Amount of GPU memory used by the application. long gpuMemoryUsed; ///Amount of GPU memory used by the application.
@ -1700,7 +1690,7 @@ extern(C++, "bgfx") struct Encoder{
Params: Params:
id = View id. id = View id.
*/ */
[q{void}, q{touch}, q{ViewId id}, `C++`], [q{void}, q{touch}, q{ViewID id}, `C++`],
/** /**
Submit primitive for rendering. Submit primitive for rendering.
@ -1710,7 +1700,7 @@ extern(C++, "bgfx") struct Encoder{
depth = Depth for sorting. depth = Depth for sorting.
flags = Discard or preserve states. See `BGFX_DISCARD_*`. flags = Discard or preserve states. See `BGFX_DISCARD_*`.
*/ */
[q{void}, q{submit}, q{ViewId id, ProgramHandle program, uint depth=0, ubyte flags=Discard.all}, `C++`], [q{void}, q{submit}, q{ViewID id, ProgramHandle program, uint depth=0, ubyte flags=Discard.all}, `C++`],
/** /**
Submit primitive with occlusion query for rendering. Submit primitive with occlusion query for rendering.
@ -1721,7 +1711,7 @@ extern(C++, "bgfx") struct Encoder{
depth = Depth for sorting. depth = Depth for sorting.
flags = Discard or preserve states. See `BGFX_DISCARD_*`. flags = Discard or preserve states. See `BGFX_DISCARD_*`.
*/ */
[q{void}, q{submit}, q{ViewId id, ProgramHandle program, OcclusionQueryHandle occlusionQuery, uint depth=0, ubyte flags=Discard.all}, `C++`], [q{void}, q{submit}, q{ViewID id, ProgramHandle program, OcclusionQueryHandle occlusionQuery, uint depth=0, ubyte flags=Discard.all}, `C++`],
/** /**
Submit primitive for rendering with index and instance data info from Submit primitive for rendering with index and instance data info from
@ -1736,7 +1726,7 @@ extern(C++, "bgfx") struct Encoder{
depth = Depth for sorting. depth = Depth for sorting.
flags = Discard or preserve states. See `BGFX_DISCARD_*`. flags = Discard or preserve states. See `BGFX_DISCARD_*`.
*/ */
[q{void}, q{submit}, q{ViewId id, ProgramHandle program, IndirectBufferHandle indirectHandle, ushort start=0, ushort num=1, uint depth=0, ubyte flags=Discard.all}, `C++`], [q{void}, q{submit}, q{ViewID id, ProgramHandle program, IndirectBufferHandle indirectHandle, ushort start=0, ushort num=1, uint depth=0, ubyte flags=Discard.all}, `C++`],
/** /**
Submit primitive for rendering with index and instance data info and Submit primitive for rendering with index and instance data info and
@ -1754,7 +1744,7 @@ extern(C++, "bgfx") struct Encoder{
depth = Depth for sorting. depth = Depth for sorting.
flags = Discard or preserve states. See `BGFX_DISCARD_*`. flags = Discard or preserve states. See `BGFX_DISCARD_*`.
*/ */
[q{void}, q{submit}, q{ViewId id, ProgramHandle program, IndirectBufferHandle indirectHandle, ushort start, IndexBufferHandle numHandle, uint numIndex=0, ushort numMax=ushort.max, uint depth=0, ubyte flags=Discard.all}, `C++`], [q{void}, q{submit}, q{ViewID id, ProgramHandle program, IndirectBufferHandle indirectHandle, ushort start, IndexBufferHandle numHandle, uint numIndex=0, ushort numMax=ushort.max, uint depth=0, ubyte flags=Discard.all}, `C++`],
/** /**
Set compute index buffer. Set compute index buffer.
@ -1822,7 +1812,7 @@ extern(C++, "bgfx") struct Encoder{
numZ = Number of groups Z. numZ = Number of groups Z.
flags = Discard or preserve states. See `BGFX_DISCARD_*`. flags = Discard or preserve states. See `BGFX_DISCARD_*`.
*/ */
[q{void}, q{dispatch}, q{ViewId id, ProgramHandle program, uint numX=1, uint numY=1, uint numZ=1, ubyte flags=Discard.all}, `C++`], [q{void}, q{dispatch}, q{ViewID id, ProgramHandle program, uint numX=1, uint numY=1, uint numZ=1, ubyte flags=Discard.all}, `C++`],
/** /**
Dispatch compute indirect. Dispatch compute indirect.
@ -1834,7 +1824,7 @@ extern(C++, "bgfx") struct Encoder{
num = Number of dispatches. num = Number of dispatches.
flags = Discard or preserve states. See `BGFX_DISCARD_*`. flags = Discard or preserve states. See `BGFX_DISCARD_*`.
*/ */
[q{void}, q{dispatch}, q{ViewId id, ProgramHandle program, IndirectBufferHandle indirectHandle, ushort start=0, ushort num=1, ubyte flags=Discard.all}, `C++`], [q{void}, q{dispatch}, q{ViewID id, ProgramHandle program, IndirectBufferHandle indirectHandle, ushort start=0, ushort num=1, ubyte flags=Discard.all}, `C++`],
/** /**
Discard previously set state for draw or compute call. Discard previously set state for draw or compute call.
@ -1858,7 +1848,7 @@ extern(C++, "bgfx") struct Encoder{
width = Width of region. width = Width of region.
height = Height of region. height = Height of region.
*/ */
[q{void}, q{blit}, q{ViewId id, TextureHandle dst, ushort dstX, ushort dstY, TextureHandle src, ushort srcX=0, ushort srcY=0, ushort width=ushort.max, ushort height=ushort.max}, `C++`], [q{void}, q{blit}, q{ViewID id, TextureHandle dst, ushort dstX, ushort dstY, TextureHandle src, ushort srcX=0, ushort srcY=0, ushort width=ushort.max, ushort height=ushort.max}, `C++`],
/** /**
Blit 2D texture region between two 2D textures. Blit 2D texture region between two 2D textures.
@ -1885,7 +1875,7 @@ extern(C++, "bgfx") struct Encoder{
depth = If texture is 3D this argument represents depth of region, otherwise it's depth = If texture is 3D this argument represents depth of region, otherwise it's
unused. unused.
*/ */
[q{void}, q{blit}, q{ViewId id, TextureHandle dst, ubyte dstMIP, ushort dstX, ushort dstY, ushort dstZ, TextureHandle src, ubyte srcMIP=0, ushort srcX=0, ushort srcY=0, ushort srcZ=0, ushort width=ushort.max, ushort height=ushort.max, ushort depth=ushort.max}, `C++`], [q{void}, q{blit}, q{ViewID id, TextureHandle dst, ubyte dstMIP, ushort dstX, ushort dstY, ushort dstZ, TextureHandle src, ubyte srcMIP=0, ushort srcX=0, ushort srcY=0, ushort srcZ=0, ushort width=ushort.max, ushort height=ushort.max, ushort depth=ushort.max}, `C++`],
], true); ], true);
return ret; return ret;
}(), typeof(this).stringof)); }(), typeof(this).stringof));
@ -2907,7 +2897,7 @@ mixin(joinFnBinds((){
id = View id. id = View id.
name = View name. name = View name.
*/ */
[q{void}, q{setViewName}, q{ViewId id, const(char)* name}, `C++, "bgfx"`], [q{void}, q{setViewName}, q{ViewID id, const(char)* name}, `C++, "bgfx"`],
/** /**
* Set view rectangle. Draw primitive outside view will be clipped. * Set view rectangle. Draw primitive outside view will be clipped.
@ -2918,7 +2908,7 @@ mixin(joinFnBinds((){
width = Width of view port region. width = Width of view port region.
height = Height of view port region. height = Height of view port region.
*/ */
[q{void}, q{setViewRect}, q{ViewId id, ushort x, ushort y, ushort width, ushort height}, `C++, "bgfx"`], [q{void}, q{setViewRect}, q{ViewID id, ushort x, ushort y, ushort width, ushort height}, `C++, "bgfx"`],
/** /**
* Set view rectangle. Draw primitive outside view will be clipped. * Set view rectangle. Draw primitive outside view will be clipped.
@ -2929,7 +2919,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}, `C++, "bgfx"`], [q{void}, q{setViewRect}, q{ViewID id, ushort x, ushort y, bgfx.fakeenum.BackbufferRatio.Enum ratio}, `C++, "bgfx"`],
/** /**
* Set view scissor. Draw primitive outside view will be clipped. When * Set view scissor. Draw primitive outside view will be clipped. When
@ -2941,7 +2931,7 @@ mixin(joinFnBinds((){
width = Width of view scissor region. width = Width of view scissor region.
height = Height of view scissor region. height = Height of view scissor region.
*/ */
[q{void}, q{setViewScissor}, q{ViewId id, ushort x=0, ushort y=0, ushort width=0, ushort height=0}, `C++, "bgfx"`], [q{void}, q{setViewScissor}, q{ViewID id, ushort x=0, ushort y=0, ushort width=0, ushort height=0}, `C++, "bgfx"`],
/** /**
* Set view clear flags. * Set view clear flags.
@ -2953,7 +2943,7 @@ mixin(joinFnBinds((){
depth = Depth clear value. depth = Depth clear value.
stencil = Stencil clear value. stencil = Stencil clear value.
*/ */
[q{void}, q{setViewClear}, q{ViewId id, ushort flags, uint rgba=0x000000ff, float depth=1.0f, ubyte stencil=0}, `C++, "bgfx"`], [q{void}, q{setViewClear}, q{ViewID id, ushort flags, uint rgba=0x000000ff, float depth=1.0f, ubyte stencil=0}, `C++, "bgfx"`],
/** /**
* Set view clear flags with different clear color for each * Set view clear flags with different clear color for each
@ -2974,7 +2964,7 @@ mixin(joinFnBinds((){
c6 = Palette index for frame buffer attachment 6. c6 = Palette index for frame buffer attachment 6.
c7 = Palette index for frame buffer attachment 7. c7 = Palette index for frame buffer attachment 7.
*/ */
[q{void}, q{setViewClear}, q{ViewId id, ushort flags, float depth, ubyte stencil, ubyte c0=ubyte.max, ubyte c1=ubyte.max, ubyte c2=ubyte.max, ubyte c3=ubyte.max, ubyte c4=ubyte.max, ubyte c5=ubyte.max, ubyte c6=ubyte.max, ubyte c7=ubyte.max}, `C++, "bgfx"`], [q{void}, q{setViewClear}, q{ViewID id, ushort flags, float depth, ubyte stencil, ubyte c0=ubyte.max, ubyte c1=ubyte.max, ubyte c2=ubyte.max, ubyte c3=ubyte.max, ubyte c4=ubyte.max, ubyte c5=ubyte.max, ubyte c6=ubyte.max, ubyte c7=ubyte.max}, `C++, "bgfx"`],
/** /**
* Set view sorting mode. * Set view sorting mode.
@ -2984,7 +2974,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_}, `C++, "bgfx"`], [q{void}, q{setViewMode}, q{ViewID id, bgfx.fakeenum.ViewMode.Enum mode=ViewMode.default_}, `C++, "bgfx"`],
/** /**
* Set view frame buffer. * Set view frame buffer.
@ -2996,7 +2986,7 @@ mixin(joinFnBinds((){
frame buffer handle will draw primitives from this view into frame buffer handle will draw primitives from this view into
default back buffer. default back buffer.
*/ */
[q{void}, q{setViewFrameBuffer}, q{ViewId id, FrameBufferHandle handle}, `C++, "bgfx"`], [q{void}, q{setViewFrameBuffer}, q{ViewID id, FrameBufferHandle handle}, `C++, "bgfx"`],
/** /**
* Set view's view matrix and projection matrix, * Set view's view matrix and projection matrix,
@ -3006,7 +2996,7 @@ mixin(joinFnBinds((){
view = View matrix. view = View matrix.
proj = Projection matrix. proj = Projection matrix.
*/ */
[q{void}, q{setViewTransform}, q{ViewId id, const(void)* view, const(void)* proj}, `C++, "bgfx"`], [q{void}, q{setViewTransform}, q{ViewID id, const(void)* view, const(void)* proj}, `C++, "bgfx"`],
/** /**
* Post submit view reordering. * Post submit view reordering.
@ -3016,12 +3006,12 @@ mixin(joinFnBinds((){
order = View remap id table. Passing `NULL` will reset view ids order = View remap id table. Passing `NULL` will reset view ids
to default state. to default state.
*/ */
[q{void}, q{setViewOrder}, q{ViewId id=0, ushort num=ushort.max, const(ViewId)* order=null}, `C++, "bgfx"`], [q{void}, q{setViewOrder}, q{ViewID id=0, ushort num=ushort.max, const(ViewID)* order=null}, `C++, "bgfx"`],
/** /**
* Reset all view settings to default. * Reset all view settings to default.
*/ */
[q{void}, q{resetView}, q{ViewId id}, `C++, "bgfx"`], [q{void}, q{resetView}, q{ViewID id}, `C++, "bgfx"`],
/** /**
* Begin submitting draw calls from thread. * Begin submitting draw calls from thread.
@ -3407,7 +3397,7 @@ mixin(joinFnBinds((){
Params: Params:
id = View id. id = View id.
*/ */
[q{void}, q{touch}, q{ViewId id}, `C++, "bgfx"`], [q{void}, q{touch}, q{ViewID id}, `C++, "bgfx"`],
/** /**
* Submit primitive for rendering. * Submit primitive for rendering.
@ -3417,7 +3407,7 @@ mixin(joinFnBinds((){
depth = Depth for sorting. depth = Depth for sorting.
flags = Which states to discard for next draw. See `BGFX_DISCARD_*`. flags = Which states to discard for next draw. See `BGFX_DISCARD_*`.
*/ */
[q{void}, q{submit}, q{ViewId id, ProgramHandle program, uint depth=0, ubyte flags=Discard.all}, `C++, "bgfx"`], [q{void}, q{submit}, q{ViewID id, ProgramHandle program, uint depth=0, ubyte flags=Discard.all}, `C++, "bgfx"`],
/** /**
* Submit primitive with occlusion query for rendering. * Submit primitive with occlusion query for rendering.
@ -3428,7 +3418,7 @@ mixin(joinFnBinds((){
depth = Depth for sorting. depth = Depth for sorting.
flags = Which states to discard for next draw. See `BGFX_DISCARD_*`. flags = Which states to discard for next draw. See `BGFX_DISCARD_*`.
*/ */
[q{void}, q{submit}, q{ViewId id, ProgramHandle program, OcclusionQueryHandle occlusionQuery, uint depth=0, ubyte flags=Discard.all}, `C++, "bgfx"`], [q{void}, q{submit}, q{ViewID id, ProgramHandle program, OcclusionQueryHandle occlusionQuery, uint depth=0, ubyte flags=Discard.all}, `C++, "bgfx"`],
/** /**
* Submit primitive for rendering with index and instance data info from * Submit primitive for rendering with index and instance data info from
@ -3443,7 +3433,7 @@ mixin(joinFnBinds((){
depth = Depth for sorting. depth = Depth for sorting.
flags = Which states to discard for next draw. See `BGFX_DISCARD_*`. flags = Which states to discard for next draw. See `BGFX_DISCARD_*`.
*/ */
[q{void}, q{submit}, q{ViewId id, ProgramHandle program, IndirectBufferHandle indirectHandle, ushort start=0, ushort num=1, uint depth=0, ubyte flags=Discard.all}, `C++, "bgfx"`], [q{void}, q{submit}, q{ViewID id, ProgramHandle program, IndirectBufferHandle indirectHandle, ushort start=0, ushort num=1, uint depth=0, ubyte flags=Discard.all}, `C++, "bgfx"`],
/** /**
* Submit primitive for rendering with index and instance data info and * Submit primitive for rendering with index and instance data info and
@ -3461,7 +3451,7 @@ mixin(joinFnBinds((){
depth = Depth for sorting. depth = Depth for sorting.
flags = Which states to discard for next draw. See `BGFX_DISCARD_*`. flags = Which states to discard for next draw. See `BGFX_DISCARD_*`.
*/ */
[q{void}, q{submit}, q{ViewId id, ProgramHandle program, IndirectBufferHandle indirectHandle, ushort start, IndexBufferHandle numHandle, uint numIndex=0, ushort numMax=ushort.max, uint depth=0, ubyte flags=Discard.all}, `C++, "bgfx"`], [q{void}, q{submit}, q{ViewID id, ProgramHandle program, IndirectBufferHandle indirectHandle, ushort start, IndexBufferHandle numHandle, uint numIndex=0, ushort numMax=ushort.max, uint depth=0, ubyte flags=Discard.all}, `C++, "bgfx"`],
/** /**
* Set compute index buffer. * Set compute index buffer.
@ -3529,7 +3519,7 @@ mixin(joinFnBinds((){
numZ = Number of groups Z. numZ = Number of groups Z.
flags = Discard or preserve states. See `BGFX_DISCARD_*`. flags = Discard or preserve states. See `BGFX_DISCARD_*`.
*/ */
[q{void}, q{dispatch}, q{ViewId id, ProgramHandle program, uint numX=1, uint numY=1, uint numZ=1, ubyte flags=Discard.all}, `C++, "bgfx"`], [q{void}, q{dispatch}, q{ViewID id, ProgramHandle program, uint numX=1, uint numY=1, uint numZ=1, ubyte flags=Discard.all}, `C++, "bgfx"`],
/** /**
* Dispatch compute indirect. * Dispatch compute indirect.
@ -3541,7 +3531,7 @@ mixin(joinFnBinds((){
num = Number of dispatches. num = Number of dispatches.
flags = Discard or preserve states. See `BGFX_DISCARD_*`. flags = Discard or preserve states. See `BGFX_DISCARD_*`.
*/ */
[q{void}, q{dispatch}, q{ViewId id, ProgramHandle program, IndirectBufferHandle indirectHandle, ushort start=0, ushort num=1, ubyte flags=Discard.all}, `C++, "bgfx"`], [q{void}, q{dispatch}, q{ViewID id, ProgramHandle program, IndirectBufferHandle indirectHandle, ushort start=0, ushort num=1, ubyte flags=Discard.all}, `C++, "bgfx"`],
/** /**
* Discard previously set state for draw or compute call. * Discard previously set state for draw or compute call.
@ -3565,7 +3555,7 @@ mixin(joinFnBinds((){
width = Width of region. width = Width of region.
height = Height of region. height = Height of region.
*/ */
[q{void}, q{blit}, q{ViewId id, TextureHandle dst, ushort dstX, ushort dstY, TextureHandle src, ushort srcX=0, ushort srcY=0, ushort width=ushort.max, ushort height=ushort.max}, `C++, "bgfx"`], [q{void}, q{blit}, q{ViewID id, TextureHandle dst, ushort dstX, ushort dstY, TextureHandle src, ushort srcX=0, ushort srcY=0, ushort width=ushort.max, ushort height=ushort.max}, `C++, "bgfx"`],
/** /**
* Blit 2D texture region between two 2D textures. * Blit 2D texture region between two 2D textures.
@ -3592,7 +3582,7 @@ mixin(joinFnBinds((){
depth = If texture is 3D this argument represents depth of region, otherwise it's depth = If texture is 3D this argument represents depth of region, otherwise it's
unused. unused.
*/ */
[q{void}, q{blit}, q{ViewId id, TextureHandle dst, ubyte dstMIP, ushort dstX, ushort dstY, ushort dstZ, TextureHandle src, ubyte srcMIP=0, ushort srcX=0, ushort srcY=0, ushort srcZ=0, ushort width=ushort.max, ushort height=ushort.max, ushort depth=ushort.max}, `C++, "bgfx"`], [q{void}, q{blit}, q{ViewID id, TextureHandle dst, ubyte dstMIP, ushort dstX, ushort dstY, ushort dstZ, TextureHandle src, ubyte srcMIP=0, ushort srcX=0, ushort srcY=0, ushort srcZ=0, ushort width=ushort.max, ushort height=ushort.max, ushort depth=ushort.max}, `C++, "bgfx"`],
]); ]);
return ret; return ret;

View File

@ -16,10 +16,12 @@ static import bgfx.fakeenum;
$version $version
alias ViewId = ushort; alias ViewID = ushort;
deprecated("Please use `ViewID` instead.") 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 = void function(void* ptr, void* userData);
$types $types
pragma(inline,true) nothrow @nogc pure @safe{ pragma(inline,true) nothrow @nogc pure @safe{
@ -129,10 +131,10 @@ end
local enumTypes = {} local enumTypes = {}
local membersWithFns = "" local membersWithFns = ""
local capsWords = {"Mip", "Id", "Rw", "Rt", "Pci", "Srgb", "Pt", "Ccw", "2d", "3d", "Msaa"} local capsWords = {"Mip", "Id", "Rw", "Vb", "Ib", "Cb", "Rt", "Pci", "Srgb", "Pt", "Ccw", "2d", "3d", "Msaa"}
local capsRepl = { local capsRepl = {
hidpi = "hiDPI", lineaa = "lineAA", maxanisotropy = "maxAnisotropy", hidpi = "hiDPI", lineaa = "lineAA", maxanisotropy = "maxAnisotropy",
notequal = "notEqual", gequal = "gEqual", lequal = "lEqual", notequal = "notEqual", gequal = "gEqual", Lequal = "LEqual", lequal = "lEqual",
decrsat = "decrSat", incrsat = "incrSat", revsub = "revSub", decrsat = "decrSat", incrsat = "incrSat", revsub = "revSub",
linestrip = "lineStrip", tristrip = "triStrip", linestrip = "lineStrip", tristrip = "triStrip",
} }
@ -174,7 +176,12 @@ end
-- return (name:gsub("^%l", string.upper)) -- return (name:gsub("^%l", string.upper))
-- end -- end
local usEnSubs = {Color = "Colour", Rasterize = "Rasterise", Initialize = "Initialise"} local usEnSubs = {
color = "colour", Color = "Colour",
rasterize = "rasterise", Rasterize = "Rasterise",
initialize = "initialise", Initialize = "Initialise",
ccw = "acw", CCW = "ACW",
}
local function toIntlEn(name) local function toIntlEn(name)
local change = false local change = false
for us, intl in pairs(usEnSubs) do for us, intl in pairs(usEnSubs) do
@ -252,6 +259,7 @@ local function convSomeType(arg, isFnArg)
end end
end end
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)
end end
return type return type
@ -526,7 +534,7 @@ function converter.types(typ)
else else
yield("/**") yield("/**")
for _, comment in ipairs(typ.comments) do for _, comment in ipairs(typ.comments) do
yield("* " .. comment) yield(comment)
end end
yield("*/") yield("*/")
end end
@ -538,9 +546,11 @@ function converter.types(typ)
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
--[[
elseif typ.funcptr then elseif typ.funcptr then
local args = {} local args = {}
for _, arg in ipairs(func.args) do for _, arg in ipairs(typ.args) do
if arg.fulltype == "..." then if arg.fulltype == "..." then
table.insert(args, "..." .. def) table.insert(args, "..." .. def)
else else
@ -548,13 +558,12 @@ function converter.types(typ)
end end
end end
yield(string.format("alias %s = extern(C++) %s function(%s);", func.name, convType(func.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", typeName) local otherName = string.format("bgfx.fakeenum.%s.Enum", typ.name:gsub("::Enum", ""))
yield("")
yield("enum " .. typeName .. ": " .. otherName .. "{") yield("enum " .. typeName .. ": " .. otherName .. "{")
table.insert(enumTypes, typeName) table.insert(enumTypes, typeName)
@ -682,20 +691,20 @@ extern(C++, "bgfx") package final abstract class %s{
if #flag.comment == 1 then if #flag.comment == 1 then
comments = " ///" .. flag.comment[1] comments = " ///" .. flag.comment[1]
else else
yield("/**") yield("\t/**")
for _, comment in ipairs(flag.comment) do for _, comment in ipairs(flag.comment) do
yield(comment) yield("\t" .. comment)
end end
yield("*/") 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(flag.name) local intlName = toIntlEn(name)
if intlName ~= nil then if intlName ~= nil then
intlName = convName(toCamelCase(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