PDA

View Full Version : Possible to disable multitexture coord interpolation?



Lindley
08-10-2007, 07:43 AM
There are a few places where I'm using glMultiTextureCoord2fARB() to pass multiple sets of texture coordinates.

However, I don't need those everywhere, and it occurs to me that there might be an efficiency gain if I could prevent OpenGL from trying to interpolate all the coordinate sets per-fragment where I don't need them.

Is there an explicit way to do that? Is Cg smart enough to automatically tell the card not to bother if a given TEXCOORD semantic doesn't appear as an input?

Zengar
08-10-2007, 01:49 PM
First, it is not possible to disable the interpolation. On newer cards (G8x) there is an extension that allows one to use other interpolation modes. And second, interpolators are "free" on modern hardware.

Lindley
08-10-2007, 01:54 PM
Yeah, I figured that might be the case. But I'm questioning everything at this point, ever size I realized just how much time I was losing with unnecessary glClears.

Komat
08-11-2007, 02:05 AM
I think that each of you is talking about different thing. Lindley question is about interpolation of unused texture coordinates. Zengar reply is about interpolation mode (e.g. flat,smooth) on used coordinate.

If driver can decide that the coordinate is not needed, it will not interpolate it. If the texture coordinate is not even mentioned in both vertex and fragment shader then it is certainly disabled. What happens in different cases (e.g. vertex shader writes the coordinate and pixel shader does not reference it) depends entirely on the driver.

Humus
08-16-2007, 09:51 AM
Originally posted by Zengar:
And second, interpolators are "free" on modern hardware. Actually, that's not entirely true. They are very rarely the bottleneck, but you can construct cases where they might be. Like this for instance:


varying vec4 t0, t1, t2;

void main(){
gl_FragColor = t0 * t1 + t2;
}