opaque/alphatest/alphablend sort order (#819)

This commit is contained in:
attilaz 2016-06-24 12:57:20 +02:00 committed by Branimir Karadžić
parent d4e41c98b2
commit 6941d506d2

View File

@ -1460,8 +1460,9 @@ namespace bgfx
void setState(uint64_t _state, uint32_t _rgba) void setState(uint64_t _state, uint32_t _rgba)
{ {
uint8_t blend = ( (_state&BGFX_STATE_BLEND_MASK)>>BGFX_STATE_BLEND_SHIFT)&0xff; uint8_t blend = ( (_state&BGFX_STATE_BLEND_MASK)>>BGFX_STATE_BLEND_SHIFT)&0xff;
uint8_t alphaRef = ( (_state&BGFX_STATE_ALPHA_REF_MASK)>>BGFX_STATE_ALPHA_REF_SHIFT)&0xff;
// transparency sort order table // transparency sort order table
m_key.m_trans = "\x0\x1\x1\x2\x2\x1\x2\x1\x2\x1\x1\x1\x1\x1\x1\x1\x1\x1\x1"[( (blend)&0xf) + (!!blend)]; m_key.m_trans = "\x0\x2\x2\x3\x3\x2\x3\x2\x3\x2\x2\x2\x2\x2\x2\x2\x2\x2\x2"[( (blend)&0xf) + (!!blend)] + !!alphaRef;
m_draw.m_stateFlags = _state; m_draw.m_stateFlags = _state;
m_draw.m_rgba = _rgba; m_draw.m_rgba = _rgba;
} }