[WINED3D] Initialize volume Format.

Ivan Gyurdiev ivg2 at cornell.edu
Thu May 4 21:42:15 CDT 2006


Volumes make use of their currentDesc.Format field, which is never 
initialized to anything. Instead that field appears to be maintained in 
the common Resource superclass. If you look at the Surface class, you'll 
see it has a pointer to the base Resource, and a WINED3DSURFACET_DESC - 
which is equivalent to D3DSURFACE_DESC minus the resource fields.

This patch changes the volume class to use the same scheme - create a 
WINED3DVOLUMET_DESC, and look up the format field in the resource 
superclass [ where it is actually initialized. ]

====

With this patch D3DFORMAT_UNKNOWN errors disappear in the RollerCoaster 
demo, and instead I see the correct format being detected as D3DFORMAT_L8.

-------------- next part --------------
---

 dlls/wined3d/directx.c         |    8 ++++----
 dlls/wined3d/volume.c          |   12 ++++++------
 dlls/wined3d/wined3d_private.h |    9 ++++++++-
 3 files changed, 18 insertions(+), 11 deletions(-)

35edd85242bc2375f04d8b56fbd80c5aa3ec576f
diff --git a/dlls/wined3d/volume.c b/dlls/wined3d/volume.c
index e8eaa0d..b6b435b 100644
--- a/dlls/wined3d/volume.c
+++ b/dlls/wined3d/volume.c
@@ -291,23 +291,23 @@ HRESULT WINAPI IWineD3DVolumeImpl_LoadTe
     TRACE("Calling glTexImage3D %x level=%d, intfmt=%x, w=%d, h=%d,d=%d, 0=%d, glFmt=%x, glType=%x, Mem=%p\n",
             GL_TEXTURE_3D,
             gl_level,
-            D3DFmt2GLIntFmt(myDevice, This->currentDesc.Format),
+            D3DFmt2GLIntFmt(myDevice, This->resource.format),
             This->currentDesc.Width,
             This->currentDesc.Height,
             This->currentDesc.Depth,
             0,
-            D3DFmt2GLFmt(myDevice, This->currentDesc.Format),
-            D3DFmt2GLType(myDevice, This->currentDesc.Format),
+            D3DFmt2GLFmt(myDevice, This->resource.format),
+            D3DFmt2GLType(myDevice, This->resource.format),
             This->resource.allocatedMemory);
     glTexImage3D(GL_TEXTURE_3D,
                     gl_level,
-                    D3DFmt2GLIntFmt(myDevice, This->currentDesc.Format),
+                    D3DFmt2GLIntFmt(myDevice, This->resource.format),
                     This->currentDesc.Width,
                     This->currentDesc.Height,
                     This->currentDesc.Depth,
                     0,
-                    D3DFmt2GLFmt(myDevice, This->currentDesc.Format),
-                    D3DFmt2GLType(myDevice, This->currentDesc.Format),
+                    D3DFmt2GLFmt(myDevice, This->resource.format),
+                    D3DFmt2GLType(myDevice, This->resource.format),
                     This->resource.allocatedMemory);
     checkGLcall("glTexImage3D");
     return WINED3D_OK;
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 568cae4..126883a 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -765,6 +765,13 @@ typedef struct IWineD3DCubeTextureImpl
 
 extern const IWineD3DCubeTextureVtbl IWineD3DCubeTexture_Vtbl;
 
+typedef struct _WINED3DVOLUMET_DESC
+{
+    UINT                    Width;
+    UINT                    Height;
+    UINT                    Depth;
+} WINED3DVOLUMET_DESC;
+
 /*****************************************************************************
  * IWineD3DVolume implementation structure (extends IUnknown)
  */
@@ -775,7 +782,7 @@ typedef struct IWineD3DVolumeImpl
     IWineD3DResourceClass      resource;
 
     /* WineD3DVolume Information */
-    D3DVOLUME_DESC          currentDesc;
+    WINED3DVOLUMET_DESC      currentDesc;
     IWineD3DBase            *container;
     UINT                    bytesPerPixel;
 
-- 
1.3.0



More information about the wine-patches mailing list