wined3d: Get rid of wined3d_buffer_get_desc().

This commit is contained in:
Henri Verbeet 2011-03-10 19:07:10 +01:00 committed by Alexandre Julliard
parent 5f73f41f35
commit adb1e10979
7 changed files with 21 additions and 16 deletions

View File

@ -210,11 +210,13 @@ static HRESULT WINAPI d3d8_vertexbuffer_GetDesc(IDirect3DVertexBuffer8 *iface, D
{
IDirect3DVertexBuffer8Impl *buffer = (IDirect3DVertexBuffer8Impl *)iface;
struct wined3d_resource_desc wined3d_desc;
struct wined3d_resource *wined3d_resource;
TRACE("iface %p, desc %p.\n", iface, desc);
wined3d_mutex_lock();
wined3d_buffer_get_desc(buffer->wineD3DVertexBuffer, &wined3d_desc);
wined3d_resource = wined3d_buffer_get_resource(buffer->wineD3DVertexBuffer);
wined3d_resource_get_desc(wined3d_resource, &wined3d_desc);
wined3d_mutex_unlock();
desc->Type = D3DRTYPE_VERTEXBUFFER;
@ -472,11 +474,13 @@ static HRESULT WINAPI d3d8_indexbuffer_GetDesc(IDirect3DIndexBuffer8 *iface, D3D
{
IDirect3DIndexBuffer8Impl *buffer = (IDirect3DIndexBuffer8Impl *)iface;
struct wined3d_resource_desc wined3d_desc;
struct wined3d_resource *wined3d_resource;
TRACE("iface %p, desc %p.\n", iface, desc);
wined3d_mutex_lock();
wined3d_buffer_get_desc(buffer->wineD3DIndexBuffer, &wined3d_desc);
wined3d_resource = wined3d_buffer_get_resource(buffer->wineD3DIndexBuffer);
wined3d_resource_get_desc(wined3d_resource, &wined3d_desc);
wined3d_mutex_unlock();
desc->Format = d3dformat_from_wined3dformat(buffer->format);

View File

@ -212,11 +212,13 @@ static HRESULT WINAPI d3d9_vertexbuffer_GetDesc(IDirect3DVertexBuffer9 *iface, D
{
IDirect3DVertexBuffer9Impl *buffer = (IDirect3DVertexBuffer9Impl *)iface;
struct wined3d_resource_desc wined3d_desc;
struct wined3d_resource *wined3d_resource;
TRACE("iface %p, desc %p.\n", iface, desc);
wined3d_mutex_lock();
wined3d_buffer_get_desc(buffer->wineD3DVertexBuffer, &wined3d_desc);
wined3d_resource = wined3d_buffer_get_resource(buffer->wineD3DVertexBuffer);
wined3d_resource_get_desc(wined3d_resource, &wined3d_desc);
wined3d_mutex_unlock();
desc->Format = D3DFMT_VERTEXDATA;
@ -474,11 +476,13 @@ static HRESULT WINAPI d3d9_indexbuffer_GetDesc(IDirect3DIndexBuffer9 *iface, D3D
{
IDirect3DIndexBuffer9Impl *buffer = (IDirect3DIndexBuffer9Impl *)iface;
struct wined3d_resource_desc wined3d_desc;
struct wined3d_resource *wined3d_resource;
TRACE("iface %p, desc %p.\n", iface, desc);
wined3d_mutex_lock();
wined3d_buffer_get_desc(buffer->wineD3DIndexBuffer, &wined3d_desc);
wined3d_resource = wined3d_buffer_get_resource(buffer->wineD3DIndexBuffer);
wined3d_resource_get_desc(wined3d_resource, &wined3d_desc);
wined3d_mutex_unlock();
desc->Format = d3dformat_from_wined3dformat(buffer->format);

View File

@ -4147,6 +4147,7 @@ IDirect3DDeviceImpl_7_DrawIndexedPrimitiveVB(IDirect3DDevice7 *iface,
IDirect3DDeviceImpl *This = (IDirect3DDeviceImpl *)iface;
IDirect3DVertexBufferImpl *vb = (IDirect3DVertexBufferImpl *)D3DVertexBuf;
DWORD stride = get_flexible_vertex_size(vb->fvf);
struct wined3d_resource *wined3d_resource;
struct wined3d_resource_desc desc;
WORD *LockedIndices;
HRESULT hr;
@ -4174,7 +4175,8 @@ IDirect3DDeviceImpl_7_DrawIndexedPrimitiveVB(IDirect3DDevice7 *iface,
/* check that the buffer is large enough to hold the indices,
* reallocate if necessary. */
wined3d_buffer_get_desc(This->indexbuffer, &desc);
wined3d_resource = wined3d_buffer_get_resource(This->indexbuffer);
wined3d_resource_get_desc(wined3d_resource, &desc);
if (desc.size < IndexCount * sizeof(WORD))
{
UINT size = max(desc.size * 2, IndexCount * sizeof(WORD));

View File

@ -209,6 +209,7 @@ IDirect3DVertexBufferImpl_Lock(IDirect3DVertexBuffer7 *iface,
{
IDirect3DVertexBufferImpl *This = (IDirect3DVertexBufferImpl *)iface;
struct wined3d_resource_desc wined3d_desc;
struct wined3d_resource *wined3d_resource;
HRESULT hr;
DWORD wined3d_flags = 0;
@ -226,7 +227,8 @@ IDirect3DVertexBufferImpl_Lock(IDirect3DVertexBuffer7 *iface,
if(Size)
{
/* Get the size, for returning it, and for locking */
wined3d_buffer_get_desc(This->wineD3DVertexBuffer, &wined3d_desc);
wined3d_resource = wined3d_buffer_get_resource(This->wineD3DVertexBuffer);
wined3d_resource_get_desc(wined3d_resource, &wined3d_desc);
*Size = wined3d_desc.size;
}
@ -401,13 +403,15 @@ IDirect3DVertexBufferImpl_GetVertexBufferDesc(IDirect3DVertexBuffer7 *iface,
{
IDirect3DVertexBufferImpl *This = (IDirect3DVertexBufferImpl *)iface;
struct wined3d_resource_desc wined3d_desc;
struct wined3d_resource *wined3d_resource;
TRACE("iface %p, desc %p.\n", iface, Desc);
if(!Desc) return DDERR_INVALIDPARAMS;
EnterCriticalSection(&ddraw_cs);
wined3d_buffer_get_desc(This->wineD3DVertexBuffer, &wined3d_desc);
wined3d_resource = wined3d_buffer_get_resource(This->wineD3DVertexBuffer);
wined3d_resource_get_desc(wined3d_resource, &wined3d_desc);
LeaveCriticalSection(&ddraw_cs);
/* Now fill the Desc structure */

View File

@ -1395,13 +1395,6 @@ void CDECL wined3d_buffer_unmap(struct wined3d_buffer *buffer)
}
}
void CDECL wined3d_buffer_get_desc(const struct wined3d_buffer *buffer, struct wined3d_resource_desc *desc)
{
TRACE("buffer %p, desc %p.\n", buffer, desc);
wined3d_resource_get_desc(&buffer->resource, desc);
}
static const struct wined3d_resource_ops buffer_resource_ops =
{
buffer_unload,

View File

@ -21,7 +21,6 @@
@ cdecl wined3d_buffer_decref(ptr)
@ cdecl wined3d_buffer_free_private_data(ptr ptr)
@ cdecl wined3d_buffer_get_desc(ptr ptr)
@ cdecl wined3d_buffer_get_parent(ptr)
@ cdecl wined3d_buffer_get_priority(ptr)
@ cdecl wined3d_buffer_get_private_data(ptr ptr ptr ptr)

View File

@ -3162,7 +3162,6 @@ HRESULT __cdecl wined3d_register_software_device(struct wined3d *wined3d, void *
ULONG __cdecl wined3d_buffer_decref(struct wined3d_buffer *buffer);
HRESULT __cdecl wined3d_buffer_free_private_data(struct wined3d_buffer *buffer, REFGUID guid);
void __cdecl wined3d_buffer_get_desc(const struct wined3d_buffer *buffer, struct wined3d_resource_desc *desc);
void * __cdecl wined3d_buffer_get_parent(const struct wined3d_buffer *buffer);
DWORD __cdecl wined3d_buffer_get_priority(const struct wined3d_buffer *buffer);
HRESULT __cdecl wined3d_buffer_get_private_data(const struct wined3d_buffer *buffer,