Commit bcbf5f39 authored by Roderick Colenbrander's avatar Roderick Colenbrander Committed by Alexandre Julliard

d3d8/wined3d: Vertex shader fixes.

parent 17b13bdc
......@@ -1084,14 +1084,17 @@ HRESULT WINAPI IDirect3DDevice8Impl_SetVertexShader(LPDIRECT3DDEVICE8 iface, DWO
if (VS_HIGHESTFIXEDFXF >= pShader) {
TRACE("Setting FVF, %d %ld\n", VS_HIGHESTFIXEDFXF, pShader);
IWineD3DDevice_SetFVF(This->WineD3DDevice, pShader);
/* Call SetVertexShader with a NULL shader to set the vertexshader in the stateblock to NULL. */
IWineD3DDevice_SetVertexShader(This->WineD3DDevice, NULL);
} else {
FIXME("Setting shader\n");
if (MAX_SHADERS <= pShader - (VS_HIGHESTFIXEDFXF + 1)) {
FIXME("(%p) : Number of shaders exceeds the maximum number of possible shaders\n", This);
hrc = D3DERR_INVALIDCALL;
} else {
/* IDirect3DVertexShader8Impl *shader = This->vShaders[pShader - (VS_HIGHESTFIXEDFXF + 1)]; */
/* hrc = IWineD3DDevice_SetVertexShader(This->WineD3DDevice, 0 == shader ? NULL : shader->wineD3DVertexShader); */
IDirect3DVertexShader8Impl *shader = This->vShaders[pShader - (VS_HIGHESTFIXEDFXF + 1)];
hrc = IWineD3DDevice_SetVertexShader(This->WineD3DDevice, 0 == shader ? NULL : shader->wineD3DVertexShader);
}
}
TRACE("(%p) : returning hr(%lu)\n", This, hrc);
......
......@@ -1622,6 +1622,22 @@ HRESULT WINAPI IWineD3DDeviceImpl_CreateVertexShader(IWineD3DDevice *iface, CONS
D3DCREATEOBJECTINSTANCE(object, VertexShader)
TRACE("(%p) : Created Vertex shader %p\n", This, *ppVertexShader);
/* If a vertex declaration has been passed, save it to the vertex shader, this affects d3d8 only. */
/* Further it needs to be set before calling SetFunction as SetFunction needs the declaration. */
if (pDeclaration != NULL) {
IWineD3DVertexDeclaration *vertexDeclaration;
hr = IWineD3DDevice_CreateVertexDeclaration(iface, pDeclaration, &vertexDeclaration ,NULL);
if (D3D_OK == hr) {
TRACE("(%p) : Setting vertex declaration to %p\n", This, vertexDeclaration);
object->vertexDeclaration = vertexDeclaration;
} else {
FIXME("(%p) : Failed to set the declaration, returning D3DERR_INVALIDCALL\n", iface);
IWineD3DVertexShader_Release(*ppVertexShader);
return D3DERR_INVALIDCALL;
}
}
hr = IWineD3DVertexShader_SetFunction(*ppVertexShader, pFunction);
if (D3D_OK != hr) {
......@@ -1639,21 +1655,6 @@ HRESULT WINAPI IWineD3DDeviceImpl_CreateVertexShader(IWineD3DDevice *iface, CONS
#endif
/* If a vertex declaration has been passed, save it to the vertex shader, this affects d3d8 only. */
if (pDeclaration != NULL) {
IWineD3DVertexDeclaration *vertexDeclaration;
hr = IWineD3DDevice_CreateVertexDeclaration(iface, pDeclaration, &vertexDeclaration ,NULL);
if (D3D_OK == hr) {
TRACE("(%p) : Setting vertex declaration to %p\n", This, vertexDeclaration);
object->vertexDeclaration = vertexDeclaration;
} else {
FIXME("(%p) : Failed to set the declaration, returning D3DERR_INVALIDCALL\n", iface);
IWineD3DVertexShader_Release(*ppVertexShader);
return D3DERR_INVALIDCALL;
}
}
return D3D_OK;
}
......
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