I want a pixelshader to do lookups in an array of 256 textures. One of these textures will be updated each frame (the other 255 remaining unchanged). I would prefer doing a lookup in a 3d texture, but a 3d texture cant be partially updated (updating it completely is not an option because of bandwidth).
To initialize the textures and samplers I would like to do:
texture texSlices[256];
sampler sliceSamplers[256];
for (int i = 0; i < 256; i++){
sliceSamplers[i] = sampler_state
{
Texture = <texSlices[i]>;
}
}
That does not work : it is complaning about the for loop. And even if it wasnt ,
this post says it wont work, and I have to outroll the loop.
Is there an other way to access a large amount of data, which changes partly every frame?
Edit: A sampler array is not a possibility : return tex2D(sliceSamplers[sliceIndex], uv); fails, because the arrayindex cant be a variable (....whose content cant be known at compile-time);