Commit 0c54dfe7 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Getting the current vertex shader should never fail.

parent 992cb88f
......@@ -1960,7 +1960,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetVertexShader(IDirect3DDevice8 *ifa
static HRESULT WINAPI IDirect3DDevice8Impl_DeleteVertexShader(LPDIRECT3DDEVICE8 iface, DWORD pShader) {
IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
IDirect3DVertexShader8Impl *shader;
IWineD3DVertexShader *cur = NULL;
IWineD3DVertexShader *cur;
TRACE("iface %p, shader %#x.\n", iface, pShader);
......@@ -1974,8 +1974,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_DeleteVertexShader(LPDIRECT3DDEVICE
return D3DERR_INVALIDCALL;
}
IWineD3DDevice_GetVertexShader(This->WineD3DDevice, &cur);
cur = IWineD3DDevice_GetVertexShader(This->WineD3DDevice);
if (cur)
{
if (cur == shader->wineD3DVertexShader) IDirect3DDevice8_SetVertexShader(iface, 0);
......
......@@ -2219,34 +2219,26 @@ static HRESULT WINAPI IDirect3DDevice9Impl_GetVertexShader(IDirect3DDevice9Ex *i
IDirect3DVertexShader9 **shader)
{
IWineD3DVertexShader *wined3d_shader;
HRESULT hr;
TRACE("iface %p, shader %p.\n", iface, shader);
wined3d_mutex_lock();
hr = IWineD3DDevice_GetVertexShader(((IDirect3DDevice9Impl *)iface)->WineD3DDevice, &wined3d_shader);
if (SUCCEEDED(hr))
wined3d_shader = IWineD3DDevice_GetVertexShader(((IDirect3DDevice9Impl *)iface)->WineD3DDevice);
if (wined3d_shader)
{
if (wined3d_shader)
{
*shader = IWineD3DVertexShader_GetParent(wined3d_shader);
IDirect3DVertexShader9_AddRef(*shader);
IWineD3DVertexShader_Release(wined3d_shader);
}
else
{
*shader = NULL;
}
*shader = IWineD3DVertexShader_GetParent(wined3d_shader);
IDirect3DVertexShader9_AddRef(*shader);
IWineD3DVertexShader_Release(wined3d_shader);
}
else
{
WARN("Failed to get vertex shader, hr %#x.\n", hr);
*shader = NULL;
}
wined3d_mutex_unlock();
TRACE("Returning %p.\n", *shader);
return hr;
return D3D_OK;
}
static HRESULT WINAPI IDirect3DDevice9Impl_SetVertexShaderConstantF(IDirect3DDevice9Ex *iface,
......
......@@ -3208,18 +3208,18 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetVertexShader(IWineD3DDevice *iface,
return WINED3D_OK;
}
static HRESULT WINAPI IWineD3DDeviceImpl_GetVertexShader(IWineD3DDevice *iface, IWineD3DVertexShader** ppShader) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
static IWineD3DVertexShader * WINAPI IWineD3DDeviceImpl_GetVertexShader(IWineD3DDevice *iface)
{
IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *)iface;
IWineD3DVertexShader *shader;
if (NULL == ppShader) {
return WINED3DERR_INVALIDCALL;
}
*ppShader = This->stateBlock->vertexShader;
if( NULL != *ppShader)
IWineD3DVertexShader_AddRef(*ppShader);
TRACE("iface %p.\n", iface);
TRACE("(%p) : returning %p\n", This, *ppShader);
return WINED3D_OK;
shader = device->stateBlock->vertexShader;
if (shader) IWineD3DVertexShader_AddRef(shader);
TRACE("Returning %p.\n", shader);
return shader;
}
static HRESULT WINAPI IWineD3DDeviceImpl_SetVertexShaderConstantB(
......
......@@ -3221,8 +3221,7 @@ interface IWineD3DDevice : IUnknown
HRESULT SetVertexShader(
[in] IWineD3DVertexShader *shader
);
HRESULT GetVertexShader(
[out] IWineD3DVertexShader **shader
IWineD3DVertexShader *GetVertexShader(
);
HRESULT SetVertexShaderConstantB(
[in] UINT start_register,
......
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