Presentation is loading. Please wait.

Presentation is loading. Please wait.

Www.compaq.com Tiled Polygon Traversal Using Half-Plane Edge Functions Joel McCormack & Bob McNamara.

Similar presentations


Presentation on theme: "Www.compaq.com Tiled Polygon Traversal Using Half-Plane Edge Functions Joel McCormack & Bob McNamara."— Presentation transcript:

1 www.compaq.com Tiled Polygon Traversal Using Half-Plane Edge Functions Joel McCormack & Bob McNamara

2 www.compaq.com What Do You Want To Do?  Partition screen into rectangular tiles  Visit all locations in triangle in one tile before any in the next tile

3 www.compaq.com Why Do You Want To Do That?  Improve frame buffer memory access patterns DRAM access to open page faster than non-open page Staying on open page improves average access time... …and improves prefetching of pages into other banks  Improve texture cache access patterns Staying within limited area increases cache hits by exploiting 2D spatial coherency of texel accesses

4 www.compaq.com Outline  Half-Plane Edge Functions  Fragment Stamp and Movement  A Simple Traversal Algorithm  A Tiling Traversal Algoriththm  Uses of Tiling and Even Metatiling  Conclusions

5 www.compaq.com Half-Plane Edge Functions  Many rasterizers traverse polygons by surrounding them with edge functions going from vertex to vertex  E 01 ( x, y ) = ( x – x 0 )( y 1 – y 0 ) – ( y – y 0 )( x 1 – x 0 ) splits 2D plane into two halves: Non-negative on or to right of edge Negative to left of edge  If all edge functions at (x, y ) have same sign, then ( x, y ) is within polygon

6 www.compaq.com Triangle Surrounded By Edge Functions  Non-negative half-planes have “shadow” lines  All three edges non-negative in shaded yellow area

7 www.compaq.com Zen and the Art of Polygon Traversal  Scanline traversal like being in the military: Start exactly right here Go exactly to there, then stop Repeat  Half-plane traversal more like Zen wandering to enlightenment: Where am I? Where can I go? Have I reached my limits? Okay, how about that away? (For now.)

8 www.compaq.com Fragment Stamp: Fragment Sample Points and Probe Points   marks sample point: is fragment inside object?   marks probe point: combine to determine if more object to left, right, above, below?

9 www.compaq.com Fragment Stamp: Which Adjacent Stamp Positions Are Valid?  Does a stamp segment, e.g. ( RB, LB ), intersect the object (and thus indicate valid adjacent position)?  Probably, if: Each edge contains at least one stamp segment endpoint Object’s bounding box contains at least one stamp segment endpoint

10 www.compaq.com Non-Tiling Traversal Example 0. Traverse first stampline 1. Traverse stamplines above 2. Traverse stamplines below Zen, yeah right. Looks like goofy scanline traversal

11 www.compaq.com A Non-Tiling Traversal Algorithm Starting at leftmost vertex... 0. Proceed right as long as valid position Save first valid up position Save first valid down position 1. Jump to saved up, proceed right as long as valid Save first valid up, repeat 1 until no more up 2. Jump to saved down, proceed right as long as valid Save first valid down, repeat 2 until no more down

12 www.compaq.com Tiling Traversal Observations  Easy to obey top and bottom tile boundaries Go down from initial scanline until hit tile bottom Then do original algorithm starting at Step 1 (go up)  Need new saved state to obey right tile boundary Original algorithm, but stop at right tile boundary, and save first right position in next tile over Traverse all of object in first tile column Then move to saved right position and restart algorithm  Combine both to obey all tile boundaries

13 www.compaq.com Tiling Traversal Example 0. Traverse first stampline in tile ½. Traverse stamplines below in same tile 1. Traverse stamplines above in tile column 2. Traverse stamplines below in tile column (then next column) Let’s see a grubby scanline algorithm do that!

14 www.compaq.com A Tiling Traversal Algorithm 0. Proceed right as long as valid position and in same tile Save first valid up and down positions ½. Jump to saved down, proceed right in same tile Save first valid down, repeat ½ while down in same tile 1. Jump to saved up, proceed right in same tile Save first valid up, repeat 1 until no more up 2. Jump to saved down, proceed right in same tile Save first valid down, repeat 2 until no more down 3. Jump to saved right (in new tile), go back to Step 0

15 www.compaq.com Obvious Uses for Tiling  Optimize frame buffer access patterns Tile size & dimensions match 2D page in frame buffer All positions in object & page visited before new page Increases available time to prefetch next page Serpentine variation reduces non-prefetchable crossings  Reduce texture cache miss rate Tile size related to texture cache size Tile dimensions long and skinny to minimize texture fetches that will suffer capacity misses

16 www.compaq.com Subset Metatiling  Visit all location in tile before next tile, and all tiles in metatile before next metatile  Requires three additional save states, though

17 www.compaq.com Subset Metatiling Uses  Optimize hierarchical frame buffer caching Mitsubishi 3D-RAM has two cache levels  Optimize hierarchical texture caches  Or optimize frame buffer access and texture cache access simultaneously

18 www.compaq.com Non-Subset Metatiling  Tiles not contained by metatiles  Visit all locations in tile also in metatile before new tile

19 www.compaq.com Conclusions  Tiling is easy to add to a half-plane based rasterizer  Tiling increases frame buffer memory efficiency  Tiling increases effectiveness of texture cache  Scanline rasterizers should die a quiet death


Download ppt "Www.compaq.com Tiled Polygon Traversal Using Half-Plane Edge Functions Joel McCormack & Bob McNamara."

Similar presentations


Ads by Google