I needed an 8-way multiplexor switch in #Unrealengine Material work, so I made this. I'm quite comfortable writing code the traditional way, but I must admit there's a kind of beauty in the patterns of a node graph like this.
@syscrusher looks eye Kandy :) BTW: can’t you use the modulus operator to simplify this logic ?

@arunoda Probably. When I created it, I was trying to avoid if/then logic because in the GPU hardware, basic arithmetic is cheap (or free, in the case of those Saturate nodes), whereas branches can be expensive.

There's a published example on the web that uses N-1 subtraction nodes cascaded from one input to the next. That's simple and can be extended by copy/paste, but I deliberately avoided cascades because it makes the higher-numbered inputs dependent on the lower-numbered ones.

I was looking for something a smart compiler could dispatch to multiple CUDAs.

That said, you're right about the modulo being a good choice. I may revisit my node graph to see how the instruction count differs if I do it that way.

OTOH, I've also built this in a Custom node with HLSL code: Internally, that "case" statement is probably no better than the published example with cascading subtracts, so I am not sure which I'll end up using.