Is it possible to modify "global processor definitions" values from .FX script?

  • Posts: 1
1 month 1 day ago #1 by MarioBag
Hi all,

I want to know if is possible to edit values from "global processor definitions variables" in runtime, by code from a *.fx script.

I've been playing around with that but, once defined, they become const and I cant edit their value. Is a bit frustrating that is possible to edit them from the reshader UI but not from a fx script.

Can anyone point me on the right direction?

Thanks in advance for your time.
All the best
Mario

Please Log in or Create an account to join the conversation.

  • Posts: 3737
4 weeks 1 day ago - 4 weeks 1 day ago #2 by crosire
Nope. The whole point of preprocessor defines is that they are simple constant text replacement that runs before the compiler actually compiles the shader. So it's static, and changing them from the UI does not so much change them as forcing ReShade to recompile all affected shaders with the new value set.

Please Log in or Create an account to join the conversation.

  • Posts: 3737
4 weeks 1 day ago - 4 weeks 1 day ago #3 by crosire
You can do things like this though:
#define FOO 1
int a = FOO;
#undef FOO
#define FOO 2
int b = FOO;
This is translated to the following by the preprocessor:
int a = 1;


int b = 2;
which is then compiled.

Please Log in or Create an account to join the conversation.