1 /* 2 * 3 * AUTO GENERATED! DO NOT EDIT! 4 * 5 */ 6 7 module bindbc.bgfx.types; 8 9 public import core.stdc.stdarg : va_list; 10 11 extern(C) @nogc nothrow: 12 13 enum uint BGFX_API_VERSION = 115; 14 15 alias bgfx_view_id_t = ushort; 16 17 /// Memory release callback. 18 19 /// Color RGB/alpha/depth write. When it's not specified write will be disabled. 20 enum ulong BGFX_STATE_WRITE_R = 0x0000000000000001; /// Enable R write. 21 enum ulong BGFX_STATE_WRITE_G = 0x0000000000000002; /// Enable G write. 22 enum ulong BGFX_STATE_WRITE_B = 0x0000000000000004; /// Enable B write. 23 enum ulong BGFX_STATE_WRITE_A = 0x0000000000000008; /// Enable alpha write. 24 enum ulong BGFX_STATE_WRITE_Z = 0x0000004000000000; /// Enable depth write. 25 enum ulong BGFX_STATE_WRITE_RGB = 0x0000000000000007; /// Enable RGB write. 26 enum ulong BGFX_STATE_WRITE_MASK = 0x000000400000000f; /// Write all channels mask. 27 28 /// Depth test state. When `BGFX_STATE_DEPTH_` is not specified depth test will be disabled. 29 enum ulong BGFX_STATE_DEPTH_TEST_LESS = 0x0000000000000010; /// Enable depth test, less. 30 enum ulong BGFX_STATE_DEPTH_TEST_LEQUAL = 0x0000000000000020; /// Enable depth test, less or equal. 31 enum ulong BGFX_STATE_DEPTH_TEST_EQUAL = 0x0000000000000030; /// Enable depth test, equal. 32 enum ulong BGFX_STATE_DEPTH_TEST_GEQUAL = 0x0000000000000040; /// Enable depth test, greater or equal. 33 enum ulong BGFX_STATE_DEPTH_TEST_GREATER = 0x0000000000000050; /// Enable depth test, greater. 34 enum ulong BGFX_STATE_DEPTH_TEST_NOTEQUAL = 0x0000000000000060; /// Enable depth test, not equal. 35 enum ulong BGFX_STATE_DEPTH_TEST_NEVER = 0x0000000000000070; /// Enable depth test, never. 36 enum ulong BGFX_STATE_DEPTH_TEST_ALWAYS = 0x0000000000000080; /// Enable depth test, always. 37 enum ulong BGFX_STATE_DEPTH_TEST_SHIFT = 4; /// Depth test state bit shift 38 enum ulong BGFX_STATE_DEPTH_TEST_MASK = 0x00000000000000f0; /// Depth test state bit mask 39 40 /** 41 * Use BGFX_STATE_BLEND_FUNC(_src, _dst) or BGFX_STATE_BLEND_FUNC_SEPARATE(_srcRGB, _dstRGB, _srcA, _dstA) 42 * helper macros. 43 */ 44 enum ulong BGFX_STATE_BLEND_ZERO = 0x0000000000001000; /// 0, 0, 0, 0 45 enum ulong BGFX_STATE_BLEND_ONE = 0x0000000000002000; /// 1, 1, 1, 1 46 enum ulong BGFX_STATE_BLEND_SRC_COLOR = 0x0000000000003000; /// Rs, Gs, Bs, As 47 enum ulong BGFX_STATE_BLEND_INV_SRC_COLOR = 0x0000000000004000; /// 1-Rs, 1-Gs, 1-Bs, 1-As 48 enum ulong BGFX_STATE_BLEND_SRC_ALPHA = 0x0000000000005000; /// As, As, As, As 49 enum ulong BGFX_STATE_BLEND_INV_SRC_ALPHA = 0x0000000000006000; /// 1-As, 1-As, 1-As, 1-As 50 enum ulong BGFX_STATE_BLEND_DST_ALPHA = 0x0000000000007000; /// Ad, Ad, Ad, Ad 51 enum ulong BGFX_STATE_BLEND_INV_DST_ALPHA = 0x0000000000008000; /// 1-Ad, 1-Ad, 1-Ad ,1-Ad 52 enum ulong BGFX_STATE_BLEND_DST_COLOR = 0x0000000000009000; /// Rd, Gd, Bd, Ad 53 enum ulong BGFX_STATE_BLEND_INV_DST_COLOR = 0x000000000000a000; /// 1-Rd, 1-Gd, 1-Bd, 1-Ad 54 enum ulong BGFX_STATE_BLEND_SRC_ALPHA_SAT = 0x000000000000b000; /// f, f, f, 1; f = min(As, 1-Ad) 55 enum ulong BGFX_STATE_BLEND_FACTOR = 0x000000000000c000; /// Blend factor 56 enum ulong BGFX_STATE_BLEND_INV_FACTOR = 0x000000000000d000; /// 1-Blend factor 57 enum ulong BGFX_STATE_BLEND_SHIFT = 12; /// Blend state bit shift 58 enum ulong BGFX_STATE_BLEND_MASK = 0x000000000ffff000; /// Blend state bit mask 59 60 /** 61 * Use BGFX_STATE_BLEND_EQUATION(_equation) or BGFX_STATE_BLEND_EQUATION_SEPARATE(_equationRGB, _equationA) 62 * helper macros. 63 */ 64 enum ulong BGFX_STATE_BLEND_EQUATION_ADD = 0x0000000000000000; /// Blend add: src + dst. 65 enum ulong BGFX_STATE_BLEND_EQUATION_SUB = 0x0000000010000000; /// Blend subtract: src - dst. 66 enum ulong BGFX_STATE_BLEND_EQUATION_REVSUB = 0x0000000020000000; /// Blend reverse subtract: dst - src. 67 enum ulong BGFX_STATE_BLEND_EQUATION_MIN = 0x0000000030000000; /// Blend min: min(src, dst). 68 enum ulong BGFX_STATE_BLEND_EQUATION_MAX = 0x0000000040000000; /// Blend max: max(src, dst). 69 enum ulong BGFX_STATE_BLEND_EQUATION_SHIFT = 28; /// Blend equation bit shift 70 enum ulong BGFX_STATE_BLEND_EQUATION_MASK = 0x00000003f0000000; /// Blend equation bit mask 71 72 /// Cull state. When `BGFX_STATE_CULL_*` is not specified culling will be disabled. 73 enum ulong BGFX_STATE_CULL_CW = 0x0000001000000000; /// Cull clockwise triangles. 74 enum ulong BGFX_STATE_CULL_CCW = 0x0000002000000000; /// Cull counter-clockwise triangles. 75 enum ulong BGFX_STATE_CULL_SHIFT = 36; /// Culling mode bit shift 76 enum ulong BGFX_STATE_CULL_MASK = 0x0000003000000000; /// Culling mode bit mask 77 78 /// Alpha reference value. 79 enum ulong BGFX_STATE_ALPHA_REF_SHIFT = 40; /// Alpha reference bit shift 80 enum ulong BGFX_STATE_ALPHA_REF_MASK = 0x0000ff0000000000; /// Alpha reference bit mask 81 ulong BGFX_STATE_ALPHA_REF (ulong v) { return (v << BGFX_STATE_ALPHA_REF_SHIFT) & BGFX_STATE_ALPHA_REF_MASK; } 82 83 enum ulong BGFX_STATE_PT_TRISTRIP = 0x0001000000000000; /// Tristrip. 84 enum ulong BGFX_STATE_PT_LINES = 0x0002000000000000; /// Lines. 85 enum ulong BGFX_STATE_PT_LINESTRIP = 0x0003000000000000; /// Line strip. 86 enum ulong BGFX_STATE_PT_POINTS = 0x0004000000000000; /// Points. 87 enum ulong BGFX_STATE_PT_SHIFT = 48; /// Primitive type bit shift 88 enum ulong BGFX_STATE_PT_MASK = 0x0007000000000000; /// Primitive type bit mask 89 90 /// Point size value. 91 enum ulong BGFX_STATE_POINT_SIZE_SHIFT = 52; /// Point size bit shift 92 enum ulong BGFX_STATE_POINT_SIZE_MASK = 0x00f0000000000000; /// Point size bit mask 93 ulong BGFX_STATE_POINT_SIZE (ulong v) { return (v << BGFX_STATE_POINT_SIZE_SHIFT) & BGFX_STATE_POINT_SIZE_MASK; } 94 95 /** 96 * Enable MSAA write when writing into MSAA frame buffer. 97 * This flag is ignored when not writing into MSAA frame buffer. 98 */ 99 enum ulong BGFX_STATE_MSAA = 0x0100000000000000; /// Enable MSAA rasterization. 100 enum ulong BGFX_STATE_LINEAA = 0x0200000000000000; /// Enable line AA rasterization. 101 enum ulong BGFX_STATE_CONSERVATIVE_RASTER = 0x0400000000000000; /// Enable conservative rasterization. 102 enum ulong BGFX_STATE_NONE = 0x0000000000000000; /// No state. 103 enum ulong BGFX_STATE_FRONT_CCW = 0x0000008000000000; /// Front counter-clockwise (default is clockwise). 104 enum ulong BGFX_STATE_BLEND_INDEPENDENT = 0x0000000400000000; /// Enable blend independent. 105 enum ulong BGFX_STATE_BLEND_ALPHA_TO_COVERAGE = 0x0000000800000000; /// Enable alpha to coverage. 106 /** 107 * Default state is write to RGB, alpha, and depth with depth test less enabled, with clockwise 108 * culling and MSAA (when writing into MSAA frame buffer, otherwise this flag is ignored). 109 */ 110 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; 111 enum ulong BGFX_STATE_MASK = 0xffffffffffffffff; /// State bit mask 112 113 /// Do not use! 114 enum ulong BGFX_STATE_RESERVED_SHIFT = 61; 115 enum ulong BGFX_STATE_RESERVED_MASK = 0xe000000000000000; 116 117 /// Set stencil ref value. 118 enum uint BGFX_STENCIL_FUNC_REF_SHIFT = 0; 119 enum uint BGFX_STENCIL_FUNC_REF_MASK = 0x000000ff; 120 uint BGFX_STENCIL_FUNC_REF (uint v) { return (v << BGFX_STENCIL_FUNC_REF_SHIFT) & BGFX_STENCIL_FUNC_REF_MASK; } 121 122 /// Set stencil rmask value. 123 enum uint BGFX_STENCIL_FUNC_RMASK_SHIFT = 8; 124 enum uint BGFX_STENCIL_FUNC_RMASK_MASK = 0x0000ff00; 125 uint BGFX_STENCIL_FUNC_RMASK (uint v) { return (v << BGFX_STENCIL_FUNC_RMASK_SHIFT) & BGFX_STENCIL_FUNC_RMASK_MASK; } 126 127 enum uint BGFX_STENCIL_NONE = 0x00000000; 128 enum uint BGFX_STENCIL_MASK = 0xffffffff; 129 enum uint BGFX_STENCIL_DEFAULT = 0x00000000; 130 131 enum uint BGFX_STENCIL_TEST_LESS = 0x00010000; /// Enable stencil test, less. 132 enum uint BGFX_STENCIL_TEST_LEQUAL = 0x00020000; /// Enable stencil test, less or equal. 133 enum uint BGFX_STENCIL_TEST_EQUAL = 0x00030000; /// Enable stencil test, equal. 134 enum uint BGFX_STENCIL_TEST_GEQUAL = 0x00040000; /// Enable stencil test, greater or equal. 135 enum uint BGFX_STENCIL_TEST_GREATER = 0x00050000; /// Enable stencil test, greater. 136 enum uint BGFX_STENCIL_TEST_NOTEQUAL = 0x00060000; /// Enable stencil test, not equal. 137 enum uint BGFX_STENCIL_TEST_NEVER = 0x00070000; /// Enable stencil test, never. 138 enum uint BGFX_STENCIL_TEST_ALWAYS = 0x00080000; /// Enable stencil test, always. 139 enum uint BGFX_STENCIL_TEST_SHIFT = 16; /// Stencil test bit shift 140 enum uint BGFX_STENCIL_TEST_MASK = 0x000f0000; /// Stencil test bit mask 141 142 enum uint BGFX_STENCIL_OP_FAIL_S_ZERO = 0x00000000; /// Zero. 143 enum uint BGFX_STENCIL_OP_FAIL_S_KEEP = 0x00100000; /// Keep. 144 enum uint BGFX_STENCIL_OP_FAIL_S_REPLACE = 0x00200000; /// Replace. 145 enum uint BGFX_STENCIL_OP_FAIL_S_INCR = 0x00300000; /// Increment and wrap. 146 enum uint BGFX_STENCIL_OP_FAIL_S_INCRSAT = 0x00400000; /// Increment and clamp. 147 enum uint BGFX_STENCIL_OP_FAIL_S_DECR = 0x00500000; /// Decrement and wrap. 148 enum uint BGFX_STENCIL_OP_FAIL_S_DECRSAT = 0x00600000; /// Decrement and clamp. 149 enum uint BGFX_STENCIL_OP_FAIL_S_INVERT = 0x00700000; /// Invert. 150 enum uint BGFX_STENCIL_OP_FAIL_S_SHIFT = 20; /// Stencil operation fail bit shift 151 enum uint BGFX_STENCIL_OP_FAIL_S_MASK = 0x00f00000; /// Stencil operation fail bit mask 152 153 enum uint BGFX_STENCIL_OP_FAIL_Z_ZERO = 0x00000000; /// Zero. 154 enum uint BGFX_STENCIL_OP_FAIL_Z_KEEP = 0x01000000; /// Keep. 155 enum uint BGFX_STENCIL_OP_FAIL_Z_REPLACE = 0x02000000; /// Replace. 156 enum uint BGFX_STENCIL_OP_FAIL_Z_INCR = 0x03000000; /// Increment and wrap. 157 enum uint BGFX_STENCIL_OP_FAIL_Z_INCRSAT = 0x04000000; /// Increment and clamp. 158 enum uint BGFX_STENCIL_OP_FAIL_Z_DECR = 0x05000000; /// Decrement and wrap. 159 enum uint BGFX_STENCIL_OP_FAIL_Z_DECRSAT = 0x06000000; /// Decrement and clamp. 160 enum uint BGFX_STENCIL_OP_FAIL_Z_INVERT = 0x07000000; /// Invert. 161 enum uint BGFX_STENCIL_OP_FAIL_Z_SHIFT = 24; /// Stencil operation depth fail bit shift 162 enum uint BGFX_STENCIL_OP_FAIL_Z_MASK = 0x0f000000; /// Stencil operation depth fail bit mask 163 164 enum uint BGFX_STENCIL_OP_PASS_Z_ZERO = 0x00000000; /// Zero. 165 enum uint BGFX_STENCIL_OP_PASS_Z_KEEP = 0x10000000; /// Keep. 166 enum uint BGFX_STENCIL_OP_PASS_Z_REPLACE = 0x20000000; /// Replace. 167 enum uint BGFX_STENCIL_OP_PASS_Z_INCR = 0x30000000; /// Increment and wrap. 168 enum uint BGFX_STENCIL_OP_PASS_Z_INCRSAT = 0x40000000; /// Increment and clamp. 169 enum uint BGFX_STENCIL_OP_PASS_Z_DECR = 0x50000000; /// Decrement and wrap. 170 enum uint BGFX_STENCIL_OP_PASS_Z_DECRSAT = 0x60000000; /// Decrement and clamp. 171 enum uint BGFX_STENCIL_OP_PASS_Z_INVERT = 0x70000000; /// Invert. 172 enum uint BGFX_STENCIL_OP_PASS_Z_SHIFT = 28; /// Stencil operation depth pass bit shift 173 enum uint BGFX_STENCIL_OP_PASS_Z_MASK = 0xf0000000; /// Stencil operation depth pass bit mask 174 175 enum ushort BGFX_CLEAR_NONE = 0x0000; /// No clear flags. 176 enum ushort BGFX_CLEAR_COLOR = 0x0001; /// Clear color. 177 enum ushort BGFX_CLEAR_DEPTH = 0x0002; /// Clear depth. 178 enum ushort BGFX_CLEAR_STENCIL = 0x0004; /// Clear stencil. 179 enum ushort BGFX_CLEAR_DISCARD_COLOR_0 = 0x0008; /// Discard frame buffer attachment 0. 180 enum ushort BGFX_CLEAR_DISCARD_COLOR_1 = 0x0010; /// Discard frame buffer attachment 1. 181 enum ushort BGFX_CLEAR_DISCARD_COLOR_2 = 0x0020; /// Discard frame buffer attachment 2. 182 enum ushort BGFX_CLEAR_DISCARD_COLOR_3 = 0x0040; /// Discard frame buffer attachment 3. 183 enum ushort BGFX_CLEAR_DISCARD_COLOR_4 = 0x0080; /// Discard frame buffer attachment 4. 184 enum ushort BGFX_CLEAR_DISCARD_COLOR_5 = 0x0100; /// Discard frame buffer attachment 5. 185 enum ushort BGFX_CLEAR_DISCARD_COLOR_6 = 0x0200; /// Discard frame buffer attachment 6. 186 enum ushort BGFX_CLEAR_DISCARD_COLOR_7 = 0x0400; /// Discard frame buffer attachment 7. 187 enum ushort BGFX_CLEAR_DISCARD_DEPTH = 0x0800; /// Discard frame buffer depth attachment. 188 enum ushort BGFX_CLEAR_DISCARD_STENCIL = 0x1000; /// Discard frame buffer stencil attachment. 189 enum ushort BGFX_CLEAR_DISCARD_COLOR_MASK = 0x07f8; 190 enum ushort BGFX_CLEAR_DISCARD_MASK = 0x1ff8; 191 192 /** 193 * Rendering state discard. When state is preserved in submit, rendering states can be discarded 194 * on a finer grain. 195 */ 196 enum ubyte BGFX_DISCARD_NONE = 0x00; /// Preserve everything. 197 enum ubyte BGFX_DISCARD_BINDINGS = 0x01; /// Discard texture sampler and buffer bindings. 198 enum ubyte BGFX_DISCARD_INDEX_BUFFER = 0x02; /// Discard index buffer. 199 enum ubyte BGFX_DISCARD_INSTANCE_DATA = 0x04; /// Discard instance data. 200 enum ubyte BGFX_DISCARD_STATE = 0x08; /// Discard state and uniform bindings. 201 enum ubyte BGFX_DISCARD_TRANSFORM = 0x10; /// Discard transform. 202 enum ubyte BGFX_DISCARD_VERTEX_STREAMS = 0x20; /// Discard vertex streams. 203 enum ubyte BGFX_DISCARD_ALL = 0xff; /// Discard all states. 204 205 enum uint BGFX_DEBUG_NONE = 0x00000000; /// No debug. 206 enum uint BGFX_DEBUG_WIREFRAME = 0x00000001; /// Enable wireframe for all primitives. 207 /** 208 * Enable infinitely fast hardware test. No draw calls will be submitted to driver. 209 * It's useful when profiling to quickly assess bottleneck between CPU and GPU. 210 */ 211 enum uint BGFX_DEBUG_IFH = 0x00000002; 212 enum uint BGFX_DEBUG_STATS = 0x00000004; /// Enable statistics display. 213 enum uint BGFX_DEBUG_TEXT = 0x00000008; /// Enable debug text display. 214 enum uint BGFX_DEBUG_PROFILER = 0x00000010; /// Enable profiler. 215 216 enum ushort BGFX_BUFFER_COMPUTE_FORMAT_8X1 = 0x0001; /// 1 8-bit value 217 enum ushort BGFX_BUFFER_COMPUTE_FORMAT_8X2 = 0x0002; /// 2 8-bit values 218 enum ushort BGFX_BUFFER_COMPUTE_FORMAT_8X4 = 0x0003; /// 4 8-bit values 219 enum ushort BGFX_BUFFER_COMPUTE_FORMAT_16X1 = 0x0004; /// 1 16-bit value 220 enum ushort BGFX_BUFFER_COMPUTE_FORMAT_16X2 = 0x0005; /// 2 16-bit values 221 enum ushort BGFX_BUFFER_COMPUTE_FORMAT_16X4 = 0x0006; /// 4 16-bit values 222 enum ushort BGFX_BUFFER_COMPUTE_FORMAT_32X1 = 0x0007; /// 1 32-bit value 223 enum ushort BGFX_BUFFER_COMPUTE_FORMAT_32X2 = 0x0008; /// 2 32-bit values 224 enum ushort BGFX_BUFFER_COMPUTE_FORMAT_32X4 = 0x0009; /// 4 32-bit values 225 enum ushort BGFX_BUFFER_COMPUTE_FORMAT_SHIFT = 0; 226 enum ushort BGFX_BUFFER_COMPUTE_FORMAT_MASK = 0x000f; 227 228 enum ushort BGFX_BUFFER_COMPUTE_TYPE_INT = 0x0010; /// Type `int`. 229 enum ushort BGFX_BUFFER_COMPUTE_TYPE_UINT = 0x0020; /// Type `uint`. 230 enum ushort BGFX_BUFFER_COMPUTE_TYPE_FLOAT = 0x0030; /// Type `float`. 231 enum ushort BGFX_BUFFER_COMPUTE_TYPE_SHIFT = 4; 232 enum ushort BGFX_BUFFER_COMPUTE_TYPE_MASK = 0x0030; 233 234 enum ushort BGFX_BUFFER_NONE = 0x0000; 235 enum ushort BGFX_BUFFER_COMPUTE_READ = 0x0100; /// Buffer will be read by shader. 236 enum ushort BGFX_BUFFER_COMPUTE_WRITE = 0x0200; /// Buffer will be used for writing. 237 enum ushort BGFX_BUFFER_DRAW_INDIRECT = 0x0400; /// Buffer will be used for storing draw indirect commands. 238 enum ushort BGFX_BUFFER_ALLOW_RESIZE = 0x0800; /// Allow dynamic index/vertex buffer resize during update. 239 enum ushort BGFX_BUFFER_INDEX32 = 0x1000; /// Index buffer contains 32-bit indices. 240 enum ushort BGFX_BUFFER_COMPUTE_READ_WRITE = 0x0300; 241 242 enum ulong BGFX_TEXTURE_NONE = 0x0000000000000000; 243 enum ulong BGFX_TEXTURE_MSAA_SAMPLE = 0x0000000800000000; /// Texture will be used for MSAA sampling. 244 enum ulong BGFX_TEXTURE_RT = 0x0000001000000000; /// Render target no MSAA. 245 enum ulong BGFX_TEXTURE_COMPUTE_WRITE = 0x0000100000000000; /// Texture will be used for compute write. 246 enum ulong BGFX_TEXTURE_SRGB = 0x0000200000000000; /// Sample texture as sRGB. 247 enum ulong BGFX_TEXTURE_BLIT_DST = 0x0000400000000000; /// Texture will be used as blit destination. 248 enum ulong BGFX_TEXTURE_READ_BACK = 0x0000800000000000; /// Texture will be used for read back from GPU. 249 250 enum ulong BGFX_TEXTURE_RT_MSAA_X2 = 0x0000002000000000; /// Render target MSAAx2 mode. 251 enum ulong BGFX_TEXTURE_RT_MSAA_X4 = 0x0000003000000000; /// Render target MSAAx4 mode. 252 enum ulong BGFX_TEXTURE_RT_MSAA_X8 = 0x0000004000000000; /// Render target MSAAx8 mode. 253 enum ulong BGFX_TEXTURE_RT_MSAA_X16 = 0x0000005000000000; /// Render target MSAAx16 mode. 254 enum ulong BGFX_TEXTURE_RT_MSAA_SHIFT = 36; 255 enum ulong BGFX_TEXTURE_RT_MSAA_MASK = 0x0000007000000000; 256 257 enum ulong BGFX_TEXTURE_RT_WRITE_ONLY = 0x0000008000000000; /// Render target will be used for writing 258 enum ulong BGFX_TEXTURE_RT_SHIFT = 36; 259 enum ulong BGFX_TEXTURE_RT_MASK = 0x000000f000000000; 260 261 /// Sampler flags. 262 enum uint BGFX_SAMPLER_U_MIRROR = 0x00000001; /// Wrap U mode: Mirror 263 enum uint BGFX_SAMPLER_U_CLAMP = 0x00000002; /// Wrap U mode: Clamp 264 enum uint BGFX_SAMPLER_U_BORDER = 0x00000003; /// Wrap U mode: Border 265 enum uint BGFX_SAMPLER_U_SHIFT = 0; 266 enum uint BGFX_SAMPLER_U_MASK = 0x00000003; 267 268 enum uint BGFX_SAMPLER_V_MIRROR = 0x00000004; /// Wrap V mode: Mirror 269 enum uint BGFX_SAMPLER_V_CLAMP = 0x00000008; /// Wrap V mode: Clamp 270 enum uint BGFX_SAMPLER_V_BORDER = 0x0000000c; /// Wrap V mode: Border 271 enum uint BGFX_SAMPLER_V_SHIFT = 2; 272 enum uint BGFX_SAMPLER_V_MASK = 0x0000000c; 273 274 enum uint BGFX_SAMPLER_W_MIRROR = 0x00000010; /// Wrap W mode: Mirror 275 enum uint BGFX_SAMPLER_W_CLAMP = 0x00000020; /// Wrap W mode: Clamp 276 enum uint BGFX_SAMPLER_W_BORDER = 0x00000030; /// Wrap W mode: Border 277 enum uint BGFX_SAMPLER_W_SHIFT = 4; 278 enum uint BGFX_SAMPLER_W_MASK = 0x00000030; 279 280 enum uint BGFX_SAMPLER_MIN_POINT = 0x00000040; /// Min sampling mode: Point 281 enum uint BGFX_SAMPLER_MIN_ANISOTROPIC = 0x00000080; /// Min sampling mode: Anisotropic 282 enum uint BGFX_SAMPLER_MIN_SHIFT = 6; 283 enum uint BGFX_SAMPLER_MIN_MASK = 0x000000c0; 284 285 enum uint BGFX_SAMPLER_MAG_POINT = 0x00000100; /// Mag sampling mode: Point 286 enum uint BGFX_SAMPLER_MAG_ANISOTROPIC = 0x00000200; /// Mag sampling mode: Anisotropic 287 enum uint BGFX_SAMPLER_MAG_SHIFT = 8; 288 enum uint BGFX_SAMPLER_MAG_MASK = 0x00000300; 289 290 enum uint BGFX_SAMPLER_MIP_POINT = 0x00000400; /// Mip sampling mode: Point 291 enum uint BGFX_SAMPLER_MIP_SHIFT = 10; 292 enum uint BGFX_SAMPLER_MIP_MASK = 0x00000400; 293 294 enum uint BGFX_SAMPLER_COMPARE_LESS = 0x00010000; /// Compare when sampling depth texture: less. 295 enum uint BGFX_SAMPLER_COMPARE_LEQUAL = 0x00020000; /// Compare when sampling depth texture: less or equal. 296 enum uint BGFX_SAMPLER_COMPARE_EQUAL = 0x00030000; /// Compare when sampling depth texture: equal. 297 enum uint BGFX_SAMPLER_COMPARE_GEQUAL = 0x00040000; /// Compare when sampling depth texture: greater or equal. 298 enum uint BGFX_SAMPLER_COMPARE_GREATER = 0x00050000; /// Compare when sampling depth texture: greater. 299 enum uint BGFX_SAMPLER_COMPARE_NOTEQUAL = 0x00060000; /// Compare when sampling depth texture: not equal. 300 enum uint BGFX_SAMPLER_COMPARE_NEVER = 0x00070000; /// Compare when sampling depth texture: never. 301 enum uint BGFX_SAMPLER_COMPARE_ALWAYS = 0x00080000; /// Compare when sampling depth texture: always. 302 enum uint BGFX_SAMPLER_COMPARE_SHIFT = 16; 303 enum uint BGFX_SAMPLER_COMPARE_MASK = 0x000f0000; 304 305 enum uint BGFX_SAMPLER_BORDER_COLOR_SHIFT = 24; 306 enum uint BGFX_SAMPLER_BORDER_COLOR_MASK = 0x0f000000; 307 uint BGFX_SAMPLER_BORDER_COLOR (uint v) { return (v << BGFX_SAMPLER_BORDER_COLOR_SHIFT) & BGFX_SAMPLER_BORDER_COLOR_MASK; } 308 309 enum uint BGFX_SAMPLER_RESERVED_SHIFT = 28; 310 enum uint BGFX_SAMPLER_RESERVED_MASK = 0xf0000000; 311 312 enum uint BGFX_SAMPLER_NONE = 0x00000000; 313 enum uint BGFX_SAMPLER_SAMPLE_STENCIL = 0x00100000; /// Sample stencil instead of depth. 314 enum uint BGFX_SAMPLER_POINT = BGFX_SAMPLER_MIN_POINT | BGFX_SAMPLER_MAG_POINT | BGFX_SAMPLER_MIP_POINT; 315 enum uint BGFX_SAMPLER_UVW_MIRROR = BGFX_SAMPLER_U_MIRROR | BGFX_SAMPLER_V_MIRROR | BGFX_SAMPLER_W_MIRROR; 316 enum uint BGFX_SAMPLER_UVW_CLAMP = BGFX_SAMPLER_U_CLAMP | BGFX_SAMPLER_V_CLAMP | BGFX_SAMPLER_W_CLAMP; 317 enum uint BGFX_SAMPLER_UVW_BORDER = BGFX_SAMPLER_U_BORDER | BGFX_SAMPLER_V_BORDER | BGFX_SAMPLER_W_BORDER; 318 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; 319 320 enum uint BGFX_RESET_MSAA_X2 = 0x00000010; /// Enable 2x MSAA. 321 enum uint BGFX_RESET_MSAA_X4 = 0x00000020; /// Enable 4x MSAA. 322 enum uint BGFX_RESET_MSAA_X8 = 0x00000030; /// Enable 8x MSAA. 323 enum uint BGFX_RESET_MSAA_X16 = 0x00000040; /// Enable 16x MSAA. 324 enum uint BGFX_RESET_MSAA_SHIFT = 4; 325 enum uint BGFX_RESET_MSAA_MASK = 0x00000070; 326 327 enum uint BGFX_RESET_NONE = 0x00000000; /// No reset flags. 328 enum uint BGFX_RESET_FULLSCREEN = 0x00000001; /// Not supported yet. 329 enum uint BGFX_RESET_VSYNC = 0x00000080; /// Enable V-Sync. 330 enum uint BGFX_RESET_MAXANISOTROPY = 0x00000100; /// Turn on/off max anisotropy. 331 enum uint BGFX_RESET_CAPTURE = 0x00000200; /// Begin screen capture. 332 enum uint BGFX_RESET_FLUSH_AFTER_RENDER = 0x00002000; /// Flush rendering after submitting to GPU. 333 /** 334 * This flag specifies where flip occurs. Default behaviour is that flip occurs 335 * before rendering new frame. This flag only has effect when `BGFX_CONFIG_MULTITHREADED=0`. 336 */ 337 enum uint BGFX_RESET_FLIP_AFTER_RENDER = 0x00004000; 338 enum uint BGFX_RESET_SRGB_BACKBUFFER = 0x00008000; /// Enable sRGB backbuffer. 339 enum uint BGFX_RESET_HDR10 = 0x00010000; /// Enable HDR10 rendering. 340 enum uint BGFX_RESET_HIDPI = 0x00020000; /// Enable HiDPI rendering. 341 enum uint BGFX_RESET_DEPTH_CLAMP = 0x00040000; /// Enable depth clamp. 342 enum uint BGFX_RESET_SUSPEND = 0x00080000; /// Suspend rendering. 343 344 enum uint BGFX_RESET_FULLSCREEN_SHIFT = 0; 345 enum uint BGFX_RESET_FULLSCREEN_MASK = 0x00000001; 346 347 enum uint BGFX_RESET_RESERVED_SHIFT = 31; /// Internal bit shift 348 enum uint BGFX_RESET_RESERVED_MASK = 0x80000000; /// Internal bit mask 349 350 enum ulong BGFX_CAPS_ALPHA_TO_COVERAGE = 0x0000000000000001; /// Alpha to coverage is supported. 351 enum ulong BGFX_CAPS_BLEND_INDEPENDENT = 0x0000000000000002; /// Blend independent is supported. 352 enum ulong BGFX_CAPS_COMPUTE = 0x0000000000000004; /// Compute shaders are supported. 353 enum ulong BGFX_CAPS_CONSERVATIVE_RASTER = 0x0000000000000008; /// Conservative rasterization is supported. 354 enum ulong BGFX_CAPS_DRAW_INDIRECT = 0x0000000000000010; /// Draw indirect is supported. 355 enum ulong BGFX_CAPS_FRAGMENT_DEPTH = 0x0000000000000020; /// Fragment depth is available in fragment shader. 356 enum ulong BGFX_CAPS_FRAGMENT_ORDERING = 0x0000000000000040; /// Fragment ordering is available in fragment shader. 357 enum ulong BGFX_CAPS_GRAPHICS_DEBUGGER = 0x0000000000000080; /// Graphics debugger is present. 358 enum ulong BGFX_CAPS_HDR10 = 0x0000000000000100; /// HDR10 rendering is supported. 359 enum ulong BGFX_CAPS_HIDPI = 0x0000000000000200; /// HiDPI rendering is supported. 360 enum ulong BGFX_CAPS_IMAGE_RW = 0x0000000000000400; /// Image Read/Write is supported. 361 enum ulong BGFX_CAPS_INDEX32 = 0x0000000000000800; /// 32-bit indices are supported. 362 enum ulong BGFX_CAPS_INSTANCING = 0x0000000000001000; /// Instancing is supported. 363 enum ulong BGFX_CAPS_OCCLUSION_QUERY = 0x0000000000002000; /// Occlusion query is supported. 364 enum ulong BGFX_CAPS_RENDERER_MULTITHREADED = 0x0000000000004000; /// Renderer is on separate thread. 365 enum ulong BGFX_CAPS_SWAP_CHAIN = 0x0000000000008000; /// Multiple windows are supported. 366 enum ulong BGFX_CAPS_TEXTURE_2D_ARRAY = 0x0000000000010000; /// 2D texture array is supported. 367 enum ulong BGFX_CAPS_TEXTURE_3D = 0x0000000000020000; /// 3D textures are supported. 368 enum ulong BGFX_CAPS_TEXTURE_BLIT = 0x0000000000040000; /// Texture blit is supported. 369 enum ulong BGFX_CAPS_TEXTURE_COMPARE_RESERVED = 0x0000000000080000; 370 enum ulong BGFX_CAPS_TEXTURE_COMPARE_LEQUAL = 0x0000000000100000; /// Texture compare less equal mode is supported. 371 enum ulong BGFX_CAPS_TEXTURE_CUBE_ARRAY = 0x0000000000200000; /// Cubemap texture array is supported. 372 enum ulong BGFX_CAPS_TEXTURE_DIRECT_ACCESS = 0x0000000000400000; /// CPU direct access to GPU texture memory. 373 enum ulong BGFX_CAPS_TEXTURE_READ_BACK = 0x0000000000800000; /// Read-back texture is supported. 374 enum ulong BGFX_CAPS_VERTEX_ATTRIB_HALF = 0x0000000001000000; /// Vertex attribute half-float is supported. 375 enum ulong BGFX_CAPS_VERTEX_ATTRIB_UINT10 = 0x0000000002000000; /// Vertex attribute 10_10_10_2 is supported. 376 enum ulong BGFX_CAPS_VERTEX_ID = 0x0000000004000000; /// Rendering with VertexID only is supported. 377 enum ulong BGFX_CAPS_VIEWPORT_LAYER_ARRAY = 0x0000000008000000; /// Viewport layer is available in vertex shader. 378 enum ulong BGFX_CAPS_TEXTURE_COMPARE_ALL = 0x0000000000180000; /// All texture compare modes are supported. 379 380 enum uint BGFX_CAPS_FORMAT_TEXTURE_NONE = 0x00000000; /// Texture format is not supported. 381 enum uint BGFX_CAPS_FORMAT_TEXTURE_2D = 0x00000001; /// Texture format is supported. 382 enum uint BGFX_CAPS_FORMAT_TEXTURE_2D_SRGB = 0x00000002; /// Texture as sRGB format is supported. 383 enum uint BGFX_CAPS_FORMAT_TEXTURE_2D_EMULATED = 0x00000004; /// Texture format is emulated. 384 enum uint BGFX_CAPS_FORMAT_TEXTURE_3D = 0x00000008; /// Texture format is supported. 385 enum uint BGFX_CAPS_FORMAT_TEXTURE_3D_SRGB = 0x00000010; /// Texture as sRGB format is supported. 386 enum uint BGFX_CAPS_FORMAT_TEXTURE_3D_EMULATED = 0x00000020; /// Texture format is emulated. 387 enum uint BGFX_CAPS_FORMAT_TEXTURE_CUBE = 0x00000040; /// Texture format is supported. 388 enum uint BGFX_CAPS_FORMAT_TEXTURE_CUBE_SRGB = 0x00000080; /// Texture as sRGB format is supported. 389 enum uint BGFX_CAPS_FORMAT_TEXTURE_CUBE_EMULATED = 0x00000100; /// Texture format is emulated. 390 enum uint BGFX_CAPS_FORMAT_TEXTURE_VERTEX = 0x00000200; /// Texture format can be used from vertex shader. 391 enum uint BGFX_CAPS_FORMAT_TEXTURE_IMAGE_READ = 0x00000400; /// Texture format can be used as image and read from. 392 enum uint BGFX_CAPS_FORMAT_TEXTURE_IMAGE_WRITE = 0x00000800; /// Texture format can be used as image and written to. 393 enum uint BGFX_CAPS_FORMAT_TEXTURE_FRAMEBUFFER = 0x00001000; /// Texture format can be used as frame buffer. 394 enum uint BGFX_CAPS_FORMAT_TEXTURE_FRAMEBUFFER_MSAA = 0x00002000; /// Texture format can be used as MSAA frame buffer. 395 enum uint BGFX_CAPS_FORMAT_TEXTURE_MSAA = 0x00004000; /// Texture can be sampled as MSAA. 396 enum uint BGFX_CAPS_FORMAT_TEXTURE_MIP_AUTOGEN = 0x00008000; /// Texture format supports auto-generated mips. 397 398 enum ubyte BGFX_RESOLVE_NONE = 0x00; /// No resolve flags. 399 enum ubyte BGFX_RESOLVE_AUTO_GEN_MIPS = 0x01; /// Auto-generate mip maps on resolve. 400 401 enum ushort BGFX_PCI_ID_NONE = 0x0000; /// Autoselect adapter. 402 enum ushort BGFX_PCI_ID_SOFTWARE_RASTERIZER = 0x0001; /// Software rasterizer. 403 enum ushort BGFX_PCI_ID_AMD = 0x1002; /// AMD adapter. 404 enum ushort BGFX_PCI_ID_INTEL = 0x8086; /// Intel adapter. 405 enum ushort BGFX_PCI_ID_NVIDIA = 0x10de; /// nVidia adapter. 406 407 enum ubyte BGFX_CUBE_MAP_POSITIVE_X = 0x00; /// Cubemap +x. 408 enum ubyte BGFX_CUBE_MAP_NEGATIVE_X = 0x01; /// Cubemap -x. 409 enum ubyte BGFX_CUBE_MAP_POSITIVE_Y = 0x02; /// Cubemap +y. 410 enum ubyte BGFX_CUBE_MAP_NEGATIVE_Y = 0x03; /// Cubemap -y. 411 enum ubyte BGFX_CUBE_MAP_POSITIVE_Z = 0x04; /// Cubemap +z. 412 enum ubyte BGFX_CUBE_MAP_NEGATIVE_Z = 0x05; /// Cubemap -z. 413 414 /// Fatal error enum. 415 enum bgfx_fatal_t 416 { 417 BGFX_FATAL_DEBUGCHECK, 418 BGFX_FATAL_INVALIDSHADER, 419 BGFX_FATAL_UNABLETOINITIALIZE, 420 BGFX_FATAL_UNABLETOCREATETEXTURE, 421 BGFX_FATAL_DEVICELOST, 422 423 BGFX_FATAL_COUNT 424 } 425 426 /// Renderer backend type enum. 427 enum bgfx_renderer_type_t 428 { 429 BGFX_RENDERER_TYPE_NOOP, /// No rendering. 430 BGFX_RENDERER_TYPE_DIRECT3D9, /// Direct3D 9.0 431 BGFX_RENDERER_TYPE_DIRECT3D11, /// Direct3D 11.0 432 BGFX_RENDERER_TYPE_DIRECT3D12, /// Direct3D 12.0 433 BGFX_RENDERER_TYPE_GNM, /// GNM 434 BGFX_RENDERER_TYPE_METAL, /// Metal 435 BGFX_RENDERER_TYPE_NVN, /// NVN 436 BGFX_RENDERER_TYPE_OPENGLES, /// OpenGL ES 2.0+ 437 BGFX_RENDERER_TYPE_OPENGL, /// OpenGL 2.1+ 438 BGFX_RENDERER_TYPE_VULKAN, /// Vulkan 439 BGFX_RENDERER_TYPE_WEBGPU, /// WebGPU 440 441 BGFX_RENDERER_TYPE_COUNT 442 } 443 444 /// Access mode enum. 445 enum bgfx_access_t 446 { 447 BGFX_ACCESS_READ, /// Read. 448 BGFX_ACCESS_WRITE, /// Write. 449 BGFX_ACCESS_READWRITE, /// Read and write. 450 451 BGFX_ACCESS_COUNT 452 } 453 454 /// Vertex attribute enum. 455 enum bgfx_attrib_t 456 { 457 BGFX_ATTRIB_POSITION, /// a_position 458 BGFX_ATTRIB_NORMAL, /// a_normal 459 BGFX_ATTRIB_TANGENT, /// a_tangent 460 BGFX_ATTRIB_BITANGENT, /// a_bitangent 461 BGFX_ATTRIB_COLOR0, /// a_color0 462 BGFX_ATTRIB_COLOR1, /// a_color1 463 BGFX_ATTRIB_COLOR2, /// a_color2 464 BGFX_ATTRIB_COLOR3, /// a_color3 465 BGFX_ATTRIB_INDICES, /// a_indices 466 BGFX_ATTRIB_WEIGHT, /// a_weight 467 BGFX_ATTRIB_TEXCOORD0, /// a_texcoord0 468 BGFX_ATTRIB_TEXCOORD1, /// a_texcoord1 469 BGFX_ATTRIB_TEXCOORD2, /// a_texcoord2 470 BGFX_ATTRIB_TEXCOORD3, /// a_texcoord3 471 BGFX_ATTRIB_TEXCOORD4, /// a_texcoord4 472 BGFX_ATTRIB_TEXCOORD5, /// a_texcoord5 473 BGFX_ATTRIB_TEXCOORD6, /// a_texcoord6 474 BGFX_ATTRIB_TEXCOORD7, /// a_texcoord7 475 476 BGFX_ATTRIB_COUNT 477 } 478 479 /// Vertex attribute type enum. 480 enum bgfx_attrib_type_t 481 { 482 BGFX_ATTRIB_TYPE_UINT8, /// Uint8 483 BGFX_ATTRIB_TYPE_UINT10, /// Uint10, availability depends on: `BGFX_CAPS_VERTEX_ATTRIB_UINT10`. 484 BGFX_ATTRIB_TYPE_INT16, /// Int16 485 BGFX_ATTRIB_TYPE_HALF, /// Half, availability depends on: `BGFX_CAPS_VERTEX_ATTRIB_HALF`. 486 BGFX_ATTRIB_TYPE_FLOAT, /// Float 487 488 BGFX_ATTRIB_TYPE_COUNT 489 } 490 491 /** 492 * Texture format enum. 493 * Notation: 494 * RGBA16S 495 * ^ ^ ^ 496 * | | +-- [ ]Unorm 497 * | | [F]loat 498 * | | [S]norm 499 * | | [I]nt 500 * | | [U]int 501 * | +---- Number of bits per component 502 * +-------- Components 503 * @attention Availability depends on Caps (see: formats). 504 */ 505 enum bgfx_texture_format_t 506 { 507 BGFX_TEXTURE_FORMAT_BC1, /// DXT1 R5G6B5A1 508 BGFX_TEXTURE_FORMAT_BC2, /// DXT3 R5G6B5A4 509 BGFX_TEXTURE_FORMAT_BC3, /// DXT5 R5G6B5A8 510 BGFX_TEXTURE_FORMAT_BC4, /// LATC1/ATI1 R8 511 BGFX_TEXTURE_FORMAT_BC5, /// LATC2/ATI2 RG8 512 BGFX_TEXTURE_FORMAT_BC6H, /// BC6H RGB16F 513 BGFX_TEXTURE_FORMAT_BC7, /// BC7 RGB 4-7 bits per color channel, 0-8 bits alpha 514 BGFX_TEXTURE_FORMAT_ETC1, /// ETC1 RGB8 515 BGFX_TEXTURE_FORMAT_ETC2, /// ETC2 RGB8 516 BGFX_TEXTURE_FORMAT_ETC2A, /// ETC2 RGBA8 517 BGFX_TEXTURE_FORMAT_ETC2A1, /// ETC2 RGB8A1 518 BGFX_TEXTURE_FORMAT_PTC12, /// PVRTC1 RGB 2BPP 519 BGFX_TEXTURE_FORMAT_PTC14, /// PVRTC1 RGB 4BPP 520 BGFX_TEXTURE_FORMAT_PTC12A, /// PVRTC1 RGBA 2BPP 521 BGFX_TEXTURE_FORMAT_PTC14A, /// PVRTC1 RGBA 4BPP 522 BGFX_TEXTURE_FORMAT_PTC22, /// PVRTC2 RGBA 2BPP 523 BGFX_TEXTURE_FORMAT_PTC24, /// PVRTC2 RGBA 4BPP 524 BGFX_TEXTURE_FORMAT_ATC, /// ATC RGB 4BPP 525 BGFX_TEXTURE_FORMAT_ATCE, /// ATCE RGBA 8 BPP explicit alpha 526 BGFX_TEXTURE_FORMAT_ATCI, /// ATCI RGBA 8 BPP interpolated alpha 527 BGFX_TEXTURE_FORMAT_ASTC4X4, /// ASTC 4x4 8.0 BPP 528 BGFX_TEXTURE_FORMAT_ASTC5X5, /// ASTC 5x5 5.12 BPP 529 BGFX_TEXTURE_FORMAT_ASTC6X6, /// ASTC 6x6 3.56 BPP 530 BGFX_TEXTURE_FORMAT_ASTC8X5, /// ASTC 8x5 3.20 BPP 531 BGFX_TEXTURE_FORMAT_ASTC8X6, /// ASTC 8x6 2.67 BPP 532 BGFX_TEXTURE_FORMAT_ASTC10X5, /// ASTC 10x5 2.56 BPP 533 BGFX_TEXTURE_FORMAT_UNKNOWN, /// Compressed formats above. 534 BGFX_TEXTURE_FORMAT_R1, 535 BGFX_TEXTURE_FORMAT_A8, 536 BGFX_TEXTURE_FORMAT_R8, 537 BGFX_TEXTURE_FORMAT_R8I, 538 BGFX_TEXTURE_FORMAT_R8U, 539 BGFX_TEXTURE_FORMAT_R8S, 540 BGFX_TEXTURE_FORMAT_R16, 541 BGFX_TEXTURE_FORMAT_R16I, 542 BGFX_TEXTURE_FORMAT_R16U, 543 BGFX_TEXTURE_FORMAT_R16F, 544 BGFX_TEXTURE_FORMAT_R16S, 545 BGFX_TEXTURE_FORMAT_R32I, 546 BGFX_TEXTURE_FORMAT_R32U, 547 BGFX_TEXTURE_FORMAT_R32F, 548 BGFX_TEXTURE_FORMAT_RG8, 549 BGFX_TEXTURE_FORMAT_RG8I, 550 BGFX_TEXTURE_FORMAT_RG8U, 551 BGFX_TEXTURE_FORMAT_RG8S, 552 BGFX_TEXTURE_FORMAT_RG16, 553 BGFX_TEXTURE_FORMAT_RG16I, 554 BGFX_TEXTURE_FORMAT_RG16U, 555 BGFX_TEXTURE_FORMAT_RG16F, 556 BGFX_TEXTURE_FORMAT_RG16S, 557 BGFX_TEXTURE_FORMAT_RG32I, 558 BGFX_TEXTURE_FORMAT_RG32U, 559 BGFX_TEXTURE_FORMAT_RG32F, 560 BGFX_TEXTURE_FORMAT_RGB8, 561 BGFX_TEXTURE_FORMAT_RGB8I, 562 BGFX_TEXTURE_FORMAT_RGB8U, 563 BGFX_TEXTURE_FORMAT_RGB8S, 564 BGFX_TEXTURE_FORMAT_RGB9E5F, 565 BGFX_TEXTURE_FORMAT_BGRA8, 566 BGFX_TEXTURE_FORMAT_RGBA8, 567 BGFX_TEXTURE_FORMAT_RGBA8I, 568 BGFX_TEXTURE_FORMAT_RGBA8U, 569 BGFX_TEXTURE_FORMAT_RGBA8S, 570 BGFX_TEXTURE_FORMAT_RGBA16, 571 BGFX_TEXTURE_FORMAT_RGBA16I, 572 BGFX_TEXTURE_FORMAT_RGBA16U, 573 BGFX_TEXTURE_FORMAT_RGBA16F, 574 BGFX_TEXTURE_FORMAT_RGBA16S, 575 BGFX_TEXTURE_FORMAT_RGBA32I, 576 BGFX_TEXTURE_FORMAT_RGBA32U, 577 BGFX_TEXTURE_FORMAT_RGBA32F, 578 BGFX_TEXTURE_FORMAT_R5G6B5, 579 BGFX_TEXTURE_FORMAT_RGBA4, 580 BGFX_TEXTURE_FORMAT_RGB5A1, 581 BGFX_TEXTURE_FORMAT_RGB10A2, 582 BGFX_TEXTURE_FORMAT_RG11B10F, 583 BGFX_TEXTURE_FORMAT_UNKNOWNDEPTH, /// Depth formats below. 584 BGFX_TEXTURE_FORMAT_D16, 585 BGFX_TEXTURE_FORMAT_D24, 586 BGFX_TEXTURE_FORMAT_D24S8, 587 BGFX_TEXTURE_FORMAT_D32, 588 BGFX_TEXTURE_FORMAT_D16F, 589 BGFX_TEXTURE_FORMAT_D24F, 590 BGFX_TEXTURE_FORMAT_D32F, 591 BGFX_TEXTURE_FORMAT_D0S8, 592 593 BGFX_TEXTURE_FORMAT_COUNT 594 } 595 596 /// Uniform type enum. 597 enum bgfx_uniform_type_t 598 { 599 BGFX_UNIFORM_TYPE_SAMPLER, /// Sampler. 600 BGFX_UNIFORM_TYPE_END, /// Reserved, do not use. 601 BGFX_UNIFORM_TYPE_VEC4, /// 4 floats vector. 602 BGFX_UNIFORM_TYPE_MAT3, /// 3x3 matrix. 603 BGFX_UNIFORM_TYPE_MAT4, /// 4x4 matrix. 604 605 BGFX_UNIFORM_TYPE_COUNT 606 } 607 608 /// Backbuffer ratio enum. 609 enum bgfx_backbuffer_ratio_t 610 { 611 BGFX_BACKBUFFER_RATIO_EQUAL, /// Equal to backbuffer. 612 BGFX_BACKBUFFER_RATIO_HALF, /// One half size of backbuffer. 613 BGFX_BACKBUFFER_RATIO_QUARTER, /// One quarter size of backbuffer. 614 BGFX_BACKBUFFER_RATIO_EIGHTH, /// One eighth size of backbuffer. 615 BGFX_BACKBUFFER_RATIO_SIXTEENTH, /// One sixteenth size of backbuffer. 616 BGFX_BACKBUFFER_RATIO_DOUBLE, /// Double size of backbuffer. 617 618 BGFX_BACKBUFFER_RATIO_COUNT 619 } 620 621 /// Occlusion query result. 622 enum bgfx_occlusion_query_result_t 623 { 624 BGFX_OCCLUSION_QUERY_RESULT_INVISIBLE, /// Query failed test. 625 BGFX_OCCLUSION_QUERY_RESULT_VISIBLE, /// Query passed test. 626 BGFX_OCCLUSION_QUERY_RESULT_NORESULT, /// Query result is not available yet. 627 628 BGFX_OCCLUSION_QUERY_RESULT_COUNT 629 } 630 631 /// Primitive topology. 632 enum bgfx_topology_t 633 { 634 BGFX_TOPOLOGY_TRILIST, /// Triangle list. 635 BGFX_TOPOLOGY_TRISTRIP, /// Triangle strip. 636 BGFX_TOPOLOGY_LINELIST, /// Line list. 637 BGFX_TOPOLOGY_LINESTRIP, /// Line strip. 638 BGFX_TOPOLOGY_POINTLIST, /// Point list. 639 640 BGFX_TOPOLOGY_COUNT 641 } 642 643 /// Topology conversion function. 644 enum bgfx_topology_convert_t 645 { 646 BGFX_TOPOLOGY_CONVERT_TRILISTFLIPWINDING, /// Flip winding order of triangle list. 647 BGFX_TOPOLOGY_CONVERT_TRISTRIPFLIPWINDING, /// Flip winding order of triangle strip. 648 BGFX_TOPOLOGY_CONVERT_TRILISTTOLINELIST, /// Convert triangle list to line list. 649 BGFX_TOPOLOGY_CONVERT_TRISTRIPTOTRILIST, /// Convert triangle strip to triangle list. 650 BGFX_TOPOLOGY_CONVERT_LINESTRIPTOLINELIST, /// Convert line strip to line list. 651 652 BGFX_TOPOLOGY_CONVERT_COUNT 653 } 654 655 /// Topology sort order. 656 enum bgfx_topology_sort_t 657 { 658 BGFX_TOPOLOGY_SORT_DIRECTIONFRONTTOBACKMIN, 659 BGFX_TOPOLOGY_SORT_DIRECTIONFRONTTOBACKAVG, 660 BGFX_TOPOLOGY_SORT_DIRECTIONFRONTTOBACKMAX, 661 BGFX_TOPOLOGY_SORT_DIRECTIONBACKTOFRONTMIN, 662 BGFX_TOPOLOGY_SORT_DIRECTIONBACKTOFRONTAVG, 663 BGFX_TOPOLOGY_SORT_DIRECTIONBACKTOFRONTMAX, 664 BGFX_TOPOLOGY_SORT_DISTANCEFRONTTOBACKMIN, 665 BGFX_TOPOLOGY_SORT_DISTANCEFRONTTOBACKAVG, 666 BGFX_TOPOLOGY_SORT_DISTANCEFRONTTOBACKMAX, 667 BGFX_TOPOLOGY_SORT_DISTANCEBACKTOFRONTMIN, 668 BGFX_TOPOLOGY_SORT_DISTANCEBACKTOFRONTAVG, 669 BGFX_TOPOLOGY_SORT_DISTANCEBACKTOFRONTMAX, 670 671 BGFX_TOPOLOGY_SORT_COUNT 672 } 673 674 /// View mode sets draw call sort order. 675 enum bgfx_view_mode_t 676 { 677 BGFX_VIEW_MODE_DEFAULT, /// Default sort order. 678 BGFX_VIEW_MODE_SEQUENTIAL, /// Sort in the same order in which submit calls were called. 679 BGFX_VIEW_MODE_DEPTHASCENDING, /// Sort draw call depth in ascending order. 680 BGFX_VIEW_MODE_DEPTHDESCENDING, /// Sort draw call depth in descending order. 681 682 BGFX_VIEW_MODE_COUNT 683 } 684 685 /// Render frame enum. 686 enum bgfx_render_frame_t 687 { 688 BGFX_RENDER_FRAME_NOCONTEXT, /// Renderer context is not created yet. 689 BGFX_RENDER_FRAME_RENDER, /// Renderer context is created and rendering. 690 BGFX_RENDER_FRAME_TIMEOUT, /// Renderer context wait for main thread signal timed out without rendering. 691 BGFX_RENDER_FRAME_EXITING, /// Renderer context is getting destroyed. 692 693 BGFX_RENDER_FRAME_COUNT 694 } 695 696 /// GPU info. 697 struct bgfx_caps_gpu_t 698 { 699 ushort vendorId; /// Vendor PCI id. See `BGFX_PCI_ID_*`. 700 ushort deviceId; /// Device id. 701 } 702 703 /// Renderer runtime limits. 704 struct bgfx_caps_limits_t 705 { 706 uint maxDrawCalls; /// Maximum number of draw calls. 707 uint maxBlits; /// Maximum number of blit calls. 708 uint maxTextureSize; /// Maximum texture size. 709 uint maxTextureLayers; /// Maximum texture layers. 710 uint maxViews; /// Maximum number of views. 711 uint maxFrameBuffers; /// Maximum number of frame buffer handles. 712 uint maxFBAttachments; /// Maximum number of frame buffer attachments. 713 uint maxPrograms; /// Maximum number of program handles. 714 uint maxShaders; /// Maximum number of shader handles. 715 uint maxTextures; /// Maximum number of texture handles. 716 uint maxTextureSamplers; /// Maximum number of texture samplers. 717 uint maxComputeBindings; /// Maximum number of compute bindings. 718 uint maxVertexLayouts; /// Maximum number of vertex format layouts. 719 uint maxVertexStreams; /// Maximum number of vertex streams. 720 uint maxIndexBuffers; /// Maximum number of index buffer handles. 721 uint maxVertexBuffers; /// Maximum number of vertex buffer handles. 722 uint maxDynamicIndexBuffers; /// Maximum number of dynamic index buffer handles. 723 uint maxDynamicVertexBuffers; /// Maximum number of dynamic vertex buffer handles. 724 uint maxUniforms; /// Maximum number of uniform handles. 725 uint maxOcclusionQueries; /// Maximum number of occlusion query handles. 726 uint maxEncoders; /// Maximum number of encoder threads. 727 uint minResourceCbSize; /// Minimum resource command buffer size. 728 uint transientVbSize; /// Maximum transient vertex buffer size. 729 uint transientIbSize; /// Maximum transient index buffer size. 730 } 731 732 /// Renderer capabilities. 733 struct bgfx_caps_t 734 { 735 bgfx_renderer_type_t rendererType; /// Renderer backend type. See: `bgfx::RendererType` 736 737 /** 738 * Supported functionality. 739 * @attention See `BGFX_CAPS_*` flags at https://bkaradzic.github.io/bgfx/bgfx.html#available-caps 740 */ 741 ulong supported; 742 ushort vendorId; /// Selected GPU vendor PCI id. 743 ushort deviceId; /// Selected GPU device id. 744 bool homogeneousDepth; /// True when NDC depth is in [-1, 1] range, otherwise its [0, 1]. 745 bool originBottomLeft; /// True when NDC origin is at bottom left. 746 byte numGPUs; /// Number of enumerated GPUs. 747 bgfx_caps_gpu_t[4] gpu; /// Enumerated GPUs. 748 bgfx_caps_limits_t limits; /// Renderer runtime limits. 749 750 /** 751 * Supported texture format capabilities flags: 752 * - `BGFX_CAPS_FORMAT_TEXTURE_NONE` - Texture format is not supported. 753 * - `BGFX_CAPS_FORMAT_TEXTURE_2D` - Texture format is supported. 754 * - `BGFX_CAPS_FORMAT_TEXTURE_2D_SRGB` - Texture as sRGB format is supported. 755 * - `BGFX_CAPS_FORMAT_TEXTURE_2D_EMULATED` - Texture format is emulated. 756 * - `BGFX_CAPS_FORMAT_TEXTURE_3D` - Texture format is supported. 757 * - `BGFX_CAPS_FORMAT_TEXTURE_3D_SRGB` - Texture as sRGB format is supported. 758 * - `BGFX_CAPS_FORMAT_TEXTURE_3D_EMULATED` - Texture format is emulated. 759 * - `BGFX_CAPS_FORMAT_TEXTURE_CUBE` - Texture format is supported. 760 * - `BGFX_CAPS_FORMAT_TEXTURE_CUBE_SRGB` - Texture as sRGB format is supported. 761 * - `BGFX_CAPS_FORMAT_TEXTURE_CUBE_EMULATED` - Texture format is emulated. 762 * - `BGFX_CAPS_FORMAT_TEXTURE_VERTEX` - Texture format can be used from vertex shader. 763 * - `BGFX_CAPS_FORMAT_TEXTURE_IMAGE_READ` - Texture format can be used as image 764 * and read from. 765 * - `BGFX_CAPS_FORMAT_TEXTURE_IMAGE_WRITE` - Texture format can be used as image 766 * and written to. 767 * - `BGFX_CAPS_FORMAT_TEXTURE_FRAMEBUFFER` - Texture format can be used as frame 768 * buffer. 769 * - `BGFX_CAPS_FORMAT_TEXTURE_FRAMEBUFFER_MSAA` - Texture format can be used as MSAA 770 * frame buffer. 771 * - `BGFX_CAPS_FORMAT_TEXTURE_MSAA` - Texture can be sampled as MSAA. 772 * - `BGFX_CAPS_FORMAT_TEXTURE_MIP_AUTOGEN` - Texture format supports auto-generated 773 * mips. 774 */ 775 ushort[bgfx_texture_format_t.BGFX_TEXTURE_FORMAT_COUNT] formats; 776 } 777 778 /// Internal data. 779 struct bgfx_internal_data_t 780 { 781 const(bgfx_caps_t)* caps; /// Renderer capabilities. 782 void* context; /// GL context, or D3D device. 783 } 784 785 /// Platform data. 786 struct bgfx_platform_data_t 787 { 788 void* ndt; /// Native display type (*nix specific). 789 790 /** 791 * Native window handle. If `NULL` bgfx will create headless 792 * context/device if renderer API supports it. 793 */ 794 void* nwh; 795 void* context; /// GL context, or D3D device. If `NULL`, bgfx will create context/device. 796 797 /** 798 * GL back-buffer, or D3D render target view. If `NULL` bgfx will 799 * create back-buffer color surface. 800 */ 801 void* backBuffer; 802 803 /** 804 * Backbuffer depth/stencil. If `NULL` bgfx will create back-buffer 805 * depth/stencil surface. 806 */ 807 void* backBufferDS; 808 } 809 810 /// Backbuffer resolution and reset parameters. 811 struct bgfx_resolution_t 812 { 813 bgfx_texture_format_t format; /// Backbuffer format. 814 uint width; /// Backbuffer width. 815 uint height; /// Backbuffer height. 816 uint reset; /// Reset parameters. 817 byte numBackBuffers; /// Number of back buffers. 818 byte maxFrameLatency; /// Maximum frame latency. 819 } 820 821 /// Configurable runtime limits parameters. 822 struct bgfx_init_limits_t 823 { 824 ushort maxEncoders; /// Maximum number of encoder threads. 825 uint minResourceCbSize; /// Minimum resource command buffer size. 826 uint transientVbSize; /// Maximum transient vertex buffer size. 827 uint transientIbSize; /// Maximum transient index buffer size. 828 } 829 830 /// Initialization parameters used by `bgfx::init`. 831 struct bgfx_init_t 832 { 833 834 /** 835 * Select rendering backend. When set to RendererType::Count 836 * a default rendering backend will be selected appropriate to the platform. 837 * See: `bgfx::RendererType` 838 */ 839 bgfx_renderer_type_t type; 840 841 /** 842 * Vendor PCI id. If set to `BGFX_PCI_ID_NONE` it will select the first 843 * device. 844 * - `BGFX_PCI_ID_NONE` - Autoselect adapter. 845 * - `BGFX_PCI_ID_SOFTWARE_RASTERIZER` - Software rasterizer. 846 * - `BGFX_PCI_ID_AMD` - AMD adapter. 847 * - `BGFX_PCI_ID_INTEL` - Intel adapter. 848 * - `BGFX_PCI_ID_NVIDIA` - nVidia adapter. 849 */ 850 ushort vendorId; 851 852 /** 853 * Device id. If set to 0 it will select first device, or device with 854 * matching id. 855 */ 856 ushort deviceId; 857 ulong capabilities; /// Capabilities initialization mask (default: UINT64_MAX). 858 bool debug_; /// Enable device for debuging. 859 bool profile; /// Enable device for profiling. 860 bgfx_platform_data_t platformData; /// Platform data. 861 bgfx_resolution_t resolution; /// Backbuffer resolution and reset parameters. See: `bgfx::Resolution`. 862 bgfx_init_limits_t limits; /// Configurable runtime limits parameters. 863 864 /** 865 * Provide application specific callback interface. 866 * See: `bgfx::CallbackI` 867 */ 868 void* callback; 869 870 /** 871 * Custom allocator. When a custom allocator is not 872 * specified, bgfx uses the CRT allocator. Bgfx assumes 873 * custom allocator is thread safe. 874 */ 875 void* allocator; 876 } 877 878 /** 879 * Memory must be obtained by calling `bgfx::alloc`, `bgfx::copy`, or `bgfx::makeRef`. 880 * @attention It is illegal to create this structure on stack and pass it to any bgfx API. 881 */ 882 struct bgfx_memory_t 883 { 884 byte* data; /// Pointer to data. 885 uint size; /// Data size. 886 } 887 888 /// Transient index buffer. 889 struct bgfx_transient_index_buffer_t 890 { 891 byte* data; /// Pointer to data. 892 uint size; /// Data size. 893 uint startIndex; /// First index. 894 bgfx_index_buffer_handle_t handle; /// Index buffer handle. 895 bool isIndex16; /// Index buffer format is 16-bits if true, otherwise it is 32-bit. 896 } 897 898 /// Transient vertex buffer. 899 struct bgfx_transient_vertex_buffer_t 900 { 901 byte* data; /// Pointer to data. 902 uint size; /// Data size. 903 uint startVertex; /// First vertex. 904 ushort stride; /// Vertex stride. 905 bgfx_vertex_buffer_handle_t handle; /// Vertex buffer handle. 906 bgfx_vertex_layout_handle_t layoutHandle; /// Vertex layout handle. 907 } 908 909 /// Instance data buffer info. 910 struct bgfx_instance_data_buffer_t 911 { 912 byte* data; /// Pointer to data. 913 uint size; /// Data size. 914 uint offset; /// Offset in vertex buffer. 915 uint num; /// Number of instances. 916 ushort stride; /// Vertex buffer stride. 917 bgfx_vertex_buffer_handle_t handle; /// Vertex buffer object handle. 918 } 919 920 /// Texture info. 921 struct bgfx_texture_info_t 922 { 923 bgfx_texture_format_t format; /// Texture format. 924 uint storageSize; /// Total amount of bytes required to store texture. 925 ushort width; /// Texture width. 926 ushort height; /// Texture height. 927 ushort depth; /// Texture depth. 928 ushort numLayers; /// Number of layers in texture array. 929 byte numMips; /// Number of MIP maps. 930 byte bitsPerPixel; /// Format bits per pixel. 931 bool cubeMap; /// Texture is cubemap. 932 } 933 934 /// Uniform info. 935 struct bgfx_uniform_info_t 936 { 937 char[256] name; /// Uniform name. 938 bgfx_uniform_type_t type; /// Uniform type. 939 ushort num; /// Number of elements in array. 940 } 941 942 /// Frame buffer texture attachment info. 943 struct bgfx_attachment_t 944 { 945 bgfx_access_t access; /// Attachment access. See `Access::Enum`. 946 bgfx_texture_handle_t handle; /// Render target texture handle. 947 ushort mip; /// Mip level. 948 ushort layer; /// Cubemap side or depth layer/slice to use. 949 ushort numLayers; /// Number of texture layer/slice(s) in array to use. 950 byte resolve; /// Resolve flags. See: `BGFX_RESOLVE_*` 951 } 952 953 /// Transform data. 954 struct bgfx_transform_t 955 { 956 float* data; /// Pointer to first 4x4 matrix. 957 ushort num; /// Number of matrices. 958 } 959 960 /// View stats. 961 struct bgfx_view_stats_t 962 { 963 char[256] name; /// View name. 964 bgfx_view_id_t view; /// View id. 965 long cpuTimeBegin; /// CPU (submit) begin time. 966 long cpuTimeEnd; /// CPU (submit) end time. 967 long gpuTimeBegin; /// GPU begin time. 968 long gpuTimeEnd; /// GPU end time. 969 } 970 971 /// Encoder stats. 972 struct bgfx_encoder_stats_t 973 { 974 long cpuTimeBegin; /// Encoder thread CPU submit begin time. 975 long cpuTimeEnd; /// Encoder thread CPU submit end time. 976 } 977 978 /** 979 * Renderer statistics data. 980 * @remarks All time values are high-resolution timestamps, while 981 * time frequencies define timestamps-per-second for that hardware. 982 */ 983 struct bgfx_stats_t 984 { 985 long cpuTimeFrame; /// CPU time between two `bgfx::frame` calls. 986 long cpuTimeBegin; /// Render thread CPU submit begin time. 987 long cpuTimeEnd; /// Render thread CPU submit end time. 988 long cpuTimerFreq; /// CPU timer frequency. Timestamps-per-second 989 long gpuTimeBegin; /// GPU frame begin time. 990 long gpuTimeEnd; /// GPU frame end time. 991 long gpuTimerFreq; /// GPU timer frequency. 992 long waitRender; /// Time spent waiting for render backend thread to finish issuing draw commands to underlying graphics API. 993 long waitSubmit; /// Time spent waiting for submit thread to advance to next frame. 994 uint numDraw; /// Number of draw calls submitted. 995 uint numCompute; /// Number of compute calls submitted. 996 uint numBlit; /// Number of blit calls submitted. 997 uint maxGpuLatency; /// GPU driver latency. 998 ushort numDynamicIndexBuffers; /// Number of used dynamic index buffers. 999 ushort numDynamicVertexBuffers; /// Number of used dynamic vertex buffers. 1000 ushort numFrameBuffers; /// Number of used frame buffers. 1001 ushort numIndexBuffers; /// Number of used index buffers. 1002 ushort numOcclusionQueries; /// Number of used occlusion queries. 1003 ushort numPrograms; /// Number of used programs. 1004 ushort numShaders; /// Number of used shaders. 1005 ushort numTextures; /// Number of used textures. 1006 ushort numUniforms; /// Number of used uniforms. 1007 ushort numVertexBuffers; /// Number of used vertex buffers. 1008 ushort numVertexLayouts; /// Number of used vertex layouts. 1009 long textureMemoryUsed; /// Estimate of texture memory used. 1010 long rtMemoryUsed; /// Estimate of render target memory used. 1011 int transientVbUsed; /// Amount of transient vertex buffer used. 1012 int transientIbUsed; /// Amount of transient index buffer used. 1013 uint[bgfx_topology_t.BGFX_TOPOLOGY_COUNT] numPrims; /// Number of primitives rendered. 1014 long gpuMemoryMax; /// Maximum available GPU memory for application. 1015 long gpuMemoryUsed; /// Amount of GPU memory used by the application. 1016 ushort width; /// Backbuffer width in pixels. 1017 ushort height; /// Backbuffer height in pixels. 1018 ushort textWidth; /// Debug text width in characters. 1019 ushort textHeight; /// Debug text height in characters. 1020 ushort numViews; /// Number of view stats. 1021 bgfx_view_stats_t* viewStats; /// Array of View stats. 1022 byte numEncoders; /// Number of encoders used during frame. 1023 bgfx_encoder_stats_t* encoderStats; /// Array of encoder stats. 1024 } 1025 1026 /// Vertex layout. 1027 struct bgfx_vertex_layout_t 1028 { 1029 uint hash; /// Hash. 1030 ushort stride; /// Stride. 1031 ushort[bgfx_attrib_t.BGFX_ATTRIB_COUNT] offset; /// Attribute offsets. 1032 ushort[bgfx_attrib_t.BGFX_ATTRIB_COUNT] attributes; /// Used attributes. 1033 } 1034 1035 /** 1036 * Encoders are used for submitting draw calls from multiple threads. Only one encoder 1037 * per thread should be used. Use `bgfx::begin()` to obtain an encoder for a thread. 1038 */ 1039 struct bgfx_encoder_t 1040 { 1041 } 1042 1043 struct bgfx_dynamic_index_buffer_handle_t { ushort idx; } 1044 1045 struct bgfx_dynamic_vertex_buffer_handle_t { ushort idx; } 1046 1047 struct bgfx_frame_buffer_handle_t { ushort idx; } 1048 1049 struct bgfx_index_buffer_handle_t { ushort idx; } 1050 1051 struct bgfx_indirect_buffer_handle_t { ushort idx; } 1052 1053 struct bgfx_occlusion_query_handle_t { ushort idx; } 1054 1055 struct bgfx_program_handle_t { ushort idx; } 1056 1057 struct bgfx_shader_handle_t { ushort idx; } 1058 1059 struct bgfx_texture_handle_t { ushort idx; } 1060 1061 struct bgfx_uniform_handle_t { ushort idx; } 1062 1063 struct bgfx_vertex_buffer_handle_t { ushort idx; } 1064 1065 struct bgfx_vertex_layout_handle_t { ushort idx; } 1066