Commit 704f0efe authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

d3d9: Use unsafe_impl_from_IDirect3DPixelShader9 for an app provided iface.

parent db1dd902
......@@ -437,6 +437,7 @@ typedef struct IDirect3DPixelShader9Impl {
HRESULT pixelshader_init(IDirect3DPixelShader9Impl *shader,
IDirect3DDevice9Impl *device, const DWORD *byte_code) DECLSPEC_HIDDEN;
IDirect3DPixelShader9Impl *unsafe_impl_from_IDirect3DPixelShader9(IDirect3DPixelShader9 *iface) DECLSPEC_HIDDEN;
/* --------------- */
/* IDirect3DQuery9 */
......
......@@ -2607,13 +2607,14 @@ static HRESULT WINAPI IDirect3DDevice9Impl_SetPixelShader(IDirect3DDevice9Ex *if
IDirect3DPixelShader9 *shader)
{
IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface);
IDirect3DPixelShader9Impl *shader_obj = unsafe_impl_from_IDirect3DPixelShader9(shader);
HRESULT hr;
TRACE("iface %p, shader %p.\n", iface, shader);
wined3d_mutex_lock();
hr = wined3d_device_set_pixel_shader(This->wined3d_device,
shader ? ((IDirect3DPixelShader9Impl *)shader)->wined3d_shader : NULL);
shader_obj ? shader_obj->wined3d_shader : NULL);
wined3d_mutex_unlock();
return hr;
......
......@@ -18,6 +18,7 @@
*/
#include "config.h"
#include <assert.h>
#include "d3d9_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3d9);
......@@ -150,6 +151,11 @@ HRESULT vertexshader_init(IDirect3DVertexShader9Impl *shader, IDirect3DDevice9Im
return D3D_OK;
}
static inline IDirect3DPixelShader9Impl *impl_from_IDirect3DPixelShader9(IDirect3DPixelShader9 *iface)
{
return CONTAINING_RECORD(iface, IDirect3DPixelShader9Impl, lpVtbl);
}
static HRESULT WINAPI d3d9_pixelshader_QueryInterface(IDirect3DPixelShader9 *iface, REFIID riid, void **object)
{
TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), object);
......@@ -276,3 +282,12 @@ HRESULT pixelshader_init(IDirect3DPixelShader9Impl *shader, IDirect3DDevice9Impl
return D3D_OK;
}
IDirect3DPixelShader9Impl *unsafe_impl_from_IDirect3DPixelShader9(IDirect3DPixelShader9 *iface)
{
if (!iface)
return NULL;
assert(iface->lpVtbl == &d3d9_pixelshader_vtbl);
return impl_from_IDirect3DPixelShader9(iface);
}
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