On Son, 2002-10-13 at 17:54, Michel Dänzer wrote:
> 
> I've done some more clueless digging into the problem visible in
> http://penguinppc.org/~daenzer/DRI/evas_test.jpeg and
> http://penguinppc.org/~daenzer/DRI/celestia.jpeg . My first suspicion
> was an off-by-one error in the scissor code, but enlarging the scissor
> rectangle doesn't help; making it smaller makes the problem worse
> though, so the scissor code seems to be correct. So the quads actually
> seem to be rendered one pixel too small in both directions;

Actually not. The problem with the evas demo is that the Radeon can't
seem to cope with infinity for texture coordinates (the demo doesn't
render just one quad per background tile, but four of 'em, three having
infinity for some texture coordinates; those aren't rendered). The first
attached patch fixes that, but is a bit awkward; better ideas anyone?

As for the text in celestia, that's fixed by the second patch, which
I'll commit soon unless someone sees a problem with it.


-- 
Earthling Michel Dänzer (MrCooper)/ Debian GNU/Linux (powerpc) developer
XFree86 and DRI project member   /  CS student, Free Software enthusiast
Index: extras/Mesa/src/tnl/t_imm_api.c
===================================================================
RCS file: /cvsroot/dri/xc/xc/extras/Mesa/src/tnl/t_imm_api.c,v
retrieving revision 1.7
diff -p -u -r1.7 t_imm_api.c
--- extras/Mesa/src/tnl/t_imm_api.c	14 Jun 2002 03:55:06 -0000	1.7
+++ extras/Mesa/src/tnl/t_imm_api.c	18 Oct 2002 00:35:21 -0000
@@ -611,6 +611,10 @@ _tnl_Normal3fv( const GLfloat *v )
 }
 
 
+#define ASSIGN_TC(tc,s,t,u,v)	ASSIGN_4V(tc,			\
+	(s == INFINITY) ? 1.0 : (s == -INFINITY) ? -1.0 : s,	\
+	(t == INFINITY) ? 1.0 : (t == -INFINITY) ? -1.0 : t,	\
+	u, v)
 
 #define TEXCOORD1(s)				\
 {						\
@@ -620,7 +624,7 @@ _tnl_Normal3fv( const GLfloat *v )
    count = IM->Count;				\
    IM->Flag[count] |= VERT_TEX0;		\
    tc = IM->TexCoord0[count];			\
-   ASSIGN_4V(tc,s,0,0,1);			\
+   ASSIGN_TC(tc,s,0,0,1);			\
 }
 
 #define TEXCOORD2(s,t)				\
@@ -631,7 +635,7 @@ _tnl_Normal3fv( const GLfloat *v )
    count = IM->Count;				\
    IM->Flag[count] |= VERT_TEX0;		\
    tc = IM->TexCoord0[count];			\
-   ASSIGN_4V(tc, s,t,0,1);		        \
+   ASSIGN_TC(tc,s,t,0,1);		        \
 }
 
 #define TEXCOORD3(s,t,u)			\
@@ -643,7 +647,7 @@ _tnl_Normal3fv( const GLfloat *v )
    IM->Flag[count] |= VERT_TEX0;		\
    IM->TexSize |= TEX_0_SIZE_3;		\
    tc = IM->TexCoord0[count];			\
-   ASSIGN_4V(tc, s,t,u,1);			\
+   ASSIGN_TC(tc, s,t,u,1);			\
 }
 
 #define TEXCOORD4(s,t,u,v)			\
@@ -655,7 +659,7 @@ _tnl_Normal3fv( const GLfloat *v )
    IM->Flag[count] |= VERT_TEX0;		\
    IM->TexSize |= TEX_0_SIZE_4;		\
    tc = IM->TexCoord0[count];			\
-   ASSIGN_4V(tc, s,t,u,v);			\
+   ASSIGN_TC(tc, s,t,u,v);			\
 }
 
 #if defined(USE_IEEE)
@@ -667,8 +671,8 @@ _tnl_Normal3fv( const GLfloat *v )
    count = IM->Count;					\
    IM->Flag[count] |= VERT_TEX0;			\
    tc = (fi_type *)IM->TexCoord0[count];		\
-   tc[0].i = ((fi_type *)&(s))->i;			\
-   tc[1].i = ((fi_type *)&(t))->i;			\
+   tc[0].f = (s==INFINITY)?1.0:(s==-INFINITY)?-1.0:s;	\
+   tc[1].f = (t==INFINITY)?1.0:(t==-INFINITY)?-1.0:t;	\
    tc[2].i = 0;						\
    tc[3].i = IEEE_ONE;					\
 }
