[dx8-18] Warcraft3 working ...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi all,

  I just seen that alexandre has comitted my d3d8-17 patch :)

  Now the good news: 
  - with this patch Warcraft3 is working well now (only minors dinput problems 
remains) ;)
  - Max Payne begin to launch (it crash after)
  - more d3d samples works

Changelog:
 - Surface pool init fixes
 - minor indent and traces fixes
 - fix locking/unlocking/dirty behavior (dirtify on lock) + optimisations 
(only copy when dirty)
 - fix IDirect3DDevice8::Clear behavior (problem seen after an 
locking/unlocking code error)
 - begin to fix volume and cube textures management

Todo:
 - split traces into many debug channels (we have too many traces)
 - understand cube textures 
 - fixing vertex shaders
 - beginning of split into d3d8/d3dcore
 - HW vertex shaders
 - HW rendering surface / swapchain support (on d3dcore with GLX 1.3 support)

Regards,
Raphael
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQE+vjEep7NA3AmQTU4RAk2vAJ40zL4bu68Dp+SBJi7/rePXQAwmfQCfV6aV
E9+obOj7OxIauFrvItZVMrM=
=hbUI
-----END PGP SIGNATURE-----
? d3d8_18.patch.tgz
Index: cubetexture.c
===================================================================
RCS file: /home/wine/wine/dlls/d3d8/cubetexture.c,v
retrieving revision 1.4
diff -u -r1.4 cubetexture.c
--- cubetexture.c	12 Apr 2003 00:06:43 -0000	1.4
+++ cubetexture.c	11 May 2003 10:44:06 -0000
@@ -86,23 +86,28 @@
 }
 HRESULT  WINAPI        IDirect3DCubeTexture8Impl_SetPrivateData(LPDIRECT3DCUBETEXTURE8 iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) {
     ICOM_THIS(IDirect3DCubeTexture8Impl,iface);
-    FIXME("(%p) : stub\n", This);    return D3D_OK;
+    FIXME("(%p) : stub\n", This);    
+    return D3D_OK;
 }
 HRESULT  WINAPI        IDirect3DCubeTexture8Impl_GetPrivateData(LPDIRECT3DCUBETEXTURE8 iface, REFGUID refguid, void* pData, DWORD* pSizeOfData) {
     ICOM_THIS(IDirect3DCubeTexture8Impl,iface);
-    FIXME("(%p) : stub\n", This);    return D3D_OK;
+    FIXME("(%p) : stub\n", This);    
+    return D3D_OK;
 }
 HRESULT  WINAPI        IDirect3DCubeTexture8Impl_FreePrivateData(LPDIRECT3DCUBETEXTURE8 iface, REFGUID refguid) {
     ICOM_THIS(IDirect3DCubeTexture8Impl,iface);
-    FIXME("(%p) : stub\n", This);    return D3D_OK;
+    FIXME("(%p) : stub\n", This);    
+    return D3D_OK;
 }
 DWORD    WINAPI        IDirect3DCubeTexture8Impl_SetPriority(LPDIRECT3DCUBETEXTURE8 iface, DWORD PriorityNew) {
     ICOM_THIS(IDirect3DCubeTexture8Impl,iface);
-    FIXME("(%p) : stub\n", This);    return D3D_OK;
+    FIXME("(%p) : stub\n", This);    
+    return D3D_OK;
 }
 DWORD    WINAPI        IDirect3DCubeTexture8Impl_GetPriority(LPDIRECT3DCUBETEXTURE8 iface) {
     ICOM_THIS(IDirect3DCubeTexture8Impl,iface);
-    FIXME("(%p) : stub\n", This);    return D3D_OK;
+    FIXME("(%p) : stub\n", This);    
+    return D3D_OK;
 }
 void     WINAPI        IDirect3DCubeTexture8Impl_PreLoad(LPDIRECT3DCUBETEXTURE8 iface) {
     ICOM_THIS(IDirect3DCubeTexture8Impl,iface);
@@ -134,36 +139,62 @@
 }
 
 /* IDirect3DCubeTexture8 */
