mesa: Fix ff fragment shader inputs calculation when enabling a VS.
mesa: Fix ff fragment shader inputs calculation when enabling a VS.

The FF VS generation happens just after the FF FS generation in
state.c, so the ctx->VP._Current value is for the previous state
update's vertex shader, not the one that will be chosen as a result of
this state update.  The vertexShader and vertexProgram variables
should be accurately telling us whether there's going to be a
ctx->VP._Current (except on _MaintainTnlProgram drivers, where it's
always true).

The glsl-vs-statechange-1 test was created to test for this, but it
turns out that the bug is hidden by the fact that we call
_mesa_update_state() twice per draw call -- once from
_mesa_valid_to_render() and once from vbo_draw_arrays(), and the
second one was fixing up the first one.

Reviewed-by: Brian Paul <3cb4e1df5ec4da2c7c4af7c52cec8cf340a55a10@vmware.com>

zeux/glsl-optimizer,KTXSoftware/glsl2agal,bkaradzic/glsl-optimizer,wolf96/glsl-optimizer,metora/MesaGLSLCompiler,benaadams/glsl-optimizer,mcanthony/glsl-optimizer,mcanthony/glsl-optimizer,zz85/glsl-optimizer,adobe/glsl2agal,mcanthony/glsl-optimizer,jbarczak/glsl-optimizer,benaadams/glsl-optimizer,tokyovigilante/glsl-optimizer,adobe/glsl2agal,wolf96/glsl-optimizer,bkaradzic/glsl-optimizer,adobe/glsl2agal,mapbox/glsl-optimizer,bkaradzic/glsl-optimizer,KTXSoftware/glsl2agal,adobe/glsl2agal,zz85/glsl-optimizer,bkaradzic/glsl-optimizer,tokyovigilante/glsl-optimizer,zeux/glsl-optimizer,tokyovigilante/glsl-optimizer,jbarczak/glsl-optimizer,jbarczak/glsl-optimizer,bkaradzic/glsl-optimizer,mapbox/glsl-optimizer,jbarczak/glsl-optimizer,mcanthony/glsl-optimizer,mcanthony/glsl-optimizer,tokyovigilante/glsl-optimizer,zz85/glsl-optimizer,zeux/glsl-optimizer,benaadams/glsl-optimizer,dellis1972/glsl-optimizer,dellis1972/glsl-optimizer,dellis1972/glsl-optimizer,zz85/glsl-optimizer,dellis1972/glsl-optimizer,wolf96/glsl-optimizer,wolf96/glsl-optimizer,wolf96/glsl-optimizer,metora/MesaGLSLCompiler,djreep81/glsl-optimizer,KTXSoftware/glsl2agal,KTXSoftware/glsl2agal,djreep81/glsl-optimizer,adobe/glsl2agal,zz85/glsl-optimizer,mapbox/glsl-optimizer,zeux/glsl-optimizer,metora/MesaGLSLCompiler,zeux/glsl-optimizer,zz85/glsl-optimizer,benaadams/glsl-optimizer,tokyovigilante/glsl-optimizer,mapbox/glsl-optimizer,benaadams/glsl-optimizer,mapbox/glsl-optimizer,djreep81/glsl-optimizer,KTXSoftware/glsl2agal,djreep81/glsl-optimizer,jbarczak/glsl-optimizer,dellis1972/glsl-optimizer,djreep81/glsl-optimizer,benaadams/glsl-optimizer