[][src]Module meshopt::ffi

Structs

meshopt_Bounds
meshopt_Meshlet
meshopt_OverdrawStatistics
meshopt_Stream

Vertex attribute stream, similar to glVertexPointer Each element takes size bytes, with stride controlling the spacing between successive elements.

meshopt_VertexCacheStatistics
meshopt_VertexFetchStatistics

Functions

meshopt_analyzeOverdraw

Overdraw analyzer Returns overdraw statistics using a software rasterizer Results may not match actual GPU performance

meshopt_analyzeVertexCache

Vertex transform cache analyzer Returns cache hit statistics using a simplified FIFO model Results may not match actual GPU performance

meshopt_analyzeVertexFetch

Vertex fetch cache analyzer Returns cache hit statistics using a simplified direct mapped model Results may not match actual GPU performance

meshopt_buildMeshlets

Experimental: Meshlet builder Splits the mesh into a set of meshlets where each meshlet has a micro index buffer indexing into meshlet vertices that refer to the original vertex buffer The resulting data can be used to render meshes using NVidia programmable mesh shading pipeline, or in other cluster-based renderers. For maximum efficiency the index buffer being converted has to be optimized for vertex cache first.

meshopt_buildMeshletsBound
meshopt_computeClusterBounds

Experimental: Cluster bounds generator Creates bounding volumes that can be used for frustum, backface and occlusion culling.

meshopt_computeMeshletBounds
meshopt_decodeIndexBuffer

Index buffer decoder Decodes index data from an array of bytes generated by meshopt_encodeIndexBuffer Returns 0 if decoding was successful, and an error code otherwise The decoder is safe to use for untrusted input, but it may produce garbage data (e.g. out of range indices).

meshopt_decodeVertexBuffer

Vertex buffer decoder Decodes vertex data from an array of bytes generated by meshopt_encodeVertexBuffer Returns 0 if decoding was successful, and an error code otherwise The decoder is safe to use for untrusted input, but it may produce garbage data.

meshopt_encodeIndexBuffer

Index buffer encoder Encodes index data into an array of bytes that is generally much smaller (<1.5 bytes/triangle) and compresses better (<1 bytes/triangle) compared to original. Returns encoded data size on success, 0 on error; the only error condition is if buffer doesn't have enough space For maximum efficiency the index buffer being encoded has to be optimized for vertex cache and vertex fetch first.

meshopt_encodeIndexBufferBound
meshopt_encodeVertexBuffer

Vertex buffer encoder Encodes vertex data into an array of bytes that is generally smaller and compresses better compared to original. Returns encoded data size on success, 0 on error; the only error condition is if buffer doesn't have enough space This function works for a single vertex stream; for multiple vertex streams, call meshopt_encodeVertexBuffer for each stream.

meshopt_encodeVertexBufferBound
meshopt_generateShadowIndexBuffer

Experimental: Generate index buffer that can be used for more efficient rendering when only a subset of the vertex attributes is necessary All vertices that are binary equivalent (wrt first vertex_size bytes) map to the first vertex in the original vertex buffer. This makes it possible to use the index buffer for Z pre-pass or shadowmap rendering, while using the original index buffer for regular rendering.

meshopt_generateShadowIndexBufferMulti

Experimental: Generate index buffer that can be used for more efficient rendering when only a subset of the vertex attributes is necessary All vertices that are binary equivalent (wrt specified streams) map to the first vertex in the original vertex buffer. This makes it possible to use the index buffer for Z pre-pass or shadowmap rendering, while using the original index buffer for regular rendering.

meshopt_generateVertexRemap

Generates a vertex remap table from the vertex buffer and an optional index buffer and returns number of unique vertices As a result, all vertices that are binary equivalent map to the same (new) location, with no gaps in the resulting sequence. Resulting remap table maps old vertices to new vertices and can be used in meshopt_remapVertexBuffer/meshopt_remapIndexBuffer.

meshopt_generateVertexRemapMulti

Experimental: Generates a vertex remap table from multiple vertex streams and an optional index buffer and returns number of unique vertices As a result, all vertices that are binary equivalent map to the same (new) location, with no gaps in the resulting sequence. Resulting remap table maps old vertices to new vertices and can be used in meshopt_remapVertexBuffer/meshopt_remapIndexBuffer. To remap vertex buffers, you will need to call meshopt_remapVertexBuffer for each vertex stream.

meshopt_optimizeOverdraw

Overdraw optimizer Reorders indices to reduce the number of GPU vertex shader invocations and the pixel overdraw If index buffer contains multiple ranges for multiple draw calls, this functions needs to be called on each range individually.

meshopt_optimizeVertexCache

Vertex transform cache optimizer Reorders indices to reduce the number of GPU vertex shader invocations If index buffer contains multiple ranges for multiple draw calls, this functions needs to be called on each range individually.

meshopt_optimizeVertexCacheFifo

Vertex transform cache optimizer for FIFO caches Reorders indices to reduce the number of GPU vertex shader invocations Generally takes ~3x less time to optimize meshes but produces inferior results compared to meshopt_optimizeVertexCache If index buffer contains multiple ranges for multiple draw calls, this functions needs to be called on each range individually.

meshopt_optimizeVertexFetch

Vertex fetch cache optimizer Reorders vertices and changes indices to reduce the amount of GPU memory fetches during vertex processing Returns the number of unique vertices, which is the same as input vertex count unless some vertices are unused This functions works for a single vertex stream; for multiple vertex streams, use meshopt_optimizeVertexFetchRemap + meshopt_remapVertexBuffer for each stream.

meshopt_optimizeVertexFetchRemap

Vertex fetch cache optimizer Generates vertex remap to reduce the amount of GPU memory fetches during vertex processing Returns the number of unique vertices, which is the same as input vertex count unless some vertices are unused The resulting remap table should be used to reorder vertex/index buffers using meshopt_remapVertexBuffer/meshopt_remapIndexBuffer

meshopt_remapIndexBuffer

Generate index buffer from the source index buffer and remap table generated by meshopt_generateVertexRemap

meshopt_remapVertexBuffer

Generates vertex buffer from the source vertex buffer and remap table generated by meshopt_generateVertexRemap

meshopt_simplify

Experimental: Mesh simplifier Reduces the number of triangles in the mesh, attempting to preserve mesh appearance as much as possible Returns the number of indices after simplification, with destination containing new index data The resulting index buffer references vertices from the original vertex buffer. If the original vertex data isn't required, creating a compact vertex buffer using meshopt_optimizeVertexFetch is recommended.

meshopt_stripify

Mesh stripifier Converts a previously vertex cache optimized triangle list to triangle strip, stitching strips using restart index Returns the number of indices in the resulting strip, with destination containing new index data For maximum efficiency the index buffer being converted has to be optimized for vertex cache first.

meshopt_stripifyBound
meshopt_unstripify

Mesh unstripifier Converts a triangle strip to a triangle list Returns the number of indices in the resulting list, with destination containing new index data

meshopt_unstripifyBound