Page MenuHomeWildfire Games

Moves terrain lighting calculation to GPU
ClosedPublic

Authored by vladislavbelov on Nov 3 2020, 9:54 PM.

Details

Reviewers
wraitii
Group Reviewers
Restricted Owners Package(Owns No Changed Paths)
Commits
rP24124: Moves terrain lighting calculation to GPU.
Summary

Saves up to 50% of RAM, ~4MB for normal size map with different textures in each patch. Also might increase performance both on CPU and GPU because of less memory consumption.

Also might slightly increase Atlas performance during painting.

Test Plan
  1. Apply the patch and compile the game
  2. Make sure that terrain looks the same as before, ARB and GLSL look similar.

Diff Detail

Repository
rP 0 A.D. Public Repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

vladislavbelov created this revision.Nov 3 2020, 9:54 PM
vladislavbelov retitled this revision from Moves lighting calculation to GPU to Moves terrain lighting calculation to GPU.
vladislavbelov edited the summary of this revision. (Show Details)

Successful build - Chance fights ever on the side of the prudent.

builderr-debug-macos.txt
../../../source/simulation2/scripting/JSInterface_Simulation.cpp:155:4: warning: suggest braces around initialization of subobject [-Wmissing-braces]
                        CFixedVector2D(-halfSize.X, -halfSize.Y),
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
builderr-release-macos.txt
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../../../binaries/system/libnetwork.a(precompiled.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../../../binaries/system/liblobby.a(precompiled.o) has no symbols
../../../source/simulation2/scripting/JSInterface_Simulation.cpp:155:4: warning: suggest braces around initialization of subobject [-Wmissing-braces]
                        CFixedVector2D(-halfSize.X, -halfSize.Y),
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../../../binaries/system/libsimulation2.a(precompiled.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../../../binaries/system/libengine.a(precompiled.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../../../binaries/system/libgraphics.a(precompiled.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../../../binaries/system/libatlas.a(precompiled.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../../../binaries/system/libgui.a(precompiled.o) has no symbols

Link to build: https://jenkins.wildfiregames.com/job/macos-differential/1706/display/redirect

vladislavbelov requested review of this revision.Nov 3 2020, 10:07 PM
wraitii accepted this revision.Nov 4 2020, 8:55 AM
wraitii added a subscriber: wraitii.

I agree that the reduction in RAM probably offsets the added computation. Seems a bit of a no-brainer.
I guess the project is to remove GetLightEnv() everywhere?

On my mac this looks good in both GLSL and ARB.

This revision is now accepted and ready to land.Nov 4 2020, 8:55 AM
Stan added a subscriber: Stan.EditedNov 4 2020, 9:11 AM

Tested on Windows with no issue

ARBPatched ARBGLSLPatched GLSL
Intel
Nvidia
GLSLPatched GLSL
Intel
Nvidia
Stan added a comment.Nov 4 2020, 12:03 PM

Works fine on my Linux Surface Laptop as well.

I guess the project is to remove GetLightEnv() everywhere?

Precomputed light - yes, but GetLightEnv() also stores useful information, like sun color and direction. So it can't be removed completely, only moved somewhere else.

I have neither noticed any issues or performance improvements. Windows, AMD Radeon

This revision was automatically updated to reflect the committed changes.