1 /* 2 * Copyright 2011-2019 Branimir Karadzic. All rights reserved. 3 * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause 4 */ 5 6 /* 7 * 8 * AUTO GENERATED FROM IDL! DO NOT EDIT! (source : temp.defines.h) 9 * 10 * More info about IDL: 11 * https://gist.github.com/bkaradzic/05a1c86a6dd57bf86e2d828878e88dc2#bgfx-is-switching-to-idl-to-generate-api 12 * 13 */ 14 15 #ifndef BGFX_DEFINES_H_HEADER_GUARD 16 #define BGFX_DEFINES_H_HEADER_GUARD 17 18 #define BGFX_API_VERSION UINT32_C(102) 19 20 /** 21 * Color RGB/alpha/depth write. When it's not specified write will be disabled. 22 * 23 */ 24 #define BGFX_STATE_WRITE_R UINT64_C(0x0000000000000001) //!< Enable R write. 25 #define BGFX_STATE_WRITE_G UINT64_C(0x0000000000000002) //!< Enable G write. 26 #define BGFX_STATE_WRITE_B UINT64_C(0x0000000000000004) //!< Enable B write. 27 #define BGFX_STATE_WRITE_A UINT64_C(0x0000000000000008) //!< Enable alpha write. 28 #define BGFX_STATE_WRITE_Z UINT64_C(0x0000004000000000) //!< Enable depth write. 29 /// Enable RGB write. 30 #define BGFX_STATE_WRITE_RGB (0 \ 31 | BGFX_STATE_WRITE_R \ 32 | BGFX_STATE_WRITE_G \ 33 | BGFX_STATE_WRITE_B \ 34 ) 35 36 /// Write all channels mask. 37 #define BGFX_STATE_WRITE_MASK (0 \ 38 | BGFX_STATE_WRITE_RGB \ 39 | BGFX_STATE_WRITE_A \ 40 | BGFX_STATE_WRITE_Z \ 41 ) 42 43 44 /** 45 * Depth test state. When `BGFX_STATE_DEPTH_` is not specified depth test will be disabled. 46 * 47 */ 48 #define BGFX_STATE_DEPTH_TEST_LESS UINT64_C(0x0000000000000010) //!< Enable depth test, less. 49 #define BGFX_STATE_DEPTH_TEST_LEQUAL UINT64_C(0x0000000000000020) //!< Enable depth test, less or equal. 50 #define BGFX_STATE_DEPTH_TEST_EQUAL UINT64_C(0x0000000000000030) //!< Enable depth test, equal. 51 #define BGFX_STATE_DEPTH_TEST_GEQUAL UINT64_C(0x0000000000000040) //!< Enable depth test, greater or equal. 52 #define BGFX_STATE_DEPTH_TEST_GREATER UINT64_C(0x0000000000000050) //!< Enable depth test, greater. 53 #define BGFX_STATE_DEPTH_TEST_NOTEQUAL UINT64_C(0x0000000000000060) //!< Enable depth test, not equal. 54 #define BGFX_STATE_DEPTH_TEST_NEVER UINT64_C(0x0000000000000070) //!< Enable depth test, never. 55 #define BGFX_STATE_DEPTH_TEST_ALWAYS UINT64_C(0x0000000000000080) //!< Enable depth test, always. 56 #define BGFX_STATE_DEPTH_TEST_SHIFT 4 //!< Depth test state bit shift 57 #define BGFX_STATE_DEPTH_TEST_MASK UINT64_C(0x00000000000000f0) //!< Depth test state bit mask 58 59 /** 60 * Use BGFX_STATE_BLEND_FUNC(_src, _dst) or BGFX_STATE_BLEND_FUNC_SEPARATE(_srcRGB, _dstRGB, _srcA, _dstA) 61 * helper macros. 62 * 63 */ 64 #define BGFX_STATE_BLEND_ZERO UINT64_C(0x0000000000001000) //!< 0, 0, 0, 0 65 #define BGFX_STATE_BLEND_ONE UINT64_C(0x0000000000002000) //!< 1, 1, 1, 1 66 #define BGFX_STATE_BLEND_SRC_COLOR UINT64_C(0x0000000000003000) //!< Rs, Gs, Bs, As 67 #define BGFX_STATE_BLEND_INV_SRC_COLOR UINT64_C(0x0000000000004000) //!< 1-Rs, 1-Gs, 1-Bs, 1-As 68 #define BGFX_STATE_BLEND_SRC_ALPHA UINT64_C(0x0000000000005000) //!< As, As, As, As 69 #define BGFX_STATE_BLEND_INV_SRC_ALPHA UINT64_C(0x0000000000006000) //!< 1-As, 1-As, 1-As, 1-As 70 #define BGFX_STATE_BLEND_DST_ALPHA UINT64_C(0x0000000000007000) //!< Ad, Ad, Ad, Ad 71 #define BGFX_STATE_BLEND_INV_DST_ALPHA UINT64_C(0x0000000000008000) //!< 1-Ad, 1-Ad, 1-Ad ,1-Ad 72 #define BGFX_STATE_BLEND_DST_COLOR UINT64_C(0x0000000000009000) //!< Rd, Gd, Bd, Ad 73 #define BGFX_STATE_BLEND_INV_DST_COLOR UINT64_C(0x000000000000a000) //!< 1-Rd, 1-Gd, 1-Bd, 1-Ad 74 #define BGFX_STATE_BLEND_SRC_ALPHA_SAT UINT64_C(0x000000000000b000) //!< f, f, f, 1; f = min(As, 1-Ad) 75 #define BGFX_STATE_BLEND_FACTOR UINT64_C(0x000000000000c000) //!< Blend factor 76 #define BGFX_STATE_BLEND_INV_FACTOR UINT64_C(0x000000000000d000) //!< 1-Blend factor 77 #define BGFX_STATE_BLEND_SHIFT 12 //!< Blend state bit shift 78 #define BGFX_STATE_BLEND_MASK UINT64_C(0x000000000ffff000) //!< Blend state bit mask 79 80 /** 81 * Use BGFX_STATE_BLEND_EQUATION(_equation) or BGFX_STATE_BLEND_EQUATION_SEPARATE(_equationRGB, _equationA) 82 * helper macros. 83 * 84 */ 85 #define BGFX_STATE_BLEND_EQUATION_ADD UINT64_C(0x0000000000000000) //!< Blend add: src + dst. 86 #define BGFX_STATE_BLEND_EQUATION_SUB UINT64_C(0x0000000010000000) //!< Blend subtract: src - dst. 87 #define BGFX_STATE_BLEND_EQUATION_REVSUB UINT64_C(0x0000000020000000) //!< Blend reverse subtract: dst - src. 88 #define BGFX_STATE_BLEND_EQUATION_MIN UINT64_C(0x0000000030000000) //!< Blend min: min(src, dst). 89 #define BGFX_STATE_BLEND_EQUATION_MAX UINT64_C(0x0000000040000000) //!< Blend max: max(src, dst). 90 #define BGFX_STATE_BLEND_EQUATION_SHIFT 28 //!< Blend equation bit shift 91 #define BGFX_STATE_BLEND_EQUATION_MASK UINT64_C(0x00000003f0000000) //!< Blend equation bit mask 92 93 /** 94 * Cull state. When `BGFX_STATE_CULL_*` is not specified culling will be disabled. 95 * 96 */ 97 #define BGFX_STATE_CULL_CW UINT64_C(0x0000001000000000) //!< Cull clockwise triangles. 98 #define BGFX_STATE_CULL_CCW UINT64_C(0x0000002000000000) //!< Cull counter-clockwise triangles. 99 #define BGFX_STATE_CULL_SHIFT 36 //!< Culling mode bit shift 100 #define BGFX_STATE_CULL_MASK UINT64_C(0x0000003000000000) //!< Culling mode bit mask 101 102 /** 103 * Alpha reference value. 104 * 105 */ 106 #define BGFX_STATE_ALPHA_REF_SHIFT 40 //!< Alpha reference bit shift 107 #define BGFX_STATE_ALPHA_REF_MASK UINT64_C(0x0000ff0000000000) //!< Alpha reference bit mask 108 #define BGFX_STATE_ALPHA_REF(v) ( ( (uint64_t)(v)<<BGFX_STATE_ALPHA_REF_SHIFT )&BGFX_STATE_ALPHA_REF_MASK) 109 110 #define BGFX_STATE_PT_TRISTRIP UINT64_C(0x0001000000000000) //!< Tristrip. 111 #define BGFX_STATE_PT_LINES UINT64_C(0x0002000000000000) //!< Lines. 112 #define BGFX_STATE_PT_LINESTRIP UINT64_C(0x0003000000000000) //!< Line strip. 113 #define BGFX_STATE_PT_POINTS UINT64_C(0x0004000000000000) //!< Points. 114 #define BGFX_STATE_PT_SHIFT 48 //!< Primitive type bit shift 115 #define BGFX_STATE_PT_MASK UINT64_C(0x0007000000000000) //!< Primitive type bit mask 116 117 /** 118 * Point size value. 119 * 120 */ 121 #define BGFX_STATE_POINT_SIZE_SHIFT 52 //!< Point size bit shift 122 #define BGFX_STATE_POINT_SIZE_MASK UINT64_C(0x00f0000000000000) //!< Point size bit mask 123 #define BGFX_STATE_POINT_SIZE(v) ( ( (uint64_t)(v)<<BGFX_STATE_POINT_SIZE_SHIFT )&BGFX_STATE_POINT_SIZE_MASK) 124 125 /** 126 * Enable MSAA write when writing into MSAA frame buffer. 127 * This flag is ignored when not writing into MSAA frame buffer. 128 * 129 */ 130 #define BGFX_STATE_MSAA UINT64_C(0x0100000000000000) //!< Enable MSAA rasterization. 131 #define BGFX_STATE_LINEAA UINT64_C(0x0200000000000000) //!< Enable line AA rasterization. 132 #define BGFX_STATE_CONSERVATIVE_RASTER UINT64_C(0x0400000000000000) //!< Enable conservative rasterization. 133 #define BGFX_STATE_NONE UINT64_C(0x0000000000000000) //!< No state. 134 #define BGFX_STATE_FRONT_CCW UINT64_C(0x0000008000000000) //!< Front counter-clockwise (default is clockwise). 135 #define BGFX_STATE_BLEND_INDEPENDENT UINT64_C(0x0000000400000000) //!< Enable blend independent. 136 #define BGFX_STATE_BLEND_ALPHA_TO_COVERAGE UINT64_C(0x0000000800000000) //!< Enable alpha to coverage. 137 /// Default state is write to RGB, alpha, and depth with depth test less enabled, with clockwise 138 /// culling and MSAA (when writing into MSAA frame buffer, otherwise this flag is ignored). 139 #define BGFX_STATE_DEFAULT (0 \ 140 | BGFX_STATE_WRITE_RGB \ 141 | BGFX_STATE_WRITE_A \ 142 | BGFX_STATE_WRITE_Z \ 143 | BGFX_STATE_DEPTH_TEST_LESS \ 144 | BGFX_STATE_CULL_CW \ 145 | BGFX_STATE_MSAA \ 146 ) 147 148 #define BGFX_STATE_MASK UINT64_C(0xffffffffffffffff) //!< State bit mask 149 150 /** 151 * Do not use! 152 * 153 */ 154 #define BGFX_STATE_RESERVED_SHIFT 61 155 156 #define BGFX_STATE_RESERVED_MASK UINT64_C(0xe000000000000000) 157 158 /** 159 * Set stencil ref value. 160 * 161 */ 162 #define BGFX_STENCIL_FUNC_REF_SHIFT 0 163 164 #define BGFX_STENCIL_FUNC_REF_MASK UINT32_C(0x000000ff) 165 #define BGFX_STENCIL_FUNC_REF(v) ( ( (uint32_t)(v)<<BGFX_STENCIL_FUNC_REF_SHIFT )&BGFX_STENCIL_FUNC_REF_MASK) 166 167 /** 168 * Set stencil rmask value. 169 * 170 */ 171 #define BGFX_STENCIL_FUNC_RMASK_SHIFT 8 172 173 #define BGFX_STENCIL_FUNC_RMASK_MASK UINT32_C(0x0000ff00) 174 #define BGFX_STENCIL_FUNC_RMASK(v) ( ( (uint32_t)(v)<<BGFX_STENCIL_FUNC_RMASK_SHIFT )&BGFX_STENCIL_FUNC_RMASK_MASK) 175 176 #define BGFX_STENCIL_NONE UINT32_C(0x00000000) 177 #define BGFX_STENCIL_MASK UINT32_C(0xffffffff) 178 #define BGFX_STENCIL_DEFAULT UINT32_C(0x00000000) 179 180 #define BGFX_STENCIL_TEST_LESS UINT32_C(0x00010000) //!< Enable stencil test, less. 181 #define BGFX_STENCIL_TEST_LEQUAL UINT32_C(0x00020000) //!< Enable stencil test, less or equal. 182 #define BGFX_STENCIL_TEST_EQUAL UINT32_C(0x00030000) //!< Enable stencil test, equal. 183 #define BGFX_STENCIL_TEST_GEQUAL UINT32_C(0x00040000) //!< Enable stencil test, greater or equal. 184 #define BGFX_STENCIL_TEST_GREATER UINT32_C(0x00050000) //!< Enable stencil test, greater. 185 #define BGFX_STENCIL_TEST_NOTEQUAL UINT32_C(0x00060000) //!< Enable stencil test, not equal. 186 #define BGFX_STENCIL_TEST_NEVER UINT32_C(0x00070000) //!< Enable stencil test, never. 187 #define BGFX_STENCIL_TEST_ALWAYS UINT32_C(0x00080000) //!< Enable stencil test, always. 188 #define BGFX_STENCIL_TEST_SHIFT 16 //!< Stencil test bit shift 189 #define BGFX_STENCIL_TEST_MASK UINT32_C(0x000f0000) //!< Stencil test bit mask 190 191 #define BGFX_STENCIL_OP_FAIL_S_ZERO UINT32_C(0x00000000) //!< Zero. 192 #define BGFX_STENCIL_OP_FAIL_S_KEEP UINT32_C(0x00100000) //!< Keep. 193 #define BGFX_STENCIL_OP_FAIL_S_REPLACE UINT32_C(0x00200000) //!< Replace. 194 #define BGFX_STENCIL_OP_FAIL_S_INCR UINT32_C(0x00300000) //!< Increment and wrap. 195 #define BGFX_STENCIL_OP_FAIL_S_INCRSAT UINT32_C(0x00400000) //!< Increment and clamp. 196 #define BGFX_STENCIL_OP_FAIL_S_DECR UINT32_C(0x00500000) //!< Decrement and wrap. 197 #define BGFX_STENCIL_OP_FAIL_S_DECRSAT UINT32_C(0x00600000) //!< Decrement and clamp. 198 #define BGFX_STENCIL_OP_FAIL_S_INVERT UINT32_C(0x00700000) //!< Invert. 199 #define BGFX_STENCIL_OP_FAIL_S_SHIFT 20 //!< Stencil operation fail bit shift 200 #define BGFX_STENCIL_OP_FAIL_S_MASK UINT32_C(0x00f00000) //!< Stencil operation fail bit mask 201 202 #define BGFX_STENCIL_OP_FAIL_Z_ZERO UINT32_C(0x00000000) //!< Zero. 203 #define BGFX_STENCIL_OP_FAIL_Z_KEEP UINT32_C(0x01000000) //!< Keep. 204 #define BGFX_STENCIL_OP_FAIL_Z_REPLACE UINT32_C(0x02000000) //!< Replace. 205 #define BGFX_STENCIL_OP_FAIL_Z_INCR UINT32_C(0x03000000) //!< Increment and wrap. 206 #define BGFX_STENCIL_OP_FAIL_Z_INCRSAT UINT32_C(0x04000000) //!< Increment and clamp. 207 #define BGFX_STENCIL_OP_FAIL_Z_DECR UINT32_C(0x05000000) //!< Decrement and wrap. 208 #define BGFX_STENCIL_OP_FAIL_Z_DECRSAT UINT32_C(0x06000000) //!< Decrement and clamp. 209 #define BGFX_STENCIL_OP_FAIL_Z_INVERT UINT32_C(0x07000000) //!< Invert. 210 #define BGFX_STENCIL_OP_FAIL_Z_SHIFT 24 //!< Stencil operation depth fail bit shift 211 #define BGFX_STENCIL_OP_FAIL_Z_MASK UINT32_C(0x0f000000) //!< Stencil operation depth fail bit mask 212 213 #define BGFX_STENCIL_OP_PASS_Z_ZERO UINT32_C(0x00000000) //!< Zero. 214 #define BGFX_STENCIL_OP_PASS_Z_KEEP UINT32_C(0x10000000) //!< Keep. 215 #define BGFX_STENCIL_OP_PASS_Z_REPLACE UINT32_C(0x20000000) //!< Replace. 216 #define BGFX_STENCIL_OP_PASS_Z_INCR UINT32_C(0x30000000) //!< Increment and wrap. 217 #define BGFX_STENCIL_OP_PASS_Z_INCRSAT UINT32_C(0x40000000) //!< Increment and clamp. 218 #define BGFX_STENCIL_OP_PASS_Z_DECR UINT32_C(0x50000000) //!< Decrement and wrap. 219 #define BGFX_STENCIL_OP_PASS_Z_DECRSAT UINT32_C(0x60000000) //!< Decrement and clamp. 220 #define BGFX_STENCIL_OP_PASS_Z_INVERT UINT32_C(0x70000000) //!< Invert. 221 #define BGFX_STENCIL_OP_PASS_Z_SHIFT 28 //!< Stencil operation depth pass bit shift 222 #define BGFX_STENCIL_OP_PASS_Z_MASK UINT32_C(0xf0000000) //!< Stencil operation depth pass bit mask 223 224 #define BGFX_CLEAR_NONE UINT16_C(0x0000) //!< No clear flags. 225 #define BGFX_CLEAR_COLOR UINT16_C(0x0001) //!< Clear color. 226 #define BGFX_CLEAR_DEPTH UINT16_C(0x0002) //!< Clear depth. 227 #define BGFX_CLEAR_STENCIL UINT16_C(0x0004) //!< Clear stencil. 228 #define BGFX_CLEAR_DISCARD_COLOR_0 UINT16_C(0x0008) //!< Discard frame buffer attachment 0. 229 #define BGFX_CLEAR_DISCARD_COLOR_1 UINT16_C(0x0010) //!< Discard frame buffer attachment 1. 230 #define BGFX_CLEAR_DISCARD_COLOR_2 UINT16_C(0x0020) //!< Discard frame buffer attachment 2. 231 #define BGFX_CLEAR_DISCARD_COLOR_3 UINT16_C(0x0040) //!< Discard frame buffer attachment 3. 232 #define BGFX_CLEAR_DISCARD_COLOR_4 UINT16_C(0x0080) //!< Discard frame buffer attachment 4. 233 #define BGFX_CLEAR_DISCARD_COLOR_5 UINT16_C(0x0100) //!< Discard frame buffer attachment 5. 234 #define BGFX_CLEAR_DISCARD_COLOR_6 UINT16_C(0x0200) //!< Discard frame buffer attachment 6. 235 #define BGFX_CLEAR_DISCARD_COLOR_7 UINT16_C(0x0400) //!< Discard frame buffer attachment 7. 236 #define BGFX_CLEAR_DISCARD_DEPTH UINT16_C(0x0800) //!< Discard frame buffer depth attachment. 237 #define BGFX_CLEAR_DISCARD_STENCIL UINT16_C(0x1000) //!< Discard frame buffer stencil attachment. 238 #define BGFX_CLEAR_DISCARD_COLOR_MASK (0 \ 239 | BGFX_CLEAR_DISCARD_COLOR_0 \ 240 | BGFX_CLEAR_DISCARD_COLOR_1 \ 241 | BGFX_CLEAR_DISCARD_COLOR_2 \ 242 | BGFX_CLEAR_DISCARD_COLOR_3 \ 243 | BGFX_CLEAR_DISCARD_COLOR_4 \ 244 | BGFX_CLEAR_DISCARD_COLOR_5 \ 245 | BGFX_CLEAR_DISCARD_COLOR_6 \ 246 | BGFX_CLEAR_DISCARD_COLOR_7 \ 247 ) 248 249 #define BGFX_CLEAR_DISCARD_MASK (0 \ 250 | BGFX_CLEAR_DISCARD_COLOR_MASK \ 251 | BGFX_CLEAR_DISCARD_DEPTH \ 252 | BGFX_CLEAR_DISCARD_STENCIL \ 253 ) 254 255 256 #define BGFX_DEBUG_NONE UINT32_C(0x00000000) //!< No debug. 257 #define BGFX_DEBUG_WIREFRAME UINT32_C(0x00000001) //!< Enable wireframe for all primitives. 258 /// Enable infinitely fast hardware test. No draw calls will be submitted to driver. 259 /// It's useful when profiling to quickly assess bottleneck between CPU and GPU. 260 #define BGFX_DEBUG_IFH UINT32_C(0x00000002) 261 #define BGFX_DEBUG_STATS UINT32_C(0x00000004) //!< Enable statistics display. 262 #define BGFX_DEBUG_TEXT UINT32_C(0x00000008) //!< Enable debug text display. 263 #define BGFX_DEBUG_PROFILER UINT32_C(0x00000010) //!< Enable profiler. 264 265 #define BGFX_BUFFER_COMPUTE_FORMAT_8X1 UINT16_C(0x0001) //!< 1 8-bit value 266 #define BGFX_BUFFER_COMPUTE_FORMAT_8X2 UINT16_C(0x0002) //!< 2 8-bit values 267 #define BGFX_BUFFER_COMPUTE_FORMAT_8X4 UINT16_C(0x0003) //!< 4 8-bit values 268 #define BGFX_BUFFER_COMPUTE_FORMAT_16X1 UINT16_C(0x0004) //!< 1 16-bit value 269 #define BGFX_BUFFER_COMPUTE_FORMAT_16X2 UINT16_C(0x0005) //!< 2 16-bit values 270 #define BGFX_BUFFER_COMPUTE_FORMAT_16X4 UINT16_C(0x0006) //!< 4 16-bit values 271 #define BGFX_BUFFER_COMPUTE_FORMAT_32X1 UINT16_C(0x0007) //!< 1 32-bit value 272 #define BGFX_BUFFER_COMPUTE_FORMAT_32X2 UINT16_C(0x0008) //!< 2 32-bit values 273 #define BGFX_BUFFER_COMPUTE_FORMAT_32X4 UINT16_C(0x0009) //!< 4 32-bit values 274 #define BGFX_BUFFER_COMPUTE_FORMAT_SHIFT 0 275 276 #define BGFX_BUFFER_COMPUTE_FORMAT_MASK UINT16_C(0x000f) 277 278 #define BGFX_BUFFER_COMPUTE_TYPE_INT UINT16_C(0x0010) //!< Type `int`. 279 #define BGFX_BUFFER_COMPUTE_TYPE_UINT UINT16_C(0x0020) //!< Type `uint`. 280 #define BGFX_BUFFER_COMPUTE_TYPE_FLOAT UINT16_C(0x0030) //!< Type `float`. 281 #define BGFX_BUFFER_COMPUTE_TYPE_SHIFT 4 282 283 #define BGFX_BUFFER_COMPUTE_TYPE_MASK UINT16_C(0x0030) 284 285 #define BGFX_BUFFER_NONE UINT16_C(0x0000) 286 #define BGFX_BUFFER_COMPUTE_READ UINT16_C(0x0100) //!< Buffer will be read by shader. 287 #define BGFX_BUFFER_COMPUTE_WRITE UINT16_C(0x0200) //!< Buffer will be used for writing. 288 #define BGFX_BUFFER_DRAW_INDIRECT UINT16_C(0x0400) //!< Buffer will be used for storing draw indirect commands. 289 #define BGFX_BUFFER_ALLOW_RESIZE UINT16_C(0x0800) //!< Allow dynamic index/vertex buffer resize during update. 290 #define BGFX_BUFFER_INDEX32 UINT16_C(0x1000) //!< Index buffer contains 32-bit indices. 291 #define BGFX_BUFFER_COMPUTE_READ_WRITE (0 \ 292 | BGFX_BUFFER_COMPUTE_READ \ 293 | BGFX_BUFFER_COMPUTE_WRITE \ 294 ) 295 296 297 #define BGFX_TEXTURE_NONE UINT64_C(0x0000000000000000) 298 #define BGFX_TEXTURE_MSAA_SAMPLE UINT64_C(0x0000000800000000) //!< Texture will be used for MSAA sampling. 299 #define BGFX_TEXTURE_RT UINT64_C(0x0000001000000000) //!< Render target no MSAA. 300 #define BGFX_TEXTURE_COMPUTE_WRITE UINT64_C(0x0000100000000000) //!< Texture will be used for compute write. 301 #define BGFX_TEXTURE_SRGB UINT64_C(0x0000200000000000) //!< Sample texture as sRGB. 302 #define BGFX_TEXTURE_BLIT_DST UINT64_C(0x0000400000000000) //!< Texture will be used as blit destination. 303 #define BGFX_TEXTURE_READ_BACK UINT64_C(0x0000800000000000) //!< Texture will be used for read back from GPU. 304 305 #define BGFX_TEXTURE_RT_MSAA_X2 UINT64_C(0x0000002000000000) //!< Render target MSAAx2 mode. 306 #define BGFX_TEXTURE_RT_MSAA_X4 UINT64_C(0x0000003000000000) //!< Render target MSAAx4 mode. 307 #define BGFX_TEXTURE_RT_MSAA_X8 UINT64_C(0x0000004000000000) //!< Render target MSAAx8 mode. 308 #define BGFX_TEXTURE_RT_MSAA_X16 UINT64_C(0x0000005000000000) //!< Render target MSAAx16 mode. 309 #define BGFX_TEXTURE_RT_MSAA_SHIFT 36 310 311 #define BGFX_TEXTURE_RT_MSAA_MASK UINT64_C(0x0000007000000000) 312 313 #define BGFX_TEXTURE_RT_WRITE_ONLY UINT64_C(0x0000008000000000) //!< Render target will be used for writing 314 #define BGFX_TEXTURE_RT_SHIFT 36 315 316 #define BGFX_TEXTURE_RT_MASK UINT64_C(0x000000f000000000) 317 318 /** 319 * Sampler flags. 320 * 321 */ 322 #define BGFX_SAMPLER_U_MIRROR UINT32_C(0x00000001) //!< Wrap U mode: Mirror 323 #define BGFX_SAMPLER_U_CLAMP UINT32_C(0x00000002) //!< Wrap U mode: Clamp 324 #define BGFX_SAMPLER_U_BORDER UINT32_C(0x00000003) //!< Wrap U mode: Border 325 #define BGFX_SAMPLER_U_SHIFT 0 326 327 #define BGFX_SAMPLER_U_MASK UINT32_C(0x00000003) 328 329 #define BGFX_SAMPLER_V_MIRROR UINT32_C(0x00000004) //!< Wrap V mode: Mirror 330 #define BGFX_SAMPLER_V_CLAMP UINT32_C(0x00000008) //!< Wrap V mode: Clamp 331 #define BGFX_SAMPLER_V_BORDER UINT32_C(0x0000000c) //!< Wrap V mode: Border 332 #define BGFX_SAMPLER_V_SHIFT 2 333 334 #define BGFX_SAMPLER_V_MASK UINT32_C(0x0000000c) 335 336 #define BGFX_SAMPLER_W_MIRROR UINT32_C(0x00000010) //!< Wrap W mode: Mirror 337 #define BGFX_SAMPLER_W_CLAMP UINT32_C(0x00000020) //!< Wrap W mode: Clamp 338 #define BGFX_SAMPLER_W_BORDER UINT32_C(0x00000030) //!< Wrap W mode: Border 339 #define BGFX_SAMPLER_W_SHIFT 4 340 341 #define BGFX_SAMPLER_W_MASK UINT32_C(0x00000030) 342 343 #define BGFX_SAMPLER_MIN_POINT UINT32_C(0x00000040) //!< Min sampling mode: Point 344 #define BGFX_SAMPLER_MIN_ANISOTROPIC UINT32_C(0x00000080) //!< Min sampling mode: Anisotropic 345 #define BGFX_SAMPLER_MIN_SHIFT 6 346 347 #define BGFX_SAMPLER_MIN_MASK UINT32_C(0x000000c0) 348 349 #define BGFX_SAMPLER_MAG_POINT UINT32_C(0x00000100) //!< Mag sampling mode: Point 350 #define BGFX_SAMPLER_MAG_ANISOTROPIC UINT32_C(0x00000200) //!< Mag sampling mode: Anisotropic 351 #define BGFX_SAMPLER_MAG_SHIFT 8 352 353 #define BGFX_SAMPLER_MAG_MASK UINT32_C(0x00000300) 354 355 #define BGFX_SAMPLER_MIP_POINT UINT32_C(0x00000400) //!< Mip sampling mode: Point 356 #define BGFX_SAMPLER_MIP_SHIFT 10 357 358 #define BGFX_SAMPLER_MIP_MASK UINT32_C(0x00000400) 359 360 #define BGFX_SAMPLER_COMPARE_LESS UINT32_C(0x00010000) //!< Compare when sampling depth texture: less. 361 #define BGFX_SAMPLER_COMPARE_LEQUAL UINT32_C(0x00020000) //!< Compare when sampling depth texture: less or equal. 362 #define BGFX_SAMPLER_COMPARE_EQUAL UINT32_C(0x00030000) //!< Compare when sampling depth texture: equal. 363 #define BGFX_SAMPLER_COMPARE_GEQUAL UINT32_C(0x00040000) //!< Compare when sampling depth texture: greater or equal. 364 #define BGFX_SAMPLER_COMPARE_GREATER UINT32_C(0x00050000) //!< Compare when sampling depth texture: greater. 365 #define BGFX_SAMPLER_COMPARE_NOTEQUAL UINT32_C(0x00060000) //!< Compare when sampling depth texture: not equal. 366 #define BGFX_SAMPLER_COMPARE_NEVER UINT32_C(0x00070000) //!< Compare when sampling depth texture: never. 367 #define BGFX_SAMPLER_COMPARE_ALWAYS UINT32_C(0x00080000) //!< Compare when sampling depth texture: always. 368 #define BGFX_SAMPLER_COMPARE_SHIFT 16 369 370 #define BGFX_SAMPLER_COMPARE_MASK UINT32_C(0x000f0000) 371 372 #define BGFX_SAMPLER_BORDER_COLOR_SHIFT 24 373 374 #define BGFX_SAMPLER_BORDER_COLOR_MASK UINT32_C(0x0f000000) 375 #define BGFX_SAMPLER_BORDER_COLOR(v) ( ( (uint32_t)(v)<<BGFX_SAMPLER_BORDER_COLOR_SHIFT )&BGFX_SAMPLER_BORDER_COLOR_MASK) 376 377 #define BGFX_SAMPLER_RESERVED_SHIFT 28 378 379 #define BGFX_SAMPLER_RESERVED_MASK UINT32_C(0xf0000000) 380 381 #define BGFX_SAMPLER_NONE UINT32_C(0x00000000) 382 #define BGFX_SAMPLER_SAMPLE_STENCIL UINT32_C(0x00100000) //!< Sample stencil instead of depth. 383 #define BGFX_SAMPLER_POINT (0 \ 384 | BGFX_SAMPLER_MIN_POINT \ 385 | BGFX_SAMPLER_MAG_POINT \ 386 | BGFX_SAMPLER_MIP_POINT \ 387 ) 388 389 #define BGFX_SAMPLER_UVW_MIRROR (0 \ 390 | BGFX_SAMPLER_U_MIRROR \ 391 | BGFX_SAMPLER_V_MIRROR \ 392 | BGFX_SAMPLER_W_MIRROR \ 393 ) 394 395 #define BGFX_SAMPLER_UVW_CLAMP (0 \ 396 | BGFX_SAMPLER_U_CLAMP \ 397 | BGFX_SAMPLER_V_CLAMP \ 398 | BGFX_SAMPLER_W_CLAMP \ 399 ) 400 401 #define BGFX_SAMPLER_UVW_BORDER (0 \ 402 | BGFX_SAMPLER_U_BORDER \ 403 | BGFX_SAMPLER_V_BORDER \ 404 | BGFX_SAMPLER_W_BORDER \ 405 ) 406 407 #define BGFX_SAMPLER_BITS_MASK (0 \ 408 | BGFX_SAMPLER_U_MASK \ 409 | BGFX_SAMPLER_V_MASK \ 410 | BGFX_SAMPLER_W_MASK \ 411 | BGFX_SAMPLER_MIN_MASK \ 412 | BGFX_SAMPLER_MAG_MASK \ 413 | BGFX_SAMPLER_MIP_MASK \ 414 | BGFX_SAMPLER_COMPARE_MASK \ 415 ) 416 417 418 #define BGFX_RESET_MSAA_X2 UINT32_C(0x00000010) //!< Enable 2x MSAA. 419 #define BGFX_RESET_MSAA_X4 UINT32_C(0x00000020) //!< Enable 4x MSAA. 420 #define BGFX_RESET_MSAA_X8 UINT32_C(0x00000030) //!< Enable 8x MSAA. 421 #define BGFX_RESET_MSAA_X16 UINT32_C(0x00000040) //!< Enable 16x MSAA. 422 #define BGFX_RESET_MSAA_SHIFT 4 423 424 #define BGFX_RESET_MSAA_MASK UINT32_C(0x00000070) 425 426 #define BGFX_RESET_NONE UINT32_C(0x00000000) //!< No reset flags. 427 #define BGFX_RESET_FULLSCREEN UINT32_C(0x00000001) //!< Not supported yet. 428 #define BGFX_RESET_VSYNC UINT32_C(0x00000080) //!< Enable V-Sync. 429 #define BGFX_RESET_MAXANISOTROPY UINT32_C(0x00000100) //!< Turn on/off max anisotropy. 430 #define BGFX_RESET_CAPTURE UINT32_C(0x00000200) //!< Begin screen capture. 431 #define BGFX_RESET_FLUSH_AFTER_RENDER UINT32_C(0x00002000) //!< Flush rendering after submitting to GPU. 432 /// This flag specifies where flip occurs. Default behavior is that flip occurs 433 /// before rendering new frame. This flag only has effect when `BGFX_CONFIG_MULTITHREADED=0`. 434 #define BGFX_RESET_FLIP_AFTER_RENDER UINT32_C(0x00004000) 435 #define BGFX_RESET_SRGB_BACKBUFFER UINT32_C(0x00008000) //!< Enable sRGB backbuffer. 436 #define BGFX_RESET_HDR10 UINT32_C(0x00010000) //!< Enable HDR10 rendering. 437 #define BGFX_RESET_HIDPI UINT32_C(0x00020000) //!< Enable HiDPI rendering. 438 #define BGFX_RESET_DEPTH_CLAMP UINT32_C(0x00040000) //!< Enable depth clamp. 439 #define BGFX_RESET_SUSPEND UINT32_C(0x00080000) //!< Suspend rendering. 440 441 #define BGFX_RESET_FULLSCREEN_SHIFT 0 442 443 #define BGFX_RESET_FULLSCREEN_MASK UINT32_C(0x00000001) 444 445 #define BGFX_RESET_RESERVED_SHIFT 31 //!< Internal bit shift 446 #define BGFX_RESET_RESERVED_MASK UINT32_C(0x80000000) //!< Internal bit mask 447 448 #define BGFX_CAPS_ALPHA_TO_COVERAGE UINT64_C(0x0000000000000001) //!< Alpha to coverage is supported. 449 #define BGFX_CAPS_BLEND_INDEPENDENT UINT64_C(0x0000000000000002) //!< Blend independent is supported. 450 #define BGFX_CAPS_COMPUTE UINT64_C(0x0000000000000004) //!< Compute shaders are supported. 451 #define BGFX_CAPS_CONSERVATIVE_RASTER UINT64_C(0x0000000000000008) //!< Conservative rasterization is supported. 452 #define BGFX_CAPS_DRAW_INDIRECT UINT64_C(0x0000000000000010) //!< Draw indirect is supported. 453 #define BGFX_CAPS_FRAGMENT_DEPTH UINT64_C(0x0000000000000020) //!< Fragment depth is accessible in fragment shader. 454 #define BGFX_CAPS_FRAGMENT_ORDERING UINT64_C(0x0000000000000040) //!< Fragment ordering is available in fragment shader. 455 #define BGFX_CAPS_FRAMEBUFFER_RW UINT64_C(0x0000000000000080) //!< Read/Write frame buffer attachments are supported. 456 #define BGFX_CAPS_GRAPHICS_DEBUGGER UINT64_C(0x0000000000000100) //!< Graphics debugger is present. 457 #define BGFX_CAPS_RESERVED UINT64_C(0x0000000000000200) 458 #define BGFX_CAPS_HDR10 UINT64_C(0x0000000000000400) //!< HDR10 rendering is supported. 459 #define BGFX_CAPS_HIDPI UINT64_C(0x0000000000000800) //!< HiDPI rendering is supported. 460 #define BGFX_CAPS_INDEX32 UINT64_C(0x0000000000001000) //!< 32-bit indices are supported. 461 #define BGFX_CAPS_INSTANCING UINT64_C(0x0000000000002000) //!< Instancing is supported. 462 #define BGFX_CAPS_OCCLUSION_QUERY UINT64_C(0x0000000000004000) //!< Occlusion query is supported. 463 #define BGFX_CAPS_RENDERER_MULTITHREADED UINT64_C(0x0000000000008000) //!< Renderer is on separate thread. 464 #define BGFX_CAPS_SWAP_CHAIN UINT64_C(0x0000000000010000) //!< Multiple windows are supported. 465 #define BGFX_CAPS_TEXTURE_2D_ARRAY UINT64_C(0x0000000000020000) //!< 2D texture array is supported. 466 #define BGFX_CAPS_TEXTURE_3D UINT64_C(0x0000000000040000) //!< 3D textures are supported. 467 #define BGFX_CAPS_TEXTURE_BLIT UINT64_C(0x0000000000080000) //!< Texture blit is supported. 468 #define BGFX_CAPS_TEXTURE_COMPARE_RESERVED UINT64_C(0x0000000000100000) //!< All texture compare modes are supported. 469 #define BGFX_CAPS_TEXTURE_COMPARE_LEQUAL UINT64_C(0x0000000000200000) //!< Texture compare less equal mode is supported. 470 #define BGFX_CAPS_TEXTURE_CUBE_ARRAY UINT64_C(0x0000000000400000) //!< Cubemap texture array is supported. 471 #define BGFX_CAPS_TEXTURE_DIRECT_ACCESS UINT64_C(0x0000000000800000) //!< CPU direct access to GPU texture memory. 472 #define BGFX_CAPS_TEXTURE_READ_BACK UINT64_C(0x0000000001000000) //!< Read-back texture is supported. 473 #define BGFX_CAPS_VERTEX_ATTRIB_HALF UINT64_C(0x0000000002000000) //!< Vertex attribute half-float is supported. 474 #define BGFX_CAPS_VERTEX_ATTRIB_UINT10 UINT64_C(0x0000000004000000) //!< Vertex attribute 10_10_10_2 is supported. 475 #define BGFX_CAPS_VERTEX_ID UINT64_C(0x0000000008000000) //!< Rendering with VertexID only is supported. 476 /// All texture compare modes are supported. 477 #define BGFX_CAPS_TEXTURE_COMPARE_ALL (0 \ 478 | BGFX_CAPS_TEXTURE_COMPARE_RESERVED \ 479 | BGFX_CAPS_TEXTURE_COMPARE_LEQUAL \ 480 ) 481 482 483 #define BGFX_CAPS_FORMAT_TEXTURE_NONE UINT16_C(0x0000) //!< Texture format is not supported. 484 #define BGFX_CAPS_FORMAT_TEXTURE_2D UINT16_C(0x0001) //!< Texture format is supported. 485 #define BGFX_CAPS_FORMAT_TEXTURE_2D_SRGB UINT16_C(0x0002) //!< Texture as sRGB format is supported. 486 #define BGFX_CAPS_FORMAT_TEXTURE_2D_EMULATED UINT16_C(0x0004) //!< Texture format is emulated. 487 #define BGFX_CAPS_FORMAT_TEXTURE_3D UINT16_C(0x0008) //!< Texture format is supported. 488 #define BGFX_CAPS_FORMAT_TEXTURE_3D_SRGB UINT16_C(0x0010) //!< Texture as sRGB format is supported. 489 #define BGFX_CAPS_FORMAT_TEXTURE_3D_EMULATED UINT16_C(0x0020) //!< Texture format is emulated. 490 #define BGFX_CAPS_FORMAT_TEXTURE_CUBE UINT16_C(0x0040) //!< Texture format is supported. 491 #define BGFX_CAPS_FORMAT_TEXTURE_CUBE_SRGB UINT16_C(0x0080) //!< Texture as sRGB format is supported. 492 #define BGFX_CAPS_FORMAT_TEXTURE_CUBE_EMULATED UINT16_C(0x0100) //!< Texture format is emulated. 493 #define BGFX_CAPS_FORMAT_TEXTURE_VERTEX UINT16_C(0x0200) //!< Texture format can be used from vertex shader. 494 #define BGFX_CAPS_FORMAT_TEXTURE_IMAGE UINT16_C(0x0400) //!< Texture format can be used as image from compute shader. 495 #define BGFX_CAPS_FORMAT_TEXTURE_FRAMEBUFFER UINT16_C(0x0800) //!< Texture format can be used as frame buffer. 496 #define BGFX_CAPS_FORMAT_TEXTURE_FRAMEBUFFER_MSAA UINT16_C(0x1000) //!< Texture format can be used as MSAA frame buffer. 497 #define BGFX_CAPS_FORMAT_TEXTURE_MSAA UINT16_C(0x2000) //!< Texture can be sampled as MSAA. 498 #define BGFX_CAPS_FORMAT_TEXTURE_MIP_AUTOGEN UINT16_C(0x4000) //!< Texture format supports auto-generated mips. 499 500 #define BGFX_RESOLVE_NONE UINT8_C(0x00) //!< No resolve flags. 501 #define BGFX_RESOLVE_AUTO_GEN_MIPS UINT8_C(0x01) //!< Auto-generate mip maps on resolve. 502 503 #define BGFX_PCI_ID_NONE UINT16_C(0x0000) //!< Autoselect adapter. 504 #define BGFX_PCI_ID_SOFTWARE_RASTERIZER UINT16_C(0x0001) //!< Software rasterizer. 505 #define BGFX_PCI_ID_AMD UINT16_C(0x1002) //!< AMD adapter. 506 #define BGFX_PCI_ID_INTEL UINT16_C(0x8086) //!< Intel adapter. 507 #define BGFX_PCI_ID_NVIDIA UINT16_C(0x10de) //!< nVidia adapter. 508 509 #define BGFX_CUBE_MAP_POSITIVE_X UINT8_C(0x00) //!< Cubemap +x. 510 #define BGFX_CUBE_MAP_NEGATIVE_X UINT8_C(0x01) //!< Cubemap -x. 511 #define BGFX_CUBE_MAP_POSITIVE_Y UINT8_C(0x02) //!< Cubemap +y. 512 #define BGFX_CUBE_MAP_NEGATIVE_Y UINT8_C(0x03) //!< Cubemap -y. 513 #define BGFX_CUBE_MAP_POSITIVE_Z UINT8_C(0x04) //!< Cubemap +z. 514 #define BGFX_CUBE_MAP_NEGATIVE_Z UINT8_C(0x05) //!< Cubemap -z. 515 516 517 /// Blend function separate. 518 #define BGFX_STATE_BLEND_FUNC_SEPARATE(_srcRGB, _dstRGB, _srcA, _dstA) (UINT64_C(0) \ 519 | ( ( (uint64_t)(_srcRGB)|( (uint64_t)(_dstRGB)<<4) ) ) \ 520 | ( ( (uint64_t)(_srcA )|( (uint64_t)(_dstA )<<4) )<<8) \ 521 ) 522 523 /// Blend equation separate. 524 #define BGFX_STATE_BLEND_EQUATION_SEPARATE(_equationRGB, _equationA) ( (uint64_t)(_equationRGB)|( (uint64_t)(_equationA)<<3) ) 525 526 /// Blend function. 527 #define BGFX_STATE_BLEND_FUNC(_src, _dst) BGFX_STATE_BLEND_FUNC_SEPARATE(_src, _dst, _src, _dst) 528 529 /// Blend equation. 530 #define BGFX_STATE_BLEND_EQUATION(_equation) BGFX_STATE_BLEND_EQUATION_SEPARATE(_equation, _equation) 531 532 /// Utility predefined blend modes. 533 534 /// Additive blending. 535 #define BGFX_STATE_BLEND_ADD (0 \ 536 | BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_ONE, BGFX_STATE_BLEND_ONE) \ 537 ) 538 539 /// Alpha blend. 540 #define BGFX_STATE_BLEND_ALPHA (0 \ 541 | BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_SRC_ALPHA, BGFX_STATE_BLEND_INV_SRC_ALPHA) \ 542 ) 543 544 /// Selects darker color of blend. 545 #define BGFX_STATE_BLEND_DARKEN (0 \ 546 | BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_ONE, BGFX_STATE_BLEND_ONE) \ 547 | BGFX_STATE_BLEND_EQUATION(BGFX_STATE_BLEND_EQUATION_MIN) \ 548 ) 549 550 /// Selects lighter color of blend. 551 #define BGFX_STATE_BLEND_LIGHTEN (0 \ 552 | BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_ONE, BGFX_STATE_BLEND_ONE) \ 553 | BGFX_STATE_BLEND_EQUATION(BGFX_STATE_BLEND_EQUATION_MAX) \ 554 ) 555 556 /// Multiplies colors. 557 #define BGFX_STATE_BLEND_MULTIPLY (0 \ 558 | BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_DST_COLOR, BGFX_STATE_BLEND_ZERO) \ 559 ) 560 561 /// Opaque pixels will cover the pixels directly below them without any math or algorithm applied to them. 562 #define BGFX_STATE_BLEND_NORMAL (0 \ 563 | BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_ONE, BGFX_STATE_BLEND_INV_SRC_ALPHA) \ 564 ) 565 566 /// Multiplies the inverse of the blend and base colors. 567 #define BGFX_STATE_BLEND_SCREEN (0 \ 568 | BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_ONE, BGFX_STATE_BLEND_INV_SRC_COLOR) \ 569 ) 570 571 /// Decreases the brightness of the base color based on the value of the blend color. 572 #define BGFX_STATE_BLEND_LINEAR_BURN (0 \ 573 | BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_DST_COLOR, BGFX_STATE_BLEND_INV_DST_COLOR) \ 574 | BGFX_STATE_BLEND_EQUATION(BGFX_STATE_BLEND_EQUATION_SUB) \ 575 ) 576 577 /// 578 #define BGFX_STATE_BLEND_FUNC_RT_x(_src, _dst) (0 \ 579 | ( (uint32_t)( (_src)>>BGFX_STATE_BLEND_SHIFT) \ 580 | ( (uint32_t)( (_dst)>>BGFX_STATE_BLEND_SHIFT)<<4) ) \ 581 ) 582 583 /// 584 #define BGFX_STATE_BLEND_FUNC_RT_xE(_src, _dst, _equation) (0 \ 585 | BGFX_STATE_BLEND_FUNC_RT_x(_src, _dst) \ 586 | ( (uint32_t)( (_equation)>>BGFX_STATE_BLEND_EQUATION_SHIFT)<<8) \ 587 ) 588 589 #define BGFX_STATE_BLEND_FUNC_RT_1(_src, _dst) (BGFX_STATE_BLEND_FUNC_RT_x(_src, _dst)<< 0) 590 #define BGFX_STATE_BLEND_FUNC_RT_2(_src, _dst) (BGFX_STATE_BLEND_FUNC_RT_x(_src, _dst)<<11) 591 #define BGFX_STATE_BLEND_FUNC_RT_3(_src, _dst) (BGFX_STATE_BLEND_FUNC_RT_x(_src, _dst)<<22) 592 593 #define BGFX_STATE_BLEND_FUNC_RT_1E(_src, _dst, _equation) (BGFX_STATE_BLEND_FUNC_RT_xE(_src, _dst, _equation)<< 0) 594 #define BGFX_STATE_BLEND_FUNC_RT_2E(_src, _dst, _equation) (BGFX_STATE_BLEND_FUNC_RT_xE(_src, _dst, _equation)<<11) 595 #define BGFX_STATE_BLEND_FUNC_RT_3E(_src, _dst, _equation) (BGFX_STATE_BLEND_FUNC_RT_xE(_src, _dst, _equation)<<22) 596 597 598 #endif // BGFX_DEFINES_H_HEADER_GUARD 599