Your patches have dos line endings (i.e. &quot;\r\n&quot;) which causes git apply to fail, although the patch command only gives a warning.<br><br><br><blockquote class="gmail_quote" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; ">

@@ -208,6 +221,12 @@ static DWORD WINAPI ID3DXMeshImpl_GetNumBytesPerVertex(ID3DXMesh *iface)<br>     TRACE(&quot;iface (%p)\n&quot;, This);<br>+    if (!This-&gt;vertex_declaration)<br>+    {<br>+        WARN(&quot;Can&#39;t get number of bytes per vertex of an invalid vertex declaration.\n&quot;);<br>

+        return E_FAIL;<br>+    }</blockquote>  <br>GetNumBytesPerVertex returns a DWORD not an HRESULT, so I wouldn&#39;t expect E_FAIL to ever be returned? Unusual behaviour like this should be covered by a test.<br><br>

<br><blockquote class="gmail_quote" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; ">

+    /* An application can pass an invalid declaration to UpdateSemantics and<br>+     * still expect D3D_OK (see tests). If the declaration is invalid, then<br>+     * subsequent calls to GetDeclaration, GetNumBytesPerVertex, and DrawSubset,<br>

+     * which use the declaration, will fail.<br>+     */</blockquote><br>D3DXCreateMesh fails when the declaration contains a non-zero Stream value. I would expect UpdateSemantics to be as strict as D3DXCreateMesh, otherwise a test could validate the different behaviour.<br>

<br>You tested a declaration with larger fields, but not with the vertex size being smaller or greater. (E.g. Try removing the last field, or appending a field.)<br><br>I did some testing and couldn&#39;t get GetDeclaration or GetNumBytesPerVertex to fail on windows.  DrawSubset did seem to fail after UpdateSemantics is called with a declaration that causes CreateVertexDeclaration to fail. This suggests that the native implementation probably just stores the D3DVERTEXELEMENT9 array and calls CreateVertexDeclaration on DrawSubset. You can probably cache the created vertex declaration and release it on UpdateSemantics for performance.