st/nine: Remove volume9 {Set/Get/Free}PrivateData functions
Remove {Set/Get/Free}PrivateData in volume9.
Functionality has been implement in IUnknown interface.
Signed-off-by: Patrick Rudolph <siro@das-labor.org>
Reviewed-by: Axel Davy <axel.davy@ens.fr>
This commit is contained in:
committed by
Axel Davy
parent
485cba7eb4
commit
03888e8a46
@@ -3114,44 +3114,6 @@ LockVolume9_GetDevice( struct NineVolume9 *This,
|
||||
}
|
||||
#endif
|
||||
|
||||
static HRESULT NINE_WINAPI
|
||||
LockVolume9_SetPrivateData( struct NineVolume9 *This,
|
||||
REFGUID refguid,
|
||||
const void *pData,
|
||||
DWORD SizeOfData,
|
||||
DWORD Flags )
|
||||
{
|
||||
HRESULT r;
|
||||
pipe_mutex_lock(d3dlock_global);
|
||||
r = NineVolume9_SetPrivateData(This, refguid, pData, SizeOfData, Flags);
|
||||
pipe_mutex_unlock(d3dlock_global);
|
||||
return r;
|
||||
}
|
||||
|
||||
static HRESULT NINE_WINAPI
|
||||
LockVolume9_GetPrivateData( struct NineVolume9 *This,
|
||||
REFGUID refguid,
|
||||
void *pData,
|
||||
DWORD *pSizeOfData )
|
||||
{
|
||||
HRESULT r;
|
||||
pipe_mutex_lock(d3dlock_global);
|
||||
r = NineVolume9_GetPrivateData(This, refguid, pData, pSizeOfData);
|
||||
pipe_mutex_unlock(d3dlock_global);
|
||||
return r;
|
||||
}
|
||||
|
||||
static HRESULT NINE_WINAPI
|
||||
LockVolume9_FreePrivateData( struct NineVolume9 *This,
|
||||
REFGUID refguid )
|
||||
{
|
||||
HRESULT r;
|
||||
pipe_mutex_lock(d3dlock_global);
|
||||
r = NineVolume9_FreePrivateData(This, refguid);
|
||||
pipe_mutex_unlock(d3dlock_global);
|
||||
return r;
|
||||
}
|
||||
|
||||
static HRESULT NINE_WINAPI
|
||||
LockVolume9_GetContainer( struct NineVolume9 *This,
|
||||
REFIID riid,
|
||||
|
||||
@@ -28,10 +28,8 @@
|
||||
#include "nine_pipe.h"
|
||||
#include "nine_dump.h"
|
||||
|
||||
#include "util/u_hash_table.h"
|
||||
#include "util/u_format.h"
|
||||
#include "util/u_surface.h"
|
||||
#include "nine_pdata.h"
|
||||
|
||||
#define DBG_CHANNEL DBG_VOLUME
|
||||
|
||||
@@ -77,10 +75,6 @@ NineVolume9_ctor( struct NineVolume9 *This,
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
This->pdata = util_hash_table_create(ht_guid_hash, ht_guid_compare);
|
||||
if (!This->pdata)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
pipe_resource_reference(&This->resource, pResource);
|
||||
|
||||
This->pipe = pParams->device->pipe;
|
||||
@@ -539,98 +533,3 @@ NineVolume9_new( struct NineDevice9 *pDevice,
|
||||
NINE_DEVICE_CHILD_NEW(Volume9, ppOut, pDevice, /* args */
|
||||
pContainer, pResource, Level, pDesc);
|
||||
}
|
||||
|
||||
|
||||
/*** The boring stuff. TODO: Unify with Resource. ***/
|
||||
|
||||
HRESULT NINE_WINAPI
|
||||
NineVolume9_SetPrivateData( struct NineVolume9 *This,
|
||||
REFGUID refguid,
|
||||
const void *pData,
|
||||
DWORD SizeOfData,
|
||||
DWORD Flags )
|
||||
{
|
||||
enum pipe_error err;
|
||||
struct pheader *header;
|
||||
const void *user_data = pData;
|
||||
|
||||
DBG("This=%p refguid=%p pData=%p SizeOfData=%d Flags=%d\n",
|
||||
This, refguid, pData, SizeOfData, Flags);
|
||||
|
||||
if (Flags & D3DSPD_IUNKNOWN)
|
||||
user_assert(SizeOfData == sizeof(IUnknown *), D3DERR_INVALIDCALL);
|
||||
|
||||
/* data consists of a header and the actual data. avoiding 2 mallocs */
|
||||
header = CALLOC_VARIANT_LENGTH_STRUCT(pheader, SizeOfData-1);
|
||||
if (!header) { return E_OUTOFMEMORY; }
|
||||
header->unknown = (Flags & D3DSPD_IUNKNOWN) ? TRUE : FALSE;
|
||||
|
||||
/* if the refguid already exists, delete it */
|
||||
NineVolume9_FreePrivateData(This, refguid);
|
||||
|
||||
/* IUnknown special case */
|
||||
if (header->unknown) {
|
||||
/* here the pointer doesn't point to the data we want, so point at the
|
||||
* pointer making what we eventually copy is the pointer itself */
|
||||
user_data = &pData;
|
||||
}
|
||||
|
||||
header->size = SizeOfData;
|
||||
memcpy(header->data, user_data, header->size);
|
||||
|
||||
err = util_hash_table_set(This->pdata, refguid, header);
|
||||
if (err == PIPE_OK) {
|
||||
if (header->unknown) { IUnknown_AddRef(*(IUnknown **)header->data); }
|
||||
return D3D_OK;
|
||||
}
|
||||
|
||||
FREE(header);
|
||||
if (err == PIPE_ERROR_OUT_OF_MEMORY) { return E_OUTOFMEMORY; }
|
||||
|
||||
return D3DERR_DRIVERINTERNALERROR;
|
||||
}
|
||||
|
||||
HRESULT NINE_WINAPI
|
||||
NineVolume9_GetPrivateData( struct NineVolume9 *This,
|
||||
REFGUID refguid,
|
||||
void *pData,
|
||||
DWORD *pSizeOfData )
|
||||
{
|
||||
struct pheader *header;
|
||||
|
||||
user_assert(pSizeOfData, E_POINTER);
|
||||
|
||||
header = util_hash_table_get(This->pdata, refguid);
|
||||
if (!header) { return D3DERR_NOTFOUND; }
|
||||
|
||||
if (!pData) {
|
||||
*pSizeOfData = header->size;
|
||||
return D3D_OK;
|
||||
}
|
||||
if (*pSizeOfData < header->size) {
|
||||
return D3DERR_MOREDATA;
|
||||
}
|
||||
|
||||
if (header->unknown) { IUnknown_AddRef(*(IUnknown **)header->data); }
|
||||
memcpy(pData, header->data, header->size);
|
||||
|
||||
return D3D_OK;
|
||||
}
|
||||
|
||||
HRESULT NINE_WINAPI
|
||||
NineVolume9_FreePrivateData( struct NineVolume9 *This,
|
||||
REFGUID refguid )
|
||||
{
|
||||
struct pheader *header;
|
||||
|
||||
DBG("This=%p refguid=%p\n", This, refguid);
|
||||
|
||||
header = util_hash_table_get(This->pdata, refguid);
|
||||
if (!header) { return D3DERR_NOTFOUND; }
|
||||
|
||||
ht_guid_delete(NULL, header, NULL);
|
||||
util_hash_table_remove(This->pdata, refguid);
|
||||
|
||||
return D3D_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -55,9 +55,6 @@ struct NineVolume9
|
||||
unsigned lock_count;
|
||||
|
||||
struct pipe_context *pipe;
|
||||
|
||||
/* for [GS]etPrivateData/FreePrivateData */
|
||||
struct util_hash_table *pdata;
|
||||
};
|
||||
static inline struct NineVolume9 *
|
||||
NineVolume9( void *data )
|
||||
@@ -100,23 +97,6 @@ NineVolume9_UploadSelf( struct NineVolume9 *This,
|
||||
|
||||
/*** Direct3D public ***/
|
||||
|
||||
HRESULT NINE_WINAPI
|
||||
NineVolume9_SetPrivateData( struct NineVolume9 *This,
|
||||
REFGUID refguid,
|
||||
const void *pData,
|
||||
DWORD SizeOfData,
|
||||
DWORD Flags );
|
||||
|
||||
HRESULT NINE_WINAPI
|
||||
NineVolume9_GetPrivateData( struct NineVolume9 *This,
|
||||
REFGUID refguid,
|
||||
void *pData,
|
||||
DWORD *pSizeOfData );
|
||||
|
||||
HRESULT NINE_WINAPI
|
||||
NineVolume9_FreePrivateData( struct NineVolume9 *This,
|
||||
REFGUID refguid );
|
||||
|
||||
HRESULT NINE_WINAPI
|
||||
NineVolume9_GetContainer( struct NineVolume9 *This,
|
||||
REFIID riid,
|
||||
|
||||
Reference in New Issue
Block a user