Skip to content

Commit

Permalink
Fix division by zero error when updating the render progress. (#1777)
Browse files Browse the repository at this point in the history
  • Loading branch information
leMaik authored Oct 6, 2024
1 parent 61a184a commit 23f4598
Showing 1 changed file with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -387,12 +387,17 @@ private int samplesPerSecond() {

private void updateRenderProgress() {
// Notify progress listener.
int current = bufferedScene.spp;
int target = bufferedScene.getTargetSpp();
long etaMillis = (long) (((target - bufferedScene.spp) * bufferedScene.renderTime) / bufferedScene.spp);
if (etaMillis > 0) {
renderTask.update("Rendering", target, bufferedScene.spp, Duration.ofMillis(etaMillis));
} else {
if (current == 0) {
renderTask.update("Rendering", target, bufferedScene.spp);
} else {
long etaMillis = ((target - current) * bufferedScene.renderTime) / current;
if (etaMillis > 0) {
renderTask.update("Rendering", target, current, Duration.ofMillis(etaMillis));
} else {
renderTask.update("Rendering", target, current);
}
}

synchronized (this) {
Expand Down

0 comments on commit 23f4598

Please sign in to comment.