Commit graph

59 commits

Author SHA1 Message Date
Henrik Rydgård
9a7579f8fa Typo fix, fixes #18038 2023-09-06 17:10:17 +02:00
Unknown W. Brackets
d6a5e84db5 softgpu: Fix worldpos skipping.
Oops, was reversed.  We need worldpos for non-directional lights.
2023-07-16 10:59:44 -07:00
Unknown W. Brackets
47c29e0874 sopftgpu: Disable lights if all else disabled.
Tiny gain, but seeing it happen so might as well.
2023-07-16 10:31:58 -07:00
Unknown W. Brackets
d5b4c98f96 softgpu: Reduce some non-SIMD lighting math.
Small perf improvement for vertex/lighting heavy (i.e. 3D) scenes.
2023-07-16 10:31:44 -07:00
fp64
f133739cd0 Replace some signed divison in SoftGPU
This also adds a few bitwise operations to Vec4<int> and further
SIMDifies it.
Also, fixes unrelated warning.
2023-06-29 16:43:21 -04:00
fp64
436b49c4f2 Streamline x86 SSE workaround
Seems clearer than using #ifdef's at each site. Also rationale
is clearly spelled out, one 'Go to definition' away from any instance.
2023-06-27 00:30:01 -04:00
Henrik Rydgård
5b4fa06b00 Revert Dot33 on 32-bit x86 only. See #17584 2023-06-16 23:43:33 +02:00
fp64
f0d844a5a3 Convert Dot33 to SSE2
Simpler, lower requirements, and doesn't seem to hurt speed. See #17571.
2023-06-14 22:02:50 -04:00
Unknown W. Brackets
a7fa37d114 softgpu: Use SIMD more for dot products. 2023-06-12 19:54:32 -07:00
Unknown W. Brackets
0490ad0039 softgpu: Add NEON variants as well. 2023-04-16 13:09:56 -07:00
Unknown W. Brackets
860fc176d8 softgpu: Use more SSE in lighting. 2023-04-16 11:59:57 -07:00
Unknown W. Brackets
2868495cf8 softgpu: Use SSE for lighting ceil if available.
Tiny optimization, helps only a little.
2023-04-16 11:13:43 -07:00
Unknown W. Brackets
b5206df04f softgpu: Calc worldnormal a bit less often.
This is clearer anyway.
2023-04-16 10:16:32 -07:00
Unknown W. Brackets
1215714240 softgpu: Use NEON for lighting. 2023-01-07 19:06:35 -08:00
Unknown W. Brackets
f1b5cbf993 softgpu: Fix lighting with 0 exp.
Broken in #15317.  Fixes Kratos scene demo.
2023-01-02 11:42:52 -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
8a6e8066bf softgpu: Store vertex colors as packed RGBA8.
No need to keep it expanded at 4x the space for both colors.
2022-09-11 18:41:06 -07: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
76f9103e97 softgpu: Add a table and initial dirty flags.
Not actually using the dirty flags to skip state, but have moved to
Execute_* functions and everything else like other graphics backends.
2022-01-23 08:08:40 -08:00
Unknown W. Brackets
7218fbbe97 softgpu: Guide more SSE light factor handling.
Missed these others in computed state.  Helps mostly to do this inside
Process().
2022-01-17 06:25:52 -08:00
Unknown W. Brackets
fcc3b7684e softgpu: Use SSE in lighting param computation.
The compiler couldn't figure this out.  Halves time in this func.
2022-01-16 21:31:53 -08:00
Unknown W. Brackets
2797e035df softgpu: Precompute lighting parameters.
In many cases, games use lighting just for diffuse or something, this
helps skip what's not needed too.  Good improvement in a scene from a
Naruto game.
2022-01-16 11:27:53 -08:00
Unknown W. Brackets
d6a8cb2a0e softgpu: Stop storing normal/worldnormal/worldpos.
This is only needed for lighting, which is applied right away.

This improves perf just simply from less data being copied.
2022-01-14 20:32:18 -08:00
Unknown W. Brackets
ce8a49b1c1 softgpu: Retain floats in diffuse/specular.
This seems to be a bit more accurate.  Color blending seems correct now,
but the factors and especially pow results are off.

