From: havoc Date: Sat, 2 Apr 2011 16:55:32 +0000 (+0000) Subject: slight optimization to 2D rendering - if triangle wslope is 0, don't X-Git-Tag: xonotic-v0.5.0~324 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=5a0449d8aad2704683b666dbcf444649e2da5618;p=xonotic%2Fdarkplaces.git slight optimization to 2D rendering - if triangle wslope is 0, don't bother doing any math, just fill the zf array git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11013 d7cf8633-e32d-0410-b094-e92efae38249 ::stable-branch::merge=5428f67a5532b4b5a18cfd9dce04fc7c2bb936ab --- diff --git a/dpsoftrast.c b/dpsoftrast.c index 29585470..13865e08 100644 --- a/dpsoftrast.c +++ b/dpsoftrast.c @@ -1989,6 +1989,13 @@ void DPSOFTRAST_Draw_Span_Begin(DPSOFTRAST_State_Thread *thread, const DPSOFTRAS float wslope = triangle->w[0]; float w = triangle->w[2] + span->x*wslope + span->y*triangle->w[1]; float endz = 1.0f / (w + wslope * startx); + if (triangle->w[0] == 0) + { + // LordHavoc: fast flat polygons (HUD/menu) + for (x = startx;x < endx;x++) + zf[x] = endz; + return; + } for (x = startx;x < endx;) { int nextsub = x + DPSOFTRAST_DRAW_MAXSUBSPAN, endsub = nextsub - 1;