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

This commit is contained in:
Michael Stefaniuc 2013-02-05 15:49:14 +01:00 committed by Alexandre Julliard
parent ef4b7c5948
commit 50a9fb579c
18 changed files with 2 additions and 63 deletions

View file

@ -1153,10 +1153,8 @@ static void *atifs_alloc(const struct wined3d_shader_backend_ops *shader_backend
struct atifs_private_data *priv;
if (!(priv = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*priv))))
{
ERR("Out of memory.\n");
return NULL;
}
if (wine_rb_init(&priv->fragment_shaders, &wined3d_ffp_frag_program_rb_functions) == -1)
{
ERR("Failed to initialize rbtree.\n");

View file

@ -1283,10 +1283,7 @@ HRESULT CDECL wined3d_buffer_create(struct wined3d_device *device, struct wined3
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
if (!object)
{
ERR("Failed to allocate memory\n");
return E_OUTOFMEMORY;
}
FIXME("Ignoring access flags (pool)\n");
@ -1328,7 +1325,6 @@ HRESULT CDECL wined3d_buffer_create_vb(struct wined3d_device *device, UINT size,
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
if (!object)
{
ERR("Out of memory\n");
*buffer = NULL;
return WINED3DERR_OUTOFVIDEOMEMORY;
}
@ -1360,7 +1356,6 @@ HRESULT CDECL wined3d_buffer_create_ib(struct wined3d_device *device, UINT size,
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
if (!object)
{
ERR("Out of memory\n");
*buffer = NULL;
return WINED3DERR_OUTOFVIDEOMEMORY;
}

View file

@ -1277,10 +1277,7 @@ struct wined3d_context *context_create(struct wined3d_swapchain *swapchain,
ret = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*ret));
if (!ret)
{
ERR("Failed to allocate context memory.\n");
return NULL;
}
ret->blit_targets = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
gl_info->limits.buffers * sizeof(*ret->blit_targets));

View file

@ -1765,10 +1765,8 @@ HRESULT CDECL wined3d_device_set_light(struct wined3d_device *device,
TRACE("Adding new light\n");
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
if (!object)
{
ERR("Out of memory error when allocating a light\n");
return E_OUTOFMEMORY;
}
list_add_head(&device->updateStateBlock->state.light_map[hash_idx], &object->entry);
object->glIndex = -1;
object->OriginalIndex = light_idx;

View file

@ -4780,10 +4780,7 @@ HRESULT CDECL wined3d_device_create(struct wined3d *wined3d, UINT adapter_idx, e
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
if (!object)
{
ERR("Failed to allocate device memory.\n");
return E_OUTOFMEMORY;
}
hr = device_init(object, wined3d, adapter_idx, device_type,
focus_window, flags, surface_alignment, device_parent);

View file

@ -5446,10 +5446,7 @@ static struct glsl_ffp_fragment_shader *shader_glsl_find_ffp_fragment_shader(str
return CONTAINING_RECORD(desc, struct glsl_ffp_fragment_shader, entry);
if (!(glsl_desc = HeapAlloc(GetProcessHeap(), 0, sizeof(*glsl_desc))))
{
ERR("Failed to allocate ffp desc memory.\n");
return NULL;
}
glsl_desc->entry.settings = *args;
glsl_desc->id = shader_glsl_generate_ffp_fragment_shader(&priv->shader_buffer, args, gl_info);

View file

@ -199,10 +199,7 @@ HRESULT CDECL wined3d_palette_create(struct wined3d_device *device, DWORD flags,
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
if (!object)
{
ERR("Failed to allocate palette memory.\n");
return E_OUTOFMEMORY;
}
hr = wined3d_palette_init(object, device, flags, entries, parent);
if (FAILED(hr))

View file

@ -610,10 +610,7 @@ HRESULT CDECL wined3d_query_create(struct wined3d_device *device,
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
if (!object)
{
ERR("Failed to allocate query memory.\n");
return E_OUTOFMEMORY;
}
hr = query_init(object, device, type);
if (FAILED(hr))

View file

@ -65,10 +65,7 @@ HRESULT CDECL wined3d_sampler_create(void *parent, struct wined3d_sampler **samp
TRACE("parent %p, sampler %p.\n", parent, sampler);
if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object))))
{
ERR("Failed to allocate memory.\n");
return E_OUTOFMEMORY;
}
wined3d_sampler_init(object, parent);

View file

@ -1510,10 +1510,7 @@ static HRESULT shader_none_alloc(struct wined3d_device *device, const struct fra
void *fragment_priv;
if (!(priv = HeapAlloc(GetProcessHeap(), 0, sizeof(*priv))))
{
ERR("Failed to allocate private data.\n");
return E_OUTOFMEMORY;
}
if (!(fragment_priv = fragment_pipe->alloc_private(&none_shader_backend, priv)))
{
@ -2303,10 +2300,7 @@ HRESULT CDECL wined3d_shader_create_gs(struct wined3d_device *device, const DWOR
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
if (!object)
{
ERR("Failed to allocate shader memory.\n");
return E_OUTOFMEMORY;
}
hr = geometryshader_init(object, device, byte_code, output_signature, parent, parent_ops, max_version);
if (FAILED(hr))
@ -2334,10 +2328,7 @@ HRESULT CDECL wined3d_shader_create_ps(struct wined3d_device *device, const DWOR
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
if (!object)
{
ERR("Failed to allocate shader memory.\n");
return E_OUTOFMEMORY;
}
hr = pixelshader_init(object, device, byte_code, output_signature, parent, parent_ops, max_version);
if (FAILED(hr))
@ -2365,10 +2356,7 @@ HRESULT CDECL wined3d_shader_create_vs(struct wined3d_device *device, const DWOR
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
if (!object)
{
ERR("Failed to allocate shader memory.\n");
return E_OUTOFMEMORY;
}
hr = vertexshader_init(object, device, byte_code, output_signature, parent, parent_ops, max_version);
if (FAILED(hr))

View file

@ -530,10 +530,7 @@ static void *shader_sm1_init(const DWORD *byte_code, const struct wined3d_shader
priv = HeapAlloc(GetProcessHeap(), 0, sizeof(*priv));
if (!priv)
{
ERR("Failed to allocate private data\n");
return NULL;
}
if (output_signature)
{

View file

@ -1451,10 +1451,7 @@ HRESULT CDECL wined3d_stateblock_create(struct wined3d_device *device,
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
if (!object)
{
ERR("Failed to allocate stateblock memory.\n");
return E_OUTOFMEMORY;
}
hr = stateblock_init(object, device, type);
if (FAILED(hr))

View file

@ -7247,10 +7247,7 @@ HRESULT CDECL wined3d_surface_create(struct wined3d_device *device, UINT width,
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
if (!object)
{
ERR("Failed to allocate surface memory.\n");
return WINED3DERR_OUTOFVIDEOMEMORY;
}
if (FAILED(hr = surface_init(object, device->surface_alignment, width, height, multisample_type,
multisample_quality, device, usage, format_id, pool, flags, parent, parent_ops)))

View file

@ -1098,10 +1098,7 @@ HRESULT CDECL wined3d_swapchain_create(struct wined3d_device *device, struct win
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
if (!object)
{
ERR("Failed to allocate swapchain memory.\n");
return E_OUTOFMEMORY;
}
hr = swapchain_init(object, device, desc, parent, parent_ops);
if (FAILED(hr))

View file

@ -1251,7 +1251,6 @@ HRESULT CDECL wined3d_texture_create_2d(struct wined3d_device *device, UINT widt
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
if (!object)
{
ERR("Out of memory.\n");
*texture = NULL;
return WINED3DERR_OUTOFVIDEOMEMORY;
}
@ -1287,7 +1286,6 @@ HRESULT CDECL wined3d_texture_create_3d(struct wined3d_device *device, UINT widt
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
if (!object)
{
ERR("Out of memory\n");
*texture = NULL;
return WINED3DERR_OUTOFVIDEOMEMORY;
}
@ -1323,7 +1321,6 @@ HRESULT CDECL wined3d_texture_create_cube(struct wined3d_device *device, UINT ed
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
if (!object)
{
ERR("Out of memory\n");
*texture = NULL;
return WINED3DERR_OUTOFVIDEOMEMORY;
}

View file

@ -252,10 +252,7 @@ HRESULT CDECL wined3d_vertex_declaration_create(struct wined3d_device *device,
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
if(!object)
{
ERR("Failed to allocate vertex declaration memory.\n");
return E_OUTOFMEMORY;
}
hr = vertexdeclaration_init(object, device, elements, element_count, parent, parent_ops);
if (FAILED(hr))

View file

@ -77,10 +77,7 @@ HRESULT CDECL wined3d_rendertarget_view_create(struct wined3d_resource *resource
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
if (!object)
{
ERR("Failed to allocate memory\n");
return E_OUTOFMEMORY;
}
wined3d_rendertarget_view_init(object, resource, parent);

View file

@ -312,7 +312,6 @@ HRESULT CDECL wined3d_volume_create(struct wined3d_device *device, UINT width, U
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
if (!object)
{
ERR("Out of memory\n");
*volume = NULL;
return WINED3DERR_OUTOFVIDEOMEMORY;
}