I am hunting this bug for over 3 hours now. I got it, but i cannot understand it.
When i use register combiners or texture environment combiners, i am forced to enable the second texture unit (counting from 1), and bind a texture to. It is allowed to disabled the unit immidiately after that. However if there is no texture bound to it (although it is disabled anyway), the combiners don´t always do what they are supposed to.
I think this is strange, and certainly it violates the spec. I only want to use the first unit, nothing more.
This is on a Gf 4200 with latest drivers.
Or is there some rule, that when using combiners i have to use more than one texture unit?
I don’t quite understand what you’re saying. A legacy texture unit comprises both a texture sampler and a combiner. You break the rules of the sampler, you lose the combiner.
1)If you need only the first texture environment (say, as a combiner), you don’t need to bind a texture anywhere else.
2)If you disable a texture unit, it’s completely irrelevant whether you have bound a texture to it or not. It will do nothing. That also means that any combiner stuff you wanted it to perform will not be done.
3)Register combiners relax the binding restrictions, so we’ll go separate paths for
a)ARB_texture_env_combine or similar:
If you enable a texture unit, you must bind a valid texture object (ie w a complete mipmap set or simply with a non-mipmapped filter). It doesn’t matter whether you actually access the texture or not. This, however, does not mean that you need to do this for genuinely unused combiners.
… don’t care.
EnableTextureUnit (0, true);
BindTexture (0, SomeTexture);
//** strange part ***
EnableTextureUnit (1, true);
BindTexture (1, EmptyTexture);
EnableTextureUnit (1, false);
glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB);
glTexEnvi (GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_MODULATE);
glTexEnvi (GL_TEXTURE_ENV, GL_SOURCE0_RGB_ARB, GL_TEXTURE);
glTexEnvi (GL_TEXTURE_ENV, GL_OPERAND0_RGB_ARB, GL_SRC_COLOR);
glTexEnvi (GL_TEXTURE_ENV, GL_SOURCE1_RGB_ARB, GL_CONSTANT_ARB);
glTexEnvi (GL_TEXTURE_ENV, GL_OPERAND1_RGB_ARB, GL_SRC_COLOR);
…set constant color…
If i don´t do the “strange part” the results are not always as expected, depending on some preconditions which i don´t know.
I am quite sure it´s a driver bug, since it works perfectly on ATI cards and it does make no sense at all why it shouldn´t work.
PS: When using reg. combiners it´s similar.
It doesn’t work because the ARB_texture_env_combine spec says that it won’t work. There is no separation between the notion of texture units and combine stages. Even though more recent hardware no longer has this limitation, the spec still works has if there is a 1:1:1 relationship between texture coordinate interpolators, texture fetch units, and texture combine units.
Originally posted by idr:
There is no separation between the notion of texture units and combine stages. The spec still works has if there is a 1:1:1 relationship between texture coordinate interpolators, texture fetch units, and texture combine units.
I don´t understand what that means, could you elaborate a bit on this?