d3d10core: Use unsafe_impl_from_ID3D10InputLayout for an app provided iface.

This commit is contained in:
Michael Stefaniuc 2011-07-12 12:50:41 +02:00 committed by Alexandre Julliard
parent dc3ee8b947
commit 6c866e06bf
3 changed files with 18 additions and 1 deletions

View File

@ -164,6 +164,7 @@ struct d3d10_input_layout
HRESULT d3d10_input_layout_init(struct d3d10_input_layout *layout, struct d3d10_device *device,
const D3D10_INPUT_ELEMENT_DESC *element_descs, UINT element_count,
const void *shader_byte_code, SIZE_T shader_byte_code_length) DECLSPEC_HIDDEN;
struct d3d10_input_layout *unsafe_impl_from_ID3D10InputLayout(ID3D10InputLayout *iface) DECLSPEC_HIDDEN;
/* ID3D10VertexShader */
struct d3d10_vertex_shader

View File

@ -192,11 +192,12 @@ static void STDMETHODCALLTYPE d3d10_device_IASetInputLayout(ID3D10Device *iface,
ID3D10InputLayout *input_layout)
{
struct d3d10_device *This = impl_from_ID3D10Device(iface);
struct d3d10_input_layout *layout = unsafe_impl_from_ID3D10InputLayout(input_layout);
TRACE("iface %p, input_layout %p\n", iface, input_layout);
wined3d_device_set_vertex_declaration(This->wined3d_device,
input_layout ? ((struct d3d10_input_layout *)input_layout)->wined3d_decl : NULL);
layout ? layout->wined3d_decl : NULL);
}
static void STDMETHODCALLTYPE d3d10_device_IASetVertexBuffers(ID3D10Device *iface, UINT start_slot,

View File

@ -19,6 +19,7 @@
#include "config.h"
#include "wine/port.h"
#include <assert.h>
#include "d3d10core_private.h"
@ -100,6 +101,11 @@ static HRESULT d3d10_input_layout_to_wined3d_declaration(const D3D10_INPUT_ELEME
return S_OK;
}
static inline struct d3d10_input_layout *impl_from_ID3D10InputLayout(ID3D10InputLayout *iface)
{
return CONTAINING_RECORD(iface, struct d3d10_input_layout, vtbl);
}
/* IUnknown methods */
static HRESULT STDMETHODCALLTYPE d3d10_input_layout_QueryInterface(ID3D10InputLayout *iface,
@ -238,3 +244,12 @@ HRESULT d3d10_input_layout_init(struct d3d10_input_layout *layout, struct d3d10_
return S_OK;
}
struct d3d10_input_layout *unsafe_impl_from_ID3D10InputLayout(ID3D10InputLayout *iface)
{
if (!iface)
return NULL;
assert(iface->lpVtbl == &d3d10_input_layout_vtbl);
return impl_from_ID3D10InputLayout(iface);
}