[Mesa-dev] [PATCH 09/11] st/nine: Some D3DUSAGE_AUTOGENMIPMAP fixes

Axel Davy axel.davy at ens.fr
Fri Apr 24 13:11:24 PDT 2015


Signed-off-by: Axel Davy <axel.davy at ens.fr>
---
 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 698c4e3..2bb1398 100644
--- a/src/gallium/state_trackers/nine/device9.c
+++ b/src/gallium/state_trackers/nine/device9.c
@@ -1198,6 +1198,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);
     }
@@ -1260,8 +1267,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;
 }
@@ -1493,6 +1502,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 2706efa..de81e0d 100644
--- a/src/gallium/state_trackers/nine/surface9.c
+++ b/src/gallium/state_trackers/nine/surface9.c
@@ -231,7 +231,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 aa586f3..0e527fe 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.1.0



More information about the mesa-dev mailing list