Overte C++ Documentation
gpu::State Class Reference

Describes pipeline state. More...

#include <State.h>

Collaboration diagram for gpu::State:

Classes

struct  BlendFunction
 Represents blending state. More...
 
class  Data
 The Data class is the full explicit description of the State class fields value. More...
 
class  DepthTest
 Represents setting for depth testing and writing. More...
 
struct  Flags
 Flags for enabling or disabling various settings for the pipeline. More...
 

Public Types

enum  Field
 
typedef std::bitset< NUM_FIELDS > Signature
 

Public Member Functions

Stamp getStamp () const
 Get the current stamp. More...
 
std::string getKey () const
 
const Flags & getFlags () const
 
void setStencilTest (bool enabled, uint8 frontWriteMask, StencilTest frontTest, uint8 backWriteMask, StencilTest backTest)
 
void setStencilTest (bool enabled, uint8 frontWriteMask, StencilTest frontTest)
 
void setSampleMask (uint32 mask)
 
uint32 getSampleMask () const
 
void setBlendFunction (bool enabled, BlendArg sourceColor, BlendOp operationColor, BlendArg destinationColor, BlendArg sourceAlpha, BlendOp operationAlpha, BlendArg destinationAlpha)
 
void setBlendFunction (bool enabled, BlendArg source, BlendOp operation, BlendArg destination)
 
void setColorWriteMask (ColorMask mask)
 
void setColorWriteMask (bool red, bool green, bool blue, bool alpha)
 Sets which color channels can be written to. More...
 
Signature getSignature () const
 
 State (const Data &values)
 For convenience, create a State from the values directly.
 
const Data & getValues () const
 

Static Public Member Functions

static Signature evalSignature (const Data &state)
 

Public Attributes

const GPUObjectPointer gpuObject {}
 Object representing state on the API-specific backend side.
 

Static Public Attributes

static const Data DEFAULT = State::Data()
 The unique default values for all the fields.
 

Protected Attributes

Data _values
 Full description of the state.
 
Signature _signature { 0 }
 Used to tell which fields have default values and which are changed.
 
Stamp _stamp { 0 }
 Incremented on changes and used to determine if API-specific backend object needs updating.
 

Detailed Description

Describes pipeline state.

Member Typedef Documentation

◆ Signature

typedef std::bitset<NUM_FIELDS> gpu::State::Signature

The signature of the state tells which fields of the state are not default. this way during rendering the Backend can compare it's current state and try to minimize the job to do.

Member Enumeration Documentation

◆ Field

All the possible fields NOTE: If you change this, you must update GLBackend::GLState::_resetStateCommands

Member Function Documentation

◆ evalSignature()

State::Signature State::evalSignature ( const Data &  state)
static
Parameters
stateState for which singature will be computed.
Returns
Signature telling which state fields are non-default for current state.

◆ getFlags()

const Flags& gpu::State::getFlags ( ) const
inline
Returns
Object containing settings enabling or disabling various parts of the pipeline.

◆ getKey()

std::string State::getKey ( ) const
Returns
Returns a text string that is unique to a given pipeline state setup.

◆ getSampleMask()

uint32 gpu::State::getSampleMask ( ) const
inline

Gets the current sample mask. Samples that are written to are decided by bit AND of this mask and given fragment's coverage.

Returns
Current sample mask.

◆ getSignature()

Signature gpu::State::getSignature ( ) const
inline
Returns
Current signature telling which state fields are not default.

◆ getStamp()

Stamp gpu::State::getStamp ( ) const
inline

Get the current stamp.

Stamp is used to detect changes in the pipeline state.

Returns
Current stamp.

◆ getValues()

const Data& gpu::State::getValues ( ) const
inline
Returns
Object containing all properties of the current state.

◆ setBlendFunction() [1/2]

void gpu::State::setBlendFunction ( bool  enabled,
BlendArg  source,
BlendOp  operation,
BlendArg  destination 
)
inline
Parameters
enabledIs blending enabled?
sourceDetermines how source (both color and alpha) will be used.
operationType of operation that will be performed on both color and alpha if blending is enabled.
destinationDetermines how destination (both color and alpha) will be used.

◆ setBlendFunction() [2/2]

void gpu::State::setBlendFunction ( bool  enabled,
BlendArg  sourceColor,
BlendOp  operationColor,
BlendArg  destinationColor,
BlendArg  sourceAlpha,
BlendOp  operationAlpha,
BlendArg  destinationAlpha 
)
inline
Parameters
enabledIs blending enabled?
sourceColorDetermines how source color will be used.
operationColorType of operation that will be performed on color if blending is enabled.
destinationColorDetermines how destination color will be used.
sourceAlphaDetermines how source alpha will be used.
operationAlphaType of operation that will be performed on alpha if blending is enabled.
destinationAlphaDetermines how destination alpha will be used.

◆ setColorWriteMask() [1/2]

void gpu::State::setColorWriteMask ( bool  red,
bool  green,
bool  blue,
bool  alpha 
)
inline

Sets which color channels can be written to.

Parameters
redShould red channel be written to.
greenShould green channel be written to.
blueShould blue channel be written to.
alphaShould alpha channel be written to.

◆ setColorWriteMask() [2/2]

void gpu::State::setColorWriteMask ( ColorMask  mask)
inline
Parameters
maskBit AND of color channels that are to be written to.

◆ setSampleMask()

void gpu::State::setSampleMask ( uint32  mask)
inline

Sets sample mask. Samples that are written to are decided by bit AND of this mask and given fragment's coverage.

Parameters
maskMask that decides which samples can be written to.

◆ setStencilTest() [1/2]

void gpu::State::setStencilTest ( bool  enabled,
uint8  frontWriteMask,
StencilTest  frontTest 
)
inline
Parameters
enabledIs stencil test enabled.
frontWriteMaskControls which bits are written to in the stencil buffer for both front and back faces.
frontTestStencil test settings for both front and back faces.

◆ setStencilTest() [2/2]

void gpu::State::setStencilTest ( bool  enabled,
uint8  frontWriteMask,
StencilTest  frontTest,
uint8  backWriteMask,
StencilTest  backTest 
)
inline
Parameters
enabledIs stencil test enabled.
frontWriteMaskControls which bits are written to in the stencil buffer for front faces.
frontTestStencil test settings for the front faces.
backWriteMaskControls which bits are written to in the stencil buffer for back faces.
backTestStencil test settings for the back faces.

The documentation for this class was generated from the following files: