Keith Whitwell wrote:
A while ago, Mesa started using the full width of variables like Stencil.WriteMask, etc. to store values, while previously it had restricted itself to only the low 8 bits.

Unfortunately there are many cases in the dri drivers that assumed the old behaviour, and did things like comparisons:

    if (ctx->Stencil.WriteMask[0] == 0xff)

and also building hardware commands:

    OUT_BATCH( SOME_COMMAND_TAG |
           ctx->Stencil.WriteMask[0] |
           SOME_OTHER_STUFF )

This was the cause of the recent i915 performance regression. The change seems to have been noticed and local fixes for the change are sprinkled through the drivers, but the attached patch is the first attempt to look at all cases throughout the drivers where this may have had an effect.

I'm travelling at the moment, and can't test the changes even on the hardware I have. Hopefully people can do a little testing in the meantime, I expect I'll commit this on Monday.

Some background on this: The OpenGL spec isn't totally clear on what the initial value for the write mask should be. It just says: 1's

We (and other OpenGL implementors) had assumed the value should be 0xff for 8-bit stencil buffers.

That was OK prior to GL_EXT_framebuffer_object. With that extension it's possible for a rendering context to use a number of stencil renderbuffers of different depths. So 0xff was an incorrect assumption.

After some discussion among the ARB members we determined the default value should be ~0 (typically 32 bits). When we use this value now we just grab the lowest N bits of the write mask if we have an N-bit stencil buffer.

Since the DRI drivers use 8-bit stencil, the tests for

        if (ctx->Stencil.WriteMask[0] == 0xff)

should probably be:

        if ((ctx->Stencil.WriteMask[0] & 0xff) == 0xff)

-Brian


-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Mesa3d-dev mailing list
Mesa3d-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev

Reply via email to