[Mesa-dev] updating tex combine for frag program

Eric Anholt eric at anholt.net
Wed Feb 8 12:35:24 PST 2012


On Wed, 8 Feb 2012 07:23:02 +0000, Dave Airlie <airlied at gmail.com> wrote:
> On Tue, Feb 7, 2012 at 10:09 PM, Ian Romanick <idr at freedesktop.org> wrote:
> > On 02/07/2012 12:08 PM, Dave Airlie wrote:
> >>
> >> Hi guys,
> >>
> >> Is there any reason we need to update tex combiner state if we are
> >> using shaders?
> >>
> >> can we drop update_tex_combine updates to only the case where we don't
> >> have a fragment shader/program unless its from the FF shader?
> >
> >
> > I don't recall when update_tex_combine happens.  Does it happen at draw-time
> > or state change-time?  If it happens at state change-time, the state will
> > need to get updated when program 0 gets bound.  Otherwise something like the
> > following would break:
> >
> >        glUseProgram(my_prog);
> >        glTexEnvi(GL_TEXTURE_2D, GL_TEXTURE_ENV_MODE,
> >                GL_DECAL);
> >        glUseProgram(0);
> >        glDrawArrays(...);
> 
> 
> IT happens in update_texture_state which happens on _NEW_TEXTURE, so
> it should be fine, since with the maintain fixed function stuff we
> update the program on _NEW_TEXTURE.

I think what he was meaning to say was

# some time before: original texenv setup.
glUseProgram(0);
glDrawArrays(...);
# change texenv but use GLSL
glUseProgram(my_prog);
glTexEnvi(GL_TEXTURE_2D, GL_TEXTURE_ENV_MODE, GL_DECAL);
glDrawArrays(...);
# disable GLSL.
glUseProgram(0);
glDrawArrays(...);

So you skipped the texenv setup when textures were changed, and didn't
re-setup when the program only changed.  So when skipping texenv you'd
need to set a flag in texenv that said "recompute when active even if
!_NEW_TEXTURE"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20120208/786932e2/attachment.pgp>


More information about the mesa-dev mailing list