From 99a7af712f9836c6f25fe65399136e707b94d1f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=91=D1=80=D0=B0=D0=BD=D0=B8=D0=BC=D0=B8=D1=80=20=D0=9A?= =?UTF-8?q?=D0=B0=D1=80=D0=B0=D1=9F=D0=B8=D1=9B?= Date: Sun, 26 Dec 2021 09:21:02 -0800 Subject: [PATCH] Added more info about transparency sort table. --- src/bgfx_p.h | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/src/bgfx_p.h b/src/bgfx_p.h index 218513d0a..d981a4054 100644 --- a/src/bgfx_p.h +++ b/src/bgfx_p.h @@ -2397,12 +2397,30 @@ namespace bgfx void setState(uint64_t _state, uint32_t _rgba) { - 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 + const uint8_t blend = ( (_state&BGFX_STATE_BLEND_MASK )>>BGFX_STATE_BLEND_SHIFT )&0xff; + const uint8_t alphaRef = ( (_state&BGFX_STATE_ALPHA_REF_MASK)>>BGFX_STATE_ALPHA_REF_SHIFT)&0xff; + + // Transparency sort order table: + // + // +----------------------------------------- BGFX_STATE_BLEND_ZERO + // | +-------------------------------------- BGFX_STATE_BLEND_ONE + // | | +----------------------------------- BGFX_STATE_BLEND_SRC_COLOR + // | | | +-------------------------------- BGFX_STATE_BLEND_INV_SRC_COLOR + // | | | | +----------------------------- BGFX_STATE_BLEND_SRC_ALPHA + // | | | | | +-------------------------- BGFX_STATE_BLEND_INV_SRC_ALPHA + // | | | | | | +----------------------- BGFX_STATE_BLEND_DST_ALPHA + // | | | | | | | +-------------------- BGFX_STATE_BLEND_INV_DST_ALPHA + // | | | | | | | | +----------------- BGFX_STATE_BLEND_DST_COLOR + // | | | | | | | | | +-------------- BGFX_STATE_BLEND_INV_DST_COLOR + // | | | | | | | | | | +----------- BGFX_STATE_BLEND_SRC_ALPHA_SAT + // | | | | | | | | | | | +-------- BGFX_STATE_BLEND_FACTOR + // | | | | | | | | | | | | +----- BGFX_STATE_BLEND_INV_FACTOR + // | | | | | | | | | | | | | + // x | | | | | | | | | | | | | x x x x x m_key.m_blend = "\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_rgba = _rgba; + m_draw.m_rgba = _rgba; } void setCondition(OcclusionQueryHandle _handle, bool _visible)