From 974b1094f34c0689ed55c1c7010acfa334f7e553 Mon Sep 17 00:00:00 2001 From: smea Date: Sun, 2 Nov 2014 21:10:56 -0800 Subject: [PATCH] GPUCMD_FlushAndRun --- libctru/include/3ds/gpu/gpu.h | 1 + libctru/source/gpu/gpu.c | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/libctru/include/3ds/gpu/gpu.h b/libctru/include/3ds/gpu/gpu.h index 16f5b8f..ef32e46 100644 --- a/libctru/include/3ds/gpu/gpu.h +++ b/libctru/include/3ds/gpu/gpu.h @@ -5,6 +5,7 @@ void GPU_Reset(u32* gxbuf, u32* gpuBuf, u32 gpuBufSize); void GPUCMD_SetBuffer(u32* adr, u32 size, u32 offset); void GPUCMD_Run(u32* gxbuf); +void GPUCMD_FlushAndRun(u32* gxbuf); void GPUCMD_Add(u32 cmd, u32* param, u32 paramlength); void GPUCMD_AddSingleParam(u32 cmd, u32 param); void GPUCMD_Finalize(); diff --git a/libctru/source/gpu/gpu.c b/libctru/source/gpu/gpu.c index 96ad76e..8f1b7bc 100644 --- a/libctru/source/gpu/gpu.c +++ b/libctru/source/gpu/gpu.c @@ -28,11 +28,20 @@ void GPUCMD_SetBuffer(u32* adr, u32 size, u32 offset) void GPUCMD_Run(u32* gxbuf) { - //should wait for some event here GX_SetCommandList_First(gxbuf, gpuCmdBuf, gpuCmdBufOffset*4, NULL, 0, NULL, 0); GX_SetCommandList_Last(gxbuf, gpuCmdBuf, gpuCmdBufOffset*4, 0x0); } +extern u32 __linear_heap_size; +extern u32* __linear_heap; + +void GPUCMD_FlushAndRun(u32* gxbuf) +{ + //take advantage of GX_SetCommandList_First to flush gsp heap + GX_SetCommandList_First(gxbuf, gpuCmdBuf, gpuCmdBufOffset*4, __linear_heap, __linear_heap_size, NULL, 0); + GX_SetCommandList_Last(gxbuf, gpuCmdBuf, gpuCmdBufOffset*4, 0x0); +} + void GPUCMD_Add(u32 cmd, u32* param, u32 paramlength) { u32 zero=0x0;