PDA

View Full Version : Prioritize textures?



Groovounet
12-04-2007, 11:20 AM
Hi,

I remenber lately the prioritize textures and textures residents mecanisum. Is this really useful... managed by the drivers? This mecanisum seams really great in theory so I'm wondering why there isn't such mecanisum for buffer object... any reason? (I may have missed this feature is actually available on buffer object...)

Cheers,
Christophe

Zengar
12-04-2007, 12:18 PM
Similar mechanism is provided via buffer creation hints... keep in mind that driver mostly treats this as hints, so don't rely on them too much!

Groovounet
12-04-2007, 03:42 PM
Do you mean GL_STATIC_* GL_STREAM_* GL_DYNAMIC_* ?

EvilOne
12-04-2007, 03:45 PM
Hmmm... just my own opinion, but I think, texture priorities are completely pointless. I would not spend my time on this. It's a simple matter of fact, a texture is used in a frame, or not. Regardless of it's priority.

EvilOne
12-04-2007, 03:48 PM
Me again... The comparision with buffers is simply wrong. Buffer creation hints are usage hints.

Relic
12-05-2007, 02:55 AM
It doesn't make sense for apps where all textures fit into texture memory (mind this is not only onboard memory, there is also AGP resp. PCI-E memory) or where all textures are needed in each frame anyway, but it's far from pointless.

Think of it as a hint to the implementation which textures are important and which are not (like a bool, use values 0.0 and 1.0).

The implementation knows which textures are required for rendering. The more interesting information for it is actually which textures are NOT important, because those are the better candidates for eviction if textures need to be made resident.

Consider this simple example: For any heavily textured scene, e.g. ground in a flight sim, you can tag the textures in the view and the ones which will come into view next with prio 1.0 and those which are definitely not in the view for the next period of time with prio zero. That way the implementation could always evict the unimportant textures first in case not all textures fit into texture memory.

Don't screw up the priorization though, it's just a hint.

Groovounet
12-05-2007, 03:13 PM
That extractly the way I was thinking : application that need more graphic memory than the graphic card have. If the drivers optimize the transfert from the main memory that seams to me very interessing. In other hand, I would need to create and delete textures to keep every drawn textures residents ...

Zengar
12-05-2007, 04:52 PM
Me again... The comparision with buffers is simply wrong. Buffer creation hints are usage hints.

Yes, and texture priorities are usage hints too.

Relic
12-06-2007, 08:38 AM
In other hand, I would need to create and delete textures to keep every drawn textures residents ...

No, there are three places where textures can reside:
In host memory, in PCI-E memory, and onboard.
The latter two can be directly accessed by the GPU for texturing.
The priorization addresses which ones get swapped out to host memory first. Prioritize your textures so that the ones which are likely to be used in the next frame have a 1.0 prio and the ones which are definitely not used a 0.0. That way those prio 0.0 textures get scrapped from the scarce texture memory first, but stay in host memory for the driver to reload once needed.

That all doesn't help if your texture working set size per frame is bigger than the available sum of texture memory.

Groovounet
12-06-2007, 01:58 PM
Thank, I will try this way.