@@ -879,7 +883,7 @@ _tnl_Vertex4fv( const GLfloat *v )
    if (texunit < IM->MaxTextureUnits) {			\
       GLuint count = IM->Count;				\
       GLfloat *tc = IM->TexCoord[texunit][count];	\
-      ASSIGN_4V(tc, s, 0.0F, 0.0F, 1.0F);		\
+      ASSIGN_TC(tc, s, 0.0F, 0.0F, 1.0F);		\
       IM->Flag[count] |= VERT_TEX(texunit);		\
    }							\
 }
@@ -891,7 +895,7 @@ _tnl_Vertex4fv( const GLfloat *v )
    if (texunit < IM->MaxTextureUnits) {			\
       GLuint count = IM->Count;				\
       GLfloat *tc = IM->TexCoord[texunit][count];	\
-      ASSIGN_4V(tc, s, t, 0.0F, 1.0F);			\
+      ASSIGN_TC(tc, s, t, 0.0F, 1.0F);			\
       IM->Flag[count] |= VERT_TEX(texunit);		\
    }							\
 }
@@ -903,7 +907,7 @@ _tnl_Vertex4fv( const GLfloat *v )
    if (texunit < IM->MaxTextureUnits) {			\
       GLuint count = IM->Count;				\
       GLfloat *tc = IM->TexCoord[texunit][count];	\
-      ASSIGN_4V(tc, s, t, u, 1.0F);			\
+      ASSIGN_TC(tc, s, t, u, 1.0F);			\
       IM->Flag[count] |= VERT_TEX(texunit);		\
       IM->TexSize |= TEX_SIZE_3(texunit);		\
    }							\
@@ -916,7 +920,7 @@ _tnl_Vertex4fv( const GLfloat *v )
    if (texunit < IM->MaxTextureUnits) {			\
       GLuint count = IM->Count;				\
       GLfloat *tc = IM->TexCoord[texunit][count];	\
-      ASSIGN_4V(tc, s, t, u, v);			\
+      ASSIGN_TC(tc, s, t, u, v);			\
       IM->Flag[count] |= VERT_TEX(texunit);		\
       IM->TexSize |= TEX_SIZE_4(texunit);		\
    }							\
@@ -931,8 +935,8 @@ _tnl_Vertex4fv( const GLfloat *v )
       GLuint count = IM->Count;					\
       fi_type *tc = (fi_type *)IM->TexCoord[texunit][count];	\
       IM->Flag[count] |= VERT_TEX(texunit);			\
-      tc[0].i = ((fi_type *)&(s))->i;				\
-      tc[1].i = ((fi_type *)&(t))->i;				\
+      tc[0].f = (s==INFINITY)? 1.0: (s==-INFINITY)? -1.0: s;	\
+      tc[1].f = (t==INFINITY)? 1.0: (t==-INFINITY)? -1.0: t;	\
       tc[2].i = 0;						\
       tc[3].i = IEEE_ONE;					\
    }								\
