Texture Array performance

I have a question for usage Texture Arrays. If I had many layers in texture and I will sampling (eg. layer 0.0) of texture array in shader will it be more costly than sampling standard 2d texture (which use 1 interesting me layer)? Maybe when I will use texture array I will have transferred some ‘extra’ data when I will call ‘texture’ function in GLSL so I will see performance drop in simple scenes compare to usage 1-3 standard texture2d? Whats are cons of usage Texture Array?

Sorry for my bad english :slight_smile:

Texture array fetching should be as fast as standard Texture2D fetching. Maybe the only cost is that you have to interpolate a 3 component texture coordinate set instead of 2, but I don’t think that it would really cost you that much.

The cons of using texture arrays is that you don’t have to bind new textures between draw calls thus improving batching.

AFAIK there not interpolation between layers, because formula of source layer is max(0, min(d-1, floor(layer+0.5)))

But I would be interested to know how texture cache is working with an array?

Pro:

  • All textures in the array are accessed as a single unit in a programmable shader

Restrictions but not Cons:

  • All textures in the array have to be of the same size
  • No support for the fixed-functionality (if this can be con today)

Con:

  • The massive object that have to be treated as a whole (as Alfonse pointed out)

Neutral:

  • Texture lookups do not filter between layers

aqnuep wasn’t saying there was. He’s saying you need to pass in a vec3 texcoord varying (for interpolation) rather than a vec2 texcoord, because you need an extra coord for the slice index. But in practice, that’s almost never a big deal. Easily compensated for by far by letting you pump larger batches.

Yes, in fact I meant varying interpolation.

Thanks all for info :slight_smile: Similar to YarUnderoaker I’m also interesting how a cache working with texture arrays, I think that it working very similar to standard 2d textures but I may be wrong.

Update:
I checked it now (Radeon HD2600 PRO) and it looks like sampling of 4x standard textures is faster than sampling 4x layers from texture array. Maybe each texture unit has its own cache? I have similar performance decrease on HD5570, but on GF9500M performance of texture array is similar to standard 2d textures :stuck_out_tongue: Is it ATI bug?