citro3d
Functions
effect.h File Reference

Configure GPU state. More...

#include "types.h"

Go to the source code of this file.

Functions

void C3D_DepthMap (bool bIsZBuffer, float zScale, float zOffset)
 Specify mapping of depth values from normalized device coordinates to window coordinates. More...
 
void C3D_CullFace (GPU_CULLMODE mode)
 Specify whether front-facing or back-facing facets can be culled. More...
 
void C3D_StencilTest (bool enable, GPU_TESTFUNC function, int ref, int inputMask, int writeMask)
 Set front and back function and reference value for stencil testing. More...
 
void C3D_StencilOp (GPU_STENCILOP sfail, GPU_STENCILOP dfail, GPU_STENCILOP pass)
 Set front and back stencil test actions. More...
 
void C3D_BlendingColor (u32 color)
 Set the blend color. More...
 
void C3D_EarlyDepthTest (bool enable, GPU_EARLYDEPTHFUNC function, u32 ref)
 
void C3D_DepthTest (bool enable, GPU_TESTFUNC function, GPU_WRITEMASK writemask)
 
void C3D_AlphaTest (bool enable, GPU_TESTFUNC function, int ref)
 Configure Alpha testing. More...
 
void C3D_AlphaBlend (GPU_BLENDEQUATION colorEq, GPU_BLENDEQUATION alphaEq, GPU_BLENDFACTOR srcClr, GPU_BLENDFACTOR dstClr, GPU_BLENDFACTOR srcAlpha, GPU_BLENDFACTOR dstAlpha)
 Configure blend functions. More...
 
void C3D_ColorLogicOp (GPU_LOGICOP op)
 
void C3D_FragOpMode (GPU_FRAGOPMODE mode)
 
void C3D_FragOpShadow (float scale, float bias)
 

Detailed Description

Configure GPU state.

Function Documentation

◆ C3D_AlphaBlend()

void C3D_AlphaBlend ( GPU_BLENDEQUATION  colorEq,
GPU_BLENDEQUATION  alphaEq,
GPU_BLENDFACTOR  srcClr,
GPU_BLENDFACTOR  dstClr,
GPU_BLENDFACTOR  srcAlpha,
GPU_BLENDFACTOR  dstAlpha 
)

Configure blend functions.

Parameters
[in]colorEqSpecifies how source and destination colors are combined. The initial value is GPU_BLEND_ADD.
[in]alphaEqSpecifies how source and destination alphas are combined. The initial value is GPU_BLEND_ADD.
[in]srcClrSpecifies how the red, green, and blue source blending factors are computed. The initial value is GPU_SRC_ALPHA.
[in]dstClrSpecifies how the red, green, and blue destination blending factors are computed. The initial value is GPU_ONE_MINUS_SRC_ALPHA.
[in]srcAlphaSpecifies how the alpha source blending factors are computed. The initial value is GPU_SRC_ALPHA.
[in]dstAlphaSpecifies how the alpha destination blending factors are computed. The initial value is GPU_ONE_MINUS_SRC_ALPHA.

◆ C3D_AlphaTest()

void C3D_AlphaTest ( bool  enable,
GPU_TESTFUNC  function,
int  ref 
)

Configure Alpha testing.

Parameters
[in]enableEnables or disables alpha test. The initial value is false.
[in]functionSpecifies the alpha comparison function. The initial value is GPU_ALWAYS.
[in]refSpecifies the reference value that incoming alpha values are compared to from 0 to 0xFF. The intial value is 0.

◆ C3D_BlendingColor()

void C3D_BlendingColor ( u32  color)

Set the blend color.

Parameters
[in]colorSpecifies the RGBA blend color. The initial value is 0.

◆ C3D_CullFace()

void C3D_CullFace ( GPU_CULLMODE  mode)

Specify whether front-facing or back-facing facets can be culled.

Parameters
[in]modeSpecifies whether front-facing, back-facing, or no facets are candidates for culling. The inital value is GPU_CULL_BACK_CCW.

◆ C3D_DepthMap()

void C3D_DepthMap ( bool  bIsZBuffer,
float  zScale,
float  zOffset 
)

Specify mapping of depth values from normalized device coordinates to window coordinates.

Parameters
[in]bIsZBufferEnables or disables depth range. The initial value is true.
[in]zScaleSpecifies mapping of depth values from normalized device coordinates to window coordinates (nearVal - farVal). The initial value is -1.0f.
[in]zOffsetSets the scale and units used to calculate depth values (nearVal + polygonOffset). The initial value is 0.0f.

◆ C3D_DepthTest()

void C3D_DepthTest ( bool  enable,
GPU_TESTFUNC  function,
GPU_WRITEMASK  writemask 
)

Configure depth testing options.

Note
Setting the enable parameter to false will not also disable depth writes. It will instead behave as if the depth function were set to GPU_ALWAYS. To completely disable depth-related operations, the enable parameter must be false, and the writemask should be GPU_WRITE_COLOR.
Parameters
[in]enableIf true, do depth comparisons on the outgoing fragments and write to the depth buffer. The initial value is true.
[in]functionSpecifies the depth comparison function. The initial value is GPU_GREATER.
[in]writemaskConfigures buffer writemasks for the depth test stage. The initial value is GPU_WRITE_ALL.

◆ C3D_StencilOp()

void C3D_StencilOp ( GPU_STENCILOP  sfail,
GPU_STENCILOP  dfail,
GPU_STENCILOP  pass 
)

Set front and back stencil test actions.

Parameters
[in]sfailSpecifies the action to take when the stencil test fails. The initial value is GPU_STENCIL_KEEP.
[in]dfailSpecifies the stencil action when the stencil test passes, but the depth test fails. The initial value is GPU_STENCIL_KEEP.
[in]passSpecifies the stencil action when both the stencil test and the depth test pass, or when the stencil test passes and either there is no depth buffer or depth testing is not enabled. The initial value is GPU_STENCIL_KEEP.

◆ C3D_StencilTest()

void C3D_StencilTest ( bool  enable,
GPU_TESTFUNC  function,
int  ref,
int  inputMask,
int  writeMask 
)

Set front and back function and reference value for stencil testing.

Parameters
[in]enableEnables or disables stencil test. The initial value is false.
[in]functionSpecifies the test function. The initial value is GPU_ALWAYS.
[in]refSpecifies the reference value for the stencil test. ref is clamped to the range 02^n - 1 , where n is the number of bitplanes in the stencil buffer. The initial value is 0.
[in]inputMaskSpecifies a mask that is ANDed with both the reference value and the stored stencil value when the test is done. The initial value is all 1's.
[in]writeMaskSpecifies a bit mask to enable and disable writing of individual bits in the stencil planes. Initially, the mask is all 0's.