[FIX] Undefined behaviour on comparison of NaN and float at particlemgr.cpp #846
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
At particlemgr.cpp in class
CParticleEffectBinding
there is a variable namedfloat m_flParticleCullRadius
that (as i think valve expected to happen) are 0.0f -ed in constructor by callingSetParticleCullRadius(0.0f)
, but looks like they didnt know thatif ( m_flParticleCullRadius != flMaxParticleRadius )
that happens inSetParticleCullRadius
working with float NaN, which is Undefined Behaviour, and results of this thing are declared by individual compilers realization. Even differend msvc versions can handle this differendly.As the result of the problem some particles like explosions, sparks, smoke and dust may not appear at all. There even where no drawcall at this conditions.
Hopefully it can be fixed easely, by manually 0.0f -ing
m_flParticleCullRadius
in constructor.Also, it can be forced to happen every time. Just instead of
m_flParticleCullRadius = 0.0f;
putm_flParticleCullRadius = nanf("");
in constructor.If you want to actually see how this looks like, ive recorded it in hl2 here. Exactly same happends in alien swarm.
Ive made same push request in mapbase and it was approved.