/* * Copyright 2011-2014 Branimir Karadzic. All rights reserved. * License: http://www.opensource.org/licenses/BSD-2-Clause */ #ifndef BGFX_DEFINES_H_HEADER_GUARD #define BGFX_DEFINES_H_HEADER_GUARD /// #define BGFX_STATE_RGB_WRITE UINT64_C(0x0000000000000001) #define BGFX_STATE_ALPHA_WRITE UINT64_C(0x0000000000000002) #define BGFX_STATE_DEPTH_WRITE UINT64_C(0x0000000000000004) #define BGFX_STATE_DEPTH_TEST_LESS UINT64_C(0x0000000000000010) #define BGFX_STATE_DEPTH_TEST_LEQUAL UINT64_C(0x0000000000000020) #define BGFX_STATE_DEPTH_TEST_EQUAL UINT64_C(0x0000000000000030) #define BGFX_STATE_DEPTH_TEST_GEQUAL UINT64_C(0x0000000000000040) #define BGFX_STATE_DEPTH_TEST_GREATER UINT64_C(0x0000000000000050) #define BGFX_STATE_DEPTH_TEST_NOTEQUAL UINT64_C(0x0000000000000060) #define BGFX_STATE_DEPTH_TEST_NEVER UINT64_C(0x0000000000000070) #define BGFX_STATE_DEPTH_TEST_ALWAYS UINT64_C(0x0000000000000080) #define BGFX_STATE_DEPTH_TEST_SHIFT 4 #define BGFX_STATE_DEPTH_TEST_MASK UINT64_C(0x00000000000000f0) #define BGFX_STATE_BLEND_ZERO UINT64_C(0x0000000000001000) #define BGFX_STATE_BLEND_ONE UINT64_C(0x0000000000002000) #define BGFX_STATE_BLEND_SRC_COLOR UINT64_C(0x0000000000003000) #define BGFX_STATE_BLEND_INV_SRC_COLOR UINT64_C(0x0000000000004000) #define BGFX_STATE_BLEND_SRC_ALPHA UINT64_C(0x0000000000005000) #define BGFX_STATE_BLEND_INV_SRC_ALPHA UINT64_C(0x0000000000006000) #define BGFX_STATE_BLEND_DST_ALPHA UINT64_C(0x0000000000007000) #define BGFX_STATE_BLEND_INV_DST_ALPHA UINT64_C(0x0000000000008000) #define BGFX_STATE_BLEND_DST_COLOR UINT64_C(0x0000000000009000) #define BGFX_STATE_BLEND_INV_DST_COLOR UINT64_C(0x000000000000a000) #define BGFX_STATE_BLEND_SRC_ALPHA_SAT UINT64_C(0x000000000000b000) #define BGFX_STATE_BLEND_FACTOR UINT64_C(0x000000000000c000) #define BGFX_STATE_BLEND_INV_FACTOR UINT64_C(0x000000000000d000) #define BGFX_STATE_BLEND_SHIFT 12 #define BGFX_STATE_BLEND_MASK UINT64_C(0x000000000ffff000) #define BGFX_STATE_BLEND_EQUATION_SUB UINT64_C(0x0000000010000000) #define BGFX_STATE_BLEND_EQUATION_REVSUB UINT64_C(0x0000000020000000) #define BGFX_STATE_BLEND_EQUATION_MIN UINT64_C(0x0000000030000000) #define BGFX_STATE_BLEND_EQUATION_MAX UINT64_C(0x0000000040000000) #define BGFX_STATE_BLEND_EQUATION_SHIFT 28 #define BGFX_STATE_BLEND_EQUATION_MASK UINT64_C(0x00000003f0000000) #define BGFX_STATE_BLEND_INDEPENDENT UINT64_C(0x0000000400000000) #define BGFX_STATE_CULL_CW UINT64_C(0x0000001000000000) #define BGFX_STATE_CULL_CCW UINT64_C(0x0000002000000000) #define BGFX_STATE_CULL_SHIFT 36 #define BGFX_STATE_CULL_MASK UINT64_C(0x0000003000000000) #define BGFX_STATE_ALPHA_REF_SHIFT 40 #define BGFX_STATE_ALPHA_REF_MASK UINT64_C(0x0000ff0000000000) #define BGFX_STATE_PT_TRISTRIP UINT64_C(0x0001000000000000) #define BGFX_STATE_PT_LINES UINT64_C(0x0002000000000000) #define BGFX_STATE_PT_POINTS UINT64_C(0x0003000000000000) #define BGFX_STATE_PT_SHIFT 48 #define BGFX_STATE_PT_MASK UINT64_C(0x0003000000000000) #define BGFX_STATE_POINT_SIZE_SHIFT 52 #define BGFX_STATE_POINT_SIZE_MASK UINT64_C(0x0ff0000000000000) #define BGFX_STATE_MSAA UINT64_C(0x1000000000000000) #define BGFX_STATE_RESERVED_MASK UINT64_C(0xe000000000000000) #define BGFX_STATE_NONE UINT64_C(0x0000000000000000) #define BGFX_STATE_MASK UINT64_C(0xffffffffffffffff) #define BGFX_STATE_DEFAULT (0 \ | BGFX_STATE_RGB_WRITE \ | BGFX_STATE_ALPHA_WRITE \ | BGFX_STATE_DEPTH_TEST_LESS \ | BGFX_STATE_DEPTH_WRITE \ | BGFX_STATE_CULL_CW \ | BGFX_STATE_MSAA \ ) #define BGFX_STATE_ALPHA_REF(_ref) ( (uint64_t(_ref)<>BGFX_STATE_BLEND_SHIFT) \ | ( uint32_t( (_dst)>>BGFX_STATE_BLEND_SHIFT)<<4) ) \ ) #define BGFX_STATE_BLEND_FUNC_RT_xE(_src, _dst, _equation) (0 \ | BGFX_STATE_BLEND_FUNC_RT_x(_src, _dst) \ | ( uint32_t( (_equation)>>BGFX_STATE_BLEND_EQUATION_SHIFT)<<8) \ ) #define BGFX_STATE_BLEND_FUNC_RT_1(_src, _dst) (BGFX_STATE_BLEND_FUNC_RT_x(_src, _dst)<< 0) #define BGFX_STATE_BLEND_FUNC_RT_2(_src, _dst) (BGFX_STATE_BLEND_FUNC_RT_x(_src, _dst)<<11) #define BGFX_STATE_BLEND_FUNC_RT_3(_src, _dst) (BGFX_STATE_BLEND_FUNC_RT_x(_src, _dst)<<22) #define BGFX_STATE_BLEND_FUNC_RT_1E(_src, _dst, _equation) (BGFX_STATE_BLEND_FUNC_RT_xE(_src, _dst, _equation)<< 0) #define BGFX_STATE_BLEND_FUNC_RT_2E(_src, _dst, _equation) (BGFX_STATE_BLEND_FUNC_RT_xE(_src, _dst, _equation)<<11) #define BGFX_STATE_BLEND_FUNC_RT_3E(_src, _dst, _equation) (BGFX_STATE_BLEND_FUNC_RT_xE(_src, _dst, _equation)<<22) /// #define BGFX_STENCIL_FUNC_REF_SHIFT 0 #define BGFX_STENCIL_FUNC_REF_MASK UINT32_C(0x000000ff) #define BGFX_STENCIL_FUNC_RMASK_SHIFT 8 #define BGFX_STENCIL_FUNC_RMASK_MASK UINT32_C(0x0000ff00) #define BGFX_STENCIL_TEST_LESS UINT32_C(0x00010000) #define BGFX_STENCIL_TEST_LEQUAL UINT32_C(0x00020000) #define BGFX_STENCIL_TEST_EQUAL UINT32_C(0x00030000) #define BGFX_STENCIL_TEST_GEQUAL UINT32_C(0x00040000) #define BGFX_STENCIL_TEST_GREATER UINT32_C(0x00050000) #define BGFX_STENCIL_TEST_NOTEQUAL UINT32_C(0x00060000) #define BGFX_STENCIL_TEST_NEVER UINT32_C(0x00070000) #define BGFX_STENCIL_TEST_ALWAYS UINT32_C(0x00080000) #define BGFX_STENCIL_TEST_SHIFT 16 #define BGFX_STENCIL_TEST_MASK UINT32_C(0x000f0000) #define BGFX_STENCIL_OP_FAIL_S_ZERO UINT32_C(0x00000000) #define BGFX_STENCIL_OP_FAIL_S_KEEP UINT32_C(0x00100000) #define BGFX_STENCIL_OP_FAIL_S_REPLACE UINT32_C(0x00200000) #define BGFX_STENCIL_OP_FAIL_S_INCR UINT32_C(0x00300000) #define BGFX_STENCIL_OP_FAIL_S_INCRSAT UINT32_C(0x00400000) #define BGFX_STENCIL_OP_FAIL_S_DECR UINT32_C(0x00500000) #define BGFX_STENCIL_OP_FAIL_S_DECRSAT UINT32_C(0x00600000) #define BGFX_STENCIL_OP_FAIL_S_INVERT UINT32_C(0x00700000) #define BGFX_STENCIL_OP_FAIL_S_SHIFT 20 #define BGFX_STENCIL_OP_FAIL_S_MASK UINT32_C(0x00f00000) #define BGFX_STENCIL_OP_FAIL_Z_ZERO UINT32_C(0x00000000) #define BGFX_STENCIL_OP_FAIL_Z_KEEP UINT32_C(0x01000000) #define BGFX_STENCIL_OP_FAIL_Z_REPLACE UINT32_C(0x02000000) #define BGFX_STENCIL_OP_FAIL_Z_INCR UINT32_C(0x03000000) #define BGFX_STENCIL_OP_FAIL_Z_INCRSAT UINT32_C(0x04000000) #define BGFX_STENCIL_OP_FAIL_Z_DECR UINT32_C(0x05000000) #define BGFX_STENCIL_OP_FAIL_Z_DECRSAT UINT32_C(0x06000000) #define BGFX_STENCIL_OP_FAIL_Z_INVERT UINT32_C(0x07000000) #define BGFX_STENCIL_OP_FAIL_Z_SHIFT 24 #define BGFX_STENCIL_OP_FAIL_Z_MASK UINT32_C(0x0f000000) #define BGFX_STENCIL_OP_PASS_Z_ZERO UINT32_C(0x00000000) #define BGFX_STENCIL_OP_PASS_Z_KEEP UINT32_C(0x10000000) #define BGFX_STENCIL_OP_PASS_Z_REPLACE UINT32_C(0x20000000) #define BGFX_STENCIL_OP_PASS_Z_INCR UINT32_C(0x30000000) #define BGFX_STENCIL_OP_PASS_Z_INCRSAT UINT32_C(0x40000000) #define BGFX_STENCIL_OP_PASS_Z_DECR UINT32_C(0x50000000) #define BGFX_STENCIL_OP_PASS_Z_DECRSAT UINT32_C(0x60000000) #define BGFX_STENCIL_OP_PASS_Z_INVERT UINT32_C(0x70000000) #define BGFX_STENCIL_OP_PASS_Z_SHIFT 28 #define BGFX_STENCIL_OP_PASS_Z_MASK UINT32_C(0xf0000000) #define BGFX_STENCIL_NONE UINT32_C(0x00000000) #define BGFX_STENCIL_MASK UINT32_C(0xffffffff) #define BGFX_STENCIL_DEFAULT UINT32_C(0x00000000) #define BGFX_STENCIL_FUNC_REF(_ref) ( (uint32_t(_ref)<