Commit 7080922e authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Pass an IWineD3DResourceImpl pointer to resource_init().

parent d54d410d
...@@ -34,7 +34,7 @@ HRESULT basetexture_init(IWineD3DBaseTextureImpl *texture, const struct wined3d_ ...@@ -34,7 +34,7 @@ HRESULT basetexture_init(IWineD3DBaseTextureImpl *texture, const struct wined3d_
{ {
HRESULT hr; HRESULT hr;
hr = resource_init((IWineD3DResource *)texture, resource_type, device, hr = resource_init((IWineD3DResourceImpl *)texture, resource_type, device,
0, usage, format, pool, parent, parent_ops); 0, usage, format, pool, parent, parent_ops);
if (FAILED(hr)) if (FAILED(hr))
{ {
......
...@@ -1473,7 +1473,7 @@ HRESULT buffer_init(struct wined3d_buffer *buffer, IWineD3DDeviceImpl *device, ...@@ -1473,7 +1473,7 @@ HRESULT buffer_init(struct wined3d_buffer *buffer, IWineD3DDeviceImpl *device,
buffer->vtbl = &wined3d_buffer_vtbl; buffer->vtbl = &wined3d_buffer_vtbl;
hr = resource_init((IWineD3DResource *)buffer, WINED3DRTYPE_BUFFER, hr = resource_init((IWineD3DResourceImpl *)buffer, WINED3DRTYPE_BUFFER,
device, size, usage, format, pool, parent, parent_ops); device, size, usage, format, pool, parent, parent_ops);
if (FAILED(hr)) if (FAILED(hr))
{ {
......
...@@ -43,28 +43,28 @@ struct private_data ...@@ -43,28 +43,28 @@ struct private_data
DWORD size; DWORD size;
}; };
HRESULT resource_init(IWineD3DResource *iface, WINED3DRESOURCETYPE resource_type, HRESULT resource_init(struct IWineD3DResourceImpl *resource, WINED3DRESOURCETYPE resource_type,
IWineD3DDeviceImpl *device, UINT size, DWORD usage, const struct wined3d_format *format, IWineD3DDeviceImpl *device, UINT size, DWORD usage, const struct wined3d_format *format,
WINED3DPOOL pool, void *parent, const struct wined3d_parent_ops *parent_ops) WINED3DPOOL pool, void *parent, const struct wined3d_parent_ops *parent_ops)
{ {
struct IWineD3DResourceClass *resource = &((IWineD3DResourceImpl *)iface)->resource; struct IWineD3DResourceClass *r = &resource->resource;
resource->device = device; r->device = device;
resource->resourceType = resource_type; r->resourceType = resource_type;
resource->ref = 1; r->ref = 1;
resource->pool = pool; r->pool = pool;
resource->format = format; r->format = format;
resource->usage = usage; r->usage = usage;
resource->size = size; r->size = size;
resource->priority = 0; r->priority = 0;
resource->parent = parent; r->parent = parent;
resource->parent_ops = parent_ops; r->parent_ops = parent_ops;
list_init(&resource->privateData); list_init(&r->privateData);
if (size) if (size)
{ {
resource->heapMemory = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size + RESOURCE_ALIGNMENT); r->heapMemory = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size + RESOURCE_ALIGNMENT);
if (!resource->heapMemory) if (!r->heapMemory)
{ {
ERR("Out of memory!\n"); ERR("Out of memory!\n");
return WINED3DERR_OUTOFVIDEOMEMORY; return WINED3DERR_OUTOFVIDEOMEMORY;
...@@ -72,9 +72,9 @@ HRESULT resource_init(IWineD3DResource *iface, WINED3DRESOURCETYPE resource_type ...@@ -72,9 +72,9 @@ HRESULT resource_init(IWineD3DResource *iface, WINED3DRESOURCETYPE resource_type
} }
else else
{ {
resource->heapMemory = NULL; r->heapMemory = NULL;
} }
resource->allocatedMemory = (BYTE *)(((ULONG_PTR)resource->heapMemory + (RESOURCE_ALIGNMENT - 1)) & ~(RESOURCE_ALIGNMENT - 1)); r->allocatedMemory = (BYTE *)(((ULONG_PTR)r->heapMemory + (RESOURCE_ALIGNMENT - 1)) & ~(RESOURCE_ALIGNMENT - 1));
/* Check that we have enough video ram left */ /* Check that we have enough video ram left */
if (pool == WINED3DPOOL_DEFAULT) if (pool == WINED3DPOOL_DEFAULT)
...@@ -82,13 +82,13 @@ HRESULT resource_init(IWineD3DResource *iface, WINED3DRESOURCETYPE resource_type ...@@ -82,13 +82,13 @@ HRESULT resource_init(IWineD3DResource *iface, WINED3DRESOURCETYPE resource_type
if (size > IWineD3DDevice_GetAvailableTextureMem((IWineD3DDevice *)device)) if (size > IWineD3DDevice_GetAvailableTextureMem((IWineD3DDevice *)device))
{ {
ERR("Out of adapter memory\n"); ERR("Out of adapter memory\n");
HeapFree(GetProcessHeap(), 0, resource->heapMemory); HeapFree(GetProcessHeap(), 0, r->heapMemory);
return WINED3DERR_OUTOFVIDEOMEMORY; return WINED3DERR_OUTOFVIDEOMEMORY;
} }
WineD3DAdapterChangeGLRam(device, size); WineD3DAdapterChangeGLRam(device, size);
} }
device_resource_add(device, iface); device_resource_add(device, (IWineD3DResource *)resource);
return WINED3D_OK; return WINED3D_OK;
} }
......
...@@ -373,7 +373,7 @@ HRESULT surface_init(IWineD3DSurfaceImpl *surface, WINED3DSURFTYPE surface_type, ...@@ -373,7 +373,7 @@ HRESULT surface_init(IWineD3DSurfaceImpl *surface, WINED3DSURFTYPE surface_type,
return WINED3DERR_INVALIDCALL; return WINED3DERR_INVALIDCALL;
} }
hr = resource_init((IWineD3DResource *)surface, WINED3DRTYPE_SURFACE, hr = resource_init((IWineD3DResourceImpl *)surface, WINED3DRTYPE_SURFACE,
device, resource_size, usage, format, pool, parent, parent_ops); device, resource_size, usage, format, pool, parent, parent_ops);
if (FAILED(hr)) if (FAILED(hr))
{ {
......
...@@ -346,7 +346,7 @@ HRESULT volume_init(IWineD3DVolumeImpl *volume, IWineD3DDeviceImpl *device, UINT ...@@ -346,7 +346,7 @@ HRESULT volume_init(IWineD3DVolumeImpl *volume, IWineD3DDeviceImpl *device, UINT
volume->lpVtbl = &IWineD3DVolume_Vtbl; volume->lpVtbl = &IWineD3DVolume_Vtbl;
hr = resource_init((IWineD3DResource *)volume, WINED3DRTYPE_VOLUME, device, hr = resource_init((IWineD3DResourceImpl *)volume, WINED3DRTYPE_VOLUME, device,
width * height * depth * format->byte_count, usage, format, pool, parent, parent_ops); width * height * depth * format->byte_count, usage, format, pool, parent, parent_ops);
if (FAILED(hr)) if (FAILED(hr))
{ {
......
...@@ -1833,7 +1833,7 @@ HRESULT resource_free_private_data(IWineD3DResource *iface, REFGUID guid) DECLSP ...@@ -1833,7 +1833,7 @@ HRESULT resource_free_private_data(IWineD3DResource *iface, REFGUID guid) DECLSP
DWORD resource_get_priority(IWineD3DResource *iface) DECLSPEC_HIDDEN; DWORD resource_get_priority(IWineD3DResource *iface) DECLSPEC_HIDDEN;
HRESULT resource_get_private_data(IWineD3DResource *iface, REFGUID guid, HRESULT resource_get_private_data(IWineD3DResource *iface, REFGUID guid,
void *data, DWORD *data_size) DECLSPEC_HIDDEN; void *data, DWORD *data_size) DECLSPEC_HIDDEN;
HRESULT resource_init(IWineD3DResource *iface, WINED3DRESOURCETYPE resource_type, HRESULT resource_init(struct IWineD3DResourceImpl *resource, WINED3DRESOURCETYPE resource_type,
IWineD3DDeviceImpl *device, UINT size, DWORD usage, const struct wined3d_format *format, IWineD3DDeviceImpl *device, UINT size, DWORD usage, const struct wined3d_format *format,
WINED3DPOOL pool, void *parent, const struct wined3d_parent_ops *parent_ops) DECLSPEC_HIDDEN; WINED3DPOOL pool, void *parent, const struct wined3d_parent_ops *parent_ops) DECLSPEC_HIDDEN;
WINED3DRESOURCETYPE resource_get_type(IWineD3DResource *iface) DECLSPEC_HIDDEN; WINED3DRESOURCETYPE resource_get_type(IWineD3DResource *iface) DECLSPEC_HIDDEN;
......
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