srp
software rendering pipeline
Loading...
Searching...
No Matches
Vertex processing

Functions related to vertex processing and post-VS cache. More...

Collaboration diagram for Vertex processing:

Files

file  vertex_processing.c
 
file  vertex_processing.h
 

Classes

struct  VertexCacheEntry
 
typedef struct VertexCacheEntry VertexCacheEntry
 
typedef struct VertexCache VertexCache
 
static void computeMinMaxVI (const SRPIndexBuffer *ib, size_t startIndex, size_t vertexCount, size_t *outMinVI, size_t *outMaxVI)
 
void allocateVertexCache (VertexCache *cache, const SRPIndexBuffer *ib, size_t startIndex, size_t vertexCount, size_t varyingSize)
 
SRPVertexShaderOutvertexCacheFetch (VertexCache *cache, size_t vertexIndex, const SRPVertexBuffer *vb, const SRPShaderProgram *sp)
 
void processVertex (size_t vertexIndex, void *varyingBlock, size_t varyingIndex, const SRPVertexBuffer *vb, const SRPShaderProgram *sp, SRPVertexShaderOut *outV)
 
void applyPerspectiveDivide (SRPVertexShaderOut *output, float *outInvW)
 

Detailed Description

Functions related to vertex processing and post-VS cache.

Typedef Documentation

◆ VertexCache

typedef struct VertexCache VertexCache

Post-VS cache

◆ VertexCacheEntry

Represents an entry in VertexCache

Function Documentation

◆ allocateVertexCache()

void allocateVertexCache ( VertexCache cache,
const SRPIndexBuffer ib,
size_t  startIndex,
size_t  vertexCount,
size_t  varyingSize 
)

Initialize / allocate vertex cache

Parameters
[in]cachePointer to the cache
[in]ibThe SRPIndexBuffer being used
[in]startIndexFirst stream index
[in]vertexCountHow many vertices from the ib you want to process
[in]varyingSizeThe size of varying vertex parameters, in bytes

◆ applyPerspectiveDivide()

void applyPerspectiveDivide ( SRPVertexShaderOut output,
float *  outInvW 
)

Apply perspective divide to the output of the vertex shader, optionally saving the 1 / W_clip value

Parameters
[in]outputOutput of the vertex shader
[out]outInvWPointer where 1/W value will be stored. May be NULL

◆ computeMinMaxVI()

static void computeMinMaxVI ( const SRPIndexBuffer ib,
size_t  startIndex,
size_t  vertexCount,
size_t *  outMinVI,
size_t *  outMaxVI 
)
static

Compute minimal and maximal vertex indices given stream indices

◆ processVertex()

void processVertex ( size_t  vertexIndex,
void *  varyingBlock,
size_t  varyingIndex,
const SRPVertexBuffer vb,
const SRPShaderProgram sp,
SRPVertexShaderOut outV 
)

Run vertex shader

Parameters
[in]vertexIndexThe index of the vertex to process (not its stream index!)
[in]varyingBlockPointer to the block where vertex varyings are stored
[in]varyingIndexIndex into the varyingBlock
[in]vbThe SRPVertexBuffer being used
[in]spThe SRPShaderProgram being used
[out]outVWhere to store the processed vertex

◆ vertexCacheFetch()

SRPVertexShaderOut * vertexCacheFetch ( VertexCache cache,
size_t  vertexIndex,
const SRPVertexBuffer vb,
const SRPShaderProgram sp 
)

Fetch vertex shader output from post-VS cache. If not found, compute and store it. Returns clip-space positions (does not perform perspective divide)

Parameters
[in]cacheThe vertex cache
[in]vertexIndexThe index of the vertex to fetch (not its stream index!)
[in]vbThe SRPVertexBuffer being used
[in]spThe SRPShaderProgram being used
Returns
The processed, post-VS vertex