Jump to content

  • Log In with Google      Sign In   
  • Create Account


Using Texture Arrays


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 dpadam450   Members   -  Reputation: 842

Like
0Likes
Like

Posted 19 February 2014 - 11:19 PM

I'm currently binding diffuse,normal,spec etc to TEXTURE_0,1,2

Is there any downside to throwing those 3 things into a texture array per object? I save a handful of opengl calls so that is a positive, but is there any downside to having a bunch of texture arrays? My instinct would be no. But I don't know if there is some cache issue where texture unit 0 1 2 have their own cache and throwing these into a texture array changes some memory layout or something.


Edited by dpadam450, 19 February 2014 - 11:21 PM.


Sponsor:

#2 haegarr   Crossbones+   -  Reputation: 3780

Like
3Likes
Like

Posted 20 February 2014 - 02:18 AM

Only few details are known about the low level architecture of modern GPUs, so I may be wrong with the following.

 

Giving each texture unit as can be accessed in OpenGL its own cache is probably not done, because it would mean to let cache memory lounge around unused if less than the total number of texture units is in use. I think that no manufacturer will waste performance this way. Caching is usually be done with the memory address as key, which is itself independent on the unit.

 

Texels are rearranged when placed in GPU main memory. This is because in general there is no preferred direction (e.g. neither rows nor columns are preferred) when being sampled. So the texels are stored in tiles (2D) or blocks (3D), and these define the content that will be cached. I assume that a 2D texture array is still stored in tiles.

 

In summary I think that there is no penalty in using a texture array here. You could measure both ways, but that will give you a hint only for your own GPUs, of course.



#3 mark ds   Members   -  Reputation: 1086

Like
0Likes
Like

Posted 20 February 2014 - 07:32 AM

As per the opengl spec:

 

"An array texture is a collection of one- and two-dimensional images of identical size and format"

 

So no, you can't... unless you use the same format for both diffuse and normals which isn't ideal, but... you could potentially use three GL_RG textures - one storing red and green, another storing blue and specular, and the third storing two components from the normal. Alternatively, use DXT5 (with spec in the alpha) and just accept some wasted space in the normal map (you only need two of the four channels).


Edited by mark ds, 20 February 2014 - 07:36 AM.





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS