Henri Verbeet : d3d9: Calculate texture levels in d3d9 instead of wined3d.

Alexandre Julliard julliard at wine.codeweavers.com
Wed Dec 10 15:34:08 CST 2014


Module: wine
Branch: master
Commit: 3b3b74510b0bc52a5b52a1438517e0381a43be45
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=3b3b74510b0bc52a5b52a1438517e0381a43be45

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Wed Dec 10 13:26:37 2014 +0100

d3d9: Calculate texture levels in d3d9 instead of wined3d.

---

 dlls/d3d9/texture.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/dlls/d3d9/texture.c b/dlls/d3d9/texture.c
index 432d248..c35ccdd 100644
--- a/dlls/d3d9/texture.c
+++ b/dlls/d3d9/texture.c
@@ -1296,6 +1296,14 @@ HRESULT texture_init(struct d3d9_texture *texture, struct d3d9_device *device,
     if (pool != D3DPOOL_DEFAULT || (usage & D3DUSAGE_DYNAMIC))
         surface_flags |= WINED3D_SURFACE_MAPPABLE;
 
+    if (!levels)
+    {
+        if (usage & D3DUSAGE_AUTOGENMIPMAP)
+            levels = 1;
+        else
+            levels = wined3d_log2i(max(width, height)) + 1;
+    }
+
     wined3d_mutex_lock();
     hr = wined3d_texture_create(device->wined3d_device, &desc, levels, surface_flags,
             texture, &d3d9_texture_wined3d_parent_ops, &texture->wined3d_texture);
@@ -1338,6 +1346,14 @@ HRESULT cubetexture_init(struct d3d9_texture *texture, struct d3d9_device *devic
     if (pool != D3DPOOL_DEFAULT || (usage & D3DUSAGE_DYNAMIC))
         surface_flags |= WINED3D_SURFACE_MAPPABLE;
 
+    if (!levels)
+    {
+        if (usage & D3DUSAGE_AUTOGENMIPMAP)
+            levels = 1;
+        else
+            levels = wined3d_log2i(edge_length) + 1;
+    }
+
     wined3d_mutex_lock();
     hr = wined3d_texture_create(device->wined3d_device, &desc, levels, surface_flags,
             texture, &d3d9_texture_wined3d_parent_ops, &texture->wined3d_texture);
@@ -1376,6 +1392,14 @@ HRESULT volumetexture_init(struct d3d9_texture *texture, struct d3d9_device *dev
     desc.depth = depth;
     desc.size = 0;
 
+    if (!levels)
+    {
+        if (usage & D3DUSAGE_AUTOGENMIPMAP)
+            levels = 1;
+        else
+            levels = wined3d_log2i(max(max(width, height), depth)) + 1;
+    }
+
     wined3d_mutex_lock();
     hr = wined3d_texture_create(device->wined3d_device, &desc, levels, 0,
             texture, &d3d9_texture_wined3d_parent_ops, &texture->wined3d_texture);




More information about the wine-cvs mailing list