st/nine: use get_pipe_acquire/release when possible
[mesa.git] / src / gallium / state_trackers / nine / volumetexture9.c
index cdfe7f281986b2ae32f503b771c299532d0846e6..4908ed7b5ef505ddd5466886bf6159b54b9db96f 100644 (file)
@@ -49,20 +49,23 @@ 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);
+                                     PIPE_BIND_SAMPLER_VIEW, FALSE,
+                                     Pool == D3DPOOL_SCRATCH);
+
     if (pf == PIPE_FORMAT_NONE)
         return D3DERR_INVALIDCALL;
 
-    /* We support ATI1 and ATI2 hacks only for 2D textures */
+    /* We support ATI1 and ATI2 hacks only for 2D and Cube textures */
     if (Format == D3DFMT_ATI1 || Format == D3DFMT_ATI2)
         return D3DERR_INVALIDCALL;
 
@@ -91,9 +94,6 @@ NineVolumeTexture9_ctor( struct NineVolumeTexture9 *This,
 
     if (Usage & D3DUSAGE_DYNAMIC) {
         info->usage = PIPE_USAGE_DYNAMIC;
-        info->bind |=
-            PIPE_BIND_TRANSFER_READ |
-            PIPE_BIND_TRANSFER_WRITE;
     }
     if (Usage & D3DUSAGE_SOFTWAREPROCESSING)
         DBG("Application asked for Software Vertex Processing, "
@@ -147,7 +147,7 @@ NineVolumeTexture9_dtor( struct NineVolumeTexture9 *This )
     NineBaseTexture9_dtor(&This->base);
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineVolumeTexture9_GetLevelDesc( struct NineVolumeTexture9 *This,
                                  UINT Level,
                                  D3DVOLUME_DESC *pDesc )
@@ -159,7 +159,7 @@ NineVolumeTexture9_GetLevelDesc( struct NineVolumeTexture9 *This,
     return D3D_OK;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineVolumeTexture9_GetVolumeLevel( struct NineVolumeTexture9 *This,
                                    UINT Level,
                                    IDirect3DVolume9 **ppVolumeLevel )
@@ -172,7 +172,7 @@ NineVolumeTexture9_GetVolumeLevel( struct NineVolumeTexture9 *This,
     return D3D_OK;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineVolumeTexture9_LockBox( struct NineVolumeTexture9 *This,
                             UINT Level,
                             D3DLOCKED_BOX *pLockedVolume,
@@ -188,7 +188,7 @@ NineVolumeTexture9_LockBox( struct NineVolumeTexture9 *This,
                                Flags);
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineVolumeTexture9_UnlockBox( struct NineVolumeTexture9 *This,
                               UINT Level )
 {
@@ -199,7 +199,7 @@ NineVolumeTexture9_UnlockBox( struct NineVolumeTexture9 *This,
     return NineVolume9_UnlockBox(This->volumes[Level]);
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineVolumeTexture9_AddDirtyBox( struct NineVolumeTexture9 *This,
                                 const D3DBOX *pDirtyBox )
 {
@@ -243,9 +243,9 @@ IDirect3DVolumeTexture9Vtbl NineVolumeTexture9_vtable = {
     (void *)NineUnknown_AddRef,
     (void *)NineUnknown_Release,
     (void *)NineUnknown_GetDevice, /* actually part of Resource9 iface */
-    (void *)NineResource9_SetPrivateData,
-    (void *)NineResource9_GetPrivateData,
-    (void *)NineResource9_FreePrivateData,
+    (void *)NineUnknown_SetPrivateData,
+    (void *)NineUnknown_GetPrivateData,
+    (void *)NineUnknown_FreePrivateData,
     (void *)NineResource9_SetPriority,
     (void *)NineResource9_GetPriority,
     (void *)NineBaseTexture9_PreLoad,