d3d9: Don't assert when apps pass in the wrong shader iface.

Sebastian Lackner sebastian at fds-team.de
Mon Dec 15 08:36:50 CST 2014


On 15.12.2014 15:29, Michael Stefaniuc wrote:
> Fixes a regression reported in
> https://bugs.winehq.org/show_bug.cgi?id=37723
> ---
>  dlls/d3d9/shader.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/dlls/d3d9/shader.c b/dlls/d3d9/shader.c
> index 0c2c881..9541028 100644
> --- a/dlls/d3d9/shader.c
> +++ b/dlls/d3d9/shader.c
> @@ -165,9 +165,8 @@ HRESULT vertexshader_init(struct d3d9_vertexshader *shader, struct d3d9_device *
>  
>  struct d3d9_vertexshader *unsafe_impl_from_IDirect3DVertexShader9(IDirect3DVertexShader9 *iface)
>  {
> -    if (!iface)
> +    if (!iface && iface->lpVtbl != &d3d9_vertexshader_vtbl)
                 ^^^^

Shouldn't it be

!iface || iface->lpVtbl != &d3d9_vertexshader_vtbl

?

>          return NULL;
> -    assert(iface->lpVtbl == &d3d9_vertexshader_vtbl);
>  
>      return impl_from_IDirect3DVertexShader9(iface);
>  }
> @@ -315,9 +314,8 @@ HRESULT pixelshader_init(struct d3d9_pixelshader *shader, struct d3d9_device *de
>  
>  struct d3d9_pixelshader *unsafe_impl_from_IDirect3DPixelShader9(IDirect3DPixelShader9 *iface)
>  {
> -    if (!iface)
> +    if (!iface && iface->lpVtbl != &d3d9_pixelshader_vtbl)
>          return NULL;
> -    assert(iface->lpVtbl == &d3d9_pixelshader_vtbl);
>  
>      return impl_from_IDirect3DPixelShader9(iface);
>  }
> 




More information about the wine-devel mailing list