Forum

Drawspans optimization in C for software Quake

Post tutorials on how to do certain tasks within game or engine code here.

Moderator: InsideQC Admins

Postby mankrip » Mon Nov 15, 2010 2:28 am

Lower resolutions should generate a lower number of count cycles in comparison to spancount cycles. Is it also slower at higher resolutions?

And on a side note, that stippled version I've posted above is broken at the remainder ( if (spancount > 0) ) part.
Ph'nglui mglw'nafh mankrip Hell's end wgah'nagl fhtagn.
==-=-=-=-=-=-=-=-=-=-==
Dev blog / Twitter / YouTube
User avatar
mankrip
 
Posts: 915
Joined: Fri Jul 04, 2008 3:02 am

Re: Drawspans optimization in C for software Quake

Postby mankrip » Sat Oct 18, 2014 6:26 am

While working on something else, I've found out that bbextents and bbextentt are always the same for turbulent surfaces. So, all instances of them in the water drawing code can be replaced with this macro:
Code: Select all
#define BBEXTENT ((16384 << 16) - 1) // 16384 = 64 << 8 // -1 (-epsilon) so we never wander off the edge of the texture

But all the bbextents and bbextentt checks can probably be removed completely, because since turbulent surfaces uses tiled power-of-two textures, bitmasking the texel location with &63 at drawing time can take care of that.
Ph'nglui mglw'nafh mankrip Hell's end wgah'nagl fhtagn.
==-=-=-=-=-=-=-=-=-=-==
Dev blog / Twitter / YouTube
User avatar
mankrip
 
Posts: 915
Joined: Fri Jul 04, 2008 3:02 am

Re: Drawspans optimization in C for software Quake

Postby mankrip » Fri May 01, 2015 7:11 pm

Negative indexes are really bad for stippling and for dithering, because they screw up bit parity consistency (*pdest&1).
My current code uses positive indexes for everything.
Ph'nglui mglw'nafh mankrip Hell's end wgah'nagl fhtagn.
==-=-=-=-=-=-=-=-=-=-==
Dev blog / Twitter / YouTube
User avatar
mankrip
 
Posts: 915
Joined: Fri Jul 04, 2008 3:02 am

Previous

Return to Programming Tutorials

Who is online

Users browsing this forum: No registered users and 2 guests