From a1cdb9175813db30b75993bda79f04ca0241f6ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=91=D1=80=D0=B0=D0=BD=D0=B8=D0=BC=D0=B8=D1=80=20=D0=9A?= =?UTF-8?q?=D0=B0=D1=80=D0=B0=D1=9F=D0=B8=D1=9B?= Date: Thu, 23 May 2019 20:31:36 -0700 Subject: [PATCH] IDL now generates defines.h --- include/bgfx/defines.h | 898 +++++++++++++++++++++-------------------- scripts/bgfx.idl | 86 ++-- scripts/codegen.lua | 34 +- scripts/genie.lua | 2 +- 4 files changed, 535 insertions(+), 485 deletions(-) diff --git a/include/bgfx/defines.h b/include/bgfx/defines.h index f6b80ad44..96643a7c4 100644 --- a/include/bgfx/defines.h +++ b/include/bgfx/defines.h @@ -8,121 +8,497 @@ #define BGFX_API_VERSION UINT32_C(99) -/// Color RGB/alpha/depth write. When it's not specified write will be disabled. -#define BGFX_STATE_WRITE_R UINT64_C(0x0000000000000001) //!< Enable R write. -#define BGFX_STATE_WRITE_G UINT64_C(0x0000000000000002) //!< Enable G write. -#define BGFX_STATE_WRITE_B UINT64_C(0x0000000000000004) //!< Enable B write. -#define BGFX_STATE_WRITE_A UINT64_C(0x0000000000000008) //!< Enable alpha write. -#define BGFX_STATE_WRITE_Z UINT64_C(0x0000004000000000) //!< Enable depth write. - +/** + * Color RGB/alpha/depth write. When it's not specified write will be disabled. + * + */ +#define BGFX_STATE_WRITE_R UINT64_C(0x0000000000000001) //!< Enable R write. +#define BGFX_STATE_WRITE_G UINT64_C(0x0000000000000002) //!< Enable G write. +#define BGFX_STATE_WRITE_B UINT64_C(0x0000000000000004) //!< Enable B write. +#define BGFX_STATE_WRITE_A UINT64_C(0x0000000000000008) //!< Enable alpha write. +#define BGFX_STATE_WRITE_Z UINT64_C(0x0000004000000000) //!< Enable depth write. /// Enable RGB write. #define BGFX_STATE_WRITE_RGB (0 \ - | BGFX_STATE_WRITE_R \ - | BGFX_STATE_WRITE_G \ - | BGFX_STATE_WRITE_B \ + | BGFX_STATE_WRITE_R \ + | BGFX_STATE_WRITE_G \ + | BGFX_STATE_WRITE_B \ ) /// Write all channels mask. #define BGFX_STATE_WRITE_MASK (0 \ - | BGFX_STATE_WRITE_RGB \ - | BGFX_STATE_WRITE_A \ - | BGFX_STATE_WRITE_Z \ + | BGFX_STATE_WRITE_RGB \ + | BGFX_STATE_WRITE_A \ + | BGFX_STATE_WRITE_Z \ ) -/// Depth test state. When `BGFX_STATE_DEPTH_` is not specified depth test will be disabled. -#define BGFX_STATE_DEPTH_TEST_LESS UINT64_C(0x0000000000000010) //!< Enable depth test, less. -#define BGFX_STATE_DEPTH_TEST_LEQUAL UINT64_C(0x0000000000000020) //!< Enable depth test, less or equal. -#define BGFX_STATE_DEPTH_TEST_EQUAL UINT64_C(0x0000000000000030) //!< Enable depth test, equal. -#define BGFX_STATE_DEPTH_TEST_GEQUAL UINT64_C(0x0000000000000040) //!< Enable depth test, greater or equal. -#define BGFX_STATE_DEPTH_TEST_GREATER UINT64_C(0x0000000000000050) //!< Enable depth test, greater. -#define BGFX_STATE_DEPTH_TEST_NOTEQUAL UINT64_C(0x0000000000000060) //!< Enable depth test, not equal. -#define BGFX_STATE_DEPTH_TEST_NEVER UINT64_C(0x0000000000000070) //!< Enable depth test, never. -#define BGFX_STATE_DEPTH_TEST_ALWAYS UINT64_C(0x0000000000000080) //!< Enable depth test, always. -#define BGFX_STATE_DEPTH_TEST_SHIFT 4 //!< Depth test state bit shift. -#define BGFX_STATE_DEPTH_TEST_MASK UINT64_C(0x00000000000000f0) //!< Depth test state bit mask. -/// Use BGFX_STATE_BLEND_FUNC(_src, _dst) or BGFX_STATE_BLEND_FUNC_SEPARATE(_srcRGB, _dstRGB, _srcA, _dstA) -/// helper macros. -#define BGFX_STATE_BLEND_ZERO UINT64_C(0x0000000000001000) //!< 0, 0, 0, 0 -#define BGFX_STATE_BLEND_ONE UINT64_C(0x0000000000002000) //!< 1, 1, 1, 1 -#define BGFX_STATE_BLEND_SRC_COLOR UINT64_C(0x0000000000003000) //!< Rs, Gs, Bs, As -#define BGFX_STATE_BLEND_INV_SRC_COLOR UINT64_C(0x0000000000004000) //!< 1-Rs, 1-Gs, 1-Bs, 1-As -#define BGFX_STATE_BLEND_SRC_ALPHA UINT64_C(0x0000000000005000) //!< As, As, As, As -#define BGFX_STATE_BLEND_INV_SRC_ALPHA UINT64_C(0x0000000000006000) //!< 1-As, 1-As, 1-As, 1-As -#define BGFX_STATE_BLEND_DST_ALPHA UINT64_C(0x0000000000007000) //!< Ad, Ad, Ad, Ad -#define BGFX_STATE_BLEND_INV_DST_ALPHA UINT64_C(0x0000000000008000) //!< 1-Ad, 1-Ad, 1-Ad ,1-Ad -#define BGFX_STATE_BLEND_DST_COLOR UINT64_C(0x0000000000009000) //!< Rd, Gd, Bd, Ad -#define BGFX_STATE_BLEND_INV_DST_COLOR UINT64_C(0x000000000000a000) //!< 1-Rd, 1-Gd, 1-Bd, 1-Ad -#define BGFX_STATE_BLEND_SRC_ALPHA_SAT UINT64_C(0x000000000000b000) //!< f, f, f, 1; f = min(As, 1-Ad) -#define BGFX_STATE_BLEND_FACTOR UINT64_C(0x000000000000c000) //!< Blend factor -#define BGFX_STATE_BLEND_INV_FACTOR UINT64_C(0x000000000000d000) //!< 1-Blend factor -#define BGFX_STATE_BLEND_SHIFT 12 //!< Blend state bit shift. -#define BGFX_STATE_BLEND_MASK UINT64_C(0x000000000ffff000) //!< Blend state bit mask. +/** + * Depth test state. When `BGFX_STATE_DEPTH_` is not specified depth test will be disabled. + * + */ +#define BGFX_STATE_DEPTH_TEST_LESS UINT64_C(0x0000000000000010) //!< Enable depth test, less. +#define BGFX_STATE_DEPTH_TEST_LEQUAL UINT64_C(0x0000000000000020) //!< Enable depth test, less or equal. +#define BGFX_STATE_DEPTH_TEST_EQUAL UINT64_C(0x0000000000000030) //!< Enable depth test, equal. +#define BGFX_STATE_DEPTH_TEST_GEQUAL UINT64_C(0x0000000000000040) //!< Enable depth test, greater or equal. +#define BGFX_STATE_DEPTH_TEST_GREATER UINT64_C(0x0000000000000050) //!< Enable depth test, greater. +#define BGFX_STATE_DEPTH_TEST_NOTEQUAL UINT64_C(0x0000000000000060) //!< Enable depth test, not equal. +#define BGFX_STATE_DEPTH_TEST_NEVER UINT64_C(0x0000000000000070) //!< Enable depth test, never. +#define BGFX_STATE_DEPTH_TEST_ALWAYS UINT64_C(0x0000000000000080) //!< Enable depth test, always. +#define BGFX_STATE_DEPTH_TEST_SHIFT 4 //!< Depth test state bit shift +#define BGFX_STATE_DEPTH_TEST_MASK UINT64_C(0x00000000000000f0) //!< Depth test state bit mask -/// Use BGFX_STATE_BLEND_EQUATION(_equation) or BGFX_STATE_BLEND_EQUATION_SEPARATE(_equationRGB, _equationA) -/// helper macros. -#define BGFX_STATE_BLEND_EQUATION_ADD UINT64_C(0x0000000000000000) //!< Blend add: src + dst. -#define BGFX_STATE_BLEND_EQUATION_SUB UINT64_C(0x0000000010000000) //!< Blend subtract: src - dst. -#define BGFX_STATE_BLEND_EQUATION_REVSUB UINT64_C(0x0000000020000000) //!< Blend reverse subtract: dst - src. -#define BGFX_STATE_BLEND_EQUATION_MIN UINT64_C(0x0000000030000000) //!< Blend min: min(src, dst). -#define BGFX_STATE_BLEND_EQUATION_MAX UINT64_C(0x0000000040000000) //!< Blend max: max(src, dst). -#define BGFX_STATE_BLEND_EQUATION_SHIFT 28 //!< Blend equation bit shift. -#define BGFX_STATE_BLEND_EQUATION_MASK UINT64_C(0x00000003f0000000) //!< Blend equation bit mask. +/** + * Use BGFX_STATE_BLEND_FUNC(_src, _dst) or BGFX_STATE_BLEND_FUNC_SEPARATE(_srcRGB, _dstRGB, _srcA, _dstA) + * helper macros. + * + */ +#define BGFX_STATE_BLEND_ZERO UINT64_C(0x0000000000001000) //!< 0, 0, 0, 0 +#define BGFX_STATE_BLEND_ONE UINT64_C(0x0000000000002000) //!< 1, 1, 1, 1 +#define BGFX_STATE_BLEND_SRC_COLOR UINT64_C(0x0000000000003000) //!< Rs, Gs, Bs, As +#define BGFX_STATE_BLEND_INV_SRC_COLOR UINT64_C(0x0000000000004000) //!< 1-Rs, 1-Gs, 1-Bs, 1-As +#define BGFX_STATE_BLEND_SRC_ALPHA UINT64_C(0x0000000000005000) //!< As, As, As, As +#define BGFX_STATE_BLEND_INV_SRC_ALPHA UINT64_C(0x0000000000006000) //!< 1-As, 1-As, 1-As, 1-As +#define BGFX_STATE_BLEND_DST_ALPHA UINT64_C(0x0000000000007000) //!< Ad, Ad, Ad, Ad +#define BGFX_STATE_BLEND_INV_DST_ALPHA UINT64_C(0x0000000000008000) //!< 1-Ad, 1-Ad, 1-Ad ,1-Ad +#define BGFX_STATE_BLEND_DST_COLOR UINT64_C(0x0000000000009000) //!< Rd, Gd, Bd, Ad +#define BGFX_STATE_BLEND_INV_DST_COLOR UINT64_C(0x000000000000a000) //!< 1-Rd, 1-Gd, 1-Bd, 1-Ad +#define BGFX_STATE_BLEND_SRC_ALPHA_SAT UINT64_C(0x000000000000b000) //!< f, f, f, 1; f = min(As, 1-Ad) +#define BGFX_STATE_BLEND_FACTOR UINT64_C(0x000000000000c000) //!< Blend factor +#define BGFX_STATE_BLEND_INV_FACTOR UINT64_C(0x000000000000d000) //!< 1-Blend factor +#define BGFX_STATE_BLEND_SHIFT 12 //!< Blend state bit shift +#define BGFX_STATE_BLEND_MASK UINT64_C(0x000000000ffff000) //!< Blend state bit mask -#define BGFX_STATE_BLEND_INDEPENDENT UINT64_C(0x0000000400000000) //!< Enable blend independent. -#define BGFX_STATE_BLEND_ALPHA_TO_COVERAGE UINT64_C(0x0000000800000000) //!< Enable alpha to coverage. +/** + * Use BGFX_STATE_BLEND_EQUATION(_equation) or BGFX_STATE_BLEND_EQUATION_SEPARATE(_equationRGB, _equationA) + * helper macros. + * + */ +#define BGFX_STATE_BLEND_EQUATION_ADD UINT64_C(0x0000000000000000) //!< Blend add: src + dst. +#define BGFX_STATE_BLEND_EQUATION_SUB UINT64_C(0x0000000010000000) //!< Blend subtract: src - dst. +#define BGFX_STATE_BLEND_EQUATION_REVSUB UINT64_C(0x0000000020000000) //!< Blend reverse subtract: dst - src. +#define BGFX_STATE_BLEND_EQUATION_MIN UINT64_C(0x0000000030000000) //!< Blend min: min(src, dst). +#define BGFX_STATE_BLEND_EQUATION_MAX UINT64_C(0x0000000040000000) //!< Blend max: max(src, dst). +#define BGFX_STATE_BLEND_EQUATION_SHIFT 28 //!< Blend equation bit shift +#define BGFX_STATE_BLEND_EQUATION_MASK UINT64_C(0x00000003f0000000) //!< Blend equation bit mask -/// Cull state. When `BGFX_STATE_CULL_*` is not specified culling will be disabled. -#define BGFX_STATE_CULL_CW UINT64_C(0x0000001000000000) //!< Cull clockwise triangles. -#define BGFX_STATE_CULL_CCW UINT64_C(0x0000002000000000) //!< Cull counter-clockwise triangles. -#define BGFX_STATE_CULL_SHIFT 36 //!< Culling mode bit shift. -#define BGFX_STATE_CULL_MASK UINT64_C(0x0000003000000000) //!< Culling mode bit mask. +/** + * Cull state. When `BGFX_STATE_CULL_*` is not specified culling will be disabled. + * + */ +#define BGFX_STATE_CULL_CW UINT64_C(0x0000001000000000) //!< Cull clockwise triangles. +#define BGFX_STATE_CULL_CCW UINT64_C(0x0000002000000000) //!< Cull counter-clockwise triangles. +#define BGFX_STATE_CULL_SHIFT 36 //!< Culling mode bit shift +#define BGFX_STATE_CULL_MASK UINT64_C(0x0000003000000000) //!< Culling mode bit mask -/// See BGFX_STATE_ALPHA_REF(_ref) helper macro. -#define BGFX_STATE_ALPHA_REF_SHIFT 40 //!< Alpha reference bit shift. -#define BGFX_STATE_ALPHA_REF_MASK UINT64_C(0x0000ff0000000000) //!< Alpha reference bit mask. +/** + * Alpha reference value. + * + */ +#define BGFX_STATE_ALPHA_REF_SHIFT 40 //!< Alpha reference bit shift +#define BGFX_STATE_ALPHA_REF_MASK UINT64_C(0x0000ff0000000000) //!< Alpha reference bit mask +#define BGFX_STATE_ALPHA_REF(v) ( ( (uint64_t)(v)<