Bug 7790

Summary: Polygons incorrectly clipped by mach64 driver (ATI Rage Pro LT card)
Product: Mesa Reporter: Dmitry 'RCL' Rekman <rcl>
Component: Drivers/DRI/Mach64Assignee: Default DRI bug account <dri-devel>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: high CC: fufutos610
Version: git   
Hardware: x86 (IA32)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: un-break strict-aliasing rules
use union's instead of memcpy's

Description Dmitry 'RCL' Rekman 2006-08-06 17:58:59 UTC
Partially offscreen polygons are rendered incorrectly. Visible part of them is
misplaced and texture coordinates are sometimes set to random values. Problem
appears only when clipping to viewport, polygons that are fully located inside
the viewport are rendered correctly.

Here's what glxinfo says about renderer:

OpenGL vendor string: Gareth Hughes, Leif Delgass, José Fonseca
OpenGL renderer string: Mesa DRI Mach64 [Rage Pro] 20051019 AGP 2x
OpenGL version string: 1.2 Mesa 6.4.2

I'm not the sole "victim", the same problem with Mach64 driver (on another card)
is described by another user here (you can get some screenshots there):
http://www.linuxquestions.org/questions/showthread.php?p=2368337

I'm attaching code that reproduces the problem with clipping.

---------------------8< cut here 8<----------------------------------

#include <GL/glut.h>

void display(void)
{
        glClearColor( 0.0, 0.0, 1.0, 0.0 );
        glClear( GL_COLOR_BUFFER_BIT );

        /* The white triangle is located inside the viewport
         and is rendered correctly */
        glColor3f( 1.0f, 1.0f, 1.0f );
        glBegin( GL_TRIANGLES );

        glVertex2f( 0.25f, 0.25f );
        glVertex2f( 0.75f, 0.25f );
        glVertex2f( 0.5f, 0.85f );

        glEnd();

        /* The red triangle is partially offscreen and various clipping
         artefacts occur during render.
           When rendered correctly, the red triangle should look the
         same as white one, just translated to the left */
        glColor3f( 1.0f, 0.0f, 0.0f );
        glBegin( GL_TRIANGLES );

        glVertex2f( -0.15f, 0.25f );
        glVertex2f( 0.35f, 0.25f );
        glVertex2f( 0.1f, 0.85f );

        glEnd();

        glutSwapBuffers();
};

int main(int argc, char **argv)
{
        glutInit( &argc, argv );
        glutInitDisplayMode( GLUT_DOUBLE | GLUT_RGBA );
        glutInitWindowSize( 640, 480 );
        glutCreateWindow( "ATI Mach64 driver bug?" );

        gluOrtho2D( 0, 1, 0, 1 );

        glutDisplayFunc( display );
        glutMainLoop();

        return 0;
}
Comment 1 George - 2006-10-20 15:44:00 UTC
Created attachment 7478 [details] [review]
un-break strict-aliasing rules

Does this help?
Comment 2 George - 2006-10-26 06:44:03 UTC
Created attachment 7530 [details] [review]
use union's instead of memcpy's
Comment 3 George - 2006-12-12 02:56:07 UTC
commited (eed1a6de4b396ed6305cf34812a269c10c746d3c)
Comment 4 Adam Jackson 2009-08-24 12:24:03 UTC
Mass version move, cvs -> git

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.