]> Chaos Git - corbenik/ctrulib.git/commitdiff
Remove u32* gxbuf parameter in GX/GPU functions
authorfincs <fincs.alt1@gmail.com>
Sat, 5 Sep 2015 18:24:55 +0000 (20:24 +0200)
committerfincs <fincs.alt1@gmail.com>
Sat, 5 Sep 2015 18:24:55 +0000 (20:24 +0200)
libctru/include/3ds/gfx.h
libctru/include/3ds/gpu/gpu.h
libctru/include/3ds/gpu/gx.h
libctru/source/gfx.c
libctru/source/gpu/gpu-old.c
libctru/source/gpu/gpu.c
libctru/source/gpu/gx.c [moved from libctru/source/services/gx.c with 64% similarity]

index 4d7a660e202cbc378c808a9c2ab121ed6e39a39a..abcd3eb87a00dcf5c02d419a720339f01c6d2499 100644 (file)
@@ -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;
index 42ae89659327b86fdf81cafe491999a1e018212c..0267188895f46faa670a24b4b0ad56a452a3b0bb 100644 (file)
@@ -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);
index e2298b40755e5694a9019b559e30261148e5bf2a..46672da906179330717740a13c26e3b5a9005a7f 100644 (file)
@@ -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;
index 06888048a414b2fb6cb7bb2518a5c64c0fceaa07..c140dfc0a5e7c0131ffa84054af381ab798eaa1d 100644 (file)
@@ -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;
 
index 897ea57c95c14f5b5b4d040e30b21384f12998e9..65478504f043a34bfa08880567d85fb64ae4f1a4 100644 (file)
@@ -138,7 +138,7 @@ void GPU_Reset(u32* gxbuf, u32* gpuBuf, u32 gpuBufSize)
        for(i=0;i<gpuResetSequenceLength;i++)GPUCMD_AddSingleParam(gpuResetSequence[i*2],gpuResetSequence[i*2+1]);
 
        GPUCMD_Finalize();
-       GPUCMD_Run(gpuBuf);
+       //GPUCMD_Run(gpuBuf);
        GPUCMD_SetBufferOffset(0);
 }
 
index 1662c530b9c2fc20264018bdbe855632087b737b..ecf841002c8a05545c0e85778cf68b2f1e15f70c 100644 (file)
@@ -40,20 +40,20 @@ void GPUCMD_AddRawCommands(u32* cmd, u32 size)
        gpuCmdBufOffset+=size;
 }
 
-void GPUCMD_Run(u32* gxbuf)
+void GPUCMD_Run(void)
 {
-       GX_SetCommandList_First(gxbuf, gpuCmdBuf, gpuCmdBufOffset*4, NULL, 0, NULL, 0);
-       GX_SetCommandList_Last(gxbuf, gpuCmdBuf, gpuCmdBufOffset*4, 0x0);
+       GX_SetCommandList_First(gpuCmdBuf, gpuCmdBufOffset*4, NULL, 0, NULL, 0);
+       GX_SetCommandList_Last(gpuCmdBuf, gpuCmdBufOffset*4, 0x0);
 }
 
 extern u32 __linear_heap_size;
 extern u32 __linear_heap;
 
-void GPUCMD_FlushAndRun(u32* gxbuf)
+void GPUCMD_FlushAndRun(void)
 {
        //take advantage of GX_SetCommandList_First to flush gsp heap
-       GX_SetCommandList_First(gxbuf, gpuCmdBuf, gpuCmdBufOffset*4, (u32 *) __linear_heap, __linear_heap_size, NULL, 0);
-       GX_SetCommandList_Last(gxbuf, gpuCmdBuf, gpuCmdBufOffset*4, 0x0);
+       GX_SetCommandList_First(gpuCmdBuf, gpuCmdBufOffset*4, (u32 *) __linear_heap, __linear_heap_size, NULL, 0);
+       GX_SetCommandList_Last(gpuCmdBuf, gpuCmdBufOffset*4, 0x0);
 }
 
 void GPUCMD_Add(u32 header, u32* param, u32 paramlength)
@@ -81,7 +81,7 @@ void GPUCMD_Add(u32 header, u32* param, u32 paramlength)
        if(paramlength&1)gpuCmdBuf[gpuCmdBufOffset++]=0x00000000; //alignment
 }
 
-void GPUCMD_Finalize()
+void GPUCMD_Finalize(void)
 {
        GPUCMD_AddMaskedWrite(GPUREG_PRIMITIVE_CONFIG, 0x8, 0x00000000);
        GPUCMD_AddWrite(GPUREG_0111, 0x00000001);
similarity index 64%
rename from libctru/source/services/gx.c
rename to libctru/source/gpu/gx.c
index cfc017b53755fd76c3ddb8d481bcd6cb66451a00..21153436e7201f302d316e869f9b3f9598f90c8a 100644 (file)
 
 u32* gxCmdBuf;
 
-Result GX_RequestDma(u32* gxbuf, u32* src, u32* dst, u32 length)
+Result GX_RequestDma(u32* src, u32* dst, u32 length)
 {
-       if(!gxbuf)gxbuf=gxCmdBuf;
-
        u32 gxCommand[0x8];
        gxCommand[0]=0x00; //CommandID
        gxCommand[1]=(u32)src; //source address
@@ -22,13 +20,11 @@ Result GX_RequestDma(u32* gxbuf, u32* src, u32* dst, u32 length)
        gxCommand[3]=length; //size
        gxCommand[4]=gxCommand[5]=gxCommand[6]=gxCommand[7]=0x0;
 
-       return GSPGPU_SubmitGxCommand(gxbuf, gxCommand, NULL);
+       return GSPGPU_SubmitGxCommand(gxCmdBuf, gxCommand, NULL);
 }
 
-Result GX_SetCommandList_Last(u32* gxbuf, u32* buf0a, u32 buf0s, u8 flags)
+Result GX_SetCommandList_Last(u32* buf0a, u32 buf0s, u8 flags)
 {
-       if(!gxbuf)gxbuf=gxCmdBuf;
-
        u32 gxCommand[0x8];
        gxCommand[0]=0x01; //CommandID
        gxCommand[1]=(u32)buf0a; //buf0 address
@@ -37,13 +33,11 @@ Result GX_SetCommandList_Last(u32* gxbuf, u32* buf0a, u32 buf0s, u8 flags)
        gxCommand[4]=gxCommand[5]=gxCommand[6]=0x0;
        gxCommand[7]=(flags>>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);
 }