Commit d86ecd4b authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

d3d9: Remove ERR() on HeapAlloc failure for small sizes known at compile time.

parent 14c38955
...@@ -40,10 +40,7 @@ IDirect3D9 * WINAPI DECLSPEC_HOTPATCH Direct3DCreate9(UINT sdk_version) ...@@ -40,10 +40,7 @@ IDirect3D9 * WINAPI DECLSPEC_HOTPATCH Direct3DCreate9(UINT sdk_version)
TRACE("sdk_version %#x.\n", sdk_version); TRACE("sdk_version %#x.\n", sdk_version);
if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)))) if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object))))
{
ERR("Failed to allocate d3d9 object memory.\n");
return NULL; return NULL;
}
if (!d3d9_init(object, FALSE)) if (!d3d9_init(object, FALSE))
{ {
...@@ -64,10 +61,7 @@ HRESULT WINAPI DECLSPEC_HOTPATCH Direct3DCreate9Ex(UINT sdk_version, IDirect3D9E ...@@ -64,10 +61,7 @@ HRESULT WINAPI DECLSPEC_HOTPATCH Direct3DCreate9Ex(UINT sdk_version, IDirect3D9E
TRACE("sdk_version %#x, d3d9ex %p.\n", sdk_version, d3d9ex); TRACE("sdk_version %#x, d3d9ex %p.\n", sdk_version, d3d9ex);
if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)))) if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object))))
{
ERR("Failed to allocate d3d9 object memory.\n");
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
}
if (!d3d9_init(object, TRUE)) if (!d3d9_init(object, TRUE))
{ {
......
...@@ -734,10 +734,7 @@ static HRESULT WINAPI d3d9_device_CreateTexture(IDirect3DDevice9Ex *iface, ...@@ -734,10 +734,7 @@ static HRESULT WINAPI d3d9_device_CreateTexture(IDirect3DDevice9Ex *iface,
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
if (!object) if (!object)
{
ERR("Failed to allocate texture memory.\n");
return D3DERR_OUTOFVIDEOMEMORY; return D3DERR_OUTOFVIDEOMEMORY;
}
hr = texture_init(object, device, width, height, levels, usage, format, pool); hr = texture_init(object, device, width, height, levels, usage, format, pool);
if (FAILED(hr)) if (FAILED(hr))
...@@ -781,10 +778,7 @@ static HRESULT WINAPI d3d9_device_CreateVolumeTexture(IDirect3DDevice9Ex *iface, ...@@ -781,10 +778,7 @@ static HRESULT WINAPI d3d9_device_CreateVolumeTexture(IDirect3DDevice9Ex *iface,
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
if (!object) if (!object)
{
ERR("Failed to allocate volume texture memory.\n");
return D3DERR_OUTOFVIDEOMEMORY; return D3DERR_OUTOFVIDEOMEMORY;
}
hr = volumetexture_init(object, device, width, height, depth, levels, usage, format, pool); hr = volumetexture_init(object, device, width, height, depth, levels, usage, format, pool);
if (FAILED(hr)) if (FAILED(hr))
...@@ -816,10 +810,7 @@ static HRESULT WINAPI d3d9_device_CreateCubeTexture(IDirect3DDevice9Ex *iface, ...@@ -816,10 +810,7 @@ static HRESULT WINAPI d3d9_device_CreateCubeTexture(IDirect3DDevice9Ex *iface,
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
if (!object) if (!object)
{
ERR("Failed to allocate cube texture memory.\n");
return D3DERR_OUTOFVIDEOMEMORY; return D3DERR_OUTOFVIDEOMEMORY;
}
hr = cubetexture_init(object, device, edge_length, levels, usage, format, pool); hr = cubetexture_init(object, device, edge_length, levels, usage, format, pool);
if (FAILED(hr)) if (FAILED(hr))
...@@ -851,10 +842,7 @@ static HRESULT WINAPI d3d9_device_CreateVertexBuffer(IDirect3DDevice9Ex *iface, ...@@ -851,10 +842,7 @@ static HRESULT WINAPI d3d9_device_CreateVertexBuffer(IDirect3DDevice9Ex *iface,
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
if (!object) if (!object)
{
ERR("Failed to allocate buffer memory.\n");
return D3DERR_OUTOFVIDEOMEMORY; return D3DERR_OUTOFVIDEOMEMORY;
}
hr = vertexbuffer_init(object, device, size, usage, fvf, pool); hr = vertexbuffer_init(object, device, size, usage, fvf, pool);
if (FAILED(hr)) if (FAILED(hr))
...@@ -886,10 +874,7 @@ static HRESULT WINAPI d3d9_device_CreateIndexBuffer(IDirect3DDevice9Ex *iface, U ...@@ -886,10 +874,7 @@ static HRESULT WINAPI d3d9_device_CreateIndexBuffer(IDirect3DDevice9Ex *iface, U
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
if (!object) if (!object)
{
ERR("Failed to allocate buffer memory.\n");
return D3DERR_OUTOFVIDEOMEMORY; return D3DERR_OUTOFVIDEOMEMORY;
}
hr = indexbuffer_init(object, device, size, usage, format, pool); hr = indexbuffer_init(object, device, size, usage, format, pool);
if (FAILED(hr)) if (FAILED(hr))
...@@ -1559,10 +1544,7 @@ static HRESULT WINAPI d3d9_device_CreateStateBlock(IDirect3DDevice9Ex *iface, ...@@ -1559,10 +1544,7 @@ static HRESULT WINAPI d3d9_device_CreateStateBlock(IDirect3DDevice9Ex *iface,
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
if (!object) if (!object)
{
ERR("Failed to allocate stateblock memory.\n");
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
}
hr = stateblock_init(object, device, type, NULL); hr = stateblock_init(object, device, type, NULL);
if (FAILED(hr)) if (FAILED(hr))
...@@ -1613,7 +1595,6 @@ static HRESULT WINAPI d3d9_device_EndStateBlock(IDirect3DDevice9Ex *iface, IDire ...@@ -1613,7 +1595,6 @@ static HRESULT WINAPI d3d9_device_EndStateBlock(IDirect3DDevice9Ex *iface, IDire
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
if (!object) if (!object)
{ {
ERR("Failed to allocate stateblock memory.\n");
wined3d_mutex_lock(); wined3d_mutex_lock();
wined3d_stateblock_decref(wined3d_stateblock); wined3d_stateblock_decref(wined3d_stateblock);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
...@@ -2413,10 +2394,7 @@ static HRESULT WINAPI d3d9_device_CreateVertexShader(IDirect3DDevice9Ex *iface, ...@@ -2413,10 +2394,7 @@ static HRESULT WINAPI d3d9_device_CreateVertexShader(IDirect3DDevice9Ex *iface,
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
if (!object) if (!object)
{
ERR("Failed to allocate vertex shader memory.\n");
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
}
hr = vertexshader_init(object, device, byte_code); hr = vertexshader_init(object, device, byte_code);
if (FAILED(hr)) if (FAILED(hr))
...@@ -2896,10 +2874,7 @@ static HRESULT WINAPI d3d9_device_CreateQuery(IDirect3DDevice9Ex *iface, D3DQUER ...@@ -2896,10 +2874,7 @@ static HRESULT WINAPI d3d9_device_CreateQuery(IDirect3DDevice9Ex *iface, D3DQUER
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
if (!object) if (!object)
{
ERR("Failed to allocate query memory.\n");
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
}
hr = query_init(object, device, type); hr = query_init(object, device, type);
if (FAILED(hr)) if (FAILED(hr))
......
...@@ -456,10 +456,7 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH d3d9_CreateDevice(IDirect3D9Ex *iface, U ...@@ -456,10 +456,7 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH d3d9_CreateDevice(IDirect3D9Ex *iface, U
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
if (!object) if (!object)
{
ERR("Failed to allocate device memory.\n");
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
}
hr = device_init(object, d3d9, d3d9->wined3d, adapter, device_type, focus_window, flags, parameters, NULL); hr = device_init(object, d3d9, d3d9->wined3d, adapter, device_type, focus_window, flags, parameters, NULL);
if (FAILED(hr)) if (FAILED(hr))
...@@ -567,10 +564,7 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH d3d9_CreateDeviceEx(IDirect3D9Ex *iface, ...@@ -567,10 +564,7 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH d3d9_CreateDeviceEx(IDirect3D9Ex *iface,
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
if (!object) if (!object)
{
ERR("Failed to allocate device memory.\n");
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
}
hr = device_init(object, d3d9, d3d9->wined3d, adapter, device_type, focus_window, flags, parameters, mode); hr = device_init(object, d3d9, d3d9->wined3d, adapter, device_type, focus_window, flags, parameters, mode);
if (FAILED(hr)) if (FAILED(hr))
......
...@@ -278,10 +278,7 @@ HRESULT d3d9_swapchain_create(struct d3d9_device *device, struct wined3d_swapcha ...@@ -278,10 +278,7 @@ HRESULT d3d9_swapchain_create(struct d3d9_device *device, struct wined3d_swapcha
HRESULT hr; HRESULT hr;
if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)))) if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object))))
{
ERR("Failed to allocate swapchain memory.\n");
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
}
if (FAILED(hr = swapchain_init(object, device, desc))) if (FAILED(hr = swapchain_init(object, device, desc)))
{ {
......
...@@ -419,10 +419,7 @@ HRESULT d3d9_vertex_declaration_create(struct d3d9_device *device, ...@@ -419,10 +419,7 @@ HRESULT d3d9_vertex_declaration_create(struct d3d9_device *device,
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
if (!object) if (!object)
{
ERR("Failed to allocate vertex declaration memory.\n");
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
}
hr = vertexdeclaration_init(object, device, elements); hr = vertexdeclaration_init(object, device, elements);
if (FAILED(hr)) if (FAILED(hr))
......
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