wined3d: Resource size should always be non-zero in resource_init().
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
afe4f54bb4
commit
d3baf0355a
|
@ -91,6 +91,9 @@ HRESULT resource_init(struct wined3d_resource *resource, struct wined3d_device *
|
|||
return WINED3DERR_INVALIDCALL;
|
||||
}
|
||||
|
||||
if (!size)
|
||||
ERR("Attempting to create a zero-sized resource.\n");
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(resource_types); ++i)
|
||||
{
|
||||
if (resource_types[i].type != type
|
||||
|
@ -188,17 +191,10 @@ HRESULT resource_init(struct wined3d_resource *resource, struct wined3d_device *
|
|||
resource->resource_ops = resource_ops;
|
||||
resource->map_binding = WINED3D_LOCATION_SYSMEM;
|
||||
|
||||
if (size)
|
||||
if (!wined3d_resource_allocate_sysmem(resource))
|
||||
{
|
||||
if (!wined3d_resource_allocate_sysmem(resource))
|
||||
{
|
||||
ERR("Failed to allocate system memory.\n");
|
||||
return E_OUTOFMEMORY;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
resource->heap_memory = NULL;
|
||||
ERR("Failed to allocate system memory.\n");
|
||||
return E_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
if (!(usage & WINED3DUSAGE_PRIVATE))
|
||||
|
|
Loading…
Reference in New Issue