UI, Texture, Sampler, and Technique Macros

More
2 years 1 month ago - 1 year 3 months 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!


Demonstration File: MacrosDemo.fx
Warning: Spoiler!


UPDATED 12/15/2018

Now fully supports ReShade 4
(some macro names have changed!)
Last edit: 1 year 3 months ago by TreyM.
The following user(s) said Thank You: OtisInf, The0roboroSpace, Masterfireheart

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

More
2 years 1 month ago - 1 year 9 months ago #2 by TreyM
Replied by TreyM on topic UI and Technique Macros
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)
)
Last edit: 1 year 9 months ago by TreyM.

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

More
2 years 1 month ago - 1 year 9 months ago #3 by TreyM
Replied by TreyM on topic UI and Technique Macros
Reserved.
Last edit: 1 year 9 months ago by TreyM.

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

More
2 years 1 month ago #4 by crosire
Replied by crosire on topic UI and Technique Macros
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.

More
2 years 1 month ago - 2 years 1 month ago #5 by TreyM
Replied by TreyM on topic UI and Technique Macros
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.
Last edit: 2 years 1 month ago by TreyM.

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

More
1 year 9 months ago #6 by TreyM
Replied by TreyM on topic UI and Technique Macros
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.

More
1 year 9 months ago #7 by TreyM
Replied by TreyM on topic UI and Technique Macros
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.