RetroArch
Functions | Variables
gpu_old.c File Reference
#include <stdlib.h>
#include <string.h>
#include <3ds/types.h>
#include <3ds/gpu/gpu.h>
#include <3ds/gpu/gx.h>
#include <3ds/gpu/shbin.h>
#include "gpu_old.h"
Include dependency graph for gpu_old.c:

Functions

void GPU_Init (Handle *gsphandle)
 Initializes the GPU. More...
 
void GPU_Reset (u32 *gxbuf, u32 *gpuBuf, u32 gpuBufSize)
 Resets the GPU. More...
 
void GPU_SetFloatUniform (GPU_SHADER_TYPE type, u32 startreg, u32 *data, u32 numreg)
 Sets a shader float uniform. More...
 
void GPU_SetViewport (u32 *depthBuffer, u32 *colorBuffer, u32 x, u32 y, u32 w, u32 h)
 Sets the viewport. More...
 
void GPU_SetScissorTest (GPU_SCISSORMODE mode, u32 left, u32 bottom, u32 right, u32 top)
 Sets the current scissor test mode. More...
 
void GPU_DepthMap (float zScale, float zOffset)
 Sets the depth map. More...
 
void GPU_SetAlphaTest (bool enable, GPU_TESTFUNC function, u8 ref)
 Sets the alpha test parameters. More...
 
void GPU_SetStencilTest (bool enable, GPU_TESTFUNC function, u8 ref, u8 input_mask, u8 write_mask)
 Sets the stencil test parameters. More...
 
void GPU_SetStencilOp (GPU_STENCILOP sfail, GPU_STENCILOP dfail, GPU_STENCILOP pass)
 Sets the stencil test operators. More...
 
void GPU_SetDepthTestAndWriteMask (bool enable, GPU_TESTFUNC function, GPU_WRITEMASK writemask)
 Sets the depth test parameters and pixel write mask. More...
 
void GPU_SetAlphaBlending (GPU_BLENDEQUATION colorEquation, GPU_BLENDEQUATION alphaEquation, GPU_BLENDFACTOR colorSrc, GPU_BLENDFACTOR colorDst, GPU_BLENDFACTOR alphaSrc, GPU_BLENDFACTOR alphaDst)
 Sets the alpha blending parameters. More...
 
void GPU_SetColorLogicOp (GPU_LOGICOP op)
 Sets the color logic operator. More...
 
void GPU_SetBlendingColor (u8 r, u8 g, u8 b, u8 a)
 Sets the blending color. More...
 
void GPU_SetTextureEnable (GPU_TEXUNIT units)
 Sets the enabled texture units. More...
 
void GPU_SetTexture (GPU_TEXUNIT unit, u32 *data, u16 width, u16 height, u32 param, GPU_TEXCOLOR colorType)
 Sets the texture data of a texture unit. More...
 
void GPU_SetTextureBorderColor (GPU_TEXUNIT unit, u32 borderColor)
 Sets the border color of a texture unit. More...
 
void GPU_SetAttributeBuffers (u8 totalAttributes, u32 *baseAddress, u64 attributeFormats, u16 attributeMask, u64 attributePermutation, u8 numBuffers, u32 bufferOffsets[], u64 bufferPermutations[], u8 bufferNumAttributes[])
 Sets the VBO attribute buffers. More...
 
void GPU_SetAttributeBuffersAddress (u32 *baseAddress)
 
void GPU_SetFaceCulling (GPU_CULLMODE mode)
 Sets the face culling mode. More...
 
void GPU_SetCombinerBufferWrite (u8 rgb_config, u8 alpha_config)
 Sets the combiner buffer write parameters. More...
 
void GPU_SetTexEnv (u8 id, u16 rgbSources, u16 alphaSources, u16 rgbOperands, u16 alphaOperands, GPU_COMBINEFUNC rgbCombine, GPU_COMBINEFUNC alphaCombine, u32 constantColor)
 Sets the parameters of a texture combiner. More...
 
void GPU_DrawArray (GPU_Primitive_t primitive, u32 first, u32 count)
 Draws an array of vertex data. More...
 
void GPU_DrawElements (GPU_Primitive_t primitive, u32 *indexArray, u32 n)
 Draws vertex elements. More...
 
void GPU_FinishDrawing ()
 Finishes drawing. More...
 
void GPU_Finalize (void)
 

Variables

const u8 GPU_FORMATSIZE [4] ={1,1,2,4}
 
const u8 GPU_TEVID [] ={0xC0,0xC8,0xD0,0xD8,0xF0,0xF8}
 

Function Documentation

◆ GPU_DepthMap()

void GPU_DepthMap ( float  zScale,
float  zOffset 
)

Sets the depth map.

Parameters
zScaleZ scale to use.
zOffsetZ offset to use.
Deprecated:
Here is the caller graph for this function:

◆ GPU_DrawArray()

void GPU_DrawArray ( GPU_Primitive_t  primitive,
u32  first,
u32  count 
)

Draws an array of vertex data.

Parameters
primitivePrimitive to draw.
firstFirst vertex to draw.
countNumber of vertices to draw.
Deprecated:
Here is the caller graph for this function:

◆ GPU_DrawElements()

void GPU_DrawElements ( GPU_Primitive_t  primitive,
u32 indexArray,
u32  n 
)

Draws vertex elements.

Parameters
primitivePrimitive to draw.
indexArrayArray of vertex indices to use.
nNumber of vertices to draw.
Deprecated:

◆ GPU_Finalize()

void GPU_Finalize ( void  )
Here is the caller graph for this function:

◆ GPU_FinishDrawing()

void GPU_FinishDrawing ( )

Finishes drawing.

Deprecated:
Here is the caller graph for this function:

◆ GPU_Init()

void GPU_Init ( Handle *  gsphandle)

Initializes the GPU.

Parameters
gsphandleGSP handle to use.
Deprecated:

◆ GPU_Reset()

void GPU_Reset ( u32 gxbuf,
u32 gpuBuf,
u32  gpuBufSize 
)

Resets the GPU.

Parameters
gxbufGX command buffer to use.
gpuBufGPU command buffer to use.
gpuBufSizeGPU command buffer size.
Deprecated:
Here is the caller graph for this function:

◆ GPU_SetAlphaBlending()

void GPU_SetAlphaBlending ( GPU_BLENDEQUATION  colorEquation,
GPU_BLENDEQUATION  alphaEquation,
GPU_BLENDFACTOR  colorSrc,
GPU_BLENDFACTOR  colorDst,
GPU_BLENDFACTOR  alphaSrc,
GPU_BLENDFACTOR  alphaDst 
)

Sets the alpha blending parameters.

Note
Cannot be used with GPU_SetColorLogicOp.
Parameters
colorEquationBlend equation to use for color components.
alphaEquationBlend equation to use for the alpha component.
colorSrcSource factor of color components.
colorDstDestination factor of color components.
alphaSrcSource factor of the alpha component.
alphaDstDestination factor of the alpha component.
Deprecated:
Here is the caller graph for this function:

◆ GPU_SetAlphaTest()

void GPU_SetAlphaTest ( bool  enable,
GPU_TESTFUNC  function,
u8  ref 
)

Sets the alpha test parameters.

Parameters
enableWhether to enable alpha testing.
functionTest function to use.
refReference value to use.
Deprecated:
Here is the caller graph for this function:

◆ GPU_SetAttributeBuffers()

void GPU_SetAttributeBuffers ( u8  totalAttributes,
u32 baseAddress,
u64  attributeFormats,
u16  attributeMask,
u64  attributePermutation,
u8  numBuffers,
u32  bufferOffsets[],
u64  bufferPermutations[],
u8  bufferNumAttributes[] 
)

Sets the VBO attribute buffers.

Parameters
totalAttributesTotal number of attributes.
baseAddressBase address of the VBO.
attributeFormatsAttribute format data.
attributeMaskAttribute mask.
attributePermutationAttribute permutations.
numBuffersNumber of buffers.
bufferOffsetsOffsets of the buffers.
bufferPermutationsBuffer permutations.
bufferNumAttributesNumbers of attributes of the buffers.
Deprecated:
Here is the call graph for this function:

◆ GPU_SetAttributeBuffersAddress()

void GPU_SetAttributeBuffersAddress ( u32 baseAddress)

◆ GPU_SetBlendingColor()

void GPU_SetBlendingColor ( u8  r,
u8  g,
u8  b,
u8  a 
)

Sets the blending color.

Parameters
rRed component.
gGreen component.
bBlue component.
aAlpha component.
Deprecated:
Here is the caller graph for this function:

◆ GPU_SetColorLogicOp()

void GPU_SetColorLogicOp ( GPU_LOGICOP  op)

Sets the color logic operator.

Note
Cannot be used with GPU_SetAlphaBlending.
Parameters
opOperator to set.
Deprecated:

◆ GPU_SetCombinerBufferWrite()

void GPU_SetCombinerBufferWrite ( u8  rgb_config,
u8  alpha_config 
)

Sets the combiner buffer write parameters.

Note
Use GPU_TEV_BUFFER_WRITE_CONFIG to build the parameters.
Only the first four TEV stages can write to the combiner buffer.
Parameters
rgb_configRGB configuration to use.
alpha_configAlpha configuration to use.
Deprecated:

