summaryrefslogtreecommitdiffstatshomepage
path: root/3rdparty/bgfx/bindings
diff options
context:
space:
mode:
Diffstat (limited to '3rdparty/bgfx/bindings')
-rw-r--r--3rdparty/bgfx/bindings/bf/bgfx.bf16
-rw-r--r--3rdparty/bgfx/bindings/cs/bgfx.cs16
-rw-r--r--3rdparty/bgfx/bindings/cs/bgfx_dllname.cs2
-rw-r--r--3rdparty/bgfx/bindings/d/fakeenum.d79
-rw-r--r--3rdparty/bgfx/bindings/d/funcs.d4569
-rw-r--r--3rdparty/bgfx/bindings/d/package.d3573
-rw-r--r--3rdparty/bgfx/bindings/d/types.d1140
-rw-r--r--3rdparty/bgfx/bindings/zig/bgfx.zig16
8 files changed, 3685 insertions, 5726 deletions
diff --git a/3rdparty/bgfx/bindings/bf/bgfx.bf b/3rdparty/bgfx/bindings/bf/bgfx.bf
index 71d5e2556d9..906a2377ca5 100644
--- a/3rdparty/bgfx/bindings/bf/bgfx.bf
+++ b/3rdparty/bgfx/bindings/bf/bgfx.bf
@@ -1,5 +1,5 @@
/*
- * Copyright 2011-2022 Branimir Karadzic. All rights reserved.
+ * Copyright 2011-2023 Branimir Karadzic. All rights reserved.
* License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE
*/
@@ -1148,14 +1148,19 @@ public static class bgfx
VertexId = 0x0000000008000000,
/// <summary>
+ /// PrimitiveID is available in fragment shader.
+ /// </summary>
+ PrimitiveId = 0x0000000010000000,
+
+ /// <summary>
/// Viewport layer is available in vertex shader.
/// </summary>
- ViewportLayerArray = 0x0000000010000000,
+ ViewportLayerArray = 0x0000000020000000,
/// <summary>
/// Draw indirect with indirect count is supported.
/// </summary>
- DrawIndirectCount = 0x0000000020000000,
+ DrawIndirectCount = 0x0000000040000000,
/// <summary>
/// All texture compare modes are supported.
@@ -2114,6 +2119,7 @@ public static class bgfx
public uint32 reset;
public uint8 numBackBuffers;
public uint8 maxFrameLatency;
+ public uint8 debugTextScale;
}
[CRepr]
@@ -3869,7 +3875,7 @@ public static class bgfx
///
/// <param name="_handle">Vertex buffer.</param>
/// <param name="_startVertex">First instance data.</param>
- /// <param name="_num">Number of data instances. Set instance data buffer for draw primitive.</param>
+ /// <param name="_num">Number of data instances.</param>
///
[LinkName("bgfx_encoder_set_instance_data_from_vertex_buffer")]
public static extern void encoder_set_instance_data_from_vertex_buffer(Encoder* _this, VertexBufferHandle _handle, uint32 _startVertex, uint32 _num);
@@ -4447,7 +4453,7 @@ public static class bgfx
///
/// <param name="_handle">Vertex buffer.</param>
/// <param name="_startVertex">First instance data.</param>
- /// <param name="_num">Number of data instances. Set instance data buffer for draw primitive.</param>
+ /// <param name="_num">Number of data instances.</param>
///
[LinkName("bgfx_set_instance_data_from_vertex_buffer")]
public static extern void set_instance_data_from_vertex_buffer(VertexBufferHandle _handle, uint32 _startVertex, uint32 _num);
diff --git a/3rdparty/bgfx/bindings/cs/bgfx.cs b/3rdparty/bgfx/bindings/cs/bgfx.cs
index 24a2a17e118..b8676ea610f 100644
--- a/3rdparty/bgfx/bindings/cs/bgfx.cs
+++ b/3rdparty/bgfx/bindings/cs/bgfx.cs
@@ -1,5 +1,5 @@
/*
- * Copyright 2011-2022 Branimir Karadzic. All rights reserved.
+ * Copyright 2011-2023 Branimir Karadzic. All rights reserved.
* License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE
*/
@@ -1147,14 +1147,19 @@ public static partial class bgfx
VertexId = 0x0000000008000000,
/// <summary>
+ /// PrimitiveID is available in fragment shader.
+ /// </summary>
+ PrimitiveId = 0x0000000010000000,
+
+ /// <summary>
/// Viewport layer is available in vertex shader.
/// </summary>
- ViewportLayerArray = 0x0000000010000000,
+ ViewportLayerArray = 0x0000000020000000,
/// <summary>
/// Draw indirect with indirect count is supported.
/// </summary>
- DrawIndirectCount = 0x0000000020000000,
+ DrawIndirectCount = 0x0000000040000000,
/// <summary>
/// All texture compare modes are supported.
@@ -2093,6 +2098,7 @@ public static partial class bgfx
public uint reset;
public byte numBackBuffers;
public byte maxFrameLatency;
+ public byte debugTextScale;
}
public unsafe struct Init
@@ -3826,7 +3832,7 @@ public static partial class bgfx
///
/// <param name="_handle">Vertex buffer.</param>
/// <param name="_startVertex">First instance data.</param>
- /// <param name="_num">Number of data instances. Set instance data buffer for draw primitive.</param>
+ /// <param name="_num">Number of data instances.</param>
///
[DllImport(DllName, EntryPoint="bgfx_encoder_set_instance_data_from_vertex_buffer", CallingConvention = CallingConvention.Cdecl)]
public static extern unsafe void encoder_set_instance_data_from_vertex_buffer(Encoder* _this, VertexBufferHandle _handle, uint _startVertex, uint _num);
@@ -4404,7 +4410,7 @@ public static partial class bgfx
///
/// <param name="_handle">Vertex buffer.</param>
/// <param name="_startVertex">First instance data.</param>
- /// <param name="_num">Number of data instances. Set instance data buffer for draw primitive.</param>
+ /// <param name="_num">Number of data instances.</param>
///
[DllImport(DllName, EntryPoint="bgfx_set_instance_data_from_vertex_buffer", CallingConvention = CallingConvention.Cdecl)]
public static extern unsafe void set_instance_data_from_vertex_buffer(VertexBufferHandle _handle, uint _startVertex, uint _num);
diff --git a/3rdparty/bgfx/bindings/cs/bgfx_dllname.cs b/3rdparty/bgfx/bindings/cs/bgfx_dllname.cs
index 54bb7cecaab..32418ce4a5f 100644
--- a/3rdparty/bgfx/bindings/cs/bgfx_dllname.cs
+++ b/3rdparty/bgfx/bindings/cs/bgfx_dllname.cs
@@ -1,5 +1,5 @@
/*
- * Copyright 2011-2022 Branimir Karadzic. All rights reserved.
+ * Copyright 2011-2023 Branimir Karadzic. All rights reserved.
* License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE
*/
diff --git a/3rdparty/bgfx/bindings/d/fakeenum.d b/3rdparty/bgfx/bindings/d/fakeenum.d
new file mode 100644
index 00000000000..4fdc6135462
--- /dev/null
+++ b/3rdparty/bgfx/bindings/d/fakeenum.d
@@ -0,0 +1,79 @@
+/+
++ ┌==============================┐
++ │ AUTO GENERATED! DO NOT EDIT! │
++ └==============================┘
++/
+module bgfx.fakeenum;
+
+//NOTE: Do NOT use this module! Use the enums with the same names in `bgfx/package.d` instead.
+package:
+extern(C++, "bgfx") package final abstract class Fatal{
+ enum Enum{
+ debugCheck,invalidShader,unableToInitialize,unableToCreateTexture,deviceLost,count
+ }
+}
+extern(C++, "bgfx") package final abstract class RendererType{
+ enum Enum{
+ noop,agc,direct3D9,direct3D11,direct3D12,gnm,metal,nvn,openGLES,openGL,vulkan,webGPU,count
+ }
+}
+extern(C++, "bgfx") package final abstract class Access{
+ enum Enum{
+ read,write,readWrite,count
+ }
+}
+extern(C++, "bgfx") package final abstract class Attrib{
+ enum Enum{
+ position,normal,tangent,bitangent,color0,color1,color2,color3,indices,weight,texCoord0,texCoord1,texCoord2,texCoord3,texCoord4,texCoord5,texCoord6,texCoord7,count
+ }
+}
+extern(C++, "bgfx") package final abstract class AttribType{
+ enum Enum{
+ uint8,uint10,int16,half,float_,count
+ }
+}
+extern(C++, "bgfx") package final abstract class TextureFormat{
+ enum Enum{
+ bc1,bc2,bc3,bc4,bc5,bc6h,bc7,etc1,etc2,etc2a,etc2a1,ptc12,ptc14,ptc12a,ptc14a,ptc22,ptc24,atc,atce,atci,astc4x4,astc5x4,astc5x5,astc6x5,astc6x6,astc8x5,astc8x6,astc8x8,astc10x5,astc10x6,astc10x8,astc10x10,astc12x10,astc12x12,unknown,r1,a8,r8,r8i,r8u,r8s,r16,r16i,r16u,r16f,r16s,r32i,r32u,r32f,rg8,rg8i,rg8u,rg8s,rg16,rg16i,rg16u,rg16f,rg16s,rg32i,rg32u,rg32f,rgb8,rgb8i,rgb8u,rgb8s,rgb9e5f,bgra8,rgba8,rgba8i,rgba8u,rgba8s,rgba16,rgba16i,rgba16u,rgba16f,rgba16s,rgba32i,rgba32u,rgba32f,b5g6r5,r5g6b5,bgra4,rgba4,bgr5a1,rgb5a1,rgb10a2,rg11b10f,unknownDepth,d16,d24,d24s8,d32,d16f,d24f,d32f,d0s8,count
+ }
+}
+extern(C++, "bgfx") package final abstract class UniformType{
+ enum Enum{
+ sampler,end,vec4,mat3,mat4,count
+ }
+}
+extern(C++, "bgfx") package final abstract class BackbufferRatio{
+ enum Enum{
+ equal,half,quarter,eighth,sixteenth,double_,count
+ }
+}
+extern(C++, "bgfx") package final abstract class OcclusionQueryResult{
+ enum Enum{
+ invisible,visible,noResult,count
+ }
+}
+extern(C++, "bgfx") package final abstract class Topology{
+ enum Enum{
+ triList,triStrip,lineList,lineStrip,pointList,count
+ }
+}
+extern(C++, "bgfx") package final abstract class TopologyConvert{
+ enum Enum{
+ triListFlipWinding,triStripFlipWinding,triListToLineList,triStripToTriList,lineStripToLineList,count
+ }
+}
+extern(C++, "bgfx") package final abstract class TopologySort{
+ enum Enum{
+ directionFrontToBackMin,directionFrontToBackAvg,directionFrontToBackMax,directionBackToFrontMin,directionBackToFrontAvg,directionBackToFrontMax,distanceFrontToBackMin,distanceFrontToBackAvg,distanceFrontToBackMax,distanceBackToFrontMin,distanceBackToFrontAvg,distanceBackToFrontMax,count
+ }
+}
+extern(C++, "bgfx") package final abstract class ViewMode{
+ enum Enum{
+ default_,sequential,depthAscending,depthDescending,count
+ }
+}
+extern(C++, "bgfx") package final abstract class RenderFrame{
+ enum Enum{
+ noContext,render,timeout,exiting,count
+ }
+}
diff --git a/3rdparty/bgfx/bindings/d/funcs.d b/3rdparty/bgfx/bindings/d/funcs.d
deleted file mode 100644
index 561556ba591..00000000000
--- a/3rdparty/bgfx/bindings/d/funcs.d
+++ /dev/null
@@ -1,4569 +0,0 @@
-/*
- *
- * AUTO GENERATED! DO NOT EDIT!
- *
- */
-
-module bindbc.bgfx.funcs;
-
-private import bindbc.bgfx.types;
-
-extern(C) @nogc nothrow:
-
-version(BindBgfx_Static)
-{
- /**
- * Init attachment.
- * Params:
- * _handle = Render target texture handle.
- * _access = Access. See `Access::Enum`.
- * _layer = Cubemap side or depth layer/slice to use.
- * _numLayers = Number of texture layer/slice(s) in array to use.
- * _mip = Mip level.
- * _resolve = Resolve flags. See: `BGFX_RESOLVE_*`
- */
- void bgfx_attachment_init(bgfx_attachment_t* _this, bgfx_texture_handle_t _handle, bgfx_access_t _access, ushort _layer, ushort _numLayers, ushort _mip, ubyte _resolve);
-
- /**
- * Start VertexLayout.
- * Params:
- * _rendererType = Renderer backend type. See: `bgfx::RendererType`
- */
- bgfx_vertex_layout_t* bgfx_vertex_layout_begin(bgfx_vertex_layout_t* _this, bgfx_renderer_type_t _rendererType);
-
- /**
- * Add attribute to VertexLayout.
- * Remarks: Must be called between begin/end.
- * Params:
- * _attrib = Attribute semantics. See: `bgfx::Attrib`
- * _num = Number of elements 1, 2, 3 or 4.
- * _type = Element type.
- * _normalized = When using fixed point AttribType (f.e. Uint8)
- * value will be normalized for vertex shader usage. When normalized
- * is set to true, AttribType::Uint8 value in range 0-255 will be
- * in range 0.0-1.0 in vertex shader.
- * _asInt = Packaging rule for vertexPack, vertexUnpack, and
- * vertexConvert for AttribType::Uint8 and AttribType::Int16.
- * Unpacking code must be implemented inside vertex shader.
- */
- bgfx_vertex_layout_t* bgfx_vertex_layout_add(bgfx_vertex_layout_t* _this, bgfx_attrib_t _attrib, ubyte _num, bgfx_attrib_type_t _type, bool _normalized, bool _asInt);
-
- /**
- * Decode attribute.
- * Params:
- * _attrib = Attribute semantics. See: `bgfx::Attrib`
- * _num = Number of elements.
- * _type = Element type.
- * _normalized = Attribute is normalized.
- * _asInt = Attribute is packed as int.
- */
- void bgfx_vertex_layout_decode(const(bgfx_vertex_layout_t)* _this, bgfx_attrib_t _attrib, ubyte* _num, bgfx_attrib_type_t* _type, bool* _normalized, bool* _asInt);
-
- /**
- * Returns `true` if VertexLayout contains attribute.
- * Params:
- * _attrib = Attribute semantics. See: `bgfx::Attrib`
- */
- bool bgfx_vertex_layout_has(const(bgfx_vertex_layout_t)* _this, bgfx_attrib_t _attrib);
-
- /**
- * Skip `_num` bytes in vertex stream.
- * Params:
- * _num = Number of bytes to skip.
- */
- bgfx_vertex_layout_t* bgfx_vertex_layout_skip(bgfx_vertex_layout_t* _this, ubyte _num);
-
- /**
- * End VertexLayout.
- */
- void bgfx_vertex_layout_end(bgfx_vertex_layout_t* _this);
-
- /**
- * Pack vertex attribute into vertex stream format.
- * Params:
- * _input = Value to be packed into vertex stream.
- * _inputNormalized = `true` if input value is already normalized.
- * _attr = Attribute to pack.
- * _layout = Vertex stream layout.
- * _data = Destination vertex stream where data will be packed.
- * _index = Vertex index that will be modified.
- */
- void bgfx_vertex_pack(const float[4] _input, bool _inputNormalized, bgfx_attrib_t _attr, const(bgfx_vertex_layout_t)* _layout, void* _data, uint _index);
-
- /**
- * Unpack vertex attribute from vertex stream format.
- * Params:
- * _output = Result of unpacking.
- * _attr = Attribute to unpack.
- * _layout = Vertex stream layout.
- * _data = Source vertex stream from where data will be unpacked.
- * _index = Vertex index that will be unpacked.
- */
- void bgfx_vertex_unpack(float[4] _output, bgfx_attrib_t _attr, const(bgfx_vertex_layout_t)* _layout, const(void)* _data, uint _index);
-
- /**
- * Converts vertex stream data from one vertex stream format to another.
- * Params:
- * _dstLayout = Destination vertex stream layout.
- * _dstData = Destination vertex stream.
- * _srcLayout = Source vertex stream layout.
- * _srcData = Source vertex stream data.
- * _num = Number of vertices to convert from source to destination.
- */
- void bgfx_vertex_convert(const(bgfx_vertex_layout_t)* _dstLayout, void* _dstData, const(bgfx_vertex_layout_t)* _srcLayout, const(void)* _srcData, uint _num);
-
- /**
- * Weld vertices.
- * Params:
- * _output = Welded vertices remapping table. The size of buffer
- * must be the same as number of vertices.
- * _layout = Vertex stream layout.
- * _data = Vertex stream.
- * _num = Number of vertices in vertex stream.
- * _index32 = Set to `true` if input indices are 32-bit.
- * _epsilon = Error tolerance for vertex position comparison.
- */
- uint bgfx_weld_vertices(void* _output, const(bgfx_vertex_layout_t)* _layout, const(void)* _data, uint _num, bool _index32, float _epsilon);
-
- /**
- * Convert index buffer for use with different primitive topologies.
- * Params:
- * _conversion = Conversion type, see `TopologyConvert::Enum`.
- * _dst = Destination index buffer. If this argument is NULL
- * function will return number of indices after conversion.
- * _dstSize = Destination index buffer in bytes. It must be
- * large enough to contain output indices. If destination size is
- * insufficient index buffer will be truncated.
- * _indices = Source indices.
- * _numIndices = Number of input indices.
- * _index32 = Set to `true` if input indices are 32-bit.
- */
- uint bgfx_topology_convert(bgfx_topology_convert_t _conversion, void* _dst, uint _dstSize, const(void)* _indices, uint _numIndices, bool _index32);
-
- /**
- * Sort indices.
- * Params:
- * _sort = Sort order, see `TopologySort::Enum`.
- * _dst = Destination index buffer.
- * _dstSize = Destination index buffer in bytes. It must be
- * large enough to contain output indices. If destination size is
- * insufficient index buffer will be truncated.
- * _dir = Direction (vector must be normalized).
- * _pos = Position.
- * _vertices = Pointer to first vertex represented as
- * float x, y, z. Must contain at least number of vertices
- * referencende by index buffer.
- * _stride = Vertex stride.
- * _indices = Source indices.
- * _numIndices = Number of input indices.
- * _index32 = Set to `true` if input indices are 32-bit.
- */
- void bgfx_topology_sort_tri_list(bgfx_topology_sort_t _sort, void* _dst, uint _dstSize, const float[3] _dir, const float[3] _pos, const(void)* _vertices, uint _stride, const(void)* _indices, uint _numIndices, bool _index32);
-
- /**
- * Returns supported backend API renderers.
- * Params:
- * _max = Maximum number of elements in _enum array.
- * _enum = Array where supported renderers will be written.
- */
- ubyte bgfx_get_supported_renderers(ubyte _max, bgfx_renderer_type_t* _enum);
-
- /**
- * Returns name of renderer.
- * Params:
- * _type = Renderer backend type. See: `bgfx::RendererType`
- */
- const(char)* bgfx_get_renderer_name(bgfx_renderer_type_t _type);
-
- void bgfx_init_ctor(bgfx_init_t* _init);
-
- /**
- * Initialize the bgfx library.
- * Params:
- * _init = Initialization parameters. See: `bgfx::Init` for more info.
- */
- bool bgfx_init(const(bgfx_init_t)* _init);
-
- /**
- * Shutdown bgfx library.
- */
- void bgfx_shutdown();
-
- /**
- * Reset graphic settings and back-buffer size.
- * Attention: This call doesn’t change the window size, it just resizes
- * the back-buffer. Your windowing code controls the window size.
- * Params:
- * _width = Back-buffer width.
- * _height = Back-buffer height.
- * _flags = See: `BGFX_RESET_*` for more info.
- * - `BGFX_RESET_NONE` - No reset flags.
- * - `BGFX_RESET_FULLSCREEN` - Not supported yet.
- * - `BGFX_RESET_MSAA_X[2/4/8/16]` - Enable 2, 4, 8 or 16 x MSAA.
- * - `BGFX_RESET_VSYNC` - Enable V-Sync.
- * - `BGFX_RESET_MAXANISOTROPY` - Turn on/off max anisotropy.
- * - `BGFX_RESET_CAPTURE` - Begin screen capture.
- * - `BGFX_RESET_FLUSH_AFTER_RENDER` - Flush rendering after submitting to GPU.
- * - `BGFX_RESET_FLIP_AFTER_RENDER` - This flag specifies where flip
- * occurs. Default behaviour is that flip occurs before rendering new
- * frame. This flag only has effect when `BGFX_CONFIG_MULTITHREADED=0`.
- * - `BGFX_RESET_SRGB_BACKBUFFER` - Enable sRGB back-buffer.
- * _format = Texture format. See: `TextureFormat::Enum`.
- */
- void bgfx_reset(uint _width, uint _height, uint _flags, bgfx_texture_format_t _format);
-
- /**
- * Advance to next frame. When using multithreaded renderer, this call
- * just swaps internal buffers, kicks render thread, and returns. In
- * singlethreaded renderer this call does frame rendering.
- * Params:
- * _capture = Capture frame with graphics debugger.
- */
- uint bgfx_frame(bool _capture);
-
- /**
- * Returns current renderer backend API type.
- * Remarks:
- * Library must be initialized.
- */
- bgfx_renderer_type_t bgfx_get_renderer_type();
-
- /**
- * Returns renderer capabilities.
- * Remarks:
- * Library must be initialized.
- */
- const(bgfx_caps_t)* bgfx_get_caps();
-
- /**
- * Returns performance counters.
- * Attention: Pointer returned is valid until `bgfx::frame` is called.
- */
- const(bgfx_stats_t)* bgfx_get_stats();
-
- /**
- * Allocate buffer to pass to bgfx calls. Data will be freed inside bgfx.
- * Params:
- * _size = Size to allocate.
- */
- const(bgfx_memory_t)* bgfx_alloc(uint _size);
-
- /**
- * Allocate buffer and copy data into it. Data will be freed inside bgfx.
- * Params:
- * _data = Pointer to data to be copied.
- * _size = Size of data to be copied.
- */
- const(bgfx_memory_t)* bgfx_copy(const(void)* _data, uint _size);
-
- /**
- * Make reference to data to pass to bgfx. Unlike `bgfx::alloc`, this call
- * doesn't allocate memory for data. It just copies the _data pointer. You
- * can pass `ReleaseFn` function pointer to release this memory after it's
- * consumed, otherwise you must make sure _data is available for at least 2
- * `bgfx::frame` calls. `ReleaseFn` function must be able to be called
- * from any thread.
- * Attention: Data passed must be available for at least 2 `bgfx::frame` calls.
- * Params:
- * _data = Pointer to data.
- * _size = Size of data.
- */
- const(bgfx_memory_t)* bgfx_make_ref(const(void)* _data, uint _size);
-
- /**
- * Make reference to data to pass to bgfx. Unlike `bgfx::alloc`, this call
- * doesn't allocate memory for data. It just copies the _data pointer. You
- * can pass `ReleaseFn` function pointer to release this memory after it's
- * consumed, otherwise you must make sure _data is available for at least 2
- * `bgfx::frame` calls. `ReleaseFn` function must be able to be called
- * from any thread.
- * Attention: Data passed must be available for at least 2 `bgfx::frame` calls.
- * Params:
- * _data = Pointer to data.
- * _size = Size of data.
- * _releaseFn = Callback function to release memory after use.
- * _userData = User data to be passed to callback function.
- */
- const(bgfx_memory_t)* bgfx_make_ref_release(const(void)* _data, uint _size, void* _releaseFn, void* _userData);
-
- /**
- * Set debug flags.
- * Params:
- * _debug = Available flags:
- * - `BGFX_DEBUG_IFH` - Infinitely fast hardware. When this flag is set
- * all rendering calls will be skipped. This is useful when profiling
- * to quickly assess potential bottlenecks between CPU and GPU.
- * - `BGFX_DEBUG_PROFILER` - Enable profiler.
- * - `BGFX_DEBUG_STATS` - Display internal statistics.
- * - `BGFX_DEBUG_TEXT` - Display debug text.
- * - `BGFX_DEBUG_WIREFRAME` - Wireframe rendering. All rendering
- * primitives will be rendered as lines.
- */
- void bgfx_set_debug(uint _debug);
-
- /**
- * Clear internal debug text buffer.
- * Params:
- * _attr = Background color.
- * _small = Default 8x16 or 8x8 font.
- */
- void bgfx_dbg_text_clear(ubyte _attr, bool _small);
-
- /**
- * Print formatted data to internal debug text character-buffer (VGA-compatible text mode).
- * Params:
- * _x = Position x from the left corner of the window.
- * _y = Position y from the top corner of the window.
- * _attr = Color palette. Where top 4-bits represent index of background, and bottom
- * 4-bits represent foreground color from standard VGA text palette (ANSI escape codes).
- * _format = `printf` style format.
- */
- void bgfx_dbg_text_printf(ushort _x, ushort _y, ubyte _attr, const(char)* _format, ... );
-
- /**
- * Print formatted data from variable argument list to internal debug text character-buffer (VGA-compatible text mode).
- * Params:
- * _x = Position x from the left corner of the window.
- * _y = Position y from the top corner of the window.
- * _attr = Color palette. Where top 4-bits represent index of background, and bottom
- * 4-bits represent foreground color from standard VGA text palette (ANSI escape codes).
- * _format = `printf` style format.
- * _argList = Variable arguments list for format string.
- */
- void bgfx_dbg_text_vprintf(ushort _x, ushort _y, ubyte _attr, const(char)* _format, va_list _argList);
-
- /**
- * Draw image into internal debug text buffer.
- * Params:
- * _x = Position x from the left corner of the window.
- * _y = Position y from the top corner of the window.
- * _width = Image width.
- * _height = Image height.
- * _data = Raw image data (character/attribute raw encoding).
- * _pitch = Image pitch in bytes.
- */
- void bgfx_dbg_text_image(ushort _x, ushort _y, ushort _width, ushort _height, const(void)* _data, ushort _pitch);
-
- /**
- * Create static index buffer.
- * Params:
- * _mem = Index buffer data.
- * _flags = Buffer creation flags.
- * - `BGFX_BUFFER_NONE` - No flags.
- * - `BGFX_BUFFER_COMPUTE_READ` - Buffer will be read from by compute shader.
- * - `BGFX_BUFFER_COMPUTE_WRITE` - Buffer will be written into by compute shader. When buffer
- * is created with `BGFX_BUFFER_COMPUTE_WRITE` flag it cannot be updated from CPU.
- * - `BGFX_BUFFER_COMPUTE_READ_WRITE` - Buffer will be used for read/write by compute shader.
- * - `BGFX_BUFFER_ALLOW_RESIZE` - Buffer will resize on buffer update if a different amount of
- * data is passed. If this flag is not specified, and more data is passed on update, the buffer
- * will be trimmed to fit the existing buffer size. This flag has effect only on dynamic
- * buffers.
- * - `BGFX_BUFFER_INDEX32` - Buffer is using 32-bit indices. This flag has effect only on
- * index buffers.
- */
- bgfx_index_buffer_handle_t bgfx_create_index_buffer(const(bgfx_memory_t)* _mem, ushort _flags);
-
- /**
- * Set static index buffer debug name.
- * Params:
- * _handle = Static index buffer handle.
- * _name = Static index buffer name.
- * _len = Static index buffer name length (if length is INT32_MAX, it's expected
- * that _name is zero terminated string.
- */
- void bgfx_set_index_buffer_name(bgfx_index_buffer_handle_t _handle, const(char)* _name, int _len);
-
- /**
- * Destroy static index buffer.
- * Params:
- * _handle = Static index buffer handle.
- */
- void bgfx_destroy_index_buffer(bgfx_index_buffer_handle_t _handle);
-
- /**
- * Create vertex layout.
- * Params:
- * _layout = Vertex layout.
- */
- bgfx_vertex_layout_handle_t bgfx_create_vertex_layout(const(bgfx_vertex_layout_t)* _layout);
-
- /**
- * Destroy vertex layout.
- * Params:
- * _layoutHandle = Vertex layout handle.
- */
- void bgfx_destroy_vertex_layout(bgfx_vertex_layout_handle_t _layoutHandle);
-
- /**
- * Create static vertex buffer.
- * Params:
- * _mem = Vertex buffer data.
- * _layout = Vertex layout.
- * _flags = Buffer creation flags.
- * - `BGFX_BUFFER_NONE` - No flags.
- * - `BGFX_BUFFER_COMPUTE_READ` - Buffer will be read from by compute shader.
- * - `BGFX_BUFFER_COMPUTE_WRITE` - Buffer will be written into by compute shader. When buffer
- * is created with `BGFX_BUFFER_COMPUTE_WRITE` flag it cannot be updated from CPU.
- * - `BGFX_BUFFER_COMPUTE_READ_WRITE` - Buffer will be used for read/write by compute shader.
- * - `BGFX_BUFFER_ALLOW_RESIZE` - Buffer will resize on buffer update if a different amount of
- * data is passed. If this flag is not specified, and more data is passed on update, the buffer
- * will be trimmed to fit the existing buffer size. This flag has effect only on dynamic buffers.
- * - `BGFX_BUFFER_INDEX32` - Buffer is using 32-bit indices. This flag has effect only on index buffers.
- */
- bgfx_vertex_buffer_handle_t bgfx_create_vertex_buffer(const(bgfx_memory_t)* _mem, const(bgfx_vertex_layout_t)* _layout, ushort _flags);
-
- /**
- * Set static vertex buffer debug name.
- * Params:
- * _handle = Static vertex buffer handle.
- * _name = Static vertex buffer name.
- * _len = Static vertex buffer name length (if length is INT32_MAX, it's expected
- * that _name is zero terminated string.
- */
- void bgfx_set_vertex_buffer_name(bgfx_vertex_buffer_handle_t _handle, const(char)* _name, int _len);
-
- /**
- * Destroy static vertex buffer.
- * Params:
- * _handle = Static vertex buffer handle.
- */
- void bgfx_destroy_vertex_buffer(bgfx_vertex_buffer_handle_t _handle);
-
- /**
- * Create empty dynamic index buffer.
- * Params:
- * _num = Number of indices.
- * _flags = Buffer creation flags.
- * - `BGFX_BUFFER_NONE` - No flags.
- * - `BGFX_BUFFER_COMPUTE_READ` - Buffer will be read from by compute shader.
- * - `BGFX_BUFFER_COMPUTE_WRITE` - Buffer will be written into by compute shader. When buffer
- * is created with `BGFX_BUFFER_COMPUTE_WRITE` flag it cannot be updated from CPU.
- * - `BGFX_BUFFER_COMPUTE_READ_WRITE` - Buffer will be used for read/write by compute shader.
- * - `BGFX_BUFFER_ALLOW_RESIZE` - Buffer will resize on buffer update if a different amount of
- * data is passed. If this flag is not specified, and more data is passed on update, the buffer
- * will be trimmed to fit the existing buffer size. This flag has effect only on dynamic
- * buffers.
- * - `BGFX_BUFFER_INDEX32` - Buffer is using 32-bit indices. This flag has effect only on
- * index buffers.
- */
- bgfx_dynamic_index_buffer_handle_t bgfx_create_dynamic_index_buffer(uint _num, ushort _flags);
-
- /**
- * Create a dynamic index buffer and initialize it.
- * Params:
- * _mem = Index buffer data.
- * _flags = Buffer creation flags.
- * - `BGFX_BUFFER_NONE` - No flags.
- * - `BGFX_BUFFER_COMPUTE_READ` - Buffer will be read from by compute shader.
- * - `BGFX_BUFFER_COMPUTE_WRITE` - Buffer will be written into by compute shader. When buffer
- * is created with `BGFX_BUFFER_COMPUTE_WRITE` flag it cannot be updated from CPU.
- * - `BGFX_BUFFER_COMPUTE_READ_WRITE` - Buffer will be used for read/write by compute shader.
- * - `BGFX_BUFFER_ALLOW_RESIZE` - Buffer will resize on buffer update if a different amount of
- * data is passed. If this flag is not specified, and more data is passed on update, the buffer
- * will be trimmed to fit the existing buffer size. This flag has effect only on dynamic
- * buffers.
- * - `BGFX_BUFFER_INDEX32` - Buffer is using 32-bit indices. This flag has effect only on
- * index buffers.
- */
- bgfx_dynamic_index_buffer_handle_t bgfx_create_dynamic_index_buffer_mem(const(bgfx_memory_t)* _mem, ushort _flags);
-
- /**
- * Update dynamic index buffer.
- * Params:
- * _handle = Dynamic index buffer handle.
- * _startIndex = Start index.
- * _mem = Index buffer data.
- */
- void bgfx_update_dynamic_index_buffer(bgfx_dynamic_index_buffer_handle_t _handle, uint _startIndex, const(bgfx_memory_t)* _mem);
-
- /**
- * Destroy dynamic index buffer.
- * Params:
- * _handle = Dynamic index buffer handle.
- */
- void bgfx_destroy_dynamic_index_buffer(bgfx_dynamic_index_buffer_handle_t _handle);
-
- /**
- * Create empty dynamic vertex buffer.
- * Params:
- * _num = Number of vertices.
- * _layout = Vertex layout.
- * _flags = Buffer creation flags.
- * - `BGFX_BUFFER_NONE` - No flags.
- * - `BGFX_BUFFER_COMPUTE_READ` - Buffer will be read from by compute shader.
- * - `BGFX_BUFFER_COMPUTE_WRITE` - Buffer will be written into by compute shader. When buffer
- * is created with `BGFX_BUFFER_COMPUTE_WRITE` flag it cannot be updated from CPU.
- * - `BGFX_BUFFER_COMPUTE_READ_WRITE` - Buffer will be used for read/write by compute shader.
- * - `BGFX_BUFFER_ALLOW_RESIZE` - Buffer will resize on buffer update if a different amount of
- * data is passed. If this flag is not specified, and more data is passed on update, the buffer
- * will be trimmed to fit the existing buffer size. This flag has effect only on dynamic
- * buffers.
- * - `BGFX_BUFFER_INDEX32` - Buffer is using 32-bit indices. This flag has effect only on
- * index buffers.
- */
- bgfx_dynamic_vertex_buffer_handle_t bgfx_create_dynamic_vertex_buffer(uint _num, const(bgfx_vertex_layout_t)* _layout, ushort _flags);
-
- /**
- * Create dynamic vertex buffer and initialize it.
- * Params:
- * _mem = Vertex buffer data.
- * _layout = Vertex layout.
- * _flags = Buffer creation flags.
- * - `BGFX_BUFFER_NONE` - No flags.
- * - `BGFX_BUFFER_COMPUTE_READ` - Buffer will be read from by compute shader.
- * - `BGFX_BUFFER_COMPUTE_WRITE` - Buffer will be written into by compute shader. When buffer
- * is created with `BGFX_BUFFER_COMPUTE_WRITE` flag it cannot be updated from CPU.
- * - `BGFX_BUFFER_COMPUTE_READ_WRITE` - Buffer will be used for read/write by compute shader.
- * - `BGFX_BUFFER_ALLOW_RESIZE` - Buffer will resize on buffer update if a different amount of
- * data is passed. If this flag is not specified, and more data is passed on update, the buffer
- * will be trimmed to fit the existing buffer size. This flag has effect only on dynamic
- * buffers.
- * - `BGFX_BUFFER_INDEX32` - Buffer is using 32-bit indices. This flag has effect only on
- * index buffers.
- */
- bgfx_dynamic_vertex_buffer_handle_t bgfx_create_dynamic_vertex_buffer_mem(const(bgfx_memory_t)* _mem, const(bgfx_vertex_layout_t)* _layout, ushort _flags);
-
- /**
- * Update dynamic vertex buffer.
- * Params:
- * _handle = Dynamic vertex buffer handle.
- * _startVertex = Start vertex.
- * _mem = Vertex buffer data.
- */
- void bgfx_update_dynamic_vertex_buffer(bgfx_dynamic_vertex_buffer_handle_t _handle, uint _startVertex, const(bgfx_memory_t)* _mem);
-
- /**
- * Destroy dynamic vertex buffer.
- * Params:
- * _handle = Dynamic vertex buffer handle.
- */
- void bgfx_destroy_dynamic_vertex_buffer(bgfx_dynamic_vertex_buffer_handle_t _handle);
-
- /**
- * Returns number of requested or maximum available indices.
- * Params:
- * _num = Number of required indices.
- * _index32 = Set to `true` if input indices will be 32-bit.
- */
- uint bgfx_get_avail_transient_index_buffer(uint _num, bool _index32);
-
- /**
- * Returns number of requested or maximum available vertices.
- * Params:
- * _num = Number of required vertices.
- * _layout = Vertex layout.
- */
- uint bgfx_get_avail_transient_vertex_buffer(uint _num, const(bgfx_vertex_layout_t)* _layout);
-
- /**
- * Returns number of requested or maximum available instance buffer slots.
- * Params:
- * _num = Number of required instances.
- * _stride = Stride per instance.
- */
- uint bgfx_get_avail_instance_data_buffer(uint _num, ushort _stride);
-
- /**
- * Allocate transient index buffer.
- * Params:
- * _tib = TransientIndexBuffer structure will be filled, and will be valid
- * for the duration of frame, and can be reused for multiple draw
- * calls.
- * _num = Number of indices to allocate.
- * _index32 = Set to `true` if input indices will be 32-bit.
- */
- void bgfx_alloc_transient_index_buffer(bgfx_transient_index_buffer_t* _tib, uint _num, bool _index32);
-
- /**
- * Allocate transient vertex buffer.
- * Params:
- * _tvb = TransientVertexBuffer structure will be filled, and will be valid
- * for the duration of frame, and can be reused for multiple draw
- * calls.
- * _num = Number of vertices to allocate.
- * _layout = Vertex layout.
- */
- void bgfx_alloc_transient_vertex_buffer(bgfx_transient_vertex_buffer_t* _tvb, uint _num, const(bgfx_vertex_layout_t)* _layout);
-
- /**
- * Check for required space and allocate transient vertex and index
- * buffers. If both space requirements are satisfied function returns
- * true.
- * Params:
- * _tvb = TransientVertexBuffer structure will be filled, and will be valid
- * for the duration of frame, and can be reused for multiple draw
- * calls.
- * _layout = Vertex layout.
- * _numVertices = Number of vertices to allocate.
- * _tib = TransientIndexBuffer structure will be filled, and will be valid
- * for the duration of frame, and can be reused for multiple draw
- * calls.
- * _numIndices = Number of indices to allocate.
- * _index32 = Set to `true` if input indices will be 32-bit.
- */
- bool bgfx_alloc_transient_buffers(bgfx_transient_vertex_buffer_t* _tvb, const(bgfx_vertex_layout_t)* _layout, uint _numVertices, bgfx_transient_index_buffer_t* _tib, uint _numIndices, bool _index32);
-
- /**
- * Allocate instance data buffer.
- * Params:
- * _idb = InstanceDataBuffer structure will be filled, and will be valid
- * for duration of frame, and can be reused for multiple draw
- * calls.
- * _num = Number of instances.
- * _stride = Instance stride. Must be multiple of 16.
- */
- void bgfx_alloc_instance_data_buffer(bgfx_instance_data_buffer_t* _idb, uint _num, ushort _stride);
-
- /**
- * Create draw indirect buffer.
- * Params:
- * _num = Number of indirect calls.
- */
- bgfx_indirect_buffer_handle_t bgfx_create_indirect_buffer(uint _num);
-
- /**
- * Destroy draw indirect buffer.
- * Params:
- * _handle = Indirect buffer handle.
- */
- void bgfx_destroy_indirect_buffer(bgfx_indirect_buffer_handle_t _handle);
-
- /**
- * Create shader from memory buffer.
- * Params:
- * _mem = Shader binary.
- */
- bgfx_shader_handle_t bgfx_create_shader(const(bgfx_memory_t)* _mem);
-
- /**
- * Returns the number of uniforms and uniform handles used inside a shader.
- * Remarks:
- * Only non-predefined uniforms are returned.
- * Params:
- * _handle = Shader handle.
- * _uniforms = UniformHandle array where data will be stored.
- * _max = Maximum capacity of array.
- */
- ushort bgfx_get_shader_uniforms(bgfx_shader_handle_t _handle, bgfx_uniform_handle_t* _uniforms, ushort _max);
-
- /**
- * Set shader debug name.
- * Params:
- * _handle = Shader handle.
- * _name = Shader name.
- * _len = Shader name length (if length is INT32_MAX, it's expected
- * that _name is zero terminated string).
- */
- void bgfx_set_shader_name(bgfx_shader_handle_t _handle, const(char)* _name, int _len);
-
- /**
- * Destroy shader.
- * Remarks: Once a shader program is created with _handle,
- * it is safe to destroy that shader.
- * Params:
- * _handle = Shader handle.
- */
- void bgfx_destroy_shader(bgfx_shader_handle_t _handle);
-
- /**
- * Create program with vertex and fragment shaders.
- * Params:
- * _vsh = Vertex shader.
- * _fsh = Fragment shader.
- * _destroyShaders = If true, shaders will be destroyed when program is destroyed.
- */
- bgfx_program_handle_t bgfx_create_program(bgfx_shader_handle_t _vsh, bgfx_shader_handle_t _fsh, bool _destroyShaders);
-
- /**
- * Create program with compute shader.
- * Params:
- * _csh = Compute shader.
- * _destroyShaders = If true, shaders will be destroyed when program is destroyed.
- */
- bgfx_program_handle_t bgfx_create_compute_program(bgfx_shader_handle_t _csh, bool _destroyShaders);
-
- /**
- * Destroy program.
- * Params:
- * _handle = Program handle.
- */
- void bgfx_destroy_program(bgfx_program_handle_t _handle);
-
- /**
- * Validate texture parameters.
- * Params:
- * _depth = Depth dimension of volume texture.
- * _cubeMap = Indicates that texture contains cubemap.
- * _numLayers = Number of layers in texture array.
- * _format = Texture format. See: `TextureFormat::Enum`.
- * _flags = Texture flags. See `BGFX_TEXTURE_*`.
- */
- bool bgfx_is_texture_valid(ushort _depth, bool _cubeMap, ushort _numLayers, bgfx_texture_format_t _format, ulong _flags);
-
- /**
- * Validate frame buffer parameters.
- * Params:
- * _num = Number of attachments.
- * _attachment = Attachment texture info. See: `bgfx::Attachment`.
- */
- bool bgfx_is_frame_buffer_valid(ubyte _num, const(bgfx_attachment_t)* _attachment);
-
- /**
- * Calculate amount of memory required for texture.
- * Params:
- * _info = Resulting texture info structure. See: `TextureInfo`.
- * _width = Width.
- * _height = Height.
- * _depth = Depth dimension of volume texture.
- * _cubeMap = Indicates that texture contains cubemap.
- * _hasMips = Indicates that texture contains full mip-map chain.
- * _numLayers = Number of layers in texture array.
- * _format = Texture format. See: `TextureFormat::Enum`.
- */
- void bgfx_calc_texture_size(bgfx_texture_info_t* _info, ushort _width, ushort _height, ushort _depth, bool _cubeMap, bool _hasMips, ushort _numLayers, bgfx_texture_format_t _format);
-
- /**
- * Create texture from memory buffer.
- * Params:
- * _mem = DDS, KTX or PVR texture binary data.
- * _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.
- * _skip = Skip top level mips when parsing texture.
- * _info = When non-`NULL` is specified it returns parsed texture information.
- */
- bgfx_texture_handle_t bgfx_create_texture(const(bgfx_memory_t)* _mem, ulong _flags, ubyte _skip, bgfx_texture_info_t* _info);
-
- /**
- * Create 2D texture.
- * Params:
- * _width = Width.
- * _height = Height.
- * _hasMips = Indicates that texture contains full mip-map chain.
- * _numLayers = Number of layers in texture array. Must be 1 if caps
- * `BGFX_CAPS_TEXTURE_2D_ARRAY` flag is not set.
- * _format = Texture format. See: `TextureFormat::Enum`.
- * _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.
- * _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.
- */
- bgfx_texture_handle_t bgfx_create_texture_2d(ushort _width, ushort _height, bool _hasMips, ushort _numLayers, bgfx_texture_format_t _format, ulong _flags, const(bgfx_memory_t)* _mem);
-
- /**
- * Create texture with size based on back-buffer ratio. Texture will maintain ratio
- * if back buffer resolution changes.
- * Params:
- * _ratio = Texture size in respect to back-buffer size. See: `BackbufferRatio::Enum`.
- * _hasMips = Indicates that texture contains full mip-map chain.
- * _numLayers = Number of layers in texture array. Must be 1 if caps
- * `BGFX_CAPS_TEXTURE_2D_ARRAY` flag is not set.
- * _format = Texture format. See: `TextureFormat::Enum`.
- * _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.
- */
- bgfx_texture_handle_t bgfx_create_texture_2d_scaled(bgfx_backbuffer_ratio_t _ratio, bool _hasMips, ushort _numLayers, bgfx_texture_format_t _format, ulong _flags);
-
- /**
- * Create 3D texture.
- * Params:
- * _width = Width.
- * _height = Height.
- * _depth = Depth.
- * _hasMips = Indicates that texture contains full mip-map chain.
- * _format = Texture format. See: `TextureFormat::Enum`.
- * _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.
- * _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.
- */
- bgfx_texture_handle_t bgfx_create_texture_3d(ushort _width, ushort _height, ushort _depth, bool _hasMips, bgfx_texture_format_t _format, ulong _flags, const(bgfx_memory_t)* _mem);
-
- /**
- * Create Cube texture.
- * Params:
- * _size = Cube side size.
- * _hasMips = Indicates that texture contains full mip-map chain.
- * _numLayers = Number of layers in texture array. Must be 1 if caps
- * `BGFX_CAPS_TEXTURE_2D_ARRAY` flag is not set.
- * _format = Texture format. See: `TextureFormat::Enum`.
- * _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.
- * _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.
- */
- bgfx_texture_handle_t bgfx_create_texture_cube(ushort _size, bool _hasMips, ushort _numLayers, bgfx_texture_format_t _format, ulong _flags, const(bgfx_memory_t)* _mem);
-
- /**
- * Update 2D texture.
- * Attention: It's valid to update only mutable texture. See `bgfx::createTexture2D` for more info.
- * Params:
- * _handle = Texture handle.
- * _layer = Layer in texture array.
- * _mip = Mip level.
- * _x = X offset in texture.
- * _y = Y offset in texture.
- * _width = Width of texture block.
- * _height = Height of texture block.
- * _mem = Texture update data.
- * _pitch = Pitch of input image (bytes). When _pitch is set to
- * UINT16_MAX, it will be calculated internally based on _width.
- */
- void bgfx_update_texture_2d(bgfx_texture_handle_t _handle, ushort _layer, ubyte _mip, ushort _x, ushort _y, ushort _width, ushort _height, const(bgfx_memory_t)* _mem, ushort _pitch);
-
- /**
- * Update 3D texture.
- * Attention: It's valid to update only mutable texture. See `bgfx::createTexture3D` for more info.
- * Params:
- * _handle = Texture handle.
- * _mip = Mip level.
- * _x = X offset in texture.
- * _y = Y offset in texture.
- * _z = Z offset in texture.
- * _width = Width of texture block.
- * _height = Height of texture block.
- * _depth = Depth of texture block.
- * _mem = Texture update data.
- */
- void bgfx_update_texture_3d(bgfx_texture_handle_t _handle, ubyte _mip, ushort _x, ushort _y, ushort _z, ushort _width, ushort _height, ushort _depth, const(bgfx_memory_t)* _mem);
-
- /**
- * Update Cube texture.
- * Attention: It's valid to update only mutable texture. See `bgfx::createTextureCube` for more info.
- * Params:
- * _handle = Texture handle.
- * _layer = Layer in texture array.
- * _side = Cubemap side `BGFX_CUBE_MAP_<POSITIVE or NEGATIVE>_<X, Y or Z>`,
- * where 0 is +X, 1 is -X, 2 is +Y, 3 is -Y, 4 is +Z, and 5 is -Z.
- * +----------+
- * |-z 2|
- * | ^ +y |
- * | | | Unfolded cube:
- * | +---->+x |
- * +----------+----------+----------+----------+
- * |+y 1|+y 4|+y 0|+y 5|
- * | ^ -x | ^ +z | ^ +x | ^ -z |
- * | | | | | | | | |
- * | +---->+z | +---->+x | +---->-z | +---->-x |
- * +----------+----------+----------+----------+
- * |+z 3|
- * | ^ -y |
- * | | |
- * | +---->+x |
- * +----------+
- * _mip = Mip level.
- * _x = X offset in texture.
- * _y = Y offset in texture.
- * _width = Width of texture block.
- * _height = Height of texture block.
- * _mem = Texture update data.
- * _pitch = Pitch of input image (bytes). When _pitch is set to
- * UINT16_MAX, it will be calculated internally based on _width.
- */
- void bgfx_update_texture_cube(bgfx_texture_handle_t _handle, ushort _layer, ubyte _side, ubyte _mip, ushort _x, ushort _y, ushort _width, ushort _height, const(bgfx_memory_t)* _mem, ushort _pitch);
-
- /**
- * Read back texture content.
- * Attention: Texture must be created with `BGFX_TEXTURE_READ_BACK` flag.
- * Attention: Availability depends on: `BGFX_CAPS_TEXTURE_READ_BACK`.
- * Params:
- * _handle = Texture handle.
- * _data = Destination buffer.
- * _mip = Mip level.
- */
- uint bgfx_read_texture(bgfx_texture_handle_t _handle, void* _data, ubyte _mip);
-
- /**
- * Set texture debug name.
- * Params:
- * _handle = Texture handle.
- * _name = Texture name.
- * _len = Texture name length (if length is INT32_MAX, it's expected
- * that _name is zero terminated string.
- */
- void bgfx_set_texture_name(bgfx_texture_handle_t _handle, const(char)* _name, int _len);
-
- /**
- * Returns texture direct access pointer.
- * Attention: Availability depends on: `BGFX_CAPS_TEXTURE_DIRECT_ACCESS`. This feature
- * is available on GPUs that have unified memory architecture (UMA) support.
- * Params:
- * _handle = Texture handle.
- */
- void* bgfx_get_direct_access_ptr(bgfx_texture_handle_t _handle);
-
- /**
- * Destroy texture.
- * Params:
- * _handle = Texture handle.
- */
- void bgfx_destroy_texture(bgfx_texture_handle_t _handle);
-
- /**
- * Create frame buffer (simple).
- * Params:
- * _width = Texture width.
- * _height = Texture height.
- * _format = Texture format. See: `TextureFormat::Enum`.
- * _textureFlags = 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.
- */
- bgfx_frame_buffer_handle_t bgfx_create_frame_buffer(ushort _width, ushort _height, bgfx_texture_format_t _format, ulong _textureFlags);
-
- /**
- * Create frame buffer with size based on back-buffer ratio. Frame buffer will maintain ratio
- * if back buffer resolution changes.
- * Params:
- * _ratio = Frame buffer size in respect to back-buffer size. See:
- * `BackbufferRatio::Enum`.
- * _format = Texture format. See: `TextureFormat::Enum`.
- * _textureFlags = 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.
- */
- bgfx_frame_buffer_handle_t bgfx_create_frame_buffer_scaled(bgfx_backbuffer_ratio_t _ratio, bgfx_texture_format_t _format, ulong _textureFlags);
-
- /**
- * Create MRT frame buffer from texture handles (simple).
- * Params:
- * _num = Number of texture handles.
- * _handles = Texture attachments.
- * _destroyTexture = If true, textures will be destroyed when
- * frame buffer is destroyed.
- */
- bgfx_frame_buffer_handle_t bgfx_create_frame_buffer_from_handles(ubyte _num, const(bgfx_texture_handle_t)* _handles, bool _destroyTexture);
-
- /**
- * Create MRT frame buffer from texture handles with specific layer and
- * mip level.
- * Params:
- * _num = Number of attachments.
- * _attachment = Attachment texture info. See: `bgfx::Attachment`.
- * _destroyTexture = If true, textures will be destroyed when
- * frame buffer is destroyed.
- */
- bgfx_frame_buffer_handle_t bgfx_create_frame_buffer_from_attachment(ubyte _num, const(bgfx_attachment_t)* _attachment, bool _destroyTexture);
-
- /**
- * Create frame buffer for multiple window rendering.
- * Remarks:
- * Frame buffer cannot be used for sampling.
- * Attention: Availability depends on: `BGFX_CAPS_SWAP_CHAIN`.
- * Params:
- * _nwh = OS' target native window handle.
- * _width = Window back buffer width.
- * _height = Window back buffer height.
- * _format = Window back buffer color format.
- * _depthFormat = Window back buffer depth format.
- */
- bgfx_frame_buffer_handle_t bgfx_create_frame_buffer_from_nwh(void* _nwh, ushort _width, ushort _height, bgfx_texture_format_t _format, bgfx_texture_format_t _depthFormat);
-
- /**
- * Set frame buffer debug name.
- * Params:
- * _handle = Frame buffer handle.
- * _name = Frame buffer name.
- * _len = Frame buffer name length (if length is INT32_MAX, it's expected
- * that _name is zero terminated string.
- */
- void bgfx_set_frame_buffer_name(bgfx_frame_buffer_handle_t _handle, const(char)* _name, int _len);
-
- /**
- * Obtain texture handle of frame buffer attachment.
- * Params:
- * _handle = Frame buffer handle.
- */
- bgfx_texture_handle_t bgfx_get_texture(bgfx_frame_buffer_handle_t _handle, ubyte _attachment);
-
- /**
- * Destroy frame buffer.
- * Params:
- * _handle = Frame buffer handle.
- */
- void bgfx_destroy_frame_buffer(bgfx_frame_buffer_handle_t _handle);
-
- /**
- * Create shader uniform parameter.
- * Remarks:
- * 1. Uniform names are unique. It's valid to call `bgfx::createUniform`
- * multiple times with the same uniform name. The library will always
- * return the same handle, but the handle reference count will be
- * incremented. This means that the same number of `bgfx::destroyUniform`
- * must be called to properly destroy the uniform.
- * 2. Predefined uniforms (declared in `bgfx_shader.sh`):
- * - `u_viewRect vec4(x, y, width, height)` - view rectangle for current
- * view, in pixels.
- * - `u_viewTexel vec4(1.0/width, 1.0/height, undef, undef)` - inverse
- * width and height
- * - `u_view mat4` - view matrix
- * - `u_invView mat4` - inverted view matrix
- * - `u_proj mat4` - projection matrix
- * - `u_invProj mat4` - inverted projection matrix
- * - `u_viewProj mat4` - concatenated view projection matrix
- * - `u_invViewProj mat4` - concatenated inverted view projection matrix
- * - `u_model mat4[BGFX_CONFIG_MAX_BONES]` - array of model matrices.
- * - `u_modelView mat4` - concatenated model view matrix, only first
- * model matrix from array is used.
- * - `u_modelViewProj mat4` - concatenated model view projection matrix.
- * - `u_alphaRef float` - alpha reference value for alpha test.
- * Params:
- * _name = Uniform name in shader.
- * _type = Type of uniform (See: `bgfx::UniformType`).
- * _num = Number of elements in array.
- */
- bgfx_uniform_handle_t bgfx_create_uniform(const(char)* _name, bgfx_uniform_type_t _type, ushort _num);
-
- /**
- * Retrieve uniform info.
- * Params:
- * _handle = Handle to uniform object.
- * _info = Uniform info.
- */
- void bgfx_get_uniform_info(bgfx_uniform_handle_t _handle, bgfx_uniform_info_t* _info);
-
- /**
- * Destroy shader uniform parameter.
- * Params:
- * _handle = Handle to uniform object.
- */
- void bgfx_destroy_uniform(bgfx_uniform_handle_t _handle);
-
- /**
- * Create occlusion query.
- */
- bgfx_occlusion_query_handle_t bgfx_create_occlusion_query();
-
- /**
- * Retrieve occlusion query result from previous frame.
- * Params:
- * _handle = Handle to occlusion query object.
- * _result = Number of pixels that passed test. This argument
- * can be `NULL` if result of occlusion query is not needed.
- */
- bgfx_occlusion_query_result_t bgfx_get_result(bgfx_occlusion_query_handle_t _handle, int* _result);
-
- /**
- * Destroy occlusion query.
- * Params:
- * _handle = Handle to occlusion query object.
- */
- void bgfx_destroy_occlusion_query(bgfx_occlusion_query_handle_t _handle);
-
- /**
- * Set palette color value.
- * Params:
- * _index = Index into palette.
- * _rgba = RGBA floating point values.
- */
- void bgfx_set_palette_color(ubyte _index, const float[4] _rgba);
-
- /**
- * Set palette color value.
- * Params:
- * _index = Index into palette.
- * _rgba = Packed 32-bit RGBA value.
- */
- void bgfx_set_palette_color_rgba8(ubyte _index, uint _rgba);
-
- /**
- * Set view name.
- * Remarks:
- * This is debug only feature.
- * In graphics debugger view name will appear as:
- * "nnnc <view name>"
- * ^ ^ ^
- * | +--- compute (C)
- * +------ view id
- * Params:
- * _id = View id.
- * _name = View name.
- */
- void bgfx_set_view_name(bgfx_view_id_t _id, const(char)* _name);
-
- /**
- * Set view rectangle. Draw primitive outside view will be clipped.
- * Params:
- * _id = View id.
- * _x = Position x from the left corner of the window.
- * _y = Position y from the top corner of the window.
- * _width = Width of view port region.
- * _height = Height of view port region.
- */
- void bgfx_set_view_rect(bgfx_view_id_t _id, ushort _x, ushort _y, ushort _width, ushort _height);
-
- /**
- * Set view rectangle. Draw primitive outside view will be clipped.
- * Params:
- * _id = View id.
- * _x = Position x from the left corner of the window.
- * _y = Position y from the top corner of the window.
- * _ratio = Width and height will be set in respect to back-buffer size.
- * See: `BackbufferRatio::Enum`.
- */
- void bgfx_set_view_rect_ratio(bgfx_view_id_t _id, ushort _x, ushort _y, bgfx_backbuffer_ratio_t _ratio);
-
- /**
- * Set view scissor. Draw primitive outside view will be clipped. When
- * _x, _y, _width and _height are set to 0, scissor will be disabled.
- * Params:
- * _id = View id.
- * _x = Position x from the left corner of the window.
- * _y = Position y from the top corner of the window.
- * _width = Width of view scissor region.
- * _height = Height of view scissor region.
- */
- void bgfx_set_view_scissor(bgfx_view_id_t _id, ushort _x, ushort _y, ushort _width, ushort _height);
-
- /**
- * Set view clear flags.
- * Params:
- * _id = View id.
- * _flags = Clear flags. Use `BGFX_CLEAR_NONE` to remove any clear
- * operation. See: `BGFX_CLEAR_*`.
- * _rgba = Color clear value.
- * _depth = Depth clear value.
- * _stencil = Stencil clear value.
- */
- void bgfx_set_view_clear(bgfx_view_id_t _id, ushort _flags, uint _rgba, float _depth, ubyte _stencil);
-
- /**
- * Set view clear flags with different clear color for each
- * frame buffer texture. `bgfx::setPaletteColor` must be used to set up a
- * clear color palette.
- * Params:
- * _id = View id.
- * _flags = Clear flags. Use `BGFX_CLEAR_NONE` to remove any clear
- * operation. See: `BGFX_CLEAR_*`.
- * _depth = Depth clear value.
- * _stencil = Stencil clear value.
- * _c0 = Palette index for frame buffer attachment 0.
- * _c1 = Palette index for frame buffer attachment 1.
- * _c2 = Palette index for frame buffer attachment 2.
- * _c3 = Palette index for frame buffer attachment 3.
- * _c4 = Palette index for frame buffer attachment 4.
- * _c5 = Palette index for frame buffer attachment 5.
- * _c6 = Palette index for frame buffer attachment 6.
- * _c7 = Palette index for frame buffer attachment 7.
- */
- void bgfx_set_view_clear_mrt(bgfx_view_id_t _id, ushort _flags, float _depth, ubyte _stencil, ubyte _c0, ubyte _c1, ubyte _c2, ubyte _c3, ubyte _c4, ubyte _c5, ubyte _c6, ubyte _c7);
-
- /**
- * Set view sorting mode.
- * Remarks:
- * View mode must be set prior calling `bgfx::submit` for the view.
- * Params:
- * _id = View id.
- * _mode = View sort mode. See `ViewMode::Enum`.
- */
- void bgfx_set_view_mode(bgfx_view_id_t _id, bgfx_view_mode_t _mode);
-
- /**
- * Set view frame buffer.
- * Remarks:
- * Not persistent after `bgfx::reset` call.
- * Params:
- * _id = View id.
- * _handle = Frame buffer handle. Passing `BGFX_INVALID_HANDLE` as
- * frame buffer handle will draw primitives from this view into
- * default back buffer.
- */
- void bgfx_set_view_frame_buffer(bgfx_view_id_t _id, bgfx_frame_buffer_handle_t _handle);
-
- /**
- * Set view's view matrix and projection matrix,
- * all draw primitives in this view will use these two matrices.
- * Params:
- * _id = View id.
- * _view = View matrix.
- * _proj = Projection matrix.
- */
- void bgfx_set_view_transform(bgfx_view_id_t _id, const(void)* _view, const(void)* _proj);
-
- /**
- * Post submit view reordering.
- * Params:
- * _id = First view id.
- * _num = Number of views to remap.
- * _order = View remap id table. Passing `NULL` will reset view ids
- * to default state.
- */
- void bgfx_set_view_order(bgfx_view_id_t _id, ushort _num, const(bgfx_view_id_t)* _order);
-
- /**
- * Reset all view settings to default.
- */
- void bgfx_reset_view(bgfx_view_id_t _id);
-
- /**
- * Begin submitting draw calls from thread.
- * Params:
- * _forThread = Explicitly request an encoder for a worker thread.
- */
- bgfx_encoder_t* bgfx_encoder_begin(bool _forThread);
-
- /**
- * End submitting draw calls from thread.
- * Params:
- * _encoder = Encoder.
- */
- void bgfx_encoder_end(bgfx_encoder_t* _encoder);
-
- /**
- * Sets a debug marker. This allows you to group graphics calls together for easy browsing in
- * graphics debugging tools.
- * Params:
- * _marker = Marker string.
- */
- void bgfx_encoder_set_marker(bgfx_encoder_t* _this, const(char)* _marker);
-
- /**
- * Set render states for draw primitive.
- * Remarks:
- * 1. To set up more complex states use:
- * `BGFX_STATE_ALPHA_REF(_ref)`,
- * `BGFX_STATE_POINT_SIZE(_size)`,
- * `BGFX_STATE_BLEND_FUNC(_src, _dst)`,
- * `BGFX_STATE_BLEND_FUNC_SEPARATE(_srcRGB, _dstRGB, _srcA, _dstA)`,
- * `BGFX_STATE_BLEND_EQUATION(_equation)`,
- * `BGFX_STATE_BLEND_EQUATION_SEPARATE(_equationRGB, _equationA)`
- * 2. `BGFX_STATE_BLEND_EQUATION_ADD` is set when no other blend
- * equation is specified.
- * Params:
- * _state = State flags. Default state for primitive type is
- * triangles. See: `BGFX_STATE_DEFAULT`.
- * - `BGFX_STATE_DEPTH_TEST_*` - Depth test function.
- * - `BGFX_STATE_BLEND_*` - See remark 1 about BGFX_STATE_BLEND_FUNC.
- * - `BGFX_STATE_BLEND_EQUATION_*` - See remark 2.
- * - `BGFX_STATE_CULL_*` - Backface culling mode.
- * - `BGFX_STATE_WRITE_*` - Enable R, G, B, A or Z write.
- * - `BGFX_STATE_MSAA` - Enable hardware multisample antialiasing.
- * - `BGFX_STATE_PT_[TRISTRIP/LINES/POINTS]` - Primitive type.
- * _rgba = Sets blend factor used by `BGFX_STATE_BLEND_FACTOR` and
- * `BGFX_STATE_BLEND_INV_FACTOR` blend modes.
- */
- void bgfx_encoder_set_state(bgfx_encoder_t* _this, ulong _state, uint _rgba);
-
- /**
- * Set condition for rendering.
- * Params:
- * _handle = Occlusion query handle.
- * _visible = Render if occlusion query is visible.
- */
- void bgfx_encoder_set_condition(bgfx_encoder_t* _this, bgfx_occlusion_query_handle_t _handle, bool _visible);
-
- /**
- * Set stencil test state.
- * Params:
- * _fstencil = Front stencil state.
- * _bstencil = Back stencil state. If back is set to `BGFX_STENCIL_NONE`
- * _fstencil is applied to both front and back facing primitives.
- */
- void bgfx_encoder_set_stencil(bgfx_encoder_t* _this, uint _fstencil, uint _bstencil);
-
- /**
- * Set scissor for draw primitive.
- * Remarks:
- * To scissor for all primitives in view see `bgfx::setViewScissor`.
- * Params:
- * _x = Position x from the left corner of the window.
- * _y = Position y from the top corner of the window.
- * _width = Width of view scissor region.
- * _height = Height of view scissor region.
- */
- ushort bgfx_encoder_set_scissor(bgfx_encoder_t* _this, ushort _x, ushort _y, ushort _width, ushort _height);
-
- /**
- * Set scissor from cache for draw primitive.
- * Remarks:
- * To scissor for all primitives in view see `bgfx::setViewScissor`.
- * Params:
- * _cache = Index in scissor cache.
- */
- void bgfx_encoder_set_scissor_cached(bgfx_encoder_t* _this, ushort _cache);
-
- /**
- * Set model matrix for draw primitive. If it is not called,
- * the model will be rendered with an identity model matrix.
- * Params:
- * _mtx = Pointer to first matrix in array.
- * _num = Number of matrices in array.
- */
- uint bgfx_encoder_set_transform(bgfx_encoder_t* _this, const(void)* _mtx, ushort _num);
-
- /**
- * Set model matrix from matrix cache for draw primitive.
- * Params:
- * _cache = Index in matrix cache.
- * _num = Number of matrices from cache.
- */
- void bgfx_encoder_set_transform_cached(bgfx_encoder_t* _this, uint _cache, ushort _num);
-
- /**
- * Reserve matrices in internal matrix cache.
- * Attention: Pointer returned can be modified until `bgfx::frame` is called.
- * Params:
- * _transform = Pointer to `Transform` structure.
- * _num = Number of matrices.
- */
- uint bgfx_encoder_alloc_transform(bgfx_encoder_t* _this, bgfx_transform_t* _transform, ushort _num);
-
- /**
- * Set shader uniform parameter for draw primitive.
- * Params:
- * _handle = Uniform.
- * _value = Pointer to uniform data.
- * _num = Number of elements. Passing `UINT16_MAX` will
- * use the _num passed on uniform creation.
- */
- void bgfx_encoder_set_uniform(bgfx_encoder_t* _this, bgfx_uniform_handle_t _handle, const(void)* _value, ushort _num);
-
- /**
- * Set index buffer for draw primitive.
- * Params:
- * _handle = Index buffer.
- * _firstIndex = First index to render.
- * _numIndices = Number of indices to render.
- */
- void bgfx_encoder_set_index_buffer(bgfx_encoder_t* _this, bgfx_index_buffer_handle_t _handle, uint _firstIndex, uint _numIndices);
-
- /**
- * Set index buffer for draw primitive.
- * Params:
- * _handle = Dynamic index buffer.
- * _firstIndex = First index to render.
- * _numIndices = Number of indices to render.
- */
- void bgfx_encoder_set_dynamic_index_buffer(bgfx_encoder_t* _this, bgfx_dynamic_index_buffer_handle_t _handle, uint _firstIndex, uint _numIndices);
-
- /**
- * Set index buffer for draw primitive.
- * Params:
- * _tib = Transient index buffer.
- * _firstIndex = First index to render.
- * _numIndices = Number of indices to render.
- */
- void bgfx_encoder_set_transient_index_buffer(bgfx_encoder_t* _this, const(bgfx_transient_index_buffer_t)* _tib, uint _firstIndex, uint _numIndices);
-
- /**
- * Set vertex buffer for draw primitive.
- * Params:
- * _stream = Vertex stream.
- * _handle = Vertex buffer.
- * _startVertex = First vertex to render.
- * _numVertices = Number of vertices to render.
- */
- void bgfx_encoder_set_vertex_buffer(bgfx_encoder_t* _this, ubyte _stream, bgfx_vertex_buffer_handle_t _handle, uint _startVertex, uint _numVertices);
-
- /**
- * Set vertex buffer for draw primitive.
- * Params:
- * _stream = Vertex stream.
- * _handle = Vertex buffer.
- * _startVertex = First vertex to render.
- * _numVertices = Number of vertices to render.
- * _layoutHandle = Vertex layout for aliasing vertex buffer. If invalid
- * handle is used, vertex layout used for creation
- * of vertex buffer will be used.
- */
- void bgfx_encoder_set_vertex_buffer_with_layout(bgfx_encoder_t* _this, ubyte _stream, bgfx_vertex_buffer_handle_t _handle, uint _startVertex, uint _numVertices, bgfx_vertex_layout_handle_t _layoutHandle);
-
- /**
- * Set vertex buffer for draw primitive.
- * Params:
- * _stream = Vertex stream.
- * _handle = Dynamic vertex buffer.
- * _startVertex = First vertex to render.
- * _numVertices = Number of vertices to render.
- */
- void bgfx_encoder_set_dynamic_vertex_buffer(bgfx_encoder_t* _this, ubyte _stream, bgfx_dynamic_vertex_buffer_handle_t _handle, uint _startVertex, uint _numVertices);
-
- void bgfx_encoder_set_dynamic_vertex_buffer_with_layout(bgfx_encoder_t* _this, ubyte _stream, bgfx_dynamic_vertex_buffer_handle_t _handle, uint _startVertex, uint _numVertices, bgfx_vertex_layout_handle_t _layoutHandle);
-
- /**
- * Set vertex buffer for draw primitive.
- * Params:
- * _stream = Vertex stream.
- * _tvb = Transient vertex buffer.
- * _startVertex = First vertex to render.
- * _numVertices = Number of vertices to render.
- */
- void bgfx_encoder_set_transient_vertex_buffer(bgfx_encoder_t* _this, ubyte _stream, const(bgfx_transient_vertex_buffer_t)* _tvb, uint _startVertex, uint _numVertices);
-
- /**
- * Set vertex buffer for draw primitive.
- * Params:
- * _stream = Vertex stream.
- * _tvb = Transient vertex buffer.
- * _startVertex = First vertex to render.
- * _numVertices = Number of vertices to render.
- * _layoutHandle = Vertex layout for aliasing vertex buffer. If invalid
- * handle is used, vertex layout used for creation
- * of vertex buffer will be used.
- */
- void bgfx_encoder_set_transient_vertex_buffer_with_layout(bgfx_encoder_t* _this, ubyte _stream, const(bgfx_transient_vertex_buffer_t)* _tvb, uint _startVertex, uint _numVertices, bgfx_vertex_layout_handle_t _layoutHandle);
-
- /**
- * Set number of vertices for auto generated vertices use in conjunction
- * with gl_VertexID.
- * Attention: Availability depends on: `BGFX_CAPS_VERTEX_ID`.
- * Params:
- * _numVertices = Number of vertices.
- */
- void bgfx_encoder_set_vertex_count(bgfx_encoder_t* _this, uint _numVertices);
-
- /**
- * Set instance data buffer for draw primitive.
- * Params:
- * _idb = Transient instance data buffer.
- * _start = First instance data.
- * _num = Number of data instances.
- */
- void bgfx_encoder_set_instance_data_buffer(bgfx_encoder_t* _this, const(bgfx_instance_data_buffer_t)* _idb, uint _start, uint _num);
-
- /**
- * Set instance data buffer for draw primitive.
- * Params:
- * _handle = Vertex buffer.
- * _startVertex = First instance data.
- * _num = Number of data instances.
- * Set instance data buffer for draw primitive.
- */
- void bgfx_encoder_set_instance_data_from_vertex_buffer(bgfx_encoder_t* _this, bgfx_vertex_buffer_handle_t _handle, uint _startVertex, uint _num);
-
- /**
- * Set instance data buffer for draw primitive.
- * Params:
- * _handle = Dynamic vertex buffer.
- * _startVertex = First instance data.
- * _num = Number of data instances.
- */
- void bgfx_encoder_set_instance_data_from_dynamic_vertex_buffer(bgfx_encoder_t* _this, bgfx_dynamic_vertex_buffer_handle_t _handle, uint _startVertex, uint _num);
-
- /**
- * Set number of instances for auto generated instances use in conjunction
- * with gl_InstanceID.
- * Attention: Availability depends on: `BGFX_CAPS_VERTEX_ID`.
- */
- void bgfx_encoder_set_instance_count(bgfx_encoder_t* _this, uint _numInstances);
-
- /**
- * Set texture stage for draw primitive.
- * Params:
- * _stage = Texture unit.
- * _sampler = Program sampler.
- * _handle = Texture handle.
- * _flags = Texture sampling mode. Default value UINT32_MAX uses
- * texture sampling settings from the texture.
- * - `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.
- */
- void bgfx_encoder_set_texture(bgfx_encoder_t* _this, ubyte _stage, bgfx_uniform_handle_t _sampler, bgfx_texture_handle_t _handle, uint _flags);
-
- /**
- * Submit an empty primitive for rendering. Uniforms and draw state
- * will be applied but no geometry will be submitted. Useful in cases
- * when no other draw/compute primitive is submitted to view, but it's
- * desired to execute clear view.
- * Remarks:
- * These empty draw calls will sort before ordinary draw calls.
- * Params:
- * _id = View id.
- */
- void bgfx_encoder_touch(bgfx_encoder_t* _this, bgfx_view_id_t _id);
-
- /**
- * Submit primitive for rendering.
- * Params:
- * _id = View id.
- * _program = Program.
- * _depth = Depth for sorting.
- * _flags = Discard or preserve states. See `BGFX_DISCARD_*`.
- */
- void bgfx_encoder_submit(bgfx_encoder_t* _this, bgfx_view_id_t _id, bgfx_program_handle_t _program, uint _depth, ubyte _flags);
-
- /**
- * Submit primitive with occlusion query for rendering.
- * Params:
- * _id = View id.
- * _program = Program.
- * _occlusionQuery = Occlusion query.
- * _depth = Depth for sorting.
- * _flags = Discard or preserve states. See `BGFX_DISCARD_*`.
- */
- void bgfx_encoder_submit_occlusion_query(bgfx_encoder_t* _this, bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_occlusion_query_handle_t _occlusionQuery, uint _depth, ubyte _flags);
-
- /**
- * Submit primitive for rendering with index and instance data info from
- * indirect buffer.
- * Attention: Availability depends on: `BGFX_CAPS_DRAW_INDIRECT`.
- * Params:
- * _id = View id.
- * _program = Program.
- * _indirectHandle = Indirect buffer.
- * _start = First element in indirect buffer.
- * _num = Number of draws.
- * _depth = Depth for sorting.
- * _flags = Discard or preserve states. See `BGFX_DISCARD_*`.
- */
- void bgfx_encoder_submit_indirect(bgfx_encoder_t* _this, bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_indirect_buffer_handle_t _indirectHandle, ushort _start, ushort _num, uint _depth, ubyte _flags);
-
- /**
- * Submit primitive for rendering with index and instance data info and
- * draw count from indirect buffers.
- * Attention: Availability depends on: `BGFX_CAPS_DRAW_INDIRECT_COUNT`.
- * Params:
- * _id = View id.
- * _program = Program.
- * _indirectHandle = Indirect buffer.
- * _start = First element in indirect buffer.
- * _numHandle = Buffer for number of draws. Must be
- * created with `BGFX_BUFFER_INDEX32` and `BGFX_BUFFER_DRAW_INDIRECT`.
- * _numIndex = Element in number buffer.
- * _numMax = Max number of draws.
- * _depth = Depth for sorting.
- * _flags = Discard or preserve states. See `BGFX_DISCARD_*`.
- */
- void bgfx_encoder_submit_indirect_count(bgfx_encoder_t* _this, bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_indirect_buffer_handle_t _indirectHandle, ushort _start, bgfx_index_buffer_handle_t _numHandle, uint _numIndex, ushort _numMax, uint _depth, ubyte _flags);
-
- /**
- * Set compute index buffer.
- * Params:
- * _stage = Compute stage.
- * _handle = Index buffer handle.
- * _access = Buffer access. See `Access::Enum`.
- */
- void bgfx_encoder_set_compute_index_buffer(bgfx_encoder_t* _this, ubyte _stage, bgfx_index_buffer_handle_t _handle, bgfx_access_t _access);
-
- /**
- * Set compute vertex buffer.
- * Params:
- * _stage = Compute stage.
- * _handle = Vertex buffer handle.
- * _access = Buffer access. See `Access::Enum`.
- */
- void bgfx_encoder_set_compute_vertex_buffer(bgfx_encoder_t* _this, ubyte _stage, bgfx_vertex_buffer_handle_t _handle, bgfx_access_t _access);
-
- /**
- * Set compute dynamic index buffer.
- * Params:
- * _stage = Compute stage.
- * _handle = Dynamic index buffer handle.
- * _access = Buffer access. See `Access::Enum`.
- */
- void bgfx_encoder_set_compute_dynamic_index_buffer(bgfx_encoder_t* _this, ubyte _stage, bgfx_dynamic_index_buffer_handle_t _handle, bgfx_access_t _access);
-
- /**
- * Set compute dynamic vertex buffer.
- * Params:
- * _stage = Compute stage.
- * _handle = Dynamic vertex buffer handle.
- * _access = Buffer access. See `Access::Enum`.
- */
- void bgfx_encoder_set_compute_dynamic_vertex_buffer(bgfx_encoder_t* _this, ubyte _stage, bgfx_dynamic_vertex_buffer_handle_t _handle, bgfx_access_t _access);
-
- /**
- * Set compute indirect buffer.
- * Params:
- * _stage = Compute stage.
- * _handle = Indirect buffer handle.
- * _access = Buffer access. See `Access::Enum`.
- */
- void bgfx_encoder_set_compute_indirect_buffer(bgfx_encoder_t* _this, ubyte _stage, bgfx_indirect_buffer_handle_t _handle, bgfx_access_t _access);
-
- /**
- * Set compute image from texture.
- * Params:
- * _stage = Compute stage.
- * _handle = Texture handle.
- * _mip = Mip level.
- * _access = Image access. See `Access::Enum`.
- * _format = Texture format. See: `TextureFormat::Enum`.
- */
- void bgfx_encoder_set_image(bgfx_encoder_t* _this, ubyte _stage, bgfx_texture_handle_t _handle, ubyte _mip, bgfx_access_t _access, bgfx_texture_format_t _format);
-
- /**
- * Dispatch compute.
- * Params:
- * _id = View id.
- * _program = Compute program.
- * _numX = Number of groups X.
- * _numY = Number of groups Y.
- * _numZ = Number of groups Z.
- * _flags = Discard or preserve states. See `BGFX_DISCARD_*`.
- */
- void bgfx_encoder_dispatch(bgfx_encoder_t* _this, bgfx_view_id_t _id, bgfx_program_handle_t _program, uint _numX, uint _numY, uint _numZ, ubyte _flags);
-
- /**
- * Dispatch compute indirect.
- * Params:
- * _id = View id.
- * _program = Compute program.
- * _indirectHandle = Indirect buffer.
- * _start = First element in indirect buffer.
- * _num = Number of dispatches.
- * _flags = Discard or preserve states. See `BGFX_DISCARD_*`.
- */
- void bgfx_encoder_dispatch_indirect(bgfx_encoder_t* _this, bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_indirect_buffer_handle_t _indirectHandle, ushort _start, ushort _num, ubyte _flags);
-
- /**
- * Discard previously set state for draw or compute call.
- * Params:
- * _flags = Discard or preserve states. See `BGFX_DISCARD_*`.
- */
- void bgfx_encoder_discard(bgfx_encoder_t* _this, ubyte _flags);
-
- /**
- * Blit 2D texture region between two 2D textures.
- * Attention: Destination texture must be created with `BGFX_TEXTURE_BLIT_DST` flag.
- * Attention: Availability depends on: `BGFX_CAPS_TEXTURE_BLIT`.
- * Params:
- * _id = View id.
- * _dst = Destination texture handle.
- * _dstMip = Destination texture mip level.
- * _dstX = Destination texture X position.
- * _dstY = Destination texture Y position.
- * _dstZ = If texture is 2D this argument should be 0. If destination texture is cube
- * this argument represents destination texture cube face. For 3D texture this argument
- * represents destination texture Z position.
- * _src = Source texture handle.
- * _srcMip = Source texture mip level.
- * _srcX = Source texture X position.
- * _srcY = Source texture Y position.
- * _srcZ = If texture is 2D this argument should be 0. If source texture is cube
- * this argument represents source texture cube face. For 3D texture this argument
- * represents source texture Z position.
- * _width = Width of region.
- * _height = Height of region.
- * _depth = If texture is 3D this argument represents depth of region, otherwise it's
- * unused.
- */
- void bgfx_encoder_blit(bgfx_encoder_t* _this, bgfx_view_id_t _id, bgfx_texture_handle_t _dst, ubyte _dstMip, ushort _dstX, ushort _dstY, ushort _dstZ, bgfx_texture_handle_t _src, ubyte _srcMip, ushort _srcX, ushort _srcY, ushort _srcZ, ushort _width, ushort _height, ushort _depth);
-
- /**
- * Request screen shot of window back buffer.
- * Remarks:
- * `bgfx::CallbackI::screenShot` must be implemented.
- * Attention: Frame buffer handle must be created with OS' target native window handle.
- * Params:
- * _handle = Frame buffer handle. If handle is `BGFX_INVALID_HANDLE` request will be
- * made for main window back buffer.
- * _filePath = Will be passed to `bgfx::CallbackI::screenShot` callback.
- */
- void bgfx_request_screen_shot(bgfx_frame_buffer_handle_t _handle, const(char)* _filePath);
-
- /**
- * Render frame.
- * Attention: `bgfx::renderFrame` is blocking call. It waits for
- * `bgfx::frame` to be called from API thread to process frame.
- * If timeout value is passed call will timeout and return even
- * if `bgfx::frame` is not called.
- * Warning: This call should be only used on platforms that don't
- * allow creating separate rendering thread. If it is called before
- * to bgfx::init, render thread won't be created by bgfx::init call.
- * Params:
- * _msecs = Timeout in milliseconds.
- */
- bgfx_render_frame_t bgfx_render_frame(int _msecs);
-
- /**
- * Set platform data.
- * Warning: Must be called before `bgfx::init`.
- * Params:
- * _data = Platform data.
- */
- void bgfx_set_platform_data(const(bgfx_platform_data_t)* _data);
-
- /**
- * Get internal data for interop.
- * Attention: It's expected you understand some bgfx internals before you
- * use this call.
- * Warning: Must be called only on render thread.
- */
- const(bgfx_internal_data_t)* bgfx_get_internal_data();
-
- /**
- * Override internal texture with externally created texture. Previously
- * created internal texture will released.
- * Attention: It's expected you understand some bgfx internals before you
- * use this call.
- * Warning: Must be called only on render thread.
- * Params:
- * _handle = Texture handle.
- * _ptr = Native API pointer to texture.
- */
- ulong bgfx_override_internal_texture_ptr(bgfx_texture_handle_t _handle, ulong _ptr);
-
- /**
- * Override internal texture by creating new texture. Previously created
- * internal texture will released.
- * Attention: It's expected you understand some bgfx internals before you
- * use this call.
- * Returns: Native API pointer to texture. If result is 0, texture is not created yet from the
- * main thread.
- * Warning: Must be called only on render thread.
- * Params:
- * _handle = Texture handle.
- * _width = Width.
- * _height = Height.
- * _numMips = Number of mip-maps.
- * _format = Texture format. See: `TextureFormat::Enum`.
- * _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.
- */
- ulong bgfx_override_internal_texture(bgfx_texture_handle_t _handle, ushort _width, ushort _height, ubyte _numMips, bgfx_texture_format_t _format, ulong _flags);
-
- /**
- * Sets a debug marker. This allows you to group graphics calls together for easy browsing in
- * graphics debugging tools.
- * Params:
- * _marker = Marker string.
- */
- void bgfx_set_marker(const(char)* _marker);
-
- /**
- * Set render states for draw primitive.
- * Remarks:
- * 1. To set up more complex states use:
- * `BGFX_STATE_ALPHA_REF(_ref)`,
- * `BGFX_STATE_POINT_SIZE(_size)`,
- * `BGFX_STATE_BLEND_FUNC(_src, _dst)`,
- * `BGFX_STATE_BLEND_FUNC_SEPARATE(_srcRGB, _dstRGB, _srcA, _dstA)`,
- * `BGFX_STATE_BLEND_EQUATION(_equation)`,
- * `BGFX_STATE_BLEND_EQUATION_SEPARATE(_equationRGB, _equationA)`
- * 2. `BGFX_STATE_BLEND_EQUATION_ADD` is set when no other blend
- * equation is specified.
- * Params:
- * _state = State flags. Default state for primitive type is
- * triangles. See: `BGFX_STATE_DEFAULT`.
- * - `BGFX_STATE_DEPTH_TEST_*` - Depth test function.
- * - `BGFX_STATE_BLEND_*` - See remark 1 about BGFX_STATE_BLEND_FUNC.
- * - `BGFX_STATE_BLEND_EQUATION_*` - See remark 2.
- * - `BGFX_STATE_CULL_*` - Backface culling mode.
- * - `BGFX_STATE_WRITE_*` - Enable R, G, B, A or Z write.
- * - `BGFX_STATE_MSAA` - Enable hardware multisample antialiasing.
- * - `BGFX_STATE_PT_[TRISTRIP/LINES/POINTS]` - Primitive type.
- * _rgba = Sets blend factor used by `BGFX_STATE_BLEND_FACTOR` and
- * `BGFX_STATE_BLEND_INV_FACTOR` blend modes.
- */
- void bgfx_set_state(ulong _state, uint _rgba);
-
- /**
- * Set condition for rendering.
- * Params:
- * _handle = Occlusion query handle.
- * _visible = Render if occlusion query is visible.
- */
- void bgfx_set_condition(bgfx_occlusion_query_handle_t _handle, bool _visible);
-
- /**
- * Set stencil test state.
- * Params:
- * _fstencil = Front stencil state.
- * _bstencil = Back stencil state. If back is set to `BGFX_STENCIL_NONE`
- * _fstencil is applied to both front and back facing primitives.
- */
- void bgfx_set_stencil(uint _fstencil, uint _bstencil);
-
- /**
- * Set scissor for draw primitive.
- * Remarks:
- * To scissor for all primitives in view see `bgfx::setViewScissor`.
- * Params:
- * _x = Position x from the left corner of the window.
- * _y = Position y from the top corner of the window.
- * _width = Width of view scissor region.
- * _height = Height of view scissor region.
- */
- ushort bgfx_set_scissor(ushort _x, ushort _y, ushort _width, ushort _height);
-
- /**
- * Set scissor from cache for draw primitive.
- * Remarks:
- * To scissor for all primitives in view see `bgfx::setViewScissor`.
- * Params:
- * _cache = Index in scissor cache.
- */
- void bgfx_set_scissor_cached(ushort _cache);
-
- /**
- * Set model matrix for draw primitive. If it is not called,
- * the model will be rendered with an identity model matrix.
- * Params:
- * _mtx = Pointer to first matrix in array.
- * _num = Number of matrices in array.
- */
- uint bgfx_set_transform(const(void)* _mtx, ushort _num);
-
- /**
- * Set model matrix from matrix cache for draw primitive.
- * Params:
- * _cache = Index in matrix cache.
- * _num = Number of matrices from cache.
- */
- void bgfx_set_transform_cached(uint _cache, ushort _num);
-
- /**
- * Reserve matrices in internal matrix cache.
- * Attention: Pointer returned can be modified until `bgfx::frame` is called.
- * Params:
- * _transform = Pointer to `Transform` structure.
- * _num = Number of matrices.
- */
- uint bgfx_alloc_transform(bgfx_transform_t* _transform, ushort _num);
-
- /**
- * Set shader uniform parameter for draw primitive.
- * Params:
- * _handle = Uniform.
- * _value = Pointer to uniform data.
- * _num = Number of elements. Passing `UINT16_MAX` will
- * use the _num passed on uniform creation.
- */
- void bgfx_set_uniform(bgfx_uniform_handle_t _handle, const(void)* _value, ushort _num);
-
- /**
- * Set index buffer for draw primitive.
- * Params:
- * _handle = Index buffer.
- * _firstIndex = First index to render.
- * _numIndices = Number of indices to render.
- */
- void bgfx_set_index_buffer(bgfx_index_buffer_handle_t _handle, uint _firstIndex, uint _numIndices);
-
- /**
- * Set index buffer for draw primitive.
- * Params:
- * _handle = Dynamic index buffer.
- * _firstIndex = First index to render.
- * _numIndices = Number of indices to render.
- */
- void bgfx_set_dynamic_index_buffer(bgfx_dynamic_index_buffer_handle_t _handle, uint _firstIndex, uint _numIndices);
-
- /**
- * Set index buffer for draw primitive.
- * Params:
- * _tib = Transient index buffer.
- * _firstIndex = First index to render.
- * _numIndices = Number of indices to render.
- */
- void bgfx_set_transient_index_buffer(const(bgfx_transient_index_buffer_t)* _tib, uint _firstIndex, uint _numIndices);
-
- /**
- * Set vertex buffer for draw primitive.
- * Params:
- * _stream = Vertex stream.
- * _handle = Vertex buffer.
- * _startVertex = First vertex to render.
- * _numVertices = Number of vertices to render.
- */
- void bgfx_set_vertex_buffer(ubyte _stream, bgfx_vertex_buffer_handle_t _handle, uint _startVertex, uint _numVertices);
-
- /**
- * Set vertex buffer for draw primitive.
- * Params:
- * _stream = Vertex stream.
- * _handle = Vertex buffer.
- * _startVertex = First vertex to render.
- * _numVertices = Number of vertices to render.
- * _layoutHandle = Vertex layout for aliasing vertex buffer. If invalid
- * handle is used, vertex layout used for creation
- * of vertex buffer will be used.
- */
- void bgfx_set_vertex_buffer_with_layout(ubyte _stream, bgfx_vertex_buffer_handle_t _handle, uint _startVertex, uint _numVertices, bgfx_vertex_layout_handle_t _layoutHandle);
-
- /**
- * Set vertex buffer for draw primitive.
- * Params:
- * _stream = Vertex stream.
- * _handle = Dynamic vertex buffer.
- * _startVertex = First vertex to render.
- * _numVertices = Number of vertices to render.
- */
- void bgfx_set_dynamic_vertex_buffer(ubyte _stream, bgfx_dynamic_vertex_buffer_handle_t _handle, uint _startVertex, uint _numVertices);
-
- /**
- * Set vertex buffer for draw primitive.
- * Params:
- * _stream = Vertex stream.
- * _handle = Dynamic vertex buffer.
- * _startVertex = First vertex to render.
- * _numVertices = Number of vertices to render.
- * _layoutHandle = Vertex layout for aliasing vertex buffer. If invalid
- * handle is used, vertex layout used for creation
- * of vertex buffer will be used.
- */
- void bgfx_set_dynamic_vertex_buffer_with_layout(ubyte _stream, bgfx_dynamic_vertex_buffer_handle_t _handle, uint _startVertex, uint _numVertices, bgfx_vertex_layout_handle_t _layoutHandle);
-
- /**
- * Set vertex buffer for draw primitive.
- * Params:
- * _stream = Vertex stream.
- * _tvb = Transient vertex buffer.
- * _startVertex = First vertex to render.
- * _numVertices = Number of vertices to render.
- */
- void bgfx_set_transient_vertex_buffer(ubyte _stream, const(bgfx_transient_vertex_buffer_t)* _tvb, uint _startVertex, uint _numVertices);
-
- /**
- * Set vertex buffer for draw primitive.
- * Params:
- * _stream = Vertex stream.
- * _tvb = Transient vertex buffer.
- * _startVertex = First vertex to render.
- * _numVertices = Number of vertices to render.
- * _layoutHandle = Vertex layout for aliasing vertex buffer. If invalid
- * handle is used, vertex layout used for creation
- * of vertex buffer will be used.
- */
- void bgfx_set_transient_vertex_buffer_with_layout(ubyte _stream, const(bgfx_transient_vertex_buffer_t)* _tvb, uint _startVertex, uint _numVertices, bgfx_vertex_layout_handle_t _layoutHandle);
-
- /**
- * Set number of vertices for auto generated vertices use in conjunction
- * with gl_VertexID.
- * Attention: Availability depends on: `BGFX_CAPS_VERTEX_ID`.
- * Params:
- * _numVertices = Number of vertices.
- */
- void bgfx_set_vertex_count(uint _numVertices);
-
- /**
- * Set instance data buffer for draw primitive.
- * Params:
- * _idb = Transient instance data buffer.
- * _start = First instance data.
- * _num = Number of data instances.
- */
- void bgfx_set_instance_data_buffer(const(bgfx_instance_data_buffer_t)* _idb, uint _start, uint _num);
-
- /**
- * Set instance data buffer for draw primitive.
- * Params:
- * _handle = Vertex buffer.
- * _startVertex = First instance data.
- * _num = Number of data instances.
- * Set instance data buffer for draw primitive.
- */
- void bgfx_set_instance_data_from_vertex_buffer(bgfx_vertex_buffer_handle_t _handle, uint _startVertex, uint _num);
-
- /**
- * Set instance data buffer for draw primitive.
- * Params:
- * _handle = Dynamic vertex buffer.
- * _startVertex = First instance data.
- * _num = Number of data instances.
- */
- void bgfx_set_instance_data_from_dynamic_vertex_buffer(bgfx_dynamic_vertex_buffer_handle_t _handle, uint _startVertex, uint _num);
-
- /**
- * Set number of instances for auto generated instances use in conjunction
- * with gl_InstanceID.
- * Attention: Availability depends on: `BGFX_CAPS_VERTEX_ID`.
- */
- void bgfx_set_instance_count(uint _numInstances);
-
- /**
- * Set texture stage for draw primitive.
- * Params:
- * _stage = Texture unit.
- * _sampler = Program sampler.
- * _handle = Texture handle.
- * _flags = Texture sampling mode. Default value UINT32_MAX uses
- * texture sampling settings from the texture.
- * - `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.
- */
- void bgfx_set_texture(ubyte _stage, bgfx_uniform_handle_t _sampler, bgfx_texture_handle_t _handle, uint _flags);
-
- /**
- * Submit an empty primitive for rendering. Uniforms and draw state
- * will be applied but no geometry will be submitted.
- * Remarks:
- * These empty draw calls will sort before ordinary draw calls.
- * Params:
- * _id = View id.
- */
- void bgfx_touch(bgfx_view_id_t _id);
-
- /**
- * Submit primitive for rendering.
- * Params:
- * _id = View id.
- * _program = Program.
- * _depth = Depth for sorting.
- * _flags = Which states to discard for next draw. See `BGFX_DISCARD_*`.
- */
- void bgfx_submit(bgfx_view_id_t _id, bgfx_program_handle_t _program, uint _depth, ubyte _flags);
-
- /**
- * Submit primitive with occlusion query for rendering.
- * Params:
- * _id = View id.
- * _program = Program.
- * _occlusionQuery = Occlusion query.
- * _depth = Depth for sorting.
- * _flags = Which states to discard for next draw. See `BGFX_DISCARD_*`.
- */
- void bgfx_submit_occlusion_query(bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_occlusion_query_handle_t _occlusionQuery, uint _depth, ubyte _flags);
-
- /**
- * Submit primitive for rendering with index and instance data info from
- * indirect buffer.
- * Attention: Availability depends on: `BGFX_CAPS_DRAW_INDIRECT`.
- * Params:
- * _id = View id.
- * _program = Program.
- * _indirectHandle = Indirect buffer.
- * _start = First element in indirect buffer.
- * _num = Number of draws.
- * _depth = Depth for sorting.
- * _flags = Which states to discard for next draw. See `BGFX_DISCARD_*`.
- */
- void bgfx_submit_indirect(bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_indirect_buffer_handle_t _indirectHandle, ushort _start, ushort _num, uint _depth, ubyte _flags);
-
- /**
- * Submit primitive for rendering with index and instance data info and
- * draw count from indirect buffers.
- * Attention: Availability depends on: `BGFX_CAPS_DRAW_INDIRECT_COUNT`.
- * Params:
- * _id = View id.
- * _program = Program.
- * _indirectHandle = Indirect buffer.
- * _start = First element in indirect buffer.
- * _numHandle = Buffer for number of draws. Must be
- * created with `BGFX_BUFFER_INDEX32` and `BGFX_BUFFER_DRAW_INDIRECT`.
- * _numIndex = Element in number buffer.
- * _numMax = Max number of draws.
- * _depth = Depth for sorting.
- * _flags = Which states to discard for next draw. See `BGFX_DISCARD_*`.
- */
- void bgfx_submit_indirect_count(bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_indirect_buffer_handle_t _indirectHandle, ushort _start, bgfx_index_buffer_handle_t _numHandle, uint _numIndex, ushort _numMax, uint _depth, ubyte _flags);
-
- /**
- * Set compute index buffer.
- * Params:
- * _stage = Compute stage.
- * _handle = Index buffer handle.
- * _access = Buffer access. See `Access::Enum`.
- */
- void bgfx_set_compute_index_buffer(ubyte _stage, bgfx_index_buffer_handle_t _handle, bgfx_access_t _access);
-
- /**
- * Set compute vertex buffer.
- * Params:
- * _stage = Compute stage.
- * _handle = Vertex buffer handle.
- * _access = Buffer access. See `Access::Enum`.
- */
- void bgfx_set_compute_vertex_buffer(ubyte _stage, bgfx_vertex_buffer_handle_t _handle, bgfx_access_t _access);
-
- /**
- * Set compute dynamic index buffer.
- * Params:
- * _stage = Compute stage.
- * _handle = Dynamic index buffer handle.
- * _access = Buffer access. See `Access::Enum`.
- */
- void bgfx_set_compute_dynamic_index_buffer(ubyte _stage, bgfx_dynamic_index_buffer_handle_t _handle, bgfx_access_t _access);
-
- /**
- * Set compute dynamic vertex buffer.
- * Params:
- * _stage = Compute stage.
- * _handle = Dynamic vertex buffer handle.
- * _access = Buffer access. See `Access::Enum`.
- */
- void bgfx_set_compute_dynamic_vertex_buffer(ubyte _stage, bgfx_dynamic_vertex_buffer_handle_t _handle, bgfx_access_t _access);
-
- /**
- * Set compute indirect buffer.
- * Params:
- * _stage = Compute stage.
- * _handle = Indirect buffer handle.
- * _access = Buffer access. See `Access::Enum`.
- */
- void bgfx_set_compute_indirect_buffer(ubyte _stage, bgfx_indirect_buffer_handle_t _handle, bgfx_access_t _access);
-
- /**
- * Set compute image from texture.
- * Params:
- * _stage = Compute stage.
- * _handle = Texture handle.
- * _mip = Mip level.
- * _access = Image access. See `Access::Enum`.
- * _format = Texture format. See: `TextureFormat::Enum`.
- */
- void bgfx_set_image(ubyte _stage, bgfx_texture_handle_t _handle, ubyte _mip, bgfx_access_t _access, bgfx_texture_format_t _format);
-
- /**
- * Dispatch compute.
- * Params:
- * _id = View id.
- * _program = Compute program.
- * _numX = Number of groups X.
- * _numY = Number of groups Y.
- * _numZ = Number of groups Z.
- * _flags = Discard or preserve states. See `BGFX_DISCARD_*`.
- */
- void bgfx_dispatch(bgfx_view_id_t _id, bgfx_program_handle_t _program, uint _numX, uint _numY, uint _numZ, ubyte _flags);
-
- /**
- * Dispatch compute indirect.
- * Params:
- * _id = View id.
- * _program = Compute program.
- * _indirectHandle = Indirect buffer.
- * _start = First element in indirect buffer.
- * _num = Number of dispatches.
- * _flags = Discard or preserve states. See `BGFX_DISCARD_*`.
- */
- void bgfx_dispatch_indirect(bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_indirect_buffer_handle_t _indirectHandle, ushort _start, ushort _num, ubyte _flags);
-
- /**
- * Discard previously set state for draw or compute call.
- * Params:
- * _flags = Draw/compute states to discard.
- */
- void bgfx_discard(ubyte _flags);
-
- /**
- * Blit 2D texture region between two 2D textures.
- * Attention: Destination texture must be created with `BGFX_TEXTURE_BLIT_DST` flag.
- * Attention: Availability depends on: `BGFX_CAPS_TEXTURE_BLIT`.
- * Params:
- * _id = View id.
- * _dst = Destination texture handle.
- * _dstMip = Destination texture mip level.
- * _dstX = Destination texture X position.
- * _dstY = Destination texture Y position.
- * _dstZ = If texture is 2D this argument should be 0. If destination texture is cube
- * this argument represents destination texture cube face. For 3D texture this argument
- * represents destination texture Z position.
- * _src = Source texture handle.
- * _srcMip = Source texture mip level.
- * _srcX = Source texture X position.
- * _srcY = Source texture Y position.
- * _srcZ = If texture is 2D this argument should be 0. If source texture is cube
- * this argument represents source texture cube face. For 3D texture this argument
- * represents source texture Z position.
- * _width = Width of region.
- * _height = Height of region.
- * _depth = If texture is 3D this argument represents depth of region, otherwise it's
- * unused.
- */
- void bgfx_blit(bgfx_view_id_t _id, bgfx_texture_handle_t _dst, ubyte _dstMip, ushort _dstX, ushort _dstY, ushort _dstZ, bgfx_texture_handle_t _src, ubyte _srcMip, ushort _srcX, ushort _srcY, ushort _srcZ, ushort _width, ushort _height, ushort _depth);
-
-}
-else
-{
- __gshared
- {
- /**
- * Init attachment.
- * Params:
- * _handle = Render target texture handle.
- * _access = Access. See `Access::Enum`.
- * _layer = Cubemap side or depth layer/slice to use.
- * _numLayers = Number of texture layer/slice(s) in array to use.
- * _mip = Mip level.
- * _resolve = Resolve flags. See: `BGFX_RESOLVE_*`
- */
- alias da_bgfx_attachment_init = void function(bgfx_attachment_t* _this, bgfx_texture_handle_t _handle, bgfx_access_t _access, ushort _layer, ushort _numLayers, ushort _mip, ubyte _resolve);
- da_bgfx_attachment_init bgfx_attachment_init;
-
- /**
- * Start VertexLayout.
- * Params:
- * _rendererType = Renderer backend type. See: `bgfx::RendererType`
- */
- alias da_bgfx_vertex_layout_begin = bgfx_vertex_layout_t* function(bgfx_vertex_layout_t* _this, bgfx_renderer_type_t _rendererType);
- da_bgfx_vertex_layout_begin bgfx_vertex_layout_begin;
-
- /**
- * Add attribute to VertexLayout.
- * Remarks: Must be called between begin/end.
- * Params:
- * _attrib = Attribute semantics. See: `bgfx::Attrib`
- * _num = Number of elements 1, 2, 3 or 4.
- * _type = Element type.
- * _normalized = When using fixed point AttribType (f.e. Uint8)
- * value will be normalized for vertex shader usage. When normalized
- * is set to true, AttribType::Uint8 value in range 0-255 will be
- * in range 0.0-1.0 in vertex shader.
- * _asInt = Packaging rule for vertexPack, vertexUnpack, and
- * vertexConvert for AttribType::Uint8 and AttribType::Int16.
- * Unpacking code must be implemented inside vertex shader.
- */
- alias da_bgfx_vertex_layout_add = bgfx_vertex_layout_t* function(bgfx_vertex_layout_t* _this, bgfx_attrib_t _attrib, ubyte _num, bgfx_attrib_type_t _type, bool _normalized, bool _asInt);
- da_bgfx_vertex_layout_add bgfx_vertex_layout_add;
-
- /**
- * Decode attribute.
- * Params:
- * _attrib = Attribute semantics. See: `bgfx::Attrib`
- * _num = Number of elements.
- * _type = Element type.
- * _normalized = Attribute is normalized.
- * _asInt = Attribute is packed as int.
- */
- alias da_bgfx_vertex_layout_decode = void function(const(bgfx_vertex_layout_t)* _this, bgfx_attrib_t _attrib, ubyte* _num, bgfx_attrib_type_t* _type, bool* _normalized, bool* _asInt);
- da_bgfx_vertex_layout_decode bgfx_vertex_layout_decode;
-
- /**
- * Returns `true` if VertexLayout contains attribute.
- * Params:
- * _attrib = Attribute semantics. See: `bgfx::Attrib`
- */
- alias da_bgfx_vertex_layout_has = bool function(const(bgfx_vertex_layout_t)* _this, bgfx_attrib_t _attrib);
- da_bgfx_vertex_layout_has bgfx_vertex_layout_has;
-
- /**
- * Skip `_num` bytes in vertex stream.
- * Params:
- * _num = Number of bytes to skip.
- */
- alias da_bgfx_vertex_layout_skip = bgfx_vertex_layout_t* function(bgfx_vertex_layout_t* _this, ubyte _num);
- da_bgfx_vertex_layout_skip bgfx_vertex_layout_skip;
-
- /**
- * End VertexLayout.
- */
- alias da_bgfx_vertex_layout_end = void function(bgfx_vertex_layout_t* _this);
- da_bgfx_vertex_layout_end bgfx_vertex_layout_end;
-
- /**
- * Pack vertex attribute into vertex stream format.
- * Params:
- * _input = Value to be packed into vertex stream.
- * _inputNormalized = `true` if input value is already normalized.
- * _attr = Attribute to pack.
- * _layout = Vertex stream layout.
- * _data = Destination vertex stream where data will be packed.
- * _index = Vertex index that will be modified.
- */
- alias da_bgfx_vertex_pack = void function(const float[4] _input, bool _inputNormalized, bgfx_attrib_t _attr, const(bgfx_vertex_layout_t)* _layout, void* _data, uint _index);
- da_bgfx_vertex_pack bgfx_vertex_pack;
-
- /**
- * Unpack vertex attribute from vertex stream format.
- * Params:
- * _output = Result of unpacking.
- * _attr = Attribute to unpack.
- * _layout = Vertex stream layout.
- * _data = Source vertex stream from where data will be unpacked.
- * _index = Vertex index that will be unpacked.
- */
- alias da_bgfx_vertex_unpack = void function(float[4] _output, bgfx_attrib_t _attr, const(bgfx_vertex_layout_t)* _layout, const(void)* _data, uint _index);
- da_bgfx_vertex_unpack bgfx_vertex_unpack;
-
- /**
- * Converts vertex stream data from one vertex stream format to another.
- * Params:
- * _dstLayout = Destination vertex stream layout.
- * _dstData = Destination vertex stream.
- * _srcLayout = Source vertex stream layout.
- * _srcData = Source vertex stream data.
- * _num = Number of vertices to convert from source to destination.
- */
- alias da_bgfx_vertex_convert = void function(const(bgfx_vertex_layout_t)* _dstLayout, void* _dstData, const(bgfx_vertex_layout_t)* _srcLayout, const(void)* _srcData, uint _num);
- da_bgfx_vertex_convert bgfx_vertex_convert;
-
- /**
- * Weld vertices.
- * Params:
- * _output = Welded vertices remapping table. The size of buffer
- * must be the same as number of vertices.
- * _layout = Vertex stream layout.
- * _data = Vertex stream.
- * _num = Number of vertices in vertex stream.
- * _index32 = Set to `true` if input indices are 32-bit.
- * _epsilon = Error tolerance for vertex position comparison.
- */
- alias da_bgfx_weld_vertices = uint function(void* _output, const(bgfx_vertex_layout_t)* _layout, const(void)* _data, uint _num, bool _index32, float _epsilon);
- da_bgfx_weld_vertices bgfx_weld_vertices;
-
- /**
- * Convert index buffer for use with different primitive topologies.
- * Params:
- * _conversion = Conversion type, see `TopologyConvert::Enum`.
- * _dst = Destination index buffer. If this argument is NULL
- * function will return number of indices after conversion.
- * _dstSize = Destination index buffer in bytes. It must be
- * large enough to contain output indices. If destination size is
- * insufficient index buffer will be truncated.
- * _indices = Source indices.
- * _numIndices = Number of input indices.
- * _index32 = Set to `true` if input indices are 32-bit.
- */
- alias da_bgfx_topology_convert = uint function(bgfx_topology_convert_t _conversion, void* _dst, uint _dstSize, const(void)* _indices, uint _numIndices, bool _index32);
- da_bgfx_topology_convert bgfx_topology_convert;
-
- /**
- * Sort indices.
- * Params:
- * _sort = Sort order, see `TopologySort::Enum`.
- * _dst = Destination index buffer.
- * _dstSize = Destination index buffer in bytes. It must be
- * large enough to contain output indices. If destination size is
- * insufficient index buffer will be truncated.
- * _dir = Direction (vector must be normalized).
- * _pos = Position.
- * _vertices = Pointer to first vertex represented as
- * float x, y, z. Must contain at least number of vertices
- * referencende by index buffer.
- * _stride = Vertex stride.
- * _indices = Source indices.
- * _numIndices = Number of input indices.
- * _index32 = Set to `true` if input indices are 32-bit.
- */
- alias da_bgfx_topology_sort_tri_list = void function(bgfx_topology_sort_t _sort, void* _dst, uint _dstSize, const float[3] _dir, const float[3] _pos, const(void)* _vertices, uint _stride, const(void)* _indices, uint _numIndices, bool _index32);
- da_bgfx_topology_sort_tri_list bgfx_topology_sort_tri_list;
-
- /**
- * Returns supported backend API renderers.
- * Params:
- * _max = Maximum number of elements in _enum array.
- * _enum = Array where supported renderers will be written.
- */
- alias da_bgfx_get_supported_renderers = ubyte function(ubyte _max, bgfx_renderer_type_t* _enum);
- da_bgfx_get_supported_renderers bgfx_get_supported_renderers;
-
- /**
- * Returns name of renderer.
- * Params:
- * _type = Renderer backend type. See: `bgfx::RendererType`
- */
- alias da_bgfx_get_renderer_name = const(char)* function(bgfx_renderer_type_t _type);
- da_bgfx_get_renderer_name bgfx_get_renderer_name;
-
- alias da_bgfx_init_ctor = void function(bgfx_init_t* _init);
- da_bgfx_init_ctor bgfx_init_ctor;
-
- /**
- * Initialize the bgfx library.
- * Params:
- * _init = Initialization parameters. See: `bgfx::Init` for more info.
- */
- alias da_bgfx_init = bool function(const(bgfx_init_t)* _init);
- da_bgfx_init bgfx_init;
-
- /**
- * Shutdown bgfx library.
- */
- alias da_bgfx_shutdown = void function();
- da_bgfx_shutdown bgfx_shutdown;
-
- /**
- * Reset graphic settings and back-buffer size.
- * Attention: This call doesn’t change the window size, it just resizes
- * the back-buffer. Your windowing code controls the window size.
- * Params:
- * _width = Back-buffer width.
- * _height = Back-buffer height.
- * _flags = See: `BGFX_RESET_*` for more info.
- * - `BGFX_RESET_NONE` - No reset flags.
- * - `BGFX_RESET_FULLSCREEN` - Not supported yet.
- * - `BGFX_RESET_MSAA_X[2/4/8/16]` - Enable 2, 4, 8 or 16 x MSAA.
- * - `BGFX_RESET_VSYNC` - Enable V-Sync.
- * - `BGFX_RESET_MAXANISOTROPY` - Turn on/off max anisotropy.
- * - `BGFX_RESET_CAPTURE` - Begin screen capture.
- * - `BGFX_RESET_FLUSH_AFTER_RENDER` - Flush rendering after submitting to GPU.
- * - `BGFX_RESET_FLIP_AFTER_RENDER` - This flag specifies where flip
- * occurs. Default behaviour is that flip occurs before rendering new
- * frame. This flag only has effect when `BGFX_CONFIG_MULTITHREADED=0`.
- * - `BGFX_RESET_SRGB_BACKBUFFER` - Enable sRGB back-buffer.
- * _format = Texture format. See: `TextureFormat::Enum`.
- */
- alias da_bgfx_reset = void function(uint _width, uint _height, uint _flags, bgfx_texture_format_t _format);
- da_bgfx_reset bgfx_reset;
-
- /**
- * Advance to next frame. When using multithreaded renderer, this call
- * just swaps internal buffers, kicks render thread, and returns. In
- * singlethreaded renderer this call does frame rendering.
- * Params:
- * _capture = Capture frame with graphics debugger.
- */
- alias da_bgfx_frame = uint function(bool _capture);
- da_bgfx_frame bgfx_frame;
-
- /**
- * Returns current renderer backend API type.
- * Remarks:
- * Library must be initialized.
- */
- alias da_bgfx_get_renderer_type = bgfx_renderer_type_t function();
- da_bgfx_get_renderer_type bgfx_get_renderer_type;
-
- /**
- * Returns renderer capabilities.
- * Remarks:
- * Library must be initialized.
- */
- alias da_bgfx_get_caps = const(bgfx_caps_t)* function();
- da_bgfx_get_caps bgfx_get_caps;
-
- /**
- * Returns performance counters.
- * Attention: Pointer returned is valid until `bgfx::frame` is called.
- */
- alias da_bgfx_get_stats = const(bgfx_stats_t)* function();
- da_bgfx_get_stats bgfx_get_stats;
-
- /**
- * Allocate buffer to pass to bgfx calls. Data will be freed inside bgfx.
- * Params:
- * _size = Size to allocate.
- */
- alias da_bgfx_alloc = const(bgfx_memory_t)* function(uint _size);
- da_bgfx_alloc bgfx_alloc;
-
- /**
- * Allocate buffer and copy data into it. Data will be freed inside bgfx.
- * Params:
- * _data = Pointer to data to be copied.
- * _size = Size of data to be copied.
- */
- alias da_bgfx_copy = const(bgfx_memory_t)* function(const(void)* _data, uint _size);
- da_bgfx_copy bgfx_copy;
-
- /**
- * Make reference to data to pass to bgfx. Unlike `bgfx::alloc`, this call
- * doesn't allocate memory for data. It just copies the _data pointer. You
- * can pass `ReleaseFn` function pointer to release this memory after it's
- * consumed, otherwise you must make sure _data is available for at least 2
- * `bgfx::frame` calls. `ReleaseFn` function must be able to be called
- * from any thread.
- * Attention: Data passed must be available for at least 2 `bgfx::frame` calls.
- * Params:
- * _data = Pointer to data.
- * _size = Size of data.
- */
- alias da_bgfx_make_ref = const(bgfx_memory_t)* function(const(void)* _data, uint _size);
- da_bgfx_make_ref bgfx_make_ref;
-
- /**
- * Make reference to data to pass to bgfx. Unlike `bgfx::alloc`, this call
- * doesn't allocate memory for data. It just copies the _data pointer. You
- * can pass `ReleaseFn` function pointer to release this memory after it's
- * consumed, otherwise you must make sure _data is available for at least 2
- * `bgfx::frame` calls. `ReleaseFn` function must be able to be called
- * from any thread.
- * Attention: Data passed must be available for at least 2 `bgfx::frame` calls.
- * Params:
- * _data = Pointer to data.
- * _size = Size of data.
- * _releaseFn = Callback function to release memory after use.
- * _userData = User data to be passed to callback function.
- */
- alias da_bgfx_make_ref_release = const(bgfx_memory_t)* function(const(void)* _data, uint _size, void* _releaseFn, void* _userData);
- da_bgfx_make_ref_release bgfx_make_ref_release;
-
- /**
- * Set debug flags.
- * Params:
- * _debug = Available flags:
- * - `BGFX_DEBUG_IFH` - Infinitely fast hardware. When this flag is set
- * all rendering calls will be skipped. This is useful when profiling
- * to quickly assess potential bottlenecks between CPU and GPU.
- * - `BGFX_DEBUG_PROFILER` - Enable profiler.
- * - `BGFX_DEBUG_STATS` - Display internal statistics.
- * - `BGFX_DEBUG_TEXT` - Display debug text.
- * - `BGFX_DEBUG_WIREFRAME` - Wireframe rendering. All rendering
- * primitives will be rendered as lines.
- */
- alias da_bgfx_set_debug = void function(uint _debug);
- da_bgfx_set_debug bgfx_set_debug;
-
- /**
- * Clear internal debug text buffer.
- * Params:
- * _attr = Background color.
- * _small = Default 8x16 or 8x8 font.
- */
- alias da_bgfx_dbg_text_clear = void function(ubyte _attr, bool _small);
- da_bgfx_dbg_text_clear bgfx_dbg_text_clear;
-
- /**
- * Print formatted data to internal debug text character-buffer (VGA-compatible text mode).
- * Params:
- * _x = Position x from the left corner of the window.
- * _y = Position y from the top corner of the window.
- * _attr = Color palette. Where top 4-bits represent index of background, and bottom
- * 4-bits represent foreground color from standard VGA text palette (ANSI escape codes).
- * _format = `printf` style format.
- */
- alias da_bgfx_dbg_text_printf = void function(ushort _x, ushort _y, ubyte _attr, const(char)* _format, ... );
- da_bgfx_dbg_text_printf bgfx_dbg_text_printf;
-
- /**
- * Print formatted data from variable argument list to internal debug text character-buffer (VGA-compatible text mode).
- * Params:
- * _x = Position x from the left corner of the window.
- * _y = Position y from the top corner of the window.
- * _attr = Color palette. Where top 4-bits represent index of background, and bottom
- * 4-bits represent foreground color from standard VGA text palette (ANSI escape codes).
- * _format = `printf` style format.
- * _argList = Variable arguments list for format string.
- */
- alias da_bgfx_dbg_text_vprintf = void function(ushort _x, ushort _y, ubyte _attr, const(char)* _format, va_list _argList);
- da_bgfx_dbg_text_vprintf bgfx_dbg_text_vprintf;
-
- /**
- * Draw image into internal debug text buffer.
- * Params:
- * _x = Position x from the left corner of the window.
- * _y = Position y from the top corner of the window.
- * _width = Image width.
- * _height = Image height.
- * _data = Raw image data (character/attribute raw encoding).
- * _pitch = Image pitch in bytes.
- */
- alias da_bgfx_dbg_text_image = void function(ushort _x, ushort _y, ushort _width, ushort _height, const(void)* _data, ushort _pitch);
- da_bgfx_dbg_text_image bgfx_dbg_text_image;
-
- /**
- * Create static index buffer.
- * Params:
- * _mem = Index buffer data.
- * _flags = Buffer creation flags.
- * - `BGFX_BUFFER_NONE` - No flags.
- * - `BGFX_BUFFER_COMPUTE_READ` - Buffer will be read from by compute shader.
- * - `BGFX_BUFFER_COMPUTE_WRITE` - Buffer will be written into by compute shader. When buffer
- * is created with `BGFX_BUFFER_COMPUTE_WRITE` flag it cannot be updated from CPU.
- * - `BGFX_BUFFER_COMPUTE_READ_WRITE` - Buffer will be used for read/write by compute shader.
- * - `BGFX_BUFFER_ALLOW_RESIZE` - Buffer will resize on buffer update if a different amount of
- * data is passed. If this flag is not specified, and more data is passed on update, the buffer
- * will be trimmed to fit the existing buffer size. This flag has effect only on dynamic
- * buffers.
- * - `BGFX_BUFFER_INDEX32` - Buffer is using 32-bit indices. This flag has effect only on
- * index buffers.
- */
- alias da_bgfx_create_index_buffer = bgfx_index_buffer_handle_t function(const(bgfx_memory_t)* _mem, ushort _flags);
- da_bgfx_create_index_buffer bgfx_create_index_buffer;
-
- /**
- * Set static index buffer debug name.
- * Params:
- * _handle = Static index buffer handle.
- * _name = Static index buffer name.
- * _len = Static index buffer name length (if length is INT32_MAX, it's expected
- * that _name is zero terminated string.
- */
- alias da_bgfx_set_index_buffer_name = void function(bgfx_index_buffer_handle_t _handle, const(char)* _name, int _len);
- da_bgfx_set_index_buffer_name bgfx_set_index_buffer_name;
-
- /**
- * Destroy static index buffer.
- * Params:
- * _handle = Static index buffer handle.
- */
- alias da_bgfx_destroy_index_buffer = void function(bgfx_index_buffer_handle_t _handle);
- da_bgfx_destroy_index_buffer bgfx_destroy_index_buffer;
-
- /**
- * Create vertex layout.
- * Params:
- * _layout = Vertex layout.
- */
- alias da_bgfx_create_vertex_layout = bgfx_vertex_layout_handle_t function(const(bgfx_vertex_layout_t)* _layout);
- da_bgfx_create_vertex_layout bgfx_create_vertex_layout;
-
- /**
- * Destroy vertex layout.
- * Params:
- * _layoutHandle = Vertex layout handle.
- */
- alias da_bgfx_destroy_vertex_layout = void function(bgfx_vertex_layout_handle_t _layoutHandle);
- da_bgfx_destroy_vertex_layout bgfx_destroy_vertex_layout;
-
- /**
- * Create static vertex buffer.
- * Params:
- * _mem = Vertex buffer data.
- * _layout = Vertex layout.
- * _flags = Buffer creation flags.
- * - `BGFX_BUFFER_NONE` - No flags.
- * - `BGFX_BUFFER_COMPUTE_READ` - Buffer will be read from by compute shader.
- * - `BGFX_BUFFER_COMPUTE_WRITE` - Buffer will be written into by compute shader. When buffer
- * is created with `BGFX_BUFFER_COMPUTE_WRITE` flag it cannot be updated from CPU.
- * - `BGFX_BUFFER_COMPUTE_READ_WRITE` - Buffer will be used for read/write by compute shader.
- * - `BGFX_BUFFER_ALLOW_RESIZE` - Buffer will resize on buffer update if a different amount of
- * data is passed. If this flag is not specified, and more data is passed on update, the buffer
- * will be trimmed to fit the existing buffer size. This flag has effect only on dynamic buffers.
- * - `BGFX_BUFFER_INDEX32` - Buffer is using 32-bit indices. This flag has effect only on index buffers.
- */
- alias da_bgfx_create_vertex_buffer = bgfx_vertex_buffer_handle_t function(const(bgfx_memory_t)* _mem, const(bgfx_vertex_layout_t)* _layout, ushort _flags);
- da_bgfx_create_vertex_buffer bgfx_create_vertex_buffer;
-
- /**
- * Set static vertex buffer debug name.
- * Params:
- * _handle = Static vertex buffer handle.
- * _name = Static vertex buffer name.
- * _len = Static vertex buffer name length (if length is INT32_MAX, it's expected
- * that _name is zero terminated string.
- */
- alias da_bgfx_set_vertex_buffer_name = void function(bgfx_vertex_buffer_handle_t _handle, const(char)* _name, int _len);
- da_bgfx_set_vertex_buffer_name bgfx_set_vertex_buffer_name;
-
- /**
- * Destroy static vertex buffer.
- * Params:
- * _handle = Static vertex buffer handle.
- */
- alias da_bgfx_destroy_vertex_buffer = void function(bgfx_vertex_buffer_handle_t _handle);
- da_bgfx_destroy_vertex_buffer bgfx_destroy_vertex_buffer;
-
- /**
- * Create empty dynamic index buffer.
- * Params:
- * _num = Number of indices.
- * _flags = Buffer creation flags.
- * - `BGFX_BUFFER_NONE` - No flags.
- * - `BGFX_BUFFER_COMPUTE_READ` - Buffer will be read from by compute shader.
- * - `BGFX_BUFFER_COMPUTE_WRITE` - Buffer will be written into by compute shader. When buffer
- * is created with `BGFX_BUFFER_COMPUTE_WRITE` flag it cannot be updated from CPU.
- * - `BGFX_BUFFER_COMPUTE_READ_WRITE` - Buffer will be used for read/write by compute shader.
- * - `BGFX_BUFFER_ALLOW_RESIZE` - Buffer will resize on buffer update if a different amount of
- * data is passed. If this flag is not specified, and more data is passed on update, the buffer
- * will be trimmed to fit the existing buffer size. This flag has effect only on dynamic
- * buffers.
- * - `BGFX_BUFFER_INDEX32` - Buffer is using 32-bit indices. This flag has effect only on
- * index buffers.
- */
- alias da_bgfx_create_dynamic_index_buffer = bgfx_dynamic_index_buffer_handle_t function(uint _num, ushort _flags);
- da_bgfx_create_dynamic_index_buffer bgfx_create_dynamic_index_buffer;
-
- /**
- * Create a dynamic index buffer and initialize it.
- * Params:
- * _mem = Index buffer data.
- * _flags = Buffer creation flags.
- * - `BGFX_BUFFER_NONE` - No flags.
- * - `BGFX_BUFFER_COMPUTE_READ` - Buffer will be read from by compute shader.
- * - `BGFX_BUFFER_COMPUTE_WRITE` - Buffer will be written into by compute shader. When buffer
- * is created with `BGFX_BUFFER_COMPUTE_WRITE` flag it cannot be updated from CPU.
- * - `BGFX_BUFFER_COMPUTE_READ_WRITE` - Buffer will be used for read/write by compute shader.
- * - `BGFX_BUFFER_ALLOW_RESIZE` - Buffer will resize on buffer update if a different amount of
- * data is passed. If this flag is not specified, and more data is passed on update, the buffer
- * will be trimmed to fit the existing buffer size. This flag has effect only on dynamic
- * buffers.
- * - `BGFX_BUFFER_INDEX32` - Buffer is using 32-bit indices. This flag has effect only on
- * index buffers.
- */
- alias da_bgfx_create_dynamic_index_buffer_mem = bgfx_dynamic_index_buffer_handle_t function(const(bgfx_memory_t)* _mem, ushort _flags);
- da_bgfx_create_dynamic_index_buffer_mem bgfx_create_dynamic_index_buffer_mem;
-
- /**
- * Update dynamic index buffer.
- * Params:
- * _handle = Dynamic index buffer handle.
- * _startIndex = Start index.
- * _mem = Index buffer data.
- */
- alias da_bgfx_update_dynamic_index_buffer = void function(bgfx_dynamic_index_buffer_handle_t _handle, uint _startIndex, const(bgfx_memory_t)* _mem);
- da_bgfx_update_dynamic_index_buffer bgfx_update_dynamic_index_buffer;
-
- /**
- * Destroy dynamic index buffer.
- * Params:
- * _handle = Dynamic index buffer handle.
- */
- alias da_bgfx_destroy_dynamic_index_buffer = void function(bgfx_dynamic_index_buffer_handle_t _handle);
- da_bgfx_destroy_dynamic_index_buffer bgfx_destroy_dynamic_index_buffer;
-
- /**
- * Create empty dynamic vertex buffer.
- * Params:
- * _num = Number of vertices.
- * _layout = Vertex layout.
- * _flags = Buffer creation flags.
- * - `BGFX_BUFFER_NONE` - No flags.
- * - `BGFX_BUFFER_COMPUTE_READ` - Buffer will be read from by compute shader.
- * - `BGFX_BUFFER_COMPUTE_WRITE` - Buffer will be written into by compute shader. When buffer
- * is created with `BGFX_BUFFER_COMPUTE_WRITE` flag it cannot be updated from CPU.
- * - `BGFX_BUFFER_COMPUTE_READ_WRITE` - Buffer will be used for read/write by compute shader.
- * - `BGFX_BUFFER_ALLOW_RESIZE` - Buffer will resize on buffer update if a different amount of
- * data is passed. If this flag is not specified, and more data is passed on update, the buffer
- * will be trimmed to fit the existing buffer size. This flag has effect only on dynamic
- * buffers.
- * - `BGFX_BUFFER_INDEX32` - Buffer is using 32-bit indices. This flag has effect only on
- * index buffers.
- */
- alias da_bgfx_create_dynamic_vertex_buffer = bgfx_dynamic_vertex_buffer_handle_t function(uint _num, const(bgfx_vertex_layout_t)* _layout, ushort _flags);
- da_bgfx_create_dynamic_vertex_buffer bgfx_create_dynamic_vertex_buffer;
-
- /**
- * Create dynamic vertex buffer and initialize it.
- * Params:
- * _mem = Vertex buffer data.
- * _layout = Vertex layout.
- * _flags = Buffer creation flags.
- * - `BGFX_BUFFER_NONE` - No flags.
- * - `BGFX_BUFFER_COMPUTE_READ` - Buffer will be read from by compute shader.
- * - `BGFX_BUFFER_COMPUTE_WRITE` - Buffer will be written into by compute shader. When buffer
- * is created with `BGFX_BUFFER_COMPUTE_WRITE` flag it cannot be updated from CPU.
- * - `BGFX_BUFFER_COMPUTE_READ_WRITE` - Buffer will be used for read/write by compute shader.
- * - `BGFX_BUFFER_ALLOW_RESIZE` - Buffer will resize on buffer update if a different amount of
- * data is passed. If this flag is not specified, and more data is passed on update, the buffer
- * will be trimmed to fit the existing buffer size. This flag has effect only on dynamic
- * buffers.
- * - `BGFX_BUFFER_INDEX32` - Buffer is using 32-bit indices. This flag has effect only on
- * index buffers.
- */
- alias da_bgfx_create_dynamic_vertex_buffer_mem = bgfx_dynamic_vertex_buffer_handle_t function(const(bgfx_memory_t)* _mem, const(bgfx_vertex_layout_t)* _layout, ushort _flags);
- da_bgfx_create_dynamic_vertex_buffer_mem bgfx_create_dynamic_vertex_buffer_mem;
-
- /**
- * Update dynamic vertex buffer.
- * Params:
- * _handle = Dynamic vertex buffer handle.
- * _startVertex = Start vertex.
- * _mem = Vertex buffer data.
- */
- alias da_bgfx_update_dynamic_vertex_buffer = void function(bgfx_dynamic_vertex_buffer_handle_t _handle, uint _startVertex, const(bgfx_memory_t)* _mem);
- da_bgfx_update_dynamic_vertex_buffer bgfx_update_dynamic_vertex_buffer;
-
- /**
- * Destroy dynamic vertex buffer.
- * Params:
- * _handle = Dynamic vertex buffer handle.
- */
- alias da_bgfx_destroy_dynamic_vertex_buffer = void function(bgfx_dynamic_vertex_buffer_handle_t _handle);
- da_bgfx_destroy_dynamic_vertex_buffer bgfx_destroy_dynamic_vertex_buffer;
-
- /**
- * Returns number of requested or maximum available indices.
- * Params:
- * _num = Number of required indices.
- * _index32 = Set to `true` if input indices will be 32-bit.
- */
- alias da_bgfx_get_avail_transient_index_buffer = uint function(uint _num, bool _index32);
- da_bgfx_get_avail_transient_index_buffer bgfx_get_avail_transient_index_buffer;
-
- /**
- * Returns number of requested or maximum available vertices.
- * Params:
- * _num = Number of required vertices.
- * _layout = Vertex layout.
- */
- alias da_bgfx_get_avail_transient_vertex_buffer = uint function(uint _num, const(bgfx_vertex_layout_t)* _layout);
- da_bgfx_get_avail_transient_vertex_buffer bgfx_get_avail_transient_vertex_buffer;
-
- /**
- * Returns number of requested or maximum available instance buffer slots.
- * Params:
- * _num = Number of required instances.
- * _stride = Stride per instance.
- */
- alias da_bgfx_get_avail_instance_data_buffer = uint function(uint _num, ushort _stride);
- da_bgfx_get_avail_instance_data_buffer bgfx_get_avail_instance_data_buffer;
-
- /**
- * Allocate transient index buffer.
- * Params:
- * _tib = TransientIndexBuffer structure will be filled, and will be valid
- * for the duration of frame, and can be reused for multiple draw
- * calls.
- * _num = Number of indices to allocate.
- * _index32 = Set to `true` if input indices will be 32-bit.
- */
- alias da_bgfx_alloc_transient_index_buffer = void function(bgfx_transient_index_buffer_t* _tib, uint _num, bool _index32);
- da_bgfx_alloc_transient_index_buffer bgfx_alloc_transient_index_buffer;
-
- /**
- * Allocate transient vertex buffer.
- * Params:
- * _tvb = TransientVertexBuffer structure will be filled, and will be valid
- * for the duration of frame, and can be reused for multiple draw
- * calls.
- * _num = Number of vertices to allocate.
- * _layout = Vertex layout.
- */
- alias da_bgfx_alloc_transient_vertex_buffer = void function(bgfx_transient_vertex_buffer_t* _tvb, uint _num, const(bgfx_vertex_layout_t)* _layout);
- da_bgfx_alloc_transient_vertex_buffer bgfx_alloc_transient_vertex_buffer;
-
- /**
- * Check for required space and allocate transient vertex and index
- * buffers. If both space requirements are satisfied function returns
- * true.
- * Params:
- * _tvb = TransientVertexBuffer structure will be filled, and will be valid
- * for the duration of frame, and can be reused for multiple draw
- * calls.
- * _layout = Vertex layout.
- * _numVertices = Number of vertices to allocate.
- * _tib = TransientIndexBuffer structure will be filled, and will be valid
- * for the duration of frame, and can be reused for multiple draw
- * calls.
- * _numIndices = Number of indices to allocate.
- * _index32 = Set to `true` if input indices will be 32-bit.
- */
- alias da_bgfx_alloc_transient_buffers = bool function(bgfx_transient_vertex_buffer_t* _tvb, const(bgfx_vertex_layout_t)* _layout, uint _numVertices, bgfx_transient_index_buffer_t* _tib, uint _numIndices, bool _index32);
- da_bgfx_alloc_transient_buffers bgfx_alloc_transient_buffers;
-
- /**
- * Allocate instance data buffer.
- * Params:
- * _idb = InstanceDataBuffer structure will be filled, and will be valid
- * for duration of frame, and can be reused for multiple draw
- * calls.
- * _num = Number of instances.
- * _stride = Instance stride. Must be multiple of 16.
- */
- alias da_bgfx_alloc_instance_data_buffer = void function(bgfx_instance_data_buffer_t* _idb, uint _num, ushort _stride);
- da_bgfx_alloc_instance_data_buffer bgfx_alloc_instance_data_buffer;
-
- /**
- * Create draw indirect buffer.
- * Params:
- * _num = Number of indirect calls.
- */
- alias da_bgfx_create_indirect_buffer = bgfx_indirect_buffer_handle_t function(uint _num);
- da_bgfx_create_indirect_buffer bgfx_create_indirect_buffer;
-
- /**
- * Destroy draw indirect buffer.
- * Params:
- * _handle = Indirect buffer handle.
- */
- alias da_bgfx_destroy_indirect_buffer = void function(bgfx_indirect_buffer_handle_t _handle);
- da_bgfx_destroy_indirect_buffer bgfx_destroy_indirect_buffer;
-
- /**
- * Create shader from memory buffer.
- * Params:
- * _mem = Shader binary.
- */
- alias da_bgfx_create_shader = bgfx_shader_handle_t function(const(bgfx_memory_t)* _mem);
- da_bgfx_create_shader bgfx_create_shader;
-
- /**
- * Returns the number of uniforms and uniform handles used inside a shader.
- * Remarks:
- * Only non-predefined uniforms are returned.
- * Params:
- * _handle = Shader handle.
- * _uniforms = UniformHandle array where data will be stored.
- * _max = Maximum capacity of array.
- */
- alias da_bgfx_get_shader_uniforms = ushort function(bgfx_shader_handle_t _handle, bgfx_uniform_handle_t* _uniforms, ushort _max);
- da_bgfx_get_shader_uniforms bgfx_get_shader_uniforms;
-
- /**
- * Set shader debug name.
- * Params:
- * _handle = Shader handle.
- * _name = Shader name.
- * _len = Shader name length (if length is INT32_MAX, it's expected
- * that _name is zero terminated string).
- */
- alias da_bgfx_set_shader_name = void function(bgfx_shader_handle_t _handle, const(char)* _name, int _len);
- da_bgfx_set_shader_name bgfx_set_shader_name;
-
- /**
- * Destroy shader.
- * Remarks: Once a shader program is created with _handle,
- * it is safe to destroy that shader.
- * Params:
- * _handle = Shader handle.
- */
- alias da_bgfx_destroy_shader = void function(bgfx_shader_handle_t _handle);
- da_bgfx_destroy_shader bgfx_destroy_shader;
-
- /**
- * Create program with vertex and fragment shaders.
- * Params:
- * _vsh = Vertex shader.
- * _fsh = Fragment shader.
- * _destroyShaders = If true, shaders will be destroyed when program is destroyed.
- */
- alias da_bgfx_create_program = bgfx_program_handle_t function(bgfx_shader_handle_t _vsh, bgfx_shader_handle_t _fsh, bool _destroyShaders);
- da_bgfx_create_program bgfx_create_program;
-
- /**
- * Create program with compute shader.
- * Params:
- * _csh = Compute shader.
- * _destroyShaders = If true, shaders will be destroyed when program is destroyed.
- */
- alias da_bgfx_create_compute_program = bgfx_program_handle_t function(bgfx_shader_handle_t _csh, bool _destroyShaders);
- da_bgfx_create_compute_program bgfx_create_compute_program;
-
- /**
- * Destroy program.
- * Params:
- * _handle = Program handle.
- */
- alias da_bgfx_destroy_program = void function(bgfx_program_handle_t _handle);
- da_bgfx_destroy_program bgfx_destroy_program;
-
- /**
- * Validate texture parameters.
- * Params:
- * _depth = Depth dimension of volume texture.
- * _cubeMap = Indicates that texture contains cubemap.
- * _numLayers = Number of layers in texture array.
- * _format = Texture format. See: `TextureFormat::Enum`.
- * _flags = Texture flags. See `BGFX_TEXTURE_*`.
- */
- alias da_bgfx_is_texture_valid = bool function(ushort _depth, bool _cubeMap, ushort _numLayers, bgfx_texture_format_t _format, ulong _flags);
- da_bgfx_is_texture_valid bgfx_is_texture_valid;
-
- /**
- * Validate frame buffer parameters.
- * Params:
- * _num = Number of attachments.
- * _attachment = Attachment texture info. See: `bgfx::Attachment`.
- */
- alias da_bgfx_is_frame_buffer_valid = bool function(ubyte _num, const(bgfx_attachment_t)* _attachment);
- da_bgfx_is_frame_buffer_valid bgfx_is_frame_buffer_valid;
-
- /**
- * Calculate amount of memory required for texture.
- * Params:
- * _info = Resulting texture info structure. See: `TextureInfo`.
- * _width = Width.
- * _height = Height.
- * _depth = Depth dimension of volume texture.
- * _cubeMap = Indicates that texture contains cubemap.
- * _hasMips = Indicates that texture contains full mip-map chain.
- * _numLayers = Number of layers in texture array.
- * _format = Texture format. See: `TextureFormat::Enum`.
- */
- alias da_bgfx_calc_texture_size = void function(bgfx_texture_info_t* _info, ushort _width, ushort _height, ushort _depth, bool _cubeMap, bool _hasMips, ushort _numLayers, bgfx_texture_format_t _format);
- da_bgfx_calc_texture_size bgfx_calc_texture_size;
-
- /**
- * Create texture from memory buffer.
- * Params:
- * _mem = DDS, KTX or PVR texture binary data.
- * _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.
- * _skip = Skip top level mips when parsing texture.
- * _info = When non-`NULL` is specified it returns parsed texture information.
- */
- alias da_bgfx_create_texture = bgfx_texture_handle_t function(const(bgfx_memory_t)* _mem, ulong _flags, ubyte _skip, bgfx_texture_info_t* _info);
- da_bgfx_create_texture bgfx_create_texture;
-
- /**
- * Create 2D texture.
- * Params:
- * _width = Width.
- * _height = Height.
- * _hasMips = Indicates that texture contains full mip-map chain.
- * _numLayers = Number of layers in texture array. Must be 1 if caps
- * `BGFX_CAPS_TEXTURE_2D_ARRAY` flag is not set.
- * _format = Texture format. See: `TextureFormat::Enum`.
- * _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.
- * _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.
- */
- alias da_bgfx_create_texture_2d = bgfx_texture_handle_t function(ushort _width, ushort _height, bool _hasMips, ushort _numLayers, bgfx_texture_format_t _format, ulong _flags, const(bgfx_memory_t)* _mem);
- da_bgfx_create_texture_2d bgfx_create_texture_2d;
-
- /**
- * Create texture with size based on back-buffer ratio. Texture will maintain ratio
- * if back buffer resolution changes.
- * Params:
- * _ratio = Texture size in respect to back-buffer size. See: `BackbufferRatio::Enum`.
- * _hasMips = Indicates that texture contains full mip-map chain.
- * _numLayers = Number of layers in texture array. Must be 1 if caps
- * `BGFX_CAPS_TEXTURE_2D_ARRAY` flag is not set.
- * _format = Texture format. See: `TextureFormat::Enum`.
- * _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.
- */
- alias da_bgfx_create_texture_2d_scaled = bgfx_texture_handle_t function(bgfx_backbuffer_ratio_t _ratio, bool _hasMips, ushort _numLayers, bgfx_texture_format_t _format, ulong _flags);
- da_bgfx_create_texture_2d_scaled bgfx_create_texture_2d_scaled;
-
- /**
- * Create 3D texture.
- * Params:
- * _width = Width.
- * _height = Height.
- * _depth = Depth.
- * _hasMips = Indicates that texture contains full mip-map chain.
- * _format = Texture format. See: `TextureFormat::Enum`.
- * _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.
- * _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.
- */
- alias da_bgfx_create_texture_3d = bgfx_texture_handle_t function(ushort _width, ushort _height, ushort _depth, bool _hasMips, bgfx_texture_format_t _format, ulong _flags, const(bgfx_memory_t)* _mem);
- da_bgfx_create_texture_3d bgfx_create_texture_3d;
-
- /**
- * Create Cube texture.
- * Params:
- * _size = Cube side size.
- * _hasMips = Indicates that texture contains full mip-map chain.
- * _numLayers = Number of layers in texture array. Must be 1 if caps
- * `BGFX_CAPS_TEXTURE_2D_ARRAY` flag is not set.
- * _format = Texture format. See: `TextureFormat::Enum`.
- * _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.
- * _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.
- */
- alias da_bgfx_create_texture_cube = bgfx_texture_handle_t function(ushort _size, bool _hasMips, ushort _numLayers, bgfx_texture_format_t _format, ulong _flags, const(bgfx_memory_t)* _mem);
- da_bgfx_create_texture_cube bgfx_create_texture_cube;
-
- /**
- * Update 2D texture.
- * Attention: It's valid to update only mutable texture. See `bgfx::createTexture2D` for more info.
- * Params:
- * _handle = Texture handle.
- * _layer = Layer in texture array.
- * _mip = Mip level.
- * _x = X offset in texture.
- * _y = Y offset in texture.
- * _width = Width of texture block.
- * _height = Height of texture block.
- * _mem = Texture update data.
- * _pitch = Pitch of input image (bytes). When _pitch is set to
- * UINT16_MAX, it will be calculated internally based on _width.
- */
- alias da_bgfx_update_texture_2d = void function(bgfx_texture_handle_t _handle, ushort _layer, ubyte _mip, ushort _x, ushort _y, ushort _width, ushort _height, const(bgfx_memory_t)* _mem, ushort _pitch);
- da_bgfx_update_texture_2d bgfx_update_texture_2d;
-
- /**
- * Update 3D texture.
- * Attention: It's valid to update only mutable texture. See `bgfx::createTexture3D` for more info.
- * Params:
- * _handle = Texture handle.
- * _mip = Mip level.
- * _x = X offset in texture.
- * _y = Y offset in texture.
- * _z = Z offset in texture.
- * _width = Width of texture block.
- * _height = Height of texture block.
- * _depth = Depth of texture block.
- * _mem = Texture update data.
- */
- alias da_bgfx_update_texture_3d = void function(bgfx_texture_handle_t _handle, ubyte _mip, ushort _x, ushort _y, ushort _z, ushort _width, ushort _height, ushort _depth, const(bgfx_memory_t)* _mem);
- da_bgfx_update_texture_3d bgfx_update_texture_3d;
-
- /**
- * Update Cube texture.
- * Attention: It's valid to update only mutable texture. See `bgfx::createTextureCube` for more info.
- * Params:
- * _handle = Texture handle.
- * _layer = Layer in texture array.
- * _side = Cubemap side `BGFX_CUBE_MAP_<POSITIVE or NEGATIVE>_<X, Y or Z>`,
- * where 0 is +X, 1 is -X, 2 is +Y, 3 is -Y, 4 is +Z, and 5 is -Z.
- * +----------+
- * |-z 2|
- * | ^ +y |
- * | | | Unfolded cube:
- * | +---->+x |
- * +----------+----------+----------+----------+
- * |+y 1|+y 4|+y 0|+y 5|
- * | ^ -x | ^ +z | ^ +x | ^ -z |
- * | | | | | | | | |
- * | +---->+z | +---->+x | +---->-z | +---->-x |
- * +----------+----------+----------+----------+
- * |+z 3|
- * | ^ -y |
- * | | |
- * | +---->+x |
- * +----------+
- * _mip = Mip level.
- * _x = X offset in texture.
- * _y = Y offset in texture.
- * _width = Width of texture block.
- * _height = Height of texture block.
- * _mem = Texture update data.
- * _pitch = Pitch of input image (bytes). When _pitch is set to
- * UINT16_MAX, it will be calculated internally based on _width.
- */
- alias da_bgfx_update_texture_cube = void function(bgfx_texture_handle_t _handle, ushort _layer, ubyte _side, ubyte _mip, ushort _x, ushort _y, ushort _width, ushort _height, const(bgfx_memory_t)* _mem, ushort _pitch);
- da_bgfx_update_texture_cube bgfx_update_texture_cube;
-
- /**
- * Read back texture content.
- * Attention: Texture must be created with `BGFX_TEXTURE_READ_BACK` flag.
- * Attention: Availability depends on: `BGFX_CAPS_TEXTURE_READ_BACK`.
- * Params:
- * _handle = Texture handle.
- * _data = Destination buffer.
- * _mip = Mip level.
- */
- alias da_bgfx_read_texture = uint function(bgfx_texture_handle_t _handle, void* _data, ubyte _mip);
- da_bgfx_read_texture bgfx_read_texture;
-
- /**
- * Set texture debug name.
- * Params:
- * _handle = Texture handle.
- * _name = Texture name.
- * _len = Texture name length (if length is INT32_MAX, it's expected
- * that _name is zero terminated string.
- */
- alias da_bgfx_set_texture_name = void function(bgfx_texture_handle_t _handle, const(char)* _name, int _len);
- da_bgfx_set_texture_name bgfx_set_texture_name;
-
- /**
- * Returns texture direct access pointer.
- * Attention: Availability depends on: `BGFX_CAPS_TEXTURE_DIRECT_ACCESS`. This feature
- * is available on GPUs that have unified memory architecture (UMA) support.
- * Params:
- * _handle = Texture handle.
- */
- alias da_bgfx_get_direct_access_ptr = void* function(bgfx_texture_handle_t _handle);
- da_bgfx_get_direct_access_ptr bgfx_get_direct_access_ptr;
-
- /**
- * Destroy texture.
- * Params:
- * _handle = Texture handle.
- */
- alias da_bgfx_destroy_texture = void function(bgfx_texture_handle_t _handle);
- da_bgfx_destroy_texture bgfx_destroy_texture;
-
- /**
- * Create frame buffer (simple).
- * Params:
- * _width = Texture width.
- * _height = Texture height.
- * _format = Texture format. See: `TextureFormat::Enum`.
- * _textureFlags = 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.
- */
- alias da_bgfx_create_frame_buffer = bgfx_frame_buffer_handle_t function(ushort _width, ushort _height, bgfx_texture_format_t _format, ulong _textureFlags);
- da_bgfx_create_frame_buffer bgfx_create_frame_buffer;
-
- /**
- * Create frame buffer with size based on back-buffer ratio. Frame buffer will maintain ratio
- * if back buffer resolution changes.
- * Params:
- * _ratio = Frame buffer size in respect to back-buffer size. See:
- * `BackbufferRatio::Enum`.
- * _format = Texture format. See: `TextureFormat::Enum`.
- * _textureFlags = 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.
- */
- alias da_bgfx_create_frame_buffer_scaled = bgfx_frame_buffer_handle_t function(bgfx_backbuffer_ratio_t _ratio, bgfx_texture_format_t _format, ulong _textureFlags);
- da_bgfx_create_frame_buffer_scaled bgfx_create_frame_buffer_scaled;
-
- /**
- * Create MRT frame buffer from texture handles (simple).
- * Params:
- * _num = Number of texture handles.
- * _handles = Texture attachments.
- * _destroyTexture = If true, textures will be destroyed when
- * frame buffer is destroyed.
- */
- alias da_bgfx_create_frame_buffer_from_handles = bgfx_frame_buffer_handle_t function(ubyte _num, const(bgfx_texture_handle_t)* _handles, bool _destroyTexture);
- da_bgfx_create_frame_buffer_from_handles bgfx_create_frame_buffer_from_handles;
-
- /**
- * Create MRT frame buffer from texture handles with specific layer and
- * mip level.
- * Params:
- * _num = Number of attachments.
- * _attachment = Attachment texture info. See: `bgfx::Attachment`.
- * _destroyTexture = If true, textures will be destroyed when
- * frame buffer is destroyed.
- */
- alias da_bgfx_create_frame_buffer_from_attachment = bgfx_frame_buffer_handle_t function(ubyte _num, const(bgfx_attachment_t)* _attachment, bool _destroyTexture);
- da_bgfx_create_frame_buffer_from_attachment bgfx_create_frame_buffer_from_attachment;
-
- /**
- * Create frame buffer for multiple window rendering.
- * Remarks:
- * Frame buffer cannot be used for sampling.
- * Attention: Availability depends on: `BGFX_CAPS_SWAP_CHAIN`.
- * Params:
- * _nwh = OS' target native window handle.
- * _width = Window back buffer width.
- * _height = Window back buffer height.
- * _format = Window back buffer color format.
- * _depthFormat = Window back buffer depth format.
- */
- alias da_bgfx_create_frame_buffer_from_nwh = bgfx_frame_buffer_handle_t function(void* _nwh, ushort _width, ushort _height, bgfx_texture_format_t _format, bgfx_texture_format_t _depthFormat);
- da_bgfx_create_frame_buffer_from_nwh bgfx_create_frame_buffer_from_nwh;
-
- /**
- * Set frame buffer debug name.
- * Params:
- * _handle = Frame buffer handle.
- * _name = Frame buffer name.
- * _len = Frame buffer name length (if length is INT32_MAX, it's expected
- * that _name is zero terminated string.
- */
- alias da_bgfx_set_frame_buffer_name = void function(bgfx_frame_buffer_handle_t _handle, const(char)* _name, int _len);
- da_bgfx_set_frame_buffer_name bgfx_set_frame_buffer_name;
-
- /**
- * Obtain texture handle of frame buffer attachment.
- * Params:
- * _handle = Frame buffer handle.
- */
- alias da_bgfx_get_texture = bgfx_texture_handle_t function(bgfx_frame_buffer_handle_t _handle, ubyte _attachment);
- da_bgfx_get_texture bgfx_get_texture;
-
- /**
- * Destroy frame buffer.
- * Params:
- * _handle = Frame buffer handle.
- */
- alias da_bgfx_destroy_frame_buffer = void function(bgfx_frame_buffer_handle_t _handle);
- da_bgfx_destroy_frame_buffer bgfx_destroy_frame_buffer;
-
- /**
- * Create shader uniform parameter.
- * Remarks:
- * 1. Uniform names are unique. It's valid to call `bgfx::createUniform`
- * multiple times with the same uniform name. The library will always
- * return the same handle, but the handle reference count will be
- * incremented. This means that the same number of `bgfx::destroyUniform`
- * must be called to properly destroy the uniform.
- * 2. Predefined uniforms (declared in `bgfx_shader.sh`):
- * - `u_viewRect vec4(x, y, width, height)` - view rectangle for current
- * view, in pixels.
- * - `u_viewTexel vec4(1.0/width, 1.0/height, undef, undef)` - inverse
- * width and height
- * - `u_view mat4` - view matrix
- * - `u_invView mat4` - inverted view matrix
- * - `u_proj mat4` - projection matrix
- * - `u_invProj mat4` - inverted projection matrix
- * - `u_viewProj mat4` - concatenated view projection matrix
- * - `u_invViewProj mat4` - concatenated inverted view projection matrix
- * - `u_model mat4[BGFX_CONFIG_MAX_BONES]` - array of model matrices.
- * - `u_modelView mat4` - concatenated model view matrix, only first
- * model matrix from array is used.
- * - `u_modelViewProj mat4` - concatenated model view projection matrix.
- * - `u_alphaRef float` - alpha reference value for alpha test.
- * Params:
- * _name = Uniform name in shader.
- * _type = Type of uniform (See: `bgfx::UniformType`).
- * _num = Number of elements in array.
- */
- alias da_bgfx_create_uniform = bgfx_uniform_handle_t function(const(char)* _name, bgfx_uniform_type_t _type, ushort _num);
- da_bgfx_create_uniform bgfx_create_uniform;
-
- /**
- * Retrieve uniform info.
- * Params:
- * _handle = Handle to uniform object.
- * _info = Uniform info.
- */
- alias da_bgfx_get_uniform_info = void function(bgfx_uniform_handle_t _handle, bgfx_uniform_info_t* _info);
- da_bgfx_get_uniform_info bgfx_get_uniform_info;
-
- /**
- * Destroy shader uniform parameter.
- * Params:
- * _handle = Handle to uniform object.
- */
- alias da_bgfx_destroy_uniform = void function(bgfx_uniform_handle_t _handle);
- da_bgfx_destroy_uniform bgfx_destroy_uniform;
-
- /**
- * Create occlusion query.
- */
- alias da_bgfx_create_occlusion_query = bgfx_occlusion_query_handle_t function();
- da_bgfx_create_occlusion_query bgfx_create_occlusion_query;
-
- /**
- * Retrieve occlusion query result from previous frame.
- * Params:
- * _handle = Handle to occlusion query object.
- * _result = Number of pixels that passed test. This argument
- * can be `NULL` if result of occlusion query is not needed.
- */
- alias da_bgfx_get_result = bgfx_occlusion_query_result_t function(bgfx_occlusion_query_handle_t _handle, int* _result);
- da_bgfx_get_result bgfx_get_result;
-
- /**
- * Destroy occlusion query.
- * Params:
- * _handle = Handle to occlusion query object.
- */
- alias da_bgfx_destroy_occlusion_query = void function(bgfx_occlusion_query_handle_t _handle);
- da_bgfx_destroy_occlusion_query bgfx_destroy_occlusion_query;
-
- /**
- * Set palette color value.
- * Params:
- * _index = Index into palette.
- * _rgba = RGBA floating point values.
- */
- alias da_bgfx_set_palette_color = void function(ubyte _index, const float[4] _rgba);
- da_bgfx_set_palette_color bgfx_set_palette_color;
-
- /**
- * Set palette color value.
- * Params:
- * _index = Index into palette.
- * _rgba = Packed 32-bit RGBA value.
- */
- alias da_bgfx_set_palette_color_rgba8 = void function(ubyte _index, uint _rgba);
- da_bgfx_set_palette_color_rgba8 bgfx_set_palette_color_rgba8;
-
- /**
- * Set view name.
- * Remarks:
- * This is debug only feature.
- * In graphics debugger view name will appear as:
- * "nnnc <view name>"
- * ^ ^ ^
- * | +--- compute (C)
- * +------ view id
- * Params:
- * _id = View id.
- * _name = View name.
- */
- alias da_bgfx_set_view_name = void function(bgfx_view_id_t _id, const(char)* _name);
- da_bgfx_set_view_name bgfx_set_view_name;
-
- /**
- * Set view rectangle. Draw primitive outside view will be clipped.
- * Params:
- * _id = View id.
- * _x = Position x from the left corner of the window.
- * _y = Position y from the top corner of the window.
- * _width = Width of view port region.
- * _height = Height of view port region.
- */
- alias da_bgfx_set_view_rect = void function(bgfx_view_id_t _id, ushort _x, ushort _y, ushort _width, ushort _height);
- da_bgfx_set_view_rect bgfx_set_view_rect;
-
- /**
- * Set view rectangle. Draw primitive outside view will be clipped.
- * Params:
- * _id = View id.
- * _x = Position x from the left corner of the window.
- * _y = Position y from the top corner of the window.
- * _ratio = Width and height will be set in respect to back-buffer size.
- * See: `BackbufferRatio::Enum`.
- */
- alias da_bgfx_set_view_rect_ratio = void function(bgfx_view_id_t _id, ushort _x, ushort _y, bgfx_backbuffer_ratio_t _ratio);
- da_bgfx_set_view_rect_ratio bgfx_set_view_rect_ratio;
-
- /**
- * Set view scissor. Draw primitive outside view will be clipped. When
- * _x, _y, _width and _height are set to 0, scissor will be disabled.
- * Params:
- * _id = View id.
- * _x = Position x from the left corner of the window.
- * _y = Position y from the top corner of the window.
- * _width = Width of view scissor region.
- * _height = Height of view scissor region.
- */
- alias da_bgfx_set_view_scissor = void function(bgfx_view_id_t _id, ushort _x, ushort _y, ushort _width, ushort _height);
- da_bgfx_set_view_scissor bgfx_set_view_scissor;
-
- /**
- * Set view clear flags.
- * Params:
- * _id = View id.
- * _flags = Clear flags. Use `BGFX_CLEAR_NONE` to remove any clear
- * operation. See: `BGFX_CLEAR_*`.
- * _rgba = Color clear value.
- * _depth = Depth clear value.
- * _stencil = Stencil clear value.
- */
- alias da_bgfx_set_view_clear = void function(bgfx_view_id_t _id, ushort _flags, uint _rgba, float _depth, ubyte _stencil);
- da_bgfx_set_view_clear bgfx_set_view_clear;
-
- /**
- * Set view clear flags with different clear color for each
- * frame buffer texture. `bgfx::setPaletteColor` must be used to set up a
- * clear color palette.
- * Params:
- * _id = View id.
- * _flags = Clear flags. Use `BGFX_CLEAR_NONE` to remove any clear
- * operation. See: `BGFX_CLEAR_*`.
- * _depth = Depth clear value.
- * _stencil = Stencil clear value.
- * _c0 = Palette index for frame buffer attachment 0.
- * _c1 = Palette index for frame buffer attachment 1.
- * _c2 = Palette index for frame buffer attachment 2.
- * _c3 = Palette index for frame buffer attachment 3.
- * _c4 = Palette index for frame buffer attachment 4.
- * _c5 = Palette index for frame buffer attachment 5.
- * _c6 = Palette index for frame buffer attachment 6.
- * _c7 = Palette index for frame buffer attachment 7.
- */
- alias da_bgfx_set_view_clear_mrt = void function(bgfx_view_id_t _id, ushort _flags, float _depth, ubyte _stencil, ubyte _c0, ubyte _c1, ubyte _c2, ubyte _c3, ubyte _c4, ubyte _c5, ubyte _c6, ubyte _c7);
- da_bgfx_set_view_clear_mrt bgfx_set_view_clear_mrt;
-
- /**
- * Set view sorting mode.
- * Remarks:
- * View mode must be set prior calling `bgfx::submit` for the view.
- * Params:
- * _id = View id.
- * _mode = View sort mode. See `ViewMode::Enum`.
- */
- alias da_bgfx_set_view_mode = void function(bgfx_view_id_t _id, bgfx_view_mode_t _mode);
- da_bgfx_set_view_mode bgfx_set_view_mode;
-
- /**
- * Set view frame buffer.
- * Remarks:
- * Not persistent after `bgfx::reset` call.
- * Params:
- * _id = View id.
- * _handle = Frame buffer handle. Passing `BGFX_INVALID_HANDLE` as
- * frame buffer handle will draw primitives from this view into
- * default back buffer.
- */
- alias da_bgfx_set_view_frame_buffer = void function(bgfx_view_id_t _id, bgfx_frame_buffer_handle_t _handle);
- da_bgfx_set_view_frame_buffer bgfx_set_view_frame_buffer;
-
- /**
- * Set view's view matrix and projection matrix,
- * all draw primitives in this view will use these two matrices.
- * Params:
- * _id = View id.
- * _view = View matrix.
- * _proj = Projection matrix.
- */
- alias da_bgfx_set_view_transform = void function(bgfx_view_id_t _id, const(void)* _view, const(void)* _proj);
- da_bgfx_set_view_transform bgfx_set_view_transform;
-
- /**
- * Post submit view reordering.
- * Params:
- * _id = First view id.
- * _num = Number of views to remap.
- * _order = View remap id table. Passing `NULL` will reset view ids
- * to default state.
- */
- alias da_bgfx_set_view_order = void function(bgfx_view_id_t _id, ushort _num, const(bgfx_view_id_t)* _order);
- da_bgfx_set_view_order bgfx_set_view_order;
-
- /**
- * Reset all view settings to default.
- */
- alias da_bgfx_reset_view = void function(bgfx_view_id_t _id);
- da_bgfx_reset_view bgfx_reset_view;
-
- /**
- * Begin submitting draw calls from thread.
- * Params:
- * _forThread = Explicitly request an encoder for a worker thread.
- */
- alias da_bgfx_encoder_begin = bgfx_encoder_t* function(bool _forThread);
- da_bgfx_encoder_begin bgfx_encoder_begin;
-
- /**
- * End submitting draw calls from thread.
- * Params:
- * _encoder = Encoder.
- */
- alias da_bgfx_encoder_end = void function(bgfx_encoder_t* _encoder);
- da_bgfx_encoder_end bgfx_encoder_end;
-
- /**
- * Sets a debug marker. This allows you to group graphics calls together for easy browsing in
- * graphics debugging tools.
- * Params:
- * _marker = Marker string.
- */
- alias da_bgfx_encoder_set_marker = void function(bgfx_encoder_t* _this, const(char)* _marker);
- da_bgfx_encoder_set_marker bgfx_encoder_set_marker;
-
- /**
- * Set render states for draw primitive.
- * Remarks:
- * 1. To set up more complex states use:
- * `BGFX_STATE_ALPHA_REF(_ref)`,
- * `BGFX_STATE_POINT_SIZE(_size)`,
- * `BGFX_STATE_BLEND_FUNC(_src, _dst)`,
- * `BGFX_STATE_BLEND_FUNC_SEPARATE(_srcRGB, _dstRGB, _srcA, _dstA)`,
- * `BGFX_STATE_BLEND_EQUATION(_equation)`,
- * `BGFX_STATE_BLEND_EQUATION_SEPARATE(_equationRGB, _equationA)`
- * 2. `BGFX_STATE_BLEND_EQUATION_ADD` is set when no other blend
- * equation is specified.
- * Params:
- * _state = State flags. Default state for primitive type is
- * triangles. See: `BGFX_STATE_DEFAULT`.
- * - `BGFX_STATE_DEPTH_TEST_*` - Depth test function.
- * - `BGFX_STATE_BLEND_*` - See remark 1 about BGFX_STATE_BLEND_FUNC.
- * - `BGFX_STATE_BLEND_EQUATION_*` - See remark 2.
- * - `BGFX_STATE_CULL_*` - Backface culling mode.
- * - `BGFX_STATE_WRITE_*` - Enable R, G, B, A or Z write.
- * - `BGFX_STATE_MSAA` - Enable hardware multisample antialiasing.
- * - `BGFX_STATE_PT_[TRISTRIP/LINES/POINTS]` - Primitive type.
- * _rgba = Sets blend factor used by `BGFX_STATE_BLEND_FACTOR` and
- * `BGFX_STATE_BLEND_INV_FACTOR` blend modes.
- */
- alias da_bgfx_encoder_set_state = void function(bgfx_encoder_t* _this, ulong _state, uint _rgba);
- da_bgfx_encoder_set_state bgfx_encoder_set_state;
-
- /**
- * Set condition for rendering.
- * Params:
- * _handle = Occlusion query handle.
- * _visible = Render if occlusion query is visible.
- */
- alias da_bgfx_encoder_set_condition = void function(bgfx_encoder_t* _this, bgfx_occlusion_query_handle_t _handle, bool _visible);
- da_bgfx_encoder_set_condition bgfx_encoder_set_condition;
-
- /**
- * Set stencil test state.
- * Params:
- * _fstencil = Front stencil state.
- * _bstencil = Back stencil state. If back is set to `BGFX_STENCIL_NONE`
- * _fstencil is applied to both front and back facing primitives.
- */
- alias da_bgfx_encoder_set_stencil = void function(bgfx_encoder_t* _this, uint _fstencil, uint _bstencil);
- da_bgfx_encoder_set_stencil bgfx_encoder_set_stencil;
-
- /**
- * Set scissor for draw primitive.
- * Remarks:
- * To scissor for all primitives in view see `bgfx::setViewScissor`.
- * Params:
- * _x = Position x from the left corner of the window.
- * _y = Position y from the top corner of the window.
- * _width = Width of view scissor region.
- * _height = Height of view scissor region.
- */
- alias da_bgfx_encoder_set_scissor = ushort function(bgfx_encoder_t* _this, ushort _x, ushort _y, ushort _width, ushort _height);
- da_bgfx_encoder_set_scissor bgfx_encoder_set_scissor;
-
- /**
- * Set scissor from cache for draw primitive.
- * Remarks:
- * To scissor for all primitives in view see `bgfx::setViewScissor`.
- * Params:
- * _cache = Index in scissor cache.
- */
- alias da_bgfx_encoder_set_scissor_cached = void function(bgfx_encoder_t* _this, ushort _cache);
- da_bgfx_encoder_set_scissor_cached bgfx_encoder_set_scissor_cached;
-
- /**
- * Set model matrix for draw primitive. If it is not called,
- * the model will be rendered with an identity model matrix.
- * Params:
- * _mtx = Pointer to first matrix in array.
- * _num = Number of matrices in array.
- */
- alias da_bgfx_encoder_set_transform = uint function(bgfx_encoder_t* _this, const(void)* _mtx, ushort _num);
- da_bgfx_encoder_set_transform bgfx_encoder_set_transform;
-
- /**
- * Set model matrix from matrix cache for draw primitive.
- * Params:
- * _cache = Index in matrix cache.
- * _num = Number of matrices from cache.
- */
- alias da_bgfx_encoder_set_transform_cached = void function(bgfx_encoder_t* _this, uint _cache, ushort _num);
- da_bgfx_encoder_set_transform_cached bgfx_encoder_set_transform_cached;
-
- /**
- * Reserve matrices in internal matrix cache.
- * Attention: Pointer returned can be modified until `bgfx::frame` is called.
- * Params:
- * _transform = Pointer to `Transform` structure.
- * _num = Number of matrices.
- */
- alias da_bgfx_encoder_alloc_transform = uint function(bgfx_encoder_t* _this, bgfx_transform_t* _transform, ushort _num);
- da_bgfx_encoder_alloc_transform bgfx_encoder_alloc_transform;
-
- /**
- * Set shader uniform parameter for draw primitive.
- * Params:
- * _handle = Uniform.
- * _value = Pointer to uniform data.
- * _num = Number of elements. Passing `UINT16_MAX` will
- * use the _num passed on uniform creation.
- */
- alias da_bgfx_encoder_set_uniform = void function(bgfx_encoder_t* _this, bgfx_uniform_handle_t _handle, const(void)* _value, ushort _num);
- da_bgfx_encoder_set_uniform bgfx_encoder_set_uniform;
-
- /**
- * Set index buffer for draw primitive.
- * Params:
- * _handle = Index buffer.
- * _firstIndex = First index to render.
- * _numIndices = Number of indices to render.
- */
- alias da_bgfx_encoder_set_index_buffer = void function(bgfx_encoder_t* _this, bgfx_index_buffer_handle_t _handle, uint _firstIndex, uint _numIndices);
- da_bgfx_encoder_set_index_buffer bgfx_encoder_set_index_buffer;
-
- /**
- * Set index buffer for draw primitive.
- * Params:
- * _handle = Dynamic index buffer.
- * _firstIndex = First index to render.
- * _numIndices = Number of indices to render.
- */
- alias da_bgfx_encoder_set_dynamic_index_buffer = void function(bgfx_encoder_t* _this, bgfx_dynamic_index_buffer_handle_t _handle, uint _firstIndex, uint _numIndices);
- da_bgfx_encoder_set_dynamic_index_buffer bgfx_encoder_set_dynamic_index_buffer;
-
- /**
- * Set index buffer for draw primitive.
- * Params:
- * _tib = Transient index buffer.
- * _firstIndex = First index to render.
- * _numIndices = Number of indices to render.
- */
- alias da_bgfx_encoder_set_transient_index_buffer = void function(bgfx_encoder_t* _this, const(bgfx_transient_index_buffer_t)* _tib, uint _firstIndex, uint _numIndices);
- da_bgfx_encoder_set_transient_index_buffer bgfx_encoder_set_transient_index_buffer;
-
- /**
- * Set vertex buffer for draw primitive.
- * Params:
- * _stream = Vertex stream.
- * _handle = Vertex buffer.
- * _startVertex = First vertex to render.
- * _numVertices = Number of vertices to render.
- */
- alias da_bgfx_encoder_set_vertex_buffer = void function(bgfx_encoder_t* _this, ubyte _stream, bgfx_vertex_buffer_handle_t _handle, uint _startVertex, uint _numVertices);
- da_bgfx_encoder_set_vertex_buffer bgfx_encoder_set_vertex_buffer;
-
- /**
- * Set vertex buffer for draw primitive.
- * Params:
- * _stream = Vertex stream.
- * _handle = Vertex buffer.
- * _startVertex = First vertex to render.
- * _numVertices = Number of vertices to render.
- * _layoutHandle = Vertex layout for aliasing vertex buffer. If invalid
- * handle is used, vertex layout used for creation
- * of vertex buffer will be used.
- */
- alias da_bgfx_encoder_set_vertex_buffer_with_layout = void function(bgfx_encoder_t* _this, ubyte _stream, bgfx_vertex_buffer_handle_t _handle, uint _startVertex, uint _numVertices, bgfx_vertex_layout_handle_t _layoutHandle);
- da_bgfx_encoder_set_vertex_buffer_with_layout bgfx_encoder_set_vertex_buffer_with_layout;
-
- /**
- * Set vertex buffer for draw primitive.
- * Params:
- * _stream = Vertex stream.
- * _handle = Dynamic vertex buffer.
- * _startVertex = First vertex to render.
- * _numVertices = Number of vertices to render.
- */
- alias da_bgfx_encoder_set_dynamic_vertex_buffer = void function(bgfx_encoder_t* _this, ubyte _stream, bgfx_dynamic_vertex_buffer_handle_t _handle, uint _startVertex, uint _numVertices);
- da_bgfx_encoder_set_dynamic_vertex_buffer bgfx_encoder_set_dynamic_vertex_buffer;
-
- alias da_bgfx_encoder_set_dynamic_vertex_buffer_with_layout = void function(bgfx_encoder_t* _this, ubyte _stream, bgfx_dynamic_vertex_buffer_handle_t _handle, uint _startVertex, uint _numVertices, bgfx_vertex_layout_handle_t _layoutHandle);
- da_bgfx_encoder_set_dynamic_vertex_buffer_with_layout bgfx_encoder_set_dynamic_vertex_buffer_with_layout;
-
- /**
- * Set vertex buffer for draw primitive.
- * Params:
- * _stream = Vertex stream.
- * _tvb = Transient vertex buffer.
- * _startVertex = First vertex to render.
- * _numVertices = Number of vertices to render.
- */
- alias da_bgfx_encoder_set_transient_vertex_buffer = void function(bgfx_encoder_t* _this, ubyte _stream, const(bgfx_transient_vertex_buffer_t)* _tvb, uint _startVertex, uint _numVertices);
- da_bgfx_encoder_set_transient_vertex_buffer bgfx_encoder_set_transient_vertex_buffer;
-
- /**
- * Set vertex buffer for draw primitive.
- * Params:
- * _stream = Vertex stream.
- * _tvb = Transient vertex buffer.
- * _startVertex = First vertex to render.
- * _numVertices = Number of vertices to render.
- * _layoutHandle = Vertex layout for aliasing vertex buffer. If invalid
- * handle is used, vertex layout used for creation
- * of vertex buffer will be used.
- */
- alias da_bgfx_encoder_set_transient_vertex_buffer_with_layout = void function(bgfx_encoder_t* _this, ubyte _stream, const(bgfx_transient_vertex_buffer_t)* _tvb, uint _startVertex, uint _numVertices, bgfx_vertex_layout_handle_t _layoutHandle);
- da_bgfx_encoder_set_transient_vertex_buffer_with_layout bgfx_encoder_set_transient_vertex_buffer_with_layout;
-
- /**
- * Set number of vertices for auto generated vertices use in conjunction
- * with gl_VertexID.
- * Attention: Availability depends on: `BGFX_CAPS_VERTEX_ID`.
- * Params:
- * _numVertices = Number of vertices.
- */
- alias da_bgfx_encoder_set_vertex_count = void function(bgfx_encoder_t* _this, uint _numVertices);
- da_bgfx_encoder_set_vertex_count bgfx_encoder_set_vertex_count;
-
- /**
- * Set instance data buffer for draw primitive.
- * Params:
- * _idb = Transient instance data buffer.
- * _start = First instance data.
- * _num = Number of data instances.
- */
- alias da_bgfx_encoder_set_instance_data_buffer = void function(bgfx_encoder_t* _this, const(bgfx_instance_data_buffer_t)* _idb, uint _start, uint _num);
- da_bgfx_encoder_set_instance_data_buffer bgfx_encoder_set_instance_data_buffer;
-
- /**
- * Set instance data buffer for draw primitive.
- * Params:
- * _handle = Vertex buffer.
- * _startVertex = First instance data.
- * _num = Number of data instances.
- * Set instance data buffer for draw primitive.
- */
- alias da_bgfx_encoder_set_instance_data_from_vertex_buffer = void function(bgfx_encoder_t* _this, bgfx_vertex_buffer_handle_t _handle, uint _startVertex, uint _num);
- da_bgfx_encoder_set_instance_data_from_vertex_buffer bgfx_encoder_set_instance_data_from_vertex_buffer;
-
- /**
- * Set instance data buffer for draw primitive.
- * Params:
- * _handle = Dynamic vertex buffer.
- * _startVertex = First instance data.
- * _num = Number of data instances.
- */
- alias da_bgfx_encoder_set_instance_data_from_dynamic_vertex_buffer = void function(bgfx_encoder_t* _this, bgfx_dynamic_vertex_buffer_handle_t _handle, uint _startVertex, uint _num);
- da_bgfx_encoder_set_instance_data_from_dynamic_vertex_buffer bgfx_encoder_set_instance_data_from_dynamic_vertex_buffer;
-
- /**
- * Set number of instances for auto generated instances use in conjunction
- * with gl_InstanceID.
- * Attention: Availability depends on: `BGFX_CAPS_VERTEX_ID`.
- */
- alias da_bgfx_encoder_set_instance_count = void function(bgfx_encoder_t* _this, uint _numInstances);
- da_bgfx_encoder_set_instance_count bgfx_encoder_set_instance_count;
-
- /**
- * Set texture stage for draw primitive.
- * Params:
- * _stage = Texture unit.
- * _sampler = Program sampler.
- * _handle = Texture handle.
- * _flags = Texture sampling mode. Default value UINT32_MAX uses
- * texture sampling settings from the texture.
- * - `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.
- */
- alias da_bgfx_encoder_set_texture = void function(bgfx_encoder_t* _this, ubyte _stage, bgfx_uniform_handle_t _sampler, bgfx_texture_handle_t _handle, uint _flags);
- da_bgfx_encoder_set_texture bgfx_encoder_set_texture;
-
- /**
- * Submit an empty primitive for rendering. Uniforms and draw state
- * will be applied but no geometry will be submitted. Useful in cases
- * when no other draw/compute primitive is submitted to view, but it's
- * desired to execute clear view.
- * Remarks:
- * These empty draw calls will sort before ordinary draw calls.
- * Params:
- * _id = View id.
- */
- alias da_bgfx_encoder_touch = void function(bgfx_encoder_t* _this, bgfx_view_id_t _id);
- da_bgfx_encoder_touch bgfx_encoder_touch;
-
- /**
- * Submit primitive for rendering.
- * Params:
- * _id = View id.
- * _program = Program.
- * _depth = Depth for sorting.
- * _flags = Discard or preserve states. See `BGFX_DISCARD_*`.
- */
- alias da_bgfx_encoder_submit = void function(bgfx_encoder_t* _this, bgfx_view_id_t _id, bgfx_program_handle_t _program, uint _depth, ubyte _flags);
- da_bgfx_encoder_submit bgfx_encoder_submit;
-
- /**
- * Submit primitive with occlusion query for rendering.
- * Params:
- * _id = View id.
- * _program = Program.
- * _occlusionQuery = Occlusion query.
- * _depth = Depth for sorting.
- * _flags = Discard or preserve states. See `BGFX_DISCARD_*`.
- */
- alias da_bgfx_encoder_submit_occlusion_query = void function(bgfx_encoder_t* _this, bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_occlusion_query_handle_t _occlusionQuery, uint _depth, ubyte _flags);
- da_bgfx_encoder_submit_occlusion_query bgfx_encoder_submit_occlusion_query;
-
- /**
- * Submit primitive for rendering with index and instance data info from
- * indirect buffer.
- * Attention: Availability depends on: `BGFX_CAPS_DRAW_INDIRECT`.
- * Params:
- * _id = View id.
- * _program = Program.
- * _indirectHandle = Indirect buffer.
- * _start = First element in indirect buffer.
- * _num = Number of draws.
- * _depth = Depth for sorting.
- * _flags = Discard or preserve states. See `BGFX_DISCARD_*`.
- */
- alias da_bgfx_encoder_submit_indirect = void function(bgfx_encoder_t* _this, bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_indirect_buffer_handle_t _indirectHandle, ushort _start, ushort _num, uint _depth, ubyte _flags);
- da_bgfx_encoder_submit_indirect bgfx_encoder_submit_indirect;
-
- /**
- * Submit primitive for rendering with index and instance data info and
- * draw count from indirect buffers.
- * Attention: Availability depends on: `BGFX_CAPS_DRAW_INDIRECT_COUNT`.
- * Params:
- * _id = View id.
- * _program = Program.
- * _indirectHandle = Indirect buffer.
- * _start = First element in indirect buffer.
- * _numHandle = Buffer for number of draws. Must be
- * created with `BGFX_BUFFER_INDEX32` and `BGFX_BUFFER_DRAW_INDIRECT`.
- * _numIndex = Element in number buffer.
- * _numMax = Max number of draws.
- * _depth = Depth for sorting.
- * _flags = Discard or preserve states. See `BGFX_DISCARD_*`.
- */
- alias da_bgfx_encoder_submit_indirect_count = void function(bgfx_encoder_t* _this, bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_indirect_buffer_handle_t _indirectHandle, ushort _start, bgfx_index_buffer_handle_t _numHandle, uint _numIndex, ushort _numMax, uint _depth, ubyte _flags);
- da_bgfx_encoder_submit_indirect_count bgfx_encoder_submit_indirect_count;
-
- /**
- * Set compute index buffer.
- * Params:
- * _stage = Compute stage.
- * _handle = Index buffer handle.
- * _access = Buffer access. See `Access::Enum`.
- */
- alias da_bgfx_encoder_set_compute_index_buffer = void function(bgfx_encoder_t* _this, ubyte _stage, bgfx_index_buffer_handle_t _handle, bgfx_access_t _access);
- da_bgfx_encoder_set_compute_index_buffer bgfx_encoder_set_compute_index_buffer;
-
- /**
- * Set compute vertex buffer.
- * Params:
- * _stage = Compute stage.
- * _handle = Vertex buffer handle.
- * _access = Buffer access. See `Access::Enum`.
- */
- alias da_bgfx_encoder_set_compute_vertex_buffer = void function(bgfx_encoder_t* _this, ubyte _stage, bgfx_vertex_buffer_handle_t _handle, bgfx_access_t _access);
- da_bgfx_encoder_set_compute_vertex_buffer bgfx_encoder_set_compute_vertex_buffer;
-
- /**
- * Set compute dynamic index buffer.
- * Params:
- * _stage = Compute stage.
- * _handle = Dynamic index buffer handle.
- * _access = Buffer access. See `Access::Enum`.
- */
- alias da_bgfx_encoder_set_compute_dynamic_index_buffer = void function(bgfx_encoder_t* _this, ubyte _stage, bgfx_dynamic_index_buffer_handle_t _handle, bgfx_access_t _access);
- da_bgfx_encoder_set_compute_dynamic_index_buffer bgfx_encoder_set_compute_dynamic_index_buffer;
-
- /**
- * Set compute dynamic vertex buffer.
- * Params:
- * _stage = Compute stage.
- * _handle = Dynamic vertex buffer handle.
- * _access = Buffer access. See `Access::Enum`.
- */
- alias da_bgfx_encoder_set_compute_dynamic_vertex_buffer = void function(bgfx_encoder_t* _this, ubyte _stage, bgfx_dynamic_vertex_buffer_handle_t _handle, bgfx_access_t _access);
- da_bgfx_encoder_set_compute_dynamic_vertex_buffer bgfx_encoder_set_compute_dynamic_vertex_buffer;
-
- /**
- * Set compute indirect buffer.
- * Params:
- * _stage = Compute stage.
- * _handle = Indirect buffer handle.
- * _access = Buffer access. See `Access::Enum`.
- */
- alias da_bgfx_encoder_set_compute_indirect_buffer = void function(bgfx_encoder_t* _this, ubyte _stage, bgfx_indirect_buffer_handle_t _handle, bgfx_access_t _access);
- da_bgfx_encoder_set_compute_indirect_buffer bgfx_encoder_set_compute_indirect_buffer;
-
- /**
- * Set compute image from texture.
- * Params:
- * _stage = Compute stage.
- * _handle = Texture handle.
- * _mip = Mip level.
- * _access = Image access. See `Access::Enum`.
- * _format = Texture format. See: `TextureFormat::Enum`.
- */
- alias da_bgfx_encoder_set_image = void function(bgfx_encoder_t* _this, ubyte _stage, bgfx_texture_handle_t _handle, ubyte _mip, bgfx_access_t _access, bgfx_texture_format_t _format);
- da_bgfx_encoder_set_image bgfx_encoder_set_image;
-
- /**
- * Dispatch compute.
- * Params:
- * _id = View id.
- * _program = Compute program.
- * _numX = Number of groups X.
- * _numY = Number of groups Y.
- * _numZ = Number of groups Z.
- * _flags = Discard or preserve states. See `BGFX_DISCARD_*`.
- */
- alias da_bgfx_encoder_dispatch = void function(bgfx_encoder_t* _this, bgfx_view_id_t _id, bgfx_program_handle_t _program, uint _numX, uint _numY, uint _numZ, ubyte _flags);
- da_bgfx_encoder_dispatch bgfx_encoder_dispatch;
-
- /**
- * Dispatch compute indirect.
- * Params:
- * _id = View id.
- * _program = Compute program.
- * _indirectHandle = Indirect buffer.
- * _start = First element in indirect buffer.
- * _num = Number of dispatches.
- * _flags = Discard or preserve states. See `BGFX_DISCARD_*`.
- */
- alias da_bgfx_encoder_dispatch_indirect = void function(bgfx_encoder_t* _this, bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_indirect_buffer_handle_t _indirectHandle, ushort _start, ushort _num, ubyte _flags);
- da_bgfx_encoder_dispatch_indirect bgfx_encoder_dispatch_indirect;
-
- /**
- * Discard previously set state for draw or compute call.
- * Params:
- * _flags = Discard or preserve states. See `BGFX_DISCARD_*`.
- */
- alias da_bgfx_encoder_discard = void function(bgfx_encoder_t* _this, ubyte _flags);
- da_bgfx_encoder_discard bgfx_encoder_discard;
-
- /**
- * Blit 2D texture region between two 2D textures.
- * Attention: Destination texture must be created with `BGFX_TEXTURE_BLIT_DST` flag.
- * Attention: Availability depends on: `BGFX_CAPS_TEXTURE_BLIT`.
- * Params:
- * _id = View id.
- * _dst = Destination texture handle.
- * _dstMip = Destination texture mip level.
- * _dstX = Destination texture X position.
- * _dstY = Destination texture Y position.
- * _dstZ = If texture is 2D this argument should be 0. If destination texture is cube
- * this argument represents destination texture cube face. For 3D texture this argument
- * represents destination texture Z position.
- * _src = Source texture handle.
- * _srcMip = Source texture mip level.
- * _srcX = Source texture X position.
- * _srcY = Source texture Y position.
- * _srcZ = If texture is 2D this argument should be 0. If source texture is cube
- * this argument represents source texture cube face. For 3D texture this argument
- * represents source texture Z position.
- * _width = Width of region.
- * _height = Height of region.
- * _depth = If texture is 3D this argument represents depth of region, otherwise it's
- * unused.
- */
- alias da_bgfx_encoder_blit = void function(bgfx_encoder_t* _this, bgfx_view_id_t _id, bgfx_texture_handle_t _dst, ubyte _dstMip, ushort _dstX, ushort _dstY, ushort _dstZ, bgfx_texture_handle_t _src, ubyte _srcMip, ushort _srcX, ushort _srcY, ushort _srcZ, ushort _width, ushort _height, ushort _depth);
- da_bgfx_encoder_blit bgfx_encoder_blit;
-
- /**
- * Request screen shot of window back buffer.
- * Remarks:
- * `bgfx::CallbackI::screenShot` must be implemented.
- * Attention: Frame buffer handle must be created with OS' target native window handle.
- * Params:
- * _handle = Frame buffer handle. If handle is `BGFX_INVALID_HANDLE` request will be
- * made for main window back buffer.
- * _filePath = Will be passed to `bgfx::CallbackI::screenShot` callback.
- */
- alias da_bgfx_request_screen_shot = void function(bgfx_frame_buffer_handle_t _handle, const(char)* _filePath);
- da_bgfx_request_screen_shot bgfx_request_screen_shot;
-
- /**
- * Render frame.
- * Attention: `bgfx::renderFrame` is blocking call. It waits for
- * `bgfx::frame` to be called from API thread to process frame.
- * If timeout value is passed call will timeout and return even
- * if `bgfx::frame` is not called.
- * Warning: This call should be only used on platforms that don't
- * allow creating separate rendering thread. If it is called before
- * to bgfx::init, render thread won't be created by bgfx::init call.
- * Params:
- * _msecs = Timeout in milliseconds.
- */
- alias da_bgfx_render_frame = bgfx_render_frame_t function(int _msecs);
- da_bgfx_render_frame bgfx_render_frame;
-
- /**
- * Set platform data.
- * Warning: Must be called before `bgfx::init`.
- * Params:
- * _data = Platform data.
- */
- alias da_bgfx_set_platform_data = void function(const(bgfx_platform_data_t)* _data);
- da_bgfx_set_platform_data bgfx_set_platform_data;
-
- /**
- * Get internal data for interop.
- * Attention: It's expected you understand some bgfx internals before you
- * use this call.
- * Warning: Must be called only on render thread.
- */
- alias da_bgfx_get_internal_data = const(bgfx_internal_data_t)* function();
- da_bgfx_get_internal_data bgfx_get_internal_data;
-
- /**
- * Override internal texture with externally created texture. Previously
- * created internal texture will released.
- * Attention: It's expected you understand some bgfx internals before you
- * use this call.
- * Warning: Must be called only on render thread.
- * Params:
- * _handle = Texture handle.
- * _ptr = Native API pointer to texture.
- */
- alias da_bgfx_override_internal_texture_ptr = ulong function(bgfx_texture_handle_t _handle, ulong _ptr);
- da_bgfx_override_internal_texture_ptr bgfx_override_internal_texture_ptr;
-
- /**
- * Override internal texture by creating new texture. Previously created
- * internal texture will released.
- * Attention: It's expected you understand some bgfx internals before you
- * use this call.
- * Returns: Native API pointer to texture. If result is 0, texture is not created yet from the
- * main thread.
- * Warning: Must be called only on render thread.
- * Params:
- * _handle = Texture handle.
- * _width = Width.
- * _height = Height.
- * _numMips = Number of mip-maps.
- * _format = Texture format. See: `TextureFormat::Enum`.
- * _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.
- */
- alias da_bgfx_override_internal_texture = ulong function(bgfx_texture_handle_t _handle, ushort _width, ushort _height, ubyte _numMips, bgfx_texture_format_t _format, ulong _flags);
- da_bgfx_override_internal_texture bgfx_override_internal_texture;
-
- /**
- * Sets a debug marker. This allows you to group graphics calls together for easy browsing in
- * graphics debugging tools.
- * Params:
- * _marker = Marker string.
- */
- alias da_bgfx_set_marker = void function(const(char)* _marker);
- da_bgfx_set_marker bgfx_set_marker;
-
- /**
- * Set render states for draw primitive.
- * Remarks:
- * 1. To set up more complex states use:
- * `BGFX_STATE_ALPHA_REF(_ref)`,
- * `BGFX_STATE_POINT_SIZE(_size)`,
- * `BGFX_STATE_BLEND_FUNC(_src, _dst)`,
- * `BGFX_STATE_BLEND_FUNC_SEPARATE(_srcRGB, _dstRGB, _srcA, _dstA)`,
- * `BGFX_STATE_BLEND_EQUATION(_equation)`,
- * `BGFX_STATE_BLEND_EQUATION_SEPARATE(_equationRGB, _equationA)`
- * 2. `BGFX_STATE_BLEND_EQUATION_ADD` is set when no other blend
- * equation is specified.
- * Params:
- * _state = State flags. Default state for primitive type is
- * triangles. See: `BGFX_STATE_DEFAULT`.
- * - `BGFX_STATE_DEPTH_TEST_*` - Depth test function.
- * - `BGFX_STATE_BLEND_*` - See remark 1 about BGFX_STATE_BLEND_FUNC.
- * - `BGFX_STATE_BLEND_EQUATION_*` - See remark 2.
- * - `BGFX_STATE_CULL_*` - Backface culling mode.
- * - `BGFX_STATE_WRITE_*` - Enable R, G, B, A or Z write.
- * - `BGFX_STATE_MSAA` - Enable hardware multisample antialiasing.
- * - `BGFX_STATE_PT_[TRISTRIP/LINES/POINTS]` - Primitive type.
- * _rgba = Sets blend factor used by `BGFX_STATE_BLEND_FACTOR` and
- * `BGFX_STATE_BLEND_INV_FACTOR` blend modes.
- */
- alias da_bgfx_set_state = void function(ulong _state, uint _rgba);
- da_bgfx_set_state bgfx_set_state;
-
- /**
- * Set condition for rendering.
- * Params:
- * _handle = Occlusion query handle.
- * _visible = Render if occlusion query is visible.
- */
- alias da_bgfx_set_condition = void function(bgfx_occlusion_query_handle_t _handle, bool _visible);
- da_bgfx_set_condition bgfx_set_condition;
-
- /**
- * Set stencil test state.
- * Params:
- * _fstencil = Front stencil state.
- * _bstencil = Back stencil state. If back is set to `BGFX_STENCIL_NONE`
- * _fstencil is applied to both front and back facing primitives.
- */
- alias da_bgfx_set_stencil = void function(uint _fstencil, uint _bstencil);
- da_bgfx_set_stencil bgfx_set_stencil;
-
- /**
- * Set scissor for draw primitive.
- * Remarks:
- * To scissor for all primitives in view see `bgfx::setViewScissor`.
- * Params:
- * _x = Position x from the left corner of the window.
- * _y = Position y from the top corner of the window.
- * _width = Width of view scissor region.
- * _height = Height of view scissor region.
- */
- alias da_bgfx_set_scissor = ushort function(ushort _x, ushort _y, ushort _width, ushort _height);
- da_bgfx_set_scissor bgfx_set_scissor;
-
- /**
- * Set scissor from cache for draw primitive.
- * Remarks:
- * To scissor for all primitives in view see `bgfx::setViewScissor`.
- * Params:
- * _cache = Index in scissor cache.
- */
- alias da_bgfx_set_scissor_cached = void function(ushort _cache);
- da_bgfx_set_scissor_cached bgfx_set_scissor_cached;
-
- /**
- * Set model matrix for draw primitive. If it is not called,
- * the model will be rendered with an identity model matrix.
- * Params:
- * _mtx = Pointer to first matrix in array.
- * _num = Number of matrices in array.
- */
- alias da_bgfx_set_transform = uint function(const(void)* _mtx, ushort _num);
- da_bgfx_set_transform bgfx_set_transform;
-
- /**
- * Set model matrix from matrix cache for draw primitive.
- * Params:
- * _cache = Index in matrix cache.
- * _num = Number of matrices from cache.
- */
- alias da_bgfx_set_transform_cached = void function(uint _cache, ushort _num);
- da_bgfx_set_transform_cached bgfx_set_transform_cached;
-
- /**
- * Reserve matrices in internal matrix cache.
- * Attention: Pointer returned can be modified until `bgfx::frame` is called.
- * Params:
- * _transform = Pointer to `Transform` structure.
- * _num = Number of matrices.
- */
- alias da_bgfx_alloc_transform = uint function(bgfx_transform_t* _transform, ushort _num);
- da_bgfx_alloc_transform bgfx_alloc_transform;
-
- /**
- * Set shader uniform parameter for draw primitive.
- * Params:
- * _handle = Uniform.
- * _value = Pointer to uniform data.
- * _num = Number of elements. Passing `UINT16_MAX` will
- * use the _num passed on uniform creation.
- */
- alias da_bgfx_set_uniform = void function(bgfx_uniform_handle_t _handle, const(void)* _value, ushort _num);
- da_bgfx_set_uniform bgfx_set_uniform;
-
- /**
- * Set index buffer for draw primitive.
- * Params:
- * _handle = Index buffer.
- * _firstIndex = First index to render.
- * _numIndices = Number of indices to render.
- */
- alias da_bgfx_set_index_buffer = void function(bgfx_index_buffer_handle_t _handle, uint _firstIndex, uint _numIndices);
- da_bgfx_set_index_buffer bgfx_set_index_buffer;
-
- /**
- * Set index buffer for draw primitive.
- * Params:
- * _handle = Dynamic index buffer.
- * _firstIndex = First index to render.
- * _numIndices = Number of indices to render.
- */
- alias da_bgfx_set_dynamic_index_buffer = void function(bgfx_dynamic_index_buffer_handle_t _handle, uint _firstIndex, uint _numIndices);
- da_bgfx_set_dynamic_index_buffer bgfx_set_dynamic_index_buffer;
-
- /**
- * Set index buffer for draw primitive.
- * Params:
- * _tib = Transient index buffer.
- * _firstIndex = First index to render.
- * _numIndices = Number of indices to render.
- */
- alias da_bgfx_set_transient_index_buffer = void function(const(bgfx_transient_index_buffer_t)* _tib, uint _firstIndex, uint _numIndices);
- da_bgfx_set_transient_index_buffer bgfx_set_transient_index_buffer;
-
- /**
- * Set vertex buffer for draw primitive.
- * Params:
- * _stream = Vertex stream.
- * _handle = Vertex buffer.
- * _startVertex = First vertex to render.
- * _numVertices = Number of vertices to render.
- */
- alias da_bgfx_set_vertex_buffer = void function(ubyte _stream, bgfx_vertex_buffer_handle_t _handle, uint _startVertex, uint _numVertices);
- da_bgfx_set_vertex_buffer bgfx_set_vertex_buffer;
-
- /**
- * Set vertex buffer for draw primitive.
- * Params:
- * _stream = Vertex stream.
- * _handle = Vertex buffer.
- * _startVertex = First vertex to render.
- * _numVertices = Number of vertices to render.
- * _layoutHandle = Vertex layout for aliasing vertex buffer. If invalid
- * handle is used, vertex layout used for creation
- * of vertex buffer will be used.
- */
- alias da_bgfx_set_vertex_buffer_with_layout = void function(ubyte _stream, bgfx_vertex_buffer_handle_t _handle, uint _startVertex, uint _numVertices, bgfx_vertex_layout_handle_t _layoutHandle);
- da_bgfx_set_vertex_buffer_with_layout bgfx_set_vertex_buffer_with_layout;
-
- /**
- * Set vertex buffer for draw primitive.
- * Params:
- * _stream = Vertex stream.
- * _handle = Dynamic vertex buffer.
- * _startVertex = First vertex to render.
- * _numVertices = Number of vertices to render.
- */
- alias da_bgfx_set_dynamic_vertex_buffer = void function(ubyte _stream, bgfx_dynamic_vertex_buffer_handle_t _handle, uint _startVertex, uint _numVertices);
- da_bgfx_set_dynamic_vertex_buffer bgfx_set_dynamic_vertex_buffer;
-
- /**
- * Set vertex buffer for draw primitive.
- * Params:
- * _stream = Vertex stream.
- * _handle = Dynamic vertex buffer.
- * _startVertex = First vertex to render.
- * _numVertices = Number of vertices to render.
- * _layoutHandle = Vertex layout for aliasing vertex buffer. If invalid
- * handle is used, vertex layout used for creation
- * of vertex buffer will be used.
- */
- alias da_bgfx_set_dynamic_vertex_buffer_with_layout = void function(ubyte _stream, bgfx_dynamic_vertex_buffer_handle_t _handle, uint _startVertex, uint _numVertices, bgfx_vertex_layout_handle_t _layoutHandle);
- da_bgfx_set_dynamic_vertex_buffer_with_layout bgfx_set_dynamic_vertex_buffer_with_layout;
-
- /**
- * Set vertex buffer for draw primitive.
- * Params:
- * _stream = Vertex stream.
- * _tvb = Transient vertex buffer.
- * _startVertex = First vertex to render.
- * _numVertices = Number of vertices to render.
- */
- alias da_bgfx_set_transient_vertex_buffer = void function(ubyte _stream, const(bgfx_transient_vertex_buffer_t)* _tvb, uint _startVertex, uint _numVertices);
- da_bgfx_set_transient_vertex_buffer bgfx_set_transient_vertex_buffer;
-
- /**
- * Set vertex buffer for draw primitive.
- * Params:
- * _stream = Vertex stream.
- * _tvb = Transient vertex buffer.
- * _startVertex = First vertex to render.
- * _numVertices = Number of vertices to render.
- * _layoutHandle = Vertex layout for aliasing vertex buffer. If invalid
- * handle is used, vertex layout used for creation
- * of vertex buffer will be used.
- */
- alias da_bgfx_set_transient_vertex_buffer_with_layout = void function(ubyte _stream, const(bgfx_transient_vertex_buffer_t)* _tvb, uint _startVertex, uint _numVertices, bgfx_vertex_layout_handle_t _layoutHandle);
- da_bgfx_set_transient_vertex_buffer_with_layout bgfx_set_transient_vertex_buffer_with_layout;
-
- /**
- * Set number of vertices for auto generated vertices use in conjunction
- * with gl_VertexID.
- * Attention: Availability depends on: `BGFX_CAPS_VERTEX_ID`.
- * Params:
- * _numVertices = Number of vertices.
- */
- alias da_bgfx_set_vertex_count = void function(uint _numVertices);
- da_bgfx_set_vertex_count bgfx_set_vertex_count;
-
- /**
- * Set instance data buffer for draw primitive.
- * Params:
- * _idb = Transient instance data buffer.
- * _start = First instance data.
- * _num = Number of data instances.
- */
- alias da_bgfx_set_instance_data_buffer = void function(const(bgfx_instance_data_buffer_t)* _idb, uint _start, uint _num);
- da_bgfx_set_instance_data_buffer bgfx_set_instance_data_buffer;
-
- /**
- * Set instance data buffer for draw primitive.
- * Params:
- * _handle = Vertex buffer.
- * _startVertex = First instance data.
- * _num = Number of data instances.
- * Set instance data buffer for draw primitive.
- */
- alias da_bgfx_set_instance_data_from_vertex_buffer = void function(bgfx_vertex_buffer_handle_t _handle, uint _startVertex, uint _num);
- da_bgfx_set_instance_data_from_vertex_buffer bgfx_set_instance_data_from_vertex_buffer;
-
- /**
- * Set instance data buffer for draw primitive.
- * Params:
- * _handle = Dynamic vertex buffer.
- * _startVertex = First instance data.
- * _num = Number of data instances.
- */
- alias da_bgfx_set_instance_data_from_dynamic_vertex_buffer = void function(bgfx_dynamic_vertex_buffer_handle_t _handle, uint _startVertex, uint _num);
- da_bgfx_set_instance_data_from_dynamic_vertex_buffer bgfx_set_instance_data_from_dynamic_vertex_buffer;
-
- /**
- * Set number of instances for auto generated instances use in conjunction
- * with gl_InstanceID.
- * Attention: Availability depends on: `BGFX_CAPS_VERTEX_ID`.
- */
- alias da_bgfx_set_instance_count = void function(uint _numInstances);
- da_bgfx_set_instance_count bgfx_set_instance_count;
-
- /**
- * Set texture stage for draw primitive.
- * Params:
- * _stage = Texture unit.
- * _sampler = Program sampler.
- * _handle = Texture handle.
- * _flags = Texture sampling mode. Default value UINT32_MAX uses
- * texture sampling settings from the texture.
- * - `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.
- */
- alias da_bgfx_set_texture = void function(ubyte _stage, bgfx_uniform_handle_t _sampler, bgfx_texture_handle_t _handle, uint _flags);
- da_bgfx_set_texture bgfx_set_texture;
-
- /**
- * Submit an empty primitive for rendering. Uniforms and draw state
- * will be applied but no geometry will be submitted.
- * Remarks:
- * These empty draw calls will sort before ordinary draw calls.
- * Params:
- * _id = View id.
- */
- alias da_bgfx_touch = void function(bgfx_view_id_t _id);
- da_bgfx_touch bgfx_touch;
-
- /**
- * Submit primitive for rendering.
- * Params:
- * _id = View id.
- * _program = Program.
- * _depth = Depth for sorting.
- * _flags = Which states to discard for next draw. See `BGFX_DISCARD_*`.
- */
- alias da_bgfx_submit = void function(bgfx_view_id_t _id, bgfx_program_handle_t _program, uint _depth, ubyte _flags);
- da_bgfx_submit bgfx_submit;
-
- /**
- * Submit primitive with occlusion query for rendering.
- * Params:
- * _id = View id.
- * _program = Program.
- * _occlusionQuery = Occlusion query.
- * _depth = Depth for sorting.
- * _flags = Which states to discard for next draw. See `BGFX_DISCARD_*`.
- */
- alias da_bgfx_submit_occlusion_query = void function(bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_occlusion_query_handle_t _occlusionQuery, uint _depth, ubyte _flags);
- da_bgfx_submit_occlusion_query bgfx_submit_occlusion_query;
-
- /**
- * Submit primitive for rendering with index and instance data info from
- * indirect buffer.
- * Attention: Availability depends on: `BGFX_CAPS_DRAW_INDIRECT`.
- * Params:
- * _id = View id.
- * _program = Program.
- * _indirectHandle = Indirect buffer.
- * _start = First element in indirect buffer.
- * _num = Number of draws.
- * _depth = Depth for sorting.
- * _flags = Which states to discard for next draw. See `BGFX_DISCARD_*`.
- */
- alias da_bgfx_submit_indirect = void function(bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_indirect_buffer_handle_t _indirectHandle, ushort _start, ushort _num, uint _depth, ubyte _flags);
- da_bgfx_submit_indirect bgfx_submit_indirect;
-
- /**
- * Submit primitive for rendering with index and instance data info and
- * draw count from indirect buffers.
- * Attention: Availability depends on: `BGFX_CAPS_DRAW_INDIRECT_COUNT`.
- * Params:
- * _id = View id.
- * _program = Program.
- * _indirectHandle = Indirect buffer.
- * _start = First element in indirect buffer.
- * _numHandle = Buffer for number of draws. Must be
- * created with `BGFX_BUFFER_INDEX32` and `BGFX_BUFFER_DRAW_INDIRECT`.
- * _numIndex = Element in number buffer.
- * _numMax = Max number of draws.
- * _depth = Depth for sorting.
- * _flags = Which states to discard for next draw. See `BGFX_DISCARD_*`.
- */
- alias da_bgfx_submit_indirect_count = void function(bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_indirect_buffer_handle_t _indirectHandle, ushort _start, bgfx_index_buffer_handle_t _numHandle, uint _numIndex, ushort _numMax, uint _depth, ubyte _flags);
- da_bgfx_submit_indirect_count bgfx_submit_indirect_count;
-
- /**
- * Set compute index buffer.
- * Params:
- * _stage = Compute stage.
- * _handle = Index buffer handle.
- * _access = Buffer access. See `Access::Enum`.
- */
- alias da_bgfx_set_compute_index_buffer = void function(ubyte _stage, bgfx_index_buffer_handle_t _handle, bgfx_access_t _access);
- da_bgfx_set_compute_index_buffer bgfx_set_compute_index_buffer;
-
- /**
- * Set compute vertex buffer.
- * Params:
- * _stage = Compute stage.
- * _handle = Vertex buffer handle.
- * _access = Buffer access. See `Access::Enum`.
- */
- alias da_bgfx_set_compute_vertex_buffer = void function(ubyte _stage, bgfx_vertex_buffer_handle_t _handle, bgfx_access_t _access);
- da_bgfx_set_compute_vertex_buffer bgfx_set_compute_vertex_buffer;
-
- /**
- * Set compute dynamic index buffer.
- * Params:
- * _stage = Compute stage.
- * _handle = Dynamic index buffer handle.
- * _access = Buffer access. See `Access::Enum`.
- */
- alias da_bgfx_set_compute_dynamic_index_buffer = void function(ubyte _stage, bgfx_dynamic_index_buffer_handle_t _handle, bgfx_access_t _access);
- da_bgfx_set_compute_dynamic_index_buffer bgfx_set_compute_dynamic_index_buffer;
-
- /**
- * Set compute dynamic vertex buffer.
- * Params:
- * _stage = Compute stage.
- * _handle = Dynamic vertex buffer handle.
- * _access = Buffer access. See `Access::Enum`.
- */
- alias da_bgfx_set_compute_dynamic_vertex_buffer = void function(ubyte _stage, bgfx_dynamic_vertex_buffer_handle_t _handle, bgfx_access_t _access);
- da_bgfx_set_compute_dynamic_vertex_buffer bgfx_set_compute_dynamic_vertex_buffer;
-
- /**
- * Set compute indirect buffer.
- * Params:
- * _stage = Compute stage.
- * _handle = Indirect buffer handle.
- * _access = Buffer access. See `Access::Enum`.
- */
- alias da_bgfx_set_compute_indirect_buffer = void function(ubyte _stage, bgfx_indirect_buffer_handle_t _handle, bgfx_access_t _access);
- da_bgfx_set_compute_indirect_buffer bgfx_set_compute_indirect_buffer;
-
- /**
- * Set compute image from texture.
- * Params:
- * _stage = Compute stage.
- * _handle = Texture handle.
- * _mip = Mip level.
- * _access = Image access. See `Access::Enum`.
- * _format = Texture format. See: `TextureFormat::Enum`.
- */
- alias da_bgfx_set_image = void function(ubyte _stage, bgfx_texture_handle_t _handle, ubyte _mip, bgfx_access_t _access, bgfx_texture_format_t _format);
- da_bgfx_set_image bgfx_set_image;
-
- /**
- * Dispatch compute.
- * Params:
- * _id = View id.
- * _program = Compute program.
- * _numX = Number of groups X.
- * _numY = Number of groups Y.
- * _numZ = Number of groups Z.
- * _flags = Discard or preserve states. See `BGFX_DISCARD_*`.
- */
- alias da_bgfx_dispatch = void function(bgfx_view_id_t _id, bgfx_program_handle_t _program, uint _numX, uint _numY, uint _numZ, ubyte _flags);
- da_bgfx_dispatch bgfx_dispatch;
-
- /**
- * Dispatch compute indirect.
- * Params:
- * _id = View id.
- * _program = Compute program.
- * _indirectHandle = Indirect buffer.
- * _start = First element in indirect buffer.
- * _num = Number of dispatches.
- * _flags = Discard or preserve states. See `BGFX_DISCARD_*`.
- */
- alias da_bgfx_dispatch_indirect = void function(bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_indirect_buffer_handle_t _indirectHandle, ushort _start, ushort _num, ubyte _flags);
- da_bgfx_dispatch_indirect bgfx_dispatch_indirect;
-
- /**
- * Discard previously set state for draw or compute call.
- * Params:
- * _flags = Draw/compute states to discard.
- */
- alias da_bgfx_discard = void function(ubyte _flags);
- da_bgfx_discard bgfx_discard;
-
- /**
- * Blit 2D texture region between two 2D textures.
- * Attention: Destination texture must be created with `BGFX_TEXTURE_BLIT_DST` flag.
- * Attention: Availability depends on: `BGFX_CAPS_TEXTURE_BLIT`.
- * Params:
- * _id = View id.
- * _dst = Destination texture handle.
- * _dstMip = Destination texture mip level.
- * _dstX = Destination texture X position.
- * _dstY = Destination texture Y position.
- * _dstZ = If texture is 2D this argument should be 0. If destination texture is cube
- * this argument represents destination texture cube face. For 3D texture this argument
- * represents destination texture Z position.
- * _src = Source texture handle.
- * _srcMip = Source texture mip level.
- * _srcX = Source texture X position.
- * _srcY = Source texture Y position.
- * _srcZ = If texture is 2D this argument should be 0. If source texture is cube
- * this argument represents source texture cube face. For 3D texture this argument
- * represents source texture Z position.
- * _width = Width of region.
- * _height = Height of region.
- * _depth = If texture is 3D this argument represents depth of region, otherwise it's
- * unused.
- */
- alias da_bgfx_blit = void function(bgfx_view_id_t _id, bgfx_texture_handle_t _dst, ubyte _dstMip, ushort _dstX, ushort _dstY, ushort _dstZ, bgfx_texture_handle_t _src, ubyte _srcMip, ushort _srcX, ushort _srcY, ushort _srcZ, ushort _width, ushort _height, ushort _depth);
- da_bgfx_blit bgfx_blit;
-
- }
-}
diff --git a/3rdparty/bgfx/bindings/d/package.d b/3rdparty/bgfx/bindings/d/package.d
new file mode 100644
index 00000000000..d05b8c89dca
--- /dev/null
+++ b/3rdparty/bgfx/bindings/d/package.d
@@ -0,0 +1,3573 @@
+/+
++ ┌==============================┐
++ │ AUTO GENERATED! DO NOT EDIT! │
++ └==============================┘
++/
+module bgfx;
+
+import bindbc.bgfx.config;
+
+import bindbc.common.types: va_list;
+static import bgfx.fakeenum;
+
+enum uint apiVersion = 122;
+
+alias ViewID = ushort;
+deprecated("Please use `ViewID` instead.") alias ViewId = ushort;
+
+enum invalidHandle(T) = T(ushort.max);
+
+alias ReleaseFn = void function(void* ptr, void* userData);
+
+///Memory release callback.
+
+///Color RGB/alpha/depth write. When it's not specified write will be disabled.
+alias StateWrite_ = ulong;
+enum StateWrite: StateWrite_{
+ r = 0x0000_0000_0000_0001, ///Enable R write.
+ g = 0x0000_0000_0000_0002, ///Enable G write.
+ b = 0x0000_0000_0000_0004, ///Enable B write.
+ a = 0x0000_0000_0000_0008, ///Enable alpha write.
+ z = 0x0000_0040_0000_0000, ///Enable depth write.
+ rgb = 0x0000_0000_0000_0007, ///Enable RGB write.
+ mask = 0x0000_0040_0000_000F, ///Write all channels mask.
+}
+
+///Depth test state. When `BGFX_STATE_DEPTH_` is not specified depth test will be disabled.
+alias StateDepthTest_ = ulong;
+enum StateDepthTest: StateDepthTest_{
+ less = 0x0000_0000_0000_0010, ///Enable depth test, less.
+ lEqual = 0x0000_0000_0000_0020, ///Enable depth test, less or equal.
+ equal = 0x0000_0000_0000_0030, ///Enable depth test, equal.
+ gEqual = 0x0000_0000_0000_0040, ///Enable depth test, greater or equal.
+ greater = 0x0000_0000_0000_0050, ///Enable depth test, greater.
+ notEqual = 0x0000_0000_0000_0060, ///Enable depth test, not equal.
+ never = 0x0000_0000_0000_0070, ///Enable depth test, never.
+ always = 0x0000_0000_0000_0080, ///Enable depth test, always.
+ shift = 4, ///Depth test state bit shift
+ mask = 0x0000_0000_0000_00F0, ///Depth test state bit mask
+}
+
+/**
+Use BGFX_STATE_BLEND_FUNC(_src, _dst) or BGFX_STATE_BLEND_FUNC_SEPARATE(_srcRGB, _dstRGB, _srcA, _dstA)
+helper macros.
+*/
+alias StateBlend_ = ulong;
+enum StateBlend: StateBlend_{
+ zero = 0x0000_0000_0000_1000, ///0, 0, 0, 0
+ one = 0x0000_0000_0000_2000, ///1, 1, 1, 1
+ srcColor = 0x0000_0000_0000_3000, ///Rs, Gs, Bs, As
+ srcColour = srcColor,
+ invSrcColor = 0x0000_0000_0000_4000, ///1-Rs, 1-Gs, 1-Bs, 1-As
+ invSrcColour = invSrcColor,
+ srcAlpha = 0x0000_0000_0000_5000, ///As, As, As, As
+ invSrcAlpha = 0x0000_0000_0000_6000, ///1-As, 1-As, 1-As, 1-As
+ dstAlpha = 0x0000_0000_0000_7000, ///Ad, Ad, Ad, Ad
+ invDstAlpha = 0x0000_0000_0000_8000, ///1-Ad, 1-Ad, 1-Ad ,1-Ad
+ dstColor = 0x0000_0000_0000_9000, ///Rd, Gd, Bd, Ad
+ dstColour = dstColor,
+ invDstColor = 0x0000_0000_0000_A000, ///1-Rd, 1-Gd, 1-Bd, 1-Ad
+ invDstColour = invDstColor,
+ srcAlphaSat = 0x0000_0000_0000_B000, ///f, f, f, 1; f = min(As, 1-Ad)
+ factor = 0x0000_0000_0000_C000, ///Blend factor
+ invFactor = 0x0000_0000_0000_D000, ///1-Blend factor
+ shift = 12, ///Blend state bit shift
+ mask = 0x0000_0000_0FFF_F000, ///Blend state bit mask
+}
+
+/**
+Use BGFX_STATE_BLEND_EQUATION(_equation) or BGFX_STATE_BLEND_EQUATION_SEPARATE(_equationRGB, _equationA)
+helper macros.
+*/
+alias StateBlendEquation_ = ulong;
+enum StateBlendEquation: StateBlendEquation_{
+ add = 0x0000_0000_0000_0000, ///Blend add: src + dst.
+ sub = 0x0000_0000_1000_0000, ///Blend subtract: src - dst.
+ revSub = 0x0000_0000_2000_0000, ///Blend reverse subtract: dst - src.
+ min = 0x0000_0000_3000_0000, ///Blend min: min(src, dst).
+ max = 0x0000_0000_4000_0000, ///Blend max: max(src, dst).
+ shift = 28, ///Blend equation bit shift
+ mask = 0x0000_0003_F000_0000, ///Blend equation bit mask
+}
+
+///Cull state. When `BGFX_STATE_CULL_*` is not specified culling will be disabled.
+alias StateCull_ = ulong;
+enum StateCull: StateCull_{
+ cw = 0x0000_0010_0000_0000, ///Cull clockwise triangles.
+ ccw = 0x0000_0020_0000_0000, ///Cull counter-clockwise triangles.
+ acw = ccw,
+ shift = 36, ///Culling mode bit shift
+ mask = 0x0000_0030_0000_0000, ///Culling mode bit mask
+}
+
+///Alpha reference value.
+alias StateAlphaRef_ = ulong;
+enum StateAlphaRef: StateAlphaRef_{
+ shift = 40, ///Alpha reference bit shift
+ mask = 0x0000_FF00_0000_0000, ///Alpha reference bit mask
+}
+StateAlphaRef_ toStateAlphaRef(ulong v){ return (v << StateAlphaRef.shift) & StateAlphaRef.mask; }
+
+alias StatePT_ = ulong;
+enum StatePT: StatePT_{
+ triStrip = 0x0001_0000_0000_0000, ///Tristrip.
+ lines = 0x0002_0000_0000_0000, ///Lines.
+ lineStrip = 0x0003_0000_0000_0000, ///Line strip.
+ points = 0x0004_0000_0000_0000, ///Points.
+ shift = 48, ///Primitive type bit shift
+ mask = 0x0007_0000_0000_0000, ///Primitive type bit mask
+}
+
+///Point size value.
+alias StatePointSize_ = ulong;
+enum StatePointSize: StatePointSize_{
+ shift = 52, ///Point size bit shift
+ mask = 0x00F0_0000_0000_0000, ///Point size bit mask
+}
+StatePointSize_ toStatePointSize(ulong v){ return (v << StatePointSize.shift) & StatePointSize.mask; }
+
+/**
+Enable MSAA write when writing into MSAA frame buffer.
+This flag is ignored when not writing into MSAA frame buffer.
+*/
+alias State_ = ulong;
+enum State: State_{
+ msaa = 0x0100_0000_0000_0000, ///Enable MSAA rasterization.
+ lineAA = 0x0200_0000_0000_0000, ///Enable line AA rasterization.
+ conservativeRaster = 0x0400_0000_0000_0000, ///Enable conservative rasterization.
+ none = 0x0000_0000_0000_0000, ///No state.
+ frontCCW = 0x0000_0080_0000_0000, ///Front counter-clockwise (default is clockwise).
+ frontACW = frontCCW,
+ blendIndependent = 0x0000_0004_0000_0000, ///Enable blend independent.
+ blendAlphaToCoverage = 0x0000_0008_0000_0000, ///Enable alpha to coverage.
+ /**
+ 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_ = StateWrite.rgb | StateWrite.a | StateWrite.z | StateDepthTest.less | StateCull.cw | State.msaa,
+ mask = 0xFFFF_FFFF_FFFF_FFFF, ///State bit mask
+}
+
+///Do not use!
+alias StateReserved_ = ulong;
+enum StateReserved: StateReserved_{
+ shift = 61,
+ mask = 0xE000_0000_0000_0000,
+}
+
+///Set stencil ref value.
+alias StencilFuncRef_ = uint;
+enum StencilFuncRef: StencilFuncRef_{
+ shift = 0,
+ mask = 0x0000_00FF,
+}
+StencilFuncRef_ toStencilFuncRef(uint v){ return (v << StencilFuncRef.shift) & StencilFuncRef.mask; }
+
+///Set stencil rmask value.
+alias StencilFuncRmask_ = uint;
+enum StencilFuncRmask: StencilFuncRmask_{
+ shift = 8,
+ mask = 0x0000_FF00,
+}
+StencilFuncRmask_ toStencilFuncRmask(uint v){ return (v << StencilFuncRmask.shift) & StencilFuncRmask.mask; }
+
+alias Stencil_ = uint;
+enum Stencil: Stencil_{
+ none = 0x0000_0000,
+ mask = 0xFFFF_FFFF,
+ default_ = 0x0000_0000,
+}
+
+alias StencilTest_ = uint;
+enum StencilTest: StencilTest_{
+ less = 0x0001_0000, ///Enable stencil test, less.
+ lEqual = 0x0002_0000, ///Enable stencil test, less or equal.
+ equal = 0x0003_0000, ///Enable stencil test, equal.
+ gEqual = 0x0004_0000, ///Enable stencil test, greater or equal.
+ greater = 0x0005_0000, ///Enable stencil test, greater.
+ notEqual = 0x0006_0000, ///Enable stencil test, not equal.
+ never = 0x0007_0000, ///Enable stencil test, never.
+ always = 0x0008_0000, ///Enable stencil test, always.
+ shift = 16, ///Stencil test bit shift
+ mask = 0x000F_0000, ///Stencil test bit mask
+}
+
+alias StencilOpFailS_ = uint;
+enum StencilOpFailS: StencilOpFailS_{
+ zero = 0x0000_0000, ///Zero.
+ keep = 0x0010_0000, ///Keep.
+ replace = 0x0020_0000, ///Replace.
+ incr = 0x0030_0000, ///Increment and wrap.
+ incrSat = 0x0040_0000, ///Increment and clamp.
+ decr = 0x0050_0000, ///Decrement and wrap.
+ decrSat = 0x0060_0000, ///Decrement and clamp.
+ invert = 0x0070_0000, ///Invert.
+ shift = 20, ///Stencil operation fail bit shift
+ mask = 0x00F0_0000, ///Stencil operation fail bit mask
+}
+
+alias StencilOpFailZ_ = uint;
+enum StencilOpFailZ: StencilOpFailZ_{
+ zero = 0x0000_0000, ///Zero.
+ keep = 0x0100_0000, ///Keep.
+ replace = 0x0200_0000, ///Replace.
+ incr = 0x0300_0000, ///Increment and wrap.
+ incrSat = 0x0400_0000, ///Increment and clamp.
+ decr = 0x0500_0000, ///Decrement and wrap.
+ decrSat = 0x0600_0000, ///Decrement and clamp.
+ invert = 0x0700_0000, ///Invert.
+ shift = 24, ///Stencil operation depth fail bit shift
+ mask = 0x0F00_0000, ///Stencil operation depth fail bit mask
+}
+
+alias StencilOpPassZ_ = uint;
+enum StencilOpPassZ: StencilOpPassZ_{
+ zero = 0x0000_0000, ///Zero.
+ keep = 0x1000_0000, ///Keep.
+ replace = 0x2000_0000, ///Replace.
+ incr = 0x3000_0000, ///Increment and wrap.
+ incrSat = 0x4000_0000, ///Increment and clamp.
+ decr = 0x5000_0000, ///Decrement and wrap.
+ decrSat = 0x6000_0000, ///Decrement and clamp.
+ invert = 0x7000_0000, ///Invert.
+ shift = 28, ///Stencil operation depth pass bit shift
+ mask = 0xF000_0000, ///Stencil operation depth pass bit mask
+}
+
+alias Clear_ = ushort;
+enum Clear: Clear_{
+ none = 0x0000, ///No clear flags.
+ color = 0x0001, ///Clear color.
+ colour = color,
+ depth = 0x0002, ///Clear depth.
+ stencil = 0x0004, ///Clear stencil.
+ discardColor0 = 0x0008, ///Discard frame buffer attachment 0.
+ discardColour0 = discardColor0,
+ discardColor1 = 0x0010, ///Discard frame buffer attachment 1.
+ discardColour1 = discardColor1,
+ discardColor2 = 0x0020, ///Discard frame buffer attachment 2.
+ discardColour2 = discardColor2,
+ discardColor3 = 0x0040, ///Discard frame buffer attachment 3.
+ discardColour3 = discardColor3,
+ discardColor4 = 0x0080, ///Discard frame buffer attachment 4.
+ discardColour4 = discardColor4,
+ discardColor5 = 0x0100, ///Discard frame buffer attachment 5.
+ discardColour5 = discardColor5,
+ discardColor6 = 0x0200, ///Discard frame buffer attachment 6.
+ discardColour6 = discardColor6,
+ discardColor7 = 0x0400, ///Discard frame buffer attachment 7.
+ discardColour7 = discardColor7,
+ discardDepth = 0x0800, ///Discard frame buffer depth attachment.
+ discardStencil = 0x1000, ///Discard frame buffer stencil attachment.
+ discardColorMask = 0x07F8,
+ discardColourMask = discardColorMask,
+ discardMask = 0x1FF8,
+}
+
+/**
+Rendering state discard. When state is preserved in submit, rendering states can be discarded
+on a finer grain.
+*/
+alias Discard_ = ubyte;
+enum Discard: Discard_{
+ none = 0x00, ///Preserve everything.
+ bindings = 0x01, ///Discard texture sampler and buffer bindings.
+ indexBuffer = 0x02, ///Discard index buffer.
+ instanceData = 0x04, ///Discard instance data.
+ state = 0x08, ///Discard state and uniform bindings.
+ transform = 0x10, ///Discard transform.
+ vertexStreams = 0x20, ///Discard vertex streams.
+ all = 0xFF, ///Discard all states.
+}
+
+alias Debug_ = uint;
+enum Debug: Debug_{
+ none = 0x0000_0000, ///No debug.
+ wireframe = 0x0000_0001, ///Enable wireframe for all primitives.
+ /**
+ Enable infinitely fast hardware test. No draw calls will be submitted to driver.
+ It's useful when profiling to quickly assess bottleneck between CPU and GPU.
+ */
+ ifh = 0x0000_0002,
+ stats = 0x0000_0004, ///Enable statistics display.
+ text = 0x0000_0008, ///Enable debug text display.
+ profiler = 0x0000_0010, ///Enable profiler. This causes per-view statistics to be collected, available through `bgfx::Stats::ViewStats`. This is unrelated to the profiler functions in `bgfx::CallbackI`.
+}
+
+alias BufferComputeFormat_ = ushort;
+enum BufferComputeFormat: BufferComputeFormat_{
+ _8x1 = 0x0001, ///1 8-bit value
+ _8x2 = 0x0002, ///2 8-bit values
+ _8x4 = 0x0003, ///4 8-bit values
+ _16x1 = 0x0004, ///1 16-bit value
+ _16x2 = 0x0005, ///2 16-bit values
+ _16x4 = 0x0006, ///4 16-bit values
+ _32x1 = 0x0007, ///1 32-bit value
+ _32x2 = 0x0008, ///2 32-bit values
+ _32x4 = 0x0009, ///4 32-bit values
+ shift = 0,
+ mask = 0x000F,
+}
+
+alias BufferComputeType_ = ushort;
+enum BufferComputeType: BufferComputeType_{
+ int_ = 0x0010, ///Type `int`.
+ uint_ = 0x0020, ///Type `uint`.
+ float_ = 0x0030, ///Type `float`.
+ shift = 4,
+ mask = 0x0030,
+}
+
+alias Buffer_ = ushort;
+enum Buffer: Buffer_{
+ none = 0x0000,
+ computeRead = 0x0100, ///Buffer will be read by shader.
+ computeWrite = 0x0200, ///Buffer will be used for writing.
+ drawIndirect = 0x0400, ///Buffer will be used for storing draw indirect commands.
+ allowResize = 0x0800, ///Allow dynamic index/vertex buffer resize during update.
+ index32 = 0x1000, ///Index buffer contains 32-bit indices.
+ computeReadWrite = 0x0300,
+}
+
+alias Texture_ = ulong;
+enum Texture: Texture_{
+ none = 0x0000_0000_0000_0000,
+ msaaSample = 0x0000_0008_0000_0000, ///Texture will be used for MSAA sampling.
+ rt = 0x0000_0010_0000_0000, ///Render target no MSAA.
+ computeWrite = 0x0000_1000_0000_0000, ///Texture will be used for compute write.
+ srgb = 0x0000_2000_0000_0000, ///Sample texture as sRGB.
+ blitDst = 0x0000_4000_0000_0000, ///Texture will be used as blit destination.
+ readBack = 0x0000_8000_0000_0000, ///Texture will be used for read back from GPU.
+}
+
+alias TextureRTMSAA_ = ulong;
+enum TextureRTMSAA: TextureRTMSAA_{
+ x2 = 0x0000_0020_0000_0000, ///Render target MSAAx2 mode.
+ x4 = 0x0000_0030_0000_0000, ///Render target MSAAx4 mode.
+ x8 = 0x0000_0040_0000_0000, ///Render target MSAAx8 mode.
+ x16 = 0x0000_0050_0000_0000, ///Render target MSAAx16 mode.
+ shift = 36,
+ mask = 0x0000_0070_0000_0000,
+}
+
+alias TextureRT_ = ulong;
+enum TextureRT: TextureRT_{
+ writeOnly = 0x0000_0080_0000_0000, ///Render target will be used for writing
+ shift = 36,
+ mask = 0x0000_00F0_0000_0000,
+}
+
+///Sampler flags.
+alias SamplerU_ = uint;
+enum SamplerU: SamplerU_{
+ mirror = 0x0000_0001, ///Wrap U mode: Mirror
+ clamp = 0x0000_0002, ///Wrap U mode: Clamp
+ border = 0x0000_0003, ///Wrap U mode: Border
+ shift = 0,
+ mask = 0x0000_0003,
+}
+
+alias SamplerV_ = uint;
+enum SamplerV: SamplerV_{
+ mirror = 0x0000_0004, ///Wrap V mode: Mirror
+ clamp = 0x0000_0008, ///Wrap V mode: Clamp
+ border = 0x0000_000C, ///Wrap V mode: Border
+ shift = 2,
+ mask = 0x0000_000C,
+}
+
+alias SamplerW_ = uint;
+enum SamplerW: SamplerW_{
+ mirror = 0x0000_0010, ///Wrap W mode: Mirror
+ clamp = 0x0000_0020, ///Wrap W mode: Clamp
+ border = 0x0000_0030, ///Wrap W mode: Border
+ shift = 4,
+ mask = 0x0000_0030,
+}
+
+alias SamplerMin_ = uint;
+enum SamplerMin: SamplerMin_{
+ point = 0x0000_0040, ///Min sampling mode: Point
+ anisotropic = 0x0000_0080, ///Min sampling mode: Anisotropic
+ shift = 6,
+ mask = 0x0000_00C0,
+}
+
+alias SamplerMag_ = uint;
+enum SamplerMag: SamplerMag_{
+ point = 0x0000_0100, ///Mag sampling mode: Point
+ anisotropic = 0x0000_0200, ///Mag sampling mode: Anisotropic
+ shift = 8,
+ mask = 0x0000_0300,
+}
+
+alias SamplerMIP_ = uint;
+enum SamplerMIP: SamplerMIP_{
+ point = 0x0000_0400, ///Mip sampling mode: Point
+ shift = 10,
+ mask = 0x0000_0400,
+}
+
+alias SamplerCompare_ = uint;
+enum SamplerCompare: SamplerCompare_{
+ less = 0x0001_0000, ///Compare when sampling depth texture: less.
+ lEqual = 0x0002_0000, ///Compare when sampling depth texture: less or equal.
+ equal = 0x0003_0000, ///Compare when sampling depth texture: equal.
+ gEqual = 0x0004_0000, ///Compare when sampling depth texture: greater or equal.
+ greater = 0x0005_0000, ///Compare when sampling depth texture: greater.
+ notEqual = 0x0006_0000, ///Compare when sampling depth texture: not equal.
+ never = 0x0007_0000, ///Compare when sampling depth texture: never.
+ always = 0x0008_0000, ///Compare when sampling depth texture: always.
+ shift = 16,
+ mask = 0x000F_0000,
+}
+
+alias SamplerBorderColor_ = uint;
+enum SamplerBorderColor: SamplerBorderColor_{
+ shift = 24,
+ mask = 0x0F00_0000,
+}
+alias SamplerBorderColour = SamplerBorderColor;
+SamplerBorderColor_ toSamplerBorderColor(uint v){ return (v << SamplerBorderColor.shift) & SamplerBorderColor.mask; }
+alias toSamplerBorderColour = toSamplerBorderColor;
+
+alias SamplerReserved_ = uint;
+enum SamplerReserved: SamplerReserved_{
+ shift = 28,
+ mask = 0xF000_0000,
+}
+
+alias Sampler_ = uint;
+enum Sampler: Sampler_{
+ none = 0x0000_0000,
+ sampleStencil = 0x0010_0000, ///Sample stencil instead of depth.
+ point = SamplerMin.point | SamplerMag.point | SamplerMIP.point,
+ uvwMirror = SamplerU.mirror | SamplerV.mirror | SamplerW.mirror,
+ uvwClamp = SamplerU.clamp | SamplerV.clamp | SamplerW.clamp,
+ uvwBorder = SamplerU.border | SamplerV.border | SamplerW.border,
+ bitsMask = SamplerU.mask | SamplerV.mask | SamplerW.mask | SamplerMin.mask | SamplerMag.mask | SamplerMIP.mask | SamplerCompare.mask,
+}
+
+alias ResetMSAA_ = uint;
+enum ResetMSAA: ResetMSAA_{
+ x2 = 0x0000_0010, ///Enable 2x MSAA.
+ x4 = 0x0000_0020, ///Enable 4x MSAA.
+ x8 = 0x0000_0030, ///Enable 8x MSAA.
+ x16 = 0x0000_0040, ///Enable 16x MSAA.
+ shift = 4,
+ mask = 0x0000_0070,
+}
+
+alias Reset_ = uint;
+enum Reset: Reset_{
+ none = 0x0000_0000, ///No reset flags.
+ fullscreen = 0x0000_0001, ///Not supported yet.
+ vsync = 0x0000_0080, ///Enable V-Sync.
+ maxAnisotropy = 0x0000_0100, ///Turn on/off max anisotropy.
+ capture = 0x0000_0200, ///Begin screen capture.
+ flushAfterRender = 0x0000_2000, ///Flush rendering after submitting to GPU.
+ /**
+ This flag specifies where flip occurs. Default behaviour is that flip occurs
+ before rendering new frame. This flag only has effect when `BGFX_CONFIG_MULTITHREADED=0`.
+ */
+ flipAfterRender = 0x0000_4000,
+ srgbBackbuffer = 0x0000_8000, ///Enable sRGB backbuffer.
+ hdr10 = 0x0001_0000, ///Enable HDR10 rendering.
+ hiDPI = 0x0002_0000, ///Enable HiDPI rendering.
+ depthClamp = 0x0004_0000, ///Enable depth clamp.
+ suspend = 0x0008_0000, ///Suspend rendering.
+ transparentBackbuffer = 0x0010_0000, ///Transparent backbuffer. Availability depends on: `BGFX_CAPS_TRANSPARENT_BACKBUFFER`.
+}
+
+alias ResetFullscreen_ = uint;
+enum ResetFullscreen: ResetFullscreen_{
+ shift = 0,
+ mask = 0x0000_0001,
+}
+
+alias ResetReserved_ = uint;
+enum ResetReserved: ResetReserved_{
+ shift = 31, ///Internal bit shift
+ mask = 0x8000_0000, ///Internal bit mask
+}
+
+alias CapFlags_ = ulong;
+enum CapFlags: CapFlags_{
+ alphaToCoverage = 0x0000_0000_0000_0001, ///Alpha to coverage is supported.
+ blendIndependent = 0x0000_0000_0000_0002, ///Blend independent is supported.
+ compute = 0x0000_0000_0000_0004, ///Compute shaders are supported.
+ conservativeRaster = 0x0000_0000_0000_0008, ///Conservative rasterization is supported.
+ drawIndirect = 0x0000_0000_0000_0010, ///Draw indirect is supported.
+ fragmentDepth = 0x0000_0000_0000_0020, ///Fragment depth is available in fragment shader.
+ fragmentOrdering = 0x0000_0000_0000_0040, ///Fragment ordering is available in fragment shader.
+ graphicsDebugger = 0x0000_0000_0000_0080, ///Graphics debugger is present.
+ hdr10 = 0x0000_0000_0000_0100, ///HDR10 rendering is supported.
+ hiDPI = 0x0000_0000_0000_0200, ///HiDPI rendering is supported.
+ imageRW = 0x0000_0000_0000_0400, ///Image Read/Write is supported.
+ index32 = 0x0000_0000_0000_0800, ///32-bit indices are supported.
+ instancing = 0x0000_0000_0000_1000, ///Instancing is supported.
+ occlusionQuery = 0x0000_0000_0000_2000, ///Occlusion query is supported.
+ rendererMultithreaded = 0x0000_0000_0000_4000, ///Renderer is on separate thread.
+ swapChain = 0x0000_0000_0000_8000, ///Multiple windows are supported.
+ texture2DArray = 0x0000_0000_0001_0000, ///2D texture array is supported.
+ texture3D = 0x0000_0000_0002_0000, ///3D textures are supported.
+ textureBlit = 0x0000_0000_0004_0000, ///Texture blit is supported.
+ transparentBackbuffer = 0x0000_0000_0008_0000, ///Transparent back buffer supported.
+ textureCompareReserved = 0x0000_0000_0010_0000,
+ textureCompareLEqual = 0x0000_0000_0020_0000, ///Texture compare less equal mode is supported.
+ textureCubeArray = 0x0000_0000_0040_0000, ///Cubemap texture array is supported.
+ textureDirectAccess = 0x0000_0000_0080_0000, ///CPU direct access to GPU texture memory.
+ textureReadBack = 0x0000_0000_0100_0000, ///Read-back texture is supported.
+ vertexAttribHalf = 0x0000_0000_0200_0000, ///Vertex attribute half-float is supported.
+ vertexAttribUint10 = 0x0000_0000_0400_0000, ///Vertex attribute 10_10_10_2 is supported.
+ vertexID = 0x0000_0000_0800_0000, ///Rendering with VertexID only is supported.
+ primitiveID = 0x0000_0000_1000_0000, ///PrimitiveID is available in fragment shader.
+ viewportLayerArray = 0x0000_0000_2000_0000, ///Viewport layer is available in vertex shader.
+ drawIndirectCount = 0x0000_0000_4000_0000, ///Draw indirect with indirect count is supported.
+ textureCompareAll = 0x0000_0000_0030_0000, ///All texture compare modes are supported.
+}
+
+alias CapsFormat_ = uint;
+enum CapsFormat: CapsFormat_{
+ textureNone = 0x0000_0000, ///Texture format is not supported.
+ texture2D = 0x0000_0001, ///Texture format is supported.
+ texture2DSRGB = 0x0000_0002, ///Texture as sRGB format is supported.
+ texture2DEmulated = 0x0000_0004, ///Texture format is emulated.
+ texture3D = 0x0000_0008, ///Texture format is supported.
+ texture3DSRGB = 0x0000_0010, ///Texture as sRGB format is supported.
+ texture3DEmulated = 0x0000_0020, ///Texture format is emulated.
+ textureCube = 0x0000_0040, ///Texture format is supported.
+ textureCubeSRGB = 0x0000_0080, ///Texture as sRGB format is supported.
+ textureCubeEmulated = 0x0000_0100, ///Texture format is emulated.
+ textureVertex = 0x0000_0200, ///Texture format can be used from vertex shader.
+ textureImageRead = 0x0000_0400, ///Texture format can be used as image and read from.
+ textureImageWrite = 0x0000_0800, ///Texture format can be used as image and written to.
+ textureFramebuffer = 0x0000_1000, ///Texture format can be used as frame buffer.
+ textureFramebufferMSAA = 0x0000_2000, ///Texture format can be used as MSAA frame buffer.
+ textureMSAA = 0x0000_4000, ///Texture can be sampled as MSAA.
+ textureMIPAutogen = 0x0000_8000, ///Texture format supports auto-generated mips.
+}
+
+alias Resolve_ = ubyte;
+enum Resolve: Resolve_{
+ none = 0x00, ///No resolve flags.
+ autoGenMIPs = 0x01, ///Auto-generate mip maps on resolve.
+}
+
+alias PCIID_ = ushort;
+enum PCIID: PCIID_{
+ none = 0x0000, ///Autoselect adapter.
+ softwareRasterizer = 0x0001, ///Software rasterizer.
+ softwareRasteriser = softwareRasterizer,
+ amd = 0x1002, ///AMD adapter.
+ apple = 0x106B, ///Apple adapter.
+ intel = 0x8086, ///Intel adapter.
+ nvidia = 0x10DE, ///nVidia adapter.
+ microsoft = 0x1414, ///Microsoft adapter.
+ arm = 0x13B5, ///ARM adapter.
+}
+
+alias CubeMap_ = ubyte;
+enum CubeMap: CubeMap_{
+ positiveX = 0x00, ///Cubemap +x.
+ negativeX = 0x01, ///Cubemap -x.
+ positiveY = 0x02, ///Cubemap +y.
+ negativeY = 0x03, ///Cubemap -y.
+ positiveZ = 0x04, ///Cubemap +z.
+ negativeZ = 0x05, ///Cubemap -z.
+}
+
+///Fatal error enum.
+enum Fatal: bgfx.fakeenum.Fatal.Enum{
+ debugCheck = bgfx.fakeenum.Fatal.Enum.debugCheck,
+ invalidShader = bgfx.fakeenum.Fatal.Enum.invalidShader,
+ unableToInitialize = bgfx.fakeenum.Fatal.Enum.unableToInitialize,
+ unableToInitialise = bgfx.fakeenum.Fatal.Enum.unableToInitialize,
+ unableToCreateTexture = bgfx.fakeenum.Fatal.Enum.unableToCreateTexture,
+ deviceLost = bgfx.fakeenum.Fatal.Enum.deviceLost,
+ count = bgfx.fakeenum.Fatal.Enum.count,
+}
+
+///Renderer backend type enum.
+enum RendererType: bgfx.fakeenum.RendererType.Enum{
+ noop = bgfx.fakeenum.RendererType.Enum.noop,
+ agc = bgfx.fakeenum.RendererType.Enum.agc,
+ direct3D9 = bgfx.fakeenum.RendererType.Enum.direct3D9,
+ direct3D11 = bgfx.fakeenum.RendererType.Enum.direct3D11,
+ direct3D12 = bgfx.fakeenum.RendererType.Enum.direct3D12,
+ gnm = bgfx.fakeenum.RendererType.Enum.gnm,
+ metal = bgfx.fakeenum.RendererType.Enum.metal,
+ nvn = bgfx.fakeenum.RendererType.Enum.nvn,
+ openGLES = bgfx.fakeenum.RendererType.Enum.openGLES,
+ openGL = bgfx.fakeenum.RendererType.Enum.openGL,
+ vulkan = bgfx.fakeenum.RendererType.Enum.vulkan,
+ webGPU = bgfx.fakeenum.RendererType.Enum.webGPU,
+ count = bgfx.fakeenum.RendererType.Enum.count,
+}
+
+///Access mode enum.
+enum Access: bgfx.fakeenum.Access.Enum{
+ read = bgfx.fakeenum.Access.Enum.read,
+ write = bgfx.fakeenum.Access.Enum.write,
+ readWrite = bgfx.fakeenum.Access.Enum.readWrite,
+ count = bgfx.fakeenum.Access.Enum.count,
+}
+
+///Vertex attribute enum.
+enum Attrib: bgfx.fakeenum.Attrib.Enum{
+ position = bgfx.fakeenum.Attrib.Enum.position,
+ normal = bgfx.fakeenum.Attrib.Enum.normal,
+ tangent = bgfx.fakeenum.Attrib.Enum.tangent,
+ bitangent = bgfx.fakeenum.Attrib.Enum.bitangent,
+ color0 = bgfx.fakeenum.Attrib.Enum.color0,
+ colour0 = bgfx.fakeenum.Attrib.Enum.color0,
+ color1 = bgfx.fakeenum.Attrib.Enum.color1,
+ colour1 = bgfx.fakeenum.Attrib.Enum.color1,
+ color2 = bgfx.fakeenum.Attrib.Enum.color2,
+ colour2 = bgfx.fakeenum.Attrib.Enum.color2,
+ color3 = bgfx.fakeenum.Attrib.Enum.color3,
+ colour3 = bgfx.fakeenum.Attrib.Enum.color3,
+ indices = bgfx.fakeenum.Attrib.Enum.indices,
+ weight = bgfx.fakeenum.Attrib.Enum.weight,
+ texCoord0 = bgfx.fakeenum.Attrib.Enum.texCoord0,
+ texCoord1 = bgfx.fakeenum.Attrib.Enum.texCoord1,
+ texCoord2 = bgfx.fakeenum.Attrib.Enum.texCoord2,
+ texCoord3 = bgfx.fakeenum.Attrib.Enum.texCoord3,
+ texCoord4 = bgfx.fakeenum.Attrib.Enum.texCoord4,
+ texCoord5 = bgfx.fakeenum.Attrib.Enum.texCoord5,
+ texCoord6 = bgfx.fakeenum.Attrib.Enum.texCoord6,
+ texCoord7 = bgfx.fakeenum.Attrib.Enum.texCoord7,
+ count = bgfx.fakeenum.Attrib.Enum.count,
+}
+
+///Vertex attribute type enum.
+enum AttribType: bgfx.fakeenum.AttribType.Enum{
+ uint8 = bgfx.fakeenum.AttribType.Enum.uint8,
+ uint10 = bgfx.fakeenum.AttribType.Enum.uint10,
+ int16 = bgfx.fakeenum.AttribType.Enum.int16,
+ half = bgfx.fakeenum.AttribType.Enum.half,
+ float_ = bgfx.fakeenum.AttribType.Enum.float_,
+ count = bgfx.fakeenum.AttribType.Enum.count,
+}
+
+/**
+Texture format enum.
+Notation:
+ RGBA16S
+ ^ ^ ^
+ | | +-- [ ]Unorm
+ | | [F]loat
+ | | [S]norm
+ | | [I]nt
+ | | [U]int
+ | +---- Number of bits per component
+ +-------- Components
+@attention Availability depends on Caps (see: formats).
+*/
+enum TextureFormat: bgfx.fakeenum.TextureFormat.Enum{
+ bc1 = bgfx.fakeenum.TextureFormat.Enum.bc1,
+ bc2 = bgfx.fakeenum.TextureFormat.Enum.bc2,
+ bc3 = bgfx.fakeenum.TextureFormat.Enum.bc3,
+ bc4 = bgfx.fakeenum.TextureFormat.Enum.bc4,
+ bc5 = bgfx.fakeenum.TextureFormat.Enum.bc5,
+ bc6h = bgfx.fakeenum.TextureFormat.Enum.bc6h,
+ bc7 = bgfx.fakeenum.TextureFormat.Enum.bc7,
+ etc1 = bgfx.fakeenum.TextureFormat.Enum.etc1,
+ etc2 = bgfx.fakeenum.TextureFormat.Enum.etc2,
+ etc2a = bgfx.fakeenum.TextureFormat.Enum.etc2a,
+ etc2a1 = bgfx.fakeenum.TextureFormat.Enum.etc2a1,
+ ptc12 = bgfx.fakeenum.TextureFormat.Enum.ptc12,
+ ptc14 = bgfx.fakeenum.TextureFormat.Enum.ptc14,
+ ptc12a = bgfx.fakeenum.TextureFormat.Enum.ptc12a,
+ ptc14a = bgfx.fakeenum.TextureFormat.Enum.ptc14a,
+ ptc22 = bgfx.fakeenum.TextureFormat.Enum.ptc22,
+ ptc24 = bgfx.fakeenum.TextureFormat.Enum.ptc24,
+ atc = bgfx.fakeenum.TextureFormat.Enum.atc,
+ atce = bgfx.fakeenum.TextureFormat.Enum.atce,
+ atci = bgfx.fakeenum.TextureFormat.Enum.atci,
+ astc4x4 = bgfx.fakeenum.TextureFormat.Enum.astc4x4,
+ astc5x4 = bgfx.fakeenum.TextureFormat.Enum.astc5x4,
+ astc5x5 = bgfx.fakeenum.TextureFormat.Enum.astc5x5,
+ astc6x5 = bgfx.fakeenum.TextureFormat.Enum.astc6x5,
+ astc6x6 = bgfx.fakeenum.TextureFormat.Enum.astc6x6,
+ astc8x5 = bgfx.fakeenum.TextureFormat.Enum.astc8x5,
+ astc8x6 = bgfx.fakeenum.TextureFormat.Enum.astc8x6,
+ astc8x8 = bgfx.fakeenum.TextureFormat.Enum.astc8x8,
+ astc10x5 = bgfx.fakeenum.TextureFormat.Enum.astc10x5,
+ astc10x6 = bgfx.fakeenum.TextureFormat.Enum.astc10x6,
+ astc10x8 = bgfx.fakeenum.TextureFormat.Enum.astc10x8,
+ astc10x10 = bgfx.fakeenum.TextureFormat.Enum.astc10x10,
+ astc12x10 = bgfx.fakeenum.TextureFormat.Enum.astc12x10,
+ astc12x12 = bgfx.fakeenum.TextureFormat.Enum.astc12x12,
+ unknown = bgfx.fakeenum.TextureFormat.Enum.unknown,
+ r1 = bgfx.fakeenum.TextureFormat.Enum.r1,
+ a8 = bgfx.fakeenum.TextureFormat.Enum.a8,
+ r8 = bgfx.fakeenum.TextureFormat.Enum.r8,
+ r8i = bgfx.fakeenum.TextureFormat.Enum.r8i,
+ r8u = bgfx.fakeenum.TextureFormat.Enum.r8u,
+ r8s = bgfx.fakeenum.TextureFormat.Enum.r8s,
+ r16 = bgfx.fakeenum.TextureFormat.Enum.r16,
+ r16i = bgfx.fakeenum.TextureFormat.Enum.r16i,
+ r16u = bgfx.fakeenum.TextureFormat.Enum.r16u,
+ r16f = bgfx.fakeenum.TextureFormat.Enum.r16f,
+ r16s = bgfx.fakeenum.TextureFormat.Enum.r16s,
+ r32i = bgfx.fakeenum.TextureFormat.Enum.r32i,
+ r32u = bgfx.fakeenum.TextureFormat.Enum.r32u,
+ r32f = bgfx.fakeenum.TextureFormat.Enum.r32f,
+ rg8 = bgfx.fakeenum.TextureFormat.Enum.rg8,
+ rg8i = bgfx.fakeenum.TextureFormat.Enum.rg8i,
+ rg8u = bgfx.fakeenum.TextureFormat.Enum.rg8u,
+ rg8s = bgfx.fakeenum.TextureFormat.Enum.rg8s,
+ rg16 = bgfx.fakeenum.TextureFormat.Enum.rg16,
+ rg16i = bgfx.fakeenum.TextureFormat.Enum.rg16i,
+ rg16u = bgfx.fakeenum.TextureFormat.Enum.rg16u,
+ rg16f = bgfx.fakeenum.TextureFormat.Enum.rg16f,
+ rg16s = bgfx.fakeenum.TextureFormat.Enum.rg16s,
+ rg32i = bgfx.fakeenum.TextureFormat.Enum.rg32i,
+ rg32u = bgfx.fakeenum.TextureFormat.Enum.rg32u,
+ rg32f = bgfx.fakeenum.TextureFormat.Enum.rg32f,
+ rgb8 = bgfx.fakeenum.TextureFormat.Enum.rgb8,
+ rgb8i = bgfx.fakeenum.TextureFormat.Enum.rgb8i,
+ rgb8u = bgfx.fakeenum.TextureFormat.Enum.rgb8u,
+ rgb8s = bgfx.fakeenum.TextureFormat.Enum.rgb8s,
+ rgb9e5f = bgfx.fakeenum.TextureFormat.Enum.rgb9e5f,
+ bgra8 = bgfx.fakeenum.TextureFormat.Enum.bgra8,
+ rgba8 = bgfx.fakeenum.TextureFormat.Enum.rgba8,
+ rgba8i = bgfx.fakeenum.TextureFormat.Enum.rgba8i,
+ rgba8u = bgfx.fakeenum.TextureFormat.Enum.rgba8u,
+ rgba8s = bgfx.fakeenum.TextureFormat.Enum.rgba8s,
+ rgba16 = bgfx.fakeenum.TextureFormat.Enum.rgba16,
+ rgba16i = bgfx.fakeenum.TextureFormat.Enum.rgba16i,
+ rgba16u = bgfx.fakeenum.TextureFormat.Enum.rgba16u,
+ rgba16f = bgfx.fakeenum.TextureFormat.Enum.rgba16f,
+ rgba16s = bgfx.fakeenum.TextureFormat.Enum.rgba16s,
+ rgba32i = bgfx.fakeenum.TextureFormat.Enum.rgba32i,
+ rgba32u = bgfx.fakeenum.TextureFormat.Enum.rgba32u,
+ rgba32f = bgfx.fakeenum.TextureFormat.Enum.rgba32f,
+ b5g6r5 = bgfx.fakeenum.TextureFormat.Enum.b5g6r5,
+ r5g6b5 = bgfx.fakeenum.TextureFormat.Enum.r5g6b5,
+ bgra4 = bgfx.fakeenum.TextureFormat.Enum.bgra4,
+ rgba4 = bgfx.fakeenum.TextureFormat.Enum.rgba4,
+ bgr5a1 = bgfx.fakeenum.TextureFormat.Enum.bgr5a1,
+ rgb5a1 = bgfx.fakeenum.TextureFormat.Enum.rgb5a1,
+ rgb10a2 = bgfx.fakeenum.TextureFormat.Enum.rgb10a2,
+ rg11b10f = bgfx.fakeenum.TextureFormat.Enum.rg11b10f,
+ unknownDepth = bgfx.fakeenum.TextureFormat.Enum.unknownDepth,
+ d16 = bgfx.fakeenum.TextureFormat.Enum.d16,
+ d24 = bgfx.fakeenum.TextureFormat.Enum.d24,
+ d24s8 = bgfx.fakeenum.TextureFormat.Enum.d24s8,
+ d32 = bgfx.fakeenum.TextureFormat.Enum.d32,
+ d16f = bgfx.fakeenum.TextureFormat.Enum.d16f,
+ d24f = bgfx.fakeenum.TextureFormat.Enum.d24f,
+ d32f = bgfx.fakeenum.TextureFormat.Enum.d32f,
+ d0s8 = bgfx.fakeenum.TextureFormat.Enum.d0s8,
+ count = bgfx.fakeenum.TextureFormat.Enum.count,
+}
+
+///Uniform type enum.
+enum UniformType: bgfx.fakeenum.UniformType.Enum{
+ sampler = bgfx.fakeenum.UniformType.Enum.sampler,
+ end = bgfx.fakeenum.UniformType.Enum.end,
+ vec4 = bgfx.fakeenum.UniformType.Enum.vec4,
+ mat3 = bgfx.fakeenum.UniformType.Enum.mat3,
+ mat4 = bgfx.fakeenum.UniformType.Enum.mat4,
+ count = bgfx.fakeenum.UniformType.Enum.count,
+}
+
+///Backbuffer ratio enum.
+enum BackbufferRatio: bgfx.fakeenum.BackbufferRatio.Enum{
+ equal = bgfx.fakeenum.BackbufferRatio.Enum.equal,
+ half = bgfx.fakeenum.BackbufferRatio.Enum.half,
+ quarter = bgfx.fakeenum.BackbufferRatio.Enum.quarter,
+ eighth = bgfx.fakeenum.BackbufferRatio.Enum.eighth,
+ sixteenth = bgfx.fakeenum.BackbufferRatio.Enum.sixteenth,
+ double_ = bgfx.fakeenum.BackbufferRatio.Enum.double_,
+ count = bgfx.fakeenum.BackbufferRatio.Enum.count,
+}
+
+///Occlusion query result.
+enum OcclusionQueryResult: bgfx.fakeenum.OcclusionQueryResult.Enum{
+ invisible = bgfx.fakeenum.OcclusionQueryResult.Enum.invisible,
+ visible = bgfx.fakeenum.OcclusionQueryResult.Enum.visible,
+ noResult = bgfx.fakeenum.OcclusionQueryResult.Enum.noResult,
+ count = bgfx.fakeenum.OcclusionQueryResult.Enum.count,
+}
+
+///Primitive topology.
+enum Topology: bgfx.fakeenum.Topology.Enum{
+ triList = bgfx.fakeenum.Topology.Enum.triList,
+ triStrip = bgfx.fakeenum.Topology.Enum.triStrip,
+ lineList = bgfx.fakeenum.Topology.Enum.lineList,
+ lineStrip = bgfx.fakeenum.Topology.Enum.lineStrip,
+ pointList = bgfx.fakeenum.Topology.Enum.pointList,
+ count = bgfx.fakeenum.Topology.Enum.count,
+}
+
+///Topology conversion function.
+enum TopologyConvert: bgfx.fakeenum.TopologyConvert.Enum{
+ triListFlipWinding = bgfx.fakeenum.TopologyConvert.Enum.triListFlipWinding,
+ triStripFlipWinding = bgfx.fakeenum.TopologyConvert.Enum.triStripFlipWinding,
+ triListToLineList = bgfx.fakeenum.TopologyConvert.Enum.triListToLineList,
+ triStripToTriList = bgfx.fakeenum.TopologyConvert.Enum.triStripToTriList,
+ lineStripToLineList = bgfx.fakeenum.TopologyConvert.Enum.lineStripToLineList,
+ count = bgfx.fakeenum.TopologyConvert.Enum.count,
+}
+
+///Topology sort order.
+enum TopologySort: bgfx.fakeenum.TopologySort.Enum{
+ directionFrontToBackMin = bgfx.fakeenum.TopologySort.Enum.directionFrontToBackMin,
+ directionFrontToBackAvg = bgfx.fakeenum.TopologySort.Enum.directionFrontToBackAvg,
+ directionFrontToBackMax = bgfx.fakeenum.TopologySort.Enum.directionFrontToBackMax,
+ directionBackToFrontMin = bgfx.fakeenum.TopologySort.Enum.directionBackToFrontMin,
+ directionBackToFrontAvg = bgfx.fakeenum.TopologySort.Enum.directionBackToFrontAvg,
+ directionBackToFrontMax = bgfx.fakeenum.TopologySort.Enum.directionBackToFrontMax,
+ distanceFrontToBackMin = bgfx.fakeenum.TopologySort.Enum.distanceFrontToBackMin,
+ distanceFrontToBackAvg = bgfx.fakeenum.TopologySort.Enum.distanceFrontToBackAvg,
+ distanceFrontToBackMax = bgfx.fakeenum.TopologySort.Enum.distanceFrontToBackMax,
+ distanceBackToFrontMin = bgfx.fakeenum.TopologySort.Enum.distanceBackToFrontMin,
+ distanceBackToFrontAvg = bgfx.fakeenum.TopologySort.Enum.distanceBackToFrontAvg,
+ distanceBackToFrontMax = bgfx.fakeenum.TopologySort.Enum.distanceBackToFrontMax,
+ count = bgfx.fakeenum.TopologySort.Enum.count,
+}
+
+///View mode sets draw call sort order.
+enum ViewMode: bgfx.fakeenum.ViewMode.Enum{
+ default_ = bgfx.fakeenum.ViewMode.Enum.default_,
+ sequential = bgfx.fakeenum.ViewMode.Enum.sequential,
+ depthAscending = bgfx.fakeenum.ViewMode.Enum.depthAscending,
+ depthDescending = bgfx.fakeenum.ViewMode.Enum.depthDescending,
+ count = bgfx.fakeenum.ViewMode.Enum.count,
+}
+
+///Render frame enum.
+enum RenderFrame: bgfx.fakeenum.RenderFrame.Enum{
+ noContext = bgfx.fakeenum.RenderFrame.Enum.noContext,
+ render = bgfx.fakeenum.RenderFrame.Enum.render,
+ timeout = bgfx.fakeenum.RenderFrame.Enum.timeout,
+ exiting = bgfx.fakeenum.RenderFrame.Enum.exiting,
+ count = bgfx.fakeenum.RenderFrame.Enum.count,
+}
+
+extern(C++, "bgfx") struct DynamicIndexBufferHandle{
+ ushort idx;
+}
+
+extern(C++, "bgfx") struct DynamicVertexBufferHandle{
+ ushort idx;
+}
+
+extern(C++, "bgfx") struct FrameBufferHandle{
+ ushort idx;
+}
+
+extern(C++, "bgfx") struct IndexBufferHandle{
+ ushort idx;
+}
+
+extern(C++, "bgfx") struct IndirectBufferHandle{
+ ushort idx;
+}
+
+extern(C++, "bgfx") struct OcclusionQueryHandle{
+ ushort idx;
+}
+
+extern(C++, "bgfx") struct ProgramHandle{
+ ushort idx;
+}
+
+extern(C++, "bgfx") struct ShaderHandle{
+ ushort idx;
+}
+
+extern(C++, "bgfx") struct TextureHandle{
+ ushort idx;
+}
+
+extern(C++, "bgfx") struct UniformHandle{
+ ushort idx;
+}
+
+extern(C++, "bgfx") struct VertexBufferHandle{
+ ushort idx;
+}
+
+extern(C++, "bgfx") struct VertexLayoutHandle{
+ ushort idx;
+}
+
+pragma(inline,true) nothrow @nogc pure @safe{
+ StateBlend_ blendFuncSeparate(StateBlend_ srcRGB, StateBlend_ dstRGB, StateBlend_ srcA, StateBlend_ dstA){
+ return (srcRGB | ((dstRGB) << 4)) | ((srcA | (dstA << 4)) << 8);
+ }
+
+ ///Blend equation separate.
+ StateBlendEquation_ blendEquationSeparate(StateBlendEquation_ equationRGB, StateBlendEquation_ equationA){
+ return equationRGB | (equationA << 3);
+ }
+
+ ///Blend function.
+ StateBlend_ blendFunc(StateBlend_ src, StateBlend_ dst){ return blendFuncSeparate(src, dst, src, dst); }
+
+ ///Blend equation.
+ StateBlendEquation_ blendEquation(StateBlendEquation_ equation){ return blendEquationSeparate(equation, equation); }
+
+ ///Utility predefined blend modes.
+ enum StateBlendFunc: StateBlend_{
+ ///Additive blending.
+ add = blendFunc(StateBlend.one, StateBlend.one),
+
+ ///Alpha blend.
+ alpha = blendFunc(StateBlend.srcAlpha, StateBlend.invSrcAlpha),
+
+ ///Selects darker color of blend.
+ darken = blendFunc(StateBlend.one, StateBlend.one) | blendEquation(StateBlendEquation.min),
+
+ ///Selects lighter color of blend.
+ lighten = blendFunc(StateBlend.one, StateBlend.one) | blendEquation(StateBlendEquation.max),
+
+ ///Multiplies colors.
+ multiply = blendFunc(StateBlend.dstColor, StateBlend.zero),
+
+ ///Opaque pixels will cover the pixels directly below them without any math or algorithm applied to them.
+ normal = blendFunc(StateBlend.one, StateBlend.invSrcAlpha),
+
+ ///Multiplies the inverse of the blend and base colors.
+ screen = blendFunc(StateBlend.one, StateBlend.invSrcColor),
+
+ ///Decreases the brightness of the base color based on the value of the blend color.
+ linearBurn = blendFunc(StateBlend.dstColor, StateBlend.invDstColor) | blendEquation(StateBlendEquation.sub),
+ }
+
+ StateBlend_ blendFuncRTx(StateBlend_ src, StateBlend_ dst){
+ return cast(uint)(src >> StateBlend.shift) | (cast(uint)(dst >> StateBlend.shift) << 4);
+ }
+
+ StateBlend_ blendFuncRTxE(StateBlend_ src, StateBlend_ dst, StateBlendEquation_ equation){
+ return blendFuncRTx(src, dst) | (cast(uint)(equation >> StateBlendEquation.shift) << 8);
+ }
+
+ StateBlend_ blendFuncRT1(StateBlend_ src, StateBlend_ dst){ return blendFuncRTx(src, dst) << 0; }
+ StateBlend_ blendFuncRT2(StateBlend_ src, StateBlend_ dst){ return blendFuncRTx(src, dst) << 11; }
+ StateBlend_ blendFuncRT3(StateBlend_ src, StateBlend_ dst){ return blendFuncRTx(src, dst) << 22; }
+
+ StateBlend_ blendFuncRT1E(StateBlend_ src, StateBlend_ dst, StateBlendEquation_ equation){
+ return blendFuncRTxE(src, dst, equation) << 0;
+ }
+ StateBlend_ blendFuncRT2E(StateBlend_ src, StateBlend_ dst, StateBlendEquation_ equation){
+ return blendFuncRTxE(src, dst, equation) << 11;
+ }
+ StateBlend_ blendFuncRT3E(StateBlend_ src, StateBlend_ dst, StateBlendEquation_ equation){
+ return blendFuncRTxE(src, dst, equation) << 22;
+ }
+}
+
+///Renderer capabilities.
+extern(C++, "bgfx") struct Caps{
+ ///GPU info.
+ extern(C++) struct GPU{
+ ushort vendorID; ///Vendor PCI id. See `BGFX_PCI_ID_*`.
+ ushort deviceID; ///Device id.
+ }
+ ///Renderer runtime limits.
+ extern(C++) struct Limits{
+ uint maxDrawCalls; ///Maximum number of draw calls.
+ uint maxBlits; ///Maximum number of blit calls.
+ uint maxTextureSize; ///Maximum texture size.
+ uint maxTextureLayers; ///Maximum texture layers.
+ uint maxViews; ///Maximum number of views.
+ uint maxFrameBuffers; ///Maximum number of frame buffer handles.
+ uint maxFBAttachments; ///Maximum number of frame buffer attachments.
+ uint maxPrograms; ///Maximum number of program handles.
+ uint maxShaders; ///Maximum number of shader handles.
+ uint maxTextures; ///Maximum number of texture handles.
+ uint maxTextureSamplers; ///Maximum number of texture samplers.
+ uint maxComputeBindings; ///Maximum number of compute bindings.
+ uint maxVertexLayouts; ///Maximum number of vertex format layouts.
+ uint maxVertexStreams; ///Maximum number of vertex streams.
+ uint maxIndexBuffers; ///Maximum number of index buffer handles.
+ uint maxVertexBuffers; ///Maximum number of vertex buffer handles.
+ uint maxDynamicIndexBuffers; ///Maximum number of dynamic index buffer handles.
+ uint maxDynamicVertexBuffers; ///Maximum number of dynamic vertex buffer handles.
+ uint maxUniforms; ///Maximum number of uniform handles.
+ uint maxOcclusionQueries; ///Maximum number of occlusion query handles.
+ uint maxEncoders; ///Maximum number of encoder threads.
+ uint minResourceCBSize; ///Minimum resource command buffer size.
+ uint transientVBSize; ///Maximum transient vertex buffer size.
+ uint transientIBSize; ///Maximum transient index buffer size.
+ }
+
+ RendererType rendererType; ///Renderer backend type. See: `bgfx::RendererType`
+
+ /**
+ Supported functionality.
+ @attention See `BGFX_CAPS_*` flags at https://bkaradzic.github.io/bgfx/bgfx.html#available-caps
+ */
+ ulong supported;
+ ushort vendorID; ///Selected GPU vendor PCI id.
+ ushort deviceID; ///Selected GPU device id.
+ bool homogeneousDepth; ///True when NDC depth is in [-1, 1] range, otherwise its [0, 1].
+ bool originBottomLeft; ///True when NDC origin is at bottom left.
+ ubyte numGPUs; ///Number of enumerated GPUs.
+ GPU[4] gpu; ///Enumerated GPUs.
+ Limits limits; ///Renderer runtime limits.
+
+ /**
+ Supported texture format capabilities flags:
+ - `BGFX_CAPS_FORMAT_TEXTURE_NONE` - Texture format is not supported.
+ - `BGFX_CAPS_FORMAT_TEXTURE_2D` - Texture format is supported.
+ - `BGFX_CAPS_FORMAT_TEXTURE_2D_SRGB` - Texture as sRGB format is supported.
+ - `BGFX_CAPS_FORMAT_TEXTURE_2D_EMULATED` - Texture format is emulated.
+ - `BGFX_CAPS_FORMAT_TEXTURE_3D` - Texture format is supported.
+ - `BGFX_CAPS_FORMAT_TEXTURE_3D_SRGB` - Texture as sRGB format is supported.
+ - `BGFX_CAPS_FORMAT_TEXTURE_3D_EMULATED` - Texture format is emulated.
+ - `BGFX_CAPS_FORMAT_TEXTURE_CUBE` - Texture format is supported.
+ - `BGFX_CAPS_FORMAT_TEXTURE_CUBE_SRGB` - Texture as sRGB format is supported.
+ - `BGFX_CAPS_FORMAT_TEXTURE_CUBE_EMULATED` - Texture format is emulated.
+ - `BGFX_CAPS_FORMAT_TEXTURE_VERTEX` - Texture format can be used from vertex shader.
+ - `BGFX_CAPS_FORMAT_TEXTURE_IMAGE_READ` - Texture format can be used as image
+ and read from.
+ - `BGFX_CAPS_FORMAT_TEXTURE_IMAGE_WRITE` - Texture format can be used as image
+ and written to.
+ - `BGFX_CAPS_FORMAT_TEXTURE_FRAMEBUFFER` - Texture format can be used as frame
+ buffer.
+ - `BGFX_CAPS_FORMAT_TEXTURE_FRAMEBUFFER_MSAA` - Texture format can be used as MSAA
+ frame buffer.
+ - `BGFX_CAPS_FORMAT_TEXTURE_MSAA` - Texture can be sampled as MSAA.
+ - `BGFX_CAPS_FORMAT_TEXTURE_MIP_AUTOGEN` - Texture format supports auto-generated
+ mips.
+ */
+ ushort[TextureFormat.count] formats;
+}
+
+///Internal data.
+extern(C++, "bgfx") struct InternalData{
+ const(Caps)* caps; ///Renderer capabilities.
+ void* context; ///GL context, or D3D device.
+}
+
+///Platform data.
+extern(C++, "bgfx") struct PlatformData{
+ void* ndt; ///Native display type (*nix specific).
+
+ /**
+ Native window handle. If `NULL`, bgfx will create a headless
+ context/device, provided the rendering API supports it.
+ */
+ void* nwh;
+
+ /**
+ GL context, D3D device, or Vulkan device. If `NULL`, bgfx
+ will create context/device.
+ */
+ void* context;
+
+ /**
+ GL back-buffer, or D3D render target view. If `NULL` bgfx will
+ create back-buffer color surface.
+ */
+ void* backBuffer;
+
+ /**
+ Backbuffer depth/stencil. If `NULL`, bgfx will create a back-buffer
+ depth/stencil surface.
+ */
+ void* backBufferDS;
+}
+
+///Backbuffer resolution and reset parameters.
+extern(C++, "bgfx") struct Resolution{
+ TextureFormat format; ///Backbuffer format.
+ uint width; ///Backbuffer width.
+ uint height; ///Backbuffer height.
+ uint reset; ///Reset parameters.
+ ubyte numBackBuffers; ///Number of back buffers.
+ ubyte maxFrameLatency; ///Maximum frame latency.
+ ubyte debugTextScale; ///Scale factor for debug text.
+ extern(D) mixin(joinFnBinds((){
+ string[][] ret;
+ ret ~= makeFnBinds([
+ [q{void}, q{this}, q{}, `C++`],
+ ], true);
+ return ret;
+ }(), typeof(this).stringof));
+}
+
+///Initialization parameters used by `bgfx::init`.
+extern(C++, "bgfx") struct Init{
+ ///Configurable runtime limits parameters.
+ extern(C++) struct Limits{
+ ushort maxEncoders; ///Maximum number of encoder threads.
+ uint minResourceCBSize; ///Minimum resource command buffer size.
+ uint transientVBSize; ///Maximum transient vertex buffer size.
+ uint transientIBSize; ///Maximum transient index buffer size.
+ }
+
+ /**
+ Select rendering backend. When set to RendererType::Count
+ a default rendering backend will be selected appropriate to the platform.
+ See: `bgfx::RendererType`
+ */
+ RendererType type;
+
+ /**
+ Vendor PCI ID. If set to `BGFX_PCI_ID_NONE`, discrete and integrated
+ GPUs will be prioritised.
+ - `BGFX_PCI_ID_NONE` - Autoselect adapter.
+ - `BGFX_PCI_ID_SOFTWARE_RASTERIZER` - Software rasterizer.
+ - `BGFX_PCI_ID_AMD` - AMD adapter.
+ - `BGFX_PCI_ID_APPLE` - Apple adapter.
+ - `BGFX_PCI_ID_INTEL` - Intel adapter.
+ - `BGFX_PCI_ID_NVIDIA` - NVIDIA adapter.
+ - `BGFX_PCI_ID_MICROSOFT` - Microsoft adapter.
+ */
+ ushort vendorID;
+
+ /**
+ Device ID. If set to 0 it will select first device, or device with
+ matching ID.
+ */
+ ushort deviceID;
+ ulong capabilities; ///Capabilities initialization mask (default: UINT64_MAX).
+ bool debug_; ///Enable device for debugging.
+ bool profile; ///Enable device for profiling.
+ PlatformData platformData; ///Platform data.
+ Resolution resolution; ///Backbuffer resolution and reset parameters. See: `bgfx::Resolution`.
+ Limits limits; ///Configurable runtime limits parameters.
+
+ /**
+ Provide application specific callback interface.
+ See: `bgfx::CallbackI`
+ */
+ void* callback;
+
+ /**
+ Custom allocator. When a custom allocator is not
+ specified, bgfx uses the CRT allocator. Bgfx assumes
+ custom allocator is thread safe.
+ */
+ void* allocator;
+ extern(D) mixin(joinFnBinds((){
+ string[][] ret;
+ ret ~= makeFnBinds([
+ [q{void}, q{this}, q{}, `C++`],
+ ], true);
+ return ret;
+ }(), typeof(this).stringof));
+}
+
+/**
+Memory must be obtained by calling `bgfx::alloc`, `bgfx::copy`, or `bgfx::makeRef`.
+@attention It is illegal to create this structure on stack and pass it to any bgfx API.
+*/
+extern(C++, "bgfx") struct Memory{
+ ubyte* data; ///Pointer to data.
+ uint size; ///Data size.
+}
+
+///Transient index buffer.
+extern(C++, "bgfx") struct TransientIndexBuffer{
+ ubyte* data; ///Pointer to data.
+ uint size; ///Data size.
+ uint startIndex; ///First index.
+ IndexBufferHandle handle; ///Index buffer handle.
+ bool isIndex16; ///Index buffer format is 16-bits if true, otherwise it is 32-bit.
+}
+
+///Transient vertex buffer.
+extern(C++, "bgfx") struct TransientVertexBuffer{
+ ubyte* data; ///Pointer to data.
+ uint size; ///Data size.
+ uint startVertex; ///First vertex.
+ ushort stride; ///Vertex stride.
+ VertexBufferHandle handle; ///Vertex buffer handle.
+ VertexLayoutHandle layoutHandle; ///Vertex layout handle.
+}
+
+///Instance data buffer info.
+extern(C++, "bgfx") struct InstanceDataBuffer{
+ ubyte* data; ///Pointer to data.
+ uint size; ///Data size.
+ uint offset; ///Offset in vertex buffer.
+ uint num; ///Number of instances.
+ ushort stride; ///Vertex buffer stride.
+ VertexBufferHandle handle; ///Vertex buffer object handle.
+}
+
+///Texture info.
+extern(C++, "bgfx") struct TextureInfo{
+ TextureFormat format; ///Texture format.
+ uint storageSize; ///Total amount of bytes required to store texture.
+ ushort width; ///Texture width.
+ ushort height; ///Texture height.
+ ushort depth; ///Texture depth.
+ ushort numLayers; ///Number of layers in texture array.
+ ubyte numMIPs; ///Number of MIP maps.
+ ubyte bitsPerPixel; ///Format bits per pixel.
+ bool cubeMap; ///Texture is cubemap.
+}
+
+///Uniform info.
+extern(C++, "bgfx") struct UniformInfo{
+ char[256] name; ///Uniform name.
+ UniformType type; ///Uniform type.
+ ushort num; ///Number of elements in array.
+}
+
+///Frame buffer texture attachment info.
+extern(C++, "bgfx") struct Attachment{
+ Access access; ///Attachment access. See `Access::Enum`.
+ TextureHandle handle; ///Render target texture handle.
+ ushort mip; ///Mip level.
+ ushort layer; ///Cubemap side or depth layer/slice to use.
+ ushort numLayers; ///Number of texture layer/slice(s) in array to use.
+ ubyte resolve; ///Resolve flags. See: `BGFX_RESOLVE_*`
+ extern(D) mixin(joinFnBinds((){
+ string[][] ret;
+ ret ~= makeFnBinds([
+ /**
+ Init attachment.
+ Params:
+ handle = Render target texture handle.
+ access = Access. See `Access::Enum`.
+ layer = Cubemap side or depth layer/slice to use.
+ numLayers = Number of texture layer/slice(s) in array to use.
+ mip = Mip level.
+ resolve = Resolve flags. See: `BGFX_RESOLVE_*`
+ */
+ [q{void}, q{init}, q{TextureHandle handle, bgfx.fakeenum.Access.Enum access=Access.write, ushort layer=0, ushort numLayers=1, ushort mip=0, ubyte resolve=Resolve.autoGenMIPs}, `C++`],
+ ], true);
+ return ret;
+ }(), typeof(this).stringof));
+}
+
+///Transform data.
+extern(C++, "bgfx") struct Transform{
+ float* data; ///Pointer to first 4x4 matrix.
+ ushort num; ///Number of matrices.
+}
+
+///View stats.
+extern(C++, "bgfx") struct ViewStats{
+ char[256] name; ///View name.
+ ViewID view; ///View id.
+ long cpuTimeBegin; ///CPU (submit) begin time.
+ long cpuTimeEnd; ///CPU (submit) end time.
+ long gpuTimeBegin; ///GPU begin time.
+ long gpuTimeEnd; ///GPU end time.
+ uint gpuFrameNum; ///Frame which generated gpuTimeBegin, gpuTimeEnd.
+}
+
+///Encoder stats.
+extern(C++, "bgfx") struct EncoderStats{
+ long cpuTimeBegin; ///Encoder thread CPU submit begin time.
+ long cpuTimeEnd; ///Encoder thread CPU submit end time.
+}
+
+/**
+Renderer statistics data.
+@remarks All time values are high-resolution timestamps, while
+time frequencies define timestamps-per-second for that hardware.
+*/
+extern(C++, "bgfx") struct Stats{
+ long cpuTimeFrame; ///CPU time between two `bgfx::frame` calls.
+ long cpuTimeBegin; ///Render thread CPU submit begin time.
+ long cpuTimeEnd; ///Render thread CPU submit end time.
+ long cpuTimerFreq; ///CPU timer frequency. Timestamps-per-second
+ long gpuTimeBegin; ///GPU frame begin time.
+ long gpuTimeEnd; ///GPU frame end time.
+ long gpuTimerFreq; ///GPU timer frequency.
+ long waitRender; ///Time spent waiting for render backend thread to finish issuing draw commands to underlying graphics API.
+ long waitSubmit; ///Time spent waiting for submit thread to advance to next frame.
+ uint numDraw; ///Number of draw calls submitted.
+ uint numCompute; ///Number of compute calls submitted.
+ uint numBlit; ///Number of blit calls submitted.
+ uint maxGpuLatency; ///GPU driver latency.
+ uint gpuFrameNum; ///Frame which generated gpuTimeBegin, gpuTimeEnd.
+ ushort numDynamicIndexBuffers; ///Number of used dynamic index buffers.
+ ushort numDynamicVertexBuffers; ///Number of used dynamic vertex buffers.
+ ushort numFrameBuffers; ///Number of used frame buffers.
+ ushort numIndexBuffers; ///Number of used index buffers.
+ ushort numOcclusionQueries; ///Number of used occlusion queries.
+ ushort numPrograms; ///Number of used programs.
+ ushort numShaders; ///Number of used shaders.
+ ushort numTextures; ///Number of used textures.
+ ushort numUniforms; ///Number of used uniforms.
+ ushort numVertexBuffers; ///Number of used vertex buffers.
+ ushort numVertexLayouts; ///Number of used vertex layouts.
+ long textureMemoryUsed; ///Estimate of texture memory used.
+ long rtMemoryUsed; ///Estimate of render target memory used.
+ int transientVBUsed; ///Amount of transient vertex buffer used.
+ int transientIBUsed; ///Amount of transient index buffer used.
+ uint[Topology.count] numPrims; ///Number of primitives rendered.
+ long gpuMemoryMax; ///Maximum available GPU memory for application.
+ long gpuMemoryUsed; ///Amount of GPU memory used by the application.
+ ushort width; ///Backbuffer width in pixels.
+ ushort height; ///Backbuffer height in pixels.
+ ushort textWidth; ///Debug text width in characters.
+ ushort textHeight; ///Debug text height in characters.
+ ushort numViews; ///Number of view stats.
+ ViewStats* viewStats; ///Array of View stats.
+ ubyte numEncoders; ///Number of encoders used during frame.
+ EncoderStats* encoderStats; ///Array of encoder stats.
+}
+
+///Vertex layout.
+extern(C++, "bgfx") struct VertexLayout{
+ uint hash; ///Hash.
+ ushort stride; ///Stride.
+ ushort[Attrib.count] offset; ///Attribute offsets.
+ ushort[Attrib.count] attributes; ///Used attributes.
+ extern(D) mixin(joinFnBinds((){
+ string[][] ret;
+ ret ~= makeFnBinds([
+ [q{void}, q{this}, q{}, `C++`],
+
+ /**
+ Start VertexLayout.
+ Params:
+ rendererType = Renderer backend type. See: `bgfx::RendererType`
+ */
+ [q{VertexLayout*}, q{begin}, q{bgfx.fakeenum.RendererType.Enum rendererType=RendererType.noop}, `C++`],
+
+ /**
+ Add attribute to VertexLayout.
+ Remarks: Must be called between begin/end.
+ Params:
+ attrib = Attribute semantics. See: `bgfx::Attrib`
+ num = Number of elements 1, 2, 3 or 4.
+ type = Element type.
+ normalized = When using fixed point AttribType (f.e. Uint8)
+ value will be normalized for vertex shader usage. When normalized
+ is set to true, AttribType::Uint8 value in range 0-255 will be
+ in range 0.0-1.0 in vertex shader.
+ asInt = Packaging rule for vertexPack, vertexUnpack, and
+ vertexConvert for AttribType::Uint8 and AttribType::Int16.
+ Unpacking code must be implemented inside vertex shader.
+ */
+ [q{VertexLayout*}, q{add}, q{bgfx.fakeenum.Attrib.Enum attrib, ubyte num, bgfx.fakeenum.AttribType.Enum type, bool normalized=false, bool asInt=false}, `C++`],
+
+ /**
+ Decode attribute.
+ Params:
+ attrib = Attribute semantics. See: `bgfx::Attrib`
+ num = Number of elements.
+ type = Element type.
+ normalized = Attribute is normalized.
+ asInt = Attribute is packed as int.
+ */
+ [q{void}, q{decode}, q{bgfx.fakeenum.Attrib.Enum attrib, ref ubyte num, ref bgfx.fakeenum.AttribType.Enum type, ref bool normalized, ref bool asInt}, `C++`, q{const}],
+
+ /**
+ Skip `_num` bytes in vertex stream.
+ Params:
+ num = Number of bytes to skip.
+ */
+ [q{VertexLayout*}, q{skip}, q{ubyte num}, `C++`],
+
+ /**
+ End VertexLayout.
+ */
+ [q{void}, q{end}, q{}, `C++`],
+ ], true);
+ return ret;
+ }(), typeof(this).stringof));
+}
+
+/**
+Encoders are used for submitting draw calls from multiple threads. Only one encoder
+per thread should be used. Use `bgfx::begin()` to obtain an encoder for a thread.
+*/
+extern(C++, "bgfx") struct Encoder{
+ extern(D) mixin(joinFnBinds((){
+ string[][] ret;
+ ret ~= makeFnBinds([
+ /**
+ Sets a debug marker. This allows you to group graphics calls together for easy browsing in
+ graphics debugging tools.
+ Params:
+ marker = Marker string.
+ */
+ [q{void}, q{setMarker}, q{const(char)* marker}, `C++`],
+
+ /**
+ Set render states for draw primitive.
+ Remarks:
+ 1. To set up more complex states use:
+ `BGFX_STATE_ALPHA_REF(_ref)`,
+ `BGFX_STATE_POINT_SIZE(_size)`,
+ `BGFX_STATE_BLEND_FUNC(_src, _dst)`,
+ `BGFX_STATE_BLEND_FUNC_SEPARATE(_srcRGB, _dstRGB, _srcA, _dstA)`,
+ `BGFX_STATE_BLEND_EQUATION(_equation)`,
+ `BGFX_STATE_BLEND_EQUATION_SEPARATE(_equationRGB, _equationA)`
+ 2. `BGFX_STATE_BLEND_EQUATION_ADD` is set when no other blend
+ equation is specified.
+ Params:
+ state = State flags. Default state for primitive type is
+ triangles. See: `BGFX_STATE_DEFAULT`.
+ - `BGFX_STATE_DEPTH_TEST_*` - Depth test function.
+ - `BGFX_STATE_BLEND_*` - See remark 1 about BGFX_STATE_BLEND_FUNC.
+ - `BGFX_STATE_BLEND_EQUATION_*` - See remark 2.
+ - `BGFX_STATE_CULL_*` - Backface culling mode.
+ - `BGFX_STATE_WRITE_*` - Enable R, G, B, A or Z write.
+ - `BGFX_STATE_MSAA` - Enable hardware multisample antialiasing.
+ - `BGFX_STATE_PT_[TRISTRIP/LINES/POINTS]` - Primitive type.
+ rgba = Sets blend factor used by `BGFX_STATE_BLEND_FACTOR` and
+ `BGFX_STATE_BLEND_INV_FACTOR` blend modes.
+ */
+ [q{void}, q{setState}, q{ulong state, uint rgba=0}, `C++`],
+
+ /**
+ Set condition for rendering.
+ Params:
+ handle = Occlusion query handle.
+ visible = Render if occlusion query is visible.
+ */
+ [q{void}, q{setCondition}, q{OcclusionQueryHandle handle, bool visible}, `C++`],
+
+ /**
+ Set stencil test state.
+ Params:
+ fstencil = Front stencil state.
+ bstencil = Back stencil state. If back is set to `BGFX_STENCIL_NONE`
+ _fstencil is applied to both front and back facing primitives.
+ */
+ [q{void}, q{setStencil}, q{uint fstencil, uint bstencil=Stencil.none}, `C++`],
+
+ /**
+ Set scissor for draw primitive.
+ Remarks:
+ To scissor for all primitives in view see `bgfx::setViewScissor`.
+ Params:
+ x = Position x from the left corner of the window.
+ y = Position y from the top corner of the window.
+ width = Width of view scissor region.
+ height = Height of view scissor region.
+ */
+ [q{ushort}, q{setScissor}, q{ushort x, ushort y, ushort width, ushort height}, `C++`],
+
+ /**
+ Set scissor from cache for draw primitive.
+ Remarks:
+ To scissor for all primitives in view see `bgfx::setViewScissor`.
+ Params:
+ cache = Index in scissor cache.
+ */
+ [q{void}, q{setScissor}, q{ushort cache=ushort.max}, `C++`],
+
+ /**
+ Set model matrix for draw primitive. If it is not called,
+ the model will be rendered with an identity model matrix.
+ Params:
+ mtx = Pointer to first matrix in array.
+ num = Number of matrices in array.
+ */
+ [q{uint}, q{setTransform}, q{const(void)* mtx, ushort num=1}, `C++`],
+
+ /**
+ Set model matrix from matrix cache for draw primitive.
+ Params:
+ cache = Index in matrix cache.
+ num = Number of matrices from cache.
+ */
+ [q{void}, q{setTransform}, q{uint cache, ushort num=1}, `C++`],
+
+ /**
+ Reserve matrices in internal matrix cache.
+ Attention: Pointer returned can be modified until `bgfx::frame` is called.
+ Params:
+ transform = Pointer to `Transform` structure.
+ num = Number of matrices.
+ */
+ [q{uint}, q{allocTransform}, q{Transform* transform, ushort num}, `C++`],
+
+ /**
+ Set shader uniform parameter for draw primitive.
+ Params:
+ handle = Uniform.
+ value = Pointer to uniform data.
+ num = Number of elements. Passing `UINT16_MAX` will
+ use the _num passed on uniform creation.
+ */
+ [q{void}, q{setUniform}, q{UniformHandle handle, const(void)* value, ushort num=1}, `C++`],
+
+ /**
+ Set index buffer for draw primitive.
+ Params:
+ handle = Index buffer.
+ */
+ [q{void}, q{setIndexBuffer}, q{IndexBufferHandle handle}, `C++`],
+
+ /**
+ Set index buffer for draw primitive.
+ Params:
+ handle = Index buffer.
+ firstIndex = First index to render.
+ numIndices = Number of indices to render.
+ */
+ [q{void}, q{setIndexBuffer}, q{IndexBufferHandle handle, uint firstIndex, uint numIndices}, `C++`],
+
+ /**
+ Set index buffer for draw primitive.
+ Params:
+ handle = Dynamic index buffer.
+ */
+ [q{void}, q{setIndexBuffer}, q{DynamicIndexBufferHandle handle}, `C++`],
+
+ /**
+ Set index buffer for draw primitive.
+ Params:
+ handle = Dynamic index buffer.
+ firstIndex = First index to render.
+ numIndices = Number of indices to render.
+ */
+ [q{void}, q{setIndexBuffer}, q{DynamicIndexBufferHandle handle, uint firstIndex, uint numIndices}, `C++`],
+
+ /**
+ Set index buffer for draw primitive.
+ Params:
+ tib = Transient index buffer.
+ */
+ [q{void}, q{setIndexBuffer}, q{const(TransientIndexBuffer)* tib}, `C++`],
+
+ /**
+ Set index buffer for draw primitive.
+ Params:
+ tib = Transient index buffer.
+ firstIndex = First index to render.
+ numIndices = Number of indices to render.
+ */
+ [q{void}, q{setIndexBuffer}, q{const(TransientIndexBuffer)* tib, uint firstIndex, uint numIndices}, `C++`],
+
+ /**
+ Set vertex buffer for draw primitive.
+ Params:
+ stream = Vertex stream.
+ handle = Vertex buffer.
+ */
+ [q{void}, q{setVertexBuffer}, q{ubyte stream, VertexBufferHandle handle}, `C++`],
+
+ /**
+ Set vertex buffer for draw primitive.
+ Params:
+ stream = Vertex stream.
+ handle = Vertex buffer.
+ startVertex = First vertex to render.
+ numVertices = Number of vertices to render.
+ layoutHandle = Vertex layout for aliasing vertex buffer. If invalid
+ handle is used, vertex layout used for creation
+ of vertex buffer will be used.
+ */
+ [q{void}, q{setVertexBuffer}, q{ubyte stream, VertexBufferHandle handle, uint startVertex, uint numVertices, VertexLayoutHandle layoutHandle=invalidHandle!VertexLayoutHandle}, `C++`],
+
+ /**
+ Set vertex buffer for draw primitive.
+ Params:
+ stream = Vertex stream.
+ handle = Dynamic vertex buffer.
+ */
+ [q{void}, q{setVertexBuffer}, q{ubyte stream, DynamicVertexBufferHandle handle}, `C++`],
+ [q{void}, q{setVertexBuffer}, q{ubyte stream, DynamicVertexBufferHandle handle, uint startVertex, uint numVertices, VertexLayoutHandle layoutHandle=invalidHandle!VertexLayoutHandle}, `C++`],
+
+ /**
+ Set vertex buffer for draw primitive.
+ Params:
+ stream = Vertex stream.
+ tvb = Transient vertex buffer.
+ */
+ [q{void}, q{setVertexBuffer}, q{ubyte stream, const(TransientVertexBuffer)* tvb}, `C++`],
+
+ /**
+ Set vertex buffer for draw primitive.
+ Params:
+ stream = Vertex stream.
+ tvb = Transient vertex buffer.
+ startVertex = First vertex to render.
+ numVertices = Number of vertices to render.
+ layoutHandle = Vertex layout for aliasing vertex buffer. If invalid
+ handle is used, vertex layout used for creation
+ of vertex buffer will be used.
+ */
+ [q{void}, q{setVertexBuffer}, q{ubyte stream, const(TransientVertexBuffer)* tvb, uint startVertex, uint numVertices, VertexLayoutHandle layoutHandle=invalidHandle!VertexLayoutHandle}, `C++`],
+
+ /**
+ Set number of vertices for auto generated vertices use in conjunction
+ with gl_VertexID.
+ Attention: Availability depends on: `BGFX_CAPS_VERTEX_ID`.
+ Params:
+ numVertices = Number of vertices.
+ */
+ [q{void}, q{setVertexCount}, q{uint numVertices}, `C++`],
+
+ /**
+ Set instance data buffer for draw primitive.
+ Params:
+ idb = Transient instance data buffer.
+ */
+ [q{void}, q{setInstanceDataBuffer}, q{const(InstanceDataBuffer)* idb}, `C++`],
+
+ /**
+ Set instance data buffer for draw primitive.
+ Params:
+ idb = Transient instance data buffer.
+ start = First instance data.
+ num = Number of data instances.
+ */
+ [q{void}, q{setInstanceDataBuffer}, q{const(InstanceDataBuffer)* idb, uint start, uint num}, `C++`],
+
+ /**
+ Set instance data buffer for draw primitive.
+ Params:
+ handle = Vertex buffer.
+ startVertex = First instance data.
+ num = Number of data instances.
+ */
+ [q{void}, q{setInstanceDataBuffer}, q{VertexBufferHandle handle, uint startVertex, uint num}, `C++`],
+
+ /**
+ Set instance data buffer for draw primitive.
+ Params:
+ handle = Dynamic vertex buffer.
+ startVertex = First instance data.
+ num = Number of data instances.
+ */
+ [q{void}, q{setInstanceDataBuffer}, q{DynamicVertexBufferHandle handle, uint startVertex, uint num}, `C++`],
+
+ /**
+ Set number of instances for auto generated instances use in conjunction
+ with gl_InstanceID.
+ Attention: Availability depends on: `BGFX_CAPS_VERTEX_ID`.
+ */
+ [q{void}, q{setInstanceCount}, q{uint numInstances}, `C++`],
+
+ /**
+ Set texture stage for draw primitive.
+ Params:
+ stage = Texture unit.
+ sampler = Program sampler.
+ handle = Texture handle.
+ flags = Texture sampling mode. Default value UINT32_MAX uses
+ texture sampling settings from the texture.
+ - `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.
+ */
+ [q{void}, q{setTexture}, q{ubyte stage, UniformHandle sampler, TextureHandle handle, uint flags=uint.max}, `C++`],
+
+ /**
+ Submit an empty primitive for rendering. Uniforms and draw state
+ will be applied but no geometry will be submitted. Useful in cases
+ when no other draw/compute primitive is submitted to view, but it's
+ desired to execute clear view.
+ Remarks:
+ These empty draw calls will sort before ordinary draw calls.
+ Params:
+ id = View id.
+ */
+ [q{void}, q{touch}, q{ViewID id}, `C++`],
+
+ /**
+ Submit primitive for rendering.
+ Params:
+ id = View id.
+ program = Program.
+ depth = Depth for sorting.
+ 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++`],
+
+ /**
+ Submit primitive with occlusion query for rendering.
+ Params:
+ id = View id.
+ program = Program.
+ occlusionQuery = Occlusion query.
+ depth = Depth for sorting.
+ 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++`],
+
+ /**
+ Submit primitive for rendering with index and instance data info from
+ indirect buffer.
+ Attention: Availability depends on: `BGFX_CAPS_DRAW_INDIRECT`.
+ Params:
+ id = View id.
+ program = Program.
+ indirectHandle = Indirect buffer.
+ start = First element in indirect buffer.
+ num = Number of draws.
+ depth = Depth for sorting.
+ 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++`],
+
+ /**
+ Submit primitive for rendering with index and instance data info and
+ draw count from indirect buffers.
+ Attention: Availability depends on: `BGFX_CAPS_DRAW_INDIRECT_COUNT`.
+ Params:
+ id = View id.
+ program = Program.
+ indirectHandle = Indirect buffer.
+ start = First element in indirect buffer.
+ numHandle = Buffer for number of draws. Must be
+ created with `BGFX_BUFFER_INDEX32` and `BGFX_BUFFER_DRAW_INDIRECT`.
+ numIndex = Element in number buffer.
+ numMax = Max number of draws.
+ depth = Depth for sorting.
+ 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++`],
+
+ /**
+ Set compute index buffer.
+ Params:
+ stage = Compute stage.
+ handle = Index buffer handle.
+ access = Buffer access. See `Access::Enum`.
+ */
+ [q{void}, q{setBuffer}, q{ubyte stage, IndexBufferHandle handle, bgfx.fakeenum.Access.Enum access}, `C++`],
+
+ /**
+ Set compute vertex buffer.
+ Params:
+ stage = Compute stage.
+ handle = Vertex buffer handle.
+ access = Buffer access. See `Access::Enum`.
+ */
+ [q{void}, q{setBuffer}, q{ubyte stage, VertexBufferHandle handle, bgfx.fakeenum.Access.Enum access}, `C++`],
+
+ /**
+ Set compute dynamic index buffer.
+ Params:
+ stage = Compute stage.
+ handle = Dynamic index buffer handle.
+ access = Buffer access. See `Access::Enum`.
+ */
+ [q{void}, q{setBuffer}, q{ubyte stage, DynamicIndexBufferHandle handle, bgfx.fakeenum.Access.Enum access}, `C++`],
+
+ /**
+ Set compute dynamic vertex buffer.
+ Params:
+ stage = Compute stage.
+ handle = Dynamic vertex buffer handle.
+ access = Buffer access. See `Access::Enum`.
+ */
+ [q{void}, q{setBuffer}, q{ubyte stage, DynamicVertexBufferHandle handle, bgfx.fakeenum.Access.Enum access}, `C++`],
+
+ /**
+ Set compute indirect buffer.
+ Params:
+ stage = Compute stage.
+ handle = Indirect buffer handle.
+ access = Buffer access. See `Access::Enum`.
+ */
+ [q{void}, q{setBuffer}, q{ubyte stage, IndirectBufferHandle handle, bgfx.fakeenum.Access.Enum access}, `C++`],
+
+ /**
+ Set compute image from texture.
+ Params:
+ stage = Compute stage.
+ handle = Texture handle.
+ mip = Mip level.
+ access = Image access. See `Access::Enum`.
+ format = Texture format. See: `TextureFormat::Enum`.
+ */
+ [q{void}, q{setImage}, q{ubyte stage, TextureHandle handle, ubyte mip, bgfx.fakeenum.Access.Enum access, bgfx.fakeenum.TextureFormat.Enum format=TextureFormat.count}, `C++`],
+
+ /**
+ Dispatch compute.
+ Params:
+ id = View id.
+ program = Compute program.
+ numX = Number of groups X.
+ numY = Number of groups Y.
+ numZ = Number of groups Z.
+ 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++`],
+
+ /**
+ Dispatch compute indirect.
+ Params:
+ id = View id.
+ program = Compute program.
+ indirectHandle = Indirect buffer.
+ start = First element in indirect buffer.
+ num = Number of dispatches.
+ 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++`],
+
+ /**
+ Discard previously set state for draw or compute call.
+ Params:
+ flags = Discard or preserve states. See `BGFX_DISCARD_*`.
+ */
+ [q{void}, q{discard}, q{ubyte flags=Discard.all}, `C++`],
+
+ /**
+ Blit 2D texture region between two 2D textures.
+ Attention: Destination texture must be created with `BGFX_TEXTURE_BLIT_DST` flag.
+ Attention: Availability depends on: `BGFX_CAPS_TEXTURE_BLIT`.
+ Params:
+ id = View id.
+ dst = Destination texture handle.
+ dstX = Destination texture X position.
+ dstY = Destination texture Y position.
+ src = Source texture handle.
+ srcX = Source texture X position.
+ srcY = Source texture Y position.
+ width = Width 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++`],
+
+ /**
+ Blit 2D texture region between two 2D textures.
+ Attention: Destination texture must be created with `BGFX_TEXTURE_BLIT_DST` flag.
+ Attention: Availability depends on: `BGFX_CAPS_TEXTURE_BLIT`.
+ Params:
+ id = View id.
+ dst = Destination texture handle.
+ dstMIP = Destination texture mip level.
+ dstX = Destination texture X position.
+ dstY = Destination texture Y position.
+ dstZ = If texture is 2D this argument should be 0. If destination texture is cube
+ this argument represents destination texture cube face. For 3D texture this argument
+ represents destination texture Z position.
+ src = Source texture handle.
+ srcMIP = Source texture mip level.
+ srcX = Source texture X position.
+ srcY = Source texture Y position.
+ srcZ = If texture is 2D this argument should be 0. If source texture is cube
+ this argument represents source texture cube face. For 3D texture this argument
+ represents source texture Z position.
+ width = Width of region.
+ height = Height of region.
+ depth = If texture is 3D this argument represents depth of region, otherwise it's
+ 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++`],
+ ], true);
+ return ret;
+ }(), typeof(this).stringof));
+}
+
+mixin(joinFnBinds((){
+ string[][] ret;
+ ret ~= makeFnBinds([
+ /**
+ * Pack vertex attribute into vertex stream format.
+ Params:
+ input = Value to be packed into vertex stream.
+ inputNormalized = `true` if input value is already normalized.
+ attr = Attribute to pack.
+ layout = Vertex stream layout.
+ data = Destination vertex stream where data will be packed.
+ index = Vertex index that will be modified.
+ */
+ [q{void}, q{vertexPack}, q{const(float)* input, bool inputNormalized, bgfx.fakeenum.Attrib.Enum attr, ref const VertexLayout layout, void* data, uint index=0}, `C++, "bgfx"`],
+
+ /**
+ * Unpack vertex attribute from vertex stream format.
+ Params:
+ output = Result of unpacking.
+ attr = Attribute to unpack.
+ layout = Vertex stream layout.
+ data = Source vertex stream from where data will be unpacked.
+ index = Vertex index that will be unpacked.
+ */
+ [q{void}, q{vertexUnpack}, q{float* output, bgfx.fakeenum.Attrib.Enum attr, ref const VertexLayout layout, const(void)* data, uint index=0}, `C++, "bgfx"`],
+
+ /**
+ * Converts vertex stream data from one vertex stream format to another.
+ Params:
+ dstLayout = Destination vertex stream layout.
+ dstData = Destination vertex stream.
+ srcLayout = Source vertex stream layout.
+ srcData = Source vertex stream data.
+ num = Number of vertices to convert from source to destination.
+ */
+ [q{void}, q{vertexConvert}, q{ref const VertexLayout dstLayout, void* dstData, ref const VertexLayout srcLayout, const(void)* srcData, uint num=1}, `C++, "bgfx"`],
+
+ /**
+ * Weld vertices.
+ Params:
+ output = Welded vertices remapping table. The size of buffer
+ must be the same as number of vertices.
+ layout = Vertex stream layout.
+ data = Vertex stream.
+ num = Number of vertices in vertex stream.
+ index32 = Set to `true` if input indices are 32-bit.
+ epsilon = Error tolerance for vertex position comparison.
+ */
+ [q{uint}, q{weldVertices}, q{void* output, ref const VertexLayout layout, const(void)* data, uint num, bool index32, float epsilon=0.001f}, `C++, "bgfx"`],
+
+ /**
+ * Convert index buffer for use with different primitive topologies.
+ Params:
+ conversion = Conversion type, see `TopologyConvert::Enum`.
+ dst = Destination index buffer. If this argument is NULL
+ function will return number of indices after conversion.
+ dstSize = Destination index buffer in bytes. It must be
+ large enough to contain output indices. If destination size is
+ insufficient index buffer will be truncated.
+ indices = Source indices.
+ numIndices = Number of input indices.
+ index32 = Set to `true` if input indices are 32-bit.
+ */
+ [q{uint}, q{topologyConvert}, q{bgfx.fakeenum.TopologyConvert.Enum conversion, void* dst, uint dstSize, const(void)* indices, uint numIndices, bool index32}, `C++, "bgfx"`],
+
+ /**
+ * Sort indices.
+ Params:
+ sort = Sort order, see `TopologySort::Enum`.
+ dst = Destination index buffer.
+ dstSize = Destination index buffer in bytes. It must be
+ large enough to contain output indices. If destination size is
+ insufficient index buffer will be truncated.
+ dir = Direction (vector must be normalized).
+ pos = Position.
+ vertices = Pointer to first vertex represented as
+ float x, y, z. Must contain at least number of vertices
+ referencende by index buffer.
+ stride = Vertex stride.
+ indices = Source indices.
+ numIndices = Number of input indices.
+ index32 = Set to `true` if input indices are 32-bit.
+ */
+ [q{void}, q{topologySortTriList}, q{bgfx.fakeenum.TopologySort.Enum sort, void* dst, uint dstSize, const(float)* dir, const(float)* pos, const(void)* vertices, uint stride, const(void)* indices, uint numIndices, bool index32}, `C++, "bgfx"`],
+
+ /**
+ * Returns supported backend API renderers.
+ Params:
+ max = Maximum number of elements in _enum array.
+ enum_ = Array where supported renderers will be written.
+ */
+ [q{ubyte}, q{getSupportedRenderers}, q{ubyte max=0, bgfx.fakeenum.RendererType.Enum* enum_=null}, `C++, "bgfx"`],
+
+ /**
+ * Returns name of renderer.
+ Params:
+ type = Renderer backend type. See: `bgfx::RendererType`
+ */
+ [q{const(char)*}, q{getRendererName}, q{bgfx.fakeenum.RendererType.Enum type}, `C++, "bgfx"`],
+
+ /**
+ * Initialize the bgfx library.
+ Params:
+ init = Initialization parameters. See: `bgfx::Init` for more info.
+ */
+ [q{bool}, q{init}, q{ref const Init init}, `C++, "bgfx"`],
+
+ /**
+ * Shutdown bgfx library.
+ */
+ [q{void}, q{shutdown}, q{}, `C++, "bgfx"`],
+
+ /**
+ * Reset graphic settings and back-buffer size.
+ * Attention: This call doesn’t change the window size, it just resizes
+ * the back-buffer. Your windowing code controls the window size.
+ Params:
+ width = Back-buffer width.
+ height = Back-buffer height.
+ flags = See: `BGFX_RESET_*` for more info.
+ - `BGFX_RESET_NONE` - No reset flags.
+ - `BGFX_RESET_FULLSCREEN` - Not supported yet.
+ - `BGFX_RESET_MSAA_X[2/4/8/16]` - Enable 2, 4, 8 or 16 x MSAA.
+ - `BGFX_RESET_VSYNC` - Enable V-Sync.
+ - `BGFX_RESET_MAXANISOTROPY` - Turn on/off max anisotropy.
+ - `BGFX_RESET_CAPTURE` - Begin screen capture.
+ - `BGFX_RESET_FLUSH_AFTER_RENDER` - Flush rendering after submitting to GPU.
+ - `BGFX_RESET_FLIP_AFTER_RENDER` - This flag specifies where flip
+ occurs. Default behaviour is that flip occurs before rendering new
+ frame. This flag only has effect when `BGFX_CONFIG_MULTITHREADED=0`.
+ - `BGFX_RESET_SRGB_BACKBUFFER` - Enable sRGB back-buffer.
+ format = Texture format. See: `TextureFormat::Enum`.
+ */
+ [q{void}, q{reset}, q{uint width, uint height, uint flags=Reset.none, bgfx.fakeenum.TextureFormat.Enum format=TextureFormat.count}, `C++, "bgfx"`],
+
+ /**
+ * Advance to next frame. When using multithreaded renderer, this call
+ * just swaps internal buffers, kicks render thread, and returns. In
+ * singlethreaded renderer this call does frame rendering.
+ Params:
+ capture = Capture frame with graphics debugger.
+ */
+ [q{uint}, q{frame}, q{bool capture=false}, `C++, "bgfx"`],
+
+ /**
+ * Returns current renderer backend API type.
+ * Remarks:
+ * Library must be initialized.
+ */
+ [q{RendererType}, q{getRendererType}, q{}, `C++, "bgfx"`],
+
+ /**
+ * Returns renderer capabilities.
+ * Remarks:
+ * Library must be initialized.
+ */
+ [q{const(Caps)*}, q{getCaps}, q{}, `C++, "bgfx"`],
+
+ /**
+ * Returns performance counters.
+ * Attention: Pointer returned is valid until `bgfx::frame` is called.
+ */
+ [q{const(Stats)*}, q{getStats}, q{}, `C++, "bgfx"`],
+
+ /**
+ * Allocate buffer to pass to bgfx calls. Data will be freed inside bgfx.
+ Params:
+ size = Size to allocate.
+ */
+ [q{const(Memory)*}, q{alloc}, q{uint size}, `C++, "bgfx"`],
+
+ /**
+ * Allocate buffer and copy data into it. Data will be freed inside bgfx.
+ Params:
+ data = Pointer to data to be copied.
+ size = Size of data to be copied.
+ */
+ [q{const(Memory)*}, q{copy}, q{const(void)* data, uint size}, `C++, "bgfx"`],
+
+ /**
+ * Make reference to data to pass to bgfx. Unlike `bgfx::alloc`, this call
+ * doesn't allocate memory for data. It just copies the _data pointer. You
+ * can pass `ReleaseFn` function pointer to release this memory after it's
+ * consumed, otherwise you must make sure _data is available for at least 2
+ * `bgfx::frame` calls. `ReleaseFn` function must be able to be called
+ * from any thread.
+ * Attention: Data passed must be available for at least 2 `bgfx::frame` calls.
+ Params:
+ data = Pointer to data.
+ size = Size of data.
+ releaseFn = Callback function to release memory after use.
+ userData = User data to be passed to callback function.
+ */
+ [q{const(Memory)*}, q{makeRef}, q{const(void)* data, uint size, ReleaseFn releaseFn=null, void* userData=null}, `C++, "bgfx"`],
+
+ /**
+ * Set debug flags.
+ Params:
+ debug_ = Available flags:
+ - `BGFX_DEBUG_IFH` - Infinitely fast hardware. When this flag is set
+ all rendering calls will be skipped. This is useful when profiling
+ to quickly assess potential bottlenecks between CPU and GPU.
+ - `BGFX_DEBUG_PROFILER` - Enable profiler.
+ - `BGFX_DEBUG_STATS` - Display internal statistics.
+ - `BGFX_DEBUG_TEXT` - Display debug text.
+ - `BGFX_DEBUG_WIREFRAME` - Wireframe rendering. All rendering
+ primitives will be rendered as lines.
+ */
+ [q{void}, q{setDebug}, q{uint debug_}, `C++, "bgfx"`],
+
+ /**
+ * Clear internal debug text buffer.
+ Params:
+ attr = Background color.
+ small = Default 8x16 or 8x8 font.
+ */
+ [q{void}, q{dbgTextClear}, q{ubyte attr=0, bool small=false}, `C++, "bgfx"`],
+
+ /**
+ * Print formatted data to internal debug text character-buffer (VGA-compatible text mode).
+ Params:
+ x = Position x from the left corner of the window.
+ y = Position y from the top corner of the window.
+ attr = Color palette. Where top 4-bits represent index of background, and bottom
+ 4-bits represent foreground color from standard VGA text palette (ANSI escape codes).
+ format = `printf` style format.
+ */
+ [q{void}, q{dbgTextPrintf}, q{ushort x, ushort y, ubyte attr, const(char)* format, ...}, `C++, "bgfx"`],
+
+ /**
+ * Print formatted data from variable argument list to internal debug text character-buffer (VGA-compatible text mode).
+ Params:
+ x = Position x from the left corner of the window.
+ y = Position y from the top corner of the window.
+ attr = Color palette. Where top 4-bits represent index of background, and bottom
+ 4-bits represent foreground color from standard VGA text palette (ANSI escape codes).
+ format = `printf` style format.
+ argList = Variable arguments list for format string.
+ */
+ [q{void}, q{dbgTextPrintfVargs}, q{ushort x, ushort y, ubyte attr, const(char)* format, va_list argList}, `C++, "bgfx"`],
+
+ /**
+ * Draw image into internal debug text buffer.
+ Params:
+ x = Position x from the left corner of the window.
+ y = Position y from the top corner of the window.
+ width = Image width.
+ height = Image height.
+ data = Raw image data (character/attribute raw encoding).
+ pitch = Image pitch in bytes.
+ */
+ [q{void}, q{dbgTextImage}, q{ushort x, ushort y, ushort width, ushort height, const(void)* data, ushort pitch}, `C++, "bgfx"`],
+
+ /**
+ * Create static index buffer.
+ Params:
+ mem = Index buffer data.
+ flags = Buffer creation flags.
+ - `BGFX_BUFFER_NONE` - No flags.
+ - `BGFX_BUFFER_COMPUTE_READ` - Buffer will be read from by compute shader.
+ - `BGFX_BUFFER_COMPUTE_WRITE` - Buffer will be written into by compute shader. When buffer
+ is created with `BGFX_BUFFER_COMPUTE_WRITE` flag it cannot be updated from CPU.
+ - `BGFX_BUFFER_COMPUTE_READ_WRITE` - Buffer will be used for read/write by compute shader.
+ - `BGFX_BUFFER_ALLOW_RESIZE` - Buffer will resize on buffer update if a different amount of
+ data is passed. If this flag is not specified, and more data is passed on update, the buffer
+ will be trimmed to fit the existing buffer size. This flag has effect only on dynamic
+ buffers.
+ - `BGFX_BUFFER_INDEX32` - Buffer is using 32-bit indices. This flag has effect only on
+ index buffers.
+ */
+ [q{IndexBufferHandle}, q{createIndexBuffer}, q{const(Memory)* mem, ushort flags=Buffer.none}, `C++, "bgfx"`],
+
+ /**
+ * Set static index buffer debug name.
+ Params:
+ handle = Static index buffer handle.
+ name = Static index buffer name.
+ len = Static index buffer name length (if length is INT32_MAX, it's expected
+ that _name is zero terminated string.
+ */
+ [q{void}, q{setName}, q{IndexBufferHandle handle, const(char)* name, int len=int.max}, `C++, "bgfx"`],
+
+ /**
+ * Destroy static index buffer.
+ Params:
+ handle = Static index buffer handle.
+ */
+ [q{void}, q{destroy}, q{IndexBufferHandle handle}, `C++, "bgfx"`],
+
+ /**
+ * Create vertex layout.
+ Params:
+ layout = Vertex layout.
+ */
+ [q{VertexLayoutHandle}, q{createVertexLayout}, q{ref const VertexLayout layout}, `C++, "bgfx"`],
+
+ /**
+ * Destroy vertex layout.
+ Params:
+ layoutHandle = Vertex layout handle.
+ */
+ [q{void}, q{destroy}, q{VertexLayoutHandle layoutHandle}, `C++, "bgfx"`],
+
+ /**
+ * Create static vertex buffer.
+ Params:
+ mem = Vertex buffer data.
+ layout = Vertex layout.
+ flags = Buffer creation flags.
+ - `BGFX_BUFFER_NONE` - No flags.
+ - `BGFX_BUFFER_COMPUTE_READ` - Buffer will be read from by compute shader.
+ - `BGFX_BUFFER_COMPUTE_WRITE` - Buffer will be written into by compute shader. When buffer
+ is created with `BGFX_BUFFER_COMPUTE_WRITE` flag it cannot be updated from CPU.
+ - `BGFX_BUFFER_COMPUTE_READ_WRITE` - Buffer will be used for read/write by compute shader.
+ - `BGFX_BUFFER_ALLOW_RESIZE` - Buffer will resize on buffer update if a different amount of
+ data is passed. If this flag is not specified, and more data is passed on update, the buffer
+ will be trimmed to fit the existing buffer size. This flag has effect only on dynamic buffers.
+ - `BGFX_BUFFER_INDEX32` - Buffer is using 32-bit indices. This flag has effect only on index buffers.
+ */
+ [q{VertexBufferHandle}, q{createVertexBuffer}, q{const(Memory)* mem, ref const VertexLayout layout, ushort flags=Buffer.none}, `C++, "bgfx"`],
+
+ /**
+ * Set static vertex buffer debug name.
+ Params:
+ handle = Static vertex buffer handle.
+ name = Static vertex buffer name.
+ len = Static vertex buffer name length (if length is INT32_MAX, it's expected
+ that _name is zero terminated string.
+ */
+ [q{void}, q{setName}, q{VertexBufferHandle handle, const(char)* name, int len=int.max}, `C++, "bgfx"`],
+
+ /**
+ * Destroy static vertex buffer.
+ Params:
+ handle = Static vertex buffer handle.
+ */
+ [q{void}, q{destroy}, q{VertexBufferHandle handle}, `C++, "bgfx"`],
+
+ /**
+ * Create empty dynamic index buffer.
+ Params:
+ num = Number of indices.
+ flags = Buffer creation flags.
+ - `BGFX_BUFFER_NONE` - No flags.
+ - `BGFX_BUFFER_COMPUTE_READ` - Buffer will be read from by compute shader.
+ - `BGFX_BUFFER_COMPUTE_WRITE` - Buffer will be written into by compute shader. When buffer
+ is created with `BGFX_BUFFER_COMPUTE_WRITE` flag it cannot be updated from CPU.
+ - `BGFX_BUFFER_COMPUTE_READ_WRITE` - Buffer will be used for read/write by compute shader.
+ - `BGFX_BUFFER_ALLOW_RESIZE` - Buffer will resize on buffer update if a different amount of
+ data is passed. If this flag is not specified, and more data is passed on update, the buffer
+ will be trimmed to fit the existing buffer size. This flag has effect only on dynamic
+ buffers.
+ - `BGFX_BUFFER_INDEX32` - Buffer is using 32-bit indices. This flag has effect only on
+ index buffers.
+ */
+ [q{DynamicIndexBufferHandle}, q{createDynamicIndexBuffer}, q{uint num, ushort flags=Buffer.none}, `C++, "bgfx"`],
+
+ /**
+ * Create a dynamic index buffer and initialize it.
+ Params:
+ mem = Index buffer data.
+ flags = Buffer creation flags.
+ - `BGFX_BUFFER_NONE` - No flags.
+ - `BGFX_BUFFER_COMPUTE_READ` - Buffer will be read from by compute shader.
+ - `BGFX_BUFFER_COMPUTE_WRITE` - Buffer will be written into by compute shader. When buffer
+ is created with `BGFX_BUFFER_COMPUTE_WRITE` flag it cannot be updated from CPU.
+ - `BGFX_BUFFER_COMPUTE_READ_WRITE` - Buffer will be used for read/write by compute shader.
+ - `BGFX_BUFFER_ALLOW_RESIZE` - Buffer will resize on buffer update if a different amount of
+ data is passed. If this flag is not specified, and more data is passed on update, the buffer
+ will be trimmed to fit the existing buffer size. This flag has effect only on dynamic
+ buffers.
+ - `BGFX_BUFFER_INDEX32` - Buffer is using 32-bit indices. This flag has effect only on
+ index buffers.
+ */
+ [q{DynamicIndexBufferHandle}, q{createDynamicIndexBuffer}, q{const(Memory)* mem, ushort flags=Buffer.none}, `C++, "bgfx"`],
+
+ /**
+ * Update dynamic index buffer.
+ Params:
+ handle = Dynamic index buffer handle.
+ startIndex = Start index.
+ mem = Index buffer data.
+ */
+ [q{void}, q{update}, q{DynamicIndexBufferHandle handle, uint startIndex, const(Memory)* mem}, `C++, "bgfx"`],
+
+ /**
+ * Destroy dynamic index buffer.
+ Params:
+ handle = Dynamic index buffer handle.
+ */
+ [q{void}, q{destroy}, q{DynamicIndexBufferHandle handle}, `C++, "bgfx"`],
+
+ /**
+ * Create empty dynamic vertex buffer.
+ Params:
+ num = Number of vertices.
+ layout = Vertex layout.
+ flags = Buffer creation flags.
+ - `BGFX_BUFFER_NONE` - No flags.
+ - `BGFX_BUFFER_COMPUTE_READ` - Buffer will be read from by compute shader.
+ - `BGFX_BUFFER_COMPUTE_WRITE` - Buffer will be written into by compute shader. When buffer
+ is created with `BGFX_BUFFER_COMPUTE_WRITE` flag it cannot be updated from CPU.
+ - `BGFX_BUFFER_COMPUTE_READ_WRITE` - Buffer will be used for read/write by compute shader.
+ - `BGFX_BUFFER_ALLOW_RESIZE` - Buffer will resize on buffer update if a different amount of
+ data is passed. If this flag is not specified, and more data is passed on update, the buffer
+ will be trimmed to fit the existing buffer size. This flag has effect only on dynamic
+ buffers.
+ - `BGFX_BUFFER_INDEX32` - Buffer is using 32-bit indices. This flag has effect only on
+ index buffers.
+ */
+ [q{DynamicVertexBufferHandle}, q{createDynamicVertexBuffer}, q{uint num, ref const VertexLayout layout, ushort flags=Buffer.none}, `C++, "bgfx"`],
+
+ /**
+ * Create dynamic vertex buffer and initialize it.
+ Params:
+ mem = Vertex buffer data.
+ layout = Vertex layout.
+ flags = Buffer creation flags.
+ - `BGFX_BUFFER_NONE` - No flags.
+ - `BGFX_BUFFER_COMPUTE_READ` - Buffer will be read from by compute shader.
+ - `BGFX_BUFFER_COMPUTE_WRITE` - Buffer will be written into by compute shader. When buffer
+ is created with `BGFX_BUFFER_COMPUTE_WRITE` flag it cannot be updated from CPU.
+ - `BGFX_BUFFER_COMPUTE_READ_WRITE` - Buffer will be used for read/write by compute shader.
+ - `BGFX_BUFFER_ALLOW_RESIZE` - Buffer will resize on buffer update if a different amount of
+ data is passed. If this flag is not specified, and more data is passed on update, the buffer
+ will be trimmed to fit the existing buffer size. This flag has effect only on dynamic
+ buffers.
+ - `BGFX_BUFFER_INDEX32` - Buffer is using 32-bit indices. This flag has effect only on
+ index buffers.
+ */
+ [q{DynamicVertexBufferHandle}, q{createDynamicVertexBuffer}, q{const(Memory)* mem, ref const VertexLayout layout, ushort flags=Buffer.none}, `C++, "bgfx"`],
+
+ /**
+ * Update dynamic vertex buffer.
+ Params:
+ handle = Dynamic vertex buffer handle.
+ startVertex = Start vertex.
+ mem = Vertex buffer data.
+ */
+ [q{void}, q{update}, q{DynamicVertexBufferHandle handle, uint startVertex, const(Memory)* mem}, `C++, "bgfx"`],
+
+ /**
+ * Destroy dynamic vertex buffer.
+ Params:
+ handle = Dynamic vertex buffer handle.
+ */
+ [q{void}, q{destroy}, q{DynamicVertexBufferHandle handle}, `C++, "bgfx"`],
+
+ /**
+ * Returns number of requested or maximum available indices.
+ Params:
+ num = Number of required indices.
+ index32 = Set to `true` if input indices will be 32-bit.
+ */
+ [q{uint}, q{getAvailTransientIndexBuffer}, q{uint num, bool index32=false}, `C++, "bgfx"`],
+
+ /**
+ * Returns number of requested or maximum available vertices.
+ Params:
+ num = Number of required vertices.
+ layout = Vertex layout.
+ */
+ [q{uint}, q{getAvailTransientVertexBuffer}, q{uint num, ref const VertexLayout layout}, `C++, "bgfx"`],
+
+ /**
+ * Returns number of requested or maximum available instance buffer slots.
+ Params:
+ num = Number of required instances.
+ stride = Stride per instance.
+ */
+ [q{uint}, q{getAvailInstanceDataBuffer}, q{uint num, ushort stride}, `C++, "bgfx"`],
+
+ /**
+ * Allocate transient index buffer.
+ Params:
+ tib = TransientIndexBuffer structure will be filled, and will be valid
+ for the duration of frame, and can be reused for multiple draw
+ calls.
+ num = Number of indices to allocate.
+ index32 = Set to `true` if input indices will be 32-bit.
+ */
+ [q{void}, q{allocTransientIndexBuffer}, q{TransientIndexBuffer* tib, uint num, bool index32=false}, `C++, "bgfx"`],
+
+ /**
+ * Allocate transient vertex buffer.
+ Params:
+ tvb = TransientVertexBuffer structure will be filled, and will be valid
+ for the duration of frame, and can be reused for multiple draw
+ calls.
+ num = Number of vertices to allocate.
+ layout = Vertex layout.
+ */
+ [q{void}, q{allocTransientVertexBuffer}, q{TransientVertexBuffer* tvb, uint num, ref const VertexLayout layout}, `C++, "bgfx"`],
+
+ /**
+ * Check for required space and allocate transient vertex and index
+ * buffers. If both space requirements are satisfied function returns
+ * true.
+ Params:
+ tvb = TransientVertexBuffer structure will be filled, and will be valid
+ for the duration of frame, and can be reused for multiple draw
+ calls.
+ layout = Vertex layout.
+ numVertices = Number of vertices to allocate.
+ tib = TransientIndexBuffer structure will be filled, and will be valid
+ for the duration of frame, and can be reused for multiple draw
+ calls.
+ numIndices = Number of indices to allocate.
+ index32 = Set to `true` if input indices will be 32-bit.
+ */
+ [q{bool}, q{allocTransientBuffers}, q{TransientVertexBuffer* tvb, ref const VertexLayout layout, uint numVertices, TransientIndexBuffer* tib, uint numIndices, bool index32=false}, `C++, "bgfx"`],
+
+ /**
+ * Allocate instance data buffer.
+ Params:
+ idb = InstanceDataBuffer structure will be filled, and will be valid
+ for duration of frame, and can be reused for multiple draw
+ calls.
+ num = Number of instances.
+ stride = Instance stride. Must be multiple of 16.
+ */
+ [q{void}, q{allocInstanceDataBuffer}, q{InstanceDataBuffer* idb, uint num, ushort stride}, `C++, "bgfx"`],
+
+ /**
+ * Create draw indirect buffer.
+ Params:
+ num = Number of indirect calls.
+ */
+ [q{IndirectBufferHandle}, q{createIndirectBuffer}, q{uint num}, `C++, "bgfx"`],
+
+ /**
+ * Destroy draw indirect buffer.
+ Params:
+ handle = Indirect buffer handle.
+ */
+ [q{void}, q{destroy}, q{IndirectBufferHandle handle}, `C++, "bgfx"`],
+
+ /**
+ * Create shader from memory buffer.
+ Params:
+ mem = Shader binary.
+ */
+ [q{ShaderHandle}, q{createShader}, q{const(Memory)* mem}, `C++, "bgfx"`],
+
+ /**
+ * Returns the number of uniforms and uniform handles used inside a shader.
+ * Remarks:
+ * Only non-predefined uniforms are returned.
+ Params:
+ handle = Shader handle.
+ uniforms = UniformHandle array where data will be stored.
+ max = Maximum capacity of array.
+ */
+ [q{ushort}, q{getShaderUniforms}, q{ShaderHandle handle, UniformHandle* uniforms=null, ushort max=0}, `C++, "bgfx"`],
+
+ /**
+ * Set shader debug name.
+ Params:
+ handle = Shader handle.
+ name = Shader name.
+ len = Shader name length (if length is INT32_MAX, it's expected
+ that _name is zero terminated string).
+ */
+ [q{void}, q{setName}, q{ShaderHandle handle, const(char)* name, int len=int.max}, `C++, "bgfx"`],
+
+ /**
+ * Destroy shader.
+ * Remarks: Once a shader program is created with _handle,
+ * it is safe to destroy that shader.
+ Params:
+ handle = Shader handle.
+ */
+ [q{void}, q{destroy}, q{ShaderHandle handle}, `C++, "bgfx"`],
+
+ /**
+ * Create program with vertex and fragment shaders.
+ Params:
+ vsh = Vertex shader.
+ fsh = Fragment shader.
+ destroyShaders = If true, shaders will be destroyed when program is destroyed.
+ */
+ [q{ProgramHandle}, q{createProgram}, q{ShaderHandle vsh, ShaderHandle fsh, bool destroyShaders=false}, `C++, "bgfx"`],
+
+ /**
+ * Create program with compute shader.
+ Params:
+ csh = Compute shader.
+ destroyShaders = If true, shaders will be destroyed when program is destroyed.
+ */
+ [q{ProgramHandle}, q{createProgram}, q{ShaderHandle csh, bool destroyShaders=false}, `C++, "bgfx"`],
+
+ /**
+ * Destroy program.
+ Params:
+ handle = Program handle.
+ */
+ [q{void}, q{destroy}, q{ProgramHandle handle}, `C++, "bgfx"`],
+
+ /**
+ * Validate texture parameters.
+ Params:
+ depth = Depth dimension of volume texture.
+ cubeMap = Indicates that texture contains cubemap.
+ numLayers = Number of layers in texture array.
+ format = Texture format. See: `TextureFormat::Enum`.
+ flags = Texture flags. See `BGFX_TEXTURE_*`.
+ */
+ [q{bool}, q{isTextureValid}, q{ushort depth, bool cubeMap, ushort numLayers, bgfx.fakeenum.TextureFormat.Enum format, ulong flags}, `C++, "bgfx"`],
+
+ /**
+ * Validate frame buffer parameters.
+ Params:
+ num = Number of attachments.
+ attachment = Attachment texture info. See: `bgfx::Attachment`.
+ */
+ [q{bool}, q{isFrameBufferValid}, q{ubyte num, const(Attachment)* attachment}, `C++, "bgfx"`],
+
+ /**
+ * Calculate amount of memory required for texture.
+ Params:
+ info = Resulting texture info structure. See: `TextureInfo`.
+ width = Width.
+ height = Height.
+ depth = Depth dimension of volume texture.
+ cubeMap = Indicates that texture contains cubemap.
+ hasMIPs = Indicates that texture contains full mip-map chain.
+ numLayers = Number of layers in texture array.
+ format = Texture format. See: `TextureFormat::Enum`.
+ */
+ [q{void}, q{calcTextureSize}, q{ref TextureInfo info, ushort width, ushort height, ushort depth, bool cubeMap, bool hasMIPs, ushort numLayers, bgfx.fakeenum.TextureFormat.Enum format}, `C++, "bgfx"`],
+
+ /**
+ * Create texture from memory buffer.
+ Params:
+ mem = DDS, KTX or PVR texture binary data.
+ 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.
+ skip = Skip top level mips when parsing texture.
+ info = When non-`NULL` is specified it returns parsed texture information.
+ */
+ [q{TextureHandle}, q{createTexture}, q{const(Memory)* mem, ulong flags, ubyte skip=0, TextureInfo* info=null}, `C++, "bgfx"`],
+
+ /**
+ * Create 2D texture.
+ Params:
+ width = Width.
+ height = Height.
+ hasMIPs = Indicates that texture contains full mip-map chain.
+ numLayers = Number of layers in texture array. Must be 1 if caps
+ `BGFX_CAPS_TEXTURE_2D_ARRAY` flag is not set.
+ format = Texture format. See: `TextureFormat::Enum`.
+ 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.
+ 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.
+ */
+ [q{TextureHandle}, q{createTexture2D}, q{ushort width, ushort height, bool hasMIPs, ushort numLayers, bgfx.fakeenum.TextureFormat.Enum format, ulong flags, const(Memory)* mem=null}, `C++, "bgfx"`],
+
+ /**
+ * Create texture with size based on back-buffer ratio. Texture will maintain ratio
+ * if back buffer resolution changes.
+ Params:
+ ratio = Texture size in respect to back-buffer size. See: `BackbufferRatio::Enum`.
+ hasMIPs = Indicates that texture contains full mip-map chain.
+ numLayers = Number of layers in texture array. Must be 1 if caps
+ `BGFX_CAPS_TEXTURE_2D_ARRAY` flag is not set.
+ format = Texture format. See: `TextureFormat::Enum`.
+ 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.
+ */
+ [q{TextureHandle}, q{createTexture2D}, q{bgfx.fakeenum.BackbufferRatio.Enum ratio, bool hasMIPs, ushort numLayers, bgfx.fakeenum.TextureFormat.Enum format, ulong flags=Texture.none|Sampler.none}, `C++, "bgfx"`],
+
+ /**
+ * Create 3D texture.
+ Params:
+ width = Width.
+ height = Height.
+ depth = Depth.
+ hasMIPs = Indicates that texture contains full mip-map chain.
+ format = Texture format. See: `TextureFormat::Enum`.
+ 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.
+ 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.
+ */
+ [q{TextureHandle}, q{createTexture3D}, q{ushort width, ushort height, ushort depth, bool hasMIPs, bgfx.fakeenum.TextureFormat.Enum format, ulong flags=Texture.none|Sampler.none, const(Memory)* mem=null}, `C++, "bgfx"`],
+
+ /**
+ * Create Cube texture.
+ Params:
+ size = Cube side size.
+ hasMIPs = Indicates that texture contains full mip-map chain.
+ numLayers = Number of layers in texture array. Must be 1 if caps
+ `BGFX_CAPS_TEXTURE_2D_ARRAY` flag is not set.
+ format = Texture format. See: `TextureFormat::Enum`.
+ 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.
+ 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.
+ */
+ [q{TextureHandle}, q{createTextureCube}, q{ushort size, bool hasMIPs, ushort numLayers, bgfx.fakeenum.TextureFormat.Enum format, ulong flags=Texture.none|Sampler.none, const(Memory)* mem=null}, `C++, "bgfx"`],
+
+ /**
+ * Update 2D texture.
+ * Attention: It's valid to update only mutable texture. See `bgfx::createTexture2D` for more info.
+ Params:
+ handle = Texture handle.
+ layer = Layer in texture array.
+ mip = Mip level.
+ x = X offset in texture.
+ y = Y offset in texture.
+ width = Width of texture block.
+ height = Height of texture block.
+ mem = Texture update data.
+ pitch = Pitch of input image (bytes). When _pitch is set to
+ UINT16_MAX, it will be calculated internally based on _width.
+ */
+ [q{void}, q{updateTexture2D}, q{TextureHandle handle, ushort layer, ubyte mip, ushort x, ushort y, ushort width, ushort height, const(Memory)* mem, ushort pitch=ushort.max}, `C++, "bgfx"`],
+
+ /**
+ * Update 3D texture.
+ * Attention: It's valid to update only mutable texture. See `bgfx::createTexture3D` for more info.
+ Params:
+ handle = Texture handle.
+ mip = Mip level.
+ x = X offset in texture.
+ y = Y offset in texture.
+ z = Z offset in texture.
+ width = Width of texture block.
+ height = Height of texture block.
+ depth = Depth of texture block.
+ mem = Texture update data.
+ */
+ [q{void}, q{updateTexture3D}, q{TextureHandle handle, ubyte mip, ushort x, ushort y, ushort z, ushort width, ushort height, ushort depth, const(Memory)* mem}, `C++, "bgfx"`],
+
+ /**
+ * Update Cube texture.
+ * Attention: It's valid to update only mutable texture. See `bgfx::createTextureCube` for more info.
+ Params:
+ handle = Texture handle.
+ layer = Layer in texture array.
+ side = Cubemap side `BGFX_CUBE_MAP_<POSITIVE or NEGATIVE>_<X, Y or Z>`,
+ where 0 is +X, 1 is -X, 2 is +Y, 3 is -Y, 4 is +Z, and 5 is -Z.
+ +----------+
+ |-z 2|
+ | ^ +y |
+ | | | Unfolded cube:
+ | +---->+x |
+ +----------+----------+----------+----------+
+ |+y 1|+y 4|+y 0|+y 5|
+ | ^ -x | ^ +z | ^ +x | ^ -z |
+ | | | | | | | | |
+ | +---->+z | +---->+x | +---->-z | +---->-x |
+ +----------+----------+----------+----------+
+ |+z 3|
+ | ^ -y |
+ | | |
+ | +---->+x |
+ +----------+
+ mip = Mip level.
+ x = X offset in texture.
+ y = Y offset in texture.
+ width = Width of texture block.
+ height = Height of texture block.
+ mem = Texture update data.
+ pitch = Pitch of input image (bytes). When _pitch is set to
+ UINT16_MAX, it will be calculated internally based on _width.
+ */
+ [q{void}, q{updateTextureCube}, q{TextureHandle handle, ushort layer, ubyte side, ubyte mip, ushort x, ushort y, ushort width, ushort height, const(Memory)* mem, ushort pitch=ushort.max}, `C++, "bgfx"`],
+
+ /**
+ * Read back texture content.
+ * Attention: Texture must be created with `BGFX_TEXTURE_READ_BACK` flag.
+ * Attention: Availability depends on: `BGFX_CAPS_TEXTURE_READ_BACK`.
+ Params:
+ handle = Texture handle.
+ data = Destination buffer.
+ mip = Mip level.
+ */
+ [q{uint}, q{readTexture}, q{TextureHandle handle, void* data, ubyte mip=0}, `C++, "bgfx"`],
+
+ /**
+ * Set texture debug name.
+ Params:
+ handle = Texture handle.
+ name = Texture name.
+ len = Texture name length (if length is INT32_MAX, it's expected
+ that _name is zero terminated string.
+ */
+ [q{void}, q{setName}, q{TextureHandle handle, const(char)* name, int len=int.max}, `C++, "bgfx"`],
+
+ /**
+ * Returns texture direct access pointer.
+ * Attention: Availability depends on: `BGFX_CAPS_TEXTURE_DIRECT_ACCESS`. This feature
+ * is available on GPUs that have unified memory architecture (UMA) support.
+ Params:
+ handle = Texture handle.
+ */
+ [q{void*}, q{getDirectAccessPtr}, q{TextureHandle handle}, `C++, "bgfx"`],
+
+ /**
+ * Destroy texture.
+ Params:
+ handle = Texture handle.
+ */
+ [q{void}, q{destroy}, q{TextureHandle handle}, `C++, "bgfx"`],
+
+ /**
+ * Create frame buffer (simple).
+ Params:
+ width = Texture width.
+ height = Texture height.
+ format = Texture format. See: `TextureFormat::Enum`.
+ textureFlags = 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.
+ */
+ [q{FrameBufferHandle}, q{createFrameBuffer}, q{ushort width, ushort height, bgfx.fakeenum.TextureFormat.Enum format, ulong textureFlags=SamplerU.clamp|SamplerV.clamp}, `C++, "bgfx"`],
+
+ /**
+ * Create frame buffer with size based on back-buffer ratio. Frame buffer will maintain ratio
+ * if back buffer resolution changes.
+ Params:
+ ratio = Frame buffer size in respect to back-buffer size. See:
+ `BackbufferRatio::Enum`.
+ format = Texture format. See: `TextureFormat::Enum`.
+ textureFlags = 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.
+ */
+ [q{FrameBufferHandle}, q{createFrameBuffer}, q{bgfx.fakeenum.BackbufferRatio.Enum ratio, bgfx.fakeenum.TextureFormat.Enum format, ulong textureFlags=SamplerU.clamp|SamplerV.clamp}, `C++, "bgfx"`],
+
+ /**
+ * Create MRT frame buffer from texture handles (simple).
+ Params:
+ num = Number of texture handles.
+ handles = Texture attachments.
+ destroyTexture = If true, textures will be destroyed when
+ frame buffer is destroyed.
+ */
+ [q{FrameBufferHandle}, q{createFrameBuffer}, q{ubyte num, const(TextureHandle)* handles, bool destroyTexture=false}, `C++, "bgfx"`],
+
+ /**
+ * Create MRT frame buffer from texture handles with specific layer and
+ * mip level.
+ Params:
+ num = Number of attachments.
+ attachment = Attachment texture info. See: `bgfx::Attachment`.
+ destroyTexture = If true, textures will be destroyed when
+ frame buffer is destroyed.
+ */
+ [q{FrameBufferHandle}, q{createFrameBuffer}, q{ubyte num, const(Attachment)* attachment, bool destroyTexture=false}, `C++, "bgfx"`],
+
+ /**
+ * Create frame buffer for multiple window rendering.
+ * Remarks:
+ * Frame buffer cannot be used for sampling.
+ * Attention: Availability depends on: `BGFX_CAPS_SWAP_CHAIN`.
+ Params:
+ nwh = OS' target native window handle.
+ width = Window back buffer width.
+ height = Window back buffer height.
+ format = Window back buffer color format.
+ depthFormat = Window back buffer depth format.
+ */
+ [q{FrameBufferHandle}, q{createFrameBuffer}, q{void* nwh, ushort width, ushort height, bgfx.fakeenum.TextureFormat.Enum format=TextureFormat.count, bgfx.fakeenum.TextureFormat.Enum depthFormat=TextureFormat.count}, `C++, "bgfx"`],
+
+ /**
+ * Set frame buffer debug name.
+ Params:
+ handle = Frame buffer handle.
+ name = Frame buffer name.
+ len = Frame buffer name length (if length is INT32_MAX, it's expected
+ that _name is zero terminated string.
+ */
+ [q{void}, q{setName}, q{FrameBufferHandle handle, const(char)* name, int len=int.max}, `C++, "bgfx"`],
+
+ /**
+ * Obtain texture handle of frame buffer attachment.
+ Params:
+ handle = Frame buffer handle.
+ */
+ [q{TextureHandle}, q{getTexture}, q{FrameBufferHandle handle, ubyte attachment=0}, `C++, "bgfx"`],
+
+ /**
+ * Destroy frame buffer.
+ Params:
+ handle = Frame buffer handle.
+ */
+ [q{void}, q{destroy}, q{FrameBufferHandle handle}, `C++, "bgfx"`],
+
+ /**
+ * Create shader uniform parameter.
+ * Remarks:
+ * 1. Uniform names are unique. It's valid to call `bgfx::createUniform`
+ * multiple times with the same uniform name. The library will always
+ * return the same handle, but the handle reference count will be
+ * incremented. This means that the same number of `bgfx::destroyUniform`
+ * must be called to properly destroy the uniform.
+ * 2. Predefined uniforms (declared in `bgfx_shader.sh`):
+ * - `u_viewRect vec4(x, y, width, height)` - view rectangle for current
+ * view, in pixels.
+ * - `u_viewTexel vec4(1.0/width, 1.0/height, undef, undef)` - inverse
+ * width and height
+ * - `u_view mat4` - view matrix
+ * - `u_invView mat4` - inverted view matrix
+ * - `u_proj mat4` - projection matrix
+ * - `u_invProj mat4` - inverted projection matrix
+ * - `u_viewProj mat4` - concatenated view projection matrix
+ * - `u_invViewProj mat4` - concatenated inverted view projection matrix
+ * - `u_model mat4[BGFX_CONFIG_MAX_BONES]` - array of model matrices.
+ * - `u_modelView mat4` - concatenated model view matrix, only first
+ * model matrix from array is used.
+ * - `u_modelViewProj mat4` - concatenated model view projection matrix.
+ * - `u_alphaRef float` - alpha reference value for alpha test.
+ Params:
+ name = Uniform name in shader.
+ type = Type of uniform (See: `bgfx::UniformType`).
+ num = Number of elements in array.
+ */
+ [q{UniformHandle}, q{createUniform}, q{const(char)* name, bgfx.fakeenum.UniformType.Enum type, ushort num=1}, `C++, "bgfx"`],
+
+ /**
+ * Retrieve uniform info.
+ Params:
+ handle = Handle to uniform object.
+ info = Uniform info.
+ */
+ [q{void}, q{getUniformInfo}, q{UniformHandle handle, ref UniformInfo info}, `C++, "bgfx"`],
+
+ /**
+ * Destroy shader uniform parameter.
+ Params:
+ handle = Handle to uniform object.
+ */
+ [q{void}, q{destroy}, q{UniformHandle handle}, `C++, "bgfx"`],
+
+ /**
+ * Create occlusion query.
+ */
+ [q{OcclusionQueryHandle}, q{createOcclusionQuery}, q{}, `C++, "bgfx"`],
+
+ /**
+ * Retrieve occlusion query result from previous frame.
+ Params:
+ handle = Handle to occlusion query object.
+ result = Number of pixels that passed test. This argument
+ can be `NULL` if result of occlusion query is not needed.
+ */
+ [q{OcclusionQueryResult}, q{getResult}, q{OcclusionQueryHandle handle, int* result=null}, `C++, "bgfx"`],
+
+ /**
+ * Destroy occlusion query.
+ Params:
+ handle = Handle to occlusion query object.
+ */
+ [q{void}, q{destroy}, q{OcclusionQueryHandle handle}, `C++, "bgfx"`],
+
+ /**
+ * Set palette color value.
+ Params:
+ index = Index into palette.
+ rgba = RGBA floating point values.
+ */
+ [q{void}, q{setPaletteColor}, q{ubyte index, const(float)* rgba}, `C++, "bgfx"`],
+
+ /**
+ * Set palette color value.
+ Params:
+ index = Index into palette.
+ rgba = Packed 32-bit RGBA value.
+ */
+ [q{void}, q{setPaletteColor}, q{ubyte index, uint rgba}, `C++, "bgfx"`],
+
+ /**
+ * Set view name.
+ * Remarks:
+ * This is debug only feature.
+ * In graphics debugger view name will appear as:
+ * "nnnc <view name>"
+ * ^ ^ ^
+ * | +--- compute (C)
+ * +------ view id
+ Params:
+ id = View id.
+ name = View name.
+ */
+ [q{void}, q{setViewName}, q{ViewID id, const(char)* name}, `C++, "bgfx"`],
+
+ /**
+ * Set view rectangle. Draw primitive outside view will be clipped.
+ Params:
+ id = View id.
+ x = Position x from the left corner of the window.
+ y = Position y from the top corner of the window.
+ width = Width 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"`],
+
+ /**
+ * Set view rectangle. Draw primitive outside view will be clipped.
+ Params:
+ id = View id.
+ x = Position x from the left corner of the window.
+ y = Position y from the top corner of the window.
+ ratio = Width and height will be set in respect to back-buffer size.
+ See: `BackbufferRatio::Enum`.
+ */
+ [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
+ * _x, _y, _width and _height are set to 0, scissor will be disabled.
+ Params:
+ id = View id.
+ x = Position x from the left corner of the window.
+ y = Position y from the top corner of the window.
+ width = Width 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"`],
+
+ /**
+ * Set view clear flags.
+ Params:
+ id = View id.
+ flags = Clear flags. Use `BGFX_CLEAR_NONE` to remove any clear
+ operation. See: `BGFX_CLEAR_*`.
+ rgba = Color clear value.
+ depth = Depth 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"`],
+
+ /**
+ * Set view clear flags with different clear color for each
+ * frame buffer texture. `bgfx::setPaletteColor` must be used to set up a
+ * clear color palette.
+ Params:
+ id = View id.
+ flags = Clear flags. Use `BGFX_CLEAR_NONE` to remove any clear
+ operation. See: `BGFX_CLEAR_*`.
+ depth = Depth clear value.
+ stencil = Stencil clear value.
+ c0 = Palette index for frame buffer attachment 0.
+ c1 = Palette index for frame buffer attachment 1.
+ c2 = Palette index for frame buffer attachment 2.
+ c3 = Palette index for frame buffer attachment 3.
+ c4 = Palette index for frame buffer attachment 4.
+ c5 = Palette index for frame buffer attachment 5.
+ c6 = Palette index for frame buffer attachment 6.
+ 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"`],
+
+ /**
+ * Set view sorting mode.
+ * Remarks:
+ * View mode must be set prior calling `bgfx::submit` for the view.
+ Params:
+ id = View id.
+ mode = View sort mode. See `ViewMode::Enum`.
+ */
+ [q{void}, q{setViewMode}, q{ViewID id, bgfx.fakeenum.ViewMode.Enum mode=ViewMode.default_}, `C++, "bgfx"`],
+
+ /**
+ * Set view frame buffer.
+ * Remarks:
+ * Not persistent after `bgfx::reset` call.
+ Params:
+ id = View id.
+ handle = Frame buffer handle. Passing `BGFX_INVALID_HANDLE` as
+ frame buffer handle will draw primitives from this view into
+ default back buffer.
+ */
+ [q{void}, q{setViewFrameBuffer}, q{ViewID id, FrameBufferHandle handle}, `C++, "bgfx"`],
+
+ /**
+ * Set view's view matrix and projection matrix,
+ * all draw primitives in this view will use these two matrices.
+ Params:
+ id = View id.
+ view = View matrix.
+ proj = Projection matrix.
+ */
+ [q{void}, q{setViewTransform}, q{ViewID id, const(void)* view, const(void)* proj}, `C++, "bgfx"`],
+
+ /**
+ * Post submit view reordering.
+ Params:
+ id = First view id.
+ num = Number of views to remap.
+ order = View remap id table. Passing `NULL` will reset view ids
+ to default state.
+ */
+ [q{void}, q{setViewOrder}, q{ViewID id=0, ushort num=ushort.max, const(ViewID)* order=null}, `C++, "bgfx"`],
+
+ /**
+ * Reset all view settings to default.
+ */
+ [q{void}, q{resetView}, q{ViewID id}, `C++, "bgfx"`],
+
+ /**
+ * Begin submitting draw calls from thread.
+ Params:
+ forThread = Explicitly request an encoder for a worker thread.
+ */
+ [q{Encoder*}, q{begin}, q{bool forThread=false}, `C++, "bgfx"`],
+
+ /**
+ * End submitting draw calls from thread.
+ Params:
+ encoder = Encoder.
+ */
+ [q{void}, q{end}, q{Encoder* encoder}, `C++, "bgfx"`],
+
+ /**
+ * Request screen shot of window back buffer.
+ * Remarks:
+ * `bgfx::CallbackI::screenShot` must be implemented.
+ * Attention: Frame buffer handle must be created with OS' target native window handle.
+ Params:
+ handle = Frame buffer handle. If handle is `BGFX_INVALID_HANDLE` request will be
+ made for main window back buffer.
+ filePath = Will be passed to `bgfx::CallbackI::screenShot` callback.
+ */
+ [q{void}, q{requestScreenShot}, q{FrameBufferHandle handle, const(char)* filePath}, `C++, "bgfx"`],
+
+ /**
+ * Render frame.
+ * Attention: `bgfx::renderFrame` is blocking call. It waits for
+ * `bgfx::frame` to be called from API thread to process frame.
+ * If timeout value is passed call will timeout and return even
+ * if `bgfx::frame` is not called.
+ * Warning: This call should be only used on platforms that don't
+ * allow creating separate rendering thread. If it is called before
+ * to bgfx::init, render thread won't be created by bgfx::init call.
+ Params:
+ msecs = Timeout in milliseconds.
+ */
+ [q{RenderFrame}, q{renderFrame}, q{int msecs=-1}, `C++, "bgfx"`],
+
+ /**
+ * Set platform data.
+ * Warning: Must be called before `bgfx::init`.
+ Params:
+ data = Platform data.
+ */
+ [q{void}, q{setPlatformData}, q{ref const PlatformData data}, `C++, "bgfx"`],
+
+ /**
+ * Get internal data for interop.
+ * Attention: It's expected you understand some bgfx internals before you
+ * use this call.
+ * Warning: Must be called only on render thread.
+ */
+ [q{const(InternalData)*}, q{getInternalData}, q{}, `C++, "bgfx"`],
+
+ /**
+ * Override internal texture with externally created texture. Previously
+ * created internal texture will released.
+ * Attention: It's expected you understand some bgfx internals before you
+ * use this call.
+ * Warning: Must be called only on render thread.
+ Params:
+ handle = Texture handle.
+ ptr = Native API pointer to texture.
+ */
+ [q{size_t}, q{overrideInternal}, q{TextureHandle handle, size_t ptr}, `C++, "bgfx"`],
+
+ /**
+ * Override internal texture by creating new texture. Previously created
+ * internal texture will released.
+ * Attention: It's expected you understand some bgfx internals before you
+ * use this call.
+ * Returns: Native API pointer to texture. If result is 0, texture is not created yet from the
+ * main thread.
+ * Warning: Must be called only on render thread.
+ Params:
+ handle = Texture handle.
+ width = Width.
+ height = Height.
+ numMIPs = Number of mip-maps.
+ format = Texture format. See: `TextureFormat::Enum`.
+ 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.
+ */
+ [q{size_t}, q{overrideInternal}, q{TextureHandle handle, ushort width, ushort height, ubyte numMIPs, bgfx.fakeenum.TextureFormat.Enum format, ulong flags}, `C++, "bgfx"`],
+
+ /**
+ * Sets a debug marker. This allows you to group graphics calls together for easy browsing in
+ * graphics debugging tools.
+ Params:
+ marker = Marker string.
+ */
+ [q{void}, q{setMarker}, q{const(char)* marker}, `C++, "bgfx"`],
+
+ /**
+ * Set render states for draw primitive.
+ * Remarks:
+ * 1. To set up more complex states use:
+ * `BGFX_STATE_ALPHA_REF(_ref)`,
+ * `BGFX_STATE_POINT_SIZE(_size)`,
+ * `BGFX_STATE_BLEND_FUNC(_src, _dst)`,
+ * `BGFX_STATE_BLEND_FUNC_SEPARATE(_srcRGB, _dstRGB, _srcA, _dstA)`,
+ * `BGFX_STATE_BLEND_EQUATION(_equation)`,
+ * `BGFX_STATE_BLEND_EQUATION_SEPARATE(_equationRGB, _equationA)`
+ * 2. `BGFX_STATE_BLEND_EQUATION_ADD` is set when no other blend
+ * equation is specified.
+ Params:
+ state = State flags. Default state for primitive type is
+ triangles. See: `BGFX_STATE_DEFAULT`.
+ - `BGFX_STATE_DEPTH_TEST_*` - Depth test function.
+ - `BGFX_STATE_BLEND_*` - See remark 1 about BGFX_STATE_BLEND_FUNC.
+ - `BGFX_STATE_BLEND_EQUATION_*` - See remark 2.
+ - `BGFX_STATE_CULL_*` - Backface culling mode.
+ - `BGFX_STATE_WRITE_*` - Enable R, G, B, A or Z write.
+ - `BGFX_STATE_MSAA` - Enable hardware multisample antialiasing.
+ - `BGFX_STATE_PT_[TRISTRIP/LINES/POINTS]` - Primitive type.
+ rgba = Sets blend factor used by `BGFX_STATE_BLEND_FACTOR` and
+ `BGFX_STATE_BLEND_INV_FACTOR` blend modes.
+ */
+ [q{void}, q{setState}, q{ulong state, uint rgba=0}, `C++, "bgfx"`],
+
+ /**
+ * Set condition for rendering.
+ Params:
+ handle = Occlusion query handle.
+ visible = Render if occlusion query is visible.
+ */
+ [q{void}, q{setCondition}, q{OcclusionQueryHandle handle, bool visible}, `C++, "bgfx"`],
+
+ /**
+ * Set stencil test state.
+ Params:
+ fstencil = Front stencil state.
+ bstencil = Back stencil state. If back is set to `BGFX_STENCIL_NONE`
+ _fstencil is applied to both front and back facing primitives.
+ */
+ [q{void}, q{setStencil}, q{uint fstencil, uint bstencil=Stencil.none}, `C++, "bgfx"`],
+
+ /**
+ * Set scissor for draw primitive.
+ * Remarks:
+ * To scissor for all primitives in view see `bgfx::setViewScissor`.
+ Params:
+ x = Position x from the left corner of the window.
+ y = Position y from the top corner of the window.
+ width = Width of view scissor region.
+ height = Height of view scissor region.
+ */
+ [q{ushort}, q{setScissor}, q{ushort x, ushort y, ushort width, ushort height}, `C++, "bgfx"`],
+
+ /**
+ * Set scissor from cache for draw primitive.
+ * Remarks:
+ * To scissor for all primitives in view see `bgfx::setViewScissor`.
+ Params:
+ cache = Index in scissor cache.
+ */
+ [q{void}, q{setScissor}, q{ushort cache=ushort.max}, `C++, "bgfx"`],
+
+ /**
+ * Set model matrix for draw primitive. If it is not called,
+ * the model will be rendered with an identity model matrix.
+ Params:
+ mtx = Pointer to first matrix in array.
+ num = Number of matrices in array.
+ */
+ [q{uint}, q{setTransform}, q{const(void)* mtx, ushort num}, `C++, "bgfx"`],
+
+ /**
+ * Set model matrix from matrix cache for draw primitive.
+ Params:
+ cache = Index in matrix cache.
+ num = Number of matrices from cache.
+ */
+ [q{void}, q{setTransform}, q{uint cache, ushort num=1}, `C++, "bgfx"`],
+
+ /**
+ * Reserve matrices in internal matrix cache.
+ * Attention: Pointer returned can be modified until `bgfx::frame` is called.
+ Params:
+ transform = Pointer to `Transform` structure.
+ num = Number of matrices.
+ */
+ [q{uint}, q{allocTransform}, q{Transform* transform, ushort num}, `C++, "bgfx"`],
+
+ /**
+ * Set shader uniform parameter for draw primitive.
+ Params:
+ handle = Uniform.
+ value = Pointer to uniform data.
+ num = Number of elements. Passing `UINT16_MAX` will
+ use the _num passed on uniform creation.
+ */
+ [q{void}, q{setUniform}, q{UniformHandle handle, const(void)* value, ushort num=1}, `C++, "bgfx"`],
+
+ /**
+ * Set index buffer for draw primitive.
+ Params:
+ handle = Index buffer.
+ */
+ [q{void}, q{setIndexBuffer}, q{IndexBufferHandle handle}, `C++, "bgfx"`],
+
+ /**
+ * Set index buffer for draw primitive.
+ Params:
+ handle = Index buffer.
+ firstIndex = First index to render.
+ numIndices = Number of indices to render.
+ */
+ [q{void}, q{setIndexBuffer}, q{IndexBufferHandle handle, uint firstIndex, uint numIndices}, `C++, "bgfx"`],
+
+ /**
+ * Set index buffer for draw primitive.
+ Params:
+ handle = Dynamic index buffer.
+ */
+ [q{void}, q{setIndexBuffer}, q{DynamicIndexBufferHandle handle}, `C++, "bgfx"`],
+
+ /**
+ * Set index buffer for draw primitive.
+ Params:
+ handle = Dynamic index buffer.
+ firstIndex = First index to render.
+ numIndices = Number of indices to render.
+ */
+ [q{void}, q{setIndexBuffer}, q{DynamicIndexBufferHandle handle, uint firstIndex, uint numIndices}, `C++, "bgfx"`],
+
+ /**
+ * Set index buffer for draw primitive.
+ Params:
+ tib = Transient index buffer.
+ */
+ [q{void}, q{setIndexBuffer}, q{const(TransientIndexBuffer)* tib}, `C++, "bgfx"`],
+
+ /**
+ * Set index buffer for draw primitive.
+ Params:
+ tib = Transient index buffer.
+ firstIndex = First index to render.
+ numIndices = Number of indices to render.
+ */
+ [q{void}, q{setIndexBuffer}, q{const(TransientIndexBuffer)* tib, uint firstIndex, uint numIndices}, `C++, "bgfx"`],
+
+ /**
+ * Set vertex buffer for draw primitive.
+ Params:
+ stream = Vertex stream.
+ handle = Vertex buffer.
+ */
+ [q{void}, q{setVertexBuffer}, q{ubyte stream, VertexBufferHandle handle}, `C++, "bgfx"`],
+
+ /**
+ * Set vertex buffer for draw primitive.
+ Params:
+ stream = Vertex stream.
+ handle = Vertex buffer.
+ startVertex = First vertex to render.
+ numVertices = Number of vertices to render.
+ layoutHandle = Vertex layout for aliasing vertex buffer. If invalid
+ handle is used, vertex layout used for creation
+ of vertex buffer will be used.
+ */
+ [q{void}, q{setVertexBuffer}, q{ubyte stream, VertexBufferHandle handle, uint startVertex, uint numVertices, VertexLayoutHandle layoutHandle=invalidHandle!VertexLayoutHandle}, `C++, "bgfx"`],
+
+ /**
+ * Set vertex buffer for draw primitive.
+ Params:
+ stream = Vertex stream.
+ handle = Dynamic vertex buffer.
+ */
+ [q{void}, q{setVertexBuffer}, q{ubyte stream, DynamicVertexBufferHandle handle}, `C++, "bgfx"`],
+
+ /**
+ * Set vertex buffer for draw primitive.
+ Params:
+ stream = Vertex stream.
+ handle = Dynamic vertex buffer.
+ startVertex = First vertex to render.
+ numVertices = Number of vertices to render.
+ layoutHandle = Vertex layout for aliasing vertex buffer. If invalid
+ handle is used, vertex layout used for creation
+ of vertex buffer will be used.
+ */
+ [q{void}, q{setVertexBuffer}, q{ubyte stream, DynamicVertexBufferHandle handle, uint startVertex, uint numVertices, VertexLayoutHandle layoutHandle=invalidHandle!VertexLayoutHandle}, `C++, "bgfx"`],
+
+ /**
+ * Set vertex buffer for draw primitive.
+ Params:
+ stream = Vertex stream.
+ tvb = Transient vertex buffer.
+ */
+ [q{void}, q{setVertexBuffer}, q{ubyte stream, const(TransientVertexBuffer)* tvb}, `C++, "bgfx"`],
+
+ /**
+ * Set vertex buffer for draw primitive.
+ Params:
+ stream = Vertex stream.
+ tvb = Transient vertex buffer.
+ startVertex = First vertex to render.
+ numVertices = Number of vertices to render.
+ layoutHandle = Vertex layout for aliasing vertex buffer. If invalid
+ handle is used, vertex layout used for creation
+ of vertex buffer will be used.
+ */
+ [q{void}, q{setVertexBuffer}, q{ubyte stream, const(TransientVertexBuffer)* tvb, uint startVertex, uint numVertices, VertexLayoutHandle layoutHandle=invalidHandle!VertexLayoutHandle}, `C++, "bgfx"`],
+
+ /**
+ * Set number of vertices for auto generated vertices use in conjunction
+ * with gl_VertexID.
+ * Attention: Availability depends on: `BGFX_CAPS_VERTEX_ID`.
+ Params:
+ numVertices = Number of vertices.
+ */
+ [q{void}, q{setVertexCount}, q{uint numVertices}, `C++, "bgfx"`],
+
+ /**
+ * Set instance data buffer for draw primitive.
+ Params:
+ idb = Transient instance data buffer.
+ */
+ [q{void}, q{setInstanceDataBuffer}, q{const(InstanceDataBuffer)* idb}, `C++, "bgfx"`],
+
+ /**
+ * Set instance data buffer for draw primitive.
+ Params:
+ idb = Transient instance data buffer.
+ start = First instance data.
+ num = Number of data instances.
+ */
+ [q{void}, q{setInstanceDataBuffer}, q{const(InstanceDataBuffer)* idb, uint start, uint num}, `C++, "bgfx"`],
+
+ /**
+ * Set instance data buffer for draw primitive.
+ Params:
+ handle = Vertex buffer.
+ startVertex = First instance data.
+ num = Number of data instances.
+ */
+ [q{void}, q{setInstanceDataBuffer}, q{VertexBufferHandle handle, uint startVertex, uint num}, `C++, "bgfx"`],
+
+ /**
+ * Set instance data buffer for draw primitive.
+ Params:
+ handle = Dynamic vertex buffer.
+ startVertex = First instance data.
+ num = Number of data instances.
+ */
+ [q{void}, q{setInstanceDataBuffer}, q{DynamicVertexBufferHandle handle, uint startVertex, uint num}, `C++, "bgfx"`],
+
+ /**
+ * Set number of instances for auto generated instances use in conjunction
+ * with gl_InstanceID.
+ * Attention: Availability depends on: `BGFX_CAPS_VERTEX_ID`.
+ */
+ [q{void}, q{setInstanceCount}, q{uint numInstances}, `C++, "bgfx"`],
+
+ /**
+ * Set texture stage for draw primitive.
+ Params:
+ stage = Texture unit.
+ sampler = Program sampler.
+ handle = Texture handle.
+ flags = Texture sampling mode. Default value UINT32_MAX uses
+ texture sampling settings from the texture.
+ - `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.
+ */
+ [q{void}, q{setTexture}, q{ubyte stage, UniformHandle sampler, TextureHandle handle, uint flags=uint.max}, `C++, "bgfx"`],
+
+ /**
+ * Submit an empty primitive for rendering. Uniforms and draw state
+ * will be applied but no geometry will be submitted.
+ * Remarks:
+ * These empty draw calls will sort before ordinary draw calls.
+ Params:
+ id = View id.
+ */
+ [q{void}, q{touch}, q{ViewID id}, `C++, "bgfx"`],
+
+ /**
+ * Submit primitive for rendering.
+ Params:
+ id = View id.
+ program = Program.
+ depth = Depth for sorting.
+ 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"`],
+
+ /**
+ * Submit primitive with occlusion query for rendering.
+ Params:
+ id = View id.
+ program = Program.
+ occlusionQuery = Occlusion query.
+ depth = Depth for sorting.
+ 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"`],
+
+ /**
+ * Submit primitive for rendering with index and instance data info from
+ * indirect buffer.
+ * Attention: Availability depends on: `BGFX_CAPS_DRAW_INDIRECT`.
+ Params:
+ id = View id.
+ program = Program.
+ indirectHandle = Indirect buffer.
+ start = First element in indirect buffer.
+ num = Number of draws.
+ depth = Depth for sorting.
+ 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"`],
+
+ /**
+ * Submit primitive for rendering with index and instance data info and
+ * draw count from indirect buffers.
+ * Attention: Availability depends on: `BGFX_CAPS_DRAW_INDIRECT_COUNT`.
+ Params:
+ id = View id.
+ program = Program.
+ indirectHandle = Indirect buffer.
+ start = First element in indirect buffer.
+ numHandle = Buffer for number of draws. Must be
+ created with `BGFX_BUFFER_INDEX32` and `BGFX_BUFFER_DRAW_INDIRECT`.
+ numIndex = Element in number buffer.
+ numMax = Max number of draws.
+ depth = Depth for sorting.
+ 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"`],
+
+ /**
+ * Set compute index buffer.
+ Params:
+ stage = Compute stage.
+ handle = Index buffer handle.
+ access = Buffer access. See `Access::Enum`.
+ */
+ [q{void}, q{setBuffer}, q{ubyte stage, IndexBufferHandle handle, bgfx.fakeenum.Access.Enum access}, `C++, "bgfx"`],
+
+ /**
+ * Set compute vertex buffer.
+ Params:
+ stage = Compute stage.
+ handle = Vertex buffer handle.
+ access = Buffer access. See `Access::Enum`.
+ */
+ [q{void}, q{setBuffer}, q{ubyte stage, VertexBufferHandle handle, bgfx.fakeenum.Access.Enum access}, `C++, "bgfx"`],
+
+ /**
+ * Set compute dynamic index buffer.
+ Params:
+ stage = Compute stage.
+ handle = Dynamic index buffer handle.
+ access = Buffer access. See `Access::Enum`.
+ */
+ [q{void}, q{setBuffer}, q{ubyte stage, DynamicIndexBufferHandle handle, bgfx.fakeenum.Access.Enum access}, `C++, "bgfx"`],
+
+ /**
+ * Set compute dynamic vertex buffer.
+ Params:
+ stage = Compute stage.
+ handle = Dynamic vertex buffer handle.
+ access = Buffer access. See `Access::Enum`.
+ */
+ [q{void}, q{setBuffer}, q{ubyte stage, DynamicVertexBufferHandle handle, bgfx.fakeenum.Access.Enum access}, `C++, "bgfx"`],
+
+ /**
+ * Set compute indirect buffer.
+ Params:
+ stage = Compute stage.
+ handle = Indirect buffer handle.
+ access = Buffer access. See `Access::Enum`.
+ */
+ [q{void}, q{setBuffer}, q{ubyte stage, IndirectBufferHandle handle, bgfx.fakeenum.Access.Enum access}, `C++, "bgfx"`],
+
+ /**
+ * Set compute image from texture.
+ Params:
+ stage = Compute stage.
+ handle = Texture handle.
+ mip = Mip level.
+ access = Image access. See `Access::Enum`.
+ format = Texture format. See: `TextureFormat::Enum`.
+ */
+ [q{void}, q{setImage}, q{ubyte stage, TextureHandle handle, ubyte mip, bgfx.fakeenum.Access.Enum access, bgfx.fakeenum.TextureFormat.Enum format=TextureFormat.count}, `C++, "bgfx"`],
+
+ /**
+ * Dispatch compute.
+ Params:
+ id = View id.
+ program = Compute program.
+ numX = Number of groups X.
+ numY = Number of groups Y.
+ numZ = Number of groups Z.
+ 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"`],
+
+ /**
+ * Dispatch compute indirect.
+ Params:
+ id = View id.
+ program = Compute program.
+ indirectHandle = Indirect buffer.
+ start = First element in indirect buffer.
+ num = Number of dispatches.
+ 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"`],
+
+ /**
+ * Discard previously set state for draw or compute call.
+ Params:
+ flags = Draw/compute states to discard.
+ */
+ [q{void}, q{discard}, q{ubyte flags=Discard.all}, `C++, "bgfx"`],
+
+ /**
+ * Blit 2D texture region between two 2D textures.
+ * Attention: Destination texture must be created with `BGFX_TEXTURE_BLIT_DST` flag.
+ * Attention: Availability depends on: `BGFX_CAPS_TEXTURE_BLIT`.
+ Params:
+ id = View id.
+ dst = Destination texture handle.
+ dstX = Destination texture X position.
+ dstY = Destination texture Y position.
+ src = Source texture handle.
+ srcX = Source texture X position.
+ srcY = Source texture Y position.
+ width = Width 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"`],
+
+ /**
+ * Blit 2D texture region between two 2D textures.
+ * Attention: Destination texture must be created with `BGFX_TEXTURE_BLIT_DST` flag.
+ * Attention: Availability depends on: `BGFX_CAPS_TEXTURE_BLIT`.
+ Params:
+ id = View id.
+ dst = Destination texture handle.
+ dstMIP = Destination texture mip level.
+ dstX = Destination texture X position.
+ dstY = Destination texture Y position.
+ dstZ = If texture is 2D this argument should be 0. If destination texture is cube
+ this argument represents destination texture cube face. For 3D texture this argument
+ represents destination texture Z position.
+ src = Source texture handle.
+ srcMIP = Source texture mip level.
+ srcX = Source texture X position.
+ srcY = Source texture Y position.
+ srcZ = If texture is 2D this argument should be 0. If source texture is cube
+ this argument represents source texture cube face. For 3D texture this argument
+ represents source texture Z position.
+ width = Width of region.
+ height = Height of region.
+ depth = If texture is 3D this argument represents depth of region, otherwise it's
+ 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"`],
+
+ ]);
+ return ret;
+}(), __MODULE__, "Resolution, Init, Attachment, VertexLayout, Encoder, "));
+
+static if(!staticBinding):
+import bindbc.loader;
+
+debug{
+ mixin(makeDynloadFns("Bgfx", makeLibPaths(["bgfx-shared-libDebug", "bgfxDebug", "bgfx"]), [__MODULE__]));
+}else{
+ mixin(makeDynloadFns("Bgfx", makeLibPaths(["bgfx-shared-libRelease", "bgfxRelease", "bgfx"]), [__MODULE__]));
+}
diff --git a/3rdparty/bgfx/bindings/d/types.d b/3rdparty/bgfx/bindings/d/types.d
deleted file mode 100644
index ae44638f4cd..00000000000
--- a/3rdparty/bgfx/bindings/d/types.d
+++ /dev/null
@@ -1,1140 +0,0 @@
-/*
- *
- * AUTO GENERATED! DO NOT EDIT!
- *
- */
-
-module bindbc.bgfx.types;
-
-public import core.stdc.stdarg : va_list;
-
-enum expandEnum(EnumType, string fqnEnumType = EnumType.stringof) = (){
- string expandEnum;
- foreach(m; __traits(allMembers, EnumType)){
- expandEnum ~= "alias " ~ m ~ " = " ~ fqnEnumType ~ "." ~ m ~ ";";
- }
- return expandEnum;
-}();
-
-extern(C) @nogc nothrow:
-
-enum uint BGFX_API_VERSION = 118;
-
-alias bgfx_view_id_t = ushort;
-
-//NOTE: TEMPORARY fix to some missing preprocessor function-macros...
-static BGFX_STATE_BLEND_FUNC_SEPARATE(ulong _srcRGB, ulong _dstRGB, ulong _srcA, ulong _dstA){
- return (0UL
- | ( ( cast(ulong)_srcRGB | ( cast(ulong)_dstRGB<<4) ) )
- | ( ( cast(ulong)_srcA | ( cast(ulong)_dstA <<4) )<<8)
- );
-}
-
-/// Blend equation separate.
-static BGFX_STATE_BLEND_EQUATION_SEPARATE(ulong _equationRGB, ulong _equationA){ return ( cast(ulong)_equationRGB | (cast(ulong)_equationA<<3) ); }
-
-/// Blend function.
-static BGFX_STATE_BLEND_FUNC(ulong _src, ulong _dst){ return BGFX_STATE_BLEND_FUNC_SEPARATE(_src, _dst, _src, _dst); }
-
-/// Blend equation.
-static BGFX_STATE_BLEND_EQUATION(ulong _equation){ return BGFX_STATE_BLEND_EQUATION_SEPARATE(_equation, _equation); }
-
-/// Utility predefined blend modes.
-
-/// Additive blending.
-static BGFX_STATE_BLEND_ADD(){ return (0 | BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_ONE, BGFX_STATE_BLEND_ONE)); }
-
-/// Alpha blend.
-static BGFX_STATE_BLEND_ALPHA(){ return (0 | BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_SRC_ALPHA, BGFX_STATE_BLEND_INV_SRC_ALPHA)); }
-
-/// Memory release callback.
-
-/// Color RGB/alpha/depth write. When it's not specified write will be disabled.
-enum ulong BGFX_STATE_WRITE_R = 0x0000000000000001; /// Enable R write.
-enum ulong BGFX_STATE_WRITE_G = 0x0000000000000002; /// Enable G write.
-enum ulong BGFX_STATE_WRITE_B = 0x0000000000000004; /// Enable B write.
-enum ulong BGFX_STATE_WRITE_A = 0x0000000000000008; /// Enable alpha write.
-enum ulong BGFX_STATE_WRITE_Z = 0x0000004000000000; /// Enable depth write.
-enum ulong BGFX_STATE_WRITE_RGB = 0x0000000000000007; /// Enable RGB write.
-enum ulong BGFX_STATE_WRITE_MASK = 0x000000400000000f; /// Write all channels mask.
-
-/// Depth test state. When `BGFX_STATE_DEPTH_` is not specified depth test will be disabled.
-enum ulong BGFX_STATE_DEPTH_TEST_LESS = 0x0000000000000010; /// Enable depth test, less.
-enum ulong BGFX_STATE_DEPTH_TEST_LEQUAL = 0x0000000000000020; /// Enable depth test, less or equal.
-enum ulong BGFX_STATE_DEPTH_TEST_EQUAL = 0x0000000000000030; /// Enable depth test, equal.
-enum ulong BGFX_STATE_DEPTH_TEST_GEQUAL = 0x0000000000000040; /// Enable depth test, greater or equal.
-enum ulong BGFX_STATE_DEPTH_TEST_GREATER = 0x0000000000000050; /// Enable depth test, greater.
-enum ulong BGFX_STATE_DEPTH_TEST_NOTEQUAL = 0x0000000000000060; /// Enable depth test, not equal.
-enum ulong BGFX_STATE_DEPTH_TEST_NEVER = 0x0000000000000070; /// Enable depth test, never.
-enum ulong BGFX_STATE_DEPTH_TEST_ALWAYS = 0x0000000000000080; /// Enable depth test, always.
-enum ulong BGFX_STATE_DEPTH_TEST_SHIFT = 4; /// Depth test state bit shift
-enum ulong BGFX_STATE_DEPTH_TEST_MASK = 0x00000000000000f0; /// Depth test state bit mask
-
-/**
- * Use BGFX_STATE_BLEND_FUNC(_src, _dst) or BGFX_STATE_BLEND_FUNC_SEPARATE(_srcRGB, _dstRGB, _srcA, _dstA)
- * helper macros.
- */
-enum ulong BGFX_STATE_BLEND_ZERO = 0x0000000000001000; /// 0, 0, 0, 0
-enum ulong BGFX_STATE_BLEND_ONE = 0x0000000000002000; /// 1, 1, 1, 1
-enum ulong BGFX_STATE_BLEND_SRC_COLOR = 0x0000000000003000; /// Rs, Gs, Bs, As
-enum ulong BGFX_STATE_BLEND_INV_SRC_COLOR = 0x0000000000004000; /// 1-Rs, 1-Gs, 1-Bs, 1-As
-enum ulong BGFX_STATE_BLEND_SRC_ALPHA = 0x0000000000005000; /// As, As, As, As
-enum ulong BGFX_STATE_BLEND_INV_SRC_ALPHA = 0x0000000000006000; /// 1-As, 1-As, 1-As, 1-As
-enum ulong BGFX_STATE_BLEND_DST_ALPHA = 0x0000000000007000; /// Ad, Ad, Ad, Ad
-enum ulong BGFX_STATE_BLEND_INV_DST_ALPHA = 0x0000000000008000; /// 1-Ad, 1-Ad, 1-Ad ,1-Ad
-enum ulong BGFX_STATE_BLEND_DST_COLOR = 0x0000000000009000; /// Rd, Gd, Bd, Ad
-enum ulong BGFX_STATE_BLEND_INV_DST_COLOR = 0x000000000000a000; /// 1-Rd, 1-Gd, 1-Bd, 1-Ad
-enum ulong BGFX_STATE_BLEND_SRC_ALPHA_SAT = 0x000000000000b000; /// f, f, f, 1; f = min(As, 1-Ad)
-enum ulong BGFX_STATE_BLEND_FACTOR = 0x000000000000c000; /// Blend factor
-enum ulong BGFX_STATE_BLEND_INV_FACTOR = 0x000000000000d000; /// 1-Blend factor
-enum ulong BGFX_STATE_BLEND_SHIFT = 12; /// Blend state bit shift
-enum ulong BGFX_STATE_BLEND_MASK = 0x000000000ffff000; /// Blend state bit mask
-
-/**
- * Use BGFX_STATE_BLEND_EQUATION(_equation) or BGFX_STATE_BLEND_EQUATION_SEPARATE(_equationRGB, _equationA)
- * helper macros.
- */
-enum ulong BGFX_STATE_BLEND_EQUATION_ADD = 0x0000000000000000; /// Blend add: src + dst.
-enum ulong BGFX_STATE_BLEND_EQUATION_SUB = 0x0000000010000000; /// Blend subtract: src - dst.
-enum ulong BGFX_STATE_BLEND_EQUATION_REVSUB = 0x0000000020000000; /// Blend reverse subtract: dst - src.
-enum ulong BGFX_STATE_BLEND_EQUATION_MIN = 0x0000000030000000; /// Blend min: min(src, dst).
-enum ulong BGFX_STATE_BLEND_EQUATION_MAX = 0x0000000040000000; /// Blend max: max(src, dst).
-enum ulong BGFX_STATE_BLEND_EQUATION_SHIFT = 28; /// Blend equation bit shift
-enum ulong BGFX_STATE_BLEND_EQUATION_MASK = 0x00000003f0000000; /// Blend equation bit mask
-
-/// Cull state. When `BGFX_STATE_CULL_*` is not specified culling will be disabled.
-enum ulong BGFX_STATE_CULL_CW = 0x0000001000000000; /// Cull clockwise triangles.
-enum ulong BGFX_STATE_CULL_CCW = 0x0000002000000000; /// Cull counter-clockwise triangles.
-enum ulong BGFX_STATE_CULL_SHIFT = 36; /// Culling mode bit shift
-enum ulong BGFX_STATE_CULL_MASK = 0x0000003000000000; /// Culling mode bit mask
-
-/// Alpha reference value.
-enum ulong BGFX_STATE_ALPHA_REF_SHIFT = 40; /// Alpha reference bit shift
-enum ulong BGFX_STATE_ALPHA_REF_MASK = 0x0000ff0000000000; /// Alpha reference bit mask
-ulong BGFX_STATE_ALPHA_REF (ulong v) { return (v << BGFX_STATE_ALPHA_REF_SHIFT) & BGFX_STATE_ALPHA_REF_MASK; }
-
-enum ulong BGFX_STATE_PT_TRISTRIP = 0x0001000000000000; /// Tristrip.
-enum ulong BGFX_STATE_PT_LINES = 0x0002000000000000; /// Lines.
-enum ulong BGFX_STATE_PT_LINESTRIP = 0x0003000000000000; /// Line strip.
-enum ulong BGFX_STATE_PT_POINTS = 0x0004000000000000; /// Points.
-enum ulong BGFX_STATE_PT_SHIFT = 48; /// Primitive type bit shift
-enum ulong BGFX_STATE_PT_MASK = 0x0007000000000000; /// Primitive type bit mask
-
-/// Point size value.
-enum ulong BGFX_STATE_POINT_SIZE_SHIFT = 52; /// Point size bit shift
-enum ulong BGFX_STATE_POINT_SIZE_MASK = 0x00f0000000000000; /// Point size bit mask
-ulong BGFX_STATE_POINT_SIZE (ulong v) { return (v << BGFX_STATE_POINT_SIZE_SHIFT) & BGFX_STATE_POINT_SIZE_MASK; }
-
-/**
- * Enable MSAA write when writing into MSAA frame buffer.
- * This flag is ignored when not writing into MSAA frame buffer.
- */
-enum ulong BGFX_STATE_MSAA = 0x0100000000000000; /// Enable MSAA rasterization.
-enum ulong BGFX_STATE_LINEAA = 0x0200000000000000; /// Enable line AA rasterization.
-enum ulong BGFX_STATE_CONSERVATIVE_RASTER = 0x0400000000000000; /// Enable conservative rasterization.
-enum ulong BGFX_STATE_NONE = 0x0000000000000000; /// No state.
-enum ulong BGFX_STATE_FRONT_CCW = 0x0000008000000000; /// Front counter-clockwise (default is clockwise).
-enum ulong BGFX_STATE_BLEND_INDEPENDENT = 0x0000000400000000; /// Enable blend independent.
-enum ulong BGFX_STATE_BLEND_ALPHA_TO_COVERAGE = 0x0000000800000000; /// Enable alpha to coverage.
-/**
- * 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).
- */
-enum ulong BGFX_STATE_DEFAULT = BGFX_STATE_WRITE_RGB | BGFX_STATE_WRITE_A | BGFX_STATE_WRITE_Z | BGFX_STATE_DEPTH_TEST_LESS | BGFX_STATE_CULL_CW | BGFX_STATE_MSAA;
-enum ulong BGFX_STATE_MASK = 0xffffffffffffffff; /// State bit mask
-
-/// Do not use!
-enum ulong BGFX_STATE_RESERVED_SHIFT = 61;
-enum ulong BGFX_STATE_RESERVED_MASK = 0xe000000000000000;
-
-/// Set stencil ref value.
-enum uint BGFX_STENCIL_FUNC_REF_SHIFT = 0;
-enum uint BGFX_STENCIL_FUNC_REF_MASK = 0x000000ff;
-uint BGFX_STENCIL_FUNC_REF (uint v) { return (v << BGFX_STENCIL_FUNC_REF_SHIFT) & BGFX_STENCIL_FUNC_REF_MASK; }
-
-/// Set stencil rmask value.
-enum uint BGFX_STENCIL_FUNC_RMASK_SHIFT = 8;
-enum uint BGFX_STENCIL_FUNC_RMASK_MASK = 0x0000ff00;
-uint BGFX_STENCIL_FUNC_RMASK (uint v) { return (v << BGFX_STENCIL_FUNC_RMASK_SHIFT) & BGFX_STENCIL_FUNC_RMASK_MASK; }
-
-enum uint BGFX_STENCIL_NONE = 0x00000000;
-enum uint BGFX_STENCIL_MASK = 0xffffffff;
-enum uint BGFX_STENCIL_DEFAULT = 0x00000000;
-
-enum uint BGFX_STENCIL_TEST_LESS = 0x00010000; /// Enable stencil test, less.
-enum uint BGFX_STENCIL_TEST_LEQUAL = 0x00020000; /// Enable stencil test, less or equal.
-enum uint BGFX_STENCIL_TEST_EQUAL = 0x00030000; /// Enable stencil test, equal.
-enum uint BGFX_STENCIL_TEST_GEQUAL = 0x00040000; /// Enable stencil test, greater or equal.
-enum uint BGFX_STENCIL_TEST_GREATER = 0x00050000; /// Enable stencil test, greater.
-enum uint BGFX_STENCIL_TEST_NOTEQUAL = 0x00060000; /// Enable stencil test, not equal.
-enum uint BGFX_STENCIL_TEST_NEVER = 0x00070000; /// Enable stencil test, never.
-enum uint BGFX_STENCIL_TEST_ALWAYS = 0x00080000; /// Enable stencil test, always.
-enum uint BGFX_STENCIL_TEST_SHIFT = 16; /// Stencil test bit shift
-enum uint BGFX_STENCIL_TEST_MASK = 0x000f0000; /// Stencil test bit mask
-
-enum uint BGFX_STENCIL_OP_FAIL_S_ZERO = 0x00000000; /// Zero.
-enum uint BGFX_STENCIL_OP_FAIL_S_KEEP = 0x00100000; /// Keep.
-enum uint BGFX_STENCIL_OP_FAIL_S_REPLACE = 0x00200000; /// Replace.
-enum uint BGFX_STENCIL_OP_FAIL_S_INCR = 0x00300000; /// Increment and wrap.
-enum uint BGFX_STENCIL_OP_FAIL_S_INCRSAT = 0x00400000; /// Increment and clamp.
-enum uint BGFX_STENCIL_OP_FAIL_S_DECR = 0x00500000; /// Decrement and wrap.
-enum uint BGFX_STENCIL_OP_FAIL_S_DECRSAT = 0x00600000; /// Decrement and clamp.
-enum uint BGFX_STENCIL_OP_FAIL_S_INVERT = 0x00700000; /// Invert.
-enum uint BGFX_STENCIL_OP_FAIL_S_SHIFT = 20; /// Stencil operation fail bit shift
-enum uint BGFX_STENCIL_OP_FAIL_S_MASK = 0x00f00000; /// Stencil operation fail bit mask
-
-enum uint BGFX_STENCIL_OP_FAIL_Z_ZERO = 0x00000000; /// Zero.
-enum uint BGFX_STENCIL_OP_FAIL_Z_KEEP = 0x01000000; /// Keep.
-enum uint BGFX_STENCIL_OP_FAIL_Z_REPLACE = 0x02000000; /// Replace.
-enum uint BGFX_STENCIL_OP_FAIL_Z_INCR = 0x03000000; /// Increment and wrap.
-enum uint BGFX_STENCIL_OP_FAIL_Z_INCRSAT = 0x04000000; /// Increment and clamp.
-enum uint BGFX_STENCIL_OP_FAIL_Z_DECR = 0x05000000; /// Decrement and wrap.
-enum uint BGFX_STENCIL_OP_FAIL_Z_DECRSAT = 0x06000000; /// Decrement and clamp.
-enum uint BGFX_STENCIL_OP_FAIL_Z_INVERT = 0x07000000; /// Invert.
-enum uint BGFX_STENCIL_OP_FAIL_Z_SHIFT = 24; /// Stencil operation depth fail bit shift
-enum uint BGFX_STENCIL_OP_FAIL_Z_MASK = 0x0f000000; /// Stencil operation depth fail bit mask
-
-enum uint BGFX_STENCIL_OP_PASS_Z_ZERO = 0x00000000; /// Zero.
-enum uint BGFX_STENCIL_OP_PASS_Z_KEEP = 0x10000000; /// Keep.
-enum uint BGFX_STENCIL_OP_PASS_Z_REPLACE = 0x20000000; /// Replace.
-enum uint BGFX_STENCIL_OP_PASS_Z_INCR = 0x30000000; /// Increment and wrap.
-enum uint BGFX_STENCIL_OP_PASS_Z_INCRSAT = 0x40000000; /// Increment and clamp.
-enum uint BGFX_STENCIL_OP_PASS_Z_DECR = 0x50000000; /// Decrement and wrap.
-enum uint BGFX_STENCIL_OP_PASS_Z_DECRSAT = 0x60000000; /// Decrement and clamp.
-enum uint BGFX_STENCIL_OP_PASS_Z_INVERT = 0x70000000; /// Invert.
-enum uint BGFX_STENCIL_OP_PASS_Z_SHIFT = 28; /// Stencil operation depth pass bit shift
-enum uint BGFX_STENCIL_OP_PASS_Z_MASK = 0xf0000000; /// Stencil operation depth pass bit mask
-
-enum ushort BGFX_CLEAR_NONE = 0x0000; /// No clear flags.
-enum ushort BGFX_CLEAR_COLOR = 0x0001; /// Clear color.
-enum ushort BGFX_CLEAR_DEPTH = 0x0002; /// Clear depth.
-enum ushort BGFX_CLEAR_STENCIL = 0x0004; /// Clear stencil.
-enum ushort BGFX_CLEAR_DISCARD_COLOR_0 = 0x0008; /// Discard frame buffer attachment 0.
-enum ushort BGFX_CLEAR_DISCARD_COLOR_1 = 0x0010; /// Discard frame buffer attachment 1.
-enum ushort BGFX_CLEAR_DISCARD_COLOR_2 = 0x0020; /// Discard frame buffer attachment 2.
-enum ushort BGFX_CLEAR_DISCARD_COLOR_3 = 0x0040; /// Discard frame buffer attachment 3.
-enum ushort BGFX_CLEAR_DISCARD_COLOR_4 = 0x0080; /// Discard frame buffer attachment 4.
-enum ushort BGFX_CLEAR_DISCARD_COLOR_5 = 0x0100; /// Discard frame buffer attachment 5.
-enum ushort BGFX_CLEAR_DISCARD_COLOR_6 = 0x0200; /// Discard frame buffer attachment 6.
-enum ushort BGFX_CLEAR_DISCARD_COLOR_7 = 0x0400; /// Discard frame buffer attachment 7.
-enum ushort BGFX_CLEAR_DISCARD_DEPTH = 0x0800; /// Discard frame buffer depth attachment.
-enum ushort BGFX_CLEAR_DISCARD_STENCIL = 0x1000; /// Discard frame buffer stencil attachment.
-enum ushort BGFX_CLEAR_DISCARD_COLOR_MASK = 0x07f8;
-enum ushort BGFX_CLEAR_DISCARD_MASK = 0x1ff8;
-
-/**
- * Rendering state discard. When state is preserved in submit, rendering states can be discarded
- * on a finer grain.
- */
-enum ubyte BGFX_DISCARD_NONE = 0x00; /// Preserve everything.
-enum ubyte BGFX_DISCARD_BINDINGS = 0x01; /// Discard texture sampler and buffer bindings.
-enum ubyte BGFX_DISCARD_INDEX_BUFFER = 0x02; /// Discard index buffer.
-enum ubyte BGFX_DISCARD_INSTANCE_DATA = 0x04; /// Discard instance data.
-enum ubyte BGFX_DISCARD_STATE = 0x08; /// Discard state and uniform bindings.
-enum ubyte BGFX_DISCARD_TRANSFORM = 0x10; /// Discard transform.
-enum ubyte BGFX_DISCARD_VERTEX_STREAMS = 0x20; /// Discard vertex streams.
-enum ubyte BGFX_DISCARD_ALL = 0xff; /// Discard all states.
-
-enum uint BGFX_DEBUG_NONE = 0x00000000; /// No debug.
-enum uint BGFX_DEBUG_WIREFRAME = 0x00000001; /// Enable wireframe for all primitives.
-/**
- * Enable infinitely fast hardware test. No draw calls will be submitted to driver.
- * It's useful when profiling to quickly assess bottleneck between CPU and GPU.
- */
-enum uint BGFX_DEBUG_IFH = 0x00000002;
-enum uint BGFX_DEBUG_STATS = 0x00000004; /// Enable statistics display.
-enum uint BGFX_DEBUG_TEXT = 0x00000008; /// Enable debug text display.
-enum uint BGFX_DEBUG_PROFILER = 0x00000010; /// Enable profiler. This causes per-view statistics to be collected, available through `bgfx::Stats::ViewStats`. This is unrelated to the profiler functions in `bgfx::CallbackI`.
-
-enum ushort BGFX_BUFFER_COMPUTE_FORMAT_8X1 = 0x0001; /// 1 8-bit value
-enum ushort BGFX_BUFFER_COMPUTE_FORMAT_8X2 = 0x0002; /// 2 8-bit values
-enum ushort BGFX_BUFFER_COMPUTE_FORMAT_8X4 = 0x0003; /// 4 8-bit values
-enum ushort BGFX_BUFFER_COMPUTE_FORMAT_16X1 = 0x0004; /// 1 16-bit value
-enum ushort BGFX_BUFFER_COMPUTE_FORMAT_16X2 = 0x0005; /// 2 16-bit values
-enum ushort BGFX_BUFFER_COMPUTE_FORMAT_16X4 = 0x0006; /// 4 16-bit values
-enum ushort BGFX_BUFFER_COMPUTE_FORMAT_32X1 = 0x0007; /// 1 32-bit value
-enum ushort BGFX_BUFFER_COMPUTE_FORMAT_32X2 = 0x0008; /// 2 32-bit values
-enum ushort BGFX_BUFFER_COMPUTE_FORMAT_32X4 = 0x0009; /// 4 32-bit values
-enum ushort BGFX_BUFFER_COMPUTE_FORMAT_SHIFT = 0;
-enum ushort BGFX_BUFFER_COMPUTE_FORMAT_MASK = 0x000f;
-
-enum ushort BGFX_BUFFER_COMPUTE_TYPE_INT = 0x0010; /// Type `int`.
-enum ushort BGFX_BUFFER_COMPUTE_TYPE_UINT = 0x0020; /// Type `uint`.
-enum ushort BGFX_BUFFER_COMPUTE_TYPE_FLOAT = 0x0030; /// Type `float`.
-enum ushort BGFX_BUFFER_COMPUTE_TYPE_SHIFT = 4;
-enum ushort BGFX_BUFFER_COMPUTE_TYPE_MASK = 0x0030;
-
-enum ushort BGFX_BUFFER_NONE = 0x0000;
-enum ushort BGFX_BUFFER_COMPUTE_READ = 0x0100; /// Buffer will be read by shader.
-enum ushort BGFX_BUFFER_COMPUTE_WRITE = 0x0200; /// Buffer will be used for writing.
-enum ushort BGFX_BUFFER_DRAW_INDIRECT = 0x0400; /// Buffer will be used for storing draw indirect commands.
-enum ushort BGFX_BUFFER_ALLOW_RESIZE = 0x0800; /// Allow dynamic index/vertex buffer resize during update.
-enum ushort BGFX_BUFFER_INDEX32 = 0x1000; /// Index buffer contains 32-bit indices.
-enum ushort BGFX_BUFFER_COMPUTE_READ_WRITE = 0x0300;
-
-enum ulong BGFX_TEXTURE_NONE = 0x0000000000000000;
-enum ulong BGFX_TEXTURE_MSAA_SAMPLE = 0x0000000800000000; /// Texture will be used for MSAA sampling.
-enum ulong BGFX_TEXTURE_RT = 0x0000001000000000; /// Render target no MSAA.
-enum ulong BGFX_TEXTURE_COMPUTE_WRITE = 0x0000100000000000; /// Texture will be used for compute write.
-enum ulong BGFX_TEXTURE_SRGB = 0x0000200000000000; /// Sample texture as sRGB.
-enum ulong BGFX_TEXTURE_BLIT_DST = 0x0000400000000000; /// Texture will be used as blit destination.
-enum ulong BGFX_TEXTURE_READ_BACK = 0x0000800000000000; /// Texture will be used for read back from GPU.
-
-enum ulong BGFX_TEXTURE_RT_MSAA_X2 = 0x0000002000000000; /// Render target MSAAx2 mode.
-enum ulong BGFX_TEXTURE_RT_MSAA_X4 = 0x0000003000000000; /// Render target MSAAx4 mode.
-enum ulong BGFX_TEXTURE_RT_MSAA_X8 = 0x0000004000000000; /// Render target MSAAx8 mode.
-enum ulong BGFX_TEXTURE_RT_MSAA_X16 = 0x0000005000000000; /// Render target MSAAx16 mode.
-enum ulong BGFX_TEXTURE_RT_MSAA_SHIFT = 36;
-enum ulong BGFX_TEXTURE_RT_MSAA_MASK = 0x0000007000000000;
-
-enum ulong BGFX_TEXTURE_RT_WRITE_ONLY = 0x0000008000000000; /// Render target will be used for writing
-enum ulong BGFX_TEXTURE_RT_SHIFT = 36;
-enum ulong BGFX_TEXTURE_RT_MASK = 0x000000f000000000;
-
-/// Sampler flags.
-enum uint BGFX_SAMPLER_U_MIRROR = 0x00000001; /// Wrap U mode: Mirror
-enum uint BGFX_SAMPLER_U_CLAMP = 0x00000002; /// Wrap U mode: Clamp
-enum uint BGFX_SAMPLER_U_BORDER = 0x00000003; /// Wrap U mode: Border
-enum uint BGFX_SAMPLER_U_SHIFT = 0;
-enum uint BGFX_SAMPLER_U_MASK = 0x00000003;
-
-enum uint BGFX_SAMPLER_V_MIRROR = 0x00000004; /// Wrap V mode: Mirror
-enum uint BGFX_SAMPLER_V_CLAMP = 0x00000008; /// Wrap V mode: Clamp
-enum uint BGFX_SAMPLER_V_BORDER = 0x0000000c; /// Wrap V mode: Border
-enum uint BGFX_SAMPLER_V_SHIFT = 2;
-enum uint BGFX_SAMPLER_V_MASK = 0x0000000c;
-
-enum uint BGFX_SAMPLER_W_MIRROR = 0x00000010; /// Wrap W mode: Mirror
-enum uint BGFX_SAMPLER_W_CLAMP = 0x00000020; /// Wrap W mode: Clamp
-enum uint BGFX_SAMPLER_W_BORDER = 0x00000030; /// Wrap W mode: Border
-enum uint BGFX_SAMPLER_W_SHIFT = 4;
-enum uint BGFX_SAMPLER_W_MASK = 0x00000030;
-
-enum uint BGFX_SAMPLER_MIN_POINT = 0x00000040; /// Min sampling mode: Point
-enum uint BGFX_SAMPLER_MIN_ANISOTROPIC = 0x00000080; /// Min sampling mode: Anisotropic
-enum uint BGFX_SAMPLER_MIN_SHIFT = 6;
-enum uint BGFX_SAMPLER_MIN_MASK = 0x000000c0;
-
-enum uint BGFX_SAMPLER_MAG_POINT = 0x00000100; /// Mag sampling mode: Point
-enum uint BGFX_SAMPLER_MAG_ANISOTROPIC = 0x00000200; /// Mag sampling mode: Anisotropic
-enum uint BGFX_SAMPLER_MAG_SHIFT = 8;
-enum uint BGFX_SAMPLER_MAG_MASK = 0x00000300;
-
-enum uint BGFX_SAMPLER_MIP_POINT = 0x00000400; /// Mip sampling mode: Point
-enum uint BGFX_SAMPLER_MIP_SHIFT = 10;
-enum uint BGFX_SAMPLER_MIP_MASK = 0x00000400;
-
-enum uint BGFX_SAMPLER_COMPARE_LESS = 0x00010000; /// Compare when sampling depth texture: less.
-enum uint BGFX_SAMPLER_COMPARE_LEQUAL = 0x00020000; /// Compare when sampling depth texture: less or equal.
-enum uint BGFX_SAMPLER_COMPARE_EQUAL = 0x00030000; /// Compare when sampling depth texture: equal.
-enum uint BGFX_SAMPLER_COMPARE_GEQUAL = 0x00040000; /// Compare when sampling depth texture: greater or equal.
-enum uint BGFX_SAMPLER_COMPARE_GREATER = 0x00050000; /// Compare when sampling depth texture: greater.
-enum uint BGFX_SAMPLER_COMPARE_NOTEQUAL = 0x00060000; /// Compare when sampling depth texture: not equal.
-enum uint BGFX_SAMPLER_COMPARE_NEVER = 0x00070000; /// Compare when sampling depth texture: never.
-enum uint BGFX_SAMPLER_COMPARE_ALWAYS = 0x00080000; /// Compare when sampling depth texture: always.
-enum uint BGFX_SAMPLER_COMPARE_SHIFT = 16;
-enum uint BGFX_SAMPLER_COMPARE_MASK = 0x000f0000;
-
-enum uint BGFX_SAMPLER_BORDER_COLOR_SHIFT = 24;
-enum uint BGFX_SAMPLER_BORDER_COLOR_MASK = 0x0f000000;
-uint BGFX_SAMPLER_BORDER_COLOR (uint v) { return (v << BGFX_SAMPLER_BORDER_COLOR_SHIFT) & BGFX_SAMPLER_BORDER_COLOR_MASK; }
-
-enum uint BGFX_SAMPLER_RESERVED_SHIFT = 28;
-enum uint BGFX_SAMPLER_RESERVED_MASK = 0xf0000000;
-
-enum uint BGFX_SAMPLER_NONE = 0x00000000;
-enum uint BGFX_SAMPLER_SAMPLE_STENCIL = 0x00100000; /// Sample stencil instead of depth.
-enum uint BGFX_SAMPLER_POINT = BGFX_SAMPLER_MIN_POINT | BGFX_SAMPLER_MAG_POINT | BGFX_SAMPLER_MIP_POINT;
-enum uint BGFX_SAMPLER_UVW_MIRROR = BGFX_SAMPLER_U_MIRROR | BGFX_SAMPLER_V_MIRROR | BGFX_SAMPLER_W_MIRROR;
-enum uint BGFX_SAMPLER_UVW_CLAMP = BGFX_SAMPLER_U_CLAMP | BGFX_SAMPLER_V_CLAMP | BGFX_SAMPLER_W_CLAMP;
-enum uint BGFX_SAMPLER_UVW_BORDER = BGFX_SAMPLER_U_BORDER | BGFX_SAMPLER_V_BORDER | BGFX_SAMPLER_W_BORDER;
-enum uint BGFX_SAMPLER_BITS_MASK = BGFX_SAMPLER_U_MASK | BGFX_SAMPLER_V_MASK | BGFX_SAMPLER_W_MASK | BGFX_SAMPLER_MIN_MASK | BGFX_SAMPLER_MAG_MASK | BGFX_SAMPLER_MIP_MASK | BGFX_SAMPLER_COMPARE_MASK;
-
-enum uint BGFX_RESET_MSAA_X2 = 0x00000010; /// Enable 2x MSAA.
-enum uint BGFX_RESET_MSAA_X4 = 0x00000020; /// Enable 4x MSAA.
-enum uint BGFX_RESET_MSAA_X8 = 0x00000030; /// Enable 8x MSAA.
-enum uint BGFX_RESET_MSAA_X16 = 0x00000040; /// Enable 16x MSAA.
-enum uint BGFX_RESET_MSAA_SHIFT = 4;
-enum uint BGFX_RESET_MSAA_MASK = 0x00000070;
-
-enum uint BGFX_RESET_NONE = 0x00000000; /// No reset flags.
-enum uint BGFX_RESET_FULLSCREEN = 0x00000001; /// Not supported yet.
-enum uint BGFX_RESET_VSYNC = 0x00000080; /// Enable V-Sync.
-enum uint BGFX_RESET_MAXANISOTROPY = 0x00000100; /// Turn on/off max anisotropy.
-enum uint BGFX_RESET_CAPTURE = 0x00000200; /// Begin screen capture.
-enum uint BGFX_RESET_FLUSH_AFTER_RENDER = 0x00002000; /// Flush rendering after submitting to GPU.
-/**
- * This flag specifies where flip occurs. Default behaviour is that flip occurs
- * before rendering new frame. This flag only has effect when `BGFX_CONFIG_MULTITHREADED=0`.
- */
-enum uint BGFX_RESET_FLIP_AFTER_RENDER = 0x00004000;
-enum uint BGFX_RESET_SRGB_BACKBUFFER = 0x00008000; /// Enable sRGB backbuffer.
-enum uint BGFX_RESET_HDR10 = 0x00010000; /// Enable HDR10 rendering.
-enum uint BGFX_RESET_HIDPI = 0x00020000; /// Enable HiDPI rendering.
-enum uint BGFX_RESET_DEPTH_CLAMP = 0x00040000; /// Enable depth clamp.
-enum uint BGFX_RESET_SUSPEND = 0x00080000; /// Suspend rendering.
-enum uint BGFX_RESET_TRANSPARENT_BACKBUFFER = 0x00100000; /// Transparent backbuffer. Availability depends on: `BGFX_CAPS_TRANSPARENT_BACKBUFFER`.
-
-enum uint BGFX_RESET_FULLSCREEN_SHIFT = 0;
-enum uint BGFX_RESET_FULLSCREEN_MASK = 0x00000001;
-
-enum uint BGFX_RESET_RESERVED_SHIFT = 31; /// Internal bit shift
-enum uint BGFX_RESET_RESERVED_MASK = 0x80000000; /// Internal bit mask
-
-enum ulong BGFX_CAPS_ALPHA_TO_COVERAGE = 0x0000000000000001; /// Alpha to coverage is supported.
-enum ulong BGFX_CAPS_BLEND_INDEPENDENT = 0x0000000000000002; /// Blend independent is supported.
-enum ulong BGFX_CAPS_COMPUTE = 0x0000000000000004; /// Compute shaders are supported.
-enum ulong BGFX_CAPS_CONSERVATIVE_RASTER = 0x0000000000000008; /// Conservative rasterization is supported.
-enum ulong BGFX_CAPS_DRAW_INDIRECT = 0x0000000000000010; /// Draw indirect is supported.
-enum ulong BGFX_CAPS_FRAGMENT_DEPTH = 0x0000000000000020; /// Fragment depth is available in fragment shader.
-enum ulong BGFX_CAPS_FRAGMENT_ORDERING = 0x0000000000000040; /// Fragment ordering is available in fragment shader.
-enum ulong BGFX_CAPS_GRAPHICS_DEBUGGER = 0x0000000000000080; /// Graphics debugger is present.
-enum ulong BGFX_CAPS_HDR10 = 0x0000000000000100; /// HDR10 rendering is supported.
-enum ulong BGFX_CAPS_HIDPI = 0x0000000000000200; /// HiDPI rendering is supported.
-enum ulong BGFX_CAPS_IMAGE_RW = 0x0000000000000400; /// Image Read/Write is supported.
-enum ulong BGFX_CAPS_INDEX32 = 0x0000000000000800; /// 32-bit indices are supported.
-enum ulong BGFX_CAPS_INSTANCING = 0x0000000000001000; /// Instancing is supported.
-enum ulong BGFX_CAPS_OCCLUSION_QUERY = 0x0000000000002000; /// Occlusion query is supported.
-enum ulong BGFX_CAPS_RENDERER_MULTITHREADED = 0x0000000000004000; /// Renderer is on separate thread.
-enum ulong BGFX_CAPS_SWAP_CHAIN = 0x0000000000008000; /// Multiple windows are supported.
-enum ulong BGFX_CAPS_TEXTURE_2D_ARRAY = 0x0000000000010000; /// 2D texture array is supported.
-enum ulong BGFX_CAPS_TEXTURE_3D = 0x0000000000020000; /// 3D textures are supported.
-enum ulong BGFX_CAPS_TEXTURE_BLIT = 0x0000000000040000; /// Texture blit is supported.
-enum ulong BGFX_CAPS_TRANSPARENT_BACKBUFFER = 0x0000000000080000; /// Transparent back buffer supported.
-enum ulong BGFX_CAPS_TEXTURE_COMPARE_RESERVED = 0x0000000000100000;
-enum ulong BGFX_CAPS_TEXTURE_COMPARE_LEQUAL = 0x0000000000200000; /// Texture compare less equal mode is supported.
-enum ulong BGFX_CAPS_TEXTURE_CUBE_ARRAY = 0x0000000000400000; /// Cubemap texture array is supported.
-enum ulong BGFX_CAPS_TEXTURE_DIRECT_ACCESS = 0x0000000000800000; /// CPU direct access to GPU texture memory.
-enum ulong BGFX_CAPS_TEXTURE_READ_BACK = 0x0000000001000000; /// Read-back texture is supported.
-enum ulong BGFX_CAPS_VERTEX_ATTRIB_HALF = 0x0000000002000000; /// Vertex attribute half-float is supported.
-enum ulong BGFX_CAPS_VERTEX_ATTRIB_UINT10 = 0x0000000004000000; /// Vertex attribute 10_10_10_2 is supported.
-enum ulong BGFX_CAPS_VERTEX_ID = 0x0000000008000000; /// Rendering with VertexID only is supported.
-enum ulong BGFX_CAPS_VIEWPORT_LAYER_ARRAY = 0x0000000010000000; /// Viewport layer is available in vertex shader.
-enum ulong BGFX_CAPS_DRAW_INDIRECT_COUNT = 0x0000000020000000; /// Draw indirect with indirect count is supported.
-enum ulong BGFX_CAPS_TEXTURE_COMPARE_ALL = 0x0000000000300000; /// All texture compare modes are supported.
-
-enum uint BGFX_CAPS_FORMAT_TEXTURE_NONE = 0x00000000; /// Texture format is not supported.
-enum uint BGFX_CAPS_FORMAT_TEXTURE_2D = 0x00000001; /// Texture format is supported.
-enum uint BGFX_CAPS_FORMAT_TEXTURE_2D_SRGB = 0x00000002; /// Texture as sRGB format is supported.
-enum uint BGFX_CAPS_FORMAT_TEXTURE_2D_EMULATED = 0x00000004; /// Texture format is emulated.
-enum uint BGFX_CAPS_FORMAT_TEXTURE_3D = 0x00000008; /// Texture format is supported.
-enum uint BGFX_CAPS_FORMAT_TEXTURE_3D_SRGB = 0x00000010; /// Texture as sRGB format is supported.
-enum uint BGFX_CAPS_FORMAT_TEXTURE_3D_EMULATED = 0x00000020; /// Texture format is emulated.
-enum uint BGFX_CAPS_FORMAT_TEXTURE_CUBE = 0x00000040; /// Texture format is supported.
-enum uint BGFX_CAPS_FORMAT_TEXTURE_CUBE_SRGB = 0x00000080; /// Texture as sRGB format is supported.
-enum uint BGFX_CAPS_FORMAT_TEXTURE_CUBE_EMULATED = 0x00000100; /// Texture format is emulated.
-enum uint BGFX_CAPS_FORMAT_TEXTURE_VERTEX = 0x00000200; /// Texture format can be used from vertex shader.
-enum uint BGFX_CAPS_FORMAT_TEXTURE_IMAGE_READ = 0x00000400; /// Texture format can be used as image and read from.
-enum uint BGFX_CAPS_FORMAT_TEXTURE_IMAGE_WRITE = 0x00000800; /// Texture format can be used as image and written to.
-enum uint BGFX_CAPS_FORMAT_TEXTURE_FRAMEBUFFER = 0x00001000; /// Texture format can be used as frame buffer.
-enum uint BGFX_CAPS_FORMAT_TEXTURE_FRAMEBUFFER_MSAA = 0x00002000; /// Texture format can be used as MSAA frame buffer.
-enum uint BGFX_CAPS_FORMAT_TEXTURE_MSAA = 0x00004000; /// Texture can be sampled as MSAA.
-enum uint BGFX_CAPS_FORMAT_TEXTURE_MIP_AUTOGEN = 0x00008000; /// Texture format supports auto-generated mips.
-
-enum ubyte BGFX_RESOLVE_NONE = 0x00; /// No resolve flags.
-enum ubyte BGFX_RESOLVE_AUTO_GEN_MIPS = 0x01; /// Auto-generate mip maps on resolve.
-
-enum ushort BGFX_PCI_ID_NONE = 0x0000; /// Autoselect adapter.
-enum ushort BGFX_PCI_ID_SOFTWARE_RASTERIZER = 0x0001; /// Software rasterizer.
-enum ushort BGFX_PCI_ID_AMD = 0x1002; /// AMD adapter.
-enum ushort BGFX_PCI_ID_APPLE = 0x106b; /// Apple adapter.
-enum ushort BGFX_PCI_ID_INTEL = 0x8086; /// Intel adapter.
-enum ushort BGFX_PCI_ID_NVIDIA = 0x10de; /// nVidia adapter.
-enum ushort BGFX_PCI_ID_MICROSOFT = 0x1414; /// Microsoft adapter.
-enum ushort BGFX_PCI_ID_ARM = 0x13b5; /// ARM adapter.
-
-enum ubyte BGFX_CUBE_MAP_POSITIVE_X = 0x00; /// Cubemap +x.
-enum ubyte BGFX_CUBE_MAP_NEGATIVE_X = 0x01; /// Cubemap -x.
-enum ubyte BGFX_CUBE_MAP_POSITIVE_Y = 0x02; /// Cubemap +y.
-enum ubyte BGFX_CUBE_MAP_NEGATIVE_Y = 0x03; /// Cubemap -y.
-enum ubyte BGFX_CUBE_MAP_POSITIVE_Z = 0x04; /// Cubemap +z.
-enum ubyte BGFX_CUBE_MAP_NEGATIVE_Z = 0x05; /// Cubemap -z.
-
-/// Fatal error enum.
-enum bgfx_fatal_t
-{
- BGFX_FATAL_DEBUGCHECK,
- BGFX_FATAL_INVALIDSHADER,
- BGFX_FATAL_UNABLETOINITIALIZE,
- BGFX_FATAL_UNABLETOCREATETEXTURE,
- BGFX_FATAL_DEVICELOST,
-
- BGFX_FATAL_COUNT
-}
-mixin(expandEnum!bgfx_fatal_t);
-
-/// Renderer backend type enum.
-enum bgfx_renderer_type_t
-{
- BGFX_RENDERER_TYPE_NOOP, /// No rendering.
- BGFX_RENDERER_TYPE_AGC, /// AGC
- BGFX_RENDERER_TYPE_DIRECT3D9, /// Direct3D 9.0
- BGFX_RENDERER_TYPE_DIRECT3D11, /// Direct3D 11.0
- BGFX_RENDERER_TYPE_DIRECT3D12, /// Direct3D 12.0
- BGFX_RENDERER_TYPE_GNM, /// GNM
- BGFX_RENDERER_TYPE_METAL, /// Metal
- BGFX_RENDERER_TYPE_NVN, /// NVN
- BGFX_RENDERER_TYPE_OPENGLES, /// OpenGL ES 2.0+
- BGFX_RENDERER_TYPE_OPENGL, /// OpenGL 2.1+
- BGFX_RENDERER_TYPE_VULKAN, /// Vulkan
- BGFX_RENDERER_TYPE_WEBGPU, /// WebGPU
-
- BGFX_RENDERER_TYPE_COUNT
-}
-mixin(expandEnum!bgfx_renderer_type_t);
-
-/// Access mode enum.
-enum bgfx_access_t
-{
- BGFX_ACCESS_READ, /// Read.
- BGFX_ACCESS_WRITE, /// Write.
- BGFX_ACCESS_READWRITE, /// Read and write.
-
- BGFX_ACCESS_COUNT
-}
-mixin(expandEnum!bgfx_access_t);
-
-/// Vertex attribute enum.
-enum bgfx_attrib_t
-{
- BGFX_ATTRIB_POSITION, /// a_position
- BGFX_ATTRIB_NORMAL, /// a_normal
- BGFX_ATTRIB_TANGENT, /// a_tangent
- BGFX_ATTRIB_BITANGENT, /// a_bitangent
- BGFX_ATTRIB_COLOR0, /// a_color0
- BGFX_ATTRIB_COLOR1, /// a_color1
- BGFX_ATTRIB_COLOR2, /// a_color2
- BGFX_ATTRIB_COLOR3, /// a_color3
- BGFX_ATTRIB_INDICES, /// a_indices
- BGFX_ATTRIB_WEIGHT, /// a_weight
- BGFX_ATTRIB_TEXCOORD0, /// a_texcoord0
- BGFX_ATTRIB_TEXCOORD1, /// a_texcoord1
- BGFX_ATTRIB_TEXCOORD2, /// a_texcoord2
- BGFX_ATTRIB_TEXCOORD3, /// a_texcoord3
- BGFX_ATTRIB_TEXCOORD4, /// a_texcoord4
- BGFX_ATTRIB_TEXCOORD5, /// a_texcoord5
- BGFX_ATTRIB_TEXCOORD6, /// a_texcoord6
- BGFX_ATTRIB_TEXCOORD7, /// a_texcoord7
-
- BGFX_ATTRIB_COUNT
-}
-mixin(expandEnum!bgfx_attrib_t);
-
-/// Vertex attribute type enum.
-enum bgfx_attrib_type_t
-{
- BGFX_ATTRIB_TYPE_UINT8, /// Uint8
- BGFX_ATTRIB_TYPE_UINT10, /// Uint10, availability depends on: `BGFX_CAPS_VERTEX_ATTRIB_UINT10`.
- BGFX_ATTRIB_TYPE_INT16, /// Int16
- BGFX_ATTRIB_TYPE_HALF, /// Half, availability depends on: `BGFX_CAPS_VERTEX_ATTRIB_HALF`.
- BGFX_ATTRIB_TYPE_FLOAT, /// Float
-
- BGFX_ATTRIB_TYPE_COUNT
-}
-mixin(expandEnum!bgfx_attrib_type_t);
-
-/**
- * Texture format enum.
- * Notation:
- * RGBA16S
- * ^ ^ ^
- * | | +-- [ ]Unorm
- * | | [F]loat
- * | | [S]norm
- * | | [I]nt
- * | | [U]int
- * | +---- Number of bits per component
- * +-------- Components
- * @attention Availability depends on Caps (see: formats).
- */
-enum bgfx_texture_format_t
-{
- BGFX_TEXTURE_FORMAT_BC1, /// DXT1 R5G6B5A1
- BGFX_TEXTURE_FORMAT_BC2, /// DXT3 R5G6B5A4
- BGFX_TEXTURE_FORMAT_BC3, /// DXT5 R5G6B5A8
- BGFX_TEXTURE_FORMAT_BC4, /// LATC1/ATI1 R8
- BGFX_TEXTURE_FORMAT_BC5, /// LATC2/ATI2 RG8
- BGFX_TEXTURE_FORMAT_BC6H, /// BC6H RGB16F
- BGFX_TEXTURE_FORMAT_BC7, /// BC7 RGB 4-7 bits per color channel, 0-8 bits alpha
- BGFX_TEXTURE_FORMAT_ETC1, /// ETC1 RGB8
- BGFX_TEXTURE_FORMAT_ETC2, /// ETC2 RGB8
- BGFX_TEXTURE_FORMAT_ETC2A, /// ETC2 RGBA8
- BGFX_TEXTURE_FORMAT_ETC2A1, /// ETC2 RGB8A1
- BGFX_TEXTURE_FORMAT_PTC12, /// PVRTC1 RGB 2BPP
- BGFX_TEXTURE_FORMAT_PTC14, /// PVRTC1 RGB 4BPP
- BGFX_TEXTURE_FORMAT_PTC12A, /// PVRTC1 RGBA 2BPP
- BGFX_TEXTURE_FORMAT_PTC14A, /// PVRTC1 RGBA 4BPP
- BGFX_TEXTURE_FORMAT_PTC22, /// PVRTC2 RGBA 2BPP
- BGFX_TEXTURE_FORMAT_PTC24, /// PVRTC2 RGBA 4BPP
- BGFX_TEXTURE_FORMAT_ATC, /// ATC RGB 4BPP
- BGFX_TEXTURE_FORMAT_ATCE, /// ATCE RGBA 8 BPP explicit alpha
- BGFX_TEXTURE_FORMAT_ATCI, /// ATCI RGBA 8 BPP interpolated alpha
- BGFX_TEXTURE_FORMAT_ASTC4X4, /// ASTC 4x4 8.0 BPP
- BGFX_TEXTURE_FORMAT_ASTC5X4, /// ASTC 5x4 6.40 BPP
- BGFX_TEXTURE_FORMAT_ASTC5X5, /// ASTC 5x5 5.12 BPP
- BGFX_TEXTURE_FORMAT_ASTC6X5, /// ASTC 6x5 4.27 BPP
- BGFX_TEXTURE_FORMAT_ASTC6X6, /// ASTC 6x6 3.56 BPP
- BGFX_TEXTURE_FORMAT_ASTC8X5, /// ASTC 8x5 3.20 BPP
- BGFX_TEXTURE_FORMAT_ASTC8X6, /// ASTC 8x6 2.67 BPP
- BGFX_TEXTURE_FORMAT_ASTC8X8, /// ASTC 8x8 2.00 BPP
- BGFX_TEXTURE_FORMAT_ASTC10X5, /// ASTC 10x5 2.56 BPP
- BGFX_TEXTURE_FORMAT_ASTC10X6, /// ASTC 10x6 2.13 BPP
- BGFX_TEXTURE_FORMAT_ASTC10X8, /// ASTC 10x8 1.60 BPP
- BGFX_TEXTURE_FORMAT_ASTC10X10, /// ASTC 10x10 1.28 BPP
- BGFX_TEXTURE_FORMAT_ASTC12X10, /// ASTC 12x10 1.07 BPP
- BGFX_TEXTURE_FORMAT_ASTC12X12, /// ASTC 12x12 0.89 BPP
- BGFX_TEXTURE_FORMAT_UNKNOWN, /// Compressed formats above.
- BGFX_TEXTURE_FORMAT_R1,
- BGFX_TEXTURE_FORMAT_A8,
- BGFX_TEXTURE_FORMAT_R8,
- BGFX_TEXTURE_FORMAT_R8I,
- BGFX_TEXTURE_FORMAT_R8U,
- BGFX_TEXTURE_FORMAT_R8S,
- BGFX_TEXTURE_FORMAT_R16,
- BGFX_TEXTURE_FORMAT_R16I,
- BGFX_TEXTURE_FORMAT_R16U,
- BGFX_TEXTURE_FORMAT_R16F,
- BGFX_TEXTURE_FORMAT_R16S,
- BGFX_TEXTURE_FORMAT_R32I,
- BGFX_TEXTURE_FORMAT_R32U,
- BGFX_TEXTURE_FORMAT_R32F,
- BGFX_TEXTURE_FORMAT_RG8,
- BGFX_TEXTURE_FORMAT_RG8I,
- BGFX_TEXTURE_FORMAT_RG8U,
- BGFX_TEXTURE_FORMAT_RG8S,
- BGFX_TEXTURE_FORMAT_RG16,
- BGFX_TEXTURE_FORMAT_RG16I,
- BGFX_TEXTURE_FORMAT_RG16U,
- BGFX_TEXTURE_FORMAT_RG16F,
- BGFX_TEXTURE_FORMAT_RG16S,
- BGFX_TEXTURE_FORMAT_RG32I,
- BGFX_TEXTURE_FORMAT_RG32U,
- BGFX_TEXTURE_FORMAT_RG32F,
- BGFX_TEXTURE_FORMAT_RGB8,
- BGFX_TEXTURE_FORMAT_RGB8I,
- BGFX_TEXTURE_FORMAT_RGB8U,
- BGFX_TEXTURE_FORMAT_RGB8S,
- BGFX_TEXTURE_FORMAT_RGB9E5F,
- BGFX_TEXTURE_FORMAT_BGRA8,
- BGFX_TEXTURE_FORMAT_RGBA8,
- BGFX_TEXTURE_FORMAT_RGBA8I,
- BGFX_TEXTURE_FORMAT_RGBA8U,
- BGFX_TEXTURE_FORMAT_RGBA8S,
- BGFX_TEXTURE_FORMAT_RGBA16,
- BGFX_TEXTURE_FORMAT_RGBA16I,
- BGFX_TEXTURE_FORMAT_RGBA16U,
- BGFX_TEXTURE_FORMAT_RGBA16F,
- BGFX_TEXTURE_FORMAT_RGBA16S,
- BGFX_TEXTURE_FORMAT_RGBA32I,
- BGFX_TEXTURE_FORMAT_RGBA32U,
- BGFX_TEXTURE_FORMAT_RGBA32F,
- BGFX_TEXTURE_FORMAT_B5G6R5,
- BGFX_TEXTURE_FORMAT_R5G6B5,
- BGFX_TEXTURE_FORMAT_BGRA4,
- BGFX_TEXTURE_FORMAT_RGBA4,
- BGFX_TEXTURE_FORMAT_BGR5A1,
- BGFX_TEXTURE_FORMAT_RGB5A1,
- BGFX_TEXTURE_FORMAT_RGB10A2,
- BGFX_TEXTURE_FORMAT_RG11B10F,
- BGFX_TEXTURE_FORMAT_UNKNOWNDEPTH, /// Depth formats below.
- BGFX_TEXTURE_FORMAT_D16,
- BGFX_TEXTURE_FORMAT_D24,
- BGFX_TEXTURE_FORMAT_D24S8,
- BGFX_TEXTURE_FORMAT_D32,
- BGFX_TEXTURE_FORMAT_D16F,
- BGFX_TEXTURE_FORMAT_D24F,
- BGFX_TEXTURE_FORMAT_D32F,
- BGFX_TEXTURE_FORMAT_D0S8,
-
- BGFX_TEXTURE_FORMAT_COUNT
-}
-mixin(expandEnum!bgfx_texture_format_t);
-
-/// Uniform type enum.
-enum bgfx_uniform_type_t
-{
- BGFX_UNIFORM_TYPE_SAMPLER, /// Sampler.
- BGFX_UNIFORM_TYPE_END, /// Reserved, do not use.
- BGFX_UNIFORM_TYPE_VEC4, /// 4 floats vector.
- BGFX_UNIFORM_TYPE_MAT3, /// 3x3 matrix.
- BGFX_UNIFORM_TYPE_MAT4, /// 4x4 matrix.
-
- BGFX_UNIFORM_TYPE_COUNT
-}
-mixin(expandEnum!bgfx_uniform_type_t);
-
-/// Backbuffer ratio enum.
-enum bgfx_backbuffer_ratio_t
-{
- BGFX_BACKBUFFER_RATIO_EQUAL, /// Equal to backbuffer.
- BGFX_BACKBUFFER_RATIO_HALF, /// One half size of backbuffer.
- BGFX_BACKBUFFER_RATIO_QUARTER, /// One quarter size of backbuffer.
- BGFX_BACKBUFFER_RATIO_EIGHTH, /// One eighth size of backbuffer.
- BGFX_BACKBUFFER_RATIO_SIXTEENTH, /// One sixteenth size of backbuffer.
- BGFX_BACKBUFFER_RATIO_DOUBLE, /// Double size of backbuffer.
-
- BGFX_BACKBUFFER_RATIO_COUNT
-}
-mixin(expandEnum!bgfx_backbuffer_ratio_t);
-
-/// Occlusion query result.
-enum bgfx_occlusion_query_result_t
-{
- BGFX_OCCLUSION_QUERY_RESULT_INVISIBLE, /// Query failed test.
- BGFX_OCCLUSION_QUERY_RESULT_VISIBLE, /// Query passed test.
- BGFX_OCCLUSION_QUERY_RESULT_NORESULT, /// Query result is not available yet.
-
- BGFX_OCCLUSION_QUERY_RESULT_COUNT
-}
-mixin(expandEnum!bgfx_occlusion_query_result_t);
-
-/// Primitive topology.
-enum bgfx_topology_t
-{
- BGFX_TOPOLOGY_TRILIST, /// Triangle list.
- BGFX_TOPOLOGY_TRISTRIP, /// Triangle strip.
- BGFX_TOPOLOGY_LINELIST, /// Line list.
- BGFX_TOPOLOGY_LINESTRIP, /// Line strip.
- BGFX_TOPOLOGY_POINTLIST, /// Point list.
-
- BGFX_TOPOLOGY_COUNT
-}
-mixin(expandEnum!bgfx_topology_t);
-
-/// Topology conversion function.
-enum bgfx_topology_convert_t
-{
- BGFX_TOPOLOGY_CONVERT_TRILISTFLIPWINDING, /// Flip winding order of triangle list.
- BGFX_TOPOLOGY_CONVERT_TRISTRIPFLIPWINDING, /// Flip winding order of triangle strip.
- BGFX_TOPOLOGY_CONVERT_TRILISTTOLINELIST, /// Convert triangle list to line list.
- BGFX_TOPOLOGY_CONVERT_TRISTRIPTOTRILIST, /// Convert triangle strip to triangle list.
- BGFX_TOPOLOGY_CONVERT_LINESTRIPTOLINELIST, /// Convert line strip to line list.
-
- BGFX_TOPOLOGY_CONVERT_COUNT
-}
-mixin(expandEnum!bgfx_topology_convert_t);
-
-/// Topology sort order.
-enum bgfx_topology_sort_t
-{
- BGFX_TOPOLOGY_SORT_DIRECTIONFRONTTOBACKMIN,
- BGFX_TOPOLOGY_SORT_DIRECTIONFRONTTOBACKAVG,
- BGFX_TOPOLOGY_SORT_DIRECTIONFRONTTOBACKMAX,
- BGFX_TOPOLOGY_SORT_DIRECTIONBACKTOFRONTMIN,
- BGFX_TOPOLOGY_SORT_DIRECTIONBACKTOFRONTAVG,
- BGFX_TOPOLOGY_SORT_DIRECTIONBACKTOFRONTMAX,
- BGFX_TOPOLOGY_SORT_DISTANCEFRONTTOBACKMIN,
- BGFX_TOPOLOGY_SORT_DISTANCEFRONTTOBACKAVG,
- BGFX_TOPOLOGY_SORT_DISTANCEFRONTTOBACKMAX,
- BGFX_TOPOLOGY_SORT_DISTANCEBACKTOFRONTMIN,
- BGFX_TOPOLOGY_SORT_DISTANCEBACKTOFRONTAVG,
- BGFX_TOPOLOGY_SORT_DISTANCEBACKTOFRONTMAX,
-
- BGFX_TOPOLOGY_SORT_COUNT
-}
-mixin(expandEnum!bgfx_topology_sort_t);
-
-/// View mode sets draw call sort order.
-enum bgfx_view_mode_t
-{
- BGFX_VIEW_MODE_DEFAULT, /// Default sort order.
- BGFX_VIEW_MODE_SEQUENTIAL, /// Sort in the same order in which submit calls were called.
- BGFX_VIEW_MODE_DEPTHASCENDING, /// Sort draw call depth in ascending order.
- BGFX_VIEW_MODE_DEPTHDESCENDING, /// Sort draw call depth in descending order.
-
- BGFX_VIEW_MODE_COUNT
-}
-mixin(expandEnum!bgfx_view_mode_t);
-
-/// Render frame enum.
-enum bgfx_render_frame_t
-{
- BGFX_RENDER_FRAME_NOCONTEXT, /// Renderer context is not created yet.
- BGFX_RENDER_FRAME_RENDER, /// Renderer context is created and rendering.
- BGFX_RENDER_FRAME_TIMEOUT, /// Renderer context wait for main thread signal timed out without rendering.
- BGFX_RENDER_FRAME_EXITING, /// Renderer context is getting destroyed.
-
- BGFX_RENDER_FRAME_COUNT
-}
-mixin(expandEnum!bgfx_render_frame_t);
-
-/// GPU info.
-struct bgfx_caps_gpu_t
-{
- ushort vendorId; /// Vendor PCI id. See `BGFX_PCI_ID_*`.
- ushort deviceId; /// Device id.
-}
-
-/// Renderer runtime limits.
-struct bgfx_caps_limits_t
-{
- uint maxDrawCalls; /// Maximum number of draw calls.
- uint maxBlits; /// Maximum number of blit calls.
- uint maxTextureSize; /// Maximum texture size.
- uint maxTextureLayers; /// Maximum texture layers.
- uint maxViews; /// Maximum number of views.
- uint maxFrameBuffers; /// Maximum number of frame buffer handles.
- uint maxFBAttachments; /// Maximum number of frame buffer attachments.
- uint maxPrograms; /// Maximum number of program handles.
- uint maxShaders; /// Maximum number of shader handles.
- uint maxTextures; /// Maximum number of texture handles.
- uint maxTextureSamplers; /// Maximum number of texture samplers.
- uint maxComputeBindings; /// Maximum number of compute bindings.
- uint maxVertexLayouts; /// Maximum number of vertex format layouts.
- uint maxVertexStreams; /// Maximum number of vertex streams.
- uint maxIndexBuffers; /// Maximum number of index buffer handles.
- uint maxVertexBuffers; /// Maximum number of vertex buffer handles.
- uint maxDynamicIndexBuffers; /// Maximum number of dynamic index buffer handles.
- uint maxDynamicVertexBuffers; /// Maximum number of dynamic vertex buffer handles.
- uint maxUniforms; /// Maximum number of uniform handles.
- uint maxOcclusionQueries; /// Maximum number of occlusion query handles.
- uint maxEncoders; /// Maximum number of encoder threads.
- uint minResourceCbSize; /// Minimum resource command buffer size.
- uint transientVbSize; /// Maximum transient vertex buffer size.
- uint transientIbSize; /// Maximum transient index buffer size.
-}
-
-/// Renderer capabilities.
-struct bgfx_caps_t
-{
- bgfx_renderer_type_t rendererType; /// Renderer backend type. See: `bgfx::RendererType`
-
- /**
- * Supported functionality.
- * @attention See `BGFX_CAPS_*` flags at https://bkaradzic.github.io/bgfx/bgfx.html#available-caps
- */
- ulong supported;
- ushort vendorId; /// Selected GPU vendor PCI id.
- ushort deviceId; /// Selected GPU device id.
- bool homogeneousDepth; /// True when NDC depth is in [-1, 1] range, otherwise its [0, 1].
- bool originBottomLeft; /// True when NDC origin is at bottom left.
- ubyte numGPUs; /// Number of enumerated GPUs.
- bgfx_caps_gpu_t[4] gpu; /// Enumerated GPUs.
- bgfx_caps_limits_t limits; /// Renderer runtime limits.
-
- /**
- * Supported texture format capabilities flags:
- * - `BGFX_CAPS_FORMAT_TEXTURE_NONE` - Texture format is not supported.
- * - `BGFX_CAPS_FORMAT_TEXTURE_2D` - Texture format is supported.
- * - `BGFX_CAPS_FORMAT_TEXTURE_2D_SRGB` - Texture as sRGB format is supported.
- * - `BGFX_CAPS_FORMAT_TEXTURE_2D_EMULATED` - Texture format is emulated.
- * - `BGFX_CAPS_FORMAT_TEXTURE_3D` - Texture format is supported.
- * - `BGFX_CAPS_FORMAT_TEXTURE_3D_SRGB` - Texture as sRGB format is supported.
- * - `BGFX_CAPS_FORMAT_TEXTURE_3D_EMULATED` - Texture format is emulated.
- * - `BGFX_CAPS_FORMAT_TEXTURE_CUBE` - Texture format is supported.
- * - `BGFX_CAPS_FORMAT_TEXTURE_CUBE_SRGB` - Texture as sRGB format is supported.
- * - `BGFX_CAPS_FORMAT_TEXTURE_CUBE_EMULATED` - Texture format is emulated.
- * - `BGFX_CAPS_FORMAT_TEXTURE_VERTEX` - Texture format can be used from vertex shader.
- * - `BGFX_CAPS_FORMAT_TEXTURE_IMAGE_READ` - Texture format can be used as image
- * and read from.
- * - `BGFX_CAPS_FORMAT_TEXTURE_IMAGE_WRITE` - Texture format can be used as image
- * and written to.
- * - `BGFX_CAPS_FORMAT_TEXTURE_FRAMEBUFFER` - Texture format can be used as frame
- * buffer.
- * - `BGFX_CAPS_FORMAT_TEXTURE_FRAMEBUFFER_MSAA` - Texture format can be used as MSAA
- * frame buffer.
- * - `BGFX_CAPS_FORMAT_TEXTURE_MSAA` - Texture can be sampled as MSAA.
- * - `BGFX_CAPS_FORMAT_TEXTURE_MIP_AUTOGEN` - Texture format supports auto-generated
- * mips.
- */
- ushort[bgfx_texture_format_t.BGFX_TEXTURE_FORMAT_COUNT] formats;
-}
-
-/// Internal data.
-struct bgfx_internal_data_t
-{
- const(bgfx_caps_t)* caps; /// Renderer capabilities.
- void* context; /// GL context, or D3D device.
-}
-
-/// Platform data.
-struct bgfx_platform_data_t
-{
- void* ndt; /// Native display type (*nix specific).
-
- /**
- * Native window handle. If `NULL`, bgfx will create a headless
- * context/device, provided the rendering API supports it.
- */
- void* nwh;
-
- /**
- * GL context, D3D device, or Vulkan device. If `NULL`, bgfx
- * will create context/device.
- */
- void* context;
-
- /**
- * GL back-buffer, or D3D render target view. If `NULL` bgfx will
- * create back-buffer color surface.
- */
- void* backBuffer;
-
- /**
- * Backbuffer depth/stencil. If `NULL`, bgfx will create a back-buffer
- * depth/stencil surface.
- */
- void* backBufferDS;
-}
-
-/// Backbuffer resolution and reset parameters.
-struct bgfx_resolution_t
-{
- bgfx_texture_format_t format; /// Backbuffer format.
- uint width; /// Backbuffer width.
- uint height; /// Backbuffer height.
- uint reset; /// Reset parameters.
- ubyte numBackBuffers; /// Number of back buffers.
- ubyte maxFrameLatency; /// Maximum frame latency.
-}
-
-/// Configurable runtime limits parameters.
-struct bgfx_init_limits_t
-{
- ushort maxEncoders; /// Maximum number of encoder threads.
- uint minResourceCbSize; /// Minimum resource command buffer size.
- uint transientVbSize; /// Maximum transient vertex buffer size.
- uint transientIbSize; /// Maximum transient index buffer size.
-}
-
-/// Initialization parameters used by `bgfx::init`.
-struct bgfx_init_t
-{
-
- /**
- * Select rendering backend. When set to RendererType::Count
- * a default rendering backend will be selected appropriate to the platform.
- * See: `bgfx::RendererType`
- */
- bgfx_renderer_type_t type;
-
- /**
- * Vendor PCI ID. If set to `BGFX_PCI_ID_NONE`, discrete and integrated
- * GPUs will be prioritised.
- * - `BGFX_PCI_ID_NONE` - Autoselect adapter.
- * - `BGFX_PCI_ID_SOFTWARE_RASTERIZER` - Software rasterizer.
- * - `BGFX_PCI_ID_AMD` - AMD adapter.
- * - `BGFX_PCI_ID_APPLE` - Apple adapter.
- * - `BGFX_PCI_ID_INTEL` - Intel adapter.
- * - `BGFX_PCI_ID_NVIDIA` - NVIDIA adapter.
- * - `BGFX_PCI_ID_MICROSOFT` - Microsoft adapter.
- */
- ushort vendorId;
-
- /**
- * Device ID. If set to 0 it will select first device, or device with
- * matching ID.
- */
- ushort deviceId;
- ulong capabilities; /// Capabilities initialization mask (default: UINT64_MAX).
- bool debug_; /// Enable device for debugging.
- bool profile; /// Enable device for profiling.
- bgfx_platform_data_t platformData; /// Platform data.
- bgfx_resolution_t resolution; /// Backbuffer resolution and reset parameters. See: `bgfx::Resolution`.
- bgfx_init_limits_t limits; /// Configurable runtime limits parameters.
-
- /**
- * Provide application specific callback interface.
- * See: `bgfx::CallbackI`
- */
- void* callback;
-
- /**
- * Custom allocator. When a custom allocator is not
- * specified, bgfx uses the CRT allocator. Bgfx assumes
- * custom allocator is thread safe.
- */
- void* allocator;
-}
-
-/**
- * Memory must be obtained by calling `bgfx::alloc`, `bgfx::copy`, or `bgfx::makeRef`.
- * @attention It is illegal to create this structure on stack and pass it to any bgfx API.
- */
-struct bgfx_memory_t
-{
- ubyte* data; /// Pointer to data.
- uint size; /// Data size.
-}
-
-/// Transient index buffer.
-struct bgfx_transient_index_buffer_t
-{
- ubyte* data; /// Pointer to data.
- uint size; /// Data size.
- uint startIndex; /// First index.
- bgfx_index_buffer_handle_t handle; /// Index buffer handle.
- bool isIndex16; /// Index buffer format is 16-bits if true, otherwise it is 32-bit.
-}
-
-/// Transient vertex buffer.
-struct bgfx_transient_vertex_buffer_t
-{
- ubyte* data; /// Pointer to data.
- uint size; /// Data size.
- uint startVertex; /// First vertex.
- ushort stride; /// Vertex stride.
- bgfx_vertex_buffer_handle_t handle; /// Vertex buffer handle.
- bgfx_vertex_layout_handle_t layoutHandle; /// Vertex layout handle.
-}
-
-/// Instance data buffer info.
-struct bgfx_instance_data_buffer_t
-{
- ubyte* data; /// Pointer to data.
- uint size; /// Data size.
- uint offset; /// Offset in vertex buffer.
- uint num; /// Number of instances.
- ushort stride; /// Vertex buffer stride.
- bgfx_vertex_buffer_handle_t handle; /// Vertex buffer object handle.
-}
-
-/// Texture info.
-struct bgfx_texture_info_t
-{
- bgfx_texture_format_t format; /// Texture format.
- uint storageSize; /// Total amount of bytes required to store texture.
- ushort width; /// Texture width.
- ushort height; /// Texture height.
- ushort depth; /// Texture depth.
- ushort numLayers; /// Number of layers in texture array.
- ubyte numMips; /// Number of MIP maps.
- ubyte bitsPerPixel; /// Format bits per pixel.
- bool cubeMap; /// Texture is cubemap.
-}
-
-/// Uniform info.
-struct bgfx_uniform_info_t
-{
- char[256] name; /// Uniform name.
- bgfx_uniform_type_t type; /// Uniform type.
- ushort num; /// Number of elements in array.
-}
-
-/// Frame buffer texture attachment info.
-struct bgfx_attachment_t
-{
- bgfx_access_t access; /// Attachment access. See `Access::Enum`.
- bgfx_texture_handle_t handle; /// Render target texture handle.
- ushort mip; /// Mip level.
- ushort layer; /// Cubemap side or depth layer/slice to use.
- ushort numLayers; /// Number of texture layer/slice(s) in array to use.
- ubyte resolve; /// Resolve flags. See: `BGFX_RESOLVE_*`
-}
-
-/// Transform data.
-struct bgfx_transform_t
-{
- float* data; /// Pointer to first 4x4 matrix.
- ushort num; /// Number of matrices.
-}
-
-/// View stats.
-struct bgfx_view_stats_t
-{
- char[256] name; /// View name.
- bgfx_view_id_t view; /// View id.
- long cpuTimeBegin; /// CPU (submit) begin time.
- long cpuTimeEnd; /// CPU (submit) end time.
- long gpuTimeBegin; /// GPU begin time.
- long gpuTimeEnd; /// GPU end time.
- uint gpuFrameNum; /// Frame which generated gpuTimeBegin, gpuTimeEnd.
-}
-
-/// Encoder stats.
-struct bgfx_encoder_stats_t
-{
- long cpuTimeBegin; /// Encoder thread CPU submit begin time.
- long cpuTimeEnd; /// Encoder thread CPU submit end time.
-}
-
-/**
- * Renderer statistics data.
- * @remarks All time values are high-resolution timestamps, while
- * time frequencies define timestamps-per-second for that hardware.
- */
-struct bgfx_stats_t
-{
- long cpuTimeFrame; /// CPU time between two `bgfx::frame` calls.
- long cpuTimeBegin; /// Render thread CPU submit begin time.
- long cpuTimeEnd; /// Render thread CPU submit end time.
- long cpuTimerFreq; /// CPU timer frequency. Timestamps-per-second
- long gpuTimeBegin; /// GPU frame begin time.
- long gpuTimeEnd; /// GPU frame end time.
- long gpuTimerFreq; /// GPU timer frequency.
- long waitRender; /// Time spent waiting for render backend thread to finish issuing draw commands to underlying graphics API.
- long waitSubmit; /// Time spent waiting for submit thread to advance to next frame.
- uint numDraw; /// Number of draw calls submitted.
- uint numCompute; /// Number of compute calls submitted.
- uint numBlit; /// Number of blit calls submitted.
- uint maxGpuLatency; /// GPU driver latency.
- uint gpuFrameNum; /// Frame which generated gpuTimeBegin, gpuTimeEnd.
- ushort numDynamicIndexBuffers; /// Number of used dynamic index buffers.
- ushort numDynamicVertexBuffers; /// Number of used dynamic vertex buffers.
- ushort numFrameBuffers; /// Number of used frame buffers.
- ushort numIndexBuffers; /// Number of used index buffers.
- ushort numOcclusionQueries; /// Number of used occlusion queries.
- ushort numPrograms; /// Number of used programs.
- ushort numShaders; /// Number of used shaders.
- ushort numTextures; /// Number of used textures.
- ushort numUniforms; /// Number of used uniforms.
- ushort numVertexBuffers; /// Number of used vertex buffers.
- ushort numVertexLayouts; /// Number of used vertex layouts.
- long textureMemoryUsed; /// Estimate of texture memory used.
- long rtMemoryUsed; /// Estimate of render target memory used.
- int transientVbUsed; /// Amount of transient vertex buffer used.
- int transientIbUsed; /// Amount of transient index buffer used.
- uint[bgfx_topology_t.BGFX_TOPOLOGY_COUNT] numPrims; /// Number of primitives rendered.
- long gpuMemoryMax; /// Maximum available GPU memory for application.
- long gpuMemoryUsed; /// Amount of GPU memory used by the application.
- ushort width; /// Backbuffer width in pixels.
- ushort height; /// Backbuffer height in pixels.
- ushort textWidth; /// Debug text width in characters.
- ushort textHeight; /// Debug text height in characters.
- ushort numViews; /// Number of view stats.
- bgfx_view_stats_t* viewStats; /// Array of View stats.
- ubyte numEncoders; /// Number of encoders used during frame.
- bgfx_encoder_stats_t* encoderStats; /// Array of encoder stats.
-}
-
-/// Vertex layout.
-struct bgfx_vertex_layout_t
-{
- uint hash; /// Hash.
- ushort stride; /// Stride.
- ushort[bgfx_attrib_t.BGFX_ATTRIB_COUNT] offset; /// Attribute offsets.
- ushort[bgfx_attrib_t.BGFX_ATTRIB_COUNT] attributes; /// Used attributes.
-}
-
-/**
- * Encoders are used for submitting draw calls from multiple threads. Only one encoder
- * per thread should be used. Use `bgfx::begin()` to obtain an encoder for a thread.
- */
-struct bgfx_encoder_t
-{
-}
-
-struct bgfx_dynamic_index_buffer_handle_t { ushort idx; }
-
-struct bgfx_dynamic_vertex_buffer_handle_t { ushort idx; }
-
-struct bgfx_frame_buffer_handle_t { ushort idx; }
-
-struct bgfx_index_buffer_handle_t { ushort idx; }
-
-struct bgfx_indirect_buffer_handle_t { ushort idx; }
-
-struct bgfx_occlusion_query_handle_t { ushort idx; }
-
-struct bgfx_program_handle_t { ushort idx; }
-
-struct bgfx_shader_handle_t { ushort idx; }
-
-struct bgfx_texture_handle_t { ushort idx; }
-
-struct bgfx_uniform_handle_t { ushort idx; }
-
-struct bgfx_vertex_buffer_handle_t { ushort idx; }
-
-struct bgfx_vertex_layout_handle_t { ushort idx; }
-
diff --git a/3rdparty/bgfx/bindings/zig/bgfx.zig b/3rdparty/bgfx/bindings/zig/bgfx.zig
index 612647d7785..757888b0f40 100644
--- a/3rdparty/bgfx/bindings/zig/bgfx.zig
+++ b/3rdparty/bgfx/bindings/zig/bgfx.zig
@@ -1,4 +1,4 @@
-// Copyright 2011-2022 Branimir Karadzic. All rights reserved.
+// Copyright 2011-2023 Branimir Karadzic. All rights reserved.
// License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE
@@ -708,11 +708,14 @@ pub const CapsFlags_VertexAttribUint10: CapsFlags = 0x0000000004000000;
/// Rendering with VertexID only is supported.
pub const CapsFlags_VertexId: CapsFlags = 0x0000000008000000;
+/// PrimitiveID is available in fragment shader.
+pub const CapsFlags_PrimitiveId: CapsFlags = 0x0000000010000000;
+
/// Viewport layer is available in vertex shader.
-pub const CapsFlags_ViewportLayerArray: CapsFlags = 0x0000000010000000;
+pub const CapsFlags_ViewportLayerArray: CapsFlags = 0x0000000020000000;
/// Draw indirect with indirect count is supported.
-pub const CapsFlags_DrawIndirectCount: CapsFlags = 0x0000000020000000;
+pub const CapsFlags_DrawIndirectCount: CapsFlags = 0x0000000040000000;
/// All texture compare modes are supported.
pub const CapsFlags_TextureCompareAll: CapsFlags = 0x0000000000300000;
@@ -1338,6 +1341,7 @@ pub const Caps = extern struct {
reset: u32,
numBackBuffers: u8,
maxFrameLatency: u8,
+ debugTextScale: u8,
};
pub const Init = extern struct {
@@ -1699,7 +1703,7 @@ pub const Init = extern struct {
/// Set instance data buffer for draw primitive.
/// <param name="_handle">Vertex buffer.</param>
/// <param name="_startVertex">First instance data.</param>
- /// <param name="_num">Number of data instances. Set instance data buffer for draw primitive.</param>
+ /// <param name="_num">Number of data instances.</param>
pub inline fn setInstanceDataFromVertexBuffer(self: ?*Encoder, _handle: VertexBufferHandle, _startVertex: u32, _num: u32) void {
return bgfx_encoder_set_instance_data_from_vertex_buffer(self, _handle, _startVertex, _num);
}
@@ -3066,7 +3070,7 @@ extern fn bgfx_encoder_set_instance_data_buffer(self: ?*Encoder, _idb: [*c]const
/// Set instance data buffer for draw primitive.
/// <param name="_handle">Vertex buffer.</param>
/// <param name="_startVertex">First instance data.</param>
-/// <param name="_num">Number of data instances. Set instance data buffer for draw primitive.</param>
+/// <param name="_num">Number of data instances.</param>
extern fn bgfx_encoder_set_instance_data_from_vertex_buffer(self: ?*Encoder, _handle: VertexBufferHandle, _startVertex: u32, _num: u32) void;
/// Set instance data buffer for draw primitive.
@@ -3497,7 +3501,7 @@ extern fn bgfx_set_instance_data_buffer(_idb: [*c]const InstanceDataBuffer, _sta
/// Set instance data buffer for draw primitive.
/// <param name="_handle">Vertex buffer.</param>
/// <param name="_startVertex">First instance data.</param>
-/// <param name="_num">Number of data instances. Set instance data buffer for draw primitive.</param>
+/// <param name="_num">Number of data instances.</param>
pub inline fn setInstanceDataFromVertexBuffer(_handle: VertexBufferHandle, _startVertex: u32, _num: u32) void {
return bgfx_set_instance_data_from_vertex_buffer(_handle, _startVertex, _num);
}