Commit 81ed6e0c authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

d3d9: Use the wined3d declaration to retrieve the FVF in IDirect3DDevice9Impl_GetFVF().

parent b48f394e
...@@ -2236,32 +2236,37 @@ static HRESULT WINAPI IDirect3DDevice9Impl_SetFVF(IDirect3DDevice9Ex *iface, DWO ...@@ -2236,32 +2236,37 @@ static HRESULT WINAPI IDirect3DDevice9Impl_SetFVF(IDirect3DDevice9Ex *iface, DWO
return hr; return hr;
} }
static HRESULT WINAPI IDirect3DDevice9Impl_GetFVF(IDirect3DDevice9Ex *iface, DWORD *pFVF) static HRESULT WINAPI IDirect3DDevice9Impl_GetFVF(IDirect3DDevice9Ex *iface, DWORD *fvf)
{ {
IDirect3DVertexDeclaration9 *decl; IDirect3DDevice9Impl *device = impl_from_IDirect3DDevice9Ex(iface);
struct wined3d_vertex_declaration *wined3d_declaration;
IDirect3DVertexDeclaration9Impl *d3d9_declaration;
HRESULT hr; HRESULT hr;
TRACE("iface %p, fvf %p.\n", iface, pFVF); TRACE("iface %p, fvf %p.\n", iface, fvf);
hr = IDirect3DDevice9_GetVertexDeclaration(iface, &decl); wined3d_mutex_lock();
if (FAILED(hr)) if (FAILED(hr = wined3d_device_get_vertex_declaration(device->wined3d_device, &wined3d_declaration)))
{ {
WARN("Failed to get vertex declaration, %#x\n", hr); wined3d_mutex_unlock();
*pFVF = 0; WARN("Failed to get vertex declaration, hr %#x.\n", hr);
*fvf = 0;
return hr; return hr;
} }
if (decl) if (wined3d_declaration)
{ {
*pFVF = ((IDirect3DVertexDeclaration9Impl *)decl)->convFVF; d3d9_declaration = wined3d_vertex_declaration_get_parent(wined3d_declaration);
IDirect3DVertexDeclaration9_Release(decl); *fvf = d3d9_declaration->convFVF;
wined3d_vertex_declaration_decref(wined3d_declaration);
} }
else else
{ {
*pFVF = 0; *fvf = 0;
} }
wined3d_mutex_unlock();
TRACE("Returning FVF %#x\n", *pFVF); TRACE("Returning FVF %#x.\n", *fvf);
return hr; return hr;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment