Removed fixed function alpha test.

This commit is contained in:
bkaradzic 2013-03-08 21:54:08 -08:00
Родитель 4c02620a24
Коммит a165353896
4 изменённых файлов: 3 добавлений и 33 удалений

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

@ -12,7 +12,6 @@
/// ///
#define BGFX_STATE_DEPTH_WRITE UINT64_C(0x0000000000000001) #define BGFX_STATE_DEPTH_WRITE UINT64_C(0x0000000000000001)
#define BGFX_STATE_ALPHA_TEST UINT64_C(0x0000000000000004)
#define BGFX_STATE_ALPHA_WRITE UINT64_C(0x0000000000000008) #define BGFX_STATE_ALPHA_WRITE UINT64_C(0x0000000000000008)
#define BGFX_STATE_ALPHA_MASK UINT64_C(0x000000000000000c) #define BGFX_STATE_ALPHA_MASK UINT64_C(0x000000000000000c)
@ -27,17 +26,6 @@
#define BGFX_STATE_DEPTH_TEST_SHIFT 4 #define BGFX_STATE_DEPTH_TEST_SHIFT 4
#define BGFX_STATE_DEPTH_TEST_MASK UINT64_C(0x00000000000000f0) #define BGFX_STATE_DEPTH_TEST_MASK UINT64_C(0x00000000000000f0)
#define BGFX_STATE_ALPHA_TEST_LESS UINT64_C(0x0000000000000100)
#define BGFX_STATE_ALPHA_TEST_LEQUAL UINT64_C(0x0000000000000200)
#define BGFX_STATE_ALPHA_TEST_EQUAL UINT64_C(0x0000000000000300)
#define BGFX_STATE_ALPHA_TEST_GEQUAL UINT64_C(0x0000000000000400)
#define BGFX_STATE_ALPHA_TEST_GREATER UINT64_C(0x0000000000000500)
#define BGFX_STATE_ALPHA_TEST_NOTEQUAL UINT64_C(0x0000000000000600)
#define BGFX_STATE_ALPHA_TEST_NEVER UINT64_C(0x0000000000000700)
#define BGFX_STATE_ALPHA_TEST_ALWAYS UINT64_C(0x0000000000000800)
#define BGFX_STATE_ALPHA_TEST_SHIFT 8
#define BGFX_STATE_ALPHA_TEST_MASK UINT64_C(0x0000000000000f00)
#define BGFX_STATE_BLEND_ZERO UINT64_C(0x0000000000001000) #define BGFX_STATE_BLEND_ZERO UINT64_C(0x0000000000001000)
#define BGFX_STATE_BLEND_ONE UINT64_C(0x0000000000002000) #define BGFX_STATE_BLEND_ONE UINT64_C(0x0000000000002000)
#define BGFX_STATE_BLEND_SRC_COLOR UINT64_C(0x0000000000003000) #define BGFX_STATE_BLEND_SRC_COLOR UINT64_C(0x0000000000003000)
@ -719,9 +707,7 @@ namespace bgfx
/// @param _state State flags. Default state for primitive type is /// @param _state State flags. Default state for primitive type is
/// triangles. See: BGFX_STATE_DEFAULT. /// triangles. See: BGFX_STATE_DEFAULT.
/// ///
/// BGFX_STATE_ALPHA_TEST - Enable alpha test.
/// BGFX_STATE_ALPHA_WRITE - Enable alpha write. /// BGFX_STATE_ALPHA_WRITE - Enable alpha write.
/// BGFX_STATE_ALPHA_TEST_* - Alpha test function.
/// BGFX_STATE_DEPTH_WRITE - Enable depth write. /// BGFX_STATE_DEPTH_WRITE - Enable depth write.
/// BGFX_STATE_DEPTH_TEST_* - Depth test function. /// BGFX_STATE_DEPTH_TEST_* - Depth test function.
/// BGFX_STATE_BLEND_* - See NOTE: BGFX_STATE_BLEND_FUNC. /// BGFX_STATE_BLEND_* - See NOTE: BGFX_STATE_BLEND_FUNC.

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

