Jump to content
  • Advertisement
Sign in to follow this  
dpadam450

OpenGL Using Texture Arrays

This topic is 2072 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
Advertisement

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.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!