From 6f57e014365563c0dcc32451401a76212abf0a54 Mon Sep 17 00:00:00 2001 From: Axel Davy Date: Fri, 20 Feb 2015 12:11:56 +0100 Subject: [PATCH] st/nine: Some D3DUSAGE_AUTOGENMIPMAP fixes Signed-off-by: Axel Davy --- src/gallium/state_trackers/nine/device9.c | 14 +++++++++++++- src/gallium/state_trackers/nine/surface9.c | 2 +- src/gallium/state_trackers/nine/surface9.h | 3 +++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/gallium/state_trackers/nine/device9.c b/src/gallium/state_trackers/nine/device9.c index ce2ea769640..466b9376ce5 100644 --- a/src/gallium/state_trackers/nine/device9.c +++ b/src/gallium/state_trackers/nine/device9.c @@ -1214,6 +1214,13 @@ NineDevice9_UpdateTexture( struct NineDevice9 *This, if (dstb->base.usage & D3DUSAGE_AUTOGENMIPMAP) { /* Only the first level is updated, the others regenerated. */ 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 { user_assert(!(srcb->base.usage & D3DUSAGE_AUTOGENMIPMAP), D3DERR_INVALIDCALL); } @@ -1276,8 +1283,10 @@ NineDevice9_UpdateTexture( struct NineDevice9 *This, assert(!"invalid texture type"); } - if (dstb->base.usage & D3DUSAGE_AUTOGENMIPMAP) + if (dstb->base.usage & D3DUSAGE_AUTOGENMIPMAP) { + dstb->dirty_mip = TRUE; NineBaseTexture9_GenerateMipSubLevels(dstb); + } return D3D_OK; } @@ -1509,6 +1518,9 @@ NineDevice9_StretchRect( struct NineDevice9 *This, &blit.src.box); } + /* Communicate the container it needs to update sublevels - if apply */ + NineSurface9_MarkContainerDirty(dst); + return D3D_OK; } diff --git a/src/gallium/state_trackers/nine/surface9.c b/src/gallium/state_trackers/nine/surface9.c index 36e108dd48b..e46afd91157 100644 --- a/src/gallium/state_trackers/nine/surface9.c +++ b/src/gallium/state_trackers/nine/surface9.c @@ -232,7 +232,7 @@ NineSurface9_GetContainer( struct NineSurface9 *This, return hr; } -static INLINE void +void NineSurface9_MarkContainerDirty( struct NineSurface9 *This ) { if (This->texture) { diff --git a/src/gallium/state_trackers/nine/surface9.h b/src/gallium/state_trackers/nine/surface9.h index aa586f37e3c..0e527fe003a 100644 --- a/src/gallium/state_trackers/nine/surface9.h +++ b/src/gallium/state_trackers/nine/surface9.h @@ -83,6 +83,9 @@ NineSurface9_dtor( struct NineSurface9 *This ); /*** Nine private ***/ +void +NineSurface9_MarkContainerDirty( struct NineSurface9 *This ); + struct pipe_surface * NineSurface9_CreatePipeSurface( struct NineSurface9 *This, const int sRGB ); -- 2.30.2