[PATCH v2 2/4] wined3d: Adjust error codes for vertex declaration creation.

Jan Sikorski jsikorski at codeweavers.com
Mon Feb 8 04:41:51 CST 2021


Signed-off-by: Jan Sikorski <jsikorski at codeweavers.com>
---
 dlls/d3d8/vertexdeclaration.c    | 8 ++++++--
 dlls/d3d9/vertexdeclaration.c    | 4 +++-
 dlls/wined3d/vertexdeclaration.c | 8 ++++----
 3 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/dlls/d3d8/vertexdeclaration.c b/dlls/d3d8/vertexdeclaration.c
index 525666d680e..08c18500e1e 100644
--- a/dlls/d3d8/vertexdeclaration.c
+++ b/dlls/d3d8/vertexdeclaration.c
@@ -356,8 +356,10 @@ HRESULT d3d8_vertex_declaration_init(struct d3d8_vertex_declaration *declaration
     heap_free(wined3d_elements);
     if (FAILED(hr))
     {
-        WARN("Failed to create wined3d vertex declaration, hr %#x.\n", hr);
+        WARN("Failed to create wined3d vertex declaration, hr %#x.%s\n", hr, hr == E_INVALIDARG ? " Returning E_FAIL." : "");
         heap_free(declaration->elements);
+        if (hr == E_INVALIDARG)
+            hr = E_FAIL;
         return hr;
     }
 
@@ -378,7 +380,9 @@ HRESULT d3d8_vertex_declaration_init_fvf(struct d3d8_vertex_declaration *declara
             &d3d8_vertexdeclaration_wined3d_parent_ops, &declaration->wined3d_vertex_declaration);
     if (FAILED(hr))
     {
-        WARN("Failed to create wined3d vertex declaration, hr %#x.\n", hr);
+        WARN("Failed to create wined3d vertex declaration, hr %#x.%s\n", hr, hr == E_INVALIDARG ? " Returning E_FAIL." : "");
+        if (hr == E_INVALIDARG)
+            hr = E_FAIL;
         return hr;
     }
 
diff --git a/dlls/d3d9/vertexdeclaration.c b/dlls/d3d9/vertexdeclaration.c
index c30a84313fb..73f6381f257 100644
--- a/dlls/d3d9/vertexdeclaration.c
+++ b/dlls/d3d9/vertexdeclaration.c
@@ -405,7 +405,9 @@ static HRESULT vertexdeclaration_init(struct d3d9_vertex_declaration *declaratio
     if (FAILED(hr))
     {
         heap_free(declaration->elements);
-        WARN("Failed to create wined3d vertex declaration, hr %#x.\n", hr);
+        WARN("Failed to create wined3d vertex declaration, hr %#x.%s\n", hr, hr == E_INVALIDARG ? " Returning E_FAIL." : "");
+        if (hr == E_INVALIDARG)
+            hr = E_FAIL;
         return hr;
     }
 
diff --git a/dlls/wined3d/vertexdeclaration.c b/dlls/wined3d/vertexdeclaration.c
index ec8e2bc1d24..fdc0376a9f1 100644
--- a/dlls/wined3d/vertexdeclaration.c
+++ b/dlls/wined3d/vertexdeclaration.c
@@ -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), returning E_INVALIDARG.\n",
                     debug_d3dformat(elements[i].format));
             heap_free(declaration->elements);
-            return E_FAIL;
+            return E_INVALIDARG;
         }
 
         if (e->offset == WINED3D_APPEND_ALIGNED_ELEMENT)
@@ -250,10 +250,10 @@ static HRESULT vertexdeclaration_init(struct wined3d_vertex_declaration *declara
         }
 
         if (e->offset & (alignment - 1)) {
-            WARN("Declaration element %u with format %s is not %d byte aligned(%u). returning E_FAIL.\n",
+            WARN("Declaration element %u with format %s is not %d byte aligned(%u). returning E_INVALIDARG.\n",
                     i, debug_d3dformat(elements[i].format), alignment, e->offset);
             heap_free(declaration->elements);
-            return E_FAIL;
+            return E_INVALIDARG;
         }
     }
 
-- 
2.30.0




More information about the wine-devel mailing list