st/nine: Some D3DUSAGE_AUTOGENMIPMAP fixes
authorAxel Davy <axel.davy@ens.fr>
Fri, 20 Feb 2015 11:11:56 +0000 (12:11 +0100)
committerAxel Davy <axel.davy@ens.fr>
Wed, 29 Apr 2015 06:28:11 +0000 (08:28 +0200)
Signed-off-by: Axel Davy <axel.davy@ens.fr>
src/gallium/state_trackers/nine/device9.c
src/gallium/state_trackers/nine/surface9.c
src/gallium/state_trackers/nine/surface9.h

index ce2ea7696409070c1671cb88e6409658db9d4f30..466b9376ce5956e5ada9694714e51a33974de4d1 100644 (file)
@@ -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;
 }
 
index 36e108dd48bb35528c771aa1048ec1c15f379f1a..e46afd91157499b2c2efb0baccd41f619e675d5d 100644 (file)
@@ -232,7 +232,7 @@ NineSurface9_GetContainer( struct NineSurface9 *This,
     return hr;
 }
 
-static INLINE void
+void
 NineSurface9_MarkContainerDirty( struct NineSurface9 *This )
 {
     if (This->texture) {
index aa586f37e3c0c08367d8b35259133934e2fdb964..0e527fe003afe601160df1313a1c3d2c860966a2 100644 (file)
@@ -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 );