-HRESULT  WINAPI        IDirect3DCubeTexture8Impl_GetLevelDesc(LPDIRECT3DCUBETEXTURE8 iface,UINT Level,D3DSURFACE_DESC *pDesc) {
+HRESULT  WINAPI        IDirect3DCubeTexture8Impl_GetLevelDesc(LPDIRECT3DCUBETEXTURE8 iface, UINT Level, D3DSURFACE_DESC* pDesc) {
     ICOM_THIS(IDirect3DCubeTexture8Impl,iface);
     if (Level < This->levels) {
-        TRACE("(%p) Level (%d)\n", This, Level);
-        return IDirect3DSurface8Impl_GetDesc((LPDIRECT3DSURFACE8)This->surfaces[Level], pDesc);
+        TRACE("(%p) level (%d)\n", This, Level);
+        return IDirect3DSurface8Impl_GetDesc((LPDIRECT3DSURFACE8) This->surfaces[Level], pDesc);
     } else {
-        FIXME("(%p) Level (%d)\n", This, Level);
+        FIXME("(%p) level(%d) overflow Levels(%d)\n", This, Level, This->levels);
+        return D3DERR_INVALIDCALL;
     }
     return D3D_OK;
 }
-HRESULT  WINAPI        IDirect3DCubeTexture8Impl_GetCubeMapSurface(LPDIRECT3DCUBETEXTURE8 iface,D3DCUBEMAP_FACES FaceType,UINT Level,IDirect3DSurface8** ppCubeMapSurface) {
+HRESULT  WINAPI        IDirect3DCubeTexture8Impl_GetCubeMapSurface(LPDIRECT3DCUBETEXTURE8 iface, D3DCUBEMAP_FACES FaceType, UINT Level, IDirect3DSurface8** ppCubeMapSurface) {
     ICOM_THIS(IDirect3DCubeTexture8Impl,iface);
-    TRACE("(%p) : returning %p\n", This, This->surfaces[FaceType][Level]);
-    *ppCubeMapSurface = (LPDIRECT3DSURFACE8) This->surfaces[FaceType][Level];
-    IDirect3DSurface8Impl_AddRef((LPDIRECT3DSURFACE8)This->surfaces[FaceType][Level]);
+    if (Level < This->levels) {
+        *ppCubeMapSurface = (LPDIRECT3DSURFACE8) This->surfaces[FaceType][Level];
+        IDirect3DSurface8Impl_AddRef((LPDIRECT3DSURFACE8) *ppCubeMapSurface);
+	TRACE("(%p) -> faceType(%d) level(%d) returning surface@%p \n", This, FaceType, Level, This->surfaces[FaceType][Level]);
+    } else {
+        FIXME("(%p) level(%d) overflow Levels(%d)\n", This, Level, This->levels);
+        return D3DERR_INVALIDCALL;
+    }
     return D3D_OK;
 }
-HRESULT  WINAPI        IDirect3DCubeTexture8Impl_LockRect(LPDIRECT3DCUBETEXTURE8 iface,D3DCUBEMAP_FACES FaceType,UINT Level,D3DLOCKED_RECT* pLockedRect,CONST RECT* pRect,DWORD Flags) {
+HRESULT  WINAPI        IDirect3DCubeTexture8Impl_LockRect(LPDIRECT3DCUBETEXTURE8 iface, D3DCUBEMAP_FACES FaceType, UINT Level, D3DLOCKED_RECT* pLockedRect, CONST RECT* pRect, DWORD Flags) {
+    HRESULT hr;
     ICOM_THIS(IDirect3DCubeTexture8Impl,iface);
-    FIXME("(%p) : stub\n", This);    return D3D_OK;
+    if (Level < This->levels) {
+      /**
+       * Not dirtified while Surfaces don't notify dirtification
+       * This->Dirty = TRUE;
+       */
+      hr = IDirect3DSurface8_LockRect((LPDIRECT3DSURFACE8) This->surfaces[FaceType][Level], pLockedRect, pRect, Flags);
+      TRACE("(%p) -> faceType(%d) level(%d) returning memory@%p success(%lu)\n", This, FaceType, Level, pLockedRect->pBits, hr);
+    } else {
+      FIXME("(%p) level(%d) overflow Levels(%d)\n", This, Level, This->levels);
+      return D3DERR_INVALIDCALL;
+    }
+    return hr;
 }
-HRESULT  WINAPI        IDirect3DCubeTexture8Impl_UnlockRect(LPDIRECT3DCUBETEXTURE8 iface,D3DCUBEMAP_FACES FaceType,UINT Level) {
+HRESULT  WINAPI        IDirect3DCubeTexture8Impl_UnlockRect(LPDIRECT3DCUBETEXTURE8 iface, D3DCUBEMAP_FACES FaceType, UINT Level) {
+    HRESULT hr;
     ICOM_THIS(IDirect3DCubeTexture8Impl,iface);
-    This->Dirty = TRUE;
-    FIXME("(%p) : stub\n", This);    return D3D_OK;
+    if (Level < This->levels) {
+      hr = IDirect3DSurface8_UnlockRect((LPDIRECT3DSURFACE8) This->surfaces[FaceType][Level]);
+      FIXME("(%p) -> faceType(%d) level(%d) success(%lu)\n", This, FaceType, Level, hr);
+    } else {
+      FIXME("(%p) level(%d) overflow Levels(%d)\n", This, Level, This->levels);
+      return D3DERR_INVALIDCALL;
+    }
+    return hr;
 }
-HRESULT  WINAPI        IDirect3DCubeTexture8Impl_AddDirtyRect(LPDIRECT3DCUBETEXTURE8 iface,D3DCUBEMAP_FACES FaceType,CONST RECT* pDirtyRect) {
+HRESULT  WINAPI        IDirect3DCubeTexture8Impl_AddDirtyRect(LPDIRECT3DCUBETEXTURE8 iface, D3DCUBEMAP_FACES FaceType, CONST RECT* pDirtyRect) {
     ICOM_THIS(IDirect3DCubeTexture8Impl,iface);
     This->Dirty = TRUE;
-    FIXME("(%p) : stub\n", This);    return D3D_OK;
+    FIXME("(%p) : stub\n", This);
+    return D3D_OK;
 }
 
 
Index: d3d8_private.h
===================================================================
RCS file: /home/wine/wine/dlls/d3d8/d3d8_private.h,v
retrieving revision 1.24
diff -u -r1.24 d3d8_private.h
--- d3d8_private.h	11 May 2003 03:35:27 -0000	1.24
+++ d3d8_private.h	11 May 2003 10:44:10 -0000
@@ -455,10 +455,13 @@
     DWORD                   ref;
 
     /* IDirect3DSwapChain8 fields */
+    IDirect3DSurface8Impl  *frontBuffer;
+    IDirect3DSurface8Impl  *backBuffer;
+    D3DPRESENT_PARAMETERS   PresentParms;
 };
 
 /* IUnknown: */
-extern HRESULT WINAPI IDirect3DSwapChain8Impl_QueryInterface(LPDIRECT3DSWAPCHAIN8 iface,REFIID refiid,LPVOID *obj);
+extern HRESULT WINAPI IDirect3DSwapChain8Impl_QueryInterface(LPDIRECT3DSWAPCHAIN8 iface, REFIID refiid, LPVOID *obj);
 extern ULONG WINAPI   IDirect3DSwapChain8Impl_AddRef(LPDIRECT3DSWAPCHAIN8 iface);
 extern ULONG WINAPI   IDirect3DSwapChain8Impl_Release(LPDIRECT3DSWAPCHAIN8 iface);
 
@@ -497,6 +500,7 @@
     BOOL                    lockable;
     BOOL                    locked;
     RECT                    lockedRect;
+    BOOL                    Dirty;
 };
 
 /* IUnknown: */
@@ -669,6 +673,8 @@
     D3DRESOURCETYPE         ResourceType;
 
     /* IDirect3DBaseTexture8 fields */
+    BOOL                    Dirty;
+
     /*
      *BOOL                    isManaged;
      *DWORD                   lod;
@@ -718,6 +724,7 @@
     D3DRESOURCETYPE         ResourceType;
 
     /* IDirect3DBaseTexture8 fields */
+    BOOL                    Dirty;
 
     /* IDirect3DCubeTexture8 fields */
     UINT                    edgeLength;
@@ -726,7 +733,6 @@
     D3DFORMAT               format;
 
     IDirect3DSurface8Impl  *surfaces[6][MAX_LEVELS];
-    BOOL                    Dirty;
 };
 
 /* IUnknown: */
@@ -779,6 +785,7 @@
     D3DRESOURCETYPE         ResourceType;
 
     /* IDirect3DBaseTexture8 fields */
+    BOOL                    Dirty;
 
     /* IDirect3DTexture8 fields */
     UINT                    width;
@@ -787,9 +794,7 @@
     DWORD                   usage;
     D3DFORMAT               format;
 
-    IDirect3DDevice8Impl   *device;
     IDirect3DSurface8Impl  *surfaces[MAX_LEVELS];
-    BOOL                    Dirty;
 };
 
 /* IUnknown: */
@@ -842,6 +847,7 @@
     D3DRESOURCETYPE         ResourceType;
 
     /* IDirect3DBaseTexture8 fields */
+    BOOL                    Dirty;
 
     /* IDirect3DVolumeTexture8 fields */
     UINT                    width;
@@ -852,7 +858,6 @@
     D3DFORMAT               format;
 
     IDirect3DVolume8Impl   *volumes[MAX_LEVELS];
-    BOOL                    Dirty;
 };
 
 /* IUnknown: */
