Skip to content

Instantly share code, notes, and snippets.

@donmccurdy
Created March 17, 2024 14:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save donmccurdy/57ef4daf30bd7de5e475b5d684ff7fc1 to your computer and use it in GitHub Desktop.
Save donmccurdy/57ef4daf30bd7de5e475b5d684ff7fc1 to your computer and use it in GitHub Desktop.
Draft enum, describing different methods for computing vertex counts.
/**
* Various methods of estimating a vertex count. For some background on why
* multiple definitions of a vertex count should exist, see [_Vertex Count
* Higher in Engine than in 3D Software_](https://shahriyarshahrabi.medium.com/vertex-count-higher-in-engine-than-in-3d-software-badc348ada66).
*
* NOTICE: Many rendering features, such as volumetric transmission, may lead
* to additional passes over some or all vertices. Such tradeoffs are
* implementation-dependent, and not considered here.
*/
export enum VertexCountMethod {
/**
* Expected number of vertices processed by the vertex shader for one render
* pass, without considering the vertex cache.
*/
RENDER = 'render',
/**
* Expected number of vertices proceessed by the vertex shader for one render
* pass, assuming a 100% hit ratio on the vertex cache. Assumes vertex attributes
* have been optimized for locality of reused references (see {@link reorder}).
* Typical GPU vertex caches are small, holding 16-32 vertices, and rarely
* achieve 100% hit ratios in practice.
*/
RENDER_OPTIMISTIC = 'render-optimistic',
/**
* Expected number of vertices uploaded to the GPU, assuming that a client
* uploads each unique {@link Primitive} individually, potentially duplicating
* reused vertex attributes {@link Accessor Accessors}, but never duplicating
* reused {@link Mesh Meshes} or {@link Primitive Primitives} in GPU memory.
*/
UPLOAD = 'upload',
/**
* Expected number of vertices uploaded to the GPU, assuming that a client
* uploads each unique {@link Accessor} only once. Unless glTF vertex
* attributes are pre-processed to a known buffer layout, and the client is
* optimized for that buffer layout, this total will be optimistic.
*/
UPLOAD_OPTIMISTIC = 'upload-optimistic',
/**
* Total number of unique vertices represented, considering all attributes of
* each vertex, and removing any duplicates.
*
* NOTE: Has no direct relationship to runtime characteristics, but may be
* helpful in identifying asset optimization opportunities.
*/
DISTINCT = 'distinct',
/**
* Total number of unique vertices represented, considering aonly vertex
* positions, and removing any duplicates.
*
* NOTE: Has no direct relationship to runtime characteristics, but may be
* helpful in identifying asset optimization opportunities.
*/
DISTINCT_POSITION = 'distinct-position',
/**
* Number of vertex positions never used by any mesh primitive.
*
* NOTE: Has no direct relationship to runtime characteristics, but may be
* helpful in identifying asset optimization opportunities.
*/
UNUSED = 'unused',
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment