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

  • MarioBag
  • Topic Author
More
3 years 10 months ago #1 by MarioBag Is it possible to modify "global processor definitions" values from .FX script? was created 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.

  • crosire
More
3 years 10 months ago - 3 years 10 months ago #2 by crosire Replied by crosire on topic Is it possible to modify "global processor definitions" values from .FX script?
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.
Last edit: 3 years 10 months ago by crosire.

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

  • crosire
More
3 years 10 months ago - 3 years 10 months ago #3 by crosire Replied by crosire on topic Is it possible to modify "global processor definitions" values from .FX script?
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.
Last edit: 3 years 10 months ago by crosire.

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

We use cookies
We use cookies on our website. Some of them are essential for the operation of the forum. You can decide for yourself whether you want to allow cookies or not. Please note that if you reject them, you may not be able to use all the functionalities of the site.