Index: device.c
===================================================================
RCS file: /home/wine/wine/dlls/d3d8/device.c,v
retrieving revision 1.48
diff -u -r1.48 device.c
--- device.c	11 May 2003 03:35:27 -0000	1.48
+++ device.c	11 May 2003 10:44:21 -0000
@@ -432,10 +432,15 @@
                                 }
                             }
                             break;
+			    
+			case D3DRTYPE_CUBETEXTURE:
+                            r = 0.0f; q = 0.0f; /* Avoid compiler warnings, need these vars later for other textures */
+                            FIXME("Unhandled texture type: D3DRTYPE_CUBETEXTURE\n");
+			    break;
 
                         default:
                             r = 0.0f; q = 0.0f; /* Avoid compiler warnings, need these vars later for other textures */
-                            FIXME("Unhandled texture type\n");
+                            FIXME("Unhandled texture type: %lu\n", IDirect3DBaseTexture8Impl_GetType((LPDIRECT3DBASETEXTURE8) This->StateBlock->textures[textureNo]));
                         }
                     } else {
                         /* Note I have seen a program actually do this, so just hide it and continue */
@@ -1247,8 +1252,8 @@
     TRACE("(%p) : BackBuf %d Type %d returning %p\n", This, BackBuffer, Type, *ppBackBuffer);
 
     if (BackBuffer > This->PresentParms.BackBufferCount - 1) {
-      FIXME("Only one backBuffer currently supported\n");
-      return D3DERR_INVALIDCALL;
+        FIXME("Only one backBuffer currently supported\n");
+        return D3DERR_INVALIDCALL;
     }
 
     /* Note inc ref on returned surface */
@@ -1282,7 +1287,8 @@
     TRACE("(%p) : W(%d) H(%d), Lvl(%d) Usage(%ld), Fmt(%d), Pool(%d)\n", This, Width, Height, Levels, Usage, Format, Pool);
     object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DTexture8Impl));
     object->lpVtbl = &Direct3DTexture8_Vtbl;
-    object->Device = This; /* FIXME: AddRef(This) */
+    object->Device = This;
+    /*IDirect3DDevice8Impl_AddRef((LPDIRECT3DDEVICE8) object->device);*/
     object->ResourceType = D3DRTYPE_TEXTURE;
     object->ref = 1;
     object->width = Width;
@@ -1290,8 +1296,7 @@
     object->levels = Levels;
     object->usage = Usage;
     object->format = Format;
-    object->device = This;
-    /*IDirect3DDevice8Impl_AddRef((LPDIRECT3DDEVICE8) object->device);*/
+
 
     /* Calculate levels for mip mapping */
     if (Levels == 0) {
@@ -1299,7 +1304,7 @@
         tmpW = Width;
         tmpH = Height;
         while (tmpW > 1 && tmpH > 1) {
-            tmpW = max(1,tmpW / 2);
+            tmpW = max(1, tmpW / 2);
             tmpH = max(1, tmpH / 2);
             object->levels++;
         }
@@ -1309,7 +1314,7 @@
     /* Generate all the surfaces */
     tmpW = Width;
     tmpH = Height;
-    for (i=0; i<object->levels; i++) 
+    for (i = 0; i < object->levels; i++) 
     {
         IDirect3DDevice8Impl_CreateImageSurface(iface, tmpW, tmpH, Format, (LPDIRECT3DSURFACE8*) &object->surfaces[i]);
         object->surfaces[i]->Container = (IUnknown*) object;
@@ -1322,7 +1327,7 @@
         tmpH = max(1, tmpH / 2);
     }
 
-    *ppTexture = (LPDIRECT3DTEXTURE8)object;
+    *ppTexture = (LPDIRECT3DTEXTURE8) object;
     return D3D_OK;
 }
 HRESULT  WINAPI  IDirect3DDevice8Impl_CreateVolumeTexture(LPDIRECT3DDEVICE8 iface, UINT Width,UINT Height,UINT Depth,UINT Levels,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DVolumeTexture8** ppVolumeTexture) {
@@ -1371,7 +1376,7 @@
     tmpH = Height;
     tmpD = Depth;
 
-    for (i = 0; i< object->levels; i++) 
+    for (i = 0; i < object->levels; i++) 
     {
         IDirect3DVolume8Impl *volume;
 
@@ -1387,13 +1392,13 @@
 	/*IUnknown_AddRef(volume->Container);*/	
         volume->ref = 1;
 
-        volume->myDesc.Width = Width;
-        volume->myDesc.Height= Height;
-        volume->myDesc.Depth = Depth;
-        volume->myDesc.Format= Format;
-        volume->myDesc.Type  = D3DRTYPE_VOLUME;
-        volume->myDesc.Pool  = Pool;
-        volume->myDesc.Usage = Usage;
+        volume->myDesc.Width  = Width;
+        volume->myDesc.Height = Height;
+        volume->myDesc.Depth  = Depth;
+        volume->myDesc.Format = Format;
+        volume->myDesc.Type   = D3DRTYPE_VOLUME;
+        volume->myDesc.Pool   = Pool;
+        volume->myDesc.Usage  = Usage;
         volume->bytesPerPixel   = bytesPerPixel(Format);
         volume->myDesc.Size     = (Width * volume->bytesPerPixel) * Height * Depth;
         volume->allocatedMemory = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, volume->myDesc.Size);
@@ -1401,15 +1406,15 @@
         TRACE("(%p) : Volume at w(%d) h(%d) d(%d) fmt(%d) surf@%p, surfmem@%p, %d bytes\n", This, Width, Height, Depth, Format, 
                   volume, volume->allocatedMemory, volume->myDesc.Size);
 
-        tmpW = max(1,tmpW / 2);
+        tmpW = max(1, tmpW / 2);
         tmpH = max(1, tmpH / 2);
         tmpD = max(1, tmpD / 2);
     }
 
