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

Alexandre Julliard julliard at winehq.org
Mon Feb 8 15:46:42 CST 2021


Module: wine
Branch: master
Commit: 6b7f02026c81d9973c3eb66997e35ffb8c36e8b5
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=6b7f02026c81d9973c3eb66997e35ffb8c36e8b5

Author: Jan Sikorski <jsikorski at codeweavers.com>
Date:   Mon Feb  8 18:50:38 2021 +0100

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

Signed-off-by: Jan Sikorski <jsikorski at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/d3d8/vertexdeclaration.c    | 4 ++++
 dlls/d3d9/vertexdeclaration.c    | 2 ++
 dlls/wined3d/vertexdeclaration.c | 6 +++---
 3 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/dlls/d3d8/vertexdeclaration.c b/dlls/d3d8/vertexdeclaration.c
index 525666d680e..d0e733b9e37 100644
--- a/dlls/d3d8/vertexdeclaration.c
+++ b/dlls/d3d8/vertexdeclaration.c
@@ -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;
     }
 
diff --git a/dlls/d3d9/vertexdeclaration.c b/dlls/d3d9/vertexdeclaration.c
index c30a84313fb..60701a9a910 100644
--- a/dlls/d3d9/vertexdeclaration.c
+++ b/dlls/d3d9/vertexdeclaration.c
@@ -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;
     }
 
diff --git a/dlls/wined3d/vertexdeclaration.c b/dlls/wined3d/vertexdeclaration.c
index e96216db380..b17059f5e64 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).\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;
         }
     }
 




More information about the wine-cvs mailing list