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

Object managing the runtime state. More...

Collaboration diagram for Context:

Files

file  context.h
 
file  message_callback.h
 
enum  SRPProvokingVertexMode { SRP_PROVOKING_VERTEX_FIRST , SRP_PROVOKING_VERTEX_LAST }
 
enum  SRPWinding { SRP_WINDING_CCW , SRP_WINDING_CW }
 
enum  SRPFace { SRP_FACE_NONE , SRP_FACE_FRONT , SRP_FACE_BACK , SRP_FACE_FRONT_AND_BACK }
 
enum  SRPPolygonMode { SRP_POLYGON_MODE_FILL , SRP_POLYGON_MODE_LINE , SRP_POLYGON_MODE_POINT }
 
enum  SRPCompareOp {
  SRP_COMPARE_NEVER , SRP_COMPARE_ALWAYS , SRP_COMPARE_LESS , SRP_COMPARE_LEQUAL ,
  SRP_COMPARE_GREATER , SRP_COMPARE_GEQUAL , SRP_COMPARE_EQUAL , SRP_COMPARE_NOTEQUAL
}
 
enum  SRPStencilOp {
  SRP_STENCIL_KEEP , SRP_STENCIL_ZERO , SRP_STENCIL_REPLACE , SRP_STENCIL_INCR ,
  SRP_STENCIL_INCR_WRAP , SRP_STENCIL_DECR , SRP_STENCIL_DECR_WRAP , SRP_STENCIL_INVERT
}
 
typedef enum SRPProvokingVertexMode SRPProvokingVertexMode
 
typedef enum SRPWinding SRPWinding
 
typedef enum SRPFace SRPFace
 
typedef enum SRPPolygonMode SRPPolygonMode
 
typedef enum SRPCompareOp SRPCompareOp
 
typedef struct SRPRasterState SRPRasterState
 
typedef struct SRPScissorState SRPScissorState
 
typedef struct SRPStencilFaceState SRPStencilFaceState
 
typedef struct SRPStencilState SRPStencilState
 
typedef struct SRPDepthState SRPDepthState
 
typedef struct SRPContext SRPContext
 
SRPContext srpContext
 
void srpNewContext (SRPContext *pContext)
 
void srpSetMessageCallback (SRPMessageCallback callback)
 
void srpProvokingVertexMode (SRPProvokingVertexMode mode)
 
void srpRasterCullFace (SRPFace face)
 
void srpRasterFrontFace (SRPWinding face)
 
void srpRasterPolygonMode (SRPPolygonMode mode)
 
void srpRasterPointSize (float size)
 
void srpScissorTest (bool enable)
 
void srpScissorOptions (size_t x, size_t y, size_t width, size_t height)
 
void srpStencilTest (bool enable)
 
void srpStencilFunc (SRPCompareOp func, uint8_t ref, uint8_t mask)
 
void srpStencilFuncSeparate (SRPFace face, SRPCompareOp func, uint8_t ref, uint8_t mask)
 
void srpStencilOp (SRPStencilOp sfail, SRPStencilOp dfail, SRPStencilOp pass)
 
void srpStencilOpSeparate (SRPFace face, SRPStencilOp sfail, SRPStencilOp dfail, SRPStencilOp pass)
 
void srpStencilWriteMask (uint8_t mask)
 
void srpStencilWriteMaskSeparate (SRPFace face, uint8_t mask)
 
void srpDepthTest (bool enable)
 
void srpDepthWrite (bool enable)
 
void srpDepthCompareOp (SRPCompareOp op)
 
enum  SRPMessageType { SRP_MESSAGE_ERROR , SRP_MESSAGE_WARNING }
 
enum  SRPMessageSeverity { SRP_MESSAGE_SEVERITY_LOW , SRP_MESSAGE_SEVERITY_MODERATE , SRP_MESSAGE_SEVERITY_HIGH }
 
typedef enum SRPMessageType SRPMessageType
 
typedef enum SRPMessageSeverity SRPMessageSeverity
 
typedef void(* SRPMessageCallbackFunc) (SRPMessageType type, SRPMessageSeverity severity, const char *sourceFunction, const char *message, void *userParameter)
 
typedef struct SRPMessageCallback SRPMessageCallback
 

Detailed Description

Object managing the runtime state.

Typedef Documentation

◆ SRPCompareOp

typedef enum SRPCompareOp SRPCompareOp

Lists possible compare operations

◆ SRPContext

typedef struct SRPContext SRPContext

Holds runtime settings. This always needs to be declared as SRPContext srpContext in user programs and initialized with srpNewContext()

◆ SRPDepthState

typedef struct SRPDepthState SRPDepthState

Depth test state

◆ SRPFace

typedef enum SRPFace SRPFace

Face types

◆ SRPMessageCallbackFunc

typedef void(* SRPMessageCallbackFunc) (SRPMessageType type, SRPMessageSeverity severity, const char *sourceFunction, const char *message, void *userParameter)

A function of this type may be defined by user to handle the messages generated by the library (errors, warnings, etc.)

See also
SRPContext
Parameters
[in]typeThe type of the message
[in]severitySeverity of the message
[in]sourceFunctionString containing the name of the function which issued this callback
[in]messageMessage sent
[in]userParameterUser paramter pointer.
See also
SRPMessageCallback.userParameter

◆ SRPMessageSeverity

Represents the message severity

See also
SRPMessageCallback

◆ SRPMessageType

Represents the message type (error, warning, etc.)

See also
SRPMessageCallback

◆ SRPPolygonMode

Polygon rendering mode

