-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve glsl shader performance #211
Conversation
Riiight, forgot to rebase. |
Use fragment depth from built-in gl_FragCoord instead of our own depth attribute
Adds few fps. Function seems to be too complex for my understanding.
Saturated sum of positive values is equal to saturated sum of saturated values
There is room for improvement, for example texture matrix, but it will require changing rendering code, so it will not be here for sake of simplicity. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems good; someone else please test run this before merging though.
I've tested it with Quake. I didn't notice any problems. @uis246 if there's any in particular that might be affected please let me know. |
I've used only properties of linear algebra(like elements of normalized vector are always in range of [-1, 1]), basic arithmetics, shuffling between registers, using proper built-ins instead of hacks and assumption of samples being in range of [0, 1]. Seems to be it. |
So there should be no existing game being affected |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looked through it once more - if it's not horribly breaking as is, it's good to merge.
Most optimizations are done by abusing mathematical properties and replacing slow on some hardware(e.g. Inetl) min and max with saturation.
For example dot product is in range [-1, 1], so
max(0, dot(...))
=sat(dot(...))
.In places where this potentially can mess with HDR comments were added.