Skip to content
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

Make all post-processing conditional #2173

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Denneisk
Copy link
Contributor

Optimizes post-processing by not having their hooks run when they're never used. Also removes some unnecessary checks or moves them to run only once.

Now post-processing hooks run only when needed.

I tested it and it all works fine, but I would appreciate anyone looking over this to make sure I didn't do any copying errors.

Was waiting for someone else to do this before I realized it'd be faster to do it myself.

@Cheatoid
Copy link

Cheatoid commented Jan 1, 2025

I like the idea, but:

  • Change this logic: newValue != "0" to check particular convar's boolean value instead (ConVar:GetBool()), this is because any non-zero value is considered true in engine, even -1 and 123.45. Consistency.
  • Have you considered what would happen if any of those Lua files were (hot)reloaded (or loaded twice for whatever reason), no? Well, it would add another instance of those change callbacks into the list, and there be double shenanigans.
  • In regards to bloom/sunbeams/toytown, you can completely wrap those around the render.SupportsPixelShaders_2_0() check, because GPU isn't going to change while Garry's Mod is running, ay? (Basically no change callback even.)

@Denneisk
Copy link
Contributor Author

Denneisk commented Jan 2, 2025

Thanks for the response

Change this logic: newValue != "0"

I thought all nonzero values were true for convars. I thought it would be simpler this way.

(hot)reloaded

Thank you for considering this, that's a very important oversight.

render.SupportsPixelShaders_2_0()

Good idea. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants