Ivan Gyurdiev : wined3d: Fix light state bugs.

Alexandre Julliard julliard at wine.codeweavers.com
Fri Jul 14 10:50:35 CDT 2006


Module: wine
Branch: refs/heads/master
Commit: 07eb6531a3de7291ce319a06fec131c428376238
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=07eb6531a3de7291ce319a06fec131c428376238

Author: Ivan Gyurdiev <ivg231 at gmail.com>
Date:   Thu Jul 13 18:17:55 2006 -0600

wined3d: Fix light state bugs.

---

 dlls/wined3d/device.c |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 082f92b..630d6d4 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -2832,6 +2832,10 @@ static HRESULT WINAPI IWineD3DDeviceImpl
     IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
     TRACE("(%p) : Idx(%ld), enable? %d\n", This, Index, Enable);
 
+    /* Tests show true = 128...not clear why */
+
+    Enable = Enable? 128: 0;
+
     /* If recording state block, just add to end of lights chain with changedEnable set to true */
     if (This->isRecordingState) {
         lightInfo = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(PLIGHTINFOEL));
@@ -2841,6 +2845,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl
         lightInfo->OriginalIndex = Index;
         lightInfo->glIndex = -1;
         lightInfo->enabledChanged = TRUE;
+        lightInfo->lightEnabled = Enable;
 
         /* Add to the END of the chain of lights changes to be replayed */
         if (This->updateStateBlock->lights == NULL) {
@@ -2887,7 +2892,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl
         } else {
             TRACE("Nothing to do as light was not enabled\n");
         }
-        lightInfo->lightEnabled = FALSE;
+        lightInfo->lightEnabled = Enable;
     } else {
 
         /* We are enabling it. If it is enabled, it's really simple */
@@ -2898,7 +2903,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl
         /* If it already has a glIndex, it's still simple */
         } else if (lightInfo->glIndex != -1) {
             TRACE("Reusing light as already set up at gl idx %ld\n", lightInfo->glIndex);
-            lightInfo->lightEnabled = TRUE;
+            lightInfo->lightEnabled = Enable;
             ENTER_GL();
             glEnable(GL_LIGHT0 + lightInfo->glIndex);
             checkGLcall("glEnable GL_LIGHT0+Index already setup");
@@ -2969,7 +2974,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl
                 glIndex = bsf->glIndex;
                 bsf->glIndex = -1;
                 lightInfo->glIndex = glIndex;
-                lightInfo->lightEnabled = TRUE;
+                lightInfo->lightEnabled = Enable;
 
                 /* Finally set up the light in gl itself */
                 TRACE("Replacing light which was set up at gl idx %ld\n", lightInfo->glIndex);
@@ -2987,7 +2992,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl
                     know the index of the next one!                          */
                 glIndex = Index;
                 lightInfo->glIndex = glIndex;
-                lightInfo->lightEnabled = TRUE;
+                lightInfo->lightEnabled = Enable;
 
                 /* In an ideal world, it's already in the right place */
                 if (lightInfo->prev == NULL || lightInfo->prev->glIndex!=-1) {




More information about the wine-cvs mailing list