[PATCH 5/5] wined3d: Store the mipmap level in the volume

Stefan Dösinger stefan at codeweavers.com
Mon Aug 19 03:52:35 CDT 2013


---
 dlls/wined3d/texture.c         |  5 +++--
 dlls/wined3d/volume.c          | 13 ++++++++++---
 dlls/wined3d/wined3d_private.h |  4 +++-
 3 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index 82f7749..e2c1b0c 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -1086,7 +1086,7 @@ static void texture3d_preload(struct wined3d_texture *texture, enum WINED3DSRGB
     {
         for (i = 0; i < texture->level_count; ++i)
         {
-            volume_load(volume_from_resource(texture->sub_resources[i]), context, i,
+            wined3d_volume_load(volume_from_resource(texture->sub_resources[i]), context,
                     texture->flags & WINED3D_TEXTURE_IS_SRGB);
         }
     }
@@ -1096,7 +1096,7 @@ static void texture3d_preload(struct wined3d_texture *texture, enum WINED3DSRGB
         {
             struct wined3d_volume *volume = volume_from_resource(texture->sub_resources[i]);
             volume_add_dirty_box(volume, NULL);
-            volume_load(volume, context, i, texture->flags & WINED3D_TEXTURE_IS_SRGB);
+            wined3d_volume_load(volume, context, texture->flags & WINED3D_TEXTURE_IS_SRGB);
         }
     }
     else
@@ -1262,6 +1262,7 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct
 
         /* Set its container to this texture. */
         volume_set_container(volume, texture);
+        wined3d_volume_set_texture_level(volume, i);
         texture->sub_resources[i] = &volume->resource;
 
         /* Calculate the next mipmap level. */
diff --git a/dlls/wined3d/volume.c b/dlls/wined3d/volume.c
index a48b67d..876465c 100644
--- a/dlls/wined3d/volume.c
+++ b/dlls/wined3d/volume.c
@@ -3,6 +3,7 @@
  * Copyright 2002-2005 Raphael Junqueira
  * Copyright 2005 Oliver Stieber
  * Copyright 2009-2011 Henri Verbeet for CodeWeavers
+ * Copyright 2013 Stefan Dösinger for CodeWeavers
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -77,17 +78,18 @@ void volume_set_container(struct wined3d_volume *volume, struct wined3d_texture
 }
 
 /* Context activation is done by the caller. */
-void volume_load(const struct wined3d_volume *volume, struct wined3d_context *context, UINT level, BOOL srgb_mode)
+void wined3d_volume_load(const struct wined3d_volume *volume, struct wined3d_context *context, BOOL srgb_mode)
 {
     const struct wined3d_gl_info *gl_info = context->gl_info;
     const struct wined3d_format *format = volume->resource.format;
 
     TRACE("volume %p, context %p, level %u, srgb %#x, format %s (%#x).\n",
-            volume, context, level, srgb_mode, debug_d3dformat(format->id), format->id);
+            volume, context, volume->texture_level, srgb_mode, debug_d3dformat(format->id),
+            format->id);
 
     volume_bind_and_dirtify(volume, context);
 
-    GL_EXTCALL(glTexImage3DEXT(GL_TEXTURE_3D, level, format->glInternal,
+    GL_EXTCALL(glTexImage3DEXT(GL_TEXTURE_3D, volume->texture_level, format->glInternal,
             volume->resource.width, volume->resource.height, volume->resource.depth,
             0, format->glFormat, format->glType, volume->resource.allocatedMemory));
     checkGLcall("glTexImage3D");
@@ -329,3 +331,8 @@ HRESULT CDECL wined3d_volume_create(struct wined3d_device *device, UINT width, U
 
     return WINED3D_OK;
 }
+
+void wined3d_volume_set_texture_level(struct wined3d_volume *volume, GLint level)
+{
+    volume->texture_level = level;
+}
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 62e9c12..d868c9a 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2063,6 +2063,7 @@ struct wined3d_volume
     struct wined3d_box dirtyBox;
 
     DWORD flags;
+    GLint texture_level;
 };
 
 static inline struct wined3d_volume *volume_from_resource(struct wined3d_resource *resource)
@@ -2071,8 +2072,9 @@ static inline struct wined3d_volume *volume_from_resource(struct wined3d_resourc
 }
 
 void volume_add_dirty_box(struct wined3d_volume *volume, const struct wined3d_box *dirty_box) DECLSPEC_HIDDEN;
-void volume_load(const struct wined3d_volume *volume, struct wined3d_context *context, UINT level, BOOL srgb_mode) DECLSPEC_HIDDEN;
+void wined3d_volume_load(const struct wined3d_volume *volume, struct wined3d_context *context, BOOL srgb_mode) DECLSPEC_HIDDEN;
 void volume_set_container(struct wined3d_volume *volume, struct wined3d_texture *container) DECLSPEC_HIDDEN;
+void wined3d_volume_set_texture_level(struct wined3d_volume *volume, GLint level) DECLSPEC_HIDDEN;
 
 struct wined3d_surface_dib
 {
-- 
1.8.1.5




More information about the wine-patches mailing list