Commit e4cfbdd4 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Get rid of D3DCREATERESOURCEOBJECTINSTANCE.

parent 7d9b7453
...@@ -27,6 +27,50 @@ ...@@ -27,6 +27,50 @@
WINE_DEFAULT_DEBUG_CHANNEL(d3d); WINE_DEFAULT_DEBUG_CHANNEL(d3d);
#define GLINFO_LOCATION ((IWineD3DImpl *)(((IWineD3DDeviceImpl *)This->resource.wineD3DDevice)->wineD3D))->gl_info #define GLINFO_LOCATION ((IWineD3DImpl *)(((IWineD3DDeviceImpl *)This->resource.wineD3DDevice)->wineD3D))->gl_info
HRESULT resource_init(struct IWineD3DResourceClass *resource, WINED3DRESOURCETYPE resource_type,
IWineD3DDeviceImpl *device, UINT size, DWORD usage, WINED3DFORMAT format, WINED3DPOOL pool, IUnknown *parent)
{
resource->wineD3DDevice = device;
resource->parent = parent;
resource->resourceType = resource_type;
resource->ref = 1;
resource->pool = pool;
resource->format = format;
resource->usage = usage;
resource->size = size;
resource->priority = 0;
list_init(&resource->privateData);
if (size)
{
resource->heapMemory = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size + RESOURCE_ALIGNMENT);
if (!resource->heapMemory)
{
ERR("Out of memory!\n");
return WINED3DERR_OUTOFVIDEOMEMORY;
}
}
else
{
resource->heapMemory = NULL;
}
resource->allocatedMemory = (BYTE *)(((ULONG_PTR)resource->heapMemory + (RESOURCE_ALIGNMENT - 1)) & ~(RESOURCE_ALIGNMENT - 1));
/* Check that we have enough video ram left */
if (pool == WINED3DPOOL_DEFAULT)
{
if (size > IWineD3DDevice_GetAvailableTextureMem((IWineD3DDevice *)device))
{
ERR("Out of adapter memory\n");
HeapFree(GetProcessHeap(), 0, resource->heapMemory);
return WINED3DERR_OUTOFVIDEOMEMORY;
}
WineD3DAdapterChangeGLRam(device, size);
}
return WINED3D_OK;
}
void resource_cleanup(IWineD3DResource *iface) void resource_cleanup(IWineD3DResource *iface)
{ {
IWineD3DResourceImpl *This = (IWineD3DResourceImpl *)iface; IWineD3DResourceImpl *This = (IWineD3DResourceImpl *)iface;
......
...@@ -1238,6 +1238,8 @@ HRESULT resource_get_parent(IWineD3DResource *iface, IUnknown **parent); ...@@ -1238,6 +1238,8 @@ HRESULT resource_get_parent(IWineD3DResource *iface, IUnknown **parent);
DWORD resource_get_priority(IWineD3DResource *iface); DWORD resource_get_priority(IWineD3DResource *iface);
HRESULT resource_get_private_data(IWineD3DResource *iface, REFGUID guid, HRESULT resource_get_private_data(IWineD3DResource *iface, REFGUID guid,
void *data, DWORD *data_size); void *data, DWORD *data_size);
HRESULT resource_init(struct IWineD3DResourceClass *resource, WINED3DRESOURCETYPE resource_type,
IWineD3DDeviceImpl *device, UINT size, DWORD usage, WINED3DFORMAT format, WINED3DPOOL pool, IUnknown *parent);
WINED3DRESOURCETYPE resource_get_type(IWineD3DResource *iface); WINED3DRESOURCETYPE resource_get_type(IWineD3DResource *iface);
DWORD resource_set_priority(IWineD3DResource *iface, DWORD new_priority); DWORD resource_set_priority(IWineD3DResource *iface, DWORD new_priority);
HRESULT resource_set_private_data(IWineD3DResource *iface, REFGUID guid, HRESULT resource_set_private_data(IWineD3DResource *iface, REFGUID guid,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment