citro3d
Data Structures | Enumerations | Functions
framebuffer.h File Reference

Process render target framebuffer. More...

#include "texture.h"

Go to the source code of this file.

Data Structures

struct  C3D_FrameBuf
 

Enumerations

enum  C3D_ClearBits {
  C3D_CLEAR_COLOR = BIT(0) ,
  C3D_CLEAR_DEPTH = BIT(1) ,
  C3D_CLEAR_ALL = C3D_CLEAR_COLOR | C3D_CLEAR_DEPTH
}
 Flags for C3D_FrameBufClear. More...
 

Functions

u32 C3D_CalcColorBufSize (u32 width, u32 height, GPU_COLORBUF fmt)
 Calculates the size of a color buffer. More...
 
u32 C3D_CalcDepthBufSize (u32 width, u32 height, GPU_DEPTHBUF fmt)
 Calculates the size of a depth buffer. More...
 
C3D_FrameBufC3D_GetFrameBuf (void)
 Returns global citro3d framebuffer structure. More...
 
void C3D_SetFrameBuf (C3D_FrameBuf *fb)
 Sets global citro3d framebuffer structure. More...
 
void C3D_FrameBufTex (C3D_FrameBuf *fb, C3D_Tex *tex, GPU_TEXFACE face, int level)
 Binds a texture to a framebuffer. This texture will be used as the color buffer. More...
 
void C3D_FrameBufClear (C3D_FrameBuf *fb, C3D_ClearBits clearBits, u32 clearColor, u32 clearDepth)
 Sets the clear bits and color for a framebuffer. More...
 
void C3D_FrameBufTransfer (C3D_FrameBuf *fb, gfxScreen_t screen, gfx3dSide_t side, u32 transferFlags)
 Transfers a framebuffer to the LCD display. More...
 
static void C3D_FrameBufAttrib (C3D_FrameBuf *fb, u16 width, u16 height, bool block32)
 Sets framebuffer attributes. More...
 
static void C3D_FrameBufColor (C3D_FrameBuf *fb, void *buf, GPU_COLORBUF fmt)
 Assigns a color buffer to a framebuffer. More...
 
static void C3D_FrameBufDepth (C3D_FrameBuf *fb, void *buf, GPU_DEPTHBUF fmt)
 Assigns a depth buffer to a framebuffer. More...
 

Detailed Description

Process render target framebuffer.

Enumeration Type Documentation

◆ C3D_ClearBits

Flags for C3D_FrameBufClear.

Enumerator
C3D_CLEAR_COLOR 

Clear the color buffer.

C3D_CLEAR_DEPTH 

Clear the the depth/stencil buffer.

C3D_CLEAR_ALL 

Clear both buffers.

Function Documentation

◆ C3D_CalcColorBufSize()

u32 C3D_CalcColorBufSize ( u32  width,
u32  height,
GPU_COLORBUF  fmt 
)

Calculates the size of a color buffer.

Parameters
[in]widthWidth of the color buffer in pixels.
[in]heightHeight of the color buffer in pixels.
[in]fmtFormat of the color buffer.
Returns
Calculated color buffer size.

◆ C3D_CalcDepthBufSize()

u32 C3D_CalcDepthBufSize ( u32  width,
u32  height,
GPU_DEPTHBUF  fmt 
)

Calculates the size of a depth buffer.

Parameters
[in]widthWidth of the depth buffer in pixels.
[in]heightHeight of the depth buffer in pixels.
[in]fmtFormat of the depth buffer.
Returns
Calculated depth buffer size.

◆ C3D_FrameBufAttrib()

static void C3D_FrameBufAttrib ( C3D_FrameBuf fb,
u16  width,
u16  height,
bool  block32 
)
inlinestatic

Sets framebuffer attributes.

Parameters
[in]fbPointer to a C3D_FrameBuf struct.
[in]widthWidth of framebuffer in pixels.
[in]heightHeight of framebuffer in pixels.
[in]block32Specifies if using 32x32 tile format.

◆ C3D_FrameBufClear()

void C3D_FrameBufClear ( C3D_FrameBuf fb,
C3D_ClearBits  clearBits,
u32  clearColor,
u32  clearDepth 
)

Sets the clear bits and color for a framebuffer.

Parameters
[in]fbPointer to a C3D_FrameBuf struct.
[in]clearBitsSpecifies which buffers to clear. (see C3D_ClearBits)
[in]clearColor32 bit RGBA value to clear the color buffer with.
[in]clearDepthValue to clear the depth buffer with.

◆ C3D_FrameBufColor()

static void C3D_FrameBufColor ( C3D_FrameBuf fb,
void *  buf,
GPU_COLORBUF  fmt 
)
inlinestatic

Assigns a color buffer to a framebuffer.

Parameters
[in]fbPointer to a C3D_FrameBuf struct.
[in]bufPointer to the buffer to use.
[in]fmtFormat of the color buffer.

◆ C3D_FrameBufDepth()

static void C3D_FrameBufDepth ( C3D_FrameBuf fb,
void *  buf,
GPU_DEPTHBUF  fmt 
)
inlinestatic

Assigns a depth buffer to a framebuffer.

Parameters
[in]fbPointer to a C3D_FrameBuf struct.
[in]bufPointer to the buffer to use.
[in]fmtFormat of the depth buffer.
Note
Depending on the format chosen, this may be used as a stencil buffer as well.

◆ C3D_FrameBufTex()

void C3D_FrameBufTex ( C3D_FrameBuf fb,
C3D_Tex tex,
GPU_TEXFACE  face,
int  level 
)

Binds a texture to a framebuffer. This texture will be used as the color buffer.

Parameters
[out]fbPointer to C3D_FrameBuf struct.
[in]texPointer to C3D_Tex struct.
[in]faceSpecifies face of cubemap to be used (ignored if it is a 2D texture)
[in]levelSpecifies mipmap level. 0 is the original image, 1 is the first mipmap, and so on.
Remarks
This calls C3D_FrameBufColor with the proper arguments for the buffer of the texture.

◆ C3D_FrameBufTransfer()

void C3D_FrameBufTransfer ( C3D_FrameBuf fb,
gfxScreen_t  screen,
gfx3dSide_t  side,
u32  transferFlags 
)

Transfers a framebuffer to the LCD display.

Parameters
[in]fbPointer to a C3D_FrameBuf struct.
[in]screenScreen to transfer the framebuffer to.
[in]sideSide of the screen to transfer the framebuffer to (unused for the bottom screen)
[in]transferFlagsSpecifies GX_TRANSFER bitflags.

◆ C3D_GetFrameBuf()

C3D_FrameBuf* C3D_GetFrameBuf ( void  )

Returns global citro3d framebuffer structure.

Returns
Pointer to C3D_FrameBuf struct.

◆ C3D_SetFrameBuf()

void C3D_SetFrameBuf ( C3D_FrameBuf fb)

Sets global citro3d framebuffer structure.

Parameters
[in]fbPointer to C3D_FrameBuf struct.