Also, normalize normal to 0, 0, 1, which seems to match results better.
2022-01-06 21:52:31 -08:00
Unknown W. Brackets
bd354164bc softgpu: Cleanup -NAN and diffuse factor. 2022-01-06 21:52:27 -08:00
Unknown W. Brackets
537e357741 softgpu: Correct NAN spotlight exponent/direction. 2022-01-06 21:19:48 -08:00
Unknown W. Brackets
b86bdc9456 softgpu: Correct handling of NAN attenuation. 2022-01-06 21:19:47 -08:00
Unknown W. Brackets
fa80c448ee softgpu: More closely match PSP light rounding. 2022-01-06 21:19:47 -08:00
Unknown W. Brackets
cba2374abd softgpu: Separate calculation of S/T.
We could probably reuse, but we're not right now and it complicates the
logic.
2022-01-06 21:19:47 -08:00
Unknown W. Brackets
d98e5bfc97 softgpu: Improve usage of SSE for lighting.
Gives about a 2% improvement in many places.
2022-01-03 06:45:10 -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
Unknown W. Brackets
4a0109d273 GPU: Treat negative light exp same as 0.
Based on #12507 and some tests, seems like negative exponents are also
fixed to a 1.0f result.
2020-03-22 22:28:05 -07:00
Unknown W. Brackets
1c19bce514 GPU: Correct specular exponent zero. 2018-11-22 08:53:25 -08:00
Unknown W. Brackets
4816bfc1a6 GPU: Skip specular on negative diffuse factor.
This is correct per hardware tests, see #8403.  Note that the PS3 emulator
running PSP HD remasters does not correctly handle this, and applies
specular for negative diffuse factor.
2018-11-22 08:53:25 -08:00
Unknown W. Brackets
6e46d6c0f9 GPU: Correct powered diffuse with exp=0.
Just to ensure negative factors are handled too, as they are on hardware.
2018-11-22 08:53:25 -08:00
Unknown W. Brackets
1cec9f5ea1 GPU: Handle spot light with 0 exp or length. 2018-11-22 08:53:25 -08:00
Unknown W. Brackets
b2d60cb807 SoftGPU: Cleanup lighting code a bit.
Avoid using Length() when Length2() is enough, simplify some things.
2018-11-18 07:28:03 -08:00
Unknown W. Brackets
986371c633 SoftGPU: Normalize 0,0,0 as 0,0,1 for shade map.
Takes care of #4155 for software rendering.
2018-11-17 18:16:54 -08:00
Unknown W. Brackets
b2d3058386 SoftGPU: Correct fog for rectangles.
Gods Eater Burst uses fog in its bloom, with rectangles.
2017-05-13 17:27:34 -07:00
Unknown W. Brackets
1a56466865 SoftGPU: Match GLES lighting better, use floats.
Using floats simplifies things and also makes it faster.
2017-05-13 12:54:18 -07:00
chinhodado
9bd07d4c9c remove a redundant assignment 2014-02-22 23:08:26 -05:00
Unknown W. Brackets
25bc394284 Ignore the material update flag w/o vertex color.
Instead of using materialambient for all of them.

Fixes #3918, and seems to match tests with 3dstudio.
2013-12-29 12:57:30 -08:00
Unknown W. Brackets
eae6e87620 Simplify lighting clamping in softgpu. 2013-10-05 13:05:32 -07:00
Unknown W. Brackets
c3839a53e5 Fix some minor warnings. 2013-09-07 22:40:08 -07:00
Henrik Rydgard
9f3848b49c swrast warning fixes 2013-08-17 12:37:47 +02:00
Tony Wasserka
9bc3e8bf07 softgpu: Generate texture coordinates for environment mapping even if lighting is disabled altogether. 2013-08-16 23:49:13 +02:00
Tony Wasserka
f4cb929073 softgpu: Fix a lighting bug. 2013-08-16 23:49:13 +02:00
Tony Wasserka
1450157e09 softgpu: Implement environment mapping. 2013-08-16 23:49:12 +02:00
Tony Wasserka
b1a4762251 softgpu: Fix specular lighting (or rather, the dumb code that always threw away the result). 2013-08-16 23:49:00 +02:00
Tony Wasserka
fd65b7c9b8 softgpu: New try at specular lighting, still doesn't seem to work... 2013-08-16 23:49:00 +02:00