@@ -102,7 +102,7 @@ static int s_targetFPS = 0; // 0 = follow browser refresh rate
102102static double s_lastFrameTime = 0.0 ; // ms
103103static double s_accumulator = 0.0 ; // ms
104104
105- static void renderFrame ();
105+ static void stepFrame ();
106106
107107static void updateFrame ()
108108{
@@ -112,7 +112,7 @@ static void updateFrame()
112112 // First frame: render immediately
113113 if (s_lastFrameTime <= 0.0 ) [[unlikely]]
114114 {
115- renderFrame ();
115+ stepFrame ();
116116 s_lastFrameTime = now;
117117 return ;
118118 }
@@ -124,7 +124,7 @@ static void updateFrame()
124124 if (delta > 1000.0 ) [[unlikely]]
125125 {
126126 s_accumulator = 0.0 ;
127- renderFrame ();
127+ stepFrame ();
128128 return ;
129129 }
130130
@@ -133,28 +133,27 @@ static void updateFrame()
133133 // If targetFPS is 0, follow browser refresh rate directly
134134 if (s_targetFPS <= 0 )
135135 {
136- renderFrame ();
136+ stepFrame ();
137137 return ;
138138 }
139139
140140 // Frame skipping logic based on accumulator
141141 double targetInterval = 1000.0 / s_targetFPS;
142142 if (s_accumulator >= targetInterval)
143143 {
144- renderFrame ();
144+ stepFrame ();
145145 s_accumulator -= targetInterval;
146146 if (s_accumulator < 0.0 ) [[unlikely]] // floating-point safety
147147 s_accumulator = 0.0 ;
148148 } // else onIdle
149149}
150150
151- static void renderFrame ()
151+ static void stepFrame ()
152152{
153153 auto director = __director;
154154 auto renderView = director->getRenderView ();
155155
156- director->renderFrame ();
157- renderView->pollEvents ();
156+ director->stepFrame ();
158157
159158 if (renderView->windowShouldClose ())
160159 {
@@ -164,7 +163,7 @@ static void renderFrame()
164163 if (renderView->isGfxContextReady ())
165164 {
166165 director->end ();
167- director->renderFrame ();
166+ director->stepFrame ();
168167 }
169168 renderView->release ();
170169
0 commit comments