Henri Verbeet : wined3d: Replace "cond_np2" in wined3d_texture with a flag.

Alexandre Julliard julliard at winehq.org
Tue Mar 29 11:43:03 CDT 2011


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

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Mon Mar 28 21:58:43 2011 +0200

wined3d: Replace "cond_np2" in wined3d_texture with a flag.

---

 dlls/wined3d/texture.c         |   10 +++++-----
 dlls/wined3d/wined3d_private.h |    4 +++-
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index 170507b..e16d72d 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -59,6 +59,7 @@ static HRESULT wined3d_texture_init(struct wined3d_texture *texture, const struc
     texture->texture_srgb.dirty = TRUE;
     texture->is_srgb = FALSE;
     texture->pow2_matrix_identity = TRUE;
+    texture->flags = 0;
 
     if (texture->resource.format->flags & WINED3DFMT_FLAG_FILTERING)
     {
@@ -262,7 +263,7 @@ void wined3d_texture_apply_state_changes(struct wined3d_texture *texture,
         const DWORD sampler_states[WINED3D_HIGHEST_SAMPLER_STATE + 1],
         const struct wined3d_gl_info *gl_info)
 {
-    BOOL cond_np2 = texture->cond_np2;
+    BOOL cond_np2 = texture->flags & WINED3D_TEXTURE_COND_NP2;
     GLenum target = texture->target;
     struct gl_texture *gl_tex;
     DWORD state;
@@ -666,7 +667,7 @@ static HRESULT texture2d_bind(struct wined3d_texture *texture,
          * state. The same applies to filtering. Even if the texture has only
          * one mip level, the default LINEAR_MIPMAP_LINEAR filter causes a SW
          * fallback on macos. */
-        if (texture->cond_np2)
+        if (texture->flags & WINED3D_TEXTURE_COND_NP2)
         {
             GLenum target = texture->target;
 
@@ -1028,7 +1029,7 @@ HRESULT texture_init(struct wined3d_texture *texture, UINT width, UINT height, U
         texture->pow2_matrix[10] = 1.0f;
         texture->pow2_matrix[15] = 1.0f;
         texture->target = GL_TEXTURE_2D;
-        texture->cond_np2 = TRUE;
+        texture->flags |= WINED3D_TEXTURE_COND_NP2;
         texture->min_mip_lookup = minMipLookup_noFilter;
     }
     else if (gl_info->supported[ARB_TEXTURE_RECTANGLE] && (width != pow2_width || height != pow2_height)
@@ -1043,7 +1044,7 @@ HRESULT texture_init(struct wined3d_texture *texture, UINT width, UINT height, U
         texture->pow2_matrix[10] = 1.0f;
         texture->pow2_matrix[15] = 1.0f;
         texture->target = GL_TEXTURE_RECTANGLE_ARB;
-        texture->cond_np2 = TRUE;
+        texture->flags |= WINED3D_TEXTURE_COND_NP2;
 
         if (texture->resource.format->flags & WINED3DFMT_FLAG_FILTERING)
             texture->min_mip_lookup = minMipLookup_noMip;
@@ -1067,7 +1068,6 @@ HRESULT texture_init(struct wined3d_texture *texture, UINT width, UINT height, U
         texture->pow2_matrix[10] = 1.0f;
         texture->pow2_matrix[15] = 1.0f;
         texture->target = GL_TEXTURE_2D;
-        texture->cond_np2 = FALSE;
     }
     TRACE("xf(%f) yf(%f)\n", texture->pow2_matrix[0], texture->pow2_matrix[5]);
 
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 382df9d..de50930 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -1888,6 +1888,8 @@ struct wined3d_texture_ops
     void (*texture_sub_resource_cleanup)(struct wined3d_resource *sub_resource);
 };
 
+#define WINED3D_TEXTURE_COND_NP2            0x1
+
 struct wined3d_texture
 {
     struct wined3d_resource resource;
@@ -1902,8 +1904,8 @@ struct wined3d_texture
     LONG bind_count;
     DWORD sampler;
     BOOL is_srgb;
+    DWORD flags;
     BOOL pow2_matrix_identity;
-    BOOL cond_np2;
     const struct min_lookup *min_mip_lookup;
     const GLenum *mag_lookup;
     GLenum target;




More information about the wine-cvs mailing list