[dx84] Misc fixes

Jason Edmeades us at the-edmeades.demon.co.uk
Thu Oct 2 15:43:39 CDT 2003


Just some tidy up for problems people have either pointed out to me or I 
have spotted while fixing something else, plus some cleanup/trace changes

Changelog

Minor fixes - Remove light debug statements, handle disabled specular 
material properly, release surfaces when debugging and clean up trace a 
little

Jason

-------------- next part --------------
Index: dlls/d3d8/device.c
===================================================================
RCS file: /home/wine/wine/dlls/d3d8/device.c,v
retrieving revision 1.83
diff -u -r1.83 device.c
--- dlls/d3d8/device.c	30 Sep 2003 00:21:07 -0000	1.83
+++ dlls/d3d8/device.c	2 Oct 2003 20:29:39 -0000
@@ -1659,6 +1659,10 @@
     if (This->StateBlock->renderstate[D3DRS_SPECULARENABLE]) {
        glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, (float*) &This->UpdateStateBlock->material.Specular);
        checkGLcall("glMaterialfv");
+    } else {
+       float black[4] = {0.0f, 0.0f, 0.0f, 0.0f};
+       glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, &black[0]);
+       checkGLcall("glMaterialfv");
     }
     glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, (float*) &This->UpdateStateBlock->material.Emissive);
     checkGLcall("glMaterialfv");
@@ -1829,8 +1833,6 @@
     if (object->glIndex != -1) {
         setup_light(iface, object->glIndex, object);
     }
-    DUMP_LIGHT_CHAIN();
-
     return D3D_OK;
 }
 HRESULT  WINAPI  IDirect3DDevice8Impl_GetLight(LPDIRECT3DDEVICE8 iface, DWORD Index,D3DLIGHT8* pLight) {
@@ -1886,7 +1888,7 @@
         D3DLIGHT8 lightParms;
         /* Warning - untested code :-) Prob safe to change fixme to a trace but
              wait until someone confirms it seems to work!                     */
-        FIXME("Light enabled requested but light not defined, so defining one!\n"); 
+        TRACE("Light enabled requested but light not defined, so defining one!\n"); 
         lightParms.Type = D3DLIGHT_DIRECTIONAL;
         lightParms.Diffuse.r = 1.0;
         lightParms.Diffuse.g = 1.0;
@@ -2074,7 +2076,6 @@
             }
         }
     }
-    DUMP_LIGHT_CHAIN();
     return D3D_OK;
 }
 HRESULT  WINAPI  IDirect3DDevice8Impl_GetLightEnable(LPDIRECT3DDEVICE8 iface, DWORD Index,BOOL* pEnable) {
Index: dlls/d3d8/drawprim.c
===================================================================
RCS file: /home/wine/wine/dlls/d3d8/drawprim.c,v
retrieving revision 1.11
diff -u -r1.11 drawprim.c
--- dlls/d3d8/drawprim.c	25 Sep 2003 20:22:21 -0000	1.11
+++ dlls/d3d8/drawprim.c	2 Oct 2003 20:29:48 -0000
@@ -203,8 +203,14 @@
         checkGLcall("glMaterialfv");
         glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, (float*) &This->StateBlock->material.Diffuse);
         checkGLcall("glMaterialfv");
-        glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, (float*) &This->StateBlock->material.Specular);
-        checkGLcall("glMaterialfv");
+        if (This->StateBlock->renderstate[D3DRS_SPECULARENABLE]) {
+           glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, (float*) &This->StateBlock->material.Specular);
+           checkGLcall("glMaterialfv");
+        } else {
+           float black[4] = {0.0f, 0.0f, 0.0f, 0.0f};
+           glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, &black[0]);
+           checkGLcall("glMaterialfv");
+        }
         glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, (float*) &This->StateBlock->material.Emissive);
         checkGLcall("glMaterialfv");
     }
@@ -1478,9 +1484,10 @@
             for (textureNo = 0; textureNo < GL_LIMITS(textures); ++textureNo) {
                 if (This->StateBlock->textures[textureNo] != NULL) {
                     sprintf(buffer, "/tmp/texture_%ld_%d.ppm", primCounter, textureNo);
-                    TRACE("Saving texture %s\n", buffer);
+                    TRACE("Saving texture %s (Format:%s)\n", buffer, debug_d3dformat(((IDirect3DBaseTexture8Impl *)This->StateBlock->textures[textureNo])->format));
                     IDirect3DTexture8Impl_GetSurfaceLevel((LPDIRECT3DTEXTURE8) This->StateBlock->textures[textureNo], 0, &pSur);
                     IDirect3DSurface8Impl_SaveSnapshot(pSur, buffer);
+                    IDirect3DSurface8Impl_ReleaseRef(pSur);
                 }
             }
            }


More information about the wine-patches mailing list