Commit 6c866e06 authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

d3d10core: Use unsafe_impl_from_ID3D10InputLayout for an app provided iface.

parent dc3ee8b9
......@@ -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
......
......@@ -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,
......
......@@ -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);
}
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