[2/2] d3dx9: Implement UpdateSemantics mesh method. (try 2)

Dylan Smith dylan.ah.smith at gmail.com
Fri Jun 10 01:08:56 CDT 2011

Your patches have dos line endings (i.e. "\r\n") which causes git apply to
fail, although the patch command only gives a warning.

@@ -208,6 +221,12 @@ static DWORD WINAPI
> ID3DXMeshImpl_GetNumBytesPerVertex(ID3DXMesh *iface)
>     TRACE("iface (%p)\n", This);
> +    if (!This->vertex_declaration)
> +    {
> +        WARN("Can't get number of bytes per vertex of an invalid vertex
> declaration.\n");
> +        return E_FAIL;
> +    }

GetNumBytesPerVertex returns a DWORD not an HRESULT, so I wouldn't expect
E_FAIL to ever be returned? Unusual behaviour like this should be covered by
a test.

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

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.

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

I did some testing and couldn'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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20110610/977d911e/attachment.htm>

More information about the wine-devel mailing list