d3d10core: Use unsafe_impl_from_ID3D10VertexShader for an app provided iface.

This commit is contained in:
Michael Stefaniuc 2011-07-12 01:51:41 +02:00 committed by Alexandre Julliard
parent d67d7ebbcb
commit ec415eaf3c
3 changed files with 17 additions and 1 deletions

View File

@ -176,6 +176,7 @@ struct d3d10_vertex_shader
HRESULT d3d10_vertex_shader_init(struct d3d10_vertex_shader *shader, struct d3d10_device *device, HRESULT d3d10_vertex_shader_init(struct d3d10_vertex_shader *shader, struct d3d10_device *device,
const void *byte_code, SIZE_T byte_code_length) DECLSPEC_HIDDEN; const void *byte_code, SIZE_T byte_code_length) DECLSPEC_HIDDEN;
struct d3d10_vertex_shader *unsafe_impl_from_ID3D10VertexShader(ID3D10VertexShader *iface) DECLSPEC_HIDDEN;
/* ID3D10GeometryShader */ /* ID3D10GeometryShader */
struct d3d10_geometry_shader struct d3d10_geometry_shader

View File

@ -151,7 +151,7 @@ static void STDMETHODCALLTYPE d3d10_device_VSSetShader(ID3D10Device *iface,
ID3D10VertexShader *shader) ID3D10VertexShader *shader)
{ {
struct d3d10_device *This = impl_from_ID3D10Device(iface); struct d3d10_device *This = impl_from_ID3D10Device(iface);
struct d3d10_vertex_shader *vs = (struct d3d10_vertex_shader *)shader; struct d3d10_vertex_shader *vs = unsafe_impl_from_ID3D10VertexShader(shader);
TRACE("iface %p, shader %p\n", iface, shader); TRACE("iface %p, shader %p\n", iface, shader);

View File

@ -19,6 +19,7 @@
#include "config.h" #include "config.h"
#include "wine/port.h" #include "wine/port.h"
#include <assert.h>
#include "d3d10core_private.h" #include "d3d10core_private.h"
@ -132,6 +133,11 @@ void shader_free_signature(struct wined3d_shader_signature *s)
HeapFree(GetProcessHeap(), 0, s->elements); HeapFree(GetProcessHeap(), 0, s->elements);
} }
static inline struct d3d10_vertex_shader *impl_from_ID3D10VertexShader(ID3D10VertexShader *iface)
{
return CONTAINING_RECORD(iface, struct d3d10_vertex_shader, vtbl);
}
/* IUnknown methods */ /* IUnknown methods */
static HRESULT STDMETHODCALLTYPE d3d10_vertex_shader_QueryInterface(ID3D10VertexShader *iface, static HRESULT STDMETHODCALLTYPE d3d10_vertex_shader_QueryInterface(ID3D10VertexShader *iface,
@ -267,6 +273,15 @@ HRESULT d3d10_vertex_shader_init(struct d3d10_vertex_shader *shader, struct d3d1
return S_OK; return S_OK;
} }
struct d3d10_vertex_shader *unsafe_impl_from_ID3D10VertexShader(ID3D10VertexShader *iface)
{
if (!iface)
return NULL;
assert(iface->lpVtbl == &d3d10_vertex_shader_vtbl);
return impl_from_ID3D10VertexShader(iface);
}
static inline struct d3d10_geometry_shader *impl_from_ID3D10GeometryShader(ID3D10GeometryShader *iface) static inline struct d3d10_geometry_shader *impl_from_ID3D10GeometryShader(ID3D10GeometryShader *iface)
{ {
return CONTAINING_RECORD(iface, struct d3d10_geometry_shader, ID3D10GeometryShader_iface); return CONTAINING_RECORD(iface, struct d3d10_geometry_shader, ID3D10GeometryShader_iface);