From ec02cd112d2af2881ee27b7e9471d092006eed57 Mon Sep 17 00:00:00 2001 From: vortex Date: Mon, 9 May 2011 11:28:12 +0000 Subject: [PATCH] Move Alpha-To-Coverage stuff to gl_backend.c, fix bug with shadows rendering. git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11139 d7cf8633-e32d-0410-b094-e92efae38249 ::stable-branch::merge=20cff5b6fe91a72c3ed5d287cfb73e51e2ab350d --- gl_backend.c | 8 ++++++++ gl_rmain.c | 16 ++++------------ r_shadow.c | 3 ++- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/gl_backend.c b/gl_backend.c index 6fc886ba..e8d2e640 100644 --- a/gl_backend.c +++ b/gl_backend.c @@ -2155,6 +2155,14 @@ void GL_AlphaTest(int state) break; case RENDERPATH_GL20: case RENDERPATH_GLES2: + if (vid_multisampling.integer) + { + if (gl_state.alphatest && r_transparent_alphatocoverage.integer) + qglEnable(GL_SAMPLE_ALPHA_TO_COVERAGE_ARB); + else + qglDisable(GL_SAMPLE_ALPHA_TO_COVERAGE_ARB); + CHECKGLERROR + } break; } } diff --git a/gl_rmain.c b/gl_rmain.c index 996fd2d9..eee8a48f 100644 --- a/gl_rmain.c +++ b/gl_rmain.c @@ -2092,20 +2092,12 @@ void R_SetupShader_Surface(const vec3_t lightcolorbase, qboolean modellighting, matrix4x4_t tempmatrix; r_waterstate_waterplane_t *waterplane = (r_waterstate_waterplane_t *)surfacewaterplane; if (rsurface.texture->currentmaterialflags & MATERIALFLAG_ALPHATEST) - permutation |= SHADERPERMUTATION_ALPHAKILL; - // Alpha to Coverage - // fixme: move to gl_backend - if (vid_multisampling.integer && r_transparent_alphatocoverage.integer) { - if (rsurface.texture->currentmaterialflags & MATERIALFLAG_ALPHATEST) - { - qglEnable(GL_SAMPLE_ALPHA_TO_COVERAGE_ARB);CHECKGLERROR - } - else - { - qglDisable(GL_SAMPLE_ALPHA_TO_COVERAGE_ARB);CHECKGLERROR - } + permutation |= SHADERPERMUTATION_ALPHAKILL; + GL_AlphaTest(true); } + else + GL_AlphaTest(false); if (rsurface.texture->r_water_waterscroll[0] && rsurface.texture->r_water_waterscroll[1]) permutation |= SHADERPERMUTATION_NORMALMAPSCROLLBLEND; // todo: make generic if (rsurfacepass == RSURFPASS_BACKGROUND) diff --git a/r_shadow.c b/r_shadow.c index 5b2a8190..47507cf9 100644 --- a/r_shadow.c +++ b/r_shadow.c @@ -1952,13 +1952,14 @@ void R_Shadow_RenderMode_Begin(void) CHECKGLERROR R_Mesh_ResetTextureState(); GL_BlendFunc(GL_ONE, GL_ZERO); + GL_AlphaTest(false); GL_DepthRange(0, 1); GL_PolygonOffset(r_refdef.polygonfactor, r_refdef.polygonoffset); GL_DepthTest(true); GL_DepthMask(false); GL_Color(0, 0, 0, 1); GL_Scissor(r_refdef.view.viewport.x, r_refdef.view.viewport.y, r_refdef.view.viewport.width, r_refdef.view.viewport.height); - + r_shadow_rendermode = R_SHADOW_RENDERMODE_NONE; if (gl_ext_separatestencil.integer && vid.support.ati_separate_stencil) -- 2.39.2