all repos — mgba @ cc06e177bbab013167c620a9bd860f4f6c120564

mGBA Game Boy Advance Emulator

3DS: Make pre-init garbage slightly less bad
Vicki Pfau vi@endrift.com
Fri, 31 Jul 2020 19:44:13 -0700
commit

cc06e177bbab013167c620a9bd860f4f6c120564

parent

0d6946dceecb7d364c13258b6d9cfc8a9eb20bd1

1 files changed, 14 insertions(+), 0 deletions(-)

jump to
M src/platform/3ds/main.csrc/platform/3ds/main.c

@@ -122,6 +122,15 @@ if (!topScreen[0] || !topScreen[1] || !bottomScreen[0] || !bottomScreen[1]) {

return false; } + C3D_FrameBegin(0); + C3D_FrameDrawOn(bottomScreen[0]); + C3D_RenderTargetClear(bottomScreen[0], C3D_CLEAR_COLOR, 0, 0); + C3D_FrameDrawOn(topScreen[0]); + C3D_RenderTargetClear(topScreen[0], C3D_CLEAR_COLOR, 0, 0); + C3D_RenderTargetSetOutput(topScreen[0], GFX_TOP, GFX_LEFT, GX_TRANSFER_IN_FORMAT(GX_TRANSFER_FMT_RGB8) | GX_TRANSFER_OUT_FORMAT(GX_TRANSFER_FMT_RGB8)); + C3D_RenderTargetSetOutput(bottomScreen[0], GFX_BOTTOM, GFX_LEFT, GX_TRANSFER_IN_FORMAT(GX_TRANSFER_FMT_RGB8) | GX_TRANSFER_OUT_FORMAT(GX_TRANSFER_FMT_RGB8)); + C3D_FrameEnd(0); + if (!C3D_TexInitVRAM(&upscaleBufferTex, 512, 512, GPU_RGB8)) { return false; }

@@ -129,6 +138,11 @@ upscaleBuffer = C3D_RenderTargetCreateFromTex(&upscaleBufferTex, GPU_TEXFACE_2D, 0, 0);

if (!upscaleBuffer) { return false; } + + C3D_FrameBegin(0); + C3D_FrameDrawOn(upscaleBuffer); + C3D_RenderTargetClear(upscaleBuffer, C3D_CLEAR_COLOR, 0, 0); + C3D_FrameEnd(0); return ctrInitGpu(); }