UI, Texture, Sampler, and Technique Macros

  • Posts: 137
1 year 7 months ago - 9 months 3 weeks ago #1 by TreyM
This set of macros can speed up the creation of shader UI layouts, very quickly setup textures and samplers, and clean up the technique section of your code.

To use, simply copy the code from the Macros.fxh code block below into a new file named "Macros.fxh", then add it to the Shaders folder where ReShade.fx is, and include it with this line:
#include "Macros.fxh"

The demonstration file below shows the proper syntax to use the macros.

Macros File: Macros.fxh
Warning: Spoiler! [ Click to expand ]


Demonstration File: MacrosDemo.fx
Warning: Spoiler! [ Click to expand ]


UPDATED 12/15/2018

Now fully supports ReShade 4
(some macro names have changed!)
The following user(s) said Thank You: OtisInf, The0roboroSpace, Masterfireheart

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

  • Posts: 137
1 year 7 months ago - 1 year 3 months ago #2 by TreyM
Some examples:

Integer "slider" type:
UI_INT_S(example_int_slider, "Example INT Slider", "Example Tooltip", 0, 100, 50)

Boolean:
UI_BOOL(example_bool, "Example Bool", "Example Tooltip", false)

Color Widget (float3):
UI_COLOR(example_color, "Example Color", "Example Tooltip", 1.0, 0.0, 0.0)

Texture:
TEXTURE(Tex1, "example.jpg")

Sampler:
SAMPLER(sExample, Tex1)

Creating a single pass technique:
TECHNIQUE(ExampleTechnique, PASS(ExamplePass, VS_Example, PS_Example))

Creating a single pass technique with RenderTarget:
TECHNIQUE(ExampleTechnique, PASS_RT(ExamplePass, VS_Example, PS_Example, ExampleRenderTarget))

Creating a multi-pass technique:
TECHNIQUE(ExampleTechnique,
    PASS (ExamplePass1, VS_Example, PS_Example1)
    PASS (ExamplePass2, VS_Example, PS_Example2)
    PASS (ExamplePass3, VS_Example, PS_Example3)
    PASS (ExamplePass4, VS_Example, PS_Example4)
)

Creating a multi-pass technique with multiple RenderTargets:
TECHNIQUE(ExampleTechnique,
    PASS_RT (ExamplePass1, VS_Example, PS_Example1, ExampleRenderTarget1)
    PASS    (ExamplePass2, VS_Example, PS_Example2)
    PASS_RT (ExamplePass3, VS_Example, PS_Example3, ExampleRenderTarget2)
    PASS    (ExamplePass4, VS_Example, PS_Example4)
)

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

  • Posts: 137
1 year 7 months ago - 1 year 3 months ago #3 by TreyM
Reserved.

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

  • Posts: 3667
1 year 7 months ago #4 by crosire
Nice! I'd suggest for this to be added to the shader repository, so it's automatically installed with ReShade.

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

  • Posts: 137
1 year 7 months ago - 1 year 7 months ago #5 by TreyM
I will for sure. Just want to make sure it's really easy to use and is as feature complete as my skill level will allow.

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

  • Posts: 137
1 year 4 months ago #6 by TreyM
I'm currently updating these to fully support some of the new ReShade 4 features and I'll send a pull request.
The following user(s) said Thank You: Masterfireheart, seri14

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

  • Posts: 137
1 year 3 months ago #7 by TreyM
The Macros are now fully supporting the new UI features in ReShade 4 as of December 15, 2018. Crosire, sending Git pull request now.
The following user(s) said Thank You: crosire

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