◆ SRPProvokingVertexMode

Which vertex is considered to be the provoking vertex

◆ SRPRasterState

Rasterizer state

◆ SRPScissorState

Scissor test state

◆ SRPStencilFaceState

Stencil test state for front or back face

◆ SRPStencilState

Stencil test state

◆ SRPWinding

typedef enum SRPWinding SRPWinding

Front face mode

Enumeration Type Documentation

◆ SRPCompareOp

Lists possible compare operations

◆ SRPFace

enum SRPFace

Face types

Enumerator
SRP_FACE_NONE 

Neither front face nor back face

SRP_FACE_FRONT 

The front face. Primitives that don't have a face (lines, points) are said to always be front facing

SRP_FACE_BACK 

The back face

SRP_FACE_FRONT_AND_BACK 

Both front and back faces

◆ SRPMessageSeverity

Represents the message severity

See also
SRPMessageCallback
Enumerator
SRP_MESSAGE_SEVERITY_LOW 

Low severity

SRP_MESSAGE_SEVERITY_MODERATE 

Moderate severity

SRP_MESSAGE_SEVERITY_HIGH 

High severity

◆ SRPMessageType

Represents the message type (error, warning, etc.)

See also
SRPMessageCallback

◆ SRPPolygonMode

Polygon rendering mode

Enumerator
SRP_POLYGON_MODE_FILL 

Filled triangles (default)

SRP_POLYGON_MODE_LINE 

Lines only (wireframe)

SRP_POLYGON_MODE_POINT 

Points only

◆ SRPProvokingVertexMode

Which vertex is considered to be the provoking vertex

Enumerator
SRP_PROVOKING_VERTEX_FIRST 

The first vertex of the primitive is its provoking vertex

SRP_PROVOKING_VERTEX_LAST 

The last vertex of the primitive is its provoking vertex (default)

◆ SRPStencilOp

Lists possible stencil buffer operations

Enumerator
SRP_STENCIL_KEEP 

Keep the current value

SRP_STENCIL_ZERO 

Set to 0

SRP_STENCIL_REPLACE 

Set to the reference value

SRP_STENCIL_INCR 

Increment (clamp to 255)

SRP_STENCIL_INCR_WRAP 

Increment (wraparound to 0)

SRP_STENCIL_DECR 

Decrement (clamp to 0)

SRP_STENCIL_DECR_WRAP 

Decrement (wraparound to 255)

SRP_STENCIL_INVERT 

Bitwise invert

◆ SRPWinding

enum SRPWinding

Front face mode

Enumerator
SRP_WINDING_CCW 

Counterclockwise (default)

SRP_WINDING_CW 

Clockwise

Function Documentation

◆ srpDepthCompareOp()

void srpDepthCompareOp ( SRPCompareOp  op)

Set the compare operation used in the depth test

◆ srpDepthTest()

void srpDepthTest ( bool  enable)

Enable or disable the depth test

◆ srpDepthWrite()

void srpDepthWrite ( bool  enable)

Enable or disable the depth writing

◆ srpNewContext()

void srpNewContext ( SRPContext pContext)

Initialize the context

Parameters
[in]pContextThe pointer to the context
Todo:
use LESS here? like OpenGL

◆ srpProvokingVertexMode()

void srpProvokingVertexMode ( SRPProvokingVertexMode  mode)

Set the provoking vertex convention

◆ srpRasterCullFace()

void srpRasterCullFace ( SRPFace  face)

Set the face(s) to cull

◆ srpRasterFrontFace()

void srpRasterFrontFace ( SRPWinding  face)

Set the winding order considered the front face

◆ srpRasterPointSize()

void srpRasterPointSize ( float  size)

Set point size

◆ srpRasterPolygonMode()

void srpRasterPolygonMode ( SRPPolygonMode  mode)

Set polygon rasterization mode

◆ srpScissorOptions()

void srpScissorOptions ( size_t  x,
size_t  y,
size_t  width,
size_t  height 
)

Set the options for the scissor test

◆ srpScissorTest()

void srpScissorTest ( bool  enable)

Enable or disable the scissor test

◆ srpSetMessageCallback()

void srpSetMessageCallback ( SRPMessageCallback  callback)

Set message callback function

◆ srpStencilFunc()

void srpStencilFunc ( SRPCompareOp  func,
uint8_t  ref,
uint8_t  mask 
)

Set the stencil comparison function options

◆ srpStencilFuncSeparate()

void srpStencilFuncSeparate ( SRPFace  face,
SRPCompareOp  func,
uint8_t  ref,
uint8_t  mask 
)

Set the stencil comparison function options for a specific face type

◆ srpStencilOp()

void srpStencilOp ( SRPStencilOp  sfail,
SRPStencilOp  dfail,
SRPStencilOp  pass 
)

Set the stencil update operation options

◆ srpStencilOpSeparate()

void srpStencilOpSeparate ( SRPFace  face,
SRPStencilOp  sfail,
SRPStencilOp  dfail,
SRPStencilOp  pass 
)

Set the stencil update operation options for a specific face type

◆ srpStencilTest()

void srpStencilTest ( bool  enable)

Enable or disable the stencil test

◆ srpStencilWriteMask()

void srpStencilWriteMask ( uint8_t  mask)

Set the write mask on stencil operations

◆ srpStencilWriteMaskSeparate()

void srpStencilWriteMaskSeparate ( SRPFace  face,
uint8_t  mask 
)

Set the write mask on stencil operations for a specific face type

Variable Documentation

◆ srpContext

SRPContext srpContext
extern

Global context declaration