mirror of
https://github.com/reactos/wine.git
synced 2024-11-24 04:10:04 +00:00
wined3d: Pass an IWineD3DResourceImpl pointer to resource_init().
This commit is contained in:
parent
d54d410d28
commit
7080922e0e
@ -34,7 +34,7 @@ HRESULT basetexture_init(IWineD3DBaseTextureImpl *texture, const struct wined3d_
|
||||
{
|
||||
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);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
|
@ -1473,7 +1473,7 @@ HRESULT buffer_init(struct wined3d_buffer *buffer, IWineD3DDeviceImpl *device,
|
||||
|
||||
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);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
|
@ -43,28 +43,28 @@ struct private_data
|
||||
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,
|
||||
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;
|
||||
resource->resourceType = resource_type;
|
||||
resource->ref = 1;
|
||||
resource->pool = pool;
|
||||
resource->format = format;
|
||||
resource->usage = usage;
|
||||
resource->size = size;
|
||||
resource->priority = 0;
|
||||
resource->parent = parent;
|
||||
resource->parent_ops = parent_ops;
|
||||
list_init(&resource->privateData);
|
||||
r->device = device;
|
||||
r->resourceType = resource_type;
|
||||
r->ref = 1;
|
||||
r->pool = pool;
|
||||
r->format = format;
|
||||
r->usage = usage;
|
||||
r->size = size;
|
||||
r->priority = 0;
|
||||
r->parent = parent;
|
||||
r->parent_ops = parent_ops;
|
||||
list_init(&r->privateData);
|
||||
|
||||
if (size)
|
||||
{
|
||||
resource->heapMemory = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size + RESOURCE_ALIGNMENT);
|
||||
if (!resource->heapMemory)
|
||||
r->heapMemory = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size + RESOURCE_ALIGNMENT);
|
||||
if (!r->heapMemory)
|
||||
{
|
||||
ERR("Out of memory!\n");
|
||||
return WINED3DERR_OUTOFVIDEOMEMORY;
|
||||
@ -72,9 +72,9 @@ HRESULT resource_init(IWineD3DResource *iface, WINED3DRESOURCETYPE resource_type
|
||||
}
|
||||
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 */
|
||||
if (pool == WINED3DPOOL_DEFAULT)
|
||||
@ -82,13 +82,13 @@ HRESULT resource_init(IWineD3DResource *iface, WINED3DRESOURCETYPE resource_type
|
||||
if (size > IWineD3DDevice_GetAvailableTextureMem((IWineD3DDevice *)device))
|
||||
{
|
||||
ERR("Out of adapter memory\n");
|
||||
HeapFree(GetProcessHeap(), 0, resource->heapMemory);
|
||||
HeapFree(GetProcessHeap(), 0, r->heapMemory);
|
||||
return WINED3DERR_OUTOFVIDEOMEMORY;
|
||||
}
|
||||
WineD3DAdapterChangeGLRam(device, size);
|
||||
}
|
||||
|
||||
device_resource_add(device, iface);
|
||||
device_resource_add(device, (IWineD3DResource *)resource);
|
||||
|
||||
return WINED3D_OK;
|
||||
}
|
||||
|
@ -373,7 +373,7 @@ HRESULT surface_init(IWineD3DSurfaceImpl *surface, WINED3DSURFTYPE surface_type,
|
||||
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);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
|
@ -346,7 +346,7 @@ HRESULT volume_init(IWineD3DVolumeImpl *volume, IWineD3DDeviceImpl *device, UINT
|
||||
|
||||
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);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
|
@ -1833,7 +1833,7 @@ HRESULT resource_free_private_data(IWineD3DResource *iface, REFGUID guid) DECLSP
|
||||
DWORD resource_get_priority(IWineD3DResource *iface) DECLSPEC_HIDDEN;
|
||||
HRESULT resource_get_private_data(IWineD3DResource *iface, REFGUID guid,
|
||||
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,
|
||||
WINED3DPOOL pool, void *parent, const struct wined3d_parent_ops *parent_ops) DECLSPEC_HIDDEN;
|
||||
WINED3DRESOURCETYPE resource_get_type(IWineD3DResource *iface) DECLSPEC_HIDDEN;
|
||||
|
Loading…
Reference in New Issue
Block a user