On Wed, 8 Feb 2012 07:23:02 +0000, Dave Airlie <airl...@gmail.com> wrote:
> On Tue, Feb 7, 2012 at 10:09 PM, Ian Romanick <i...@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"

Attachment: pgpmKtCJA2tQg.pgp
Description: PGP signature

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to