From 33617ef296efac88cd7b8b760ff3a8c47669e424 Mon Sep 17 00:00:00 2001 From: Patrick Rudolph Date: Thu, 15 Jan 2015 09:43:33 +0100 Subject: [PATCH] st/nine: Return E_FAIL for unused vertexdeclaration type Add returncode E_FAIL. Return E_FAIL for any vertexdeclaration element with type unused. Reviewed-by: Axel Davy Signed-off-by: Patrick Rudolph --- include/D3D9/d3d9types.h | 1 + src/gallium/state_trackers/nine/vertexdeclaration9.c | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/include/D3D9/d3d9types.h b/include/D3D9/d3d9types.h index e0f1e720ab1..5020934ddfe 100644 --- a/include/D3D9/d3d9types.h +++ b/include/D3D9/d3d9types.h @@ -50,6 +50,7 @@ #define E_OUTOFMEMORY MAKE_HRESULT(1, 0x007, 14) #define E_NOINTERFACE MAKE_HRESULT(1, 0x000, 0x4002) #define E_POINTER MAKE_HRESULT(1, 0x000, 0x4003) +#define E_FAIL MAKE_HRESULT(1, 0x000, 0x4005) #define S_OK ((HRESULT)0) #define S_FALSE ((HRESULT)1) diff --git a/src/gallium/state_trackers/nine/vertexdeclaration9.c b/src/gallium/state_trackers/nine/vertexdeclaration9.c index 08b95e22fc4..49e5937a52e 100644 --- a/src/gallium/state_trackers/nine/vertexdeclaration9.c +++ b/src/gallium/state_trackers/nine/vertexdeclaration9.c @@ -181,10 +181,11 @@ NineVertexDeclaration9_ctor( struct NineVertexDeclaration9 *This, HRESULT hr = NineUnknown_ctor(&This->base, pParams); if (FAILED(hr)) { return hr; } + /* wine */ for (This->nelems = 0; - pElements[This->nelems].Type != D3DDECLTYPE_UNUSED && - pElements[This->nelems].Stream != 0xFF; /* wine */ - ++This->nelems); + pElements[This->nelems].Stream != 0xFF; + ++This->nelems) + user_assert(pElements[This->nelems].Type != D3DDECLTYPE_UNUSED, E_FAIL); caps = NineDevice9_GetCaps(This->base.device); user_assert(This->nelems <= caps->MaxStreams, D3DERR_INVALIDCALL); -- 2.30.2