Page MenuHomeWildfire Games

Do not send Screen height, width to shader if not needed [On Hold]

Authored by Angen on Nov 10 2019, 3:17 PM.



We do not need to send width and height to shader every time, so adding boolean variable which gets set to true when resized and will be set to false as soon new data are send to shader. It will be set to true if new shader is going to be created to send there initial values.

Test Plan

Run game
Turn on/off wated effects, move camera, resize windows, change fullscreen/windowed check texture looks good and does not have fractions which will correct themselves after resizing window.

Event Timeline

Angen created this revision.Nov 10 2019, 3:17 PM
Owners added a subscriber: Restricted Owners Package.Nov 10 2019, 3:18 PM

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

Link to build:

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

Linter detected issues:
Executing section Source...

|  37| class·TerrainRenderer
|    | [MAJOR] CPPCheckBear (syntaxError):
|    | Code 'classTerrainRenderer{' is invalid C code. Use --std or --language to configure the language.
Executing section JS...
Executing section cli...

Link to build:

Stan added a subscriber: Stan.Nov 11 2019, 10:39 AM
Stan added inline comments.

Remembers :) But the comment is not really useful.

Maybe something like "Send screen width and height in the next drawcall" ?

Actually looking at what the code does It's actually making the resize variable "dirty" So maybe it could be SetResize()/NeedsResize/ MakeDirty → ElevationHandlers.cpp ?

Angen added a comment.Nov 11 2019, 6:45 PM

putting on hold, see discussion on irc:

14:25 < Vladislav_> Angen we need to send this data on each frame, and we don't have a cache there (afaik). So you can't skip Unfiorm steps.
14:26 < Vladislav_> Angen: and do you know why it works for you?
14:26 < Vladislav_> :)
14:26 < Angen> magic ?
14:27 < Vladislav_> Because we don't use screenSize afaik x)
14:27 < Angen> dont understand, shader is created once it should remember passed values
14:28 < Angen> we do use screensize :P
14:30 < Angen> and it is as my water would look really bad after resizing :)
14:30 < Vladislav_> It's compiled once but you pass uniform data on each frame.
14:31 < Angen> and thats bad
14:31 < Vladislav_> Yeah, you're right it's used but only in fancy water.
14:31 < Vladislav_> Why bad? That's expected.
14:31 < elexis> and where is pglProgramLocalParameter4fARB defined? OpenGL Easy Extension library? where is that located?
14:32 < Angen> nope, its expected to pass that only if values changes
14:32 < Vladislav_> elexis: it's a pointer calculated by any GL ext loader
14:33 < Vladislav_> Angen: why? You can have only one program binded at once. So GL need to change active unfiorms anyways.
14:33 < Angen> Vladislav_:
14:37 < Angen> unbind does not mean removing values from variables
14:37 < Vladislav_> Angen: you need to reload it on each shader reload, also I'm not sure that all drivers support such behaviour.
Angen retitled this revision from Do not send Screen height, width to shader if not needed to Do not send Screen height, width to shader if not needed [On Hold].Nov 11 2019, 6:45 PM
Angen abandoned this revision.Sep 6 2020, 12:56 PM