citro3d
|
Set up rendertarget and render frame. More...
#include "framebuffer.h"
Go to the source code of this file.
Data Structures | |
struct | C3D_RenderTarget_tag |
union | C3D_DEPTHTYPE |
Macros | |
#define | C3D_DEPTHTYPE_OK(_x) ((_x).__i >= 0) |
#define | C3D_DEPTHTYPE_VAL(_x) ((_x).__e) |
Typedefs | |
typedef struct C3D_RenderTarget_tag | C3D_RenderTarget |
Render target structure. | |
Enumerations | |
enum | { C3D_FRAME_SYNCDRAW = BIT(0) , C3D_FRAME_NONBLOCK = BIT(1) } |
Flags for C3D_FrameBegin. More... | |
Functions | |
float | C3D_FrameRate (float fps) |
Specifies framerate cap. Specifies target framerate for C3D_FrameSync(). More... | |
void | C3D_FrameSync (void) |
Performs framerate limiting. Waits for the required amount of vblanks specified by C3D_FrameRate(). More... | |
u32 | C3D_FrameCounter (int id) |
Returns total number of frames drawn. More... | |
bool | C3D_FrameBegin (u8 flags) |
Begins drawing frame. More... | |
bool | C3D_FrameDrawOn (C3D_RenderTarget *target) |
Specifies render target to draw frame to. More... | |
void | C3D_FrameSplit (u8 flags) |
Splits and submits the GPU cmdlist in the middle of a renderqueue frame. More... | |
void | C3D_FrameEnd (u8 flags) |
Ends drawing frame. More... | |
void | C3D_FrameEndHook (void(*hook)(void *), void *param) |
Executes callback upon C3D_FrameEnd(). More... | |
float | C3D_GetDrawingTime (void) |
Gets time spent by the GPU during last render. More... | |
float | C3D_GetProcessingTime (void) |
Gets time elapsed between last C3D_FrameBegin() and C3D_FrameEnd(). More... | |
C3D_RenderTarget * | C3D_RenderTargetCreate (int width, int height, GPU_COLORBUF colorFmt, C3D_DEPTHTYPE depthFmt) |
Creates a new render target. More... | |
C3D_RenderTarget * | C3D_RenderTargetCreateFromTex (C3D_Tex *tex, GPU_TEXFACE face, int level, C3D_DEPTHTYPE depthFmt) |
Constructs render target for texture. More... | |
void | C3D_RenderTargetDelete (C3D_RenderTarget *target) |
Deletes render target. More... | |
void | C3D_RenderTargetSetOutput (C3D_RenderTarget *target, gfxScreen_t screen, gfx3dSide_t side, u32 transferFlags) |
Sets render target output to screen. More... | |
static void | C3D_RenderTargetDetachOutput (C3D_RenderTarget *target) |
Detaches render target from screen output. More... | |
static void | C3D_RenderTargetClear (C3D_RenderTarget *target, C3D_ClearBits clearBits, u32 clearColor, u32 clearDepth) |
Clears framebuffer of target. More... | |
void | C3D_SyncDisplayTransfer (u32 *inadr, u32 indim, u32 *outadr, u32 outdim, u32 flags) |
Synchronizes and initiates a display transfer. Synchronizes and initiates a GX_DisplayTransfer(). More... | |
void | C3D_SyncTextureCopy (u32 *inadr, u32 indim, u32 *outadr, u32 outdim, u32 size, u32 flags) |
Synchronizes and initiates a texture copy. Synchronizes and initiates a GX_TextureCopy(). More... | |
void | C3D_SyncMemoryFill (u32 *buf0a, u32 buf0v, u32 *buf0e, u16 control0, u32 *buf1a, u32 buf1v, u32 *buf1e, u16 control1) |
Synchronizes and fills the memory of two buffers with the given values. Synchronizes and initiates a GX_MemoryFill(). More... | |
Set up rendertarget and render frame.
anonymous enum |
Flags for C3D_FrameBegin.
Enumerator | |
---|---|
C3D_FRAME_SYNCDRAW | Perform C3D_FrameSync() before checking the GPU status. |
C3D_FRAME_NONBLOCK | Return false instead of waiting if the GPU is busy. |
bool C3D_FrameBegin | ( | u8 | flags | ) |
Begins drawing frame.
[in] | flags | Specifies options for rendering; 0 or more flags may be provided. C3D_FRAME_SYNCDRAW specifies that C3D_FrameSync() should be performed before checking the GPU status, C3D_FRAME_NONBLOCK specifies that the function should return false instead of waiting for GPU to be ready. |
u32 C3D_FrameCounter | ( | int | id | ) |
Returns total number of frames drawn.
[in] | id | Vblank frame counter id. |
bool C3D_FrameDrawOn | ( | C3D_RenderTarget * | target | ) |
Specifies render target to draw frame to.
[in] | target | Pointer to render target. |
void C3D_FrameEnd | ( | u8 | flags | ) |
Ends drawing frame.
[in] | flags | Specifies 0 or more GX_CMDLIST flags. |
void C3D_FrameEndHook | ( | void(*)(void *) | hook, |
void * | param | ||
) |
Executes callback upon C3D_FrameEnd().
[in] | hook | Function callback. |
[in] | param | User data. |
float C3D_FrameRate | ( | float | fps | ) |
Specifies framerate cap. Specifies target framerate for C3D_FrameSync().
[in] | fps | Specifies the target framerate. Must be between 0.0 and 60.0 fps. |
void C3D_FrameSplit | ( | u8 | flags | ) |
Splits and submits the GPU cmdlist in the middle of a renderqueue frame.
[in] | flags | Specifies 0 or more GX_CMDLIST flags. |
void C3D_FrameSync | ( | void | ) |
Performs framerate limiting. Waits for the required amount of vblanks specified by C3D_FrameRate().
float C3D_GetDrawingTime | ( | void | ) |
Gets time spent by the GPU during last render.
float C3D_GetProcessingTime | ( | void | ) |
Gets time elapsed between last C3D_FrameBegin() and C3D_FrameEnd().
|
inlinestatic |
Clears framebuffer of target.
[in] | target | Pointer to render target. |
[in] | clearBits | Specifies which buffers to clear. (see C3D_ClearBits) |
[in] | clearColor | 32 bit RGBA value to clear color buffer with. |
[in] | clearDepth | Value to clear depth buffer with. |
C3D_RenderTarget* C3D_RenderTargetCreate | ( | int | width, |
int | height, | ||
GPU_COLORBUF | colorFmt, | ||
C3D_DEPTHTYPE | depthFmt | ||
) |
Creates a new render target.
[in] | width | Specifies width of the render target in pixels. |
[in] | height | Specifies height of the render target in pixels. |
[in] | colorFmt | Specifies the color format of the render target. |
[in] | depthFmt | Specifies the depth format of the render target using GPU_DEPTHBUF. (-1 for no depth type) |
C3D_RenderTarget* C3D_RenderTargetCreateFromTex | ( | C3D_Tex * | tex, |
GPU_TEXFACE | face, | ||
int | level, | ||
C3D_DEPTHTYPE | depthFmt | ||
) |
Constructs render target for texture.
[in] | tex | Pointer to C3D_Tex. |
[in] | face | Specifies face of cubemap to be used. (GPU_TEXFACE_2D if not cubemap) |
[in] | level | Specifies mipmap level to use. |
[in] | depthFmt | Specifies the depth format of the render target using GPU_DEPTHBUF. (-1 for no depth type) |
void C3D_RenderTargetDelete | ( | C3D_RenderTarget * | target | ) |
Deletes render target.
[in] | target | Pointer to render target. |
|
inlinestatic |
Detaches render target from screen output.
[in] | target | Pointer to render target. |
void C3D_RenderTargetSetOutput | ( | C3D_RenderTarget * | target, |
gfxScreen_t | screen, | ||
gfx3dSide_t | side, | ||
u32 | transferFlags | ||
) |
Sets render target output to screen.
[in] | target | Pointer to render target. |
[in] | screen | Screen to transfer the framebuffer to. |
[in] | side | Side of the screen to transfer the framebuffer to. (unused for the bottom screen) |
[in] | transferFlags | Specifies GX_TRANSFER bitflags. |
Synchronizes and initiates a display transfer. Synchronizes and initiates a GX_DisplayTransfer().
[in] | inadr | Address of the input. |
[in] | indim | GX_BUFFER_DIM() of the input. |
[out] | outadr | Address of the output. |
[in] | outdim | GX_BUFFER_DIM() of the output. |
[in] | flags | Flags to transfer with. |
void C3D_SyncMemoryFill | ( | u32 * | buf0a, |
u32 | buf0v, | ||
u32 * | buf0e, | ||
u16 | control0, | ||
u32 * | buf1a, | ||
u32 | buf1v, | ||
u32 * | buf1e, | ||
u16 | control1 | ||
) |
Synchronizes and fills the memory of two buffers with the given values. Synchronizes and initiates a GX_MemoryFill().
[in] | buf0a | Start address of the first buffer. |
[in] | buf0v | Value to fill first buffer. |
[in] | buf0e | End address of the first buffer. |
[in] | control0 | Value to fill the first buffer with. |
[in] | buf1a | Start address of the second buffer. |
[in] | buf1v | Value to fill second buffer. |
[in] | buf1e | End address of the second buffer. |
[in] | control1 | Value to fill the second buffer with. |
Synchronizes and initiates a texture copy. Synchronizes and initiates a GX_TextureCopy().
[in] | inadr | Address of the input. |
[in] | indim | GX_BUFFER_DIM() of the input. |
[out] | outadr | Address of the output. |
[in] | outdim | GX_BUFFER_DIM() of the output. |
[in] | size | Size of the data to transfer. |
[in] | flags | Flags to transfer with. |