1 /* 2 * Copyright (c) 2014 Derelict Developers 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: 8 * 9 * * Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * 12 * * Redistributions in binary form must reproduce the above copyright 13 * notice, this list of conditions and the following disclaimer in the 14 * documentation and/or other materials provided with the distribution. 15 * 16 * * Neither the names 'Derelict', 'DerelictBgfx', nor the names of its contributors 17 * may be used to endorse or promote products derived from this software 18 * without specific prior written permission. 19 * 20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 22 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 23 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 24 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 25 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 26 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 27 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 28 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 29 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 30 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 */ 32 module derelict.bgfx.types; 33 34 import core.stdc.stdarg : va_list; 35 36 37 alias uint8_t = ubyte; 38 alias uint16_t = ushort; 39 alias uint32_t = uint; 40 alias uint64_t = ulong; 41 alias int8_t = byte; 42 alias int16_t = short; 43 alias int32_t = int; 44 alias int64_t = long; 45 alias uintptr_t = ulong; 46 47 // bgfxdefines.h 48 49 enum BGFX_API_VERSION = 13; 50 51 52 enum ulong BGFX_STATE_RGB_WRITE = 0x0000000000000001; 53 enum ulong BGFX_STATE_ALPHA_WRITE = 0x0000000000000002; 54 enum ulong BGFX_STATE_DEPTH_WRITE = 0x0000000000000004; 55 enum ulong BGFX_STATE_DEPTH_TEST_LESS = 0x0000000000000010; 56 enum ulong BGFX_STATE_DEPTH_TEST_LEQUAL = 0x0000000000000020; 57 enum ulong BGFX_STATE_DEPTH_TEST_EQUAL = 0x0000000000000030; 58 enum ulong BGFX_STATE_DEPTH_TEST_GEQUAL = 0x0000000000000040; 59 enum ulong BGFX_STATE_DEPTH_TEST_GREATER = 0x0000000000000050; 60 enum ulong BGFX_STATE_DEPTH_TEST_NOTEQUAL = 0x0000000000000060; 61 enum ulong BGFX_STATE_DEPTH_TEST_NEVER = 0x0000000000000070; 62 enum ulong BGFX_STATE_DEPTH_TEST_ALWAYS = 0x0000000000000080; 63 enum BGFX_STATE_DEPTH_TEST_SHIFT = 4; 64 enum ulong BGFX_STATE_DEPTH_TEST_MASK = 0x00000000000000f0; 65 enum ulong BGFX_STATE_BLEND_ZERO = 0x0000000000001000; 66 enum ulong BGFX_STATE_BLEND_ONE = 0x0000000000002000; 67 enum ulong BGFX_STATE_BLEND_SRC_COLOR = 0x0000000000003000; 68 enum ulong BGFX_STATE_BLEND_INV_SRC_COLOR = 0x0000000000004000; 69 enum ulong BGFX_STATE_BLEND_SRC_ALPHA = 0x0000000000005000; 70 enum ulong BGFX_STATE_BLEND_INV_SRC_ALPHA = 0x0000000000006000; 71 enum ulong BGFX_STATE_BLEND_DST_ALPHA = 0x0000000000007000; 72 enum ulong BGFX_STATE_BLEND_INV_DST_ALPHA = 0x0000000000008000; 73 enum ulong BGFX_STATE_BLEND_DST_COLOR = 0x0000000000009000; 74 enum ulong BGFX_STATE_BLEND_INV_DST_COLOR = 0x000000000000a000; 75 enum ulong BGFX_STATE_BLEND_SRC_ALPHA_SAT = 0x000000000000b000; 76 enum ulong BGFX_STATE_BLEND_FACTOR = 0x000000000000c000; 77 enum ulong BGFX_STATE_BLEND_INV_FACTOR = 0x000000000000d000; 78 enum BGFX_STATE_BLEND_SHIFT = 12; 79 enum ulong BGFX_STATE_BLEND_MASK = 0x000000000ffff000; 80 81 enum ulong BGFX_STATE_BLEND_EQUATION_ADD = 0x0000000000000000; 82 enum ulong BGFX_STATE_BLEND_EQUATION_SUB = 0x0000000010000000; 83 enum ulong BGFX_STATE_BLEND_EQUATION_REVSUB = 0x0000000020000000; 84 enum ulong BGFX_STATE_BLEND_EQUATION_MIN = 0x0000000030000000; 85 enum ulong BGFX_STATE_BLEND_EQUATION_MAX = 0x0000000040000000; 86 enum BGFX_STATE_BLEND_EQUATION_SHIFT = 28; 87 enum ulong BGFX_STATE_BLEND_EQUATION_MASK = 0x00000003f0000000; 88 89 enum ulong BGFX_STATE_BLEND_INDEPENDENT = 0x0000000400000000; 90 enum ulong BGFX_STATE_BLEND_ALPHA_TO_COVERAGE = 0x0000000800000000; 91 92 enum ulong BGFX_STATE_CULL_CW = 0x0000001000000000; 93 enum ulong BGFX_STATE_CULL_CCW = 0x0000002000000000; 94 enum BGFX_STATE_CULL_SHIFT = 36; 95 enum ulong BGFX_STATE_CULL_MASK = 0x0000003000000000; 96 97 enum BGFX_STATE_ALPHA_REF_SHIFT = 40; 98 enum ulong BGFX_STATE_ALPHA_REF_MASK = 0x0000ff0000000000; 99 100 enum ulong BGFX_STATE_PT_TRISTRIP = 0x0001000000000000; 101 enum ulong BGFX_STATE_PT_LINES = 0x0002000000000000; 102 enum ulong BGFX_STATE_PT_LINESTRIP = 0x0003000000000000; 103 enum ulong BGFX_STATE_PT_POINTS = 0x0004000000000000; 104 enum BGFX_STATE_PT_SHIFT = 48; 105 enum ulong BGFX_STATE_PT_MASK = 0x0007000000000000; 106 107 enum BGFX_STATE_POINT_SIZE_SHIFT = 52; 108 enum ulong BGFX_STATE_POINT_SIZE_MASK = 0x00f0000000000000; 109 110 enum ulong BGFX_STATE_MSAA = 0x0100000000000000; 111 enum ulong BGFX_STATE_LINEAA = 0x0200000000000000; 112 enum ulong BGFX_STATE_CONSERVATIVE_RASTER = 0x0400000000000000; 113 114 enum ulong BGFX_STATE_RESERVED_MASK = 0xe000000000000000; 115 116 enum ulong BGFX_STATE_NONE = 0x0000000000000000; 117 enum ulong BGFX_STATE_MASK = 0xffffffffffffffff; 118 enum ulong BGFX_STATE_DEFAULT = 0 119 | BGFX_STATE_RGB_WRITE 120 | BGFX_STATE_ALPHA_WRITE 121 | BGFX_STATE_DEPTH_TEST_LESS 122 | BGFX_STATE_DEPTH_WRITE 123 | BGFX_STATE_CULL_CW 124 | BGFX_STATE_MSAA; 125 126 ulong BGFX_STATE_ALPHA_REF(ulong _ref) pure nothrow 127 { 128 return (_ref << BGFX_STATE_ALPHA_REF_SHIFT) & BGFX_STATE_ALPHA_REF_MASK; 129 } 130 131 ulong BGFX_STATE_POINT_SIZE(ulong _size) pure nothrow 132 { 133 return (_size << BGFX_STATE_POINT_SIZE_SHIFT) & BGFX_STATE_POINT_SIZE_MASK; 134 } 135 136 ulong BGFX_STATE_BLEND_FUNC_SEPARATE(ulong _srcRGB, ulong _dstRGB, ulong _srcA, ulong _dstA) pure nothrow 137 { 138 return _srcRGB | (_dstRGB << 4) | (_srcA << 8) | (_dstA << 12); 139 } 140 141 ulong BGFX_STATE_BLEND_EQUATION_SEPARATE(ulong _rgb, ulong _a) pure nothrow 142 { 143 return _rgb | (_a << 3); 144 } 145 146 ulong BGFX_STATE_BLEND_FUNC(ulong _src, ulong _dst) pure nothrow 147 { 148 return BGFX_STATE_BLEND_FUNC_SEPARATE(_src, _dst, _src, _dst); 149 } 150 151 ulong BGFX_STATE_BLEND_EQUATION(ulong _equation) pure nothrow 152 { 153 return BGFX_STATE_BLEND_EQUATION_SEPARATE(_equation, _equation); 154 } 155 156 157 enum ulong BGFX_STATE_BLEND_ADD = BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_ONE, BGFX_STATE_BLEND_ONE ); 158 enum ulong BGFX_STATE_BLEND_ALPHA = BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_SRC_ALPHA, BGFX_STATE_BLEND_INV_SRC_ALPHA); 159 enum ulong BGFX_STATE_BLEND_DARKEN = BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_ONE, BGFX_STATE_BLEND_ONE ) | BGFX_STATE_BLEND_EQUATION(BGFX_STATE_BLEND_EQUATION_MIN); 160 enum ulong BGFX_STATE_BLEND_LIGHTEN = BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_ONE, BGFX_STATE_BLEND_ONE ) | BGFX_STATE_BLEND_EQUATION(BGFX_STATE_BLEND_EQUATION_MAX); 161 enum ulong BGFX_STATE_BLEND_MULTIPLY = BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_DST_COLOR, BGFX_STATE_BLEND_ZERO ); 162 enum ulong BGFX_STATE_BLEND_NORMAL = BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_ONE, BGFX_STATE_BLEND_INV_SRC_ALPHA); 163 enum ulong BGFX_STATE_BLEND_SCREEN = BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_ONE, BGFX_STATE_BLEND_INV_SRC_COLOR); 164 enum ulong BGFX_STATE_BLEND_LINEAR_BURN = BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_DST_COLOR, BGFX_STATE_BLEND_INV_DST_COLOR) | BGFX_STATE_BLEND_EQUATION(BGFX_STATE_BLEND_EQUATION_SUB); 165 166 167 uint BGFX_STATE_BLEND_FUNC_RT_x(uint _src, uint _dst) pure nothrow 168 { 169 return (_src >> BGFX_STATE_BLEND_SHIFT) | ((_dst >> BGFX_STATE_BLEND_SHIFT) << 4); 170 } 171 172 uint BGFX_STATE_BLEND_FUNC_RT_xE(uint _src, uint _dst, uint _equation) pure nothrow 173 { 174 return BGFX_STATE_BLEND_FUNC_RT_x(_src, _dst) | ((_equation >> BGFX_STATE_BLEND_EQUATION_SHIFT) << 8); 175 } 176 177 uint BGFX_STATE_BLEND_FUNC_RT_1(uint _src, uint _dst) pure nothrow 178 { 179 return BGFX_STATE_BLEND_FUNC_RT_x(_src, _dst) << 0; 180 } 181 182 uint BGFX_STATE_BLEND_FUNC_RT_2(uint _src, uint _dst) pure nothrow 183 { 184 return BGFX_STATE_BLEND_FUNC_RT_x(_src, _dst) << 11; 185 } 186 187 uint BGFX_STATE_BLEND_FUNC_RT_3(uint _src, uint _dst) pure nothrow 188 { 189 return BGFX_STATE_BLEND_FUNC_RT_x(_src, _dst) << 22; 190 } 191 192 uint BGFX_STATE_BLEND_FUNC_RT_1E(uint _src, uint _dst, uint _equation) pure nothrow 193 { 194 return BGFX_STATE_BLEND_FUNC_RT_xE(_src, _dst, _equation) << 0; 195 } 196 197 uint BGFX_STATE_BLEND_FUNC_RT_2E(uint _src, uint _dst, uint _equation) pure nothrow 198 { 199 return BGFX_STATE_BLEND_FUNC_RT_xE(_src, _dst, _equation) << 11; 200 } 201 202 uint BGFX_STATE_BLEND_FUNC_RT_3E(uint _src, uint _dst, uint _equation) pure nothrow 203 { 204 return BGFX_STATE_BLEND_FUNC_RT_xE(_src, _dst, _equation) << 22; 205 } 206 207 /// 208 enum BGFX_STENCIL_FUNC_REF_SHIFT = 0; 209 enum uint BGFX_STENCIL_FUNC_REF_MASK = 0x000000ff; 210 enum BGFX_STENCIL_FUNC_RMASK_SHIFT = 8; 211 enum uint BGFX_STENCIL_FUNC_RMASK_MASK = 0x0000ff00; 212 213 enum uint BGFX_STENCIL_TEST_LESS = 0x00010000; 214 enum uint BGFX_STENCIL_TEST_LEQUAL = 0x00020000; 215 enum uint BGFX_STENCIL_TEST_EQUAL = 0x00030000; 216 enum uint BGFX_STENCIL_TEST_GEQUAL = 0x00040000; 217 enum uint BGFX_STENCIL_TEST_GREATER = 0x00050000; 218 enum uint BGFX_STENCIL_TEST_NOTEQUAL = 0x00060000; 219 enum uint BGFX_STENCIL_TEST_NEVER = 0x00070000; 220 enum uint BGFX_STENCIL_TEST_ALWAYS = 0x00080000; 221 enum BGFX_STENCIL_TEST_SHIFT = 16; 222 enum uint BGFX_STENCIL_TEST_MASK = 0x000f0000; 223 224 enum uint BGFX_STENCIL_OP_FAIL_S_ZERO = 0x00000000; 225 enum uint BGFX_STENCIL_OP_FAIL_S_KEEP = 0x00100000; 226 enum uint BGFX_STENCIL_OP_FAIL_S_REPLACE = 0x00200000; 227 enum uint BGFX_STENCIL_OP_FAIL_S_INCR = 0x00300000; 228 enum uint BGFX_STENCIL_OP_FAIL_S_INCRSAT = 0x00400000; 229 enum uint BGFX_STENCIL_OP_FAIL_S_DECR = 0x00500000; 230 enum uint BGFX_STENCIL_OP_FAIL_S_DECRSAT = 0x00600000; 231 enum uint BGFX_STENCIL_OP_FAIL_S_INVERT = 0x00700000; 232 enum BGFX_STENCIL_OP_FAIL_S_SHIFT = 20; 233 enum uint BGFX_STENCIL_OP_FAIL_S_MASK = 0x00f00000; 234 235 enum uint BGFX_STENCIL_OP_FAIL_Z_ZERO = 0x00000000; 236 enum uint BGFX_STENCIL_OP_FAIL_Z_KEEP = 0x01000000; 237 enum uint BGFX_STENCIL_OP_FAIL_Z_REPLACE = 0x02000000; 238 enum uint BGFX_STENCIL_OP_FAIL_Z_INCR = 0x03000000; 239 enum uint BGFX_STENCIL_OP_FAIL_Z_INCRSAT = 0x04000000; 240 enum uint BGFX_STENCIL_OP_FAIL_Z_DECR = 0x05000000; 241 enum uint BGFX_STENCIL_OP_FAIL_Z_DECRSAT = 0x06000000; 242 enum uint BGFX_STENCIL_OP_FAIL_Z_INVERT = 0x07000000; 243 enum BGFX_STENCIL_OP_FAIL_Z_SHIFT = 24; 244 enum uint BGFX_STENCIL_OP_FAIL_Z_MASK = 0x0f000000; 245 246 enum uint BGFX_STENCIL_OP_PASS_Z_ZERO = 0x00000000; 247 enum uint BGFX_STENCIL_OP_PASS_Z_KEEP = 0x10000000; 248 enum uint BGFX_STENCIL_OP_PASS_Z_REPLACE = 0x20000000; 249 enum uint BGFX_STENCIL_OP_PASS_Z_INCR = 0x30000000; 250 enum uint BGFX_STENCIL_OP_PASS_Z_INCRSAT = 0x40000000; 251 enum uint BGFX_STENCIL_OP_PASS_Z_DECR = 0x50000000; 252 enum uint BGFX_STENCIL_OP_PASS_Z_DECRSAT = 0x60000000; 253 enum uint BGFX_STENCIL_OP_PASS_Z_INVERT = 0x70000000; 254 enum BGFX_STENCIL_OP_PASS_Z_SHIFT = 28; 255 enum uint BGFX_STENCIL_OP_PASS_Z_MASK = 0xf0000000; 256 257 enum uint BGFX_STENCIL_NONE = 0x00000000; 258 enum uint BGFX_STENCIL_MASK = 0xffffffff; 259 enum uint BGFX_STENCIL_DEFAULT = 0x00000000; 260 261 uint BGFX_STENCIL_FUNC_REF(uint _ref) pure nothrow 262 { 263 return (_ref << BGFX_STENCIL_FUNC_REF_SHIFT) & BGFX_STENCIL_FUNC_REF_MASK; 264 } 265 266 uint BGFX_STENCIL_FUNC_RMASK(uint _mask) pure nothrow 267 { 268 return (_mask << BGFX_STENCIL_FUNC_RMASK_SHIFT) & BGFX_STENCIL_FUNC_RMASK_MASK; 269 } 270 271 272 enum ushort BGFX_CLEAR_NONE = 0x0000; //!< No clear flags. 273 enum ushort BGFX_CLEAR_COLOR = 0x0001; //!< Clear color. 274 enum ushort BGFX_CLEAR_DEPTH = 0x0002; //!< Clear depth. 275 enum ushort BGFX_CLEAR_STENCIL = 0x0004; //!< Clear stencil. 276 enum ushort BGFX_CLEAR_DISCARD_COLOR_0 = 0x0008; //!< Discard frame buffer attachment 0. 277 enum ushort BGFX_CLEAR_DISCARD_COLOR_1 = 0x0010; //!< Discard frame buffer attachment 1. 278 enum ushort BGFX_CLEAR_DISCARD_COLOR_2 = 0x0020; //!< Discard frame buffer attachment 2. 279 enum ushort BGFX_CLEAR_DISCARD_COLOR_3 = 0x0040; //!< Discard frame buffer attachment 3. 280 enum ushort BGFX_CLEAR_DISCARD_COLOR_4 = 0x0080; //!< Discard frame buffer attachment 4. 281 enum ushort BGFX_CLEAR_DISCARD_COLOR_5 = 0x0100; //!< Discard frame buffer attachment 5. 282 enum ushort BGFX_CLEAR_DISCARD_COLOR_6 = 0x0200; //!< Discard frame buffer attachment 6. 283 enum ushort BGFX_CLEAR_DISCARD_COLOR_7 = 0x0400; //!< Discard frame buffer attachment 7. 284 enum ushort BGFX_CLEAR_DISCARD_DEPTH = 0x0800; //!< Discard frame buffer depth attachment. 285 enum ushort BGFX_CLEAR_DISCARD_STENCIL = 0x1000; //!< Discard frame buffer stencil attachment. 286 287 enum ushort BGFX_CLEAR_DISCARD_COLOR_MASK = 0 288 | BGFX_CLEAR_DISCARD_COLOR_0 289 | BGFX_CLEAR_DISCARD_COLOR_1 290 | BGFX_CLEAR_DISCARD_COLOR_2 291 | BGFX_CLEAR_DISCARD_COLOR_3 292 | BGFX_CLEAR_DISCARD_COLOR_4 293 | BGFX_CLEAR_DISCARD_COLOR_5 294 | BGFX_CLEAR_DISCARD_COLOR_6 295 | BGFX_CLEAR_DISCARD_COLOR_7; 296 297 enum ushort BGFX_CLEAR_DISCARD_MASK = 0 298 | BGFX_CLEAR_DISCARD_COLOR_MASK 299 | BGFX_CLEAR_DISCARD_DEPTH 300 | BGFX_CLEAR_DISCARD_STENCIL; 301 302 enum uint BGFX_DEBUG_NONE = 0x00000000; 303 enum uint BGFX_DEBUG_WIREFRAME = 0x00000001; 304 enum uint BGFX_DEBUG_IFH = 0x00000002; 305 enum uint BGFX_DEBUG_STATS = 0x00000004; 306 enum uint BGFX_DEBUG_TEXT = 0x00000008; 307 308 /// 309 enum ushort BGFX_BUFFER_NONE = 0x0000; //!< 310 311 enum ushort BGFX_BUFFER_COMPUTE_FORMAT_8x1 = 0x0001; //!< 312 enum ushort BGFX_BUFFER_COMPUTE_FORMAT_8x2 = 0x0002; //!< 313 enum ushort BGFX_BUFFER_COMPUTE_FORMAT_8x4 = 0x0003; //!< 314 enum ushort BGFX_BUFFER_COMPUTE_FORMAT_16x1 = 0x0004; //!< 315 enum ushort BGFX_BUFFER_COMPUTE_FORMAT_16x2 = 0x0005; //!< 316 enum ushort BGFX_BUFFER_COMPUTE_FORMAT_16x4 = 0x0006; //!< 317 enum ushort BGFX_BUFFER_COMPUTE_FORMAT_32x1 = 0x0007; //!< 318 enum ushort BGFX_BUFFER_COMPUTE_FORMAT_32x2 = 0x0008; //!< 319 enum ushort BGFX_BUFFER_COMPUTE_FORMAT_32x4 = 0x0009; //!< 320 enum BGFX_BUFFER_COMPUTE_FORMAT_SHIFT = 0; //!< 321 enum ushort BGFX_BUFFER_COMPUTE_FORMAT_MASK = 0x000f; //!< 322 323 enum ushort BGFX_BUFFER_COMPUTE_TYPE_UINT = 0x0010; //!< 324 enum ushort BGFX_BUFFER_COMPUTE_TYPE_INT = 0x0020; //!< 325 enum ushort BGFX_BUFFER_COMPUTE_TYPE_FLOAT = 0x0030; //!< 326 enum BGFX_BUFFER_COMPUTE_TYPE_SHIFT = 4; //!< 327 enum ushort BGFX_BUFFER_COMPUTE_TYPE_MASK = 0x0030; //!< 328 329 enum ushort BGFX_BUFFER_COMPUTE_READ = 0x0100; //!< 330 enum ushort BGFX_BUFFER_COMPUTE_WRITE = 0x0200; //!< 331 enum ushort BGFX_BUFFER_DRAW_INDIRECT = 0x0400; //!< 332 enum ushort BGFX_BUFFER_ALLOW_RESIZE = 0x0800; //!< 333 enum ushort BGFX_BUFFER_INDEX32 = 0x1000; //!< 334 335 enum ushort BGFX_BUFFER_COMPUTE_READ_WRITE = 0 336 | BGFX_BUFFER_COMPUTE_READ 337 | BGFX_BUFFER_COMPUTE_WRITE; 338 339 340 /// 341 enum uint BGFX_TEXTURE_NONE = 0x00000000; 342 enum uint BGFX_TEXTURE_U_MIRROR = 0x00000001; 343 enum uint BGFX_TEXTURE_U_CLAMP = 0x00000002; 344 enum uint BGFX_TEXTURE_U_BORDER = 0x00000003; 345 enum BGFX_TEXTURE_U_SHIFT = 0; 346 enum uint BGFX_TEXTURE_U_MASK = 0x00000003; 347 enum uint BGFX_TEXTURE_V_MIRROR = 0x00000004; 348 enum uint BGFX_TEXTURE_V_CLAMP = 0x00000008; 349 enum uint BGFX_TEXTURE_V_BORDER = 0x0000000c; 350 enum BGFX_TEXTURE_V_SHIFT = 2; 351 enum uint BGFX_TEXTURE_V_MASK = 0x0000000c; 352 enum uint BGFX_TEXTURE_W_MIRROR = 0x00000010; 353 enum uint BGFX_TEXTURE_W_CLAMP = 0x00000020; 354 enum uint BGFX_TEXTURE_W_BORDER = 0x00000030; 355 enum BGFX_TEXTURE_W_SHIFT = 4; 356 enum uint BGFX_TEXTURE_W_MASK = 0x00000030; 357 enum uint BGFX_TEXTURE_MIN_POINT = 0x00000040; 358 enum uint BGFX_TEXTURE_MIN_ANISOTROPIC = 0x00000080; 359 enum BGFX_TEXTURE_MIN_SHIFT = 6; 360 enum uint BGFX_TEXTURE_MIN_MASK = 0x000000c0; 361 enum uint BGFX_TEXTURE_MAG_POINT = 0x00000100; 362 enum uint BGFX_TEXTURE_MAG_ANISOTROPIC = 0x00000200; 363 enum BGFX_TEXTURE_MAG_SHIFT = 8; 364 enum uint BGFX_TEXTURE_MAG_MASK = 0x00000300; 365 enum uint BGFX_TEXTURE_MIP_POINT = 0x00000400; 366 enum BGFX_TEXTURE_MIP_SHIFT = 10; 367 enum uint BGFX_TEXTURE_MIP_MASK = 0x00000400; 368 enum uint BGFX_TEXTURE_RT = 0x00001000; 369 enum uint BGFX_TEXTURE_RT_MSAA_X2 = 0x00002000; 370 enum uint BGFX_TEXTURE_RT_MSAA_X4 = 0x00003000; 371 enum uint BGFX_TEXTURE_RT_MSAA_X8 = 0x00004000; 372 enum uint BGFX_TEXTURE_RT_MSAA_X16 = 0x00005000; 373 enum BGFX_TEXTURE_RT_MSAA_SHIFT = 12; 374 enum uint BGFX_TEXTURE_RT_MSAA_MASK = 0x00007000; 375 enum uint BGFX_TEXTURE_RT_WRITE_ONLY = 0x00008000; 376 enum uint BGFX_TEXTURE_RT_MASK = 0x0000f000; 377 enum uint BGFX_TEXTURE_COMPARE_LESS = 0x00010000; 378 enum uint BGFX_TEXTURE_COMPARE_LEQUAL = 0x00020000; 379 enum uint BGFX_TEXTURE_COMPARE_EQUAL = 0x00030000; 380 enum uint BGFX_TEXTURE_COMPARE_GEQUAL = 0x00040000; 381 enum uint BGFX_TEXTURE_COMPARE_GREATER = 0x00050000; 382 enum uint BGFX_TEXTURE_COMPARE_NOTEQUAL = 0x00060000; 383 enum uint BGFX_TEXTURE_COMPARE_NEVER = 0x00070000; 384 enum uint BGFX_TEXTURE_COMPARE_ALWAYS = 0x00080000; 385 enum BGFX_TEXTURE_COMPARE_SHIFT = 16; 386 enum uint BGFX_TEXTURE_COMPARE_MASK = 0x000f0000; 387 enum uint BGFX_TEXTURE_COMPUTE_WRITE = 0x00100000; 388 enum uint BGFX_TEXTURE_SRGB = 0x00200000; 389 enum uint BGFX_TEXTURE_BLIT_DST = 0x00400000; 390 enum uint BGFX_TEXTURE_READ_BACK = 0x00800000; 391 enum BGFX_TEXTURE_BORDER_COLOR_SHIFT = 24; 392 enum uint BGFX_TEXTURE_BORDER_COLOR_MASK = 0x0f000000; 393 enum BGFX_TEXTURE_RESERVED_SHIFT = 28; 394 enum uint BGFX_TEXTURE_RESERVED_MASK = 0xf0000000; 395 396 enum uint BGFX_TEXTURE_BORDER_COLOR(uint _index) 397 { 398 return (_index << BGFX_TEXTURE_BORDER_COLOR_SHIFT) & BGFX_TEXTURE_BORDER_COLOR_MASK; 399 } 400 401 enum uint BGFX_TEXTURE_SAMPLER_BITS_MASK = 0 402 | BGFX_TEXTURE_U_MASK 403 | BGFX_TEXTURE_V_MASK 404 | BGFX_TEXTURE_W_MASK 405 | BGFX_TEXTURE_MIN_MASK 406 | BGFX_TEXTURE_MAG_MASK 407 | BGFX_TEXTURE_MIP_MASK 408 | BGFX_TEXTURE_COMPARE_MASK; 409 410 enum uint BGFX_RESET_NONE = 0x00000000; 411 enum uint BGFX_RESET_FULLSCREEN = 0x00000001; 412 enum BGFX_RESET_FULLSCREEN_SHIFT = 0; 413 enum uint BGFX_RESET_FULLSCREEN_MASK = 0x00000001; 414 enum uint BGFX_RESET_MSAA_X2 = 0x00000010; 415 enum uint BGFX_RESET_MSAA_X4 = 0x00000020; 416 enum uint BGFX_RESET_MSAA_X8 = 0x00000030; 417 enum uint BGFX_RESET_MSAA_X16 = 0x00000040; 418 enum BGFX_RESET_MSAA_SHIFT = 4; 419 enum uint BGFX_RESET_MSAA_MASK = 0x00000070; 420 enum uint BGFX_RESET_VSYNC = 0x00000080; 421 enum uint BGFX_RESET_MAXANISOTROPY = 0x00000100; 422 enum uint BGFX_RESET_CAPTURE = 0x00000200; 423 enum uint BGFX_RESET_HMD = 0x00000400; 424 enum uint BGFX_RESET_HMD_DEBUG = 0x00000800; 425 enum uint BGFX_RESET_HMD_RECENTER = 0x00001000; 426 enum uint BGFX_RESET_FLUSH_AFTER_RENDER = 0x00002000; 427 enum uint BGFX_RESET_FLIP_AFTER_RENDER = 0x00004000; 428 enum uint BGFX_RESET_SRGB_BACKBUFFER = 0x00008000; 429 enum uint BGFX_RESET_HIDPI = 0x00010000; 430 enum uint BGFX_RESET_DEPTH_CLAMP = 0x00020000; 431 enum uint BGFX_RESET_SUSPEND = 0x00040000; 432 433 enum BGFX_RESET_RESERVED_SHIFT = 31; 434 enum uint BGFX_RESET_RESERVED_MASK = 0x80000000; 435 436 /// 437 enum ulong BGFX_CAPS_TEXTURE_COMPARE_LEQUAL = 0x0000000000000001; 438 enum ulong BGFX_CAPS_TEXTURE_COMPARE_ALL = 0x0000000000000003; 439 enum ulong BGFX_CAPS_TEXTURE_3D = 0x0000000000000004; 440 enum ulong BGFX_CAPS_VERTEX_ATTRIB_HALF = 0x0000000000000008; 441 enum ulong BGFX_CAPS_VERTEX_ATTRIB_UINT10 = 0x0000000000000010; 442 enum ulong BGFX_CAPS_INSTANCING = 0x0000000000000020; 443 enum ulong BGFX_CAPS_RENDERER_MULTITHREADED = 0x0000000000000040; 444 enum ulong BGFX_CAPS_FRAGMENT_DEPTH = 0x0000000000000080; 445 enum ulong BGFX_CAPS_BLEND_INDEPENDENT = 0x0000000000000100; 446 enum ulong BGFX_CAPS_COMPUTE = 0x0000000000000200; 447 enum ulong BGFX_CAPS_FRAGMENT_ORDERING = 0x0000000000000400; 448 enum ulong BGFX_CAPS_SWAP_CHAIN = 0x0000000000000800; 449 enum ulong BGFX_CAPS_HMD = 0x0000000000001000; 450 enum ulong BGFX_CAPS_INDEX32 = 0x0000000000002000; 451 enum ulong BGFX_CAPS_DRAW_INDIRECT = 0x0000000000004000; 452 enum ulong BGFX_CAPS_HIDPI = 0x0000000000008000; 453 enum ulong BGFX_CAPS_TEXTURE_BLIT = 0x0000000000010000; 454 enum ulong BGFX_CAPS_TEXTURE_READ_BACK = 0x0000000000020000; 455 enum ulong BGFX_CAPS_OCCLUSION_QUERY = 0x0000000000040000; 456 enum ulong BGFX_CAPS_ALPHA_TO_COVERAGE = 0x0000000000080000; 457 enum ulong BGFX_CAPS_CONSERVATIVE_RASTER = 0x0000000000100000; 458 459 /// 460 enum ushort BGFX_CAPS_FORMAT_TEXTURE_NONE = 0x0000; 461 enum ushort BGFX_CAPS_FORMAT_TEXTURE_2D = 0x0001; 462 enum ushort BGFX_CAPS_FORMAT_TEXTURE_2D_SRGB = 0x0002; 463 enum ushort BGFX_CAPS_FORMAT_TEXTURE_2D_EMULATED = 0x0004; 464 enum ushort BGFX_CAPS_FORMAT_TEXTURE_3D = 0x0008; 465 enum ushort BGFX_CAPS_FORMAT_TEXTURE_3D_SRGB = 0x0010; 466 enum ushort BGFX_CAPS_FORMAT_TEXTURE_3D_EMULATED = 0x0020; 467 enum ushort BGFX_CAPS_FORMAT_TEXTURE_CUBE = 0x0040; 468 enum ushort BGFX_CAPS_FORMAT_TEXTURE_CUBE_SRGB = 0x0080; 469 enum ushort BGFX_CAPS_FORMAT_TEXTURE_CUBE_EMULATED = 0x0100; 470 enum ushort BGFX_CAPS_FORMAT_TEXTURE_VERTEX = 0x0200; 471 enum ushort BGFX_CAPS_FORMAT_TEXTURE_IMAGE = 0x0400; 472 enum ushort BGFX_CAPS_FORMAT_TEXTURE_FRAMEBUFFER = 0x0800; 473 enum ushort BGFX_CAPS_FORMAT_TEXTURE_FRAMEBUFFER_MSAA = 0x1000; 474 enum ushort BGFX_CAPS_FORMAT_TEXTURE_MSAA = 0x2000; 475 476 /// 477 enum ubyte BGFX_VIEW_NONE = 0x00; 478 enum ubyte BGFX_VIEW_STEREO = 0x01; 479 480 /// 481 enum ubyte BGFX_SUBMIT_EYE_LEFT = 0x01; //!< 482 enum ubyte BGFX_SUBMIT_EYE_RIGHT = 0x02; //!< 483 enum ubyte BGFX_SUBMIT_EYE_MASK = 0x03; //!< 484 enum ubyte BGFX_SUBMIT_EYE_FIRST = BGFX_SUBMIT_EYE_LEFT; 485 486 enum BGFX_SUBMIT_RESERVED_SHIFT = 7; 487 enum ubyte BGFX_SUBMIT_RESERVED_MASK = 0x80; 488 489 /// 490 enum ushort BGFX_PCI_ID_NONE = 0x0000; //!< Autoselect adapter. 491 enum ushort BGFX_PCI_ID_SOFTWARE_RASTERIZER = 0x0001; //!< Software rasterizer. 492 enum ushort BGFX_PCI_ID_AMD = 0x1002; //!< AMD adapter. 493 enum ushort BGFX_PCI_ID_INTEL = 0x8086; //!< Intel adapter. 494 enum ushort BGFX_PCI_ID_NVIDIA = 0x10de; //!< nVidia adapter. 495 496 /// 497 enum ubyte BGFX_HMD_NONE = 0x00; //!< None. 498 enum ubyte BGFX_HMD_DEVICE_RESOLUTION = 0x01; //!< Has HMD native resolution. 499 enum ubyte BGFX_HMD_RENDERING = 0x02; //!< Rendering to HMD. 500 501 /// 502 enum ubyte BGFX_CUBE_MAP_POSITIVE_X = 0x00; 503 enum ubyte BGFX_CUBE_MAP_NEGATIVE_X = 0x01; 504 enum ubyte BGFX_CUBE_MAP_POSITIVE_Y = 0x02; 505 enum ubyte BGFX_CUBE_MAP_NEGATIVE_Y = 0x03; 506 enum ubyte BGFX_CUBE_MAP_POSITIVE_Z = 0x04; 507 enum ubyte BGFX_CUBE_MAP_NEGATIVE_Z = 0x05; 508 509 // bgfx.c99.h 510 511 alias bgfx_renderer_type_t = int; 512 enum : bgfx_renderer_type_t 513 { 514 BGFX_RENDERER_TYPE_NULL, 515 BGFX_RENDERER_TYPE_DIRECT3D9, 516 BGFX_RENDERER_TYPE_DIRECT3D11, 517 BGFX_RENDERER_TYPE_DIRECT3D12, 518 BGFX_RENDERER_TYPE_METAL, 519 BGFX_RENDERER_TYPE_OPENGLES, 520 BGFX_RENDERER_TYPE_OPENGL, 521 BGFX_RENDERER_TYPE_VULKAN, 522 523 BGFX_RENDERER_TYPE_COUNT 524 525 } 526 527 alias bgfx_access_t = int; 528 enum : bgfx_access_t 529 { 530 BGFX_ACCESS_READ, 531 BGFX_ACCESS_WRITE, 532 BGFX_ACCESS_READWRITE, 533 534 BGFX_ACCESS_COUNT 535 536 } 537 538 alias bgfx_attrib_t = int; 539 enum : bgfx_attrib_t 540 { 541 BGFX_ATTRIB_POSITION, 542 BGFX_ATTRIB_NORMAL, 543 BGFX_ATTRIB_TANGENT, 544 BGFX_ATTRIB_BITANGENT, 545 BGFX_ATTRIB_COLOR0, 546 BGFX_ATTRIB_COLOR1, 547 BGFX_ATTRIB_INDICES, 548 BGFX_ATTRIB_WEIGHT, 549 BGFX_ATTRIB_TEXCOORD0, 550 BGFX_ATTRIB_TEXCOORD1, 551 BGFX_ATTRIB_TEXCOORD2, 552 BGFX_ATTRIB_TEXCOORD3, 553 BGFX_ATTRIB_TEXCOORD4, 554 BGFX_ATTRIB_TEXCOORD5, 555 BGFX_ATTRIB_TEXCOORD6, 556 BGFX_ATTRIB_TEXCOORD7, 557 558 BGFX_ATTRIB_COUNT 559 560 } 561 562 alias bgfx_attrib_type_t = int; 563 enum : bgfx_attrib_type_t 564 { 565 BGFX_ATTRIB_TYPE_UINT8, 566 BGFX_ATTRIB_TYPE_UINT10, 567 BGFX_ATTRIB_TYPE_INT16, 568 BGFX_ATTRIB_TYPE_HALF, 569 BGFX_ATTRIB_TYPE_FLOAT, 570 571 BGFX_ATTRIB_TYPE_COUNT 572 573 } 574 575 alias bgfx_texture_format_t = int; 576 enum : bgfx_texture_format_t 577 { 578 BGFX_TEXTURE_FORMAT_BC1, 579 BGFX_TEXTURE_FORMAT_BC2, 580 BGFX_TEXTURE_FORMAT_BC3, 581 BGFX_TEXTURE_FORMAT_BC4, 582 BGFX_TEXTURE_FORMAT_BC5, 583 BGFX_TEXTURE_FORMAT_BC6H, 584 BGFX_TEXTURE_FORMAT_BC7, 585 BGFX_TEXTURE_FORMAT_ETC1, 586 BGFX_TEXTURE_FORMAT_ETC2, 587 BGFX_TEXTURE_FORMAT_ETC2A, 588 BGFX_TEXTURE_FORMAT_ETC2A1, 589 BGFX_TEXTURE_FORMAT_PTC12, 590 BGFX_TEXTURE_FORMAT_PTC14, 591 BGFX_TEXTURE_FORMAT_PTC12A, 592 BGFX_TEXTURE_FORMAT_PTC14A, 593 BGFX_TEXTURE_FORMAT_PTC22, 594 BGFX_TEXTURE_FORMAT_PTC24, 595 596 BGFX_TEXTURE_FORMAT_UNKNOWN, 597 598 BGFX_TEXTURE_FORMAT_R1, 599 BGFX_TEXTURE_FORMAT_A8, 600 BGFX_TEXTURE_FORMAT_R8, 601 BGFX_TEXTURE_FORMAT_R8I, 602 BGFX_TEXTURE_FORMAT_R8U, 603 BGFX_TEXTURE_FORMAT_R8S, 604 BGFX_TEXTURE_FORMAT_R16, 605 BGFX_TEXTURE_FORMAT_R16I, 606 BGFX_TEXTURE_FORMAT_R16U, 607 BGFX_TEXTURE_FORMAT_R16F, 608 BGFX_TEXTURE_FORMAT_R16S, 609 BGFX_TEXTURE_FORMAT_R32I, 610 BGFX_TEXTURE_FORMAT_R32U, 611 BGFX_TEXTURE_FORMAT_R32F, 612 BGFX_TEXTURE_FORMAT_RG8, 613 BGFX_TEXTURE_FORMAT_RG8I, 614 BGFX_TEXTURE_FORMAT_RG8U, 615 BGFX_TEXTURE_FORMAT_RG8S, 616 BGFX_TEXTURE_FORMAT_RG16, 617 BGFX_TEXTURE_FORMAT_RG16I, 618 BGFX_TEXTURE_FORMAT_RG16U, 619 BGFX_TEXTURE_FORMAT_RG16F, 620 BGFX_TEXTURE_FORMAT_RG16S, 621 BGFX_TEXTURE_FORMAT_RG32I, 622 BGFX_TEXTURE_FORMAT_RG32U, 623 BGFX_TEXTURE_FORMAT_RG32F, 624 BGFX_TEXTURE_FORMAT_RGB8, 625 BGFX_TEXTURE_FORMAT_RGB8I, 626 BGFX_TEXTURE_FORMAT_RGB8U, 627 BGFX_TEXTURE_FORMAT_RGB8S, 628 BGFX_TEXTURE_FORMAT_RGB9E5F, 629 BGFX_TEXTURE_FORMAT_BGRA8, 630 BGFX_TEXTURE_FORMAT_RGBA8, 631 BGFX_TEXTURE_FORMAT_RGBA8I, 632 BGFX_TEXTURE_FORMAT_RGBA8U, 633 BGFX_TEXTURE_FORMAT_RGBA8S, 634 BGFX_TEXTURE_FORMAT_RGBA16, 635 BGFX_TEXTURE_FORMAT_RGBA16I, 636 BGFX_TEXTURE_FORMAT_RGBA16U, 637 BGFX_TEXTURE_FORMAT_RGBA16F, 638 BGFX_TEXTURE_FORMAT_RGBA16S, 639 BGFX_TEXTURE_FORMAT_RGBA32I, 640 BGFX_TEXTURE_FORMAT_RGBA32U, 641 BGFX_TEXTURE_FORMAT_RGBA32F, 642 BGFX_TEXTURE_FORMAT_R5G6B5, 643 BGFX_TEXTURE_FORMAT_RGBA4, 644 BGFX_TEXTURE_FORMAT_RGB5A1, 645 BGFX_TEXTURE_FORMAT_RGB10A2, 646 BGFX_TEXTURE_FORMAT_R11G11B10F, 647 648 BGFX_TEXTURE_FORMAT_UNKNOWN_DEPTH, 649 650 BGFX_TEXTURE_FORMAT_D16, 651 BGFX_TEXTURE_FORMAT_D24, 652 BGFX_TEXTURE_FORMAT_D24S8, 653 BGFX_TEXTURE_FORMAT_D32, 654 BGFX_TEXTURE_FORMAT_D16F, 655 BGFX_TEXTURE_FORMAT_D24F, 656 BGFX_TEXTURE_FORMAT_D32F, 657 BGFX_TEXTURE_FORMAT_D0S8, 658 659 BGFX_TEXTURE_FORMAT_COUNT 660 661 } 662 663 alias bgfx_uniform_type_t = int; 664 enum : bgfx_uniform_type_t 665 { 666 BGFX_UNIFORM_TYPE_INT1, 667 BGFX_UNIFORM_TYPE_END, 668 669 BGFX_UNIFORM_TYPE_VEC4, 670 BGFX_UNIFORM_TYPE_MAT3, 671 BGFX_UNIFORM_TYPE_MAT4, 672 673 BGFX_UNIFORM_TYPE_COUNT 674 675 } 676 677 alias bgfx_backbuffer_ratio_t = int; 678 enum : bgfx_backbuffer_ratio_t 679 { 680 BGFX_BACKBUFFER_RATIO_EQUAL, 681 BGFX_BACKBUFFER_RATIO_HALF, 682 BGFX_BACKBUFFER_RATIO_QUARTER, 683 BGFX_BACKBUFFER_RATIO_EIGHTH, 684 BGFX_BACKBUFFER_RATIO_SIXTEENTH, 685 BGFX_BACKBUFFER_RATIO_DOUBLE, 686 687 BGFX_BACKBUFFER_RATIO_COUNT 688 689 } 690 691 alias bgfx_occlusion_query_result_t = int; 692 enum : bgfx_occlusion_query_result_t 693 { 694 BGFX_TOPOLOGY_CONVERT_TRI_LIST_FLIP_WINDING, 695 BGFX_TOPOLOGY_CONVERT_TRI_LIST_TO_LINE_LIST, 696 BGFX_TOPOLOGY_CONVERT_TRI_STRIP_TO_TRI_LIST, 697 BGFX_TOPOLOGY_CONVERT_LINE_STRIP_TO_LINE_LIST, 698 699 BGFX_TOPOLOGY_CONVERT_COUNT 700 701 } 702 703 alias bgfx_topology_convert_t = int; 704 enum : bgfx_topology_convert_t 705 { 706 BGFX_OCCLUSION_QUERY_RESULT_INVISIBLE, 707 BGFX_OCCLUSION_QUERY_RESULT_VISIBLE, 708 BGFX_OCCLUSION_QUERY_RESULT_NORESULT, 709 710 BGFX_OCCLUSION_QUERY_RESULT_COUNT 711 712 } 713 714 struct bgfx_indirect_buffer_handle_t 715 { 716 ushort idx; 717 } 718 719 struct bgfx_dynamic_index_buffer_handle_t 720 { 721 ushort idx; 722 } 723 724 struct bgfx_dynamic_vertex_buffer_handle_t 725 { 726 ushort idx; 727 } 728 729 struct bgfx_frame_buffer_handle_t 730 { 731 ushort idx; 732 } 733 734 struct bgfx_index_buffer_handle_t 735 { 736 ushort idx; 737 } 738 739 struct bgfx_occlusion_query_handle_t 740 { 741 ushort idx; 742 } 743 744 struct bgfx_program_handle_t 745 { 746 ushort idx; 747 } 748 749 struct bgfx_shader_handle_t 750 { 751 ushort idx; 752 } 753 754 struct bgfx_texture_handle_t 755 { 756 ushort idx; 757 } 758 759 struct bgfx_uniform_handle_t 760 { 761 ushort idx; 762 } 763 764 struct bgfx_vertex_buffer_handle_t 765 { 766 ushort idx; 767 } 768 769 struct bgfx_vertex_decl_handle_t 770 { 771 ushort idx; 772 } 773 774 extern(C) nothrow @nogc 775 { 776 alias bgfx_release_fn_t = void function(void* _ptr, void* _userData); 777 } 778 779 struct bgfx_memory_t 780 { 781 uint8_t* data; 782 uint32_t size; 783 } 784 785 struct bgfx_transform_t 786 { 787 float* data; 788 uint16_t num; 789 } 790 791 struct bgfx_hmd_t 792 { 793 /** 794 * Eye 795 */ 796 struct Eye 797 { 798 float[4] rotation; 799 float[3] translation; 800 float[4] fov; 801 float[3] adjust; 802 float[2] pixelsPerTanAngle; 803 }; 804 805 Eye[2] eye; 806 uint16_t width; 807 uint16_t height; 808 uint32_t deviceWidth; 809 uint32_t deviceHeight; 810 uint8_t flags; 811 } 812 813 struct bgfx_stats_t 814 { 815 uint64_t cpuTime; 816 uint64_t cpuTimerFreq; 817 818 uint64_t gpuTime; 819 uint64_t gpuTimerFreq; 820 821 } 822 823 /** 824 * Vertex declaration. 825 */ 826 struct bgfx_vertex_decl_t 827 { 828 uint32_t hash; 829 uint16_t stride; 830 uint16_t[BGFX_ATTRIB_COUNT] offset; 831 uint16_t[BGFX_ATTRIB_COUNT] attributes; 832 833 } 834 835 /** 836 */ 837 struct bgfx_transient_index_buffer_t 838 { 839 uint8_t* data; 840 uint32_t size; 841 bgfx_index_buffer_handle_t handle; 842 uint32_t startIndex; 843 } 844 845 /** 846 */ 847 struct bgfx_transient_vertex_buffer_t 848 { 849 uint8_t* data; 850 uint32_t size; 851 uint32_t startVertex; 852 uint16_t stride; 853 bgfx_vertex_buffer_handle_t handle; 854 bgfx_vertex_decl_handle_t decl; 855 856 } 857 858 /** 859 */ 860 struct bgfx_instance_data_buffer_t 861 { 862 uint8_t* data; 863 uint32_t size; 864 uint32_t offset; 865 uint16_t num; 866 uint16_t stride; 867 bgfx_vertex_buffer_handle_t handle; 868 869 } 870 871 /** 872 */ 873 struct bgfx_texture_info_t 874 { 875 bgfx_texture_format_t format; 876 uint32_t storageSize; 877 uint16_t width; 878 uint16_t height; 879 uint16_t depth; 880 uint8_t numMips; 881 uint8_t bitsPerPixel; 882 bool cubeMap; 883 884 } 885 886 struct bgfx_attachment_t 887 { 888 bgfx_texture_handle_t handle; 889 uint16_t mip; 890 uint16_t layer; 891 892 } 893 894 struct bgfx_caps_gpu_t 895 { 896 uint16_t vendorId; 897 uint16_t deviceId; 898 899 } 900 901 902 /** 903 * Renderer capabilities. 904 */ 905 struct bgfx_caps_t 906 { 907 bgfx_renderer_type_t rendererType; 908 909 uint64_t supported; 910 911 uint32_t maxDrawCalls; 912 uint16_t maxTextureSize; 913 uint16_t maxViews; 914 uint8_t maxFBAttachments; 915 uint8_t numGPUs; 916 bool homogeneousDepth; 917 bool originBottomLeft; 918 919 uint16_t vendorId; 920 uint16_t deviceId; 921 bgfx_caps_gpu_t[4] gpu; 922 923 uint16_t[BGFX_TEXTURE_FORMAT_COUNT] formats; 924 925 } 926 927 /** 928 */ 929 930 alias bgfx_fatal_t = int; 931 enum : bgfx_fatal_t 932 { 933 BGFX_FATAL_DEBUG_CHECK, 934 BGFX_FATAL_MINIMUM_REQUIRED_SPECS, 935 BGFX_FATAL_INVALID_SHADER, 936 BGFX_FATAL_UNABLE_TO_INITIALIZE, 937 BGFX_FATAL_UNABLE_TO_CREATE_TEXTURE, 938 BGFX_FATAL_DEVICE_LOST, 939 940 BGFX_FATAL_COUNT 941 } 942 943 extern(C++, bgfx) interface CallbackI 944 { 945 void fatal(bgfx_fatal_t _code, const(char)* _str); 946 void traceVargs(const(char)* _filePath, uint16_t _line, const(char*) _format, va_list _argList); 947 uint32_t cacheReadSize(uint64_t _id); 948 bool cacheRead(uint64_t _id, void* _data, uint32_t _size); 949 void cacheWrite(uint64_t _id, const(void)* _data, uint32_t _size); 950 void screenShot(const(char)* _filePath, uint32_t _width, uint32_t _height, uint32_t _pitch, const(void)* _data, uint32_t _size, bool _yflip); 951 void captureBegin(uint32_t _width, uint32_t _height, uint32_t _pitch, bgfx_texture_format_t _format, bool _yflip); 952 void captureEnd(); 953 void captureFrame(const(void)* _data, uint32_t _size); 954 } 955 956 extern(C++, bx) interface AllocatorI 957 { 958 void* realloc(void* _ptr, size_t _size, size_t _align, const(char)* _file, uint32_t _line); 959 } 960 961 // bgfxplatform.c99.h 962 963 alias bgfx_render_frame_t = int; 964 enum : bgfx_render_frame_t 965 { 966 BGFX_RENDER_FRAME_NO_CONTEXT, 967 BGFX_RENDER_FRAME_RENDER, 968 BGFX_RENDER_FRAME_EXITING, 969 970 BGFX_RENDER_FRAME_COUNT 971 } 972 973 struct bgfx_platform_data_t 974 { 975 void* ndt; 976 void* nwh; 977 void* context; 978 void* backBuffer; 979 void* backBufferDS; 980 981 } 982 983 struct bgfx_internal_data_t 984 { 985 bgfx_caps_t* caps; 986 void* context; 987 988 } 989