[PATCH 5/5] wined3d: Get rid of legacy mipmap autogeneration support.

Matteo Bruni mbruni at codeweavers.com
Tue Feb 6 12:36:17 CST 2018


Signed-off-by: Matteo Bruni <mbruni at codeweavers.com>
---
 dlls/d3d11/device.c            |  2 +-
 dlls/d3d9/d3d9_private.h       |  2 +-
 dlls/wined3d/directx.c         | 13 ++++-----
 dlls/wined3d/resource.c        |  1 -
 dlls/wined3d/texture.c         | 60 ------------------------------------------
 dlls/wined3d/utils.c           |  2 +-
 dlls/wined3d/wined3d.spec      |  2 --
 dlls/wined3d/wined3d_gl.h      |  2 --
 dlls/wined3d/wined3d_private.h |  1 -
 include/wine/wined3d.h         | 13 ++++-----
 10 files changed, 13 insertions(+), 85 deletions(-)

diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c
index b14c3862a1d..fb1aba42592 100644
--- a/dlls/d3d11/device.c
+++ b/dlls/d3d11/device.c
@@ -3225,7 +3225,7 @@ static HRESULT STDMETHODCALLTYPE d3d11_device_CheckFormatSupport(ID3D11Device *i
     {
         hr = wined3d_check_device_format(wined3d, params.adapter_idx, params.device_type,
                 WINED3DFMT_UNKNOWN, flag_mapping[i].usage, flag_mapping[i].rtype, wined3d_format);
-        if (hr == WINED3DERR_NOTAVAILABLE || hr == WINED3DOK_NOAUTOGEN)
+        if (hr == WINED3DERR_NOTAVAILABLE || hr == WINED3DOK_NOMIPGEN)
             continue;
         if (hr != WINED3D_OK)
         {
diff --git a/dlls/d3d9/d3d9_private.h b/dlls/d3d9/d3d9_private.h
index ce76c71e029..72f89e1aab6 100644
--- a/dlls/d3d9/d3d9_private.h
+++ b/dlls/d3d9/d3d9_private.h
@@ -331,7 +331,7 @@ static inline unsigned int wined3daccess_from_d3dpool(D3DPOOL pool)
 
 static inline DWORD wined3dusage_from_d3dusage(unsigned int usage)
 {
-    return usage & WINED3DUSAGE_MASK & ~WINED3DUSAGE_AUTOGENMIPMAP;
+    return usage & WINED3DUSAGE_MASK;
 }
 
 #endif /* __WINE_D3D9_PRIVATE_H */
diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c
index a2cc484727d..b40f7c339e6 100644
--- a/dlls/wined3d/directx.c
+++ b/dlls/wined3d/directx.c
@@ -270,9 +270,6 @@ static const struct wined3d_extension_map gl_extension_map[] =
     {"GL_NV_vertex_program2",               NV_VERTEX_PROGRAM2            },
     {"GL_NV_vertex_program2_option",        NV_VERTEX_PROGRAM2_OPTION     },
     {"GL_NV_vertex_program3",               NV_VERTEX_PROGRAM3            },
-
-    /* SGI */
-    {"GL_SGIS_generate_mipmap",             SGIS_GENERATE_MIPMAP          },
 };
 
 static const struct wined3d_extension_map wgl_extension_map[] =
@@ -5329,12 +5326,12 @@ HRESULT CDECL wined3d_check_device_format(const struct wined3d *wined3d, UINT ad
                 gl_type = gl_type_end = WINED3D_GL_RES_TYPE_RB;
                 break;
             }
-            allowed_usage |= WINED3DUSAGE_AUTOGENMIPMAP
-                    | WINED3DUSAGE_DYNAMIC
+            allowed_usage |= WINED3DUSAGE_DYNAMIC
                     | WINED3DUSAGE_LEGACY_CUBEMAP
                     | WINED3DUSAGE_SOFTWAREPROCESSING
                     | WINED3DUSAGE_TEXTURE
                     | WINED3DUSAGE_QUERY_FILTER
+                    | WINED3DUSAGE_QUERY_GENMIPMAP
                     | WINED3DUSAGE_QUERY_LEGACYBUMPMAP
                     | WINED3DUSAGE_QUERY_SRGBREAD
                     | WINED3DUSAGE_QUERY_SRGBWRITE
@@ -5437,10 +5434,10 @@ HRESULT CDECL wined3d_check_device_format(const struct wined3d *wined3d, UINT ad
             mipmap_gen_supported = FALSE;
     }
 
-    if ((usage & WINED3DUSAGE_AUTOGENMIPMAP) && !mipmap_gen_supported)
+    if ((usage & WINED3DUSAGE_QUERY_GENMIPMAP) && !mipmap_gen_supported)
     {
         TRACE("No WINED3DUSAGE_AUTOGENMIPMAP support, returning WINED3DOK_NOAUTOGEN.\n");
-        return WINED3DOK_NOAUTOGEN;
+        return WINED3DOK_NOMIPGEN;
     }
 
     return WINED3D_OK;
@@ -5613,7 +5610,7 @@ HRESULT CDECL wined3d_get_device_caps(const struct wined3d *wined3d, UINT adapte
                                      WINED3DCAPS2_FULLSCREENGAMMA |
                                      WINED3DCAPS2_DYNAMICTEXTURES;
     if (gl_info->supported[ARB_FRAMEBUFFER_OBJECT] || gl_info->supported[EXT_FRAMEBUFFER_OBJECT])
-        caps->Caps2 |= WINED3DCAPS2_CANAUTOGENMIPMAP;
+        caps->Caps2 |= WINED3DCAPS2_CANGENMIPMAP;
 
     caps->Caps3                    = WINED3DCAPS3_ALPHA_FULLSCREEN_FLIP_OR_DISCARD |
                                      WINED3DCAPS3_COPY_TO_VIDMEM                   |
diff --git a/dlls/wined3d/resource.c b/dlls/wined3d/resource.c
index 61ff20679bd..64d9e26f89f 100644
--- a/dlls/wined3d/resource.c
+++ b/dlls/wined3d/resource.c
@@ -34,7 +34,6 @@ static void resource_check_usage(DWORD usage)
             | WINED3DUSAGE_DEPTHSTENCIL
             | WINED3DUSAGE_WRITEONLY
             | WINED3DUSAGE_DYNAMIC
-            | WINED3DUSAGE_AUTOGENMIPMAP
             | WINED3DUSAGE_STATICDECL
             | WINED3DUSAGE_OVERLAY
             | WINED3DUSAGE_SCRATCH
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index 6c8c313ee25..650a82ab3f2 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -375,7 +375,6 @@ static HRESULT wined3d_texture_init(struct wined3d_texture *texture, const struc
 
     texture->layer_count = layer_count;
     texture->level_count = level_count;
-    texture->filter_type = (desc->usage & WINED3DUSAGE_AUTOGENMIPMAP) ? WINED3D_TEXF_LINEAR : WINED3D_TEXF_NONE;
     texture->lod = 0;
     texture->flags |= WINED3D_TEXTURE_POW2_MAT_IDENT | WINED3D_TEXTURE_NORMALIZED_COORDS;
     if (flags & WINED3D_TEXTURE_CREATE_GET_DC_LENIENT)
@@ -712,12 +711,6 @@ void wined3d_texture_bind(struct wined3d_texture *texture,
 
     context_bind_texture(context, target, gl_tex->name);
 
-    if (texture->resource.usage & WINED3DUSAGE_AUTOGENMIPMAP)
-    {
-        gl_info->gl_ops.gl.p_glTexParameteri(target, GL_GENERATE_MIPMAP_SGIS, GL_TRUE);
-        checkGLcall("glTexParameteri(target, GL_GENERATE_MIPMAP_SGIS, GL_TRUE)");
-    }
-
     /* For a new texture we have to set the texture levels after binding the
      * texture. Beware that texture rectangles do not support mipmapping, but
      * set the maxmiplevel if we're relying on the partial
@@ -1161,29 +1154,6 @@ DWORD CDECL wined3d_texture_get_level_count(const struct wined3d_texture *textur
     return texture->level_count;
 }
 
-HRESULT CDECL wined3d_texture_set_autogen_filter_type(struct wined3d_texture *texture,
-        enum wined3d_texture_filter_type filter_type)
-{
-    FIXME("texture %p, filter_type %s stub!\n", texture, debug_d3dtexturefiltertype(filter_type));
-
-    if (!(texture->resource.usage & WINED3DUSAGE_AUTOGENMIPMAP))
-    {
-        WARN("Texture doesn't have AUTOGENMIPMAP usage.\n");
-        return WINED3DERR_INVALIDCALL;
-    }
-
-    texture->filter_type = filter_type;
-
-    return WINED3D_OK;
-}
-
-enum wined3d_texture_filter_type CDECL wined3d_texture_get_autogen_filter_type(const struct wined3d_texture *texture)
-{
-    TRACE("texture %p.\n", texture);
-
-    return texture->filter_type;
-}
-
 HRESULT CDECL wined3d_texture_set_color_key(struct wined3d_texture *texture,
         DWORD flags, const struct wined3d_color_key *color_key)
 {
@@ -2144,21 +2114,6 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3
         TRACE("Creating an oversized (%ux%u) surface.\n", pow2_width, pow2_height);
     }
 
-    /* Calculate levels for mip mapping. */
-    if (desc->usage & WINED3DUSAGE_AUTOGENMIPMAP)
-    {
-        if (!gl_info->supported[SGIS_GENERATE_MIPMAP])
-        {
-            WARN("No mipmap generation support, returning WINED3DERR_INVALIDCALL.\n");
-            return WINED3DERR_INVALIDCALL;
-        }
-
-        if (level_count != 1)
-        {
-            WARN("WINED3DUSAGE_AUTOGENMIPMAP is set, and level count != 1, returning WINED3DERR_INVALIDCALL.\n");
-            return WINED3DERR_INVALIDCALL;
-        }
-    }
     if (flags & WINED3D_TEXTURE_GENERATE_MIPMAPS && !gl_info->supported[ARB_FRAMEBUFFER_OBJECT]
             && !gl_info->supported[EXT_FRAMEBUFFER_OBJECT])
     {
@@ -2592,21 +2547,6 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct
         return WINED3DERR_INVALIDCALL;
     }
 
-    /* Calculate levels for mip mapping. */
-    if (desc->usage & WINED3DUSAGE_AUTOGENMIPMAP)
-    {
-        if (!gl_info->supported[SGIS_GENERATE_MIPMAP])
-        {
-            WARN("No mipmap generation support, returning D3DERR_INVALIDCALL.\n");
-            return WINED3DERR_INVALIDCALL;
-        }
-
-        if (level_count != 1)
-        {
-            WARN("WINED3DUSAGE_AUTOGENMIPMAP is set, and level count != 1, returning D3DERR_INVALIDCALL.\n");
-            return WINED3DERR_INVALIDCALL;
-        }
-    }
     if (flags & WINED3D_TEXTURE_GENERATE_MIPMAPS && !gl_info->supported[ARB_FRAMEBUFFER_OBJECT]
             && !gl_info->supported[EXT_FRAMEBUFFER_OBJECT])
     {
diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c
index a31baa43a71..c3fda3465a9 100644
--- a/dlls/wined3d/utils.c
+++ b/dlls/wined3d/utils.c
@@ -4160,7 +4160,6 @@ const char *debug_d3dusage(DWORD usage)
     WINED3DUSAGE_TO_STR(WINED3DUSAGE_RTPATCHES);
     WINED3DUSAGE_TO_STR(WINED3DUSAGE_NPATCHES);
     WINED3DUSAGE_TO_STR(WINED3DUSAGE_DYNAMIC);
-    WINED3DUSAGE_TO_STR(WINED3DUSAGE_AUTOGENMIPMAP);
     WINED3DUSAGE_TO_STR(WINED3DUSAGE_RESTRICTED_CONTENT);
     WINED3DUSAGE_TO_STR(WINED3DUSAGE_RESTRICT_SHARED_RESOURCE_DRIVER);
     WINED3DUSAGE_TO_STR(WINED3DUSAGE_RESTRICT_SHARED_RESOURCE);
@@ -4184,6 +4183,7 @@ const char *debug_d3dusagequery(DWORD usagequery)
     buf[0] = '\0';
 #define WINED3DUSAGEQUERY_TO_STR(u) if (usagequery & u) { strcat(buf, " | "#u); usagequery &= ~u; }
     WINED3DUSAGEQUERY_TO_STR(WINED3DUSAGE_QUERY_FILTER);
+    WINED3DUSAGEQUERY_TO_STR(WINED3DUSAGE_QUERY_GENMIPMAP);
     WINED3DUSAGEQUERY_TO_STR(WINED3DUSAGE_QUERY_LEGACYBUMPMAP);
     WINED3DUSAGEQUERY_TO_STR(WINED3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING);
     WINED3DUSAGEQUERY_TO_STR(WINED3DUSAGE_QUERY_SRGBREAD);
diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec
index 74e61eab39e..82ef8a1f054 100644
--- a/dlls/wined3d/wined3d.spec
+++ b/dlls/wined3d/wined3d.spec
@@ -288,7 +288,6 @@
 @ cdecl wined3d_texture_create(ptr ptr long long long ptr ptr ptr ptr)
 @ cdecl wined3d_texture_decref(ptr)
 @ cdecl wined3d_texture_from_resource(ptr)
-@ cdecl wined3d_texture_get_autogen_filter_type(ptr)
 @ cdecl wined3d_texture_get_dc(ptr long ptr)
 @ cdecl wined3d_texture_get_level_count(ptr)
 @ cdecl wined3d_texture_get_lod(ptr)
@@ -300,7 +299,6 @@
 @ cdecl wined3d_texture_get_sub_resource_parent(ptr long)
 @ cdecl wined3d_texture_incref(ptr)
 @ cdecl wined3d_texture_release_dc(ptr long ptr)
-@ cdecl wined3d_texture_set_autogen_filter_type(ptr long)
 @ cdecl wined3d_texture_set_color_key(ptr long ptr)
 @ cdecl wined3d_texture_set_lod(ptr long)
 @ cdecl wined3d_texture_set_overlay_position(ptr long long long)
diff --git a/dlls/wined3d/wined3d_gl.h b/dlls/wined3d/wined3d_gl.h
index a3dee243595..cc6f8880256 100644
--- a/dlls/wined3d/wined3d_gl.h
+++ b/dlls/wined3d/wined3d_gl.h
@@ -199,8 +199,6 @@ enum wined3d_gl_extension
     NV_VERTEX_PROGRAM2,
     NV_VERTEX_PROGRAM2_OPTION,
     NV_VERTEX_PROGRAM3,
-    /* SGI */
-    SGIS_GENERATE_MIPMAP,
     /* WGL extensions */
     WGL_ARB_PIXEL_FORMAT,
     WGL_EXT_SWAP_CONTROL,
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 334724514df..76306d889f3 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -3101,7 +3101,6 @@ struct wined3d_texture
     unsigned int sysmem_count;
     float pow2_matrix[16];
     UINT lod;
-    enum wined3d_texture_filter_type filter_type;
     DWORD sampler;
     DWORD flags;
     GLenum target;
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h
index 72168e5fa78..3a50c39cd67 100644
--- a/include/wine/wined3d.h
+++ b/include/wine/wined3d.h
@@ -36,7 +36,7 @@
 
 #define _FACWINED3D                                             0x876
 #define MAKE_WINED3DSTATUS(code)                                MAKE_HRESULT(0, _FACWINED3D, code)
-#define WINED3DOK_NOAUTOGEN                                     MAKE_WINED3DSTATUS(2159)
+#define WINED3DOK_NOMIPGEN                                      MAKE_WINED3DSTATUS(2159)
 
 #define MAKE_WINED3DHRESULT(code)                               MAKE_HRESULT(1, _FACWINED3D, code)
 #define WINED3DERR_CONFLICTINGRENDERSTATE                       MAKE_WINED3DHRESULT(2081)
@@ -891,13 +891,12 @@ enum wined3d_shader_byte_code_format
 #define WINED3DUSAGE_RTPATCHES                                  0x00000080
 #define WINED3DUSAGE_NPATCHES                                   0x00000100
 #define WINED3DUSAGE_DYNAMIC                                    0x00000200
-#define WINED3DUSAGE_AUTOGENMIPMAP                              0x00000400
 #define WINED3DUSAGE_RESTRICTED_CONTENT                         0x00000800
 #define WINED3DUSAGE_RESTRICT_SHARED_RESOURCE_DRIVER            0x00001000
 #define WINED3DUSAGE_RESTRICT_SHARED_RESOURCE                   0x00002000
 #define WINED3DUSAGE_DMAP                                       0x00004000
 #define WINED3DUSAGE_TEXTAPI                                    0x10000000
-#define WINED3DUSAGE_MASK                                       0x10007fff
+#define WINED3DUSAGE_MASK                                       0x10007bff
 
 #define WINED3DUSAGE_SCRATCH                                    0x00200000
 #define WINED3DUSAGE_PRIVATE                                    0x00400000
@@ -907,6 +906,7 @@ enum wined3d_shader_byte_code_format
 #define WINED3DUSAGE_STATICDECL                                 0x04000000
 #define WINED3DUSAGE_OVERLAY                                    0x08000000
 
+#define WINED3DUSAGE_QUERY_GENMIPMAP                            0x00000400
 #define WINED3DUSAGE_QUERY_LEGACYBUMPMAP                        0x00008000
 #define WINED3DUSAGE_QUERY_FILTER                               0x00020000
 #define WINED3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING             0x00080000
@@ -914,7 +914,7 @@ enum wined3d_shader_byte_code_format
 #define WINED3DUSAGE_QUERY_SRGBWRITE                            0x00040000
 #define WINED3DUSAGE_QUERY_VERTEXTEXTURE                        0x00100000
 #define WINED3DUSAGE_QUERY_WRAPANDMIP                           0x00200000
-#define WINED3DUSAGE_QUERY_MASK                                 0x003f8000
+#define WINED3DUSAGE_QUERY_MASK                                 0x003f8400
 
 #define WINED3D_MAP_READONLY                                    0x0010
 #define WINED3D_MAP_NOSYSLOCK                                   0x0800
@@ -1170,7 +1170,7 @@ enum wined3d_shader_byte_code_format
 #define WINED3DCAPS2_RESERVED                                   0x02000000
 #define WINED3DCAPS2_CANMANAGERESOURCE                          0x10000000
 #define WINED3DCAPS2_DYNAMICTEXTURES                            0x20000000
-#define WINED3DCAPS2_CANAUTOGENMIPMAP                           0x40000000
+#define WINED3DCAPS2_CANGENMIPMAP                               0x40000000
 
 #define WINED3DPRASTERCAPS_DITHER                               0x00000001
 #define WINED3DPRASTERCAPS_ROP2                                 0x00000002
@@ -2668,7 +2668,6 @@ HRESULT __cdecl wined3d_texture_create(struct wined3d_device *device, const stru
         void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_texture **texture);
 struct wined3d_texture * __cdecl wined3d_texture_from_resource(struct wined3d_resource *resource);
 ULONG __cdecl wined3d_texture_decref(struct wined3d_texture *texture);
-enum wined3d_texture_filter_type __cdecl wined3d_texture_get_autogen_filter_type(const struct wined3d_texture *texture);
 HRESULT __cdecl wined3d_texture_get_dc(struct wined3d_texture *texture, unsigned int sub_resource_idx, HDC *dc);
 DWORD __cdecl wined3d_texture_get_level_count(const struct wined3d_texture *texture);
 DWORD __cdecl wined3d_texture_get_lod(const struct wined3d_texture *texture);
@@ -2683,8 +2682,6 @@ HRESULT __cdecl wined3d_texture_get_sub_resource_desc(const struct wined3d_textu
 void * __cdecl wined3d_texture_get_sub_resource_parent(struct wined3d_texture *texture, unsigned int sub_resource_idx);
 ULONG __cdecl wined3d_texture_incref(struct wined3d_texture *texture);
 HRESULT __cdecl wined3d_texture_release_dc(struct wined3d_texture *texture, unsigned int sub_resource_idx, HDC dc);
-HRESULT __cdecl wined3d_texture_set_autogen_filter_type(struct wined3d_texture *texture,
-        enum wined3d_texture_filter_type filter_type);
 HRESULT __cdecl wined3d_texture_set_color_key(struct wined3d_texture *texture,
         DWORD flags, const struct wined3d_color_key *color_key);
 DWORD __cdecl wined3d_texture_set_lod(struct wined3d_texture *texture, DWORD lod);
-- 
2.13.6




More information about the wine-devel mailing list