d3d9: Improve IDirect3DDevice9::SetFVF() code flow.
This commit is contained in:
parent
aa3027a604
commit
09f21f3fd8
@ -1507,26 +1507,31 @@ static IDirect3DVertexDeclaration9 *getConvertedDecl(IDirect3DDevice9Impl *This,
|
|||||||
|
|
||||||
static HRESULT WINAPI IDirect3DDevice9Impl_SetFVF(LPDIRECT3DDEVICE9EX iface, DWORD FVF) {
|
static HRESULT WINAPI IDirect3DDevice9Impl_SetFVF(LPDIRECT3DDEVICE9EX iface, DWORD FVF) {
|
||||||
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
|
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
|
||||||
HRESULT hr = S_OK;
|
IDirect3DVertexDeclaration9 *decl;
|
||||||
|
HRESULT hr;
|
||||||
|
|
||||||
TRACE("(%p) Relay\n" , This);
|
TRACE("(%p) Relay\n" , This);
|
||||||
|
|
||||||
EnterCriticalSection(&d3d9_cs);
|
if (!FVF)
|
||||||
if (0 != FVF) {
|
{
|
||||||
IDirect3DVertexDeclaration9* pDecl = getConvertedDecl(This, FVF);
|
WARN("%#x is not a valid FVF\n", FVF);
|
||||||
|
return D3D_OK;
|
||||||
if(!pDecl) {
|
|
||||||
/* Any situation when this should happen, except out of memory? */
|
|
||||||
ERR("Failed to create a converted vertex declaration\n");
|
|
||||||
LeaveCriticalSection(&d3d9_cs);
|
|
||||||
return D3DERR_DRIVERINTERNALERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
hr = IDirect3DDevice9Impl_SetVertexDeclaration(iface, pDecl);
|
|
||||||
if (hr != S_OK) {
|
|
||||||
LeaveCriticalSection(&d3d9_cs);
|
|
||||||
return hr;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EnterCriticalSection(&d3d9_cs);
|
||||||
|
|
||||||
|
decl = getConvertedDecl(This, FVF);
|
||||||
|
if (!decl)
|
||||||
|
{
|
||||||
|
/* Any situation when this should happen, except out of memory? */
|
||||||
|
ERR("Failed to create a converted vertex declaration\n");
|
||||||
|
LeaveCriticalSection(&d3d9_cs);
|
||||||
|
return D3DERR_DRIVERINTERNALERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
hr = IDirect3DDevice9Impl_SetVertexDeclaration(iface, decl);
|
||||||
|
if (FAILED(hr)) ERR("Failed to set vertex declaration\n");
|
||||||
|
|
||||||
LeaveCriticalSection(&d3d9_cs);
|
LeaveCriticalSection(&d3d9_cs);
|
||||||
|
|
||||||
return hr;
|
return hr;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user