Bug 13578

Summary: incorrect glClear with ati driver
Product: Mesa Reporter: Yaniv Kamay <kpub>
Component: Drivers/DRI/r300Assignee: Default DRI bug account <dri-devel>
Status: RESOLVED INVALID QA Contact:
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: x86-64 (AMD64)   
OS: All   
Whiteboard:
i915 platform: i915 features:

Description Yaniv Kamay 2007-12-09 15:08:01 UTC
01:00.0 VGA compatible controller: ATI Technologies Inc RV350 AP [Radeon 9600]
mesa 7.0.1
xorg-ati 1:6.7.195
xorg 1:7.2


glClear ignore stencil mask while using xorg-ati driver (works fine with fglrx).
gl specifically state that:
            "The pixel ownership test, the scissor test,
            dithering, and the buffer writemasks affect the operation of glClear".


the following example demonstrate the problem. the expected rendering result is the intersection of the
first two rectangles. with ati driver nothing gets rendered.

void draw(void)
{
    glStencilMask(0xff);
    glClear(GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
    
    glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
    
    glStencilFunc(GL_ALWAYS, 0x01, 0x01);
    glStencilOp(GL_REPLACE, GL_REPLACE, GL_REPLACE);
    glBegin(GL_POLYGON);
        glVertex2f(0, 0);
        glVertex2f(0, 100);
        glVertex2f(100, 100);
        glVertex2f(100, 0);
    glEnd();
    
    glStencilFunc(GL_ALWAYS, 0x01, 0x01);
    glStencilOp(GL_INCR, GL_INCR, GL_INCR);
    glBegin(GL_POLYGON);
        glVertex2f(50, 50);
        glVertex2f(50, 150);
        glVertex2f(150, 150);
        glVertex2f(150, 50);
    glEnd();
    
    glStencilMask(0x1);
    glClear(GL_STENCIL_BUFFER_BIT);
    
    glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
    glStencilFunc(GL_EQUAL, 0x02, 0x02);
    glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
    glColor3f(1, 0, 0);
    glBegin(GL_POLYGON);
        glVertex2f(0, 0);
        glVertex2f(0, 1000);
        glVertex2f(1000, 1000);
        glVertex2f(1000, 0);
    glEnd();
    
    glFlush();
}

static void init(int width, int height)
{
    glViewport(0, 0, width, height);
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    glOrtho(0, width, 0, height, -1, 1);
    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();
    glClearColor(0, 0, 0, 0);
    glClearStencil(0);
    glEnable(GL_STENCIL_TEST);
    glStencilFunc(GL_ALWAYS, 0, 0);
    glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
}
Comment 1 Maciej Cencora 2009-09-19 03:01:54 UTC
Can you reproduce this bug with current mesa version from git?
Comment 2 Maciej Cencora 2009-12-19 07:45:33 UTC
Closing due to lack of user feedback.

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.