Index: lib/GL/mesa/src/drv/radeon/radeon_vtxfmt_c.c
===================================================================
RCS file: /cvsroot/dri/xc/xc/lib/GL/mesa/src/drv/radeon/radeon_vtxfmt_c.c,v
retrieving revision 1.3
diff -p -u -r1.3 radeon_vtxfmt_c.c
--- lib/GL/mesa/src/drv/radeon/radeon_vtxfmt_c.c	18 Jun 2002 22:40:26 -0000	1.3
+++ lib/GL/mesa/src/drv/radeon/radeon_vtxfmt_c.c	18 Oct 2002 00:35:21 -0000
@@ -392,29 +392,25 @@ static void radeon_Normal3fv( const GLfl
 static void radeon_TexCoord1f( GLfloat s )
 {
    GLfloat *dest = vb.texcoordptr[0];
-   dest[0] = s;
+   dest[0] = (s == INFINITY) ? 1.0 : (s == -INFINITY) ? -1.0 : s;
    dest[1] = 0;
 }
 
 static void radeon_TexCoord1fv( const GLfloat *v )
 {
-   GLfloat *dest = vb.texcoordptr[0];
-   dest[0] = v[0];
-   dest[1] = 0;
+   radeon_TexCoord1f( v[0] );
 }
 
 static void radeon_TexCoord2f( GLfloat s, GLfloat t )
 {
    GLfloat *dest = vb.texcoordptr[0];
-   dest[0] = s;
-   dest[1] = t;
+   dest[0] = (s == INFINITY) ? 1.0 : (s == -INFINITY) ? -1.0 : s;
+   dest[1] = (t == INFINITY) ? 1.0 : (t == -INFINITY) ? -1.0 : t;
 }
 
 static void radeon_TexCoord2fv( const GLfloat *v )
 {
-   GLfloat *dest = vb.texcoordptr[0];
-   dest[0] = v[0];
-   dest[1] = v[1];
+   radeon_TexCoord2f( v[0], v[1] );
 }
 
 
@@ -423,29 +419,25 @@ static void radeon_TexCoord2fv( const GL
 static void radeon_MultiTexCoord1fARB( GLenum target, GLfloat s  )
 {
    GLfloat *dest = vb.texcoordptr[(target - GL_TEXTURE0_ARB)&1];
-   dest[0] = s;
+   dest[0] = (s == INFINITY) ? 1.0 : (s == -INFINITY) ? -1.0 : s;
    dest[1] = 0;
 }
 
 static void radeon_MultiTexCoord1fvARB( GLenum target, const GLfloat *v )
 {
-   GLfloat *dest = vb.texcoordptr[(target - GL_TEXTURE0_ARB)&1];
-   dest[0] = v[0];
-   dest[1] = 0;
+   radeon_MultiTexCoord1fARB( target, v[0] );
 }
 
 static void radeon_MultiTexCoord2fARB( GLenum target, GLfloat s, GLfloat t )
 {
    GLfloat *dest = vb.texcoordptr[(target - GL_TEXTURE0_ARB)&1];
-   dest[0] = s;
-   dest[1] = t;
+   dest[0] = (s == INFINITY) ? 1.0 : (s == -INFINITY) ? -1.0 : s;
+   dest[1] = (t == INFINITY) ? 1.0 : (t == -INFINITY) ? -1.0 : t;
 }
 
 static void radeon_MultiTexCoord2fvARB( GLenum target, const GLfloat *v )
 {
-   GLfloat *dest = vb.texcoordptr[(target - GL_TEXTURE0_ARB)&1];
-   dest[0] = v[0];
-   dest[1] = v[1];
+   radeon_MultiTexCoord2fARB( target, v[0], v[1] );
 }
 
 static struct dynfn *lookup( struct dynfn *l, int key )
Index: lib/GL/mesa/src/drv/radeon/radeon_state.c
===================================================================
RCS file: /cvsroot/dri/xc/xc/lib/GL/mesa/src/drv/radeon/radeon_state.c,v
retrieving revision 1.18
diff -p -u -r1.18 radeon_state.c
--- lib/GL/mesa/src/drv/radeon/radeon_state.c	25 Aug 2002 22:24:39 -0000	1.18
+++ lib/GL/mesa/src/drv/radeon/radeon_state.c	18 Oct 2002 00:37:01 -0000
@@ -464,9 +464,9 @@ static void radeonUpdateScissor( GLconte
 
       rmesa->state.scissor.rect.x1 = x + dPriv->x;
       rmesa->state.scissor.rect.y1 = y + dPriv->y;
-      rmesa->state.scissor.rect.x2 = w + dPriv->x + 1;
-      rmesa->state.scissor.rect.y2 = h + dPriv->y + 1;
-
+      rmesa->state.scissor.rect.x2 = w + dPriv->x;
+      rmesa->state.scissor.rect.y2 = h + dPriv->y;
+      fprintf(stderr, "%s: (%d,%d) - (%d,%d)\n", __FUNCTION__, rmesa->state.scissor.rect.x1, rmesa->state.scissor.rect.y1, rmesa->state.scissor.rect.x2, rmesa->state.scissor.rect.y2);
       radeonRecalcScissorRects( rmesa );
    }
 }
@@ -885,7 +885,7 @@ void radeonUpdateMaterial( GLcontext *ct
    GLuint mask = ~0;
    
    if (ctx->Light.ColorMaterialEnabled)
-      mask &= ~ctx->Light.ColorMaterialBitmask;
+      mask &= ctx->Light.ColorMaterialBitmask;
 
    if (RADEON_DEBUG & DEBUG_STATE)
       fprintf(stderr, "%s\n", __FUNCTION__);
@@ -1357,6 +1357,7 @@ static void radeonClearStencil( GLcontex
  * To correctly position primitives:
  */
 #define SUBPIXEL_X 0.125
+#define SUBPIXEL_Y 0.125
 
 void radeonUpdateWindow( GLcontext *ctx )
 {
@@ -1369,10 +1370,10 @@ void radeonUpdateWindow( GLcontext *ctx 
    GLfloat sx = v[MAT_SX];
    GLfloat tx = v[MAT_TX] + xoffset + SUBPIXEL_X;
    GLfloat sy = - v[MAT_SY];
-   GLfloat ty = (- v[MAT_TY]) + yoffset;
+   GLfloat ty = (- v[MAT_TY]) + yoffset + SUBPIXEL_X;
    GLfloat sz = v[MAT_SZ] * rmesa->state.depth.scale;
    GLfloat tz = v[MAT_TZ] * rmesa->state.depth.scale;
-
+   fprintf(stderr, "%s: sx=%f, tx=%f, sy=%f, ty=%f\n", __FUNCTION__, sx, tx, sy, ty);
    RADEON_FIREVERTICES( rmesa );
    RADEON_STATECHANGE( rmesa, vpt );
 

Reply via email to