#include "via_tris.h"
#include "via_ioctl.h"
#include "via_fb.h"
-#include "via_regs.h"
#include <stdio.h>
#include "macros.h"
assert(!mesaVis->haveStencilBuffer);
vmesa->have_hw_stencil = GL_FALSE;
vmesa->depth_max = (GLfloat)0xffffffff;
- vmesa->depth_clear_mask = 0;
- vmesa->ClearDepth = 0xffffffff;
vmesa->depth_clear_mask = 0xf << 28;
+ vmesa->ClearDepth = 0xffffffff;
vmesa->polygon_offset_scale = 2.0 / vmesa->depth_max;
break;
default:
#include "via_tex.h"
#include "via_common.h"
+/* Chip tags. These are used to group the adapters into
+ * related families.
+ */
+enum VIACHIPTAGS {
+ VIA_UNKNOWN = 0,
+ VIA_CLE266,
+ VIA_KM400,
+ VIA_K8M800,
+ VIA_PM800,
+ VIA_LAST
+};
+
#define VIA_FALLBACK_TEXTURE 0x1
#define VIA_FALLBACK_DRAW_BUFFER 0x2
#define VIA_FALLBACK_READ_BUFFER 0x4
#define VIA_FALLBACK_BLEND_FUNC 0x400
#define VIA_FALLBACK_USER_DISABLE 0x800
#define VIA_FALLBACK_PROJ_TEXTURE 0x1000
+#define VIA_FALLBACK_STIPPLE 0x2000
#define VIA_DMA_BUFSIZ 4096
#define VIA_DMA_HIGHWATER (VIA_DMA_BUFSIZ - 128)
GLuint swap_count;
GLuint swap_missed_count;
+ GLuint stipple[32];
+
PFNGLXGETUSTPROC get_ust;
};
}
}
-
if (ctx->Polygon.StippleFlag) {
- GLuint *stipple = &ctx->PolygonStipple[0];
+ GLuint *stipple = &vmesa->stipple[0];
BEGIN_RING(38);
OUT_RING( HC_HEADER2 );
viaXMesaWindowMoved(vmesa);
- /* We want to update the s/w rast state too so that r200SetBuffer()
+ /* We want to update the s/w rast state too so that viaSetBuffer()
* gets called.
*/
_swrast_DrawBuffer(ctx, mode);
viaCalcViewport(ctx);
}
+#if 0
+static void
+flip_bytes( GLubyte *p, GLuint n )
+{
+ register GLuint i, a, b;
+
+ for (i=0;i<n;i++) {
+ b = (GLuint) p[i]; /* words are often faster than bytes */
+ a = ((b & 0x01) << 7) |
+ ((b & 0x02) << 5) |
+ ((b & 0x04) << 3) |
+ ((b & 0x08) << 1) |
+ ((b & 0x10) >> 1) |
+ ((b & 0x20) >> 3) |
+ ((b & 0x40) >> 5) |
+ ((b & 0x80) >> 7);
+ p[i] = (GLubyte) a;
+ }
+}
+#endif
+
+static void viaPolygonStipple( GLcontext *ctx, const GLubyte *mask )
+{
+ viaContextPtr vmesa = VIA_CONTEXT(ctx);
+ GLubyte *s = (GLubyte *)vmesa->stipple;
+ int i;
+
+ /* Fallback for the CLE266 case as it doesn't seem to work */
+ if (vmesa->viaScreen->deviceID == VIA_CLE266) {
+ FALLBACK( vmesa, VIA_FALLBACK_STIPPLE, GL_TRUE);
+ } else {
+ for (i=0;i<128;i++)
+ s[i] = mask[i];
+ }
+}
void viaInitState(GLcontext *ctx)
{
viaChooseTriangle(ctx);
}
- if (vmesa->newState & _NEW_STENCIL)
+ if ((vmesa->newState & _NEW_STENCIL) && vmesa->have_hw_stencil)
viaChooseStencilState(ctx);
if (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR)
ctx->Driver.DepthRange = viaDepthRange;
ctx->Driver.Viewport = viaViewport;
ctx->Driver.Enable = viaEnable;
+ ctx->Driver.PolygonStipple = viaPolygonStipple;
/* Pixel path fallbacks.
*/