[Bug 18993] Shadows and selection circles z-fight in World of Warcraft

wine-bugs at winehq.org wine-bugs at winehq.org
Fri Dec 25 03:11:02 CST 2009


http://bugs.winehq.org/show_bug.cgi?id=18993


Dorek Biglari <dbiglari at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dbiglari at gmail.com




--- Comment #2 from Dorek Biglari <dbiglari at gmail.com>  2009-12-25 03:11:01 ---
The problem is due to the undocumented (or rather incorrectly documented)
depthbias feature in direct3d. This site http://aras-p.info/blog/tags/d3d/
explains the differences between resolving z-fighting conflicts in direct3d and
opengl.  The place we need to apply the patch is in dlls/wined3d/state.c, in
the state_depthbias function on the line with the call to glPolygonOffset. 
Basically, you need to make the number that d3d is sending to opengl larger. 
This works on my configuration (NVidia 6xxx, 24 bit depth buffer, which I think
is pretty common):

static void state_depthbias(DWORD state, IWineD3DStateBlockImpl *stateblock,
struct wined3d_context *context)
{
    union {
        DWORD d;
        float f;
    } tmpvalue;

    if(stateblock->renderState[WINED3DRS_SLOPESCALEDEPTHBIAS] ||
       stateblock->renderState[WINED3DRS_DEPTHBIAS]) {
        tmpvalue.d = stateblock->renderState[WINED3DRS_SLOPESCALEDEPTHBIAS];
        glEnable(GL_POLYGON_OFFSET_FILL);
        checkGLcall("glEnable(GL_POLYGON_OFFSET_FILL)");
        glPolygonOffset(tmpvalue.f/(2.0*4.8e-7),
(*((float*)&stateblock->renderState[WINED3DRS_DEPTHBIAS]))/(2.0*4.8e-7));  /*
Changed to fix z-fighting in WoW */
        checkGLcall("glPolygonOffset(...)");
    } else {
        glDisable(GL_POLYGON_OFFSET_FILL);
        checkGLcall("glDisable(GL_POLYGON_OFFSET_FILL)");
    }
}

I don't know what the proper procedure is for submitting this, hopefully
somebody will see it.  I'm currently using it and it works great.  It may need
to be tweaked with a different number for 16 bit depth buffers.  This is my
first comment here as I usually have just been a wine user, and just decided to
start getting into the code.  Let me know if this works for anyone else.

-- 
Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email
Do not reply to this email, post in Bugzilla using the
above URL to reply.
------- You are receiving this mail because: -------
You are watching all bug changes.



More information about the wine-bugs mailing list