d3d9: Use unsafe_impl_from_IDirect3DVertexShader9 for an app provided iface.

This commit is contained in:
Michael Stefaniuc 2011-07-06 13:20:37 +02:00 committed by Alexandre Julliard
parent 1bd8d40675
commit f12cbfb509
3 changed files with 17 additions and 1 deletions

View File

@ -416,6 +416,7 @@ typedef struct IDirect3DVertexShader9Impl {
HRESULT vertexshader_init(IDirect3DVertexShader9Impl *shader,
IDirect3DDevice9Impl *device, const DWORD *byte_code) DECLSPEC_HIDDEN;
IDirect3DVertexShader9Impl *unsafe_impl_from_IDirect3DVertexShader9(IDirect3DVertexShader9 *iface) DECLSPEC_HIDDEN;
#define D3D9_MAX_VERTEX_SHADER_CONSTANTF 256
#define D3D9_MAX_SIMULTANEOUS_RENDERTARGETS 4

View File

@ -2298,13 +2298,14 @@ static HRESULT WINAPI IDirect3DDevice9Impl_SetVertexShader(IDirect3DDevice9Ex *i
IDirect3DVertexShader9 *shader)
{
IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface);
IDirect3DVertexShader9Impl *shader_obj = unsafe_impl_from_IDirect3DVertexShader9(shader);
HRESULT hr;
TRACE("iface %p, shader %p.\n", iface, shader);
wined3d_mutex_lock();
hr = wined3d_device_set_vertex_shader(This->wined3d_device,
shader ? ((IDirect3DVertexShader9Impl *)shader)->wined3d_shader : NULL);
shader_obj ? shader_obj->wined3d_shader : NULL);
wined3d_mutex_unlock();
return hr;

View File

@ -23,6 +23,11 @@
WINE_DEFAULT_DEBUG_CHANNEL(d3d9);
static inline IDirect3DVertexShader9Impl *impl_from_IDirect3DVertexShader9(IDirect3DVertexShader9 *iface)
{
return CONTAINING_RECORD(iface, IDirect3DVertexShader9Impl, lpVtbl);
}
static HRESULT WINAPI d3d9_vertexshader_QueryInterface(IDirect3DVertexShader9 *iface, REFIID riid, void **object)
{
TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), object);
@ -151,6 +156,15 @@ HRESULT vertexshader_init(IDirect3DVertexShader9Impl *shader, IDirect3DDevice9Im
return D3D_OK;
}
IDirect3DVertexShader9Impl *unsafe_impl_from_IDirect3DVertexShader9(IDirect3DVertexShader9 *iface)
{
if (!iface)
return NULL;
assert(iface->lpVtbl == &d3d9_vertexshader_vtbl);
return impl_from_IDirect3DVertexShader9(iface);
}
static inline IDirect3DPixelShader9Impl *impl_from_IDirect3DPixelShader9(IDirect3DPixelShader9 *iface)
{
return CONTAINING_RECORD(iface, IDirect3DPixelShader9Impl, IDirect3DPixelShader9_iface);