views:

346

answers:

2

I've been reading papers on computer graphics, and every so often I come across the term "dependent texture read" or "dependent texture fetch" used in the context of querying textures in shader code. What is a dependent texture read, and what is the difference between this and a "normal" texture read?

+2  A: 

A normal texture read just uses the texture coordinates passed into the shader. A dependent texture read is with texture coordinates that were calculated (somehow) in the shader.

Jim Buck
+1  A: 

A "dependent texture read" is when return values from one texture lookup are used to determine WHERE to look up from a second texture. An important implication is that the texture coordinates (where you look up from) is not determined until the middle of execution of the shader... there's no kind of static analysis you can do on the shader (even knowing the values of all parameters) that will tell you what the coordinates will be ahead of time. It also strictly orders the two texture reads and limits how much the execution order could be changed by optimizations in the driver, etc.

On older graphics cards, there used to be quite a few limitations on this kind of thing. For example, at one point (IIRC) you could look up from multiple textures but only with a small number of distinct texture coordinates. The hardware was actually implemented in a way that certain types of dependent texture reads were either impossible or very inefficient.

In the latest generation or two of cards, you shouldn't have to worry about this. But you may be reading books or articles from a couple years ago when you really did have to pay close attention to such things.

Larry Gritz
Actually, according PowerVR, you do need to pay attention on some fairly recent hardware :-) http://bit.ly/yvSnM
Justicle