From a1653538960c9896d7a9a869fb17af99e0819894 Mon Sep 17 00:00:00 2001 From: bkaradzic Date: Fri, 8 Mar 2013 21:54:08 -0800 Subject: [PATCH] Removed fixed function alpha test. --- include/bgfx.h | 14 -------------- src/renderer_d3d11.cpp | 2 +- src/renderer_d3d9.cpp | 4 +--- src/renderer_gl.cpp | 16 +--------------- 4 files changed, 3 insertions(+), 33 deletions(-) diff --git a/include/bgfx.h b/include/bgfx.h index 73db1063..f7d3a918 100644 --- a/include/bgfx.h +++ b/include/bgfx.h @@ -12,7 +12,6 @@ /// #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_MASK UINT64_C(0x000000000000000c) @@ -27,17 +26,6 @@ #define BGFX_STATE_DEPTH_TEST_SHIFT 4 #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_ONE UINT64_C(0x0000000000002000) #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 /// triangles. See: BGFX_STATE_DEFAULT. /// - /// BGFX_STATE_ALPHA_TEST - Enable alpha test. /// BGFX_STATE_ALPHA_WRITE - Enable alpha write. - /// BGFX_STATE_ALPHA_TEST_* - Alpha test function. /// BGFX_STATE_DEPTH_WRITE - Enable depth write. /// BGFX_STATE_DEPTH_TEST_* - Depth test function. /// BGFX_STATE_BLEND_* - See NOTE: BGFX_STATE_BLEND_FUNC. diff --git a/src/renderer_d3d11.cpp b/src/renderer_d3d11.cpp index 7eefc506..1c104535 100644 --- a/src/renderer_d3d11.cpp +++ b/src/renderer_d3d11.cpp @@ -2193,7 +2193,7 @@ namespace bgfx 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; alphaRef = ref/255.0f; diff --git a/src/renderer_d3d9.cpp b/src/renderer_d3d9.cpp index a528f0b0..7023cd46 100644 --- a/src/renderer_d3d9.cpp +++ b/src/renderer_d3d9.cpp @@ -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; 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) diff --git a/src/renderer_gl.cpp b/src/renderer_gl.cpp index 543ae2cf..262d6c73 100644 --- a/src/renderer_gl.cpp +++ b/src/renderer_gl.cpp @@ -1848,9 +1848,6 @@ namespace bgfx GL_CHECK(glDisable(GL_CULL_FACE) ); GL_CHECK(glDisable(GL_BLEND) ); 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]; 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; 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