st/nine: Some D3DUSAGE_AUTOGENMIPMAP fixes

Signed-off-by: Axel Davy <axel.davy@ens.fr>
This commit is contained in:
Axel Davy 2015-02-20 12:11:56 +01:00
parent 24eca6a30d
commit 6f57e01436
3 changed files with 17 additions and 2 deletions

View File

@ -1214,6 +1214,13 @@ NineDevice9_UpdateTexture( struct NineDevice9 *This,
if (dstb->base.usage & D3DUSAGE_AUTOGENMIPMAP) { if (dstb->base.usage & D3DUSAGE_AUTOGENMIPMAP) {
/* Only the first level is updated, the others regenerated. */ /* Only the first level is updated, the others regenerated. */
last_level = 0; last_level = 0;
/* if the source has D3DUSAGE_AUTOGENMIPMAP, we have to ignore
* the sublevels, thus level 0 has to match */
user_assert(!(srcb->base.usage & D3DUSAGE_AUTOGENMIPMAP) ||
(srcb->base.info.width0 == dstb->base.info.width0 &&
srcb->base.info.height0 == dstb->base.info.height0 &&
srcb->base.info.depth0 == dstb->base.info.depth0),
D3DERR_INVALIDCALL);
} else { } else {
user_assert(!(srcb->base.usage & D3DUSAGE_AUTOGENMIPMAP), D3DERR_INVALIDCALL); user_assert(!(srcb->base.usage & D3DUSAGE_AUTOGENMIPMAP), D3DERR_INVALIDCALL);
} }
@ -1276,8 +1283,10 @@ NineDevice9_UpdateTexture( struct NineDevice9 *This,
assert(!"invalid texture type"); assert(!"invalid texture type");
} }
if (dstb->base.usage & D3DUSAGE_AUTOGENMIPMAP) if (dstb->base.usage & D3DUSAGE_AUTOGENMIPMAP) {
dstb->dirty_mip = TRUE;
NineBaseTexture9_GenerateMipSubLevels(dstb); NineBaseTexture9_GenerateMipSubLevels(dstb);
}
return D3D_OK; return D3D_OK;
} }
@ -1509,6 +1518,9 @@ NineDevice9_StretchRect( struct NineDevice9 *This,
&blit.src.box); &blit.src.box);
} }
/* Communicate the container it needs to update sublevels - if apply */
NineSurface9_MarkContainerDirty(dst);
return D3D_OK; return D3D_OK;
} }

View File

@ -232,7 +232,7 @@ NineSurface9_GetContainer( struct NineSurface9 *This,
return hr; return hr;
} }
static INLINE void void
NineSurface9_MarkContainerDirty( struct NineSurface9 *This ) NineSurface9_MarkContainerDirty( struct NineSurface9 *This )
{ {
if (This->texture) { if (This->texture) {

View File

@ -83,6 +83,9 @@ NineSurface9_dtor( struct NineSurface9 *This );
/*** Nine private ***/ /*** Nine private ***/
void
NineSurface9_MarkContainerDirty( struct NineSurface9 *This );
struct pipe_surface * struct pipe_surface *
NineSurface9_CreatePipeSurface( struct NineSurface9 *This, const int sRGB ); NineSurface9_CreatePipeSurface( struct NineSurface9 *This, const int sRGB );