Page MenuHomeWildfire Games

Change shadow quality without game restart
ClosedPublic

Authored by vladislavbelov on Aug 19 2017, 9:52 PM.

Details

Reviewers
elexis
Group Reviewers
Restricted Owners Package(Owns No Changed Paths)
Restricted Owners Package(Owns No Changed Paths)
Commits
rP20011: Change the shadow map quality without restarting the match.
Trac Tickets
#4351
Summary

We need to restart the game to change the quality. So the patch improve this.

It calls CreateTexture when the quality was changed. It doesn't cost much, because the same function is called when the window size changed.

Test Plan
  1. Run the game
  2. Open any map
  3. Change the shadow quality

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.Aug 19 2017, 9:52 PM
vladislavbelov updated the Trac tickets for this revision.
elexis requested changes to this revision.Aug 19 2017, 10:04 PM

A config value per frame sounds like too much work. The config get values call contains a loop.
It seems more clean and performant to call a new engine function from options.json that just deletes the texture and SetupFrame will recreate it automatically.

This revision now requires changes to proceed.Aug 19 2017, 10:04 PM
Vulcan added a subscriber: Vulcan.Aug 19 2017, 10:46 PM

Build is green

Updating workspaces.
Build (release)...
Build (debug)...
Running release tests...
Running cxxtest tests (306 tests)..................................................................................................................................................................................................................................................................................................................OK!
Running debug tests...
Running cxxtest tests (306 tests)..................................................................................................................................................................................................................................................................................................................OK!
Checking XML files...

http://jw:8080/job/phabricator/1883/ for more details.

vladislavbelov edited edge metadata.

Tried to implement @elexis 's suggestion about notifying. Current state of option.js is pretty much hardcoded.

Build is green

Updating workspaces.
Build (release)...
Build (debug)...
Running release tests...
Running cxxtest tests (306 tests)..................................................................................................................................................................................................................................................................................................................OK!
Running debug tests...
Running cxxtest tests (306 tests)..................................................................................................................................................................................................................................................................................................................OK!
Checking XML files...

http://jw:8080/job/phabricator/1884/ for more details.

elexis accepted this revision.Aug 21 2017, 3:08 AM

It's a very good patch. Really like seeing the shadow quality changed instantly. Thanks.

source/renderer/Renderer.cpp
2138 ↗(On Diff #3193)

Ack, is initialized

2139 ↗(On Diff #3193)

No newline, no cookies

source/renderer/Renderer.h
341 ↗(On Diff #3193)

Why isn't it grouped with the other getters?

source/renderer/scripting/JSInterface_Renderer.cpp
64 ↗(On Diff #3193)

If we add fake JS code that's one thing, but in C++ the names shouldn't be misleading.

So it should be RecreateShadowMap. Otherwise there should be a rock solid schedule when to implement the setter so that it sets something.

Luckily JS doesn't complain if we pass more arguments than the function expects.

This revision is now accepted and ready to land.Aug 21 2017, 3:08 AM
This revision was automatically updated to reflect the committed changes.