if (index == 0) texture0.Sample(sampler_state,location);
if (index == 1) texture1.Sample(sampler_state,location);
// ect...
D3D11 multitexturing
(1 - index) * texture0.Sample(sampler_state, location) + index * texture1.Sample(sampler_state, location)
i never use if statements in a shader
(1 - index) * texture0.Sample(sampler_state, location) + index * texture1.Sample(sampler_state, location)
i never use if statements in a shader
From what I understand, on any modern card that'd be much slower than a series of if statements. In that case every texture would be accessed regardless, at least with multiple if statements every texture would be accessed only when every texture was accessed simultaneously on a given warp.
Before texture arrays existed, we emulated the behaviour for 2D texture using texture atlases -- storing many 2d sub-textures within a single large texture.
You could do the same with your 3D textures, which would replace the branching with some code to simply offset/scale the tex-coords.