3DS: Update for new citro3d
Vicki Pfau vi@endrift.com
Sat, 19 May 2018 11:34:17 -0700
2 files changed,
9 insertions(+),
17 deletions(-)
M
src/platform/3ds/ctr-gpu.c
→
src/platform/3ds/ctr-gpu.c
@@ -133,7 +133,7 @@ activeTexture = texture;
C3D_TexBind(0, activeTexture); C3D_TexEnv* env = C3D_GetTexEnv(0); - C3D_TexEnvOp(env, C3D_Both, 0, 0, 0); + C3D_TexEnvInit(env); if (texture->fmt < GPU_LA8) { C3D_TexEnvSrc(env, C3D_Both, GPU_TEXTURE0, GPU_PRIMARY_COLOR, 0); C3D_TexEnvFunc(env, C3D_Both, GPU_MODULATE);@@ -144,11 +144,11 @@ C3D_TexEnvFunc(env, C3D_RGB, GPU_REPLACE);
C3D_TexEnvFunc(env, C3D_Alpha, GPU_MODULATE); } env = C3D_GetTexEnv(1); - C3D_TexEnvOp(env, C3D_Both, 0, 0, 0); + C3D_TexEnvInit(env); C3D_TexEnvSrc(env, C3D_Both, GPU_PREVIOUS, 0, 0); C3D_TexEnvFunc(env, C3D_Both, GPU_REPLACE); env = C3D_GetTexEnv(2); - C3D_TexEnvOp(env, C3D_Both, 0, 0, 0); + C3D_TexEnvInit(env); C3D_TexEnvSrc(env, C3D_Both, GPU_PREVIOUS, 0, 0); C3D_TexEnvFunc(env, C3D_Both, GPU_REPLACE);@@ -164,14 +164,14 @@ }
void ctrTextureMultiply(void) { C3D_TexEnv* env = C3D_GetTexEnv(1); - C3D_TexEnvOp(env, C3D_Both, 0, 0, 0); + C3D_TexEnvInit(env); C3D_TexEnvSrc(env, C3D_Both, GPU_PREVIOUS, GPU_TEXTURE0, 0); C3D_TexEnvFunc(env, C3D_Both, GPU_MODULATE); } void ctrTextureBias(u32 color) { C3D_TexEnv* env = C3D_GetTexEnv(2); - C3D_TexEnvOp(env, C3D_Both, 0, 0, 0); + C3D_TexEnvInit(env); C3D_TexEnvSrc(env, C3D_Both, GPU_PREVIOUS, GPU_CONSTANT, 0); C3D_TexEnvFunc(env, C3D_Both, GPU_ADD); C3D_TexEnvColor(env, color);
M
src/platform/3ds/main.c
→
src/platform/3ds/main.c
@@ -74,7 +74,6 @@ // TODO: Move into context
static void* outputBuffer; static struct mAVStream stream; static int16_t* audioLeft = 0; -static int16_t* audioRight = 0; static size_t audioPos = 0; static C3D_Tex outputTexture; static ndspWaveBuf dspBuffer[DSP_BUFFERS];@@ -114,8 +113,6 @@ upscaleBuffer = C3D_RenderTargetCreateFromTex(&upscaleBufferTex, GPU_TEXFACE_2D, 0, 0);
if (!upscaleBuffer) { return false; } - - C3D_RenderTargetSetClear(upscaleBuffer, C3D_CLEAR_COLOR, 0, 0); return ctrInitGpu(); }@@ -214,6 +211,8 @@
static void _postAudioBuffer(struct mAVStream* stream, blip_t* left, blip_t* right); static void _drawStart(void) { + C3D_FrameBufClear(&bottomScreen[doubleBuffer]->frameBuf, C3D_CLEAR_COLOR, 0, 0); + C3D_FrameBufClear(&topScreen[doubleBuffer]->frameBuf, C3D_CLEAR_COLOR, 0, 0); } static void _frameStart(void) {@@ -230,9 +229,6 @@ tickCounter = svcGetSystemTick();
} } C3D_FrameBegin(flags); - // Mark both buffers used to make sure they get cleared - C3D_FrameDrawOn(topScreen[doubleBuffer]); - C3D_FrameDrawOn(bottomScreen[doubleBuffer]); ctrStartFrame(); }@@ -247,8 +243,6 @@ C3D_FrameEnd(GX_CMDLIST_FLUSH);
frameStarted = false; doubleBuffer ^= 1; - C3D_FrameBufClear(&bottomScreen[doubleBuffer]->frameBuf, C3D_CLEAR_COLOR, 0, 0); - C3D_FrameBufClear(&topScreen[doubleBuffer]->frameBuf, C3D_CLEAR_COLOR, 0, 0); } static int _batteryState(void) {@@ -558,7 +552,7 @@
C3D_Tex* tex = &outputTexture; GSPGPU_FlushDataCache(outputBuffer, 256 * VIDEO_VERTICAL_PIXELS * 2); - C3D_SafeDisplayTransfer( + C3D_SyncDisplayTransfer( outputBuffer, GX_BUFFER_DIM(256, VIDEO_VERTICAL_PIXELS), tex->data, GX_BUFFER_DIM(256, 256), GX_TRANSFER_IN_FORMAT(GX_TRANSFER_FMT_RGB565) |@@ -570,7 +564,6 @@ blip_clear(runner->core->getAudioChannel(runner->core, 0));
blip_clear(runner->core->getAudioChannel(runner->core, 1)); } - gspWaitForPPF(); _drawTex(runner->core, faded); }@@ -587,13 +580,12 @@ memset(&newPixels[y * 256 + width], 0, (256 - width) * sizeof(color_t));
} GSPGPU_FlushDataCache(newPixels, 256 * height * sizeof(u32)); - C3D_SafeDisplayTransfer( + C3D_SyncDisplayTransfer( (u32*) newPixels, GX_BUFFER_DIM(256, height), tex->data, GX_BUFFER_DIM(256, 256), GX_TRANSFER_IN_FORMAT(GX_TRANSFER_FMT_RGB565) | GX_TRANSFER_OUT_FORMAT(GX_TRANSFER_FMT_RGB565) | GX_TRANSFER_OUT_TILED(1) | GX_TRANSFER_FLIP_VERT(1)); - gspWaitForPPF(); linearFree(newPixels); _drawTex(runner->core, faded);