◆ GPU_SetDepthTestAndWriteMask()

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

Sets the depth test parameters and pixel write mask.

Note
GPU_WRITEMASK values can be ORed together.
Parameters
enableWhether to enable depth testing.
functionTest function to use.
writemaskPixel write mask to use.
Deprecated:
Here is the caller graph for this function:

◆ GPU_SetFaceCulling()

void GPU_SetFaceCulling ( GPU_CULLMODE  mode)

Sets the face culling mode.

Parameters
modeFace culling mode to use.
Deprecated:
Here is the caller graph for this function:

◆ GPU_SetFloatUniform()

void GPU_SetFloatUniform ( GPU_SHADER_TYPE  type,
u32  startreg,
u32 data,
u32  numreg 
)

Sets a shader float uniform.

Parameters
typeType of shader to set the uniform of.
startregStart of the uniform register to set.
dataData to set.
numregNumber of registers to set.
Deprecated:

◆ GPU_SetScissorTest()

void GPU_SetScissorTest ( GPU_SCISSORMODE  mode,
u32  left,
u32  bottom,
u32  right,
u32  top 
)

Sets the current scissor test mode.

Parameters
modeScissor test mode to use.
xX of the scissor region.
yY of the scissor region.
wWidth of the scissor region.
hHeight of the scissor region.
Deprecated:

◆ GPU_SetStencilOp()

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

Sets the stencil test operators.

Parameters
sfailOperator to use on source test failure.
dfailOperator to use on destination test failure.
passOperator to use on test passing.
Deprecated:
Here is the caller graph for this function:

◆ GPU_SetStencilTest()

void GPU_SetStencilTest ( bool  enable,
GPU_TESTFUNC  function,
u8  ref,
u8  input_mask,
u8  write_mask 
)

Sets the stencil test parameters.

Parameters
enableWhether to enable stencil testing.
functionTest function to use.
refReference value to use.
input_maskInput mask to use.
write_maskWrite mask to use.
Deprecated:
Here is the caller graph for this function:

◆ GPU_SetTexEnv()

void GPU_SetTexEnv ( u8  id,
u16  rgbSources,
u16  alphaSources,
u16  rgbOperands,
u16  alphaOperands,
GPU_COMBINEFUNC  rgbCombine,
GPU_COMBINEFUNC  alphaCombine,
u32  constantColor 
)

Sets the parameters of a texture combiner.

Parameters
idID of the combiner.
rgbSourcesRGB source configuration.
alphaSourcesAlpha source configuration.
rgbOperandsRGB operand configuration.
alphaOperandsAlpha operand configuration.
rgbCombineRGB combiner function.
alphaCombineAlpha combiner function.
constantColorConstant color to provide.
Deprecated:
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GPU_SetTexture()

void GPU_SetTexture ( GPU_TEXUNIT  unit,
u32 data,
u16  width,
u16  height,
u32  param,
GPU_TEXCOLOR  colorType 
)

Sets the texture data of a texture unit.

Parameters
unitTexture unit to use.
dataData to load. Must be in linear memory or VRAM.
widthWidth of the texture.
heightHeight of the texture.
Parametersof the texture, such as filters and wrap modes.
colorTypeColor type of the texture.
Deprecated:

◆ GPU_SetTextureBorderColor()

void GPU_SetTextureBorderColor ( GPU_TEXUNIT  unit,
u32  borderColor 
)

Sets the border color of a texture unit.

Parameters
unitTexture unit to use.
borderColorThe color used for the border when using the GPU_CLAMP_TO_BORDER wrap mode.
Deprecated:

◆ GPU_SetTextureEnable()

void GPU_SetTextureEnable ( GPU_TEXUNIT  units)

Sets the enabled texture units.

Parameters
unitsUnits to enable. OR texture unit values together to create this value.
Deprecated:
Here is the caller graph for this function:

◆ GPU_SetViewport()

void GPU_SetViewport ( u32 depthBuffer,
u32 colorBuffer,
u32  x,
u32  y,
u32  w,
u32  h 
)

Sets the viewport.

Parameters
depthBufferBuffer to output depth data to.
colorBufferBuffer to output color data to.
xX of the viewport.
yY of the viewport.
wWidth of the viewport.
hHeight of the viewport.
Deprecated:
Here is the caller graph for this function:

Variable Documentation

◆ GPU_FORMATSIZE

const u8 GPU_FORMATSIZE[4] ={1,1,2,4}

◆ GPU_TEVID

const u8 GPU_TEVID[] ={0xC0,0xC8,0xD0,0xD8,0xF0,0xF8}