@ -2193,7 +2193,7 @@ namespace bgfx
s_renderCtx.setRasterizerState(newFlags, wireframe); s_renderCtx.setRasterizerState(newFlags, wireframe);
} }
if ( (BGFX_STATE_ALPHA_TEST|BGFX_STATE_ALPHA_REF_MASK) & changedFlags) if (BGFX_STATE_ALPHA_REF_MASK & changedFlags)
{ {
uint32_t ref = (newFlags&BGFX_STATE_ALPHA_REF_MASK)>>BGFX_STATE_ALPHA_REF_SHIFT; uint32_t ref = (newFlags&BGFX_STATE_ALPHA_REF_MASK)>>BGFX_STATE_ALPHA_REF_SHIFT;
alphaRef = ref/255.0f; alphaRef = ref/255.0f;

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

@ -2345,12 +2345,10 @@ namespace bgfx
} }
} }
if ( (BGFX_STATE_ALPHA_TEST|BGFX_STATE_ALPHA_REF_MASK) & changedFlags) if (BGFX_STATE_ALPHA_REF_MASK & changedFlags)
{ {
uint32_t ref = (newFlags&BGFX_STATE_ALPHA_REF_MASK)>>BGFX_STATE_ALPHA_REF_SHIFT; uint32_t ref = (newFlags&BGFX_STATE_ALPHA_REF_MASK)>>BGFX_STATE_ALPHA_REF_SHIFT;
alphaRef = ref/255.0f; alphaRef = ref/255.0f;
DX_CHECK(device->SetRenderState(D3DRS_ALPHAREF, ref) );
DX_CHECK(device->SetRenderState(D3DRS_ALPHATESTENABLE, !!(BGFX_STATE_ALPHA_TEST & newFlags) ) );
} }
if ( (BGFX_STATE_PT_POINTS|BGFX_STATE_POINT_SIZE_MASK) & changedFlags) if ( (BGFX_STATE_PT_POINTS|BGFX_STATE_POINT_SIZE_MASK) & changedFlags)

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

@ -1848,9 +1848,6 @@ namespace bgfx
GL_CHECK(glDisable(GL_CULL_FACE) ); GL_CHECK(glDisable(GL_CULL_FACE) );
GL_CHECK(glDisable(GL_BLEND) ); GL_CHECK(glDisable(GL_BLEND) );
GL_CHECK(glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE) ); GL_CHECK(glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE) );
#if BGFX_CONFIG_RENDERER_OPENGL && BGFX_CONFIG_RENDERER_OPENGL < 31
GL_CHECK(glDisable(GL_ALPHA_TEST) );
#endif // BGFX_CONFIG_RENDERER_OPENGL && BGFX_CONFIG_RENDERER_OPENGL
Program& program = s_renderCtx.m_program[m_program.idx]; Program& program = s_renderCtx.m_program[m_program.idx];
GL_CHECK(glUseProgram(program.m_id) ); GL_CHECK(glUseProgram(program.m_id) );
@ -2495,21 +2492,10 @@ namespace bgfx
} }
} }
if ( (BGFX_STATE_ALPHA_TEST|BGFX_STATE_ALPHA_REF_MASK) & changedFlags) if (BGFX_STATE_ALPHA_REF_MASK & changedFlags)
{ {
uint32_t ref = (newFlags&BGFX_STATE_ALPHA_REF_MASK)>>BGFX_STATE_ALPHA_REF_SHIFT; uint32_t ref = (newFlags&BGFX_STATE_ALPHA_REF_MASK)>>BGFX_STATE_ALPHA_REF_SHIFT;
alphaRef = ref/255.0f; alphaRef = ref/255.0f;
#if BGFX_CONFIG_RENDERER_OPENGL && BGFX_CONFIG_RENDERER_OPENGL < 31
if (BGFX_STATE_ALPHA_TEST & newFlags)
{
GL_CHECK(glEnable(GL_ALPHA_TEST) );
}
else
{
GL_CHECK(glDisable(GL_ALPHA_TEST) );
}
#endif // BGFX_CONFIG_RENDERER_OPENGL && BGFX_CONFIG_RENDERER_OPENGL < 31
} }
#if BGFX_CONFIG_RENDERER_OPENGL #if BGFX_CONFIG_RENDERER_OPENGL