-    *ppVolumeTexture = (LPDIRECT3DVOLUMETEXTURE8)object;
+    *ppVolumeTexture = (LPDIRECT3DVOLUMETEXTURE8) object;
     return D3D_OK;
 }
-HRESULT  WINAPI  IDirect3DDevice8Impl_CreateCubeTexture(LPDIRECT3DDEVICE8 iface, UINT EdgeLength,UINT Levels,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DCubeTexture8** ppCubeTexture) {
+HRESULT  WINAPI  IDirect3DDevice8Impl_CreateCubeTexture(LPDIRECT3DDEVICE8 iface, UINT EdgeLength, UINT Levels, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, IDirect3DCubeTexture8** ppCubeTexture) {
 
     IDirect3DCubeTexture8Impl *object;
     ICOM_THIS(IDirect3DDevice8Impl,iface);
@@ -1435,7 +1440,7 @@
         object->levels++;
         tmpW = EdgeLength;
         while (tmpW > 1) {
-            tmpW = max(1,tmpW / 2);
+            tmpW = max(1, tmpW / 2);
             object->levels++;
         }
         TRACE("Calculated levels = %d\n", object->levels);
@@ -1446,12 +1451,12 @@
     for (i = 0; i < object->levels; i++) 
     {
         /* Create the 6 faces */
-        for (j = 0;j < 6; j++) {
+        for (j = 0; j < 6; j++) {
            IDirect3DDevice8Impl_CreateImageSurface(iface, tmpW, tmpW, Format, (LPDIRECT3DSURFACE8*) &object->surfaces[j][i]);
            object->surfaces[j][i]->Container = (IUnknown*) object;
 	   /*IUnknown_AddRef(object->surfaces[j][i]->Container);*/
            object->surfaces[j][i]->myDesc.Usage = Usage;
-           object->surfaces[j][i]->myDesc.Pool = Pool ;
+           object->surfaces[j][i]->myDesc.Pool = Pool;
 
            TRACE("Created surface level %d @ %p, memory at %p\n", i, object->surfaces[j][i], object->surfaces[j][i]->allocatedMemory);
            tmpW = max(1, tmpW / 2);
@@ -1518,8 +1523,12 @@
     IDirect3DSurface8Impl *object;
 
     ICOM_THIS(IDirect3DDevice8Impl,iface);
-
+    
     object  = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DSurface8Impl));
+    if (NULL == object) {
+      *ppSurface = NULL;
+      return D3DERR_OUTOFVIDEOMEMORY;
+    }
     *ppSurface = (LPDIRECT3DSURFACE8) object;
     object->lpVtbl = &Direct3DSurface8_Vtbl;
     object->Device = This;
@@ -1534,7 +1543,7 @@
     object->myDesc.Format = Format;
     object->myDesc.Type = D3DRTYPE_SURFACE;
     object->myDesc.Usage = D3DUSAGE_RENDERTARGET;
-    object->myDesc.Pool = D3DPOOL_MANAGED;
+    object->myDesc.Pool = D3DPOOL_DEFAULT;
     object->myDesc.MultiSampleType = MultiSample;
     object->bytesPerPixel = bytesPerPixel(Format);
     object->myDesc.Size = (Width * object->bytesPerPixel) * Height;
@@ -1551,6 +1560,10 @@
     ICOM_THIS(IDirect3DDevice8Impl,iface);
 
     object  = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DSurface8Impl));
+    if (NULL == object) {
+      *ppSurface = NULL;
+      return D3DERR_OUTOFVIDEOMEMORY;
+    }
     *ppSurface = (LPDIRECT3DSURFACE8) object;
     object->lpVtbl = &Direct3DSurface8_Vtbl;
     object->Device = This;
@@ -1565,7 +1578,7 @@
     object->myDesc.Format = Format;
     object->myDesc.Type = D3DRTYPE_SURFACE;
     object->myDesc.Usage = D3DUSAGE_DEPTHSTENCIL;
-    object->myDesc.Pool = D3DPOOL_MANAGED;
+    object->myDesc.Pool = D3DPOOL_DEFAULT;
     object->myDesc.MultiSampleType = MultiSample;
     object->bytesPerPixel = bytesPerPixel(Format);
     object->myDesc.Size = (Width * object->bytesPerPixel) * Height;
@@ -1727,9 +1740,10 @@
 
     return D3D_OK;
 }
