[Mesa-dev] [PATCH 05/12] st/nine: Clean pSharedHandle Texture ctors checks

Axel Davy axel.davy at ens.fr
Sun Feb 7 23:13:12 UTC 2016


Signed-off-by: Axel Davy <axel.davy at ens.fr>
---
 src/gallium/state_trackers/nine/cubetexture9.c   |  7 ++++---
 src/gallium/state_trackers/nine/texture9.c       | 25 ++++++++++++------------
 src/gallium/state_trackers/nine/volumetexture9.c |  7 ++++---
 3 files changed, 21 insertions(+), 18 deletions(-)

diff --git a/src/gallium/state_trackers/nine/cubetexture9.c b/src/gallium/state_trackers/nine/cubetexture9.c
index c6fa397..1749190 100644
--- a/src/gallium/state_trackers/nine/cubetexture9.c
+++ b/src/gallium/state_trackers/nine/cubetexture9.c
@@ -54,12 +54,13 @@ NineCubeTexture9_ctor( struct NineCubeTexture9 *This,
         Format, Pool, pSharedHandle);
 
     user_assert(EdgeLength, D3DERR_INVALIDCALL);
-    user_assert(!pSharedHandle || Pool == D3DPOOL_DEFAULT, D3DERR_INVALIDCALL);
-    user_assert(!(Usage & D3DUSAGE_AUTOGENMIPMAP) ||
-                (Pool != D3DPOOL_SYSTEMMEM && Levels <= 1), D3DERR_INVALIDCALL);
 
+    /* user_assert(!pSharedHandle || Pool == D3DPOOL_DEFAULT, D3DERR_INVALIDCALL); */
     user_assert(!pSharedHandle, D3DERR_INVALIDCALL); /* TODO */
 
+    user_assert(!(Usage & D3DUSAGE_AUTOGENMIPMAP) ||
+                (Pool != D3DPOOL_SYSTEMMEM && Levels <= 1), D3DERR_INVALIDCALL);
+
     if (Usage & D3DUSAGE_AUTOGENMIPMAP)
         Levels = 0;
 
diff --git a/src/gallium/state_trackers/nine/texture9.c b/src/gallium/state_trackers/nine/texture9.c
index 7338215..3052937 100644
--- a/src/gallium/state_trackers/nine/texture9.c
+++ b/src/gallium/state_trackers/nine/texture9.c
@@ -61,18 +61,22 @@ NineTexture9_ctor( struct NineTexture9 *This,
         d3dformat_to_string(Format), nine_D3DPOOL_to_str(Pool), pSharedHandle);
 
     user_assert(Width && Height, D3DERR_INVALIDCALL);
+
+    /* pSharedHandle: can be non-null for ex only.
+     * D3DPOOL_SYSTEMMEM: Levels must be 1
+     * D3DPOOL_DEFAULT: no restriction for Levels
+     * Other Pools are forbidden. */
     user_assert(!pSharedHandle || pParams->device->ex, D3DERR_INVALIDCALL);
-    /* When is used shared handle, Pool must be
-     * SYSTEMMEM with Levels 1 or DEFAULT with any Levels */
-    user_assert(!pSharedHandle || Pool != D3DPOOL_SYSTEMMEM || Levels == 1,
-                D3DERR_INVALIDCALL);
-    user_assert(!pSharedHandle || Pool == D3DPOOL_SYSTEMMEM || Pool == D3DPOOL_DEFAULT,
-                D3DERR_INVALIDCALL);
-    user_assert((Usage != D3DUSAGE_AUTOGENMIPMAP || Levels <= 1), D3DERR_INVALIDCALL);
+    user_assert(!pSharedHandle ||
+                (Pool == D3DPOOL_SYSTEMMEM && Levels == 1) ||
+                Pool == D3DPOOL_DEFAULT, D3DERR_INVALIDCALL);
+
     user_assert(!(Usage & D3DUSAGE_AUTOGENMIPMAP) ||
-                (Pool != D3DPOOL_SYSTEMMEM && Levels <= 1), D3DERR_INVALIDCALL);
+                (Pool != D3DPOOL_SYSTEMMEM && Pool != D3DPOOL_SCRATCH && Levels <= 1),
+                D3DERR_INVALIDCALL);
 
-    /* TODO: implement buffer sharing (should work with cross process too)
+    /* TODO: implement pSharedHandle for D3DPOOL_DEFAULT (cross process
+     * buffer sharing).
      *
      * Gem names may have fit but they're depreciated and won't work on render-nodes.
      * One solution is to use shm buffers. We would use a /dev/shm file, fill the first
@@ -85,9 +89,6 @@ NineTexture9_ctor( struct NineTexture9 *This,
      * invalid handle, that we would fail to import. Please note that we don't advertise
      * the flag indicating the support for that feature, but apps seem to not care.
      */
-    user_assert(!pSharedHandle ||
-                Pool == D3DPOOL_SYSTEMMEM ||
-                Pool == D3DPOOL_DEFAULT, D3DERR_INVALIDCALL);
 
     if (pSharedHandle && Pool == D3DPOOL_DEFAULT) {
         if (!*pSharedHandle) {
diff --git a/src/gallium/state_trackers/nine/volumetexture9.c b/src/gallium/state_trackers/nine/volumetexture9.c
index cdfe7f2..cdec21f 100644
--- a/src/gallium/state_trackers/nine/volumetexture9.c
+++ b/src/gallium/state_trackers/nine/volumetexture9.c
@@ -49,14 +49,15 @@ NineVolumeTexture9_ctor( struct NineVolumeTexture9 *This,
         Usage, Format, Pool, pSharedHandle);
 
     user_assert(Width && Height && Depth, D3DERR_INVALIDCALL);
-    user_assert(!pSharedHandle || Pool == D3DPOOL_DEFAULT, D3DERR_INVALIDCALL);
+
+    /* user_assert(!pSharedHandle || Pool == D3DPOOL_DEFAULT, D3DERR_INVALIDCALL); */
+    user_assert(!pSharedHandle, D3DERR_INVALIDCALL); /* TODO */
+
     /* An IDirect3DVolume9 cannot be bound as a render target can it ? */
     user_assert(!(Usage & (D3DUSAGE_RENDERTARGET | D3DUSAGE_DEPTHSTENCIL)),
                 D3DERR_INVALIDCALL);
     user_assert(!(Usage & D3DUSAGE_AUTOGENMIPMAP), D3DERR_INVALIDCALL);
 
-    user_assert(!pSharedHandle, D3DERR_INVALIDCALL); /* TODO */
-
     pf = d3d9_to_pipe_format_checked(screen, Format, PIPE_TEXTURE_3D, 0,
                                      PIPE_BIND_SAMPLER_VIEW, FALSE);
     if (pf == PIPE_FORMAT_NONE)
-- 
2.7.0



More information about the mesa-dev mailing list