Hi,

I have a rendering engine with tiles, a frame may consist of a few hundred tiles. Most tiles will be rendered with a single texture, while a few may be rendered with an extra texture in a different unit.

Which is faster:

1. Using two different shaders where one has two samplers and the other only one, and switch shaders according to which type of tile it is.
2. Using the same shader all the time, but binding a 1x1 transparent pixel texture to the second texture unit for most of the tiles.

Is there an alternative 3?

I can probably sort the tiles to reduce the number of shader switches in alternative 1, but there are already some other sort criteria on these tiles, so it may not work.

Cheers