-HRESULT  WINAPI  IDirect3DDevice8Impl_UpdateTexture(LPDIRECT3DDEVICE8 iface, IDirect3DBaseTexture8* pSourceTexture,IDirect3DBaseTexture8* pDestinationTexture) {
+HRESULT  WINAPI  IDirect3DDevice8Impl_UpdateTexture(LPDIRECT3DDEVICE8 iface, IDirect3DBaseTexture8* pSourceTexture, IDirect3DBaseTexture8* pDestinationTexture) {
     ICOM_THIS(IDirect3DDevice8Impl,iface);
-    FIXME("(%p) : stub\n", This);    return D3D_OK;
+    FIXME("(%p) : stub\n", This);
+    return D3D_OK;
 }
 HRESULT  WINAPI  IDirect3DDevice8Impl_GetFrontBuffer(LPDIRECT3DDEVICE8 iface, IDirect3DSurface8* pDestSurface) {
     HRESULT hr;
@@ -1775,9 +1789,15 @@
     hr = IDirect3DSurface8Impl_UnlockRect(pDestSurface);
     return hr;
 }
-HRESULT  WINAPI  IDirect3DDevice8Impl_SetRenderTarget(LPDIRECT3DDEVICE8 iface, IDirect3DSurface8* pRenderTarget,IDirect3DSurface8* pNewZStencil) {
+HRESULT  WINAPI  IDirect3DDevice8Impl_SetRenderTarget(LPDIRECT3DDEVICE8 iface, IDirect3DSurface8* pRenderTarget, IDirect3DSurface8* pNewZStencil) {
     ICOM_THIS(IDirect3DDevice8Impl,iface);
-    FIXME("(%p) : invalid stub expect crash\n", This);
+
+    if ((IDirect3DSurface8Impl*) pRenderTarget == This->frontBuffer && (IDirect3DSurface8Impl*) pNewZStencil == This->depthStencilBuffer) {
+      TRACE("Trying to do a NOP SetRenderTarget operation\n");
+      return D3D_OK;
+    }
+    
+    FIXME("(%p) : invalid stub expect crash newRender@%p newZStencil@%p\n", This, pRenderTarget, pNewZStencil);
 
     return D3D_OK;
 }
@@ -1797,8 +1817,8 @@
     TRACE("(%p)->(%p)\n", This, ppZStencilSurface);
     
     /* Note inc ref on returned surface */
-    IDirect3DSurface8Impl_AddRef((LPDIRECT3DSURFACE8)This->depthStencilBuffer);
-    *ppZStencilSurface = (LPDIRECT3DSURFACE8)This->depthStencilBuffer;
+    *ppZStencilSurface = (LPDIRECT3DSURFACE8) This->depthStencilBuffer;
+    IDirect3DSurface8Impl_AddRef((LPDIRECT3DSURFACE8) *ppZStencilSurface);
 
     return D3D_OK;
 }
@@ -1831,6 +1851,11 @@
       render target does not have an attached depth buffer. Similarly, if you specify the D3DCLEAR_STENCIL flag
       when the depth-buffer format does not contain stencil buffer information, this method fails. */
     GLbitfield glMask = 0;
+    GLboolean old_ztest;
+    GLfloat old_z_clear_value;
+    GLint   old_stencil_clear_value;
+    GLfloat old_color_clear_value[4];
+
     int i;
     CONST D3DRECT   *curRect;
 
@@ -1858,13 +1883,17 @@
         }
 
         /* Clear the whole screen */
