Given that the second argument is always 360, we can remove some tests for bad ranges of input and use simple truncation/multiplication to compute the result, while retaining good accuracy within reasonable FRotator input value ranges.
#jira UE-129730
#preflight 62699851f97c319beba69337
#rb Dmytro.Vovk
[CL 19947858 by Zak Middleton in ue5-main branch]
Deprecation of FPlatformMath::IsNegative*() functions.
New FPlatformMath::IsNegativeOrNegativeZero().
Fix up of existing usage to either use < 0 or IsNegativeOrNegativeZero where appropriate.
Fixes for aliasing problems in various FMath functions, including IsNegative*().
Resubmission of CL# 19833778 with fixes for problematic Mac and Android toolchains, causing spurious errors while building PCHs.
#rb devin.doucette, charles.bloom, will.damon, chris.babcock
#jira UE-148435
#preflight 6260764d91376845adf9893f
[CL 19840896 by Steve Robb in ue5-main branch]
Deprecation of FPlatformMath::IsNegative*() functions.
New FPlatformMath::IsNegativeOrNegativeZero().
Fix up of existing usage to either use < 0 or IsNegativeOrNegativeZero where appropriate.
Fixes for aliasing problems in various FMath functions, including IsNegative*().
#rb devin.doucette, charles.bloom
#jira UE-148435
#preflight 625ece48f16e0d2accab15d9
[CL 19833778 by Steve Robb in ue5-main branch]
Fixes for all the macro use in Core.
#rb robert.manuszewski
#jira UE-140139
#preflight 623c54628900c14eecdea9c6
[CL 19493359 by Steve Robb in ue5-main branch]
FLinearColor ctor from FColor is mainly three table lookups, make it inline and move to the header.
Quantize, QuantizeFloor, QuantizeRound are similarly trivial, now inline.
Move Clamp01 to FColor as static method so it's namespaced; rename to Clamp01NansTo0 to explain why it's not just FMath::Clamp to [0,1]
SSE2-ified FLinearColor::ToFColorSRGB for x86 targets, bitwise exact same results as before for all input floats (tested exhaustively, test included)
Don't want to make ToFColorSRGB inline, it's a bit large for that, but make an array version that does multiple at once. Mainly try to avoid doing a cross-DLL call per pixel for large batches.
Switch ImageCore Linear->sRGB conv to use array version.
FLinearColor R,G,B,A members union'd with "deprecated" RGBA[] array, Component() updated to use it (matching recent fix for FVector)
ImageCore vector loads from FLinearColors updated to use &Component(0) which gives &RGBA[0], pointer to a 4-elem array
Add tests to UnrealMathTest.cpp to verify that sRGB<->Linear and UNORM<->Linear conversions behave as expected, plus the separate ColorConversionHeavy test that does the exhaustive equivalence check between the SSE2 ToFColorSRGB() and reference (warning: takes a while)
#rb danny.couture, martins.mozeiko
#preflight 6238c86f04769ab493469a3f
[CL 19456245 by fabian giesen in ue5-main branch]
For large enough floats x (e.g. 1e+7f), x*255 is too large to convert to int. On x86 this turns into INT_MIN which then gets clamped to 0, on ARM it gets saturated and turns into INT_MAX which gets clamped to 255.
Fix it so that over-large values result in 255 (which is the more natural behavior) everywhere and note the conversion rules used for both the sRGB and the linear channels while I'm here. Also update ImageCore optimized kernels to include the QuantizeRound fix.
Confirmed to produce bitwise identical results for textures on AncientGame (i.e. nop on typical content).
#jira UE-146294
#preflight 6234ffcc48746817f14025dc
#rb martins.mozeiko
[CL 19442181 by fabian giesen in ue5-main branch]
Tested against UnrealEditor, ShooterGame, QAGame, FortniteGame, Lyra, CitySample, and a local project
Ciode review was a preliminary review for a coding style.
#rnx
#rb jonathan.adamczewski, joe.kirchoff
#preflight 6220cfb76f26901529b6514e
[CL 19243710 by Tim Smith in ue5-main branch]
Added overloads for *ToFloat(double) methods to TUnrealPlatformMathSSE4Base to avoid ambiguous overloads (and make it easier for us to update later when do another pass at int64 versions).
Resolved ambiguous Max() and Min() calls when mixing int32/int64, float/double, etc by using macro to promote to the largest precision type.
#jira UE-124808
#rb Andrew.Davidson
#lockdown Julien.Marchand
#preflight 6206fa3af7376af79b56ea83
#ROBOMERGE-AUTHOR: zak.middleton
#ROBOMERGE-SOURCE: CL 18984296 in //UE5/Release-5.0/... via CL 18985501 via CL 18987604
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v917-18934589)
[CL 18987966 by zak middleton in ue5-main branch]
Backwards compatibility with replays from float based builds.
#rb ryan.gerleve
#preflight 61f3ed956b5aea38e5b68e9c
#ROBOMERGE-AUTHOR: andrew.davidson
#ROBOMERGE-SOURCE: CL 18770363 in //UE5/Release-5.0/... via CL 18770369 via CL 18770589
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v903-18687472)
[CL 18770595 by andrew davidson in ue5-main branch]
#ROBOMERGE-AUTHOR: zak.middleton
#ROBOMERGE-SOURCE: CL 18614616 via CL 18616142 via CL 18616256 via CL 18619470 via CL 18619727 via CL 18620065
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v899-18417669)
[CL 18620586 by zak middleton in ue5-main branch]
#ROBOMERGE-AUTHOR: zak.middleton
#ROBOMERGE-SOURCE: CL 18605321 via CL 18616140 via CL 18616250 via CL 18619448 via CL 18619695 via CL 18620025
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v899-18417669)
[CL 18620573 by zak middleton in ue5-main branch]
Main compiler bug workaround was in FRotation3::Conjugate() used by CalculateAngularVelocity1 (and unused CalculateAngularVelocity2). MSVC generated incorrect optimized code when complied with /arch:AVX, which breaks down on negating the individual elements and reassembling them. Workaround is to use the vectorized formulation already in the base TQuat (or disabling optimizations around the original code). Without this change, BodySolver::SetW() would assign (but now asserts) NaN values generated from CalculateAngularVelocity with 2 valid input rotations.
Includes various fixes for PMatrix<FReal, 3, 3> causing last element to take a value not equal to 1, which caused scaling of results. Due to missing operator*= and operator+= overrides (which also fixed bad Determinant() as well as bad transformations).
Also fixed missing definitions for Zero and Identity for recently refactored PMatrix, since only the FMatrix one was defined in Utilities.cpp
Refactored some massive inlined Matrix and Quat functions to separate cpp files, because the inlined assembly would go to sometimes over 400 lines per matrix mutliply. This made debugging difficult and was providing minimum value (and there are outstanding MSVC bug as well with code gen issues in overly large functions so best to avoid those).
Re-enabled AVX intrinsics on previously disabled platforms (from CL 18456125).
Note that for testing on PC, you can set VCToolChain.cs to enable /arch:AVX (which is the build flag that surfaces the issue). With that flag off but other avx/sse remaining on, bug does not occur. Toggling these will cause a full rebuild.
#jira UE-134215, UE-138959
#rb David.Harvey, Max.Whitehead, Cedric.Caillaud
#preflight
#ROBOMERGE-OWNER: zak.middleton
#ROBOMERGE-AUTHOR: zak.middleton
#ROBOMERGE-SOURCE: CL 18598858 via CL 18616128 via CL 18616245 via CL 18619403 via CL 18619668 via CL 18619988
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v899-18417669)
[CL 18620555 by zak middleton in ue5-main branch]
Some code was using the wrong #define to toggle (PLATFORM_ENABLE_VECTORINTRINSICS instead of ENABLE_VECTORIZED_TRANSFORM).
#rb Andrew.Davidson
#ROBOMERGE-AUTHOR: zak.middleton
#ROBOMERGE-SOURCE: CL 18587119 via CL 18587132 via CL 18587135 via CL 18587389 via CL 18587410 via CL 18587426
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Test -> Main) (v899-18417669)
[CL 18587431 by zak middleton in ue5-main branch]