Frame Interp: UI Pacing Simplification

This commit is contained in:
Irastris
2026-04-17 21:21:44 -04:00
parent bc6c132d69
commit 59d2014fb9
13 changed files with 125 additions and 261 deletions
+25 -89
View File
@@ -471,72 +471,32 @@ void darwFilter(GXColor matColor) {
GXEnd();
}
#ifdef TARGET_PC
static void mDoGph_AdvanceFadeState() {
if (mDoGph_gInf_c::isFade() != 0) {
f32 fade_rate = mDoGph_gInf_c::getFadeRate() + mDoGph_gInf_c::getFadeSpeed();
if (fade_rate < 0.0f) {
fade_rate = 0.0f;
mDoGph_gInf_c::offFade();
} else if (fade_rate > 1.0f) {
fade_rate = 1.0f;
}
mDoGph_gInf_c::setFadeRate(fade_rate);
mDoGph_gInf_c::getFadeColor().a = 255.0f * fade_rate;
} else {
GXColor& fade_color = mDoGph_gInf_c::getFadeColor();
if (dComIfG_getBrightness() != 255) {
fade_color.r = 0;
fade_color.g = 0;
fade_color.b = 0;
fade_color.a = 255 - dComIfG_getBrightness();
} else {
fade_color.a = 0;
}
}
}
static void mDoGph_AdvanceFadeState(u32 tick_count) {
for (u32 i = 0; i < tick_count; ++i) {
mDoGph_AdvanceFadeState();
}
}
static void mDoGph_DrawStoredFade() {
GXColor& fade_color = mDoGph_gInf_c::getFadeColor();
if (fade_color.a != 0) {
darwFilter(fade_color);
}
}
void mDoGph_gInf_c::calcFade() {
mDoGph_AdvanceFadeState();
mDoGph_DrawStoredFade();
}
#else
void mDoGph_gInf_c::calcFade() {
if (mDoGph_gInf_c::mFade != 0) {
mFadeRate += mFadeSpeed;
#if TARGET_PC
if (dusk::frame_interp::get_ui_tick_pending())
#endif
{
if (mFade != 0) {
mFadeRate += mFadeSpeed;
if (mFadeRate < 0.0f) {
mFadeRate = 0.0f;
mDoGph_gInf_c::mFade = 0;
} else {
if (mFadeRate > 1.0f) {
mFadeRate = 1.0f;
if (mFadeRate < 0.0f) {
mFadeRate = 0.0f;
mFade = 0;
} else {
if (mFadeRate > 1.0f) {
mFadeRate = 1.0f;
}
}
}
mFadeColor.a = 255.0f * mFadeRate;
} else {
if (dComIfG_getBrightness() != 255) {
mFadeColor.r = 0;
mFadeColor.g = 0;
mFadeColor.b = 0;
mFadeColor.a = 255 - dComIfG_getBrightness();
mFadeColor.a = 255.0f * mFadeRate;
} else {
mFadeColor.a = 0;
if (dComIfG_getBrightness() != 255) {
mFadeColor.r = 0;
mFadeColor.g = 0;
mFadeColor.b = 0;
mFadeColor.a = 255 - dComIfG_getBrightness();
} else {
mFadeColor.a = 0;
}
}
}
@@ -544,7 +504,6 @@ void mDoGph_gInf_c::calcFade() {
darwFilter(mFadeColor);
}
}
#endif
#if PLATFORM_WII || PLATFORM_SHIELD
u32 mDoGph_gInf_c::csr_c::m_blurID;
@@ -954,9 +913,6 @@ int mDoGph_AfterOfDraw() {
JUTVideo::getManager()->setRenderMode(mDoMch_render_c::getRenderModeObj());
mDoGph_gInf_c::endFrame();
#ifdef TARGET_PC
dusk::frame_interp::notify_sim_tick_complete();
#endif
return 1;
}
@@ -2114,8 +2070,6 @@ int mDoGph_Painter() {
#if TARGET_PC
dusk::g_imguiConsole.PreDraw();
const u32 pending_ui_ticks = dusk::frame_interp::begin_presentation_ui_pass();
#endif
#if DEBUG
@@ -2123,7 +2077,7 @@ int mDoGph_Painter() {
#endif
#ifdef TARGET_PC
for (u32 i = 0; i < pending_ui_ticks; ++i)
if (dusk::frame_interp::get_ui_tick_pending())
#endif
{
dComIfGp_particle_calcMenu();
@@ -2214,7 +2168,7 @@ int mDoGph_Painter() {
view_port->height);
#ifdef TARGET_PC
// Frame interpolation: Call setViewMtx earlier so that it's interpolated in time for draw_info to use it
// FRAME INTERP NOTE: Call setViewMtx earlier so that it's interpolated in time for draw_info to use it
j3dSys.setViewMtx(camera_p->view.viewMtx);
JPADrawInfo draw_info(j3dSys.getViewMtx(), camera_p->view.fovy, camera_p->view.aspect);
#else
@@ -2615,12 +2569,7 @@ int mDoGph_Painter() {
if (strcmp(dComIfGp_getStartStageName(), "F_SP127") != 0 &&
(mDoGph_gInf_c::isFade() & 0x80) == 0)
{
#ifdef TARGET_PC
mDoGph_AdvanceFadeState(pending_ui_ticks);
mDoGph_DrawStoredFade();
#else
mDoGph_gInf_c::calcFade();
#endif
}
#if DEBUG
@@ -2686,7 +2635,7 @@ int mDoGph_Painter() {
GXSetClipMode(GX_CLIP_ENABLE);
#if TARGET_PC
for (u32 i = 0; i < pending_ui_ticks; ++i)
if (dusk::frame_interp::get_ui_tick_pending())
#endif
{
dDlst_list_c::calcWipe();
@@ -2740,12 +2689,7 @@ int mDoGph_Painter() {
if (strcmp(dComIfGp_getStartStageName(), "F_SP127") == 0 || (mDoGph_gInf_c::isFade() & 0x80) != 0)
{
#ifdef TARGET_PC
mDoGph_AdvanceFadeState(pending_ui_ticks);
mDoGph_DrawStoredFade();
#else
mDoGph_gInf_c::calcFade();
#endif
}
GX_DEBUG_GROUP(dComIfGp_particle_draw2DmenuFore, &draw_info3);
@@ -2778,18 +2722,10 @@ int mDoGph_Painter() {
#if TARGET_PC
dusk::g_imguiConsole.PostDraw();
if (dusk::getSettings().game.enableFrameInterpolation) {
JFWDisplay::getManager()->setFaderSimSteps(pending_ui_ticks);
}
#endif
mDoGph_gInf_c::endRender();
#ifdef TARGET_PC
dusk::frame_interp::end_presentation_ui_pass();
#endif
#if WIDESCREEN_SUPPORT
mDoGph_gInf_c::offWideZoom();
#endif