diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c index ef8545d003a..7a8e1fb7d18 100644 --- a/dlls/wined3d/texture.c +++ b/dlls/wined3d/texture.c @@ -384,6 +384,15 @@ static HRESULT wined3d_texture_init(struct wined3d_texture *texture, const struc texture->flags |= WINED3D_TEXTURE_GET_DC; if (flags & WINED3D_TEXTURE_CREATE_DISCARD) texture->flags |= WINED3D_TEXTURE_DISCARD; + if (flags & WINED3D_TEXTURE_CREATE_GENERATE_MIPMAPS) + { + if (~format->flags[WINED3D_GL_RES_TYPE_TEX_2D] + & (WINED3DFMT_FLAG_RENDERTARGET | WINED3DFMT_FLAG_FILTERING)) + WARN("Format doesn't support mipmaps generation, " + "ignoring WINED3D_TEXTURE_CREATE_GENERATE_MIPMAPS flag.\n"); + else + texture->flags |= WINED3D_TEXTURE_GENERATE_MIPMAPS; + } return WINED3D_OK; } @@ -1573,8 +1582,13 @@ BOOL wined3d_texture_prepare_location(struct wined3d_texture *texture, unsigned void CDECL wined3d_texture_generate_mipmaps(struct wined3d_texture *texture) { - /* TODO: Implement filters using GL_SGI_generate_mipmaps. */ FIXME("texture %p stub!\n", texture); + + if (!(texture->flags & WINED3D_TEXTURE_GENERATE_MIPMAPS)) + { + WARN("Texture without the WINED3D_TEXTURE_GENERATE_MIPMAPS flag, ignoring.\n"); + return; + } } static struct wined3d_texture_sub_resource *wined3d_texture_get_sub_resource(struct wined3d_texture *texture, diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index bd4a2102f25..0daa8612841 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -3074,6 +3074,7 @@ struct wined3d_texture_ops #define WINED3D_TEXTURE_DC_IN_USE 0x00001000 #define WINED3D_TEXTURE_DISCARD 0x00002000 #define WINED3D_TEXTURE_GET_DC 0x00004000 +#define WINED3D_TEXTURE_GENERATE_MIPMAPS 0x00008000 #define WINED3D_TEXTURE_ASYNC_COLOR_KEY 0x00000001 diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h index f35d9806e3f..a0ac7ba02f0 100644 --- a/include/wine/wined3d.h +++ b/include/wine/wined3d.h @@ -1538,6 +1538,7 @@ enum wined3d_shader_byte_code_format #define WINED3D_TEXTURE_CREATE_DISCARD 0x00000002 #define WINED3D_TEXTURE_CREATE_GET_DC_LENIENT 0x00000004 #define WINED3D_TEXTURE_CREATE_GET_DC 0x00000008 +#define WINED3D_TEXTURE_CREATE_GENERATE_MIPMAPS 0x00000010 #define WINED3D_APPEND_ALIGNED_ELEMENT 0xffffffff