mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-28 10:35:43 -05:00
SortKey: Added static check for overlaps.
This commit is contained in:
parent
d59cf406c0
commit
a02086c119
1 changed files with 30 additions and 4 deletions
34
src/bgfx_p.h
34
src/bgfx_p.h
|
@ -714,14 +714,40 @@ namespace bgfx
|
|||
#define SORT_KEY_DRAW_PROGRAM_SHIFT 0x20
|
||||
#define SORT_KEY_DRAW_PROGRAM_MASK ( (uint64_t(BGFX_CONFIG_MAX_PROGRAMS-1) )<<SORT_KEY_DRAW_PROGRAM_SHIFT)
|
||||
|
||||
#define SORT_KEY_COMPUTE_PROGRAM_SHIFT 0x22
|
||||
#define SORT_KEY_COMPUTE_PROGRAM_MASK ( (uint64_t(BGFX_CONFIG_MAX_PROGRAMS-1) )<<SORT_KEY_COMPUTE_PROGRAM_SHIFT)
|
||||
|
||||
#define SORT_KEY_DRAW_DEPTH_SHIFT 0
|
||||
#define SORT_KEY_DRAW_DEPTH_MASK ( (uint64_t(UINT32_MAX) )<<SORT_KEY_DRAW_DEPTH_SHIFT)
|
||||
|
||||
#define SORT_KEY_COMPUTE_PROGRAM_SHIFT 0x22
|
||||
#define SORT_KEY_COMPUTE_PROGRAM_MASK ( (uint64_t(BGFX_CONFIG_MAX_PROGRAMS-1) )<<SORT_KEY_COMPUTE_PROGRAM_SHIFT)
|
||||
|
||||
BX_STATIC_ASSERT(BGFX_CONFIG_MAX_VIEWS <= 256);
|
||||
BX_STATIC_ASSERT( (BGFX_CONFIG_MAX_PROGRAMS & (BGFX_CONFIG_MAX_PROGRAMS-1) ) == 0); // must be power of 2
|
||||
BX_STATIC_ASSERT( (BGFX_CONFIG_MAX_PROGRAMS & (BGFX_CONFIG_MAX_PROGRAMS-1) ) == 0); // Must be power of 2.
|
||||
BX_STATIC_ASSERT( (0 // Render key mask shouldn't overlap.
|
||||
| SORT_KEY_DRAW_BIT
|
||||
| SORT_KEY_SEQ_MASK
|
||||
| SORT_KEY_VIEW_MASK
|
||||
| SORT_KEY_DRAW_TRANS_MASK
|
||||
| SORT_KEY_DRAW_PROGRAM_MASK
|
||||
| SORT_KEY_DRAW_DEPTH_MASK
|
||||
) == (0
|
||||
^ SORT_KEY_DRAW_BIT
|
||||
^ SORT_KEY_SEQ_MASK
|
||||
^ SORT_KEY_VIEW_MASK
|
||||
^ SORT_KEY_DRAW_TRANS_MASK
|
||||
^ SORT_KEY_DRAW_PROGRAM_MASK
|
||||
^ SORT_KEY_DRAW_DEPTH_MASK
|
||||
) );
|
||||
BX_STATIC_ASSERT( (0 // Compute key mask shouldn't overlap.
|
||||
| SORT_KEY_DRAW_BIT
|
||||
| SORT_KEY_SEQ_MASK
|
||||
| SORT_KEY_VIEW_MASK
|
||||
| SORT_KEY_COMPUTE_PROGRAM_MASK
|
||||
) == (0
|
||||
^ SORT_KEY_DRAW_BIT
|
||||
^ SORT_KEY_SEQ_MASK
|
||||
^ SORT_KEY_VIEW_MASK
|
||||
^ SORT_KEY_COMPUTE_PROGRAM_MASK
|
||||
) );
|
||||
|
||||
struct SortKey
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue