View Issue Details

IDProjectCategoryView StatusLast Update
0003883The Dark ModCodingpublic23.12.2014 17:51
ReporterSteveL Assigned ToSteveL  
Status closedResolutionno change required 
Product VersionTDM 2.03 
Summary0003883: Post processing shaders doing more sums than needed
DescriptionFrom a note on issue 0003877

On the environmental variables: shaders that use _currentRender do unnecessary work. The _currentRender capture in the renderer c++ code sets environmental constants for both the screen size and the power-of-two texture size, to allow shaders to translate a screen position to a texture coordinate. But when you lay out the math, only the reciprocal of the power-of-two texture size is really needed to do that. The screen size cancels out in the algebra. That's how I did it in the "depth window" shader and video I posted in the engine thread. I'll add a new environmental constant for depth-capture-related fragment programs which holds that reciprocal, and maybe open another tracker to change the shaders using _currentRender if it turns out that they're doing that extra calculation for every pixel instead of just once (I don't have the code in front of me right now).
Additional InformationThe calculation *is* done for each fragment, at least in HeatHaze.vfp, and lots (or maybe all) other PP shaders copy from it.

Actions required:
- Check whether the simple reciprocal does indeed cover all possible permutations of screen and texture size
- See whether this makes any performance difference and decide whether it's worth fixing.
TagsNo tags attached.


related to 0003877 resolvedSteveL Allow shaders to access scene depth (co-author: revelator) 
child of 0003684 new Investigate GPL Renderer Improvements 




23.11.2014 11:39

reporter   ~0007164

Closed on the grounds of "don't fix what's not broken". It's true but the code is quite widespread and I can't find any evidence that fragment shaders are a bottleneck for us.


23.12.2014 17:51

reporter   ~0007271

Update: we need the two parameters after all because some old special effects use a different aspect ratio while rendering.

Issue History

Date Modified Username Field Change
24.10.2014 17:51 SteveL New Issue
24.10.2014 17:51 SteveL Status new => assigned
24.10.2014 17:51 SteveL Assigned To => SteveL
24.10.2014 17:51 SteveL Summary Posrt processing shaders doing more sums than needed => Post processing shaders doing more sums than needed
24.10.2014 17:51 SteveL Relationship added related to 0003877
24.10.2014 17:52 SteveL Relationship added child of 0003684
23.11.2014 11:39 SteveL Note Added: 0007164
23.11.2014 11:39 SteveL Status assigned => closed
23.11.2014 11:39 SteveL Resolution open => no change required
23.12.2014 17:51 SteveL Note Added: 0007271