#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"
GLint ref, GLuint mask )
{
r128ContextPtr rmesa = R128_CONTEXT(ctx);
- GLuint refmask = ((ctx->Stencil.Ref[0] << 0) |
- (ctx->Stencil.ValueMask[0] << 16) |
- (ctx->Stencil.WriteMask[0] << 24));
+ GLuint refmask = (((ctx->Stencil.Ref[0] & 0xff) << 0) |
+ ((ctx->Stencil.ValueMask[0] & 0xff) << 16) |
+ ((ctx->Stencil.WriteMask[0] & 0xff) << 24));
GLuint z = rmesa->setup.z_sten_cntl_c;
z &= ~R128_STENCIL_TEST_MASK;
r128DDStencilMaskSeparate( GLcontext *ctx, GLenum face, GLuint mask )
{
r128ContextPtr rmesa = R128_CONTEXT(ctx);
- GLuint refmask = ((ctx->Stencil.Ref[0] << 0) |
- (ctx->Stencil.ValueMask[0] << 16) |
- (ctx->Stencil.WriteMask[0] << 24));
+ GLuint refmask = (((ctx->Stencil.Ref[0] & 0xff) << 0) |
+ ((ctx->Stencil.ValueMask[0] & 0xff) << 16) |
+ ((ctx->Stencil.WriteMask[0] & 0xff) << 24));
if ( rmesa->setup.sten_ref_mask_c != refmask ) {
rmesa->setup.sten_ref_mask_c = refmask;
{
r128ContextPtr rmesa = R128_CONTEXT(ctx);
GLuint z = rmesa->setup.z_sten_cntl_c;
- GLboolean ok = 1;
if (!( ctx->Visual.stencilBits > 0 && ctx->Visual.depthBits == 24 ))
return;
break;
case GL_ZERO:
z |= R128_STENCIL_S_FAIL_ZERO;
- ok = 0; /* Hardware bug? ZERO maps to KEEP */
break;
case GL_REPLACE:
z |= R128_STENCIL_S_FAIL_REPLACE;
- ok = 0; /* Hardware bug? REPLACE maps to KEEP */
break;
case GL_INCR:
z |= R128_STENCIL_S_FAIL_INC;
break;
case GL_INVERT:
z |= R128_STENCIL_S_FAIL_INV;
- ok = 0; /* Hardware bug? INV maps to ZERO */
+ break;
+ case GL_INCR_WRAP:
+ z |= R128_STENCIL_S_FAIL_INC_WRAP;
+ break;
+ case GL_DECR_WRAP:
+ z |= R128_STENCIL_S_FAIL_DEC_WRAP;
break;
}
switch ( ctx->Stencil.ZFailFunc[0] ) {
case GL_KEEP:
z |= R128_STENCIL_ZFAIL_KEEP;
- ok = 0; /* Hardware bug? KEEP maps to ZERO */
break;
case GL_ZERO:
z |= R128_STENCIL_ZFAIL_ZERO;
break;
case GL_INVERT:
z |= R128_STENCIL_ZFAIL_INV;
- ok = 0; /* Hardware bug? INV maps to ZERO */
+ break;
+ case GL_INCR_WRAP:
+ z |= R128_STENCIL_ZFAIL_INC_WRAP;
+ break;
+ case GL_DECR_WRAP:
+ z |= R128_STENCIL_ZFAIL_DEC_WRAP;
break;
}
switch ( ctx->Stencil.ZPassFunc[0] ) {
case GL_KEEP:
z |= R128_STENCIL_ZPASS_KEEP;
- ok = 0; /* Hardware bug? KEEP maps to ZERO */
break;
case GL_ZERO:
z |= R128_STENCIL_ZPASS_ZERO;
break;
case GL_DECR:
z |= R128_STENCIL_ZPASS_DEC;
- ok = 0; /* Hardware bug? DEC maps to INCR_WRAP */
break;
case GL_INVERT:
z |= R128_STENCIL_ZPASS_INV;
- ok = 0; /* Hardware bug? INV maps to ZERO */
+ break;
+ case GL_INCR_WRAP:
+ z |= R128_STENCIL_ZPASS_INC_WRAP;
+ break;
+ case GL_DECR_WRAP:
+ z |= R128_STENCIL_ZPASS_DEC_WRAP;
break;
}
- /* XXX: Now that we know whether we can do the given funcs successfully
- * (according to testing done with a modified stencilwrap test), go
- * ahead and drop that knowledge on the floor. While fallbacks remain
- * broken, they make the situation even worse (in test apps, at least) than
- * failing in just the stencil part.
- */
- /*FALLBACK( rmesa, R128_FALLBACK_STENCIL, !ok );*/
-
if ( rmesa->setup.z_sten_cntl_c != z ) {
rmesa->setup.z_sten_cntl_c = z;
rmesa->dirty |= R128_UPLOAD_CONTEXT;
x2 += drawable->x;
y2 += drawable->y;
- rmesa->setup.sc_top_left_c = ((y1 << 16) | x1);
- rmesa->setup.sc_bottom_right_c = ((y2 << 16) | x2);
+ /* Clamp values to screen to avoid wrapping problems */
+ if ( x1 < 0 )
+ x1 = 0;
+ else if ( x1 >= rmesa->driScreen->fbWidth )
+ x1 = rmesa->driScreen->fbWidth - 1;
+ if ( y1 < 0 )
+ 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));
rmesa->dirty |= R128_UPLOAD_CONTEXT;
}
struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[0][0];
driRenderbuffer *drb = (driRenderbuffer *) rb;
- rmesa->setup.window_xy_offset = ((y << R128_WINDOW_Y_SHIFT) |
- (x << R128_WINDOW_X_SHIFT));
+ rmesa->setup.window_xy_offset = (((y & 0xFFF) << R128_WINDOW_Y_SHIFT) |
+ ((x & 0xFFF) << R128_WINDOW_X_SHIFT));
rmesa->setup.dst_pitch_offset_c = (((drb->flippedPitch/8) << 21) |
(drb->flippedOffset >> 5));
R128_UPLOAD_WINDOW |
R128_UPLOAD_CORE) ) {
memcpy( &sarea->context_state, regs, sizeof(sarea->context_state) );
+
+ if( rmesa->dirty & R128_UPLOAD_CONTEXT )
+ {
+ /* One possible side-effect of uploading a new context is the
+ * setting of the R128_GMC_AUX_CLIP_DIS bit, which causes all
+ * auxilliary cliprects to be disabled. So the next command must
+ * upload them again. */
+ rmesa->dirty |= R128_UPLOAD_CLIPRECTS;
+ }
}
if ( (rmesa->dirty & R128_UPLOAD_TEX0) && t0 ) {
r128UpdateMasks( ctx );
if ( new_state & R128_NEW_WINDOW )
+ {
r128UpdateWindow( ctx );
+ r128CalcViewport( ctx );
+ }
if ( rmesa->NewGLState & _NEW_TEXTURE ) {
r128UpdateTextureState( ctx );
{
_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;
}
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;
}