From 696ac996d1551b91fde98de1d81606f02bcad609 Mon Sep 17 00:00:00 2001 From: fincs Date: Sat, 5 Sep 2015 20:24:55 +0200 Subject: [PATCH] Remove u32* gxbuf parameter in GX/GPU functions --- libctru/include/3ds/gfx.h | 1 - libctru/include/3ds/gpu/gpu.h | 6 ++--- libctru/include/3ds/gpu/gx.h | 14 ++++++----- libctru/source/gfx.c | 1 + libctru/source/gpu/gpu-old.c | 2 +- libctru/source/gpu/gpu.c | 14 +++++------ libctru/source/{services => gpu}/gx.c | 36 +++++++++------------------ 7 files changed, 32 insertions(+), 42 deletions(-) rename libctru/source/{services => gpu}/gx.c (64%) diff --git a/libctru/include/3ds/gfx.h b/libctru/include/3ds/gfx.h index 4d7a660..abcd3eb 100644 --- a/libctru/include/3ds/gfx.h +++ b/libctru/include/3ds/gfx.h @@ -147,4 +147,3 @@ u8* gfxGetFramebuffer(gfxScreen_t screen, gfx3dSide_t side, u16* width, u16* hei extern u8* gfxTopLeftFramebuffers[2]; extern u8* gfxTopRightFramebuffers[2]; extern u8* gfxBottomFramebuffers[2]; -extern u32* gxCmdBuf; diff --git a/libctru/include/3ds/gpu/gpu.h b/libctru/include/3ds/gpu/gpu.h index 42ae896..0267188 100644 --- a/libctru/include/3ds/gpu/gpu.h +++ b/libctru/include/3ds/gpu/gpu.h @@ -14,10 +14,10 @@ void GPUCMD_SetBuffer(u32* adr, u32 size, u32 offset); void GPUCMD_SetBufferOffset(u32 offset); void GPUCMD_GetBuffer(u32** adr, u32* size, u32* offset); void GPUCMD_AddRawCommands(u32* cmd, u32 size); -void GPUCMD_Run(u32* gxbuf); -void GPUCMD_FlushAndRun(u32* gxbuf); +void GPUCMD_Run(void); +void GPUCMD_FlushAndRun(void); void GPUCMD_Add(u32 header, u32* param, u32 paramlength); -void GPUCMD_Finalize(); +void GPUCMD_Finalize(void); u32 f32tof24(float f); u32 computeInvValue(u32 val); diff --git a/libctru/include/3ds/gpu/gx.h b/libctru/include/3ds/gpu/gx.h index e2298b4..46672da 100644 --- a/libctru/include/3ds/gpu/gx.h +++ b/libctru/include/3ds/gpu/gx.h @@ -51,9 +51,11 @@ typedef enum #define GX_TRANSFER_OUT_FORMAT(x) ((x)<<12) #define GX_TRANSFER_SCALING(x) ((x)<<24) -Result GX_RequestDma(u32* gxbuf, u32* src, u32* dst, u32 length); -Result GX_SetCommandList_Last(u32* gxbuf, u32* buf0a, u32 buf0s, u8 flags); -Result GX_SetMemoryFill(u32* gxbuf, u32* buf0a, u32 buf0v, u32* buf0e, u16 control0, u32* buf1a, u32 buf1v, u32* buf1e, u16 control1); -Result GX_SetDisplayTransfer(u32* gxbuf, u32* inadr, u32 indim, u32* outadr, u32 outdim, u32 flags); -Result GX_SetTextureCopy(u32* gxbuf, u32* inadr, u32 indim, u32* outadr, u32 outdim, u32 size, u32 flags); -Result GX_SetCommandList_First(u32* gxbuf, u32* buf0a, u32 buf0s, u32* buf1a, u32 buf1s, u32* buf2a, u32 buf2s); +Result GX_RequestDma(u32* src, u32* dst, u32 length); +Result GX_SetCommandList_Last(u32* buf0a, u32 buf0s, u8 flags); +Result GX_SetMemoryFill(u32* buf0a, u32 buf0v, u32* buf0e, u16 control0, u32* buf1a, u32 buf1v, u32* buf1e, u16 control1); +Result GX_SetDisplayTransfer(u32* inadr, u32 indim, u32* outadr, u32 outdim, u32 flags); +Result GX_SetTextureCopy(u32* inadr, u32 indim, u32* outadr, u32 outdim, u32 size, u32 flags); +Result GX_SetCommandList_First(u32* buf0a, u32 buf0s, u32* buf1a, u32 buf1s, u32* buf2a, u32 buf2s); + +extern u32* gxCmdBuf; diff --git a/libctru/source/gfx.c b/libctru/source/gfx.c index 0688804..c140dfc 100644 --- a/libctru/source/gfx.c +++ b/libctru/source/gfx.c @@ -6,6 +6,7 @@ #include <3ds/svc.h> #include <3ds/linear.h> #include <3ds/vram.h> +#include <3ds/gpu/gx.h> GSP_FramebufferInfo topFramebufferInfo, bottomFramebufferInfo; diff --git a/libctru/source/gpu/gpu-old.c b/libctru/source/gpu/gpu-old.c index 897ea57..6547850 100644 --- a/libctru/source/gpu/gpu-old.c +++ b/libctru/source/gpu/gpu-old.c @@ -138,7 +138,7 @@ void GPU_Reset(u32* gxbuf, u32* gpuBuf, u32 gpuBufSize) for(i=0;i>1)&1; //when non-zero, call svcFlushProcessDataCache() with the specified buffer - return GSPGPU_SubmitGxCommand(gxbuf, gxCommand, NULL); + return GSPGPU_SubmitGxCommand(gxCmdBuf, gxCommand, NULL); } -Result GX_SetMemoryFill(u32* gxbuf, u32* buf0a, u32 buf0v, u32* buf0e, u16 control0, u32* buf1a, u32 buf1v, u32* buf1e, u16 control1) +Result GX_SetMemoryFill(u32* buf0a, u32 buf0v, u32* buf0e, u16 control0, u32* buf1a, u32 buf1v, u32* buf1e, u16 control1) { - if(!gxbuf)gxbuf=gxCmdBuf; - u32 gxCommand[0x8]; // gxCommand[0]=0x02; //CommandID gxCommand[0]=0x01000102; //CommandID @@ -55,14 +49,12 @@ Result GX_SetMemoryFill(u32* gxbuf, u32* buf0a, u32 buf0v, u32* buf0e, u16 contr gxCommand[6]=(u32)buf1e; //buf1 end addr gxCommand[7]=(control0)|(control1<<16); - return GSPGPU_SubmitGxCommand(gxbuf, gxCommand, NULL); + return GSPGPU_SubmitGxCommand(gxCmdBuf, gxCommand, NULL); } // Flags, for applications this is 0x1001000 for the main screen, and 0x1000 for the sub screen. -Result GX_SetDisplayTransfer(u32* gxbuf, u32* inadr, u32 indim, u32* outadr, u32 outdim, u32 flags) +Result GX_SetDisplayTransfer(u32* inadr, u32 indim, u32* outadr, u32 outdim, u32 flags) { - if(!gxbuf)gxbuf=gxCmdBuf; - u32 gxCommand[0x8]; gxCommand[0]=0x03; //CommandID gxCommand[1]=(u32)inadr; @@ -72,13 +64,11 @@ Result GX_SetDisplayTransfer(u32* gxbuf, u32* inadr, u32 indim, u32* outadr, u32 gxCommand[5]=flags; gxCommand[6]=gxCommand[7]=0x0; - return GSPGPU_SubmitGxCommand(gxbuf, gxCommand, NULL); + return GSPGPU_SubmitGxCommand(gxCmdBuf, gxCommand, NULL); } -Result GX_SetTextureCopy(u32* gxbuf, u32* inadr, u32 indim, u32* outadr, u32 outdim, u32 size, u32 flags) +Result GX_SetTextureCopy(u32* inadr, u32 indim, u32* outadr, u32 outdim, u32 size, u32 flags) { - if(!gxbuf)gxbuf=gxCmdBuf; - u32 gxCommand[0x8]; gxCommand[0]=0x04; //CommandID gxCommand[1]=(u32)inadr; @@ -89,13 +79,11 @@ Result GX_SetTextureCopy(u32* gxbuf, u32* inadr, u32 indim, u32* outadr, u32 out gxCommand[6]=flags; gxCommand[7]=0x0; - return GSPGPU_SubmitGxCommand(gxbuf, gxCommand, NULL); + return GSPGPU_SubmitGxCommand(gxCmdBuf, gxCommand, NULL); } -Result GX_SetCommandList_First(u32* gxbuf, u32* buf0a, u32 buf0s, u32* buf1a, u32 buf1s, u32* buf2a, u32 buf2s) +Result GX_SetCommandList_First(u32* buf0a, u32 buf0s, u32* buf1a, u32 buf1s, u32* buf2a, u32 buf2s) { - if(!gxbuf)gxbuf=gxCmdBuf; - u32 gxCommand[0x8]; gxCommand[0]=0x05; //CommandID gxCommand[1]=(u32)buf0a; //buf0 address @@ -106,5 +94,5 @@ Result GX_SetCommandList_First(u32* gxbuf, u32* buf0a, u32 buf0s, u32* buf1a, u3 gxCommand[6]=(u32)buf2s; //buf2 size gxCommand[7]=0x0; - return GSPGPU_SubmitGxCommand(gxbuf, gxCommand, NULL); + return GSPGPU_SubmitGxCommand(gxCmdBuf, gxCommand, NULL); }