Henri Verbeet : wined3d: Make sure all texture levels are allocated in surface_prepare_texture().

Alexandre Julliard julliard at winehq.org
Sun Apr 25 20:01:47 CDT 2010


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

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Thu Apr 22 18:55:58 2010 +0200

wined3d: Make sure all texture levels are allocated in surface_prepare_texture().

This fixes a regression introduced by commit
af7dfcd378739127c50aa95ce40b13eb3d1950cf.

---

 dlls/wined3d/surface.c |   28 +++++++++++++++++++++++++++-
 1 files changed, 27 insertions(+), 1 deletions(-)

diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 0818ce9..7d6d175 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -1563,7 +1563,8 @@ static void read_from_framebuffer_texture(IWineD3DSurfaceImpl *This, BOOL srgb)
 }
 
 /* Context activation is done by the caller. */
-void surface_prepare_texture(IWineD3DSurfaceImpl *surface, const struct wined3d_gl_info *gl_info, BOOL srgb)
+static void surface_prepare_texture_internal(IWineD3DSurfaceImpl *surface,
+        const struct wined3d_gl_info *gl_info, BOOL srgb)
 {
     DWORD alloc_flag = srgb ? SFLAG_SRGBALLOCATED : SFLAG_ALLOCATED;
     CONVERT_TYPES convert;
@@ -1580,6 +1581,31 @@ void surface_prepare_texture(IWineD3DSurfaceImpl *surface, const struct wined3d_
     surface->Flags |= alloc_flag;
 }
 
+/* Context activation is done by the caller. */
+void surface_prepare_texture(IWineD3DSurfaceImpl *surface, const struct wined3d_gl_info *gl_info, BOOL srgb)
+{
+    IWineD3DBaseTextureImpl *texture;
+
+    if (SUCCEEDED(IWineD3DSurface_GetContainer((IWineD3DSurface *)surface,
+            &IID_IWineD3DBaseTexture, (void **)&texture)))
+    {
+        UINT sub_count = texture->baseTexture.level_count * texture->baseTexture.layer_count;
+        UINT i;
+
+        TRACE("surface %p is a subresource of texture %p.\n", surface, texture);
+
+        for (i = 0; i < sub_count; ++i)
+        {
+            IWineD3DSurfaceImpl *s = (IWineD3DSurfaceImpl *)texture->baseTexture.sub_resources[i];
+            surface_prepare_texture_internal(s, gl_info, srgb);
+        }
+
+        IWineD3DBaseTexture_Release((IWineD3DBaseTexture *)texture);
+    }
+
+    surface_prepare_texture_internal(surface, gl_info, srgb);
+}
+
 static void surface_prepare_system_memory(IWineD3DSurfaceImpl *This)
 {
     IWineD3DDeviceImpl *device = This->resource.device;




More information about the wine-cvs mailing list