DX11 multi pass setup questions

hi all,

I work on a baselayer with multiple overlays of dynamic data visualizations. All of my textures are the same size, and for each overlay I use a combination of my fragment shaders with different parameters. Some overlays have unique fx which are only used once.

Atm I have multiple custom fragment shaders, passing down the texture while adding effects to it. I noticed performance going down, and I suspect the extra sampling in between my effects is unnecessary and also adds extra drawcalls on top.

What is the right way to set this up? A multipass pixel shader with different techniques for different overlays? Is it ok to switch conditions with bools or do you prefer compiling multiple versions of a big shader with different #define values? How to avoid branching problems?

Is it also possible to create a struct and send this through multiple passes, so that I can use control textures in later on? (I guess sampling the same resource in different passes is slower) Or would you suggest maintaining a patched structure? Is it then possible to have a shader outputting a custom struct and pipe this through several fragment shaders?

Can you recommend a help-patch or another resource on this? Or maybe a minimalistic example on how a shader structure like this could look like? I am a little bit stuck here and would really appreciate some directions.

cheers, A

Yo can do so called interfaces, example (2.7 KB)

For the second part you can do custom semantics: (13.3 KB)

Guess you gonna need small intro on the interfaces… (2.5 KB)

1 Like

Hey man,

thanks a lot for the detailed information! This helps a lot.
Going down the rabbit hole…