Tipsify
Encapsulates an algorithm to optimize triangles for the post vertex-shader cache. This is based on the 2007 SIGGRAPH paper 'Fast Triangle Reordering for Vertex Locality and Reduced Overdraw.' The runtime is linear but several passes are made.
- Fast Triangle Reordering for Vertex Locality and Reduced Overdraw by Sander, Nehab, and Barczak
See:
Source:
Methods
-
<static> calculateACMR
-
Calculates the average cache miss ratio (ACMR) for a given set of indices.
Parameters:
Name Type Argument Default Description description.indices
Array Lists triads of numbers corresponding to the indices of the vertices in the vertex buffer that define the geometry's triangles. description.maximumIndex
Number <optional>
The maximum value of the elements in args.indices
. If not supplied, this value will be computed.description.cacheSize
Number <optional>
24 The number of vertices that can be stored in the cache at any one time. Throws:
-
DeveloperError : indices is required.
-
DeveloperError : indices length must be a multiple of three.
-
DeveloperError : cacheSize must be greater than two.
Returns:
Number The average cache miss ratio (ACMR).Example
var indices = [0, 1, 2, 3, 4, 5]; var maxIndex = 5; var cacheSize = 3; var acmr = Tipsify.calculateACMR({indices : indices, maxIndex : maxIndex, cacheSize : cacheSize});
-
-
<static> tipsify
-
Optimizes triangles for the post-vertex shader cache.
Parameters:
Name Type Argument Default Description description.indices
Array Lists triads of numbers corresponding to the indices of the vertices in the vertex buffer that define the geometry's triangles. description.maximumIndex
Number <optional>
The maximum value of the elements in args.indices
. If not supplied, this value will be computed.description.cacheSize
Number <optional>
24 The number of vertices that can be stored in the cache at any one time. Throws:
-
DeveloperError : indices is required.
-
DeveloperError : indices length must be a multiple of three.
-
DeveloperError : cacheSize must be greater than two.
Returns:
Array A list of the input indices in an optimized order.Example
var indices = [0, 1, 2, 3, 4, 5]; var maxIndex = 5; var cacheSize = 3; var reorderedIndices = Tipsify.tipsify({indices : indices, maxIndex : maxIndex, cacheSize : cacheSize});
-