
- Removed double buffered gpu cmdbuffer (might be added back later) - Added a global gxCmdQueue which by default is configured to run commands as they arrive (in the future it might be double buffered) - Added C3D_FrameSync for explicitly waiting for "vblank" - Repurposed C3D_FRAME_SYNCDRAW to perform C3D_FrameSync - Added C3D_FrameSplit for splitting/submitting the gpu cmdlist in the middle of a renderqueue frame - C3D_RenderTargetSetClear is still supported, however it's unofficially deprecated (it's performed after drawing/transferring instead of before drawing, which is pretty counter-intuitive) - C3D_RenderTargetSetOutput is explicitly NOT deprecated since it's necessary to avoid screen tearing when transferring to the screen framebuffers (this stems from a Nintendo design flaw where screen swap processing is done immediately after GX transfers finish)
63 lines
2.0 KiB
C
63 lines
2.0 KiB
C
#pragma once
|
|
#include "framebuffer.h"
|
|
|
|
typedef struct C3D_RenderTarget_tag C3D_RenderTarget;
|
|
|
|
struct C3D_RenderTarget_tag
|
|
{
|
|
C3D_RenderTarget *next, *prev;
|
|
C3D_FrameBuf frameBuf;
|
|
|
|
bool used;
|
|
bool ownsColor, ownsDepth;
|
|
|
|
bool linked;
|
|
gfxScreen_t screen;
|
|
gfx3dSide_t side;
|
|
C3D_ClearBits clearBits;
|
|
u32 transferFlags;
|
|
u32 clearColor, clearDepth;
|
|
};
|
|
|
|
// Flags for C3D_FrameBegin
|
|
enum
|
|
{
|
|
C3D_FRAME_SYNCDRAW = BIT(0), // Perform C3D_FrameSync before checking the GPU status
|
|
C3D_FRAME_NONBLOCK = BIT(1), // Return false instead of waiting if the GPU is busy
|
|
};
|
|
|
|
float C3D_FrameRate(float fps);
|
|
void C3D_FrameSync(void);
|
|
|
|
bool C3D_FrameBegin(u8 flags);
|
|
bool C3D_FrameDrawOn(C3D_RenderTarget* target);
|
|
void C3D_FrameSplit(u8 flags);
|
|
void C3D_FrameEnd(u8 flags);
|
|
|
|
float C3D_GetDrawingTime(void);
|
|
float C3D_GetProcessingTime(void);
|
|
|
|
#if defined(__GNUC__) && !defined(__cplusplus)
|
|
typedef union __attribute__((__transparent_union__))
|
|
{
|
|
int __i;
|
|
GPU_DEPTHBUF __e;
|
|
} C3D_DEPTHTYPE;
|
|
#define C3D_DEPTHTYPE_OK(_x) ((_x).__i >= 0)
|
|
#define C3D_DEPTHTYPE_VAL(_x) ((_x).__e)
|
|
#else
|
|
typedef int C3D_DEPTHTYPE;
|
|
#define C3D_DEPTHTYPE_OK(_x) ((_x) >= 0)
|
|
#define C3D_DEPTHTYPE_VAL(_x) ((GPU_DEPTHBUF)(_x))
|
|
#endif
|
|
|
|
C3D_RenderTarget* C3D_RenderTargetCreate(int width, int height, GPU_COLORBUF colorFmt, C3D_DEPTHTYPE depthFmt);
|
|
C3D_RenderTarget* C3D_RenderTargetCreateFromTex(C3D_Tex* tex, GPU_TEXFACE face, int level, C3D_DEPTHTYPE depthFmt);
|
|
void C3D_RenderTargetDelete(C3D_RenderTarget* target);
|
|
void C3D_RenderTargetSetClear(C3D_RenderTarget* target, C3D_ClearBits clearBits, u32 clearColor, u32 clearDepth);
|
|
void C3D_RenderTargetSetOutput(C3D_RenderTarget* target, gfxScreen_t screen, gfx3dSide_t side, u32 transferFlags);
|
|
|
|
void C3D_SafeDisplayTransfer(u32* inadr, u32 indim, u32* outadr, u32 outdim, u32 flags);
|
|
void C3D_SafeTextureCopy(u32* inadr, u32 indim, u32* outadr, u32 outdim, u32 size, u32 flags);
|
|
void C3D_SafeMemoryFill(u32* buf0a, u32 buf0v, u32* buf0e, u16 control0, u32* buf1a, u32 buf1v, u32* buf1e, u16 control1);
|