Reserve 10 bits in sort key for view.

This commit is contained in:
Branimir Karadžić 2017-11-27 19:38:36 -08:00
Родитель be2c709812
Коммит cb60295e1b
1 изменённых файлов: 6 добавлений и 3 удалений

Просмотреть файл

@ -787,9 +787,10 @@ namespace bgfx
uint8_t m_buffer[BGFX_CONFIG_MAX_COMMAND_BUFFER_SIZE]; uint8_t m_buffer[BGFX_CONFIG_MAX_COMMAND_BUFFER_SIZE];
}; };
#define SORT_KEY_NUM_BITS_TRANS 2 //
#define SORK_KEY_NUM_BITS_VIEW 10
#define SORT_KEY_VIEW_SHIFT 56 #define SORT_KEY_VIEW_SHIFT (64-SORK_KEY_NUM_BITS_VIEW)
#define SORT_KEY_VIEW_MASK ( (uint64_t(BGFX_CONFIG_MAX_VIEWS-1) )<<SORT_KEY_VIEW_SHIFT) #define SORT_KEY_VIEW_MASK ( (uint64_t(BGFX_CONFIG_MAX_VIEWS-1) )<<SORT_KEY_VIEW_SHIFT)
#define SORT_KEY_DRAW_BIT_SHIFT (SORT_KEY_VIEW_SHIFT - 1) #define SORT_KEY_DRAW_BIT_SHIFT (SORT_KEY_VIEW_SHIFT - 1)
@ -806,6 +807,8 @@ namespace bgfx
#define SORT_KEY_DRAW_TYPE_SEQUENCE (UINT64_C(2)<<SORT_KEY_DRAW_TYPE_BIT_SHIFT) #define SORT_KEY_DRAW_TYPE_SEQUENCE (UINT64_C(2)<<SORT_KEY_DRAW_TYPE_BIT_SHIFT)
// //
#define SORT_KEY_NUM_BITS_TRANS 2
#define SORT_KEY_DRAW_0_TRANS_SHIFT (SORT_KEY_DRAW_TYPE_BIT_SHIFT - SORT_KEY_NUM_BITS_TRANS) #define SORT_KEY_DRAW_0_TRANS_SHIFT (SORT_KEY_DRAW_TYPE_BIT_SHIFT - SORT_KEY_NUM_BITS_TRANS)
#define SORT_KEY_DRAW_0_TRANS_MASK (UINT64_C(0x3)<<SORT_KEY_DRAW_0_TRANS_SHIFT) #define SORT_KEY_DRAW_0_TRANS_MASK (UINT64_C(0x3)<<SORT_KEY_DRAW_0_TRANS_SHIFT)
@ -842,7 +845,7 @@ namespace bgfx
#define SORT_KEY_COMPUTE_PROGRAM_SHIFT (SORT_KEY_COMPUTE_SEQ_SHIFT - BGFX_CONFIG_SORT_KEY_NUM_BITS_PROGRAM) #define SORT_KEY_COMPUTE_PROGRAM_SHIFT (SORT_KEY_COMPUTE_SEQ_SHIFT - BGFX_CONFIG_SORT_KEY_NUM_BITS_PROGRAM)
#define SORT_KEY_COMPUTE_PROGRAM_MASK ( (uint64_t(BGFX_CONFIG_MAX_PROGRAMS-1) )<<SORT_KEY_COMPUTE_PROGRAM_SHIFT) #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_VIEWS <= (1<<SORK_KEY_NUM_BITS_VIEW) );
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. BX_STATIC_ASSERT( (0 // Render key mask shouldn't overlap.
| SORT_KEY_VIEW_MASK | SORT_KEY_VIEW_MASK