Tiled Polygon Traversal Using Half-Plane Edge Functions - PowerPoint PPT Presentation

About This Presentation
Title:

Tiled Polygon Traversal Using Half-Plane Edge Functions

Description:

What Do You Want To Do? Partition screen into rectangular tiles ... Serpentine variation reduces non-prefetchable crossings. Reduce texture cache miss rate ... – PowerPoint PPT presentation

Number of Views:117
Avg rating:3.0/5.0
Slides: 20
Provided by: larrys7
Category:

less

Transcript and Presenter's Notes

Title: Tiled Polygon Traversal Using Half-Plane Edge Functions


1
Tiled Polygon Traversal Using Half-Plane Edge
Functions
  • Joel McCormack Bob McNamara

2
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
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
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
Half-Plane Edge Functions
  • Many rasterizers traverse polygons by surrounding
    them with edge functions going from vertex to
    vertex
  • E01(x, y) (x x0)(y1 y0) (y y0)(x1 x0)
    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
Triangle Surrounded By Edge Functions
  • Non-negative half-planes have shadow lines
  • All three edges non-negative in shaded yellow area

7
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
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
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
  • Objects bounding box contains at least one stamp
    segment endpoint

10
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
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
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
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)
Lets see a grubby scanline algorithm do that!
14
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
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
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
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
Non-Subset Metatiling
  • Tiles not contained by metatiles
  • Visit all locations in tile also in metatile
    before new tile

19
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
Write a Comment
User Comments (0)
About PowerShow.com