diff --git a/examples/graphics/gpu/geoshader/source/gpu.c b/examples/graphics/gpu/geoshader/source/gpu.c index 60761fc..f950130 100644 --- a/examples/graphics/gpu/geoshader/source/gpu.c +++ b/examples/graphics/gpu/geoshader/source/gpu.c @@ -27,7 +27,7 @@ void gpuExit(void) void gpuClearBuffers(u32 clearColor) { - GX_SetMemoryFill( + GX_MemoryFill( colorBuf, clearColor, &colorBuf[240*400], GX_FILL_TRIGGER | GX_FILL_32BIT_DEPTH, depthBuf, 0, &depthBuf[240*400], GX_FILL_TRIGGER | GX_FILL_32BIT_DEPTH); gspWaitForPSC0(); // Wait for the fill to complete @@ -71,7 +71,7 @@ void gpuFrameEnd(void) gspWaitForP3D(); // Wait for the rendering to complete // Transfer the GPU output to the framebuffer - GX_SetDisplayTransfer( + GX_DisplayTransfer( colorBuf, GX_BUFFER_DIM(240, 400), (u32*)gfxGetFramebuffer(GFX_TOP, GFX_LEFT, NULL, NULL), GX_BUFFER_DIM(240, 400), DISPLAY_TRANSFER_FLAGS); diff --git a/examples/graphics/gpu/simple_tri/source/gpu.c b/examples/graphics/gpu/simple_tri/source/gpu.c index 60761fc..f950130 100644 --- a/examples/graphics/gpu/simple_tri/source/gpu.c +++ b/examples/graphics/gpu/simple_tri/source/gpu.c @@ -27,7 +27,7 @@ void gpuExit(void) void gpuClearBuffers(u32 clearColor) { - GX_SetMemoryFill( + GX_MemoryFill( colorBuf, clearColor, &colorBuf[240*400], GX_FILL_TRIGGER | GX_FILL_32BIT_DEPTH, depthBuf, 0, &depthBuf[240*400], GX_FILL_TRIGGER | GX_FILL_32BIT_DEPTH); gspWaitForPSC0(); // Wait for the fill to complete @@ -71,7 +71,7 @@ void gpuFrameEnd(void) gspWaitForP3D(); // Wait for the rendering to complete // Transfer the GPU output to the framebuffer - GX_SetDisplayTransfer( + GX_DisplayTransfer( colorBuf, GX_BUFFER_DIM(240, 400), (u32*)gfxGetFramebuffer(GFX_TOP, GFX_LEFT, NULL, NULL), GX_BUFFER_DIM(240, 400), DISPLAY_TRANSFER_FLAGS); diff --git a/examples/graphics/gpu/textured_cube/source/gpu.c b/examples/graphics/gpu/textured_cube/source/gpu.c index 60761fc..f950130 100644 --- a/examples/graphics/gpu/textured_cube/source/gpu.c +++ b/examples/graphics/gpu/textured_cube/source/gpu.c @@ -27,7 +27,7 @@ void gpuExit(void) void gpuClearBuffers(u32 clearColor) { - GX_SetMemoryFill( + GX_MemoryFill( colorBuf, clearColor, &colorBuf[240*400], GX_FILL_TRIGGER | GX_FILL_32BIT_DEPTH, depthBuf, 0, &depthBuf[240*400], GX_FILL_TRIGGER | GX_FILL_32BIT_DEPTH); gspWaitForPSC0(); // Wait for the fill to complete @@ -71,7 +71,7 @@ void gpuFrameEnd(void) gspWaitForP3D(); // Wait for the rendering to complete // Transfer the GPU output to the framebuffer - GX_SetDisplayTransfer( + GX_DisplayTransfer( colorBuf, GX_BUFFER_DIM(240, 400), (u32*)gfxGetFramebuffer(GFX_TOP, GFX_LEFT, NULL, NULL), GX_BUFFER_DIM(240, 400), DISPLAY_TRANSFER_FLAGS); diff --git a/libctru/include/3ds/gpu/gx.h b/libctru/include/3ds/gpu/gx.h index 46672da..2901196 100644 --- a/libctru/include/3ds/gpu/gx.h +++ b/libctru/include/3ds/gpu/gx.h @@ -51,11 +51,14 @@ typedef enum #define GX_TRANSFER_OUT_FORMAT(x) ((x)<<12) #define GX_TRANSFER_SCALING(x) ((x)<<24) +#define GX_CMDLIST_BIT0 BIT(0) +#define GX_CMDLIST_FLUSH BIT(1) + 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); +Result GX_ProcessCommandList(u32* buf0a, u32 buf0s, u8 flags); +Result GX_MemoryFill(u32* buf0a, u32 buf0v, u32* buf0e, u16 control0, u32* buf1a, u32 buf1v, u32* buf1e, u16 control1); +Result GX_DisplayTransfer(u32* inadr, u32 indim, u32* outadr, u32 outdim, u32 flags); +Result GX_TextureCopy(u32* inadr, u32 indim, u32* outadr, u32 outdim, u32 size, u32 flags); +Result GX_FlushCacheRegions(u32* buf0a, u32 buf0s, u32* buf1a, u32 buf1s, u32* buf2a, u32 buf2s); extern u32* gxCmdBuf; diff --git a/libctru/source/gpu/gpu.c b/libctru/source/gpu/gpu.c index e40ce68..db73a32 100644 --- a/libctru/source/gpu/gpu.c +++ b/libctru/source/gpu/gpu.c @@ -42,8 +42,7 @@ void GPUCMD_AddRawCommands(u32* cmd, u32 size) void GPUCMD_Run(void) { - GX_SetCommandList_First(gpuCmdBuf, gpuCmdBufOffset*4, NULL, 0, NULL, 0); - GX_SetCommandList_Last(gpuCmdBuf, gpuCmdBufOffset*4, 0x0); + GX_ProcessCommandList(gpuCmdBuf, gpuCmdBufOffset*4, GX_CMDLIST_FLUSH); } extern u32 __linear_heap_size; @@ -51,9 +50,9 @@ extern u32 __linear_heap; void GPUCMD_FlushAndRun(void) { - //take advantage of GX_SetCommandList_First to flush gsp heap - GX_SetCommandList_First(gpuCmdBuf, gpuCmdBufOffset*4, (u32 *) __linear_heap, __linear_heap_size, NULL, 0); - GX_SetCommandList_Last(gpuCmdBuf, gpuCmdBufOffset*4, 0x0); + //take advantage of GX_FlushCacheRegions to flush gsp heap + GX_FlushCacheRegions(gpuCmdBuf, gpuCmdBufOffset*4, (u32 *) __linear_heap, __linear_heap_size, NULL, 0); + GX_ProcessCommandList(gpuCmdBuf, gpuCmdBufOffset*4, 0x0); } void GPUCMD_Add(u32 header, u32* param, u32 paramlength) diff --git a/libctru/source/gpu/gx.c b/libctru/source/gpu/gx.c index 437dff7..6fc8b18 100644 --- a/libctru/source/gpu/gx.c +++ b/libctru/source/gpu/gx.c @@ -23,7 +23,7 @@ Result GX_RequestDma(u32* src, u32* dst, u32 length) return GSPGPU_SubmitGxCommand(gxCmdBuf, gxCommand); } -Result GX_SetCommandList_Last(u32* buf0a, u32 buf0s, u8 flags) +Result GX_ProcessCommandList(u32* buf0a, u32 buf0s, u8 flags) { u32 gxCommand[0x8]; gxCommand[0]=0x01; //CommandID @@ -36,7 +36,7 @@ Result GX_SetCommandList_Last(u32* buf0a, u32 buf0s, u8 flags) return GSPGPU_SubmitGxCommand(gxCmdBuf, gxCommand); } -Result GX_SetMemoryFill(u32* buf0a, u32 buf0v, u32* buf0e, u16 control0, u32* buf1a, u32 buf1v, u32* buf1e, u16 control1) +Result GX_MemoryFill(u32* buf0a, u32 buf0v, u32* buf0e, u16 control0, u32* buf1a, u32 buf1v, u32* buf1e, u16 control1) { u32 gxCommand[0x8]; // gxCommand[0]=0x02; //CommandID @@ -53,7 +53,7 @@ Result GX_SetMemoryFill(u32* buf0a, u32 buf0v, u32* buf0e, u16 control0, u32* bu } // Flags, for applications this is 0x1001000 for the main screen, and 0x1000 for the sub screen. -Result GX_SetDisplayTransfer(u32* inadr, u32 indim, u32* outadr, u32 outdim, u32 flags) +Result GX_DisplayTransfer(u32* inadr, u32 indim, u32* outadr, u32 outdim, u32 flags) { u32 gxCommand[0x8]; gxCommand[0]=0x03; //CommandID @@ -67,7 +67,7 @@ Result GX_SetDisplayTransfer(u32* inadr, u32 indim, u32* outadr, u32 outdim, u32 return GSPGPU_SubmitGxCommand(gxCmdBuf, gxCommand); } -Result GX_SetTextureCopy(u32* inadr, u32 indim, u32* outadr, u32 outdim, u32 size, u32 flags) +Result GX_TextureCopy(u32* inadr, u32 indim, u32* outadr, u32 outdim, u32 size, u32 flags) { u32 gxCommand[0x8]; gxCommand[0]=0x04; //CommandID @@ -82,7 +82,7 @@ Result GX_SetTextureCopy(u32* inadr, u32 indim, u32* outadr, u32 outdim, u32 siz return GSPGPU_SubmitGxCommand(gxCmdBuf, gxCommand); } -Result GX_SetCommandList_First(u32* buf0a, u32 buf0s, u32* buf1a, u32 buf1s, u32* buf2a, u32 buf2s) +Result GX_FlushCacheRegions(u32* buf0a, u32 buf0s, u32* buf1a, u32 buf1s, u32* buf2a, u32 buf2s) { u32 gxCommand[0x8]; gxCommand[0]=0x05; //CommandID