mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2024-11-10 07:12:07 +00:00
Redo 95bbb99
in a more correct manner.
1) Do not increment the frame rate returned by SDL by 1. Incrementing is unnessecary, more or less up to date versions on Nvidias, AMDs and Intels GPU driver on relevant platform return an value that's either correct or rounded up to next integer. And SDL itself also rounds up to the next integer. At least in current versions. In fact, incrementing the value by one is harmfull, it messes our internal timing up and leads to subtile miss predictions. Working around that in frame.c would add another bunch of fragile magic... So just do it correctly. If someone still has broken GPU drivers or SDL versions that are rounding down the could set vid_displayrefreshrate. 2) The calculation of the 5% security margin to pfps in frame.c was wrong. It didn't take into account that rfps can be slightly wrong in the first place, e.g. 60 on an 59.95hz display. Correct it by comparing against rfps including the margin and not the plain value.
This commit is contained in:
parent
012ab85b31
commit
69b6e5ad48
3 changed files with 4 additions and 10 deletions
|
@ -401,12 +401,5 @@ GLimp_GetRefreshRate(void)
|
|||
}
|
||||
}
|
||||
|
||||
/* The value reported by SDL may be one frame too low, for example
|
||||
on my old Radeon R7 360 the driver returns 59hz for my 59.95hz
|
||||
display. And Quake II isn't that accurate, we loose a little bit
|
||||
here and there. Since it doesn't really hurt if we're running a
|
||||
litte bit too fast just return one frame more than we really have. */
|
||||
glimp_refreshRate++;
|
||||
|
||||
return glimp_refreshRate;
|
||||
}
|
||||
|
|
|
@ -525,8 +525,7 @@ Qcommon_Frame(int msec)
|
|||
scene may be more complex than the previous one and SDL
|
||||
may give us a 1 or 2 frames too low display refresh rate.
|
||||
Add a security magin of 5%, e.g. 60fps * 0.95 = 57fps. */
|
||||
pfps = (cl_maxfps->value > rfps) ? floor(rfps * 0.95) : cl_maxfps->value;
|
||||
|
||||
pfps = (cl_maxfps->value > (rfps * 0.95)) ? floor(rfps * 0.95) : cl_maxfps->value;
|
||||
|
||||
/* Calculate average time spend to process a render
|
||||
frame. This is highly depended on the GPU and the
|
||||
|
|
|
@ -262,7 +262,9 @@ M_CheckGround(edict_t *ent)
|
|||
VectorCopy(trace.endpos, ent->s.origin);
|
||||
ent->groundentity = trace.ent;
|
||||
ent->groundentity_linkcount = trace.ent->linkcount;
|
||||
ent->velocity[2] = trace.ent->velocity[2];
|
||||
|
||||
// FIXME
|
||||
ent->velocity[2] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue