Henrik Rydgård and Claude Opus 5
e4337eed28
Math3D: Make float Length/Normalize exact and identical on every platform
...
The SSE, NEON and scalar versions summed the components in three different
orders, so Length() alone differed by architecture. Worse, the SSE normalize
used _mm_rsqrt_ps with no Newton step - about 12 bits - where NEON used vrsqrte
plus two refinement steps and the generic path used exact sqrtf. Three accuracy
tiers for one function, and the SSE2-vs-SSE4.1 choice was made from cpu_info at
runtime, so one binary gave different answers on two different x86 CPUs.
This isn't shading-only: the results feed environment-map texture coordinates via
GE_PROJMAP_NORMALIZED_NORMAL and Lighting's GenerateLightST, so it moves UVs.
sqrtf and division are correctly rounded per IEEE-754, so a single scalar version
is bit-identical everywhere. The horizontal sums being removed were never much
faster than the three multiplies they replaced. The useSSE4 parameter is kept so
the call sites don't churn, but it no longer selects anything.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com >
Claude-Session: https://claude.ai/code/session_01Vd8ntC2brCUtCrDJMqLbs8
2026-08-29 12:05:50 +02:00
Henrik Rydgård
d5bfc1b5eb
Finish up this cleanup (move _M_SSE compat define out of Common.h)
2024-12-19 16:23:20 +01:00
Henrik Rydgård
e93c80db4e
Cleaning up our SIMD header includes, using the new header
2024-12-19 16:08:48 +01:00
oltolm
6e609342d6
fix ASAN error in Vec2<float>::Length()
2023-12-08 19:50:47 +01:00
Unknown W. Brackets
d90aec6f63
GPU: Use NEON for vector length/normalize.
...
This is a bit less accurate for normalize, but it's faster.
2023-01-08 12:32:55 -08:00
Unknown W. Brackets
a7b7bf7826
Global: Set many read-only params as const.
...
This makes what they do and which args to use clearer, if nothing else.
2022-12-10 21:13:36 -08:00
Unknown W. Brackets
c80f325912
GPU: Fix SSE4 Vec3f normalize.
...
Was sometimes adding in garbage data, which could create NANs.
2022-09-26 00:24:12 -07:00
Henrik Rydgård
493c17647a
Take the absolute value when measuring pixel size for line expansion.
...
Fixes issues in Echochrome. Though still doesn't look fantastic.
2022-06-11 00:03:40 +02:00
Unknown W. Brackets
2479d52202
Global: Reduce includes of common headers.
...
In many places, string, map, or Common.h were included but not needed.
2022-01-30 16:35:33 -08:00
Unknown W. Brackets
8a00c2d233
GPU: Allow gcc/clang/icc runtime SSE4 usage.
...
All our builds before were only using SSE4 in jit...
2022-01-08 17:09:09 -08:00
Unknown W. Brackets
2f63f9999d
GPU: Normalize 0 to 1 always in software lighting.
...
See #14167 . This seems to be consistent.
2021-02-27 23:51:45 -08:00
xebra
d0682d7829
[spline/bezier]Move SIMD optimization of vector operations to Math3D.h.
...
Needs rebuild to avoid a dialog confirmation on Visual Studio.
2018-10-07 23:53:43 +09:00
Unknown W. Brackets
56b83af1f0
Don't use aligned loads in non-inlined funcs.
...
I'm wanting things to stay in registers, but that's not realistic for
arguments. Force inline the others. May help #5699 .
2014-03-23 12:09:17 -07:00
Unknown W. Brackets
416df17088
Inline From/ToRGB(A) to avoid losing SSE.
...
Otherwise it has to store it, which I'd like to avoid.
2014-03-17 23:03:04 -07:00
Unknown W. Brackets
833c93bd98
Dumb mistake, forgot the divide.
...
Probably caused the blending issues.
2014-03-17 12:53:49 -07:00
Unknown W. Brackets
6630e45eff
Just add a packed version of Vec3f.
...
This way we can have it aligned to memory where needed. I think it'd be
better to avoid this if possible so that we can actually vectorize
spline/etc. code.
Fixes #5673 .
2014-03-17 06:59:40 -07:00
Unknown W. Brackets
10456a09ac
Oops, forgot to multiply in float ToRGBA().
...
Not actually used...
2014-03-16 21:12:23 -07:00
Unknown W. Brackets
627027307c
softgpu: Use SSE in ToRGB()/FromRGB() etc.
2014-03-16 19:21:35 -07:00
Unknown W. Brackets
47728528d7
softgpu: Use SSE in Vec?::Length().
...
Minor perf boost but if I do everything in Vec things get slower.
2014-03-16 17:56:34 -07:00
Unknown W. Brackets
473fb866e6
softgpu: Implement vertex preview.
...
And move ConvertMatrix4x3To4x4() into a common place since there were
differing implementations, which was only confusing.
2013-12-29 13:45:10 -08:00
neobrain
4ab080d083
GPU/Math3D: Support converting Vec3 and Vec4 objects to u32 color values.
2013-07-29 22:26:42 +02:00
neobrain
45d1645c6a
GPU/Math3D: Add a Vec2 class.
2013-07-29 22:26:42 +02:00
neobrain
9a5958d353
GPU/Math3D: Add a Vec4 class.
2013-07-29 22:26:41 +02:00
neobrain
6926926267
GPU/Math3D: Change Vec3 to allow for arbitrary component base types.
2013-07-29 22:26:41 +02:00
Henrik Rydgard
64cc573703
Switch to "GPL 2.0 or later" for various reasons. I wrote most of the code I imported from Dolphin (which is GPL2-but-not-later), so it should be OK.
2012-11-04 23:24:00 +01:00
Henrik Rydgard
4f7ad15758
Add snapshot of the whole source code.
2012-11-01 16:19:01 +01:00