Commit 6b7f0202 authored by Jan Sikorski's avatar Jan Sikorski Committed by Alexandre Julliard

wined3d: Return E_INVALIDARG from vertexdeclaration_init() on validation failure.

parent 81dfece4
......@@ -358,6 +358,8 @@ HRESULT d3d8_vertex_declaration_init(struct d3d8_vertex_declaration *declaration
{
WARN("Failed to create wined3d vertex declaration, hr %#x.\n", hr);
heap_free(declaration->elements);
if (hr == E_INVALIDARG)
hr = E_FAIL;
return hr;
}
......@@ -379,6 +381,8 @@ HRESULT d3d8_vertex_declaration_init_fvf(struct d3d8_vertex_declaration *declara
if (FAILED(hr))
{
WARN("Failed to create wined3d vertex declaration, hr %#x.\n", hr);
if (hr == E_INVALIDARG)
hr = E_FAIL;
return hr;
}
......
......@@ -406,6 +406,8 @@ static HRESULT vertexdeclaration_init(struct d3d9_vertex_declaration *declaratio
{
heap_free(declaration->elements);
WARN("Failed to create wined3d vertex declaration, hr %#x.\n", hr);
if (hr == E_INVALIDARG)
hr = E_FAIL;
return hr;
}
......
......@@ -226,10 +226,10 @@ static HRESULT vertexdeclaration_init(struct wined3d_vertex_declaration *declara
if (!(e->format->flags[WINED3D_GL_RES_TYPE_BUFFER] & WINED3DFMT_FLAG_VERTEX_ATTRIBUTE))
{
FIXME("The application tries to use an unsupported format (%s), returning E_FAIL.\n",
FIXME("The application tries to use an unsupported format (%s).\n",
debug_d3dformat(elements[i].format));
heap_free(declaration->elements);
return E_FAIL;
return E_INVALIDARG;
}
if (e->offset == WINED3D_APPEND_ALIGNED_ELEMENT)
......@@ -254,7 +254,7 @@ static HRESULT vertexdeclaration_init(struct wined3d_vertex_declaration *declara
WARN("Declaration element %u with format %s and offset %u is not %u byte aligned.\n",
i, debug_d3dformat(elements[i].format), e->offset, alignment);
heap_free(declaration->elements);
return E_FAIL;
return E_INVALIDARG;
}
}
......
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