Module: wine Branch: master Commit: a6f2c003a3ec264132b7a92415924aff817a0c56 URL: http://source.winehq.org/git/wine.git/?a=commit;h=a6f2c003a3ec264132b7a92415... Author: Misha Koshelev <misha680(a)gmail.com> Date: Wed Sep 22 18:42:48 2010 -0500 d3dx9_36: D3DXDeclaratorFromFVF returns D3DERR_INVALIDCALL when an invalid declarator is passed. --- dlls/d3dx9_36/mesh.c | 2 ++ dlls/d3dx9_36/tests/mesh.c | 2 ++ 2 files changed, 4 insertions(+), 0 deletions(-) diff --git a/dlls/d3dx9_36/mesh.c b/dlls/d3dx9_36/mesh.c index 844d521..166000f 100644 --- a/dlls/d3dx9_36/mesh.c +++ b/dlls/d3dx9_36/mesh.c @@ -559,6 +559,8 @@ HRESULT WINAPI D3DXDeclaratorFromFVF(DWORD fvf, D3DVERTEXELEMENT9 declaration[MA TRACE("fvf %#x, declaration %p.\n", fvf, declaration); + if (fvf & (D3DFVF_RESERVED0 | D3DFVF_RESERVED2)) return D3DERR_INVALIDCALL; + if (fvf & D3DFVF_POSITION_MASK) { BOOL has_blend = (fvf & D3DFVF_XYZB5) >= D3DFVF_XYZB1; diff --git a/dlls/d3dx9_36/tests/mesh.c b/dlls/d3dx9_36/tests/mesh.c index 05df51e..c55a3c7 100644 --- a/dlls/d3dx9_36/tests/mesh.c +++ b/dlls/d3dx9_36/tests/mesh.c @@ -836,6 +836,8 @@ static void test_fvf_decl_conversion(void) }; test_decl_to_fvf(decl, 0, D3DERR_INVALIDCALL, __LINE__, 0); } + /* Invalid FVFs cannot be converted to a declarator. */ + test_fvf_to_decl(0xdeadbeef, NULL, D3DERR_INVALIDCALL, __LINE__, 0); } static void D3DXGetFVFVertexSizeTest(void)