fix some c# bindings gen: support arrays, move chars to bytes, marshal char* return correctly
This commit is contained in:
parent
c688a66d89
commit
1416c5981d
@ -376,6 +376,8 @@ public static partial class bgfx
|
|||||||
UnableToInitialize,
|
UnableToInitialize,
|
||||||
UnableToCreateTexture,
|
UnableToCreateTexture,
|
||||||
DeviceLost,
|
DeviceLost,
|
||||||
|
|
||||||
|
Count
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum RendererType
|
public enum RendererType
|
||||||
@ -390,6 +392,8 @@ public static partial class bgfx
|
|||||||
OpenGLES,
|
OpenGLES,
|
||||||
OpenGL,
|
OpenGL,
|
||||||
Vulkan,
|
Vulkan,
|
||||||
|
|
||||||
|
Count
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum Access
|
public enum Access
|
||||||
@ -397,6 +401,8 @@ public static partial class bgfx
|
|||||||
Read,
|
Read,
|
||||||
Write,
|
Write,
|
||||||
ReadWrite,
|
ReadWrite,
|
||||||
|
|
||||||
|
Count
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum Attrib
|
public enum Attrib
|
||||||
@ -419,6 +425,8 @@ public static partial class bgfx
|
|||||||
TexCoord5,
|
TexCoord5,
|
||||||
TexCoord6,
|
TexCoord6,
|
||||||
TexCoord7,
|
TexCoord7,
|
||||||
|
|
||||||
|
Count
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum AttribType
|
public enum AttribType
|
||||||
@ -428,6 +436,8 @@ public static partial class bgfx
|
|||||||
Int16,
|
Int16,
|
||||||
Half,
|
Half,
|
||||||
Float,
|
Float,
|
||||||
|
|
||||||
|
Count
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum TextureFormat
|
public enum TextureFormat
|
||||||
@ -517,6 +527,8 @@ public static partial class bgfx
|
|||||||
D24F,
|
D24F,
|
||||||
D32F,
|
D32F,
|
||||||
D0S8,
|
D0S8,
|
||||||
|
|
||||||
|
Count
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum UniformType
|
public enum UniformType
|
||||||
@ -526,6 +538,8 @@ public static partial class bgfx
|
|||||||
Vec4,
|
Vec4,
|
||||||
Mat3,
|
Mat3,
|
||||||
Mat4,
|
Mat4,
|
||||||
|
|
||||||
|
Count
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum BackbufferRatio
|
public enum BackbufferRatio
|
||||||
@ -536,6 +550,8 @@ public static partial class bgfx
|
|||||||
Eighth,
|
Eighth,
|
||||||
Sixteenth,
|
Sixteenth,
|
||||||
Double,
|
Double,
|
||||||
|
|
||||||
|
Count
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum OcclusionQueryResult
|
public enum OcclusionQueryResult
|
||||||
@ -543,6 +559,8 @@ public static partial class bgfx
|
|||||||
Invisible,
|
Invisible,
|
||||||
Visible,
|
Visible,
|
||||||
NoResult,
|
NoResult,
|
||||||
|
|
||||||
|
Count
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum Topology
|
public enum Topology
|
||||||
@ -552,6 +570,8 @@ public static partial class bgfx
|
|||||||
LineList,
|
LineList,
|
||||||
LineStrip,
|
LineStrip,
|
||||||
PointList,
|
PointList,
|
||||||
|
|
||||||
|
Count
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum TopologyConvert
|
public enum TopologyConvert
|
||||||
@ -561,6 +581,8 @@ public static partial class bgfx
|
|||||||
TriListToLineList,
|
TriListToLineList,
|
||||||
TriStripToTriList,
|
TriStripToTriList,
|
||||||
LineStripToLineList,
|
LineStripToLineList,
|
||||||
|
|
||||||
|
Count
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum TopologySort
|
public enum TopologySort
|
||||||
@ -577,6 +599,8 @@ public static partial class bgfx
|
|||||||
DistanceBackToFrontMin,
|
DistanceBackToFrontMin,
|
||||||
DistanceBackToFrontAvg,
|
DistanceBackToFrontAvg,
|
||||||
DistanceBackToFrontMax,
|
DistanceBackToFrontMax,
|
||||||
|
|
||||||
|
Count
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum ViewMode
|
public enum ViewMode
|
||||||
@ -585,6 +609,8 @@ public static partial class bgfx
|
|||||||
Sequential,
|
Sequential,
|
||||||
DepthAscending,
|
DepthAscending,
|
||||||
DepthDescending,
|
DepthDescending,
|
||||||
|
|
||||||
|
Count
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum RenderFrame
|
public enum RenderFrame
|
||||||
@ -593,6 +619,8 @@ public static partial class bgfx
|
|||||||
Render,
|
Render,
|
||||||
Timeout,
|
Timeout,
|
||||||
Exiting,
|
Exiting,
|
||||||
|
|
||||||
|
Count
|
||||||
}
|
}
|
||||||
|
|
||||||
public unsafe struct Caps
|
public unsafe struct Caps
|
||||||
@ -634,12 +662,12 @@ public static partial class bgfx
|
|||||||
public ulong supported;
|
public ulong supported;
|
||||||
public ushort vendorId;
|
public ushort vendorId;
|
||||||
public ushort deviceId;
|
public ushort deviceId;
|
||||||
public bool homogeneousDepth;
|
public byte homogeneousDepth;
|
||||||
public bool originBottomLeft;
|
public byte originBottomLeft;
|
||||||
public byte numGPUs;
|
public byte numGPUs;
|
||||||
public GPU gpu;
|
public fixed uint gpu[4];
|
||||||
public Limits limits;
|
public Limits limits;
|
||||||
public ushort formats;
|
public fixed ushort formats[(int)TextureFormat.Count];
|
||||||
}
|
}
|
||||||
|
|
||||||
public unsafe struct InternalData
|
public unsafe struct InternalData
|
||||||
@ -679,8 +707,8 @@ public static partial class bgfx
|
|||||||
public RendererType type;
|
public RendererType type;
|
||||||
public ushort vendorId;
|
public ushort vendorId;
|
||||||
public ushort deviceId;
|
public ushort deviceId;
|
||||||
public bool debug;
|
public byte debug;
|
||||||
public bool profile;
|
public byte profile;
|
||||||
public PlatformData platformData;
|
public PlatformData platformData;
|
||||||
public Resolution resolution;
|
public Resolution resolution;
|
||||||
public Limits limits;
|
public Limits limits;
|
||||||
@ -732,12 +760,12 @@ public static partial class bgfx
|
|||||||
public ushort numLayers;
|
public ushort numLayers;
|
||||||
public byte numMips;
|
public byte numMips;
|
||||||
public byte bitsPerPixel;
|
public byte bitsPerPixel;
|
||||||
public bool cubeMap;
|
public byte cubeMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
public unsafe struct UniformInfo
|
public unsafe struct UniformInfo
|
||||||
{
|
{
|
||||||
public char name;
|
public fixed byte name[256];
|
||||||
public UniformType type;
|
public UniformType type;
|
||||||
public ushort num;
|
public ushort num;
|
||||||
}
|
}
|
||||||
@ -759,7 +787,7 @@ public static partial class bgfx
|
|||||||
|
|
||||||
public unsafe struct ViewStats
|
public unsafe struct ViewStats
|
||||||
{
|
{
|
||||||
public char name;
|
public fixed byte name[256];
|
||||||
public ushort view;
|
public ushort view;
|
||||||
public long cpuTimeElapsed;
|
public long cpuTimeElapsed;
|
||||||
public long gpuTimeElapsed;
|
public long gpuTimeElapsed;
|
||||||
@ -801,7 +829,7 @@ public static partial class bgfx
|
|||||||
public long rtMemoryUsed;
|
public long rtMemoryUsed;
|
||||||
public int transientVbUsed;
|
public int transientVbUsed;
|
||||||
public int transientIbUsed;
|
public int transientIbUsed;
|
||||||
public uint numPrims;
|
public fixed uint numPrims[(int)Topology.Count];
|
||||||
public long gpuMemoryMax;
|
public long gpuMemoryMax;
|
||||||
public long gpuMemoryUsed;
|
public long gpuMemoryUsed;
|
||||||
public ushort width;
|
public ushort width;
|
||||||
@ -818,8 +846,8 @@ public static partial class bgfx
|
|||||||
{
|
{
|
||||||
public uint hash;
|
public uint hash;
|
||||||
public ushort stride;
|
public ushort stride;
|
||||||
public ushort offset;
|
public fixed ushort offset[(int)Attrib.Count];
|
||||||
public ushort attributes;
|
public fixed ushort attributes[(int)Attrib.Count];
|
||||||
}
|
}
|
||||||
|
|
||||||
public unsafe struct Encoder
|
public unsafe struct Encoder
|
||||||
@ -883,7 +911,7 @@ public static partial class bgfx
|
|||||||
/// <param name="_asInt">Packaging rule for vertexPack, vertexUnpack, and vertexConvert for AttribType::Uint8 and AttribType::Int16. Unpacking code must be implemented inside vertex shader.</param>
|
/// <param name="_asInt">Packaging rule for vertexPack, vertexUnpack, and vertexConvert for AttribType::Uint8 and AttribType::Int16. Unpacking code must be implemented inside vertex shader.</param>
|
||||||
///
|
///
|
||||||
[DllImport(DllName, EntryPoint="bgfx_vertex_decl_add", CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(DllName, EntryPoint="bgfx_vertex_decl_add", CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern unsafe VertexDecl* vertex_decl_add(VertexDecl* _this, Attrib _attrib, byte _num, AttribType _type, bool _normalized, bool _asInt);
|
public static extern unsafe VertexDecl* vertex_decl_add(VertexDecl* _this, Attrib _attrib, byte _num, AttribType _type, byte _normalized, byte _asInt);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Decode attribute.
|
/// Decode attribute.
|
||||||
@ -896,7 +924,7 @@ public static partial class bgfx
|
|||||||
/// <param name="_asInt">Attribute is packed as int.</param>
|
/// <param name="_asInt">Attribute is packed as int.</param>
|
||||||
///
|
///
|
||||||
[DllImport(DllName, EntryPoint="bgfx_vertex_decl_decode", CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(DllName, EntryPoint="bgfx_vertex_decl_decode", CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern unsafe void vertex_decl_decode(VertexDecl* _this, Attrib _attrib, byte * _num, AttribType* _type, bool* _normalized, bool* _asInt);
|
public static extern unsafe void vertex_decl_decode(VertexDecl* _this, Attrib _attrib, byte * _num, AttribType* _type, byte * _normalized, byte * _asInt);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns true if VertexDecl contains attribute.
|
/// Returns true if VertexDecl contains attribute.
|
||||||
@ -906,7 +934,7 @@ public static partial class bgfx
|
|||||||
///
|
///
|
||||||
[DllImport(DllName, EntryPoint="bgfx_vertex_decl_has", CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(DllName, EntryPoint="bgfx_vertex_decl_has", CallingConvention = CallingConvention.Cdecl)]
|
||||||
[return: MarshalAs(UnmanagedType.I1)]
|
[return: MarshalAs(UnmanagedType.I1)]
|
||||||
public static extern unsafe bool vertex_decl_has(VertexDecl* _this, Attrib _attrib);
|
public static extern unsafe byte vertex_decl_has(VertexDecl* _this, Attrib _attrib);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Skip `_num` bytes in vertex stream.
|
/// Skip `_num` bytes in vertex stream.
|
||||||
@ -934,7 +962,7 @@ public static partial class bgfx
|
|||||||
/// <param name="_index">Vertex index that will be modified.</param>
|
/// <param name="_index">Vertex index that will be modified.</param>
|
||||||
///
|
///
|
||||||
[DllImport(DllName, EntryPoint="bgfx_vertex_pack", CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(DllName, EntryPoint="bgfx_vertex_pack", CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern unsafe void vertex_pack(float _input, bool _inputNormalized, Attrib _attr, VertexDecl* _decl, void* _data, uint _index);
|
public static extern unsafe void vertex_pack(float _input, byte _inputNormalized, Attrib _attr, VertexDecl* _decl, void* _data, uint _index);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Unpack vertex attribute from vertex stream format.
|
/// Unpack vertex attribute from vertex stream format.
|
||||||
@ -987,7 +1015,7 @@ public static partial class bgfx
|
|||||||
/// <param name="_index32">Set to `true` if input indices are 32-bit.</param>
|
/// <param name="_index32">Set to `true` if input indices are 32-bit.</param>
|
||||||
///
|
///
|
||||||
[DllImport(DllName, EntryPoint="bgfx_topology_convert", CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(DllName, EntryPoint="bgfx_topology_convert", CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern unsafe uint topology_convert(TopologyConvert _conversion, void* _dst, uint _dstSize, void* _indices, uint _numIndices, bool _index32);
|
public static extern unsafe uint topology_convert(TopologyConvert _conversion, void* _dst, uint _dstSize, void* _indices, uint _numIndices, byte _index32);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sort indices.
|
/// Sort indices.
|
||||||
@ -1005,7 +1033,7 @@ public static partial class bgfx
|
|||||||
/// <param name="_index32">Set to `true` if input indices are 32-bit.</param>
|
/// <param name="_index32">Set to `true` if input indices are 32-bit.</param>
|
||||||
///
|
///
|
||||||
[DllImport(DllName, EntryPoint="bgfx_topology_sort_tri_list", CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(DllName, EntryPoint="bgfx_topology_sort_tri_list", CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern unsafe void topology_sort_tri_list(TopologySort _sort, void* _dst, uint _dstSize, float _dir, float _pos, void* _vertices, uint _stride, void* _indices, uint _numIndices, bool _index32);
|
public static extern unsafe void topology_sort_tri_list(TopologySort _sort, void* _dst, uint _dstSize, float _dir, float _pos, void* _vertices, uint _stride, void* _indices, uint _numIndices, byte _index32);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns supported backend API renderers.
|
/// Returns supported backend API renderers.
|
||||||
@ -1024,8 +1052,7 @@ public static partial class bgfx
|
|||||||
/// <param name="_type">Renderer backend type. See: `bgfx::RendererType`</param>
|
/// <param name="_type">Renderer backend type. See: `bgfx::RendererType`</param>
|
||||||
///
|
///
|
||||||
[DllImport(DllName, EntryPoint="bgfx_get_renderer_name", CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(DllName, EntryPoint="bgfx_get_renderer_name", CallingConvention = CallingConvention.Cdecl)]
|
||||||
[return: MarshalAs(UnmanagedType.LPStr)]
|
public static extern unsafe IntPtr get_renderer_name(RendererType _type);
|
||||||
public static extern unsafe string get_renderer_name(RendererType _type);
|
|
||||||
|
|
||||||
[DllImport(DllName, EntryPoint="bgfx_init_ctor", CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(DllName, EntryPoint="bgfx_init_ctor", CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern unsafe void init_ctor(Init* _init);
|
public static extern unsafe void init_ctor(Init* _init);
|
||||||
@ -1038,7 +1065,7 @@ public static partial class bgfx
|
|||||||
///
|
///
|
||||||
[DllImport(DllName, EntryPoint="bgfx_init", CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(DllName, EntryPoint="bgfx_init", CallingConvention = CallingConvention.Cdecl)]
|
||||||
[return: MarshalAs(UnmanagedType.I1)]
|
[return: MarshalAs(UnmanagedType.I1)]
|
||||||
public static extern unsafe bool init(Init* _init);
|
public static extern unsafe byte init(Init* _init);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Shutdown bgfx library.
|
/// Shutdown bgfx library.
|
||||||
@ -1070,7 +1097,7 @@ public static partial class bgfx
|
|||||||
/// <param name="_capture">Capture frame with graphics debugger.</param>
|
/// <param name="_capture">Capture frame with graphics debugger.</param>
|
||||||
///
|
///
|
||||||
[DllImport(DllName, EntryPoint="bgfx_frame", CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(DllName, EntryPoint="bgfx_frame", CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern unsafe uint frame(bool _capture);
|
public static extern unsafe uint frame(byte _capture);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns current renderer backend API type.
|
/// Returns current renderer backend API type.
|
||||||
@ -1168,7 +1195,7 @@ public static partial class bgfx
|
|||||||
/// <param name="_small">Default 8x16 or 8x8 font.</param>
|
/// <param name="_small">Default 8x16 or 8x8 font.</param>
|
||||||
///
|
///
|
||||||
[DllImport(DllName, EntryPoint="bgfx_dbg_text_clear", CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(DllName, EntryPoint="bgfx_dbg_text_clear", CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern unsafe void dbg_text_clear(byte _attr, bool _small);
|
public static extern unsafe void dbg_text_clear(byte _attr, byte _small);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Print formatted data to internal debug text character-buffer (VGA-compatible text mode).
|
/// Print formatted data to internal debug text character-buffer (VGA-compatible text mode).
|
||||||
@ -1438,7 +1465,7 @@ public static partial class bgfx
|
|||||||
///
|
///
|
||||||
[DllImport(DllName, EntryPoint="bgfx_alloc_transient_buffers", CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(DllName, EntryPoint="bgfx_alloc_transient_buffers", CallingConvention = CallingConvention.Cdecl)]
|
||||||
[return: MarshalAs(UnmanagedType.I1)]
|
[return: MarshalAs(UnmanagedType.I1)]
|
||||||
public static extern unsafe bool alloc_transient_buffers(TransientVertexBuffer* _tvb, VertexDecl* _decl, uint _numVertices, TransientIndexBuffer* _tib, uint _numIndices);
|
public static extern unsafe byte alloc_transient_buffers(TransientVertexBuffer* _tvb, VertexDecl* _decl, uint _numVertices, TransientIndexBuffer* _tib, uint _numIndices);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Allocate instance data buffer.
|
/// Allocate instance data buffer.
|
||||||
@ -1522,7 +1549,7 @@ public static partial class bgfx
|
|||||||
/// <param name="_destroyShaders">If true, shaders will be destroyed when program is destroyed.</param>
|
/// <param name="_destroyShaders">If true, shaders will be destroyed when program is destroyed.</param>
|
||||||
///
|
///
|
||||||
[DllImport(DllName, EntryPoint="bgfx_create_program", CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(DllName, EntryPoint="bgfx_create_program", CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern unsafe ProgramHandle create_program(ShaderHandle _vsh, ShaderHandle _fsh, bool _destroyShaders);
|
public static extern unsafe ProgramHandle create_program(ShaderHandle _vsh, ShaderHandle _fsh, byte _destroyShaders);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Create program with compute shader.
|
/// Create program with compute shader.
|
||||||
@ -1532,7 +1559,7 @@ public static partial class bgfx
|
|||||||
/// <param name="_destroyShaders">If true, shaders will be destroyed when program is destroyed.</param>
|
/// <param name="_destroyShaders">If true, shaders will be destroyed when program is destroyed.</param>
|
||||||
///
|
///
|
||||||
[DllImport(DllName, EntryPoint="bgfx_create_compute_program", CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(DllName, EntryPoint="bgfx_create_compute_program", CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern unsafe ProgramHandle create_compute_program(ShaderHandle _csh, bool _destroyShaders);
|
public static extern unsafe ProgramHandle create_compute_program(ShaderHandle _csh, byte _destroyShaders);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Destroy program.
|
/// Destroy program.
|
||||||
@ -1555,7 +1582,7 @@ public static partial class bgfx
|
|||||||
///
|
///
|
||||||
[DllImport(DllName, EntryPoint="bgfx_is_texture_valid", CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(DllName, EntryPoint="bgfx_is_texture_valid", CallingConvention = CallingConvention.Cdecl)]
|
||||||
[return: MarshalAs(UnmanagedType.I1)]
|
[return: MarshalAs(UnmanagedType.I1)]
|
||||||
public static extern unsafe bool is_texture_valid(ushort _depth, bool _cubeMap, ushort _numLayers, TextureFormat _format, ulong _flags);
|
public static extern unsafe byte is_texture_valid(ushort _depth, byte _cubeMap, ushort _numLayers, TextureFormat _format, ulong _flags);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Calculate amount of memory required for texture.
|
/// Calculate amount of memory required for texture.
|
||||||
@ -1571,7 +1598,7 @@ public static partial class bgfx
|
|||||||
/// <param name="_format">Texture format. See: `TextureFormat::Enum`.</param>
|
/// <param name="_format">Texture format. See: `TextureFormat::Enum`.</param>
|
||||||
///
|
///
|
||||||
[DllImport(DllName, EntryPoint="bgfx_calc_texture_size", CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(DllName, EntryPoint="bgfx_calc_texture_size", CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern unsafe void calc_texture_size(TextureInfo* _info, ushort _width, ushort _height, ushort _depth, bool _cubeMap, bool _hasMips, ushort _numLayers, TextureFormat _format);
|
public static extern unsafe void calc_texture_size(TextureInfo* _info, ushort _width, ushort _height, ushort _depth, byte _cubeMap, byte _hasMips, ushort _numLayers, TextureFormat _format);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Create texture from memory buffer.
|
/// Create texture from memory buffer.
|
||||||
@ -1598,7 +1625,7 @@ public static partial class bgfx
|
|||||||
/// <param name="_mem">Texture data. If `_mem` is non-NULL, created texture will be immutable. If `_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.</param>
|
/// <param name="_mem">Texture data. If `_mem` is non-NULL, created texture will be immutable. If `_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.</param>
|
||||||
///
|
///
|
||||||
[DllImport(DllName, EntryPoint="bgfx_create_texture_2d", CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(DllName, EntryPoint="bgfx_create_texture_2d", CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern unsafe TextureHandle create_texture_2d(ushort _width, ushort _height, bool _hasMips, ushort _numLayers, TextureFormat _format, ulong _flags, Memory* _mem);
|
public static extern unsafe TextureHandle create_texture_2d(ushort _width, ushort _height, byte _hasMips, ushort _numLayers, TextureFormat _format, ulong _flags, Memory* _mem);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Create texture with size based on backbuffer ratio. Texture will maintain ratio
|
/// Create texture with size based on backbuffer ratio. Texture will maintain ratio
|
||||||
@ -1612,7 +1639,7 @@ public static partial class bgfx
|
|||||||
/// <param name="_flags">Texture creation (see `BGFX_TEXTURE_*`.), and sampler (see `BGFX_SAMPLER_*`) flags. Default texture sampling mode is linear, and wrap mode is repeat. - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap mode. - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic sampling.</param>
|
/// <param name="_flags">Texture creation (see `BGFX_TEXTURE_*`.), and sampler (see `BGFX_SAMPLER_*`) flags. Default texture sampling mode is linear, and wrap mode is repeat. - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap mode. - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic sampling.</param>
|
||||||
///
|
///
|
||||||
[DllImport(DllName, EntryPoint="bgfx_create_texture_2d_scaled", CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(DllName, EntryPoint="bgfx_create_texture_2d_scaled", CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern unsafe TextureHandle create_texture_2d_scaled(BackbufferRatio _ratio, bool _hasMips, ushort _numLayers, TextureFormat _format, ulong _flags);
|
public static extern unsafe TextureHandle create_texture_2d_scaled(BackbufferRatio _ratio, byte _hasMips, ushort _numLayers, TextureFormat _format, ulong _flags);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Create 3D texture.
|
/// Create 3D texture.
|
||||||
@ -1627,7 +1654,7 @@ public static partial class bgfx
|
|||||||
/// <param name="_mem">Texture data. If `_mem` is non-NULL, created texture will be immutable. If `_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.</param>
|
/// <param name="_mem">Texture data. If `_mem` is non-NULL, created texture will be immutable. If `_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.</param>
|
||||||
///
|
///
|
||||||
[DllImport(DllName, EntryPoint="bgfx_create_texture_3d", CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(DllName, EntryPoint="bgfx_create_texture_3d", CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern unsafe TextureHandle create_texture_3d(ushort _width, ushort _height, ushort _depth, bool _hasMips, TextureFormat _format, ulong _flags, Memory* _mem);
|
public static extern unsafe TextureHandle create_texture_3d(ushort _width, ushort _height, ushort _depth, byte _hasMips, TextureFormat _format, ulong _flags, Memory* _mem);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Create Cube texture.
|
/// Create Cube texture.
|
||||||
@ -1641,7 +1668,7 @@ public static partial class bgfx
|
|||||||
/// <param name="_mem">Texture data. If `_mem` is non-NULL, created texture will be immutable. If `_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.</param>
|
/// <param name="_mem">Texture data. If `_mem` is non-NULL, created texture will be immutable. If `_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.</param>
|
||||||
///
|
///
|
||||||
[DllImport(DllName, EntryPoint="bgfx_create_texture_cube", CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(DllName, EntryPoint="bgfx_create_texture_cube", CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern unsafe TextureHandle create_texture_cube(ushort _size, bool _hasMips, ushort _numLayers, TextureFormat _format, ulong _flags, Memory* _mem);
|
public static extern unsafe TextureHandle create_texture_cube(ushort _size, byte _hasMips, ushort _numLayers, TextureFormat _format, ulong _flags, Memory* _mem);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Update 2D texture.
|
/// Update 2D texture.
|
||||||
@ -1775,7 +1802,7 @@ public static partial class bgfx
|
|||||||
/// <param name="_destroyTexture">If true, textures will be destroyed when frame buffer is destroyed.</param>
|
/// <param name="_destroyTexture">If true, textures will be destroyed when frame buffer is destroyed.</param>
|
||||||
///
|
///
|
||||||
[DllImport(DllName, EntryPoint="bgfx_create_frame_buffer_from_handles", CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(DllName, EntryPoint="bgfx_create_frame_buffer_from_handles", CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern unsafe FrameBufferHandle create_frame_buffer_from_handles(byte _num, TextureHandle* _handles, bool _destroyTexture);
|
public static extern unsafe FrameBufferHandle create_frame_buffer_from_handles(byte _num, TextureHandle* _handles, byte _destroyTexture);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Create MRT frame buffer from texture handles with specific layer and
|
/// Create MRT frame buffer from texture handles with specific layer and
|
||||||
@ -1787,7 +1814,7 @@ public static partial class bgfx
|
|||||||
/// <param name="_destroyTexture">If true, textures will be destroyed when frame buffer is destroyed.</param>
|
/// <param name="_destroyTexture">If true, textures will be destroyed when frame buffer is destroyed.</param>
|
||||||
///
|
///
|
||||||
[DllImport(DllName, EntryPoint="bgfx_create_frame_buffer_from_attachment", CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(DllName, EntryPoint="bgfx_create_frame_buffer_from_attachment", CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern unsafe FrameBufferHandle create_frame_buffer_from_attachment(byte _num, Attachment* _attachment, bool _destroyTexture);
|
public static extern unsafe FrameBufferHandle create_frame_buffer_from_attachment(byte _num, Attachment* _attachment, byte _destroyTexture);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Create frame buffer for multiple window rendering.
|
/// Create frame buffer for multiple window rendering.
|
||||||
@ -2077,7 +2104,7 @@ public static partial class bgfx
|
|||||||
/// <param name="_forThread">Explicitly request an encoder for a worker thread.</param>
|
/// <param name="_forThread">Explicitly request an encoder for a worker thread.</param>
|
||||||
///
|
///
|
||||||
[DllImport(DllName, EntryPoint="bgfx_encoder_begin", CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(DllName, EntryPoint="bgfx_encoder_begin", CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern unsafe Encoder* encoder_begin(bool _forThread);
|
public static extern unsafe Encoder* encoder_begin(byte _forThread);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// End submitting draw calls from thread.
|
/// End submitting draw calls from thread.
|
||||||
@ -2126,7 +2153,7 @@ public static partial class bgfx
|
|||||||
/// <param name="_visible">Render if occlusion query is visible.</param>
|
/// <param name="_visible">Render if occlusion query is visible.</param>
|
||||||
///
|
///
|
||||||
[DllImport(DllName, EntryPoint="bgfx_encoder_set_condition", CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(DllName, EntryPoint="bgfx_encoder_set_condition", CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern unsafe void encoder_set_condition(Encoder* _this, OcclusionQueryHandle _handle, bool _visible);
|
public static extern unsafe void encoder_set_condition(Encoder* _this, OcclusionQueryHandle _handle, byte _visible);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Set stencil test state.
|
/// Set stencil test state.
|
||||||
@ -2365,7 +2392,7 @@ public static partial class bgfx
|
|||||||
/// <param name="_preserveState">Preserve internal draw state for next draw call submit.</param>
|
/// <param name="_preserveState">Preserve internal draw state for next draw call submit.</param>
|
||||||
///
|
///
|
||||||
[DllImport(DllName, EntryPoint="bgfx_encoder_submit", CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(DllName, EntryPoint="bgfx_encoder_submit", CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern unsafe void encoder_submit(Encoder* _this, ushort _id, ProgramHandle _program, uint _depth, bool _preserveState);
|
public static extern unsafe void encoder_submit(Encoder* _this, ushort _id, ProgramHandle _program, uint _depth, byte _preserveState);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Submit primitive with occlusion query for rendering.
|
/// Submit primitive with occlusion query for rendering.
|
||||||
@ -2378,7 +2405,7 @@ public static partial class bgfx
|
|||||||
/// <param name="_preserveState">Preserve internal draw state for next draw call submit.</param>
|
/// <param name="_preserveState">Preserve internal draw state for next draw call submit.</param>
|
||||||
///
|
///
|
||||||
[DllImport(DllName, EntryPoint="bgfx_encoder_submit_occlusion_query", CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(DllName, EntryPoint="bgfx_encoder_submit_occlusion_query", CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern unsafe void encoder_submit_occlusion_query(Encoder* _this, ushort _id, ProgramHandle _program, OcclusionQueryHandle _occlusionQuery, uint _depth, bool _preserveState);
|
public static extern unsafe void encoder_submit_occlusion_query(Encoder* _this, ushort _id, ProgramHandle _program, OcclusionQueryHandle _occlusionQuery, uint _depth, byte _preserveState);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Submit primitive for rendering with index and instance data info from
|
/// Submit primitive for rendering with index and instance data info from
|
||||||
@ -2394,7 +2421,7 @@ public static partial class bgfx
|
|||||||
/// <param name="_preserveState">Preserve internal draw state for next draw call submit.</param>
|
/// <param name="_preserveState">Preserve internal draw state for next draw call submit.</param>
|
||||||
///
|
///
|
||||||
[DllImport(DllName, EntryPoint="bgfx_encoder_submit_indirect", CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(DllName, EntryPoint="bgfx_encoder_submit_indirect", CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern unsafe void encoder_submit_indirect(Encoder* _this, ushort _id, ProgramHandle _program, IndirectBufferHandle _indirectHandle, ushort _start, ushort _num, uint _depth, bool _preserveState);
|
public static extern unsafe void encoder_submit_indirect(Encoder* _this, ushort _id, ProgramHandle _program, IndirectBufferHandle _indirectHandle, ushort _start, ushort _num, uint _depth, byte _preserveState);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Set compute index buffer.
|
/// Set compute index buffer.
|
||||||
@ -2642,7 +2669,7 @@ public static partial class bgfx
|
|||||||
/// <param name="_visible">Render if occlusion query is visible.</param>
|
/// <param name="_visible">Render if occlusion query is visible.</param>
|
||||||
///
|
///
|
||||||
[DllImport(DllName, EntryPoint="bgfx_set_condition", CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(DllName, EntryPoint="bgfx_set_condition", CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern unsafe void set_condition(OcclusionQueryHandle _handle, bool _visible);
|
public static extern unsafe void set_condition(OcclusionQueryHandle _handle, byte _visible);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Set stencil test state.
|
/// Set stencil test state.
|
||||||
@ -2878,7 +2905,7 @@ public static partial class bgfx
|
|||||||
/// <param name="_preserveState">Preserve internal draw state for next draw call submit.</param>
|
/// <param name="_preserveState">Preserve internal draw state for next draw call submit.</param>
|
||||||
///
|
///
|
||||||
[DllImport(DllName, EntryPoint="bgfx_submit", CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(DllName, EntryPoint="bgfx_submit", CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern unsafe void submit(ushort _id, ProgramHandle _program, uint _depth, bool _preserveState);
|
public static extern unsafe void submit(ushort _id, ProgramHandle _program, uint _depth, byte _preserveState);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Submit primitive with occlusion query for rendering.
|
/// Submit primitive with occlusion query for rendering.
|
||||||
@ -2891,7 +2918,7 @@ public static partial class bgfx
|
|||||||
/// <param name="_preserveState">Preserve internal draw state for next draw call submit.</param>
|
/// <param name="_preserveState">Preserve internal draw state for next draw call submit.</param>
|
||||||
///
|
///
|
||||||
[DllImport(DllName, EntryPoint="bgfx_submit_occlusion_query", CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(DllName, EntryPoint="bgfx_submit_occlusion_query", CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern unsafe void submit_occlusion_query(ushort _id, ProgramHandle _program, OcclusionQueryHandle _occlusionQuery, uint _depth, bool _preserveState);
|
public static extern unsafe void submit_occlusion_query(ushort _id, ProgramHandle _program, OcclusionQueryHandle _occlusionQuery, uint _depth, byte _preserveState);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Submit primitive for rendering with index and instance data info from
|
/// Submit primitive for rendering with index and instance data info from
|
||||||
@ -2907,7 +2934,7 @@ public static partial class bgfx
|
|||||||
/// <param name="_preserveState">Preserve internal draw state for next draw call submit.</param>
|
/// <param name="_preserveState">Preserve internal draw state for next draw call submit.</param>
|
||||||
///
|
///
|
||||||
[DllImport(DllName, EntryPoint="bgfx_submit_indirect", CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(DllName, EntryPoint="bgfx_submit_indirect", CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern unsafe void submit_indirect(ushort _id, ProgramHandle _program, IndirectBufferHandle _indirectHandle, ushort _start, ushort _num, uint _depth, bool _preserveState);
|
public static extern unsafe void submit_indirect(ushort _id, ProgramHandle _program, IndirectBufferHandle _indirectHandle, ushort _start, ushort _num, uint _depth, byte _preserveState);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Set compute index buffer.
|
/// Set compute index buffer.
|
||||||
|
@ -49,10 +49,16 @@ local function convert_type_0(arg)
|
|||||||
return arg.ctype:gsub("bgfx_view_id_t", "ushort")
|
return arg.ctype:gsub("bgfx_view_id_t", "ushort")
|
||||||
elseif hasPrefix(arg.ctype, "uint8_t") then
|
elseif hasPrefix(arg.ctype, "uint8_t") then
|
||||||
return arg.ctype:gsub("uint8_t", "byte")
|
return arg.ctype:gsub("uint8_t", "byte")
|
||||||
|
elseif hasPrefix(arg.ctype, "bool") then
|
||||||
|
return arg.ctype:gsub("bool", "byte")
|
||||||
elseif hasPrefix(arg.ctype, "uintptr_t") then
|
elseif hasPrefix(arg.ctype, "uintptr_t") then
|
||||||
return arg.ctype:gsub("uintptr_t", "UIntPtr")
|
return arg.ctype:gsub("uintptr_t", "UIntPtr")
|
||||||
|
elseif arg.ctype == "bgfx_caps_gpu_t" then
|
||||||
|
return arg.ctype:gsub("bgfx_caps_gpu_t", "uint")
|
||||||
elseif arg.ctype == "const char*" then
|
elseif arg.ctype == "const char*" then
|
||||||
return "[MarshalAs(UnmanagedType.LPStr)] string"
|
return "[MarshalAs(UnmanagedType.LPStr)] string"
|
||||||
|
elseif hasPrefix(arg.ctype, "char") then
|
||||||
|
return arg.ctype:gsub("char", "byte")
|
||||||
elseif hasSuffix(arg.fulltype, "Handle") then
|
elseif hasSuffix(arg.fulltype, "Handle") then
|
||||||
return arg.fulltype
|
return arg.fulltype
|
||||||
elseif arg.ctype == "..." then
|
elseif arg.ctype == "..." then
|
||||||
@ -70,7 +76,8 @@ local function convert_type_0(arg)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function convert_type(arg)
|
local function convert_type(arg)
|
||||||
local ctype = convert_type_0(arg)
|
local ctype;
|
||||||
|
ctype = convert_type_0(arg)
|
||||||
ctype = ctype:gsub("::Enum", "")
|
ctype = ctype:gsub("::Enum", "")
|
||||||
ctype = ctype:gsub("const ", "")
|
ctype = ctype:gsub("const ", "")
|
||||||
ctype = ctype:gsub(" &", "*")
|
ctype = ctype:gsub(" &", "*")
|
||||||
@ -81,7 +88,7 @@ end
|
|||||||
local function convert_ret_type(arg)
|
local function convert_ret_type(arg)
|
||||||
local ctype = convert_type(arg)
|
local ctype = convert_type(arg)
|
||||||
if hasPrefix(ctype, "[MarshalAs(UnmanagedType.LPStr)]") then
|
if hasPrefix(ctype, "[MarshalAs(UnmanagedType.LPStr)]") then
|
||||||
return "string"
|
return "IntPtr"
|
||||||
end
|
end
|
||||||
|
|
||||||
return ctype
|
return ctype
|
||||||
@ -184,6 +191,22 @@ local function lastCombinedFlagBlock()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function convert_array(member)
|
||||||
|
if string.find(member.array, "::") then
|
||||||
|
return member.array:gsub("::", "."):gsub("%[","[(int)")
|
||||||
|
else
|
||||||
|
return member.array
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function convert_struct_member(member)
|
||||||
|
if member.array then
|
||||||
|
return "fixed " .. convert_type(member) .. " " .. member.name .. convert_array(member)
|
||||||
|
else
|
||||||
|
return convert_type(member) .. " " .. member.name
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local namespace = ""
|
local namespace = ""
|
||||||
|
|
||||||
function converter.types(typ)
|
function converter.types(typ)
|
||||||
@ -199,6 +222,8 @@ function converter.types(typ)
|
|||||||
for _, enum in ipairs(typ.enum) do
|
for _, enum in ipairs(typ.enum) do
|
||||||
yield("\t" .. enum.name .. ",")
|
yield("\t" .. enum.name .. ",")
|
||||||
end
|
end
|
||||||
|
yield("");
|
||||||
|
yield("\tCount")
|
||||||
yield("}")
|
yield("}")
|
||||||
elseif typ.bits ~= nil then
|
elseif typ.bits ~= nil then
|
||||||
local prefix, name = typ.name:match "(%u%l+)(.*)"
|
local prefix, name = typ.name:match "(%u%l+)(.*)"
|
||||||
@ -271,8 +296,8 @@ function converter.types(typ)
|
|||||||
end
|
end
|
||||||
|
|
||||||
for _, member in ipairs(typ.struct) do
|
for _, member in ipairs(typ.struct) do
|
||||||
yield(
|
yield(
|
||||||
indent .. "\tpublic " .. convert_type(member) .. " " .. member.name .. ";"
|
indent .. "\tpublic " .. convert_struct_member(member) .. ";"
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -325,8 +350,6 @@ function converter.funcs(func)
|
|||||||
|
|
||||||
if func.ret.cpptype == "bool" then
|
if func.ret.cpptype == "bool" then
|
||||||
yield("[return: MarshalAs(UnmanagedType.I1)]")
|
yield("[return: MarshalAs(UnmanagedType.I1)]")
|
||||||
elseif func.ret.cpptype == "const char*" then
|
|
||||||
yield("[return: MarshalAs(UnmanagedType.LPStr)]")
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local args = {}
|
local args = {}
|
||||||
|
Loading…
Reference in New Issue
Block a user