Add C3D_GetCmdBufUsage
This commit is contained in:
parent
4e2075f378
commit
184fad0623
@ -13,6 +13,8 @@ bool C3D_Init(size_t cmdBufSize);
|
|||||||
void C3D_FlushAsync(void);
|
void C3D_FlushAsync(void);
|
||||||
void C3D_Fini(void);
|
void C3D_Fini(void);
|
||||||
|
|
||||||
|
float C3D_GetCmdBufUsage(void);
|
||||||
|
|
||||||
void C3D_BindProgram(shaderProgram_s* program);
|
void C3D_BindProgram(shaderProgram_s* program);
|
||||||
|
|
||||||
void C3D_SetViewport(u32 x, u32 y, u32 w, u32 h);
|
void C3D_SetViewport(u32 x, u32 y, u32 w, u32 h);
|
||||||
|
@ -75,6 +75,7 @@ bool C3D_Init(size_t cmdBufSize)
|
|||||||
|
|
||||||
ctx->cmdBufSize = cmdBufSize/8; // Half of the size of the cmdbuf, in words
|
ctx->cmdBufSize = cmdBufSize/8; // Half of the size of the cmdbuf, in words
|
||||||
ctx->cmdBuf = (u32*)linearAlloc(cmdBufSize);
|
ctx->cmdBuf = (u32*)linearAlloc(cmdBufSize);
|
||||||
|
ctx->cmdBufUsage = 0;
|
||||||
if (!ctx->cmdBuf) return false;
|
if (!ctx->cmdBuf) return false;
|
||||||
|
|
||||||
GPUCMD_SetBuffer(ctx->cmdBuf, ctx->cmdBufSize, 0);
|
GPUCMD_SetBuffer(ctx->cmdBuf, ctx->cmdBufSize, 0);
|
||||||
@ -267,6 +268,7 @@ void C3Di_FinalizeFrame(u32** pBuf, u32* pSize)
|
|||||||
|
|
||||||
GPUCMD_Finalize();
|
GPUCMD_Finalize();
|
||||||
GPUCMD_GetBuffer(pBuf, NULL, pSize);
|
GPUCMD_GetBuffer(pBuf, NULL, pSize);
|
||||||
|
ctx->cmdBufUsage = (float)(*pSize) / ctx->cmdBufSize;
|
||||||
*pSize *= 4;
|
*pSize *= 4;
|
||||||
|
|
||||||
ctx->flags ^= C3DiF_CmdBuffer;
|
ctx->flags ^= C3DiF_CmdBuffer;
|
||||||
@ -292,6 +294,11 @@ void C3D_FlushAsync(void)
|
|||||||
GX_ProcessCommandList(cmdBuf, cmdBufSize, 0x0);
|
GX_ProcessCommandList(cmdBuf, cmdBufSize, 0x0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float C3D_GetCmdBufUsage(void)
|
||||||
|
{
|
||||||
|
return C3Di_GetContext()->cmdBufUsage;
|
||||||
|
}
|
||||||
|
|
||||||
void C3D_Fini(void)
|
void C3D_Fini(void)
|
||||||
{
|
{
|
||||||
C3D_Context* ctx = C3Di_GetContext();
|
C3D_Context* ctx = C3Di_GetContext();
|
||||||
|
@ -28,6 +28,7 @@ typedef struct
|
|||||||
{
|
{
|
||||||
u32* cmdBuf;
|
u32* cmdBuf;
|
||||||
size_t cmdBufSize;
|
size_t cmdBufSize;
|
||||||
|
float cmdBufUsage;
|
||||||
|
|
||||||
u32 flags;
|
u32 flags;
|
||||||
shaderProgram_s* program;
|
shaderProgram_s* program;
|
||||||
|
Loading…
Reference in New Issue
Block a user