forked from Mirrors/openclonk
C4TimeMilliseconds: fixed comparison & stopped reloading shaders every frame
Imagine lhs being 0 and rhs being more than int32_t can handle. And then imagine subtracting them and casting them to int32_t. That's what happened e.g. in void C4ShaderCall::Start() when ScriptShader.LastUpdate was 0. This caused the shaders to reload every frame; at least when in the main menu. This lead to serious lagging (of the cursor) for me. Note that the subtraction operator in C4TimeMilliseconds.cpp has a similar issue. This might need a fix or at least high awareness by users. Maybe an assert or something. PS: Who thought that doing the comparison with a subtraction was a good idea? This is not assembler :Iinstall-platforms
parent
8d1aa0c0c2
commit
6fa13d8717
|
@ -84,7 +84,7 @@ bool operator<( const C4TimeMilliseconds& lhs, const C4TimeMilliseconds& rhs )
|
|||
{
|
||||
return lhs.inf < rhs.inf;
|
||||
}
|
||||
return int32_t(lhs.time - rhs.time) < 0;
|
||||
return lhs.time < rhs.time;
|
||||
}
|
||||
|
||||
int32_t operator-(const C4TimeMilliseconds& lhs, const C4TimeMilliseconds& rhs)
|
||||
|
|
Loading…
Reference in New Issue