-        if (Flags & D3DCLEAR_STENCIL) {
+        if (Flags & D3DCLEAR_STENCIL) {	
+	    glGetIntegerv(GL_STENCIL_CLEAR_VALUE, &old_stencil_clear_value);
             glClearStencil(Stencil);
             checkGLcall("glClearStencil");
             glMask = glMask | GL_STENCIL_BUFFER_BIT;
         }
 
         if (Flags & D3DCLEAR_ZBUFFER) {
+	    glGetBooleanv(GL_DEPTH_WRITEMASK, &old_ztest);
+	    glDepthMask(GL_TRUE); 
+	    glGetFloatv(GL_DEPTH_CLEAR_VALUE, &old_z_clear_value);
             glClearDepth(Z);
             checkGLcall("glClearDepth");
             glMask = glMask | GL_DEPTH_BUFFER_BIT;
@@ -1872,8 +1901,11 @@
 
         if (Flags & D3DCLEAR_TARGET) {
             TRACE("Clearing screen with glClear to color %lx\n", Color);
-            glClearColor(((Color >> 16) & 0xFF) / 255.0, ((Color >>  8) & 0xFF) / 255.0,
-                         ((Color >>  0) & 0xFF) / 255.0, ((Color >> 24) & 0xFF) / 255.0);
+	    glGetFloatv(GL_COLOR_CLEAR_VALUE, old_color_clear_value);
+            glClearColor(((Color >> 16) & 0xFF) / 255.0, 
+			 ((Color >>  8) & 0xFF) / 255.0,
+                         ((Color >>  0) & 0xFF) / 255.0, 
+			 ((Color >> 24) & 0xFF) / 255.0);
             checkGLcall("glClearColor");
             glMask = glMask | GL_COLOR_BUFFER_BIT;
         }
@@ -1881,6 +1913,20 @@
         glClear(glMask);
         checkGLcall("glClear");
 
+	if (Flags & D3DCLEAR_STENCIL) {
+	  glClearStencil(old_stencil_clear_value);
+	}    
+	if (Flags & D3DCLEAR_ZBUFFER) {
+	  glDepthMask(old_ztest);
+	  glClearDepth(old_z_clear_value);
+	}
+	if (Flags & D3DCLEAR_TARGET) {
+	  glClearColor(old_color_clear_value[0], 
+		       old_color_clear_value[1],
+		       old_color_clear_value[2], 
+		       old_color_clear_value[3]);
+	}
+
         if (curRect) curRect = curRect + sizeof(D3DRECT);
     }
 
@@ -3615,14 +3661,14 @@
 
                 case D3DTOP_SELECTARG1                :
 		    {
+		        BOOL  isAlphaOp = (Type == D3DTSS_ALPHAOP);
+		        DWORD dwValue = 0;
+			GLenum source;
+			GLenum operand;			
                         FIXME("see if D3DTOP_SELECTARG1 behavior is correct now!\n");
                         glTexEnvi(GL_TEXTURE_ENV, Parm, GL_REPLACE);
 			checkGLcall("glTexEnvi(GL_TEXTURE_ENV, Parm, GL_REPLACE)");
 #if 0 /* don't seem to do anything */			
-		        BOOL  isAlphaOp = (Type == D3DTSS_ALPHAOP);
-		        DWORD dwValue = 0;
-			GLenum source;
-			GLenum operand;
 			dwValue = This->StateBlock->texture_state[Stage][(isAlphaOp) ? D3DTSS_ALPHAARG1 : D3DTSS_COLORARG1];
 			GetSrcAndOpFromValue(dwValue, isAlphaOp, &source, &operand);
 			if (isAlphaOp) {
Index: surface.c
===================================================================
RCS file: /home/wine/wine/dlls/d3d8/surface.c,v
retrieving revision 1.7
diff -u -r1.7 surface.c
--- surface.c	11 May 2003 03:35:27 -0000	1.7
+++ surface.c	11 May 2003 10:44:26 -0000
@@ -31,8 +31,8 @@
 WINE_DEFAULT_DEBUG_CHANNEL(d3d);
 
 /* trace: */
-#if 1
-# define VTRACE(A) FIXME A
+#if 0
+# define VTRACE(A) TRACE A
 #else 
 # define VTRACE(A) 
 #endif
@@ -85,15 +85,18 @@
 }
 HRESULT WINAPI IDirect3DSurface8Impl_SetPrivateData(LPDIRECT3DSURFACE8 iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) {
     ICOM_THIS(IDirect3DSurface8Impl,iface);
-    FIXME("(%p) : stub\n", This);    return D3D_OK;
+    FIXME("(%p) : stub\n", This);    
+    return D3D_OK;
 }
 HRESULT WINAPI IDirect3DSurface8Impl_GetPrivateData(LPDIRECT3DSURFACE8 iface, REFGUID refguid, void* pData, DWORD* pSizeOfData) {
     ICOM_THIS(IDirect3DSurface8Impl,iface);
-    FIXME("(%p) : stub\n", This);    return D3D_OK;
+    FIXME("(%p) : stub\n", This);    
+    return D3D_OK;
 }
 HRESULT WINAPI IDirect3DSurface8Impl_FreePrivateData(LPDIRECT3DSURFACE8 iface, REFGUID refguid) {
     ICOM_THIS(IDirect3DSurface8Impl,iface);
-    FIXME("(%p) : stub\n", This);    return D3D_OK;
+    FIXME("(%p) : stub\n", This);    
+    return D3D_OK;
 }
 HRESULT WINAPI IDirect3DSurface8Impl_GetContainer(LPDIRECT3DSURFACE8 iface, REFIID riid, void** ppContainer) {
     ICOM_THIS(IDirect3DSurface8Impl,iface);
@@ -118,7 +121,9 @@
     return D3D_OK;
 }
 HRESULT WINAPI IDirect3DSurface8Impl_LockRect(LPDIRECT3DSURFACE8 iface, D3DLOCKED_RECT* pLockedRect, CONST RECT* pRect, DWORD Flags) {
+    HRESULT hr;
     ICOM_THIS(IDirect3DSurface8Impl,iface);
+  
     /* fixme: should we really lock as such? */
 
     if (FALSE == This->lockable) {
@@ -126,7 +131,7 @@
       return D3DERR_INVALIDCALL;
     }
 
-    TRACE("(%p) : rect=%p, output prect=%p, allMem=%p\n", This, pRect, pLockedRect, This->allocatedMemory);
+    TRACE("(%p) : rect@%p flags(%08x), output lockedRect@%p, memory@%p\n", This, pRect, Flags, pLockedRect, This->allocatedMemory);
 
     pLockedRect->Pitch = This->bytesPerPixel * This->myDesc.Width;  /* Bytes / row */    
     
@@ -146,7 +151,6 @@
     }
 
 
-
     if (0 == This->myDesc.Usage) { /* classic surface */
 
       /* Nothing to do ;) */
@@ -227,6 +231,37 @@
       FIXME("unsupported locking to surface surf@%p usage(%lu)\n", This, This->myDesc.Usage);
     }
 
+    if (Flags & (D3DLOCK_NO_DIRTY_UPDATE | D3DLOCK_READONLY)) {
+      /* Dont dirtify */
+    } else {
+      /**
+       * Dirtify on lock
+       * as seen in msdn docs
+       */
+      This->Dirty = TRUE;
+      /** Dirtify Container if needed */
+      if (NULL != This->Container) {
+	IDirect3DBaseTexture8* cont = NULL;
+	hr = IUnknown_QueryInterface(This->Container, &IID_IDirect3DBaseTexture8, (void**) &cont);
+	
+	if (SUCCEEDED(hr) && NULL != cont) {
+	  /* Now setup the texture appropraitly */
+	  D3DRESOURCETYPE containerType = IDirect3DBaseTexture8Impl_GetType(cont);
+	  if (containerType == D3DRTYPE_TEXTURE) {
+            IDirect3DTexture8Impl* pTexture = (IDirect3DTexture8Impl*) cont;
+            pTexture->Dirty = TRUE;
+	  } else if (containerType == D3DRTYPE_CUBETEXTURE) {
+            IDirect3DCubeTexture8Impl* pTexture = (IDirect3DCubeTexture8Impl*) cont;
+            pTexture->Dirty = TRUE;
+	  } else {
+            FIXME("Set dirty on container type %d\n", containerType);
+	  }
+	  IDirect3DBaseTexture8_Release(cont);
+	  cont = NULL;
+	}
+      }
+    }
+
     TRACE("returning pBits=%p, pitch=%d\n", pLockedRect->pBits, pLockedRect->Pitch);
 
     This->locked = TRUE;
@@ -241,10 +276,17 @@
       return D3DERR_INVALIDCALL;
     }
 
-    TRACE("(%p) : stub\n", This);
+    TRACE("(%p) : see if behavior is correct\n", This);
+
+    if (FALSE == This->Dirty) {
+      TRACE("(%p) : Not Dirtified so nothing to do, return now\n", This);
+      goto unlock_end;
+    }
 
     if (0 == This->myDesc.Usage) { /* classic surface */
+#if 0
       if (This->Container) {
+	HRESULT hr;
 	IDirect3DBaseTexture8* cont = NULL;
 	hr = IUnknown_QueryInterface(This->Container, &IID_IDirect3DBaseTexture8, (void**) &cont);
 	
@@ -252,18 +294,19 @@
 	  /* Now setup the texture appropraitly */
 	  int containerType = IDirect3DBaseTexture8Impl_GetType(cont);
 	  if (containerType == D3DRTYPE_TEXTURE) {
-            IDirect3DTexture8Impl *pTexture = (IDirect3DTexture8Impl *)cont;
-            pTexture->Dirty = TRUE;
+	    IDirect3DTexture8Impl *pTexture = (IDirect3DTexture8Impl *)cont;
+	    pTexture->Dirty = TRUE;
 	  } else if (containerType == D3DRTYPE_CUBETEXTURE) {
-            IDirect3DCubeTexture8Impl *pTexture = (IDirect3DCubeTexture8Impl *)cont;
-            pTexture->Dirty = TRUE;
+	    IDirect3DCubeTexture8Impl *pTexture = (IDirect3DCubeTexture8Impl *)cont;
+	    pTexture->Dirty = TRUE;
 	  } else {
-            FIXME("Set dirty on container type %d\n", containerType);
+	    FIXME("Set dirty on container type %d\n", containerType);
 	  }
 	  IDirect3DBaseTexture8_Release(cont);
 	  cont = NULL;
 	}
       }
+#endif
     } else if (D3DUSAGE_RENDERTARGET & This->myDesc.Usage) { /* render surfaces */
 
       if (This == This->Device->backBuffer || This == This->Device->frontBuffer) {
@@ -336,6 +379,8 @@
     } else {
       FIXME("unsupported unlocking to surface surf@%p usage(%lu)\n", This, This->myDesc.Usage);
     }
+
+unlock_end:
     This->locked = FALSE;
     return D3D_OK;
 }
Index: texture.c
===================================================================
RCS file: /home/wine/wine/dlls/d3d8/texture.c,v
retrieving revision 1.6
diff -u -r1.6 texture.c
--- texture.c	8 May 2003 03:49:04 -0000	1.6
+++ texture.c	11 May 2003 10:44:27 -0000
@@ -192,30 +192,36 @@
 HRESULT  WINAPI        IDirect3DTexture8Impl_GetSurfaceLevel(LPDIRECT3DTEXTURE8 iface, UINT Level,IDirect3DSurface8** ppSurfaceLevel) {
     ICOM_THIS(IDirect3DTexture8Impl,iface);
     *ppSurfaceLevel = (LPDIRECT3DSURFACE8)This->surfaces[Level];
-    IDirect3DSurface8Impl_AddRef((LPDIRECT3DSURFACE8)This->surfaces[Level]);
+    IDirect3DSurface8Impl_AddRef((LPDIRECT3DSURFACE8) This->surfaces[Level]);
     TRACE("(%p) : returning %p for level %d\n", This, *ppSurfaceLevel, Level);
     return D3D_OK;
 }
 HRESULT  WINAPI        IDirect3DTexture8Impl_LockRect(LPDIRECT3DTEXTURE8 iface, UINT Level,D3DLOCKED_RECT* pLockedRect,CONST RECT* pRect,DWORD Flags) {
+    HRESULT hr;
     ICOM_THIS(IDirect3DTexture8Impl,iface);
     TRACE("(%p) Level (%d)\n", This, Level);
     if (Level < This->levels) {
-        return IDirect3DSurface8Impl_LockRect((LPDIRECT3DSURFACE8)This->surfaces[Level], pLockedRect, pRect, Flags);
+      /**
+       * Not dirtified while Surfaces don't notify dirtification
+       * This->Dirty = TRUE;
+       */
+      hr = IDirect3DSurface8Impl_LockRect((LPDIRECT3DSURFACE8) This->surfaces[Level], pLockedRect, pRect, Flags);
+      TRACE("(%p) Level (%d) success(%lu)\n", This, Level, hr);
     } else {
         FIXME("Levels seems too high?!!\n");
     }
-    return D3D_OK;
+    return hr;
 }
 HRESULT  WINAPI        IDirect3DTexture8Impl_UnlockRect(LPDIRECT3DTEXTURE8 iface, UINT Level) {
     ICOM_THIS(IDirect3DTexture8Impl,iface);
-    This->Dirty = TRUE;
     TRACE("(%p) : stub\n", This);
     return D3D_OK;
 }
 HRESULT  WINAPI        IDirect3DTexture8Impl_AddDirtyRect(LPDIRECT3DTEXTURE8 iface, CONST RECT* pDirtyRect) {
     ICOM_THIS(IDirect3DTexture8Impl,iface);
     This->Dirty = TRUE;
-    FIXME("(%p) : stub\n", This);    return D3D_OK;
+    FIXME("(%p) : stub\n", This);    
+    return D3D_OK;
 }
 
 
Index: volume.c
===================================================================
RCS file: /home/wine/wine/dlls/d3d8/volume.c,v
retrieving revision 1.5
diff -u -r1.5 volume.c
--- volume.c	11 May 2003 03:35:27 -0000	1.5
+++ volume.c	11 May 2003 10:44:27 -0000
@@ -77,15 +77,18 @@
 }
 HRESULT WINAPI IDirect3DVolume8Impl_SetPrivateData(LPDIRECT3DVOLUME8 iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) {
     ICOM_THIS(IDirect3DVolume8Impl,iface);
-    FIXME("(%p) : stub\n", This);    return D3D_OK;
+    FIXME("(%p) : stub\n", This);    
+    return D3D_OK;
 }
 HRESULT WINAPI IDirect3DVolume8Impl_GetPrivateData(LPDIRECT3DVOLUME8 iface, REFGUID  refguid, void* pData, DWORD* pSizeOfData) {
     ICOM_THIS(IDirect3DVolume8Impl,iface);
-    FIXME("(%p) : stub\n", This);    return D3D_OK;
+    FIXME("(%p) : stub\n", This);    
+    return D3D_OK;
 }
 HRESULT WINAPI IDirect3DVolume8Impl_FreePrivateData(LPDIRECT3DVOLUME8 iface, REFGUID refguid) {
     ICOM_THIS(IDirect3DVolume8Impl,iface);
-    FIXME("(%p) : stub\n", This);    return D3D_OK;
+    FIXME("(%p) : stub\n", This);    
+    return D3D_OK;
 }
 
 HRESULT WINAPI IDirect3DVolume8Impl_GetContainer(LPDIRECT3DVOLUME8 iface, REFIID riid, void** ppContainer) {
@@ -101,7 +104,7 @@
     memcpy(pDesc, &This->myDesc, sizeof(D3DVOLUME_DESC));
     return D3D_OK;
 }
