Mesa (gallium-mesa-7.4): mesa: fix/ change state validation order for program/texture state

Alan Hourihane alanh at kemper.freedesktop.org
Wed Feb 18 12:59:25 UTC 2009


Module: Mesa
Branch: gallium-mesa-7.4
Commit: 8278c70716162b8ea36050f99020daef3834994a
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=8278c70716162b8ea36050f99020daef3834994a

Author: Brian Paul <brianp at vmware.com>
Date:   Mon Feb 16 20:22:46 2009 -0700

mesa: fix/change state validation order for program/texture state

Program state needs to be updated before texture state since the later depends
on the former.

Fixes piglit texgen failure.  The second time through the modes (press 't'
three times) we disable the fragment program and return to conventional texture
mode.  State validation failed here because update_texture() saw stale fragment
program state.

(cherry picked from master, commit 46ae1abbac6837d051c10b2e8b57eab3d4958ff4)

---

 src/mesa/main/state.c |   25 ++++++++++++-------------
 1 files changed, 12 insertions(+), 13 deletions(-)

diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c
index 6fe54c7..2c3177b 100644
--- a/src/mesa/main/state.c
+++ b/src/mesa/main/state.c
@@ -429,6 +429,18 @@ _mesa_update_state_locked( GLcontext *ctx )
    if (MESA_VERBOSE & VERBOSE_STATE)
       _mesa_print_state("_mesa_update_state", new_state);
 
+   if (ctx->FragmentProgram._MaintainTexEnvProgram) {
+      prog_flags |= (_NEW_TEXTURE | _NEW_FOG | _DD_NEW_SEPARATE_SPECULAR);
+   }
+   if (ctx->VertexProgram._MaintainTnlProgram) {
+      prog_flags |= (_NEW_ARRAY | _NEW_TEXTURE | _NEW_TEXTURE_MATRIX |
+                     _NEW_TRANSFORM | _NEW_POINT |
+                     _NEW_FOG | _NEW_LIGHT |
+                     _MESA_NEW_NEED_EYE_COORDS);
+   }
+   if (new_state & prog_flags)
+      update_program( ctx );
+
    if (new_state & (_NEW_MODELVIEW|_NEW_PROJECTION))
       _mesa_update_modelview_project( ctx, new_state );
 
@@ -488,19 +500,6 @@ _mesa_update_state_locked( GLcontext *ctx )
    if (new_state & _MESA_NEW_NEED_EYE_COORDS) 
       _mesa_update_tnl_spaces( ctx, new_state );
 
-   if (ctx->FragmentProgram._MaintainTexEnvProgram) {
-      prog_flags |= (_NEW_TEXTURE | _NEW_FOG | _DD_NEW_SEPARATE_SPECULAR);
-   }
-   if (ctx->VertexProgram._MaintainTnlProgram) {
-      prog_flags |= (_NEW_ARRAY | _NEW_TEXTURE | _NEW_TEXTURE_MATRIX |
-                     _NEW_TRANSFORM | _NEW_POINT |
-                     _NEW_FOG | _NEW_LIGHT |
-                     _MESA_NEW_NEED_EYE_COORDS);
-   }
-   if (new_state & prog_flags)
-      update_program( ctx );
-
-
 
    /*
     * Give the driver a chance to act upon the new_state flags.




More information about the mesa-commit mailing list