Merge branch 'origin' into glsl-compiler-1
[mesa.git] / src / mesa / drivers / dri / r128 / r128_state.c
index 05ab3890d2cbd5eb5e3f02f184d16e92a627b215..e476afa5d828a982d56173102e5cb2e6f0aeace7 100644 (file)
@@ -44,7 +44,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include "enums.h"
 #include "colormac.h"
 #include "swrast/swrast.h"
-#include "array_cache/acache.h"
+#include "vbo/vbo.h"
 #include "tnl/tnl.h"
 #include "swrast_setup/swrast_setup.h"
 
@@ -608,6 +608,14 @@ static void r128UpdateClipping( GLcontext *ctx )
          y1 = 0;
       else if ( y1 >= rmesa->driScreen->fbHeight )
          y1 = rmesa->driScreen->fbHeight - 1;
+      if ( x2 < 0 )
+         x2 = 0;
+      else if ( x2 >= rmesa->driScreen->fbWidth )
+         x2 = rmesa->driScreen->fbWidth - 1;
+      if ( y2 < 0 )
+         y2 = 0;
+      else if ( y2 >= rmesa->driScreen->fbHeight )
+         y2 = rmesa->driScreen->fbHeight - 1;
 
       rmesa->setup.sc_top_left_c     = (((y1 & 0x3FFF) << 16) | (x1 & 0x3FFF));
       rmesa->setup.sc_bottom_right_c = (((y2 & 0x3FFF) << 16) | (x2 & 0x3FFF));
@@ -1226,7 +1234,10 @@ void r128DDUpdateHWState( GLcontext *ctx )
         r128UpdateMasks( ctx );
 
       if ( new_state & R128_NEW_WINDOW )
+      {
         r128UpdateWindow( ctx );
+        r128CalcViewport( ctx );
+      }
 
       if ( rmesa->NewGLState & _NEW_TEXTURE ) {
         r128UpdateTextureState( ctx );
@@ -1239,7 +1250,7 @@ static void r128DDInvalidateState( GLcontext *ctx, GLuint new_state )
 {
    _swrast_InvalidateState( ctx, new_state );
    _swsetup_InvalidateState( ctx, new_state );
-   _ac_InvalidateState( ctx, new_state );
+   _vbo_InvalidateState( ctx, new_state );
    _tnl_InvalidateState( ctx, new_state );
    R128_CONTEXT(ctx)->NewGLState |= new_state;
 }
@@ -1423,19 +1434,4 @@ void r128DDInitStateFuncs( GLcontext *ctx )
 
    ctx->Driver.DepthRange               = r128DepthRange;
    ctx->Driver.Viewport                 = r128Viewport;
-
-   /* Pixel path fallbacks.
-    */
-   ctx->Driver.Accum = _swrast_Accum;
-   ctx->Driver.Bitmap = _swrast_Bitmap;
-   ctx->Driver.CopyPixels = _swrast_CopyPixels;
-   ctx->Driver.DrawPixels = _swrast_DrawPixels;
-   ctx->Driver.ReadPixels = _swrast_ReadPixels;
-
-   /* Swrast hooks for imaging extensions:
-    */
-   ctx->Driver.CopyColorTable = _swrast_CopyColorTable;
-   ctx->Driver.CopyColorSubTable = _swrast_CopyColorSubTable;
-   ctx->Driver.CopyConvolutionFilter1D = _swrast_CopyConvolutionFilter1D;
-   ctx->Driver.CopyConvolutionFilter2D = _swrast_CopyConvolutionFilter2D;
 }