From 5428f67a5532b4b5a18cfd9dce04fc7c2bb936ab Mon Sep 17 00:00:00 2001 From: havoc Date: Sat, 2 Apr 2011 16:55:32 +0000 Subject: [PATCH] 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 --- dpsoftrast.c | 7 +++++++ 1 file changed, 7 insertions(+) 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; -- 2.39.2