summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mesa/drivers/dri/unichrome/via_common.h8
-rw-r--r--src/mesa/drivers/dri/unichrome/via_context.c47
-rw-r--r--src/mesa/drivers/dri/unichrome/via_context.h31
-rw-r--r--src/mesa/drivers/dri/unichrome/via_ioctl.c40
-rw-r--r--src/mesa/drivers/dri/unichrome/via_ioctl.h12
-rw-r--r--src/mesa/drivers/dri/unichrome/via_render.c15
-rw-r--r--src/mesa/drivers/dri/unichrome/via_state.c321
-rw-r--r--src/mesa/drivers/dri/unichrome/via_state.h12
-rw-r--r--src/mesa/drivers/dri/unichrome/via_texmem.c6
-rw-r--r--src/mesa/drivers/dri/unichrome/via_texstate.c14
-rw-r--r--src/mesa/drivers/dri/unichrome/via_tris.c1
-rw-r--r--src/mesa/drivers/dri/unichrome/via_vb.c5
12 files changed, 68 insertions, 444 deletions
diff --git a/src/mesa/drivers/dri/unichrome/via_common.h b/src/mesa/drivers/dri/unichrome/via_common.h
index 58eafc9103..52d25c786e 100644
--- a/src/mesa/drivers/dri/unichrome/via_common.h
+++ b/src/mesa/drivers/dri/unichrome/via_common.h
@@ -40,14 +40,6 @@
#define VIA_LOG_MIN_TEX_REGION_SIZE 16
#endif
-#define VIA_UPLOAD_TEX0IMAGE 0x1
-#define VIA_UPLOAD_TEX1IMAGE 0x2
-#define VIA_UPLOAD_CTX 0x4
-#define VIA_UPLOAD_BUFFERS 0x8
-#define VIA_UPLOAD_TEX0 0x10
-#define VIA_UPLOAD_TEX1 0x20
-#define VIA_UPLOAD_CLIPRECTS 0x40
-/*#define VIA_UPLOAD_ALL 0xff*/
/* VIA specific ioctls */
#define DRM_IOCTL_VIA_ALLOCMEM DRM_IOWR(0x40, drm_via_mem_t)
diff --git a/src/mesa/drivers/dri/unichrome/via_context.c b/src/mesa/drivers/dri/unichrome/via_context.c
index bb1dfdd6ca..7c4cec8a2d 100644
--- a/src/mesa/drivers/dri/unichrome/via_context.c
+++ b/src/mesa/drivers/dri/unichrome/via_context.c
@@ -352,7 +352,6 @@ InitVertexBuffer(viaContextPtr vmesa)
vmesa->dmaLow = DMA_OFFSET;
vmesa->dmaHigh = VIA_DMA_BUFSIZ;
vmesa->dmaAddr = (unsigned char *)vmesa->dma;
- vmesa->dmaLastPrim = vmesa->dmaLow;
}
static void
@@ -415,14 +414,14 @@ viaCreateContext(const __GLcontextModes *mesaVis,
vmesa->hasDepth = GL_TRUE;
vmesa->depthBits = mesaVis->depthBits;
vmesa->have_hw_stencil = GL_FALSE;
- vmesa->depth_scale = 1.0/0xffff;
+ vmesa->depth_max = (GLfloat)0xffff;
vmesa->depth_clear_mask = 0xf << 28;
vmesa->ClearDepth = 0xffff;
break;
case 24:
vmesa->hasDepth = GL_TRUE;
vmesa->depthBits = mesaVis->depthBits;
- vmesa->depth_scale = 1.0/0xffffff;
+ vmesa->depth_max = (GLfloat) 0xffffff;
vmesa->depth_clear_mask = 0xe << 28;
vmesa->ClearDepth = 0xffffff00;
@@ -438,7 +437,7 @@ viaCreateContext(const __GLcontextModes *mesaVis,
vmesa->depthBits = mesaVis->depthBits;
assert(!mesaVis->haveStencilBuffer);
vmesa->have_hw_stencil = GL_FALSE;
- vmesa->depth_scale = 1.0/0xffffffff;
+ vmesa->depth_max = (GLfloat)0xffffffff;
vmesa->depth_clear_mask = 0;
vmesa->ClearDepth = 0xffffffff;
vmesa->depth_clear_mask = 0xf << 28;
@@ -470,7 +469,7 @@ viaCreateContext(const __GLcontextModes *mesaVis,
ctx = vmesa->glCtx;
- ctx->Const.MaxTextureLevels = 11;
+ ctx->Const.MaxTextureLevels = 10;
ctx->Const.MaxTextureUnits = 2;
ctx->Const.MaxTextureImageUnits = ctx->Const.MaxTextureUnits;
ctx->Const.MaxTextureCoordUnits = ctx->Const.MaxTextureUnits;
@@ -528,8 +527,6 @@ viaCreateContext(const __GLcontextModes *mesaVis,
vmesa->texHeap = mmInit(0, viaScreen->textureSize);
vmesa->stippleInHw = 1;
vmesa->renderIndex = ~0;
- vmesa->dirty = VIA_UPLOAD_ALL;
- vmesa->uploadCliprects = GL_TRUE;
vmesa->needUploadAllState = 1;
make_empty_list(&vmesa->TexObjList);
@@ -665,8 +662,12 @@ void viaXMesaSetFrontClipRects(viaContextPtr vmesa)
vmesa->drawW = dPriv->w;
vmesa->drawH = dPriv->h;
- viaEmitDrawingRectangle(vmesa);
- vmesa->uploadCliprects = GL_TRUE;
+ {
+ GLuint bytePerPixel = vmesa->viaScreen->bitsPerPixel >> 3;
+ vmesa->drawXoff = (GLuint)(((vmesa->drawX * bytePerPixel) & 0x1f) / bytePerPixel);
+ }
+
+ viaCalcViewport(vmesa->glCtx);
}
void viaXMesaSetBackClipRects(viaContextPtr vmesa)
@@ -683,14 +684,16 @@ void viaXMesaSetBackClipRects(viaContextPtr vmesa)
vmesa->drawY = dPriv->y;
vmesa->drawW = dPriv->w;
vmesa->drawH = dPriv->h;
- viaEmitDrawingRectangle(vmesa);
- vmesa->uploadCliprects = GL_TRUE;
+
+
+ vmesa->drawXoff = 0;
+
+ viaCalcViewport(vmesa->glCtx);
}
void viaXMesaWindowMoved(viaContextPtr vmesa)
{
- GLuint bytePerPixel = vmesa->viaScreen->bitsPerPixel >> 3;
-
+
switch (vmesa->glCtx->Color._DrawDestMask[0]) {
case DD_FRONT_LEFT_BIT:
viaXMesaSetFrontClipRects(vmesa);
@@ -703,23 +706,6 @@ void viaXMesaWindowMoved(viaContextPtr vmesa)
break;
}
- vmesa->viaScreen->fbOffset = 0;
-
- {
- GLuint pitch, offset;
- pitch = vmesa->front.pitch;
- offset = vmesa->viaScreen->fbOffset + (vmesa->drawY * pitch + vmesa->drawX * bytePerPixel);
- assert(vmesa->viaScreen->fbOffset % bytePerPixel == 0);
- assert(pitch % bytePerPixel == 0);
-
- /* KW: I don't know what this was, but it was giving incorrect
- * results for backbuffer rendering:
- */
-/* vmesa->drawXoff = (GLuint)(((vmesa->drawX * bytePerPixel) & 0x1f) / bytePerPixel); */
- vmesa->drawXoff = 0;
- }
-
- viaCalcViewport(vmesa->glCtx);
}
GLboolean
@@ -796,7 +782,6 @@ void viaGetLock(viaContextPtr vmesa, GLuint flags)
DRI_VALIDATE_DRAWABLE_INFO( sPriv, dPriv );
if (sarea->ctxOwner != me) {
- vmesa->uploadCliprects = GL_TRUE;
sarea->ctxOwner = me;
vmesa->needUploadAllState = 1;
}
diff --git a/src/mesa/drivers/dri/unichrome/via_context.h b/src/mesa/drivers/dri/unichrome/via_context.h
index 187b81154f..2e815685bc 100644
--- a/src/mesa/drivers/dri/unichrome/via_context.h
+++ b/src/mesa/drivers/dri/unichrome/via_context.h
@@ -52,22 +52,6 @@ typedef struct via_texture_object_t *viaTextureObjectPtr;
#define VIA_FALLBACK_BLEND_FUNC 0x400
#define VIA_FALLBACK_USER_DISABLE 0x800
-#define VIA_UPLOAD_NONE 0x0000
-#define VIA_UPLOAD_ALPHATEST 0x0001
-#define VIA_UPLOAD_BLEND 0x0002
-#define VIA_UPLOAD_FOG 0x0004
-#define VIA_UPLOAD_MASK_ROP 0x0008
-#define VIA_UPLOAD_LINESTIPPLE 0x0010
-#define VIA_UPLOAD_POLYGONSTIPPLE 0x0020
-#define VIA_UPLOAD_DEPTH 0x0040
-#define VIA_UPLOAD_TEXTURE 0x0080
-#define VIA_UPLOAD_STENCIL 0x0100
-#define VIA_UPLOAD_CLIPPING 0x0200
-#define VIA_UPLOAD_DESTBUFFER 0x0400
-#define VIA_UPLOAD_DEPTHBUFFER 0x0800
-#define VIA_UPLOAD_ENABLE 0x0800
-#define VIA_UPLOAD_ALL 0x1000
-
#define VIA_DMA_BUFSIZ 500000
/* Use the templated vertex formats:
@@ -119,7 +103,7 @@ struct via_context_t {
GLuint ClearDepth;
GLuint depth_clear_mask;
GLuint stencil_clear_mask;
- GLfloat depth_scale;
+ GLfloat depth_max;
GLuint *dma;
viaRegion tex;
@@ -162,8 +146,6 @@ struct via_context_t {
GLuint dmaLastPrim;
GLboolean useAgp;
- GLboolean uploadCliprects;
-
GLuint needUploadAllState;
GLuint primitiveRendered;
@@ -403,12 +385,6 @@ extern hash_element hash_table[HASH_TABLE_SIZE][HASH_TABLE_DEPTH];
break; \
} while (1)
-#define LOCK_HARDWARE_QUIESCENT(vmesa) \
- do { \
- LOCK_HARDWARE(vmesa); \
- viaRegetLockQuiescent(vmesa); \
- } while (0)
-
#ifdef DEBUG
extern GLuint VIA_DEBUG;
@@ -422,7 +398,6 @@ extern void viaLock(viaContextPtr vmesa, GLuint flags);
extern void viaUnLock(viaContextPtr vmesa, GLuint flags);
extern void viaEmitHwStateLocked(viaContextPtr vmesa);
extern void viaEmitScissorValues(viaContextPtr vmesa, int box_nr, int emit);
-extern void viaEmitDrawingRectangle(viaContextPtr vmesa);
extern void viaXMesaSetBackClipRects(viaContextPtr vmesa);
extern void viaXMesaSetFrontClipRects(viaContextPtr vmesa);
extern void viaReAllocateBuffers(GLframebuffer *drawbuffer);
@@ -431,8 +406,8 @@ extern void viaXMesaWindowMoved(viaContextPtr vmesa);
extern void viaTexCombineState(viaContextPtr vmesa,
const struct gl_tex_env_combine_state * combine, unsigned unit );
-#define SUBPIXEL_X -.5
-#define SUBPIXEL_Y -.5
+#define SUBPIXEL_X 0
+#define SUBPIXEL_Y 0
/* TODO XXX _SOLO temp defines to make code compilable */
#ifndef GLX_PBUFFER_BIT
diff --git a/src/mesa/drivers/dri/unichrome/via_ioctl.c b/src/mesa/drivers/dri/unichrome/via_ioctl.c
index fc1b0327d9..aacd784ea5 100644
--- a/src/mesa/drivers/dri/unichrome/via_ioctl.c
+++ b/src/mesa/drivers/dri/unichrome/via_ioctl.c
@@ -195,7 +195,6 @@ static void viaClear(GLcontext *ctx, GLbitfield mask, GLboolean all,
}
UNLOCK_HARDWARE(vmesa);
- vmesa->uploadCliprects = GL_TRUE;
}
if (mask)
@@ -251,7 +250,6 @@ void viaCopyBuffer(const __DRIdrawablePrivate *dPriv)
}
}
UNLOCK_HARDWARE(vmesa);
- vmesa->uploadCliprects = GL_TRUE;
vmesa->swap_count++;
(*vmesa->get_ust)( & ust );
@@ -349,7 +347,6 @@ void viaPageFlip(const __DRIdrawablePrivate *dPriv)
}
UNLOCK_HARDWARE(vmesa);
- vmesa->uploadCliprects = GL_TRUE;
vmesa->swap_count++;
(void) (*vmesa->get_ust)( &vmesa->swap_ust );
@@ -380,22 +377,6 @@ void viaPageFlip(const __DRIdrawablePrivate *dPriv)
}
-/* This waits for *everybody* to finish rendering -- overkill.
- */
-void viaDmaFinish(viaContextPtr vmesa)
-{
- if (VIA_DEBUG) fprintf(stderr, "%s in\n", __FUNCTION__);
- VIA_FIREVERTICES(vmesa);
- LOCK_HARDWARE(vmesa);
- UNLOCK_HARDWARE(vmesa);
- if (VIA_DEBUG) fprintf(stderr, "%s out\n", __FUNCTION__);
-}
-
-void viaRegetLockQuiescent(viaContextPtr vmesa)
-{
- drmUnlock(vmesa->driFd, vmesa->hHWContext);
-}
-
static int intersect_rect(drm_clip_rect_t *out,
drm_clip_rect_t *a,
drm_clip_rect_t *b)
@@ -479,15 +460,11 @@ void viaFlushPrimsLocked(viaContextPtr vmesa)
sysCmd.size = 0;
}
else if (nbox > VIA_NR_SAREA_CLIPRECTS) {
- vmesa->uploadCliprects = GL_TRUE;
+ /* XXX: not handled ? */
}
- if (!nbox || !vmesa->uploadCliprects) {
- if (nbox == 1)
- sarea->nbox = 0;
- else
- sarea->nbox = nbox;
-
+ if (!nbox) {
+ sarea->nbox = 0;
sysCmd.discard = 1;
flush_sys(vmesa, &sysCmd);
}
@@ -546,7 +523,6 @@ void viaFlushPrimsLocked(viaContextPtr vmesa)
vmesa->dmaLow = DMA_OFFSET;
vmesa->dmaAddr = (unsigned char *)vmesa->dma;
vmesa->dmaHigh = VIA_DMA_BUFSIZ;
- vmesa->dmaLastPrim = DMA_OFFSET;
}
void viaFlushPrims(viaContextPtr vmesa)
@@ -763,7 +739,11 @@ void viaFillDepthBuffer(viaContextPtr vmesa, GLuint pixel, GLuint mask)
fprintf(stderr, "Fill Depth offset = %08x, pixel %x, mask %x\n", offset, pixel, mask);
nDestBase = offset;
nDestPitch = vmesa->depth.pitch;
- offsetX = vmesa->drawXoff;
+
+ /* KW: bogus offset? */
+/* offsetX = vmesa->drawXoff; */
+ offsetX = 0;
+
nDestWidth = (vmesa->depth.pitch / vmesa->depth.bpp * 8) - offsetX;
nDestHeight = vmesa->driDrawable->h;
@@ -906,7 +886,9 @@ int flush_sys(viaContextPtr vmesa, drm_via_flush_sys_t* buf)
}
else {
*vb++ = ((HC_SubA_HClipTB << 24) | (0x0 << 12) | vmesa->driDrawable->h);
- *vb++ = ((HC_SubA_HClipLR << 24) | (vmesa->drawXoff << 12) | (vmesa->driDrawable->w + vmesa->drawXoff));
+ /* KW: drawXoff known zero */
+/* *vb++ = ((HC_SubA_HClipLR << 24) | (vmesa->drawXoff << 12) | (vmesa->driDrawable->w + vmesa->drawXoff)); */
+ *vb++ = ((HC_SubA_HClipLR << 24) | vmesa->driDrawable->w);
}
/*=* John Sheng [2003.6.16] fix pci path *=*/
diff --git a/src/mesa/drivers/dri/unichrome/via_ioctl.h b/src/mesa/drivers/dri/unichrome/via_ioctl.h
index fec13c9362..627d8ad8f2 100644
--- a/src/mesa/drivers/dri/unichrome/via_ioctl.h
+++ b/src/mesa/drivers/dri/unichrome/via_ioctl.h
@@ -32,8 +32,6 @@ void viaEmitPrim(viaContextPtr vmesa);
void viaFlushPrims(viaContextPtr vmesa);
void viaFlushPrimsLocked(viaContextPtr vmesa);
-void viaDmaFinish(viaContextPtr vmesa);
-void viaRegetLockQuiescent(viaContextPtr vmesa);
void viaInitIoctlFuncs(GLcontext *ctx);
void viaCopyBuffer(const __DRIdrawablePrivate *dpriv);
void viaPageFlip(const __DRIdrawablePrivate *dpriv);
@@ -48,17 +46,9 @@ void viaDoSwapPBuffers(viaContextPtr vmesa);
int flush_agp(viaContextPtr vmesa, drm_via_flush_agp_t* agpCmd);
int flush_sys(viaContextPtr vmesa, drm_via_flush_sys_t* buf);
-#define VIA_STATECHANGE(vmesa, flag) \
- do { \
- if (vmesa->dmaLow != vmesa->dmaLastPrim) \
- viaFlushPrims(vmesa); \
- vmesa->dirty |= flag; \
- } while (0) \
-
-
#define VIA_FIREVERTICES(vmesa) \
do { \
- if (vmesa->dmaLow) { \
+ if (vmesa->dmaLow != DMA_OFFSET) { \
viaFlushPrims(vmesa); \
} \
} while (0)
diff --git a/src/mesa/drivers/dri/unichrome/via_render.c b/src/mesa/drivers/dri/unichrome/via_render.c
index 1ea5a53cc5..9c97d1981c 100644
--- a/src/mesa/drivers/dri/unichrome/via_render.c
+++ b/src/mesa/drivers/dri/unichrome/via_render.c
@@ -96,7 +96,7 @@ static void VERT_FALLBACK(GLcontext *ctx,
/*
#define INIT(prim) \
do { \
- VIA_STATECHANGE(vmesa, 0); \
+ VIA_FIREVERTICES(vmesa); \
viaRasterPrimitive(ctx, reducedPrim[prim], prim); \
} while (0)
*/
@@ -104,7 +104,7 @@ static void VERT_FALLBACK(GLcontext *ctx,
do { \
viaRasterPrimitive(ctx, reducedPrim[prim], prim); \
} while (0)
-#define NEW_PRIMITIVE() VIA_STATECHANGE(vmesa, 0)
+#define NEW_PRIMITIVE() VIA_FIREVERTICES(vmesa)
#define NEW_BUFFER() VIA_FIREVERTICES(vmesa)
#define GET_CURRENT_VB_MAX_VERTS() \
(((int)vmesa->dmaHigh - (int)vmesa->dmaLow) / (vmesa->vertexSize * 4))
@@ -445,16 +445,7 @@ static GLboolean via_run_render(GLcontext *ctx,
}
while (tnl->Driver.Render.Multipass && tnl->Driver.Render.Multipass(ctx, ++pass));
tnl->Driver.Render.Finish(ctx);
-
- /*=* DBG - flush : if hw idel *=*/
- /*{
- GLuint volatile *pnEnginStatus = vmesa->regEngineStatus;
- GLuint nStatus;
- nStatus = *pnEnginStatus;
- if ((nStatus & 0xFFFEFFFF) == 0x00020000)
- viaFlushPrims(vmesa);
- }*/
-
+
/*=* DBG viewperf7.0 : fix command buffer overflow *=*/
if (vmesa->dmaLow > (VIA_DMA_BUFSIZ / 2))
viaFlushPrims(vmesa);
diff --git a/src/mesa/drivers/dri/unichrome/via_state.c b/src/mesa/drivers/dri/unichrome/via_state.c
index bb06b327bb..aef23ff691 100644
--- a/src/mesa/drivers/dri/unichrome/via_state.c
+++ b/src/mesa/drivers/dri/unichrome/via_state.c
@@ -82,12 +82,6 @@ static __inline__ GLuint viaPackColor(GLuint format,
}
}
-static void viaAlphaFunc(GLcontext *ctx, GLenum func, GLfloat ref)
-{
- viaContextPtr vmesa = VIA_CONTEXT(ctx);
- vmesa = vmesa;
-}
-
static void viaBlendEquationSeparate(GLcontext *ctx, GLenum rgbMode, GLenum aMode)
{
if (VIA_DEBUG) fprintf(stderr, "%s in\n", __FUNCTION__);
@@ -112,16 +106,9 @@ static void viaBlendFunc(GLcontext *ctx, GLenum sfactor, GLenum dfactor)
viaContextPtr vmesa = VIA_CONTEXT(ctx);
GLboolean fallback = GL_FALSE;
if (VIA_DEBUG) fprintf(stderr, "%s in\n", __FUNCTION__);
+
switch (ctx->Color.BlendSrcRGB) {
- case GL_ZERO: break;
- case GL_SRC_ALPHA: break;
- case GL_ONE: break;
- case GL_DST_COLOR: break;
- case GL_ONE_MINUS_DST_COLOR: break;
- case GL_ONE_MINUS_SRC_ALPHA: break;
- case GL_DST_ALPHA: break;
- case GL_ONE_MINUS_DST_ALPHA: break;
- case GL_SRC_ALPHA_SATURATE: /*a |= SDM_SRC_SRC_ALPHA; break;*/
+ case GL_SRC_ALPHA_SATURATE:
case GL_CONSTANT_COLOR:
case GL_ONE_MINUS_CONSTANT_COLOR:
case GL_CONSTANT_ALPHA:
@@ -129,18 +116,10 @@ static void viaBlendFunc(GLcontext *ctx, GLenum sfactor, GLenum dfactor)
fallback = GL_TRUE;
break;
default:
- return;
+ break;
}
switch (ctx->Color.BlendDstRGB) {
- case GL_SRC_ALPHA: break;
- case GL_ONE_MINUS_SRC_ALPHA: break;
- case GL_ZERO: break;
- case GL_ONE: break;
- case GL_SRC_COLOR: break;
- case GL_ONE_MINUS_SRC_COLOR: break;
- case GL_DST_ALPHA: break;
- case GL_ONE_MINUS_DST_ALPHA: break;
case GL_CONSTANT_COLOR:
case GL_ONE_MINUS_CONSTANT_COLOR:
case GL_CONSTANT_ALPHA:
@@ -148,7 +127,7 @@ static void viaBlendFunc(GLcontext *ctx, GLenum sfactor, GLenum dfactor)
fallback = GL_TRUE;
break;
default:
- return;
+ break;
}
FALLBACK(vmesa, VIA_FALLBACK_BLEND_FUNC, fallback);
@@ -169,23 +148,6 @@ static void viaBlendFuncSeparate(GLcontext *ctx, GLenum sfactorRGB,
}
-static void viaDepthFunc(GLcontext *ctx, GLenum func)
-{
- viaContextPtr vmesa = VIA_CONTEXT(ctx);
- vmesa = vmesa;
-}
-
-static void viaDepthMask(GLcontext *ctx, GLboolean flag)
-{
- viaContextPtr vmesa = VIA_CONTEXT(ctx);
- vmesa = vmesa;
-}
-
-static void viaPolygonStipple(GLcontext *ctx, const GLubyte *mask)
-{
- viaContextPtr vmesa = VIA_CONTEXT(ctx);
- vmesa = vmesa;
-}
/* =============================================================
@@ -203,7 +165,6 @@ static void viaScissor(GLcontext *ctx, GLint x, GLint y,
if (ctx->Scissor.Enabled) {
VIA_FIREVERTICES(vmesa); /* don't pipeline cliprect changes */
- vmesa->uploadCliprects = GL_TRUE;
}
vmesa->scissorRect.x1 = x;
@@ -214,21 +175,12 @@ static void viaScissor(GLcontext *ctx, GLint x, GLint y,
}
-static void viaLogicOp(GLcontext *ctx, GLenum opcode)
-{
- if (VIA_DEBUG) fprintf(stderr, "%s in\n", __FUNCTION__);
- if (VIA_DEBUG) fprintf(stderr, "opcode = %x\n", opcode);
- if (VIA_DEBUG) fprintf(stderr, "%s out\n", __FUNCTION__);
-}
/* Fallback to swrast for select and feedback.
*/
static void viaRenderMode(GLcontext *ctx, GLenum mode)
{
- viaContextPtr vmesa = VIA_CONTEXT(ctx);
- if (VIA_DEBUG) fprintf(stderr, "%s in\n", __FUNCTION__);
- FALLBACK(vmesa, VIA_FALLBACK_RENDERMODE, (mode != GL_RENDER));
- if (VIA_DEBUG) fprintf(stderr, "%s out\n", __FUNCTION__);
+ FALLBACK(VIA_CONTEXT(ctx), VIA_FALLBACK_RENDERMODE, (mode != GL_RENDER));
}
@@ -238,7 +190,6 @@ static void viaDrawBuffer(GLcontext *ctx, GLenum mode)
if (VIA_DEBUG) fprintf(stderr, "%s in\n", __FUNCTION__);
if (mode == GL_FRONT) {
VIA_FIREVERTICES(vmesa);
- VIA_STATECHANGE(vmesa, VIA_UPLOAD_BUFFERS);
vmesa->drawMap = (char *)vmesa->driScreen->pFB;
vmesa->readMap = (char *)vmesa->driScreen->pFB;
vmesa->drawPitch = vmesa->front.pitch;
@@ -249,7 +200,6 @@ static void viaDrawBuffer(GLcontext *ctx, GLenum mode)
}
else if (mode == GL_BACK) {
VIA_FIREVERTICES(vmesa);
- VIA_STATECHANGE(vmesa, VIA_UPLOAD_BUFFERS);
vmesa->drawMap = vmesa->back.map;
vmesa->readMap = vmesa->back.map;
vmesa->drawPitch = vmesa->back.pitch;
@@ -276,119 +226,19 @@ static void viaClearColor(GLcontext *ctx, const GLfloat color[4])
{
viaContextPtr vmesa = VIA_CONTEXT(ctx);
GLubyte pcolor[4];
- pcolor[0] = (GLubyte) (255 * color[0]);
- pcolor[1] = (GLubyte) (255 * color[1]);
- pcolor[2] = (GLubyte) (255 * color[2]);
- pcolor[3] = (GLubyte) (255 * color[3]);
+ CLAMPED_FLOAT_TO_UBYTE(pcolor[0], color[0]);
+ CLAMPED_FLOAT_TO_UBYTE(pcolor[1], color[1]);
+ CLAMPED_FLOAT_TO_UBYTE(pcolor[2], color[2]);
+ CLAMPED_FLOAT_TO_UBYTE(pcolor[3], color[3]);
vmesa->ClearColor = viaPackColor(vmesa->viaScreen->bitsPerPixel,
pcolor[0], pcolor[1],
pcolor[2], pcolor[3]);
}
-/* =============================================================
- * Culling - the via isn't quite as clean here as the rest of
- * its interfaces, but it's not bad.
- */
-static void viaCullFaceFrontFace(GLcontext *ctx, GLenum unused)
-{
- viaContextPtr vmesa = VIA_CONTEXT(ctx);
- vmesa = vmesa;
-}
-
-static void viaLineWidth(GLcontext *ctx, GLfloat widthf)
-{
- viaContextPtr vmesa = VIA_CONTEXT(ctx);
- vmesa = vmesa;
-}
-
-static void viaPointSize(GLcontext *ctx, GLfloat sz)
-{
- viaContextPtr vmesa = VIA_CONTEXT(ctx);
- vmesa = vmesa;
-}
-
/* =============================================================
- * Color masks
*/
-static void viaColorMask(GLcontext *ctx,
- GLboolean r, GLboolean g,
- GLboolean b, GLboolean a)
-{
- viaContextPtr vmesa = VIA_CONTEXT(ctx);
- vmesa = vmesa;
-}
-
-/* Seperate specular not fully implemented on the via.
- */
-static void viaLightModelfv(GLcontext *ctx, GLenum pname,
- const GLfloat *param)
-{
- viaContextPtr vmesa = VIA_CONTEXT(ctx);
- vmesa = vmesa;
-}
-
-
-/* In Mesa 3.5 we can reliably do native flatshading.
- */
-static void viaShadeModel(GLcontext *ctx, GLenum mode)
-{
- viaContextPtr vmesa = VIA_CONTEXT(ctx);
- vmesa = vmesa;
-}
-
-/* =============================================================
- * Fog
- */
-static void viaFogfv(GLcontext *ctx, GLenum pname, const GLfloat *param)
-{
- viaContextPtr vmesa = VIA_CONTEXT(ctx);
- vmesa = vmesa;
-}
-
-/* =============================================================
- */
-static void viaEnable(GLcontext *ctx, GLenum cap, GLboolean state)
-{
- viaContextPtr vmesa = VIA_CONTEXT(ctx);
- vmesa = vmesa;
-}
-
-/* =============================================================
- */
-void viaEmitDrawingRectangle(viaContextPtr vmesa)
-{
- __DRIdrawablePrivate *dPriv = vmesa->driDrawable;
- viaScreenPrivate *viaScreen = vmesa->viaScreen;
- int x0 = vmesa->drawX;
- int y0 = vmesa->drawY;
- int x1 = x0 + dPriv->w;
- int y1 = y0 + dPriv->h;
-/* GLuint dr2, dr3, dr4;
-*/
-
- /* Coordinate origin of the window - may be offscreen.
- */
-/* dr4 = vmesa->BufferSetup[VIA_DESTREG_DR4] = ((y0 << 16) |
- (((unsigned)x0) & 0xFFFF));
-*/
-
- /* Clip to screen.
- */
- if (x0 < 0) x0 = 0;
- if (y0 < 0) y0 = 0;
- if (x1 > viaScreen->width - 1) x1 = viaScreen->width - 1;
- if (y1 > viaScreen->height - 1) y1 = viaScreen->height - 1;
-
- /* Onscreen drawing rectangle.
- */
-/* dr2 = vmesa->BufferSetup[VIA_DESTREG_DR2] = ((y0 << 16) | x0);
- dr3 = vmesa->BufferSetup[VIA_DESTREG_DR3] = (((y1 + 1) << 16) | (x1 + 1));
-*/
-
- vmesa->dirty |= VIA_UPLOAD_BUFFERS;
-}
void viaCalcViewport(GLcontext *ctx)
@@ -397,15 +247,14 @@ void viaCalcViewport(GLcontext *ctx)
const GLfloat *v = ctx->Viewport._WindowMap.m;
GLfloat *m = vmesa->ViewportMatrix.m;
- /* See also via_translate_vertex. SUBPIXEL adjustments can be done
- * via state vars, too.
+ /* See also via_translate_vertex.
*/
- m[MAT_SX] = v[MAT_SX];
- m[MAT_TX] = v[MAT_TX] + vmesa->drawXoff;
+ m[MAT_SX] = v[MAT_SX];
+ m[MAT_TX] = v[MAT_TX] + SUBPIXEL_X + vmesa->drawXoff;
m[MAT_SY] = - v[MAT_SY];
- m[MAT_TY] = - v[MAT_TY] + vmesa->driDrawable->h;
- m[MAT_SZ] = v[MAT_SZ] * vmesa->depth_scale;
- m[MAT_TZ] = v[MAT_TZ] * vmesa->depth_scale;
+ m[MAT_TY] = - v[MAT_TY] + vmesa->driDrawable->h + SUBPIXEL_Y;
+ m[MAT_SZ] = v[MAT_SZ] * (1.0 / vmesa->depth_max);
+ m[MAT_TZ] = v[MAT_TZ] * (1.0 / vmesa->depth_max);
}
static void viaViewport(GLcontext *ctx,
@@ -423,19 +272,6 @@ static void viaDepthRange(GLcontext *ctx,
viaCalcViewport(ctx);
}
-void viaPrintDirty(const char *msg, GLuint state)
-{
- if (VIA_DEBUG)
- fprintf(stderr, "%s (0x%x): %s%s%s%s\n",
- msg,
- (unsigned int) state,
- (state & VIA_UPLOAD_TEX0) ? "upload-tex0, " : "",
- (state & VIA_UPLOAD_TEX1) ? "upload-tex1, " : "",
- (state & VIA_UPLOAD_CTX) ? "upload-ctx, " : "",
- (state & VIA_UPLOAD_BUFFERS) ? "upload-bufs, " : ""
- );
-}
-
void viaInitState(GLcontext *ctx)
{
@@ -447,12 +283,6 @@ void viaInitState(GLcontext *ctx)
/* Mesa should do this for us:
*/
- ctx->Driver.AlphaFunc( ctx,
- ctx->Color.AlphaFunc,
- ctx->Color.AlphaRef);
-
-/* ctx->Driver.BlendColor( ctx, */
-/* ctx->Color.BlendColor ); */
ctx->Driver.BlendEquationSeparate( ctx,
ctx->Color.BlendEquationRGB,
@@ -464,65 +294,8 @@ void viaInitState(GLcontext *ctx)
ctx->Color.BlendSrcA,
ctx->Color.BlendDstA);
- ctx->Driver.ColorMask( ctx,
- ctx->Color.ColorMask[RCOMP],
- ctx->Color.ColorMask[GCOMP],
- ctx->Color.ColorMask[BCOMP],
- ctx->Color.ColorMask[ACOMP]);
-
- ctx->Driver.CullFace( ctx, ctx->Polygon.CullFaceMode );
- ctx->Driver.DepthFunc( ctx, ctx->Depth.Func );
- ctx->Driver.DepthMask( ctx, ctx->Depth.Mask );
-
- ctx->Driver.Enable( ctx, GL_ALPHA_TEST, ctx->Color.AlphaEnabled );
- ctx->Driver.Enable( ctx, GL_BLEND, ctx->Color.BlendEnabled );
- ctx->Driver.Enable( ctx, GL_COLOR_LOGIC_OP, ctx->Color.ColorLogicOpEnabled );
- ctx->Driver.Enable( ctx, GL_COLOR_SUM, ctx->Fog.ColorSumEnabled );
- ctx->Driver.Enable( ctx, GL_CULL_FACE, ctx->Polygon.CullFlag );
- ctx->Driver.Enable( ctx, GL_DEPTH_TEST, ctx->Depth.Test );
- ctx->Driver.Enable( ctx, GL_DITHER, ctx->Color.DitherFlag );
- ctx->Driver.Enable( ctx, GL_FOG, ctx->Fog.Enabled );
- ctx->Driver.Enable( ctx, GL_LIGHTING, ctx->Light.Enabled );
- ctx->Driver.Enable( ctx, GL_LINE_SMOOTH, ctx->Line.SmoothFlag );
- ctx->Driver.Enable( ctx, GL_POLYGON_STIPPLE, ctx->Polygon.StippleFlag );
- ctx->Driver.Enable( ctx, GL_SCISSOR_TEST, ctx->Scissor.Enabled );
- ctx->Driver.Enable( ctx, GL_STENCIL_TEST, ctx->Stencil.Enabled );
- ctx->Driver.Enable( ctx, GL_TEXTURE_1D, GL_FALSE );
- ctx->Driver.Enable( ctx, GL_TEXTURE_2D, GL_FALSE );
- ctx->Driver.Enable( ctx, GL_TEXTURE_RECTANGLE_NV, GL_FALSE );
- ctx->Driver.Enable( ctx, GL_TEXTURE_3D, GL_FALSE );
- ctx->Driver.Enable( ctx, GL_TEXTURE_CUBE_MAP, GL_FALSE );
-
- ctx->Driver.Fogfv( ctx, GL_FOG_COLOR, ctx->Fog.Color );
- ctx->Driver.Fogfv( ctx, GL_FOG_MODE, 0 );
- ctx->Driver.Fogfv( ctx, GL_FOG_DENSITY, &ctx->Fog.Density );
- ctx->Driver.Fogfv( ctx, GL_FOG_START, &ctx->Fog.Start );
- ctx->Driver.Fogfv( ctx, GL_FOG_END, &ctx->Fog.End );
-
- ctx->Driver.FrontFace( ctx, ctx->Polygon.FrontFace );
-
- {
- GLfloat f = (GLfloat)ctx->Light.Model.ColorControl;
- ctx->Driver.LightModelfv( ctx, GL_LIGHT_MODEL_COLOR_CONTROL, &f );
- }
-
- ctx->Driver.LineWidth( ctx, ctx->Line.Width );
- ctx->Driver.LogicOpcode( ctx, ctx->Color.LogicOp );
- ctx->Driver.PointSize( ctx, ctx->Point.Size );
- ctx->Driver.PolygonStipple( ctx, (const GLubyte *)ctx->PolygonStipple );
ctx->Driver.Scissor( ctx, ctx->Scissor.X, ctx->Scissor.Y,
ctx->Scissor.Width, ctx->Scissor.Height );
- ctx->Driver.ShadeModel( ctx, ctx->Light.ShadeModel );
-/* ctx->Driver.StencilFunc( ctx, */
-/* ctx->Stencil.Function[0], */
-/* ctx->Stencil.Ref[0], */
-/* ctx->Stencil.ValueMask[0] ); */
-/* ctx->Driver.StencilMask( ctx, ctx->Stencil.WriteMask[0] ); */
-/* ctx->Driver.StencilOp( ctx, */
-/* ctx->Stencil.FailFunc[0], */
-/* ctx->Stencil.ZFailFunc[0], */
-/* ctx->Stencil.ZPassFunc[0]); */
-
ctx->Driver.DrawBuffer( ctx, ctx->Color.DrawBuffer[0] );
}
@@ -566,7 +339,7 @@ get_wrap_mode( GLenum sWrap, GLenum tWrap )
}
-void viaChooseTextureState(GLcontext *ctx)
+static void viaChooseTextureState(GLcontext *ctx)
{
viaContextPtr vmesa = VIA_CONTEXT(ctx);
struct gl_texture_unit *texUnit0 = &ctx->Texture.Unit[0];
@@ -719,7 +492,6 @@ void viaChooseTextureState(GLcontext *ctx)
viaTexCombineState( vmesa, texUnit1->_CurrentCombine, 1 );
}
- vmesa->dirty |= VIA_UPLOAD_TEXTURE;
if (VIA_DEBUG) {
fprintf( stderr, "Csat_0 / Cop_0 = 0x%08x / 0x%08x\n",
@@ -740,13 +512,12 @@ void viaChooseTextureState(GLcontext *ctx)
else
vmesa->regCmdB &= (~(HC_HVPMSK_S | HC_HVPMSK_T | HC_HVPMSK_W));
vmesa->regEnable &= (~(HC_HenTXMP_MASK | HC_HenTXCH_MASK | HC_HenTXPP_MASK));
- vmesa->dirty |= VIA_UPLOAD_ENABLE;
}
if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__);
}
-void viaChooseColorState(GLcontext *ctx)
+static void viaChooseColorState(GLcontext *ctx)
{
viaContextPtr vmesa = VIA_CONTEXT(ctx);
GLenum s = ctx->Color.BlendSrcRGB;
@@ -998,22 +769,18 @@ void viaChooseColorState(GLcontext *ctx)
if (vmesa->viaScreen->bitsPerPixel <= 16)
vmesa->regEnable &= ~HC_HenDT_MASK;
- vmesa->dirty |= (VIA_UPLOAD_BLEND | VIA_UPLOAD_ENABLE);
}
else {
vmesa->regEnable &= (~HC_HenABL_MASK);
- vmesa->dirty |= VIA_UPLOAD_ENABLE;
}
if (ctx->Color.AlphaEnabled) {
vmesa->regEnable |= HC_HenAT_MASK;
vmesa->regHATMD = (((GLchan)ctx->Color.AlphaRef) & 0xFF) |
((ctx->Color.AlphaFunc - GL_NEVER) << 8);
- vmesa->dirty |= (VIA_UPLOAD_ALPHATEST | VIA_UPLOAD_ENABLE);
}
else {
vmesa->regEnable &= (~HC_HenAT_MASK);
- vmesa->dirty |= VIA_UPLOAD_ENABLE;
}
if (ctx->Color.DitherFlag && (vmesa->viaScreen->bitsPerPixel < 32)) {
@@ -1023,7 +790,6 @@ void viaChooseColorState(GLcontext *ctx)
else {
vmesa->regEnable |= HC_HenDT_MASK;
}
- vmesa->dirty |= VIA_UPLOAD_ENABLE;
}
if (ctx->Color.ColorLogicOpEnabled)
@@ -1033,17 +799,15 @@ void viaChooseColorState(GLcontext *ctx)
vmesa->regHFBBMSKL = (*(GLuint *)&ctx->Color.ColorMask[0]) & 0xFFFFFF;
vmesa->regHROP |= ((*(GLuint *)&ctx->Color.ColorMask[0]) >> 24) & 0xFF;
- vmesa->dirty |= VIA_UPLOAD_MASK_ROP;
if ((GLuint)((GLuint *)&ctx->Color.ColorMask[0]) & 0xFF000000)
vmesa->regEnable |= HC_HenAW_MASK;
else
vmesa->regEnable &= (~HC_HenAW_MASK);
- vmesa->dirty |= VIA_UPLOAD_ENABLE;
if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__);
}
-void viaChooseFogState(GLcontext *ctx)
+static void viaChooseFogState(GLcontext *ctx)
{
viaContextPtr vmesa = VIA_CONTEXT(ctx);
@@ -1063,7 +827,6 @@ void viaChooseFogState(GLcontext *ctx)
a = (GLubyte)(ctx->Fog.Color[3] * 255.0F);
vmesa->regHFogCL = (r << 16) | (g << 8) | b;
vmesa->regHFogCH = a;
- vmesa->dirty |= (VIA_UPLOAD_FOG | VIA_UPLOAD_ENABLE);
}
else {
if (!ctx->Texture._EnabledUnits) {
@@ -1071,11 +834,10 @@ void viaChooseFogState(GLcontext *ctx)
vmesa->regCmdB &= ~ HC_HVPMSK_Cs;
}
vmesa->regEnable &= ~HC_HenFOG_MASK;
- vmesa->dirty |= VIA_UPLOAD_ENABLE;
}
}
-void viaChooseDepthState(GLcontext *ctx)
+static void viaChooseDepthState(GLcontext *ctx)
{
viaContextPtr vmesa = VIA_CONTEXT(ctx);
if (ctx->Depth.Test) {
@@ -1086,7 +848,6 @@ void viaChooseDepthState(GLcontext *ctx)
else
vmesa->regEnable &= (~HC_HenZW_MASK);
vmesa->regHZWTMD = (ctx->Depth.Func - GL_NEVER) << 16;
- vmesa->dirty |= (VIA_UPLOAD_DEPTH | VIA_UPLOAD_ENABLE);
}
else {
@@ -1102,12 +863,10 @@ void viaChooseDepthState(GLcontext *ctx)
else
vmesa->regEnable &= (~HC_HenZW_MASK);*/
vmesa->regEnable &= (~HC_HenZW_MASK);
-
- vmesa->dirty |= VIA_UPLOAD_ENABLE;
}
}
-void viaChooseLightState(GLcontext *ctx)
+static void viaChooseLightState(GLcontext *ctx)
{
viaContextPtr vmesa = VIA_CONTEXT(ctx);
@@ -1121,7 +880,7 @@ void viaChooseLightState(GLcontext *ctx)
}
}
-void viaChooseLineState(GLcontext *ctx)
+static void viaChooseLineState(GLcontext *ctx)
{
viaContextPtr vmesa = VIA_CONTEXT(ctx);
@@ -1138,15 +897,13 @@ void viaChooseLineState(GLcontext *ctx)
vmesa->regEnable |= HC_HenLP_MASK;
vmesa->regHLP = ctx->Line.StipplePattern;
vmesa->regHLPRF = ctx->Line.StippleFactor;
- vmesa->dirty |= VIA_UPLOAD_LINESTIPPLE;
}
else {
vmesa->regEnable &= ~HC_HenLP_MASK;
}
- vmesa->dirty |= VIA_UPLOAD_ENABLE;
}
-void viaChoosePolygonState(GLcontext *ctx)
+static void viaChoosePolygonState(GLcontext *ctx)
{
viaContextPtr vmesa = VIA_CONTEXT(ctx);
@@ -1161,7 +918,6 @@ void viaChoosePolygonState(GLcontext *ctx)
if (ctx->Polygon.StippleFlag) {
vmesa->regEnable |= HC_HenSP_MASK;
- vmesa->dirty |= VIA_UPLOAD_POLYGONSTIPPLE;
}
else {
vmesa->regEnable &= ~HC_HenSP_MASK;
@@ -1173,10 +929,9 @@ void viaChoosePolygonState(GLcontext *ctx)
else {
vmesa->regEnable &= ~HC_HenFBCull_MASK;
}
- vmesa->dirty |= VIA_UPLOAD_ENABLE;
}
-void viaChooseStencilState(GLcontext *ctx)
+static void viaChooseStencilState(GLcontext *ctx)
{
viaContextPtr vmesa = VIA_CONTEXT(ctx);
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__);
@@ -1255,27 +1010,16 @@ void viaChooseStencilState(GLcontext *ctx)
break;
}
vmesa->regHSTMD = temp;
-
- vmesa->dirty |= (VIA_UPLOAD_STENCIL | VIA_UPLOAD_STENCIL);
}
else {
vmesa->regEnable &= ~HC_HenST_MASK;
- vmesa->dirty |= VIA_UPLOAD_ENABLE;
}
if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__);
}
-void viaChoosePoint(GLcontext *ctx)
-{
- ctx = ctx;
-}
-void viaChooseLine(GLcontext *ctx)
-{
- ctx = ctx;
-}
-void viaChooseTriangle(GLcontext *ctx)
+static void viaChooseTriangle(GLcontext *ctx)
{
viaContextPtr vmesa = VIA_CONTEXT(ctx);
if (VIA_DEBUG) {
@@ -1327,8 +1071,7 @@ static void viaChooseState(GLcontext *ctx, GLuint newState)
_NEW_STENCIL)))
return;
- vmesa->dirty = 0;
- vmesa->newState = newState;
+ vmesa->newState |= newState;
if (texUnit0->_ReallyEnabled || texUnit1->_ReallyEnabled || ctx->Fog.Enabled) {
vmesa->regCmdB |= HC_HVPMSK_Cs;
@@ -1383,28 +1126,14 @@ void viaInitStateFuncs(GLcontext *ctx)
/* API callbacks
*/
- ctx->Driver.AlphaFunc = viaAlphaFunc;
ctx->Driver.BlendEquationSeparate = viaBlendEquationSeparate;
ctx->Driver.BlendFuncSeparate = viaBlendFuncSeparate;
ctx->Driver.ClearColor = viaClearColor;
- ctx->Driver.ColorMask = viaColorMask;
- ctx->Driver.CullFace = viaCullFaceFrontFace;
- ctx->Driver.DepthFunc = viaDepthFunc;
- ctx->Driver.DepthMask = viaDepthMask;
ctx->Driver.DrawBuffer = viaDrawBuffer;
- ctx->Driver.Enable = viaEnable;
- ctx->Driver.Fogfv = viaFogfv;
- ctx->Driver.FrontFace = viaCullFaceFrontFace;
- ctx->Driver.LineWidth = viaLineWidth;
- ctx->Driver.LogicOpcode = viaLogicOp;
- ctx->Driver.PolygonStipple = viaPolygonStipple;
ctx->Driver.RenderMode = viaRenderMode;
ctx->Driver.Scissor = viaScissor;
- ctx->Driver.ShadeModel = viaShadeModel;
ctx->Driver.DepthRange = viaDepthRange;
ctx->Driver.Viewport = viaViewport;
- ctx->Driver.PointSize = viaPointSize;
- ctx->Driver.LightModelfv = viaLightModelfv;
/* Pixel path fallbacks.
*/
diff --git a/src/mesa/drivers/dri/unichrome/via_state.h b/src/mesa/drivers/dri/unichrome/via_state.h
index 08f8a49af3..b93c46bb2e 100644
--- a/src/mesa/drivers/dri/unichrome/via_state.h
+++ b/src/mesa/drivers/dri/unichrome/via_state.h
@@ -30,18 +30,6 @@
extern void viaInitState(GLcontext *ctx);
extern void viaInitStateFuncs(GLcontext *ctx);
extern void viaCalcViewport(GLcontext *ctx);
-extern void viaPrintDirty(const char *msg, GLuint state);
-extern void viaChooseTextureState(GLcontext *ctx);
-extern void viaChooseColorState(GLcontext *ctx);
-extern void viaChooseDepthState(GLcontext *ctx);
-extern void viaChoosePolygonState(GLcontext *ctx);
-extern void viaChoosePoint(GLcontext *ctx);
-extern void viaChooseLine(GLcontext *ctx);
-extern void viaChooseTriangle(GLcontext *ctx);
-extern void viaChooseFogState(GLcontext *ctx);
-extern void viaChooseStencilState(GLcontext *ctx);
-extern void viaChooseLightState(GLcontext *ctx);
-extern void viaChooseLineState(GLcontext *ctx);
extern void viaFallback(viaContextPtr vmesa, GLuint bit, GLboolean mode);
#define FALLBACK(vmesa, bit, mode) viaFallback(vmesa, bit, mode)
diff --git a/src/mesa/drivers/dri/unichrome/via_texmem.c b/src/mesa/drivers/dri/unichrome/via_texmem.c
index 6f4edde64e..167b79db00 100644
--- a/src/mesa/drivers/dri/unichrome/via_texmem.c
+++ b/src/mesa/drivers/dri/unichrome/via_texmem.c
@@ -63,12 +63,10 @@ void viaDestroyTexObj(viaContextPtr vmesa, viaTextureObjectPtr t)
if (vmesa) {
if (vmesa->CurrentTexObj[0] == t) {
vmesa->CurrentTexObj[0] = 0;
- vmesa->dirty &= ~VIA_UPLOAD_TEX0;
}
if (vmesa->CurrentTexObj[1] == t) {
vmesa->CurrentTexObj[1] = 0;
- vmesa->dirty &= ~VIA_UPLOAD_TEX1;
}
}
@@ -431,10 +429,10 @@ void viaUploadTexImages(viaContextPtr vmesa, viaTextureObjectPtr t)
/*t->bufAddr = (char *)((GLuint)vmesa->driScreen->pFB + t->texMem.offset);*/
if (t == vmesa->CurrentTexObj[0])
- VIA_STATECHANGE(vmesa, VIA_UPLOAD_TEX0);
+ VIA_FIREVERTICES(vmesa);
if (t == vmesa->CurrentTexObj[1])
- VIA_STATECHANGE(vmesa, VIA_UPLOAD_TEX1);
+ VIA_FIREVERTICES(vmesa);
viaUpdateTexLRU(vmesa, t);
diff --git a/src/mesa/drivers/dri/unichrome/via_texstate.c b/src/mesa/drivers/dri/unichrome/via_texstate.c
index f1db81eaf3..2255ecfba4 100644
--- a/src/mesa/drivers/dri/unichrome/via_texstate.c
+++ b/src/mesa/drivers/dri/unichrome/via_texstate.c
@@ -233,12 +233,6 @@ static void viaSetTexImages(viaContextPtr vmesa,
numLevels = lastLevel - firstLevel + 1;
- /*=* [DBG] fgfs : fix mipmap level 11 over hw limitations and result in segmentation fault *=*/
- if(numLevels > 10) {
- numLevels = 10;
- t->lastLevel = firstLevel + 9;
- }
-
log2Width = tObj->Image[0][firstLevel]->WidthLog2;
log2Height = tObj->Image[0][firstLevel]->HeightLog2;
log2Pitch = logbase2(tObj->Image[0][firstLevel]->Width * baseImage->TexFormat->TexelBytes);
@@ -270,7 +264,8 @@ static void viaSetTexImages(viaContextPtr vmesa,
t->totalSize = (*texSize)[log2Height][log2Width];
t->texMem.size = t->totalSize;
t->maxLevel = i - 1;
- t->dirty = VIA_UPLOAD_TEX0 | VIA_UPLOAD_TEX1;
+/* t->dirty = VIA_UPLOAD_TEX0 | VIA_UPLOAD_TEX1; */
+
if (VIA_DEBUG) {
fprintf(stderr, "log2Width = %d\n", log2Width);
fprintf(stderr, "log2Height = %d\n", log2Height);
@@ -672,7 +667,7 @@ static void viaUpdateTexUnit(GLcontext *ctx, GLuint unit)
* time.
*/
if (vmesa->CurrentTexObj[unit] != t) {
- VIA_STATECHANGE(vmesa, (VIA_UPLOAD_TEX0 << unit));
+ VIA_FIREVERTICES(vmesa);
vmesa->CurrentTexObj[unit] = t;
viaUpdateTexLRU(vmesa, t); /* done too often */
}
@@ -688,8 +683,7 @@ static void viaUpdateTexUnit(GLcontext *ctx, GLuint unit)
else {
vmesa->CurrentTexObj[unit] = 0;
vmesa->TexEnvImageFmt[unit] = 0;
- vmesa->dirty &= ~(VIA_UPLOAD_TEX0 << unit);
- VIA_STATECHANGE(vmesa, VIA_UPLOAD_CTX);
+ VIA_FIREVERTICES(vmesa);
}
if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__);
}
diff --git a/src/mesa/drivers/dri/unichrome/via_tris.c b/src/mesa/drivers/dri/unichrome/via_tris.c
index 60b835d040..0190d7a7d4 100644
--- a/src/mesa/drivers/dri/unichrome/via_tris.c
+++ b/src/mesa/drivers/dri/unichrome/via_tris.c
@@ -1194,7 +1194,6 @@ static void emit_all_state(viaContextPtr vmesa)
vmesa->dmaLow += (i << 2);
- vmesa->dirty = 0;
if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__);
}
diff --git a/src/mesa/drivers/dri/unichrome/via_vb.c b/src/mesa/drivers/dri/unichrome/via_vb.c
index 5ce2f521e0..f989d8d0fd 100644
--- a/src/mesa/drivers/dri/unichrome/via_vb.c
+++ b/src/mesa/drivers/dri/unichrome/via_vb.c
@@ -90,10 +90,11 @@ static struct {
#define HAVE_TEX3_VERTICES 0
#define HAVE_PTEX_VERTICES 0
-#define UNVIEWPORT_VARS GLfloat h = VIA_CONTEXT(ctx)->driDrawable->h
+#define UNVIEWPORT_VARS GLfloat h = VIA_CONTEXT(ctx)->driDrawable->h, \
+ depth_max = VIA_CONTEXT(ctx)->depth_max;
#define UNVIEWPORT_X(x) x - SUBPIXEL_X
#define UNVIEWPORT_Y(y) - y + h + SUBPIXEL_Y
-#define UNVIEWPORT_Z(z) z * (float)0xffffffff
+#define UNVIEWPORT_Z(z) z * (float)depth_max
#define PTEX_FALLBACK() FALLBACK(VIA_CONTEXT(ctx), VIA_FALLBACK_TEXTURE, 1)