wined3d: Add texture flag for mipmap generation.

Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Matteo Bruni 2017-11-24 23:30:00 +01:00 committed by Alexandre Julliard
parent 9f11f4adf1
commit 22eabf1db7
3 changed files with 17 additions and 1 deletions

View File

@ -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,

View File

@ -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

View File

@ -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