Welcome, Guest.
Username: Password: Remember me

TOPIC: UI, Texture, Sampler, and Technique Macros

UI, Texture, Sampler, and Technique Macros 3 months 1 week ago #1

Inspired by The Sandvich Maker's UI Macros for ENB, I decided to try my hand at something similar for ReShade. 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" in the Shaders folder, then add Macros.fxh 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 8/10/2018
Last Edit: 3 months 1 week ago by TreyM.
The administrator has disabled public write access.
The following user(s) said Thank You: OtisInf, The0roboroSpace, Masterfireheart

UI and Technique Macros 3 months 1 week ago #2

Some examples:

Integer "drag" style:
UI_INT(example_int_drag, "Example INT Drag", "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(UIDemo, PASS(Pass1, PostProcessVS, PS_UIDemo))

Creating a single pass technique with RenderTarget:
TECHNIQUE(UIDemo, PASS_RT(Pass1, PostProcessVS, PS_UIDemo, RenderTarget))

Creating a multi-pass technique:
TECHNIQUE(UIDemo,
    PASS(Pass1, PostProcessVS, PS_UIDemo)
    PASS(Pass2, PostProcessVS, PS_UIDemo)
    PASS(Pass3, PostProcessVS, PS_UIDemo)
    PASS(Pass4, PostProcessVS, PS_UIDemo)
)

Creating a multi-pass technique with multiple RenderTargets:
TECHNIQUE(UIDemo,
    PASS_RT(Pass1, PostProcessVS, PS_UIDemo, RenderTarget1)
    PASS(Pass2, PostProcessVS, PS_UIDemo)
    PASS_RT(Pass3, PostProcessVS, PS_UIDemo, RenderTarget2)
    PASS(Pass4, PostProcessVS, PS_UIDemo)
)
Last Edit: 3 months 1 week ago by TreyM.
The administrator has disabled public write access.

UI and Technique Macros 3 months 1 week ago #3

I'm probably missing a few features. Please let me know if I am so I can add them.
The administrator has disabled public write access.

UI and Technique Macros 3 months 1 week ago #4

Nice! I'd suggest for this to be added to the shader repository, so it's automatically installed with ReShade.
Cheers, crosire =)
The administrator has disabled public write access.

UI and Technique Macros 3 months 1 week ago #5

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: 3 months 1 week ago by TreyM.
The administrator has disabled public write access.