diff --git a/src/bgfx_p.h b/src/bgfx_p.h index c876b684..60792225 100644 --- a/src/bgfx_p.h +++ b/src/bgfx_p.h @@ -700,9 +700,25 @@ namespace bgfx void operator=(const CommandBuffer&); }; -#define SORT_KEY_RENDER_DRAW (UINT64_C(1)<<0x36) -#define SORT_KEY_VIEW_SHIFT UINT8_C(0x37) -#define SORT_KEY_VIEW_MASK ( (uint64_t(BGFX_CONFIG_MAX_VIEWS-1) )<>0x2c)& 0x7ff; - m_view = uint8_t( (_key&SORT_KEY_VIEW_MASK)>>SORT_KEY_VIEW_SHIFT); - if (_key & SORT_KEY_RENDER_DRAW) + m_seq = uint16_t( (_key & SORT_KEY_SEQ_MASK ) >> SORT_KEY_SEQ_SHIFT); + m_view = uint8_t( (_key & SORT_KEY_VIEW_MASK) >> SORT_KEY_VIEW_SHIFT); + if (_key & SORT_KEY_DRAW_BIT) { - m_depth = _key & 0xffffffff; - m_program = (_key>>0x20)&(BGFX_CONFIG_MAX_PROGRAMS-1); - m_trans = (_key>>0x29)& 0x3; + m_depth = uint32_t( (_key & SORT_KEY_DRAW_DEPTH_MASK ) >> SORT_KEY_DRAW_DEPTH_SHIFT); + m_program = uint16_t( (_key & SORT_KEY_DRAW_PROGRAM_MASK) >> SORT_KEY_DRAW_PROGRAM_SHIFT); + m_trans = uint8_t( (_key & SORT_KEY_DRAW_TRANS_MASK ) >> SORT_KEY_DRAW_TRANS_SHIFT); return false; // draw } - m_program = (_key>>0x22)&(BGFX_CONFIG_MAX_PROGRAMS-1); + m_program = uint16_t( (_key & SORT_KEY_COMPUTE_PROGRAM_MASK) >> SORT_KEY_COMPUTE_PROGRAM_SHIFT); return true; // compute }