Add MESA_FORMAT_XRGB8888_REV.
[mesa.git] / src / mesa / main / state.c
index 7b41b8f4da479f862518eeaae04633bc83b0250c..f10e6b04b7ccee4bb5a9072910bcb0ec24e9c616 100644 (file)
@@ -40,9 +40,7 @@
 #include "framebuffer.h"
 #include "light.h"
 #include "matrix.h"
-#if FEATURE_pixel_transfer
 #include "pixel.h"
-#endif
 #include "shader/program.h"
 #include "shader/prog_parameter.h"
 #include "state.h"
@@ -75,6 +73,16 @@ compute_max_element(struct gl_client_array *array)
 {
    assert(array->Enabled);
    if (array->BufferObj->Name) {
+      GLsizeiptrARB offset = (GLsizeiptrARB) array->Ptr;
+      GLsizeiptrARB obj_size = (GLsizeiptrARB) array->BufferObj->Size;
+
+      if (offset < obj_size) {
+        array->_MaxElement = (obj_size - offset +
+                              array->StrideB -
+                              array->_ElementSize) / array->StrideB;
+      } else {
+        array->_MaxElement = 0;
+      }
       /* Compute the max element we can access in the VBO without going
        * out of bounds.
        */
@@ -536,8 +544,9 @@ _mesa_update_state_locked( GLcontext *ctx )
 
    /* Determine which state flags effect vertex/fragment program state */
    if (ctx->FragmentProgram._MaintainTexEnvProgram) {
-      prog_flags |= (_NEW_TEXTURE | _NEW_FOG | _DD_NEW_SEPARATE_SPECULAR |
-                    _NEW_ARRAY);
+      prog_flags |= (_NEW_TEXTURE | _NEW_FOG |
+                    _NEW_ARRAY | _NEW_LIGHT | _NEW_POINT | _NEW_RENDERMODE |
+                    _NEW_PROGRAM);
    }
    if (ctx->VertexProgram._MaintainTnlProgram) {
       prog_flags |= (_NEW_ARRAY | _NEW_TEXTURE | _NEW_TEXTURE_MATRIX |
@@ -574,10 +583,8 @@ _mesa_update_state_locked( GLcontext *ctx )
    if (new_state & (_NEW_STENCIL | _NEW_BUFFERS))
       _mesa_update_stencil( ctx );
 
-#if FEATURE_pixel_transfer
    if (new_state & _MESA_NEW_TRANSFER_STATE)
       _mesa_update_pixel( ctx, new_state );
-#endif
 
    if (new_state & _DD_NEW_SEPARATE_SPECULAR)
       update_separate_specular( ctx );
@@ -702,6 +709,6 @@ _mesa_set_vp_override(GLcontext *ctx, GLboolean flag)
       /* Set one of the bits which will trigger fragment program
        * regeneration:
        */
-      ctx->NewState |= _NEW_ARRAY; 
+      ctx->NewState |= _NEW_PROGRAM;
    }
 }