-HRESULT WINAPI IDirect3DVolume8Impl_LockBox(LPDIRECT3DVOLUME8 iface, D3DLOCKED_BOX* pLockedVolume,CONST D3DBOX* pBox, DWORD Flags) {
+HRESULT WINAPI IDirect3DVolume8Impl_LockBox(LPDIRECT3DVOLUME8 iface, D3DLOCKED_BOX* pLockedVolume, CONST D3DBOX* pBox, DWORD Flags) {
     ICOM_THIS(IDirect3DVolume8Impl,iface);
     FIXME("(%p) : pBox=%p stub\n", This, pBox);    
 
@@ -120,23 +123,45 @@
             (pLockedVolume->RowPitch * pBox->Top) + 
             (pBox->Left * This->bytesPerPixel);
     }
-    TRACE("returning pBits=%p, rpitch=%d, spitch=%d\n", pLockedVolume->pBits, pLockedVolume->RowPitch, pLockedVolume->SlicePitch);
+    
+    if (Flags & (D3DLOCK_NO_DIRTY_UPDATE | D3DLOCK_READONLY)) {
+      /* Dont dirtify */
+    } else {
+      /**
+       * Dirtify on lock
+       * as seen in msdn docs
+       */
+      /**  Dirtify Container if needed */
+      if (NULL != This->Container) {
+        IDirect3DVolumeTexture8* cont = (IDirect3DVolumeTexture8*) This->Container;	
+        D3DRESOURCETYPE containerType = IDirect3DBaseTexture8Impl_GetType((LPDIRECT3DBASETEXTURE8) cont);
+        if (containerType == D3DRTYPE_VOLUMETEXTURE) {
+	  IDirect3DBaseTexture8Impl* pTexture = (IDirect3DBaseTexture8Impl*) cont;
+	  pTexture->Dirty = TRUE;
+        } else {
+	  FIXME("Set dirty on container type %d\n", containerType);
+        }
+      }
+    }
+
+    TRACE("returning memory@%p rpitch(%d) spitch(%d)\n", pLockedVolume->pBits, pLockedVolume->RowPitch, pLockedVolume->SlicePitch);
     return D3D_OK;
 }
 HRESULT WINAPI IDirect3DVolume8Impl_UnlockBox(LPDIRECT3DVOLUME8 iface) {
     ICOM_THIS(IDirect3DVolume8Impl,iface);
     TRACE("(%p) : stub\n", This);
+#if 0
     if (This->Container) {
         IDirect3DVolumeTexture8* cont = (IDirect3DVolumeTexture8*) This->Container;
-
-        int containerType = IDirect3DBaseTexture8Impl_GetType((LPDIRECT3DBASETEXTURE8) cont);
+        D3DRESOURCETYPE containerType = IDirect3DBaseTexture8Impl_GetType((LPDIRECT3DBASETEXTURE8) cont);
         if (containerType == D3DRTYPE_VOLUMETEXTURE) {
-            IDirect3DTexture8Impl *pTexture = (IDirect3DTexture8Impl *)cont;
+            IDirect3DTexture8Impl* pTexture = (IDirect3DTexture8Impl*) cont;
             pTexture->Dirty = TRUE;
         } else {
             FIXME("Set dirty on container type %d\n", containerType);
         }
     }
+#endif
     return D3D_OK;
 }
 
Index: volumetexture.c
===================================================================
RCS file: /home/wine/wine/dlls/d3d8/volumetexture.c,v
retrieving revision 1.6
diff -u -r1.6 volumetexture.c
--- volumetexture.c	11 May 2003 03:35:27 -0000	1.6
+++ volumetexture.c	11 May 2003 10:44:28 -0000
@@ -141,33 +141,50 @@
     }
     return D3D_OK;
 }
-HRESULT  WINAPI        IDirect3DVolumeTexture8Impl_GetVolumeLevel(LPDIRECT3DVOLUMETEXTURE8 iface, UINT Level,IDirect3DVolume8** ppVolumeLevel) {
+HRESULT  WINAPI        IDirect3DVolumeTexture8Impl_GetVolumeLevel(LPDIRECT3DVOLUMETEXTURE8 iface, UINT Level, IDirect3DVolume8** ppVolumeLevel) {
     ICOM_THIS(IDirect3DVolumeTexture8Impl,iface);
-    IDirect3DVolume8Impl_AddRef((LPDIRECT3DVOLUME8)This->volumes[Level]);
-    *ppVolumeLevel = (LPDIRECT3DVOLUME8)This->volumes[Level];
-    TRACE("(%p) : returning %p for level %d\n", This, *ppVolumeLevel, Level);
+    if (Level < This->levels) {
+      *ppVolumeLevel = (LPDIRECT3DVOLUME8)This->volumes[Level];
+      IDirect3DVolume8Impl_AddRef((LPDIRECT3DVOLUME8) *ppVolumeLevel);
+      TRACE("(%p) -> level(%d) returning volume@%p\n", This, Level, *ppVolumeLevel);
+    } else {
+      FIXME("(%p) Level(%d) overflow Levels(%d)\n", This, Level, This->levels);
+      return D3DERR_INVALIDCALL;
+    }
     return D3D_OK;
+
 }
-HRESULT  WINAPI        IDirect3DVolumeTexture8Impl_LockBox(LPDIRECT3DVOLUMETEXTURE8 iface, UINT Level,D3DLOCKED_BOX* pLockedVolume,CONST D3DBOX* pBox,DWORD Flags) {
+HRESULT  WINAPI        IDirect3DVolumeTexture8Impl_LockBox(LPDIRECT3DVOLUMETEXTURE8 iface, UINT Level, D3DLOCKED_BOX* pLockedVolume, CONST D3DBOX* pBox, DWORD Flags) {
+    HRESULT hr;
     ICOM_THIS(IDirect3DVolumeTexture8Impl,iface);
-    TRACE("(%p) Level (%d)\n", This, Level);
     if (Level < This->levels) {
-        return IDirect3DVolume8Impl_LockBox((LPDIRECT3DVOLUME8)This->volumes[Level], pLockedVolume, pBox, Flags);
+      /**
+       * Not dirtified while Surfaces don't notify dirtification
+       * This->Dirty = TRUE;
+       */
+      hr = IDirect3DVolume8Impl_LockBox((LPDIRECT3DVOLUME8) This->volumes[Level], pLockedVolume, pBox, Flags);
+      TRACE("(%p) Level (%d) success(%lu)\n", This, Level, hr);
     } else {
-        FIXME("Volume Levels seems too high?!!\n");
+      FIXME("(%p) level(%d) overflow Levels(%d)\n", This, Level, This->levels);
+      return D3DERR_INVALIDCALL;
     }
-    return D3D_OK;
+    return hr;
 }
 HRESULT  WINAPI        IDirect3DVolumeTexture8Impl_UnlockBox(LPDIRECT3DVOLUMETEXTURE8 iface, UINT Level) {
     ICOM_THIS(IDirect3DVolumeTexture8Impl,iface);
-    This->Dirty = TRUE;
-    TRACE("(%p) : stub\n", This);
+    if (Level < This->levels) {
+      TRACE("(%p) level(%d) stub\n", This, Level);
+    } else {
+      FIXME("(%p) level(%d) overflow Levels(%d)\n", This, Level, This->levels);
+      return D3DERR_INVALIDCALL;
+    }
     return D3D_OK;
 }
 HRESULT  WINAPI        IDirect3DVolumeTexture8Impl_AddDirtyBox(LPDIRECT3DVOLUMETEXTURE8 iface, CONST D3DBOX* pDirtyBox) {
     ICOM_THIS(IDirect3DVolumeTexture8Impl,iface);
     This->Dirty = TRUE;
-    FIXME("(%p) : stub\n", This);    return D3D_OK;
+    FIXME("(%p) : stub\n", This);    
+    return D3D_OK;
 }
 
 

[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux