mirror of
https://github.com/GTNewHorizons/Angelica.git
synced 2026-11-21 04:42:17 +00:00
Stop capping mailbox present mode to the refresh rate (#2279)
This commit is contained in:
1 parent
98703a11be
commit
69124e3f2f
6 files changed
+43
-32
No files matched your search
@@ -112,7 +112,7 @@ public final class FramePacer {
|
||||
final int refreshHz = refreshHz(mode, cap, refreshPeriodNanos);
|
||||
|
||||
core.setRefreshPeriodNanos(refreshPeriodNanos);
|
||||
core.setTearFree(mode.tearFree());
|
||||
core.setFifo(mode == VSyncMode.ON);
|
||||
core.setVsyncOn(mode == VSyncMode.ON && honored);
|
||||
core.setCap(cap);
|
||||
|
||||
@@ -216,7 +216,7 @@ public final class FramePacer {
|
||||
|
||||
private static int refreshHz(VSyncMode mode, int capHz, long refreshPeriodNanos) {
|
||||
final int hz = RenderBackend.hzFromPeriod(refreshPeriodNanos);
|
||||
if (hz == 0 && capHz == 0 && mode.tearFree() && !warnedUncapped) {
|
||||
if (hz == 0 && capHz == 0 && mode == VSyncMode.ON && !warnedUncapped) {
|
||||
warnedUncapped = true;
|
||||
AngelicaMod.LOGGER.warn("Display refresh rate is unknown, so the frame rate cannot be bounded if the driver ignores vsync. Set Max Framerate to bound it.");
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ final class PacerCore {
|
||||
private LongConsumer idleWork;
|
||||
|
||||
private long refreshPeriodNanos;
|
||||
private boolean tearFree = true;
|
||||
private boolean fifo = true;
|
||||
private boolean vsyncOn = true;
|
||||
private int capHz;
|
||||
|
||||
@@ -109,9 +109,9 @@ final class PacerCore {
|
||||
dropLock();
|
||||
}
|
||||
|
||||
void setTearFree(boolean value) {
|
||||
if (value == tearFree) return;
|
||||
tearFree = value;
|
||||
void setFifo(boolean value) {
|
||||
if (value == fifo) return;
|
||||
fifo = value;
|
||||
dropLock();
|
||||
}
|
||||
|
||||
@@ -159,8 +159,8 @@ final class PacerCore {
|
||||
lastGpuWaitNanos = pendingGpuWaitNanos;
|
||||
pendingGpuWaitNanos = 0L;
|
||||
|
||||
final long c = cadencePeriodNanos(capHz, refreshPeriodNanos, tearFree);
|
||||
final boolean candidate = sample && vsyncOn && tearFree && refreshPeriodNanos > 0L
|
||||
final long c = cadencePeriodNanos(capHz, refreshPeriodNanos, fifo);
|
||||
final boolean candidate = sample && vsyncOn && fifo && refreshPeriodNanos > 0L
|
||||
&& sampleDuration > gateThresholdNanos(c);
|
||||
updateLock(candidate, sampleEnd);
|
||||
|
||||
@@ -307,9 +307,9 @@ final class PacerCore {
|
||||
return lastPresentIntervalNanos;
|
||||
}
|
||||
|
||||
static long cadencePeriodNanos(int capHz, long refreshPeriodNanos, boolean tearFree) {
|
||||
static long cadencePeriodNanos(int capHz, long refreshPeriodNanos, boolean fifo) {
|
||||
final long cap = Math.max(capHz, 0);
|
||||
if (tearFree && refreshPeriodNanos > 0L) {
|
||||
if (fifo && refreshPeriodNanos > 0L) {
|
||||
if (cap == 0L || cap * refreshPeriodNanos * CAP_EQ_DIVISOR >= NANOS_PER_SECOND * (CAP_EQ_DIVISOR - 1)) {
|
||||
return refreshPeriodNanos;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user