Michael Stefaniuc : d3d10core: Use unsafe_impl_from_ID3D10PixelShader for an app provided iface.
Alexandre Julliard
julliard at winehq.org
Tue Jul 12 13:47:09 CDT 2011
Module: wine
Branch: master
Commit: 887a4ff3cc630e0353c744cac31f48389e0a6afe
URL: http://source.winehq.org/git/wine.git/?a=commit;h=887a4ff3cc630e0353c744cac31f48389e0a6afe
Author: Michael Stefaniuc <mstefani at redhat.de>
Date: Tue Jul 12 01:55:11 2011 +0200
d3d10core: Use unsafe_impl_from_ID3D10PixelShader for an app provided iface.
---
dlls/d3d10core/d3d10core_private.h | 1 +
dlls/d3d10core/device.c | 2 +-
dlls/d3d10core/shader.c | 14 ++++++++++++++
3 files changed, 16 insertions(+), 1 deletions(-)
diff --git a/dlls/d3d10core/d3d10core_private.h b/dlls/d3d10core/d3d10core_private.h
index 50d31b0..17c3bae 100644
--- a/dlls/d3d10core/d3d10core_private.h
+++ b/dlls/d3d10core/d3d10core_private.h
@@ -203,6 +203,7 @@ struct d3d10_pixel_shader
HRESULT d3d10_pixel_shader_init(struct d3d10_pixel_shader *shader, struct d3d10_device *device,
const void *byte_code, SIZE_T byte_code_length) DECLSPEC_HIDDEN;
+struct d3d10_pixel_shader *unsafe_impl_from_ID3D10PixelShader(ID3D10PixelShader *iface) DECLSPEC_HIDDEN;
HRESULT shader_parse_signature(const char *data, DWORD data_size, struct wined3d_shader_signature *s) DECLSPEC_HIDDEN;
void shader_free_signature(struct wined3d_shader_signature *s) DECLSPEC_HIDDEN;
diff --git a/dlls/d3d10core/device.c b/dlls/d3d10core/device.c
index 0f4b75f..149afa9 100644
--- a/dlls/d3d10core/device.c
+++ b/dlls/d3d10core/device.c
@@ -133,7 +133,7 @@ static void STDMETHODCALLTYPE d3d10_device_PSSetShader(ID3D10Device *iface,
ID3D10PixelShader *shader)
{
struct d3d10_device *This = impl_from_ID3D10Device(iface);
- struct d3d10_pixel_shader *ps = (struct d3d10_pixel_shader *)shader;
+ struct d3d10_pixel_shader *ps = unsafe_impl_from_ID3D10PixelShader(shader);
TRACE("iface %p, shader %p\n", iface, shader);
diff --git a/dlls/d3d10core/shader.c b/dlls/d3d10core/shader.c
index fe112dc..79131e1 100644
--- a/dlls/d3d10core/shader.c
+++ b/dlls/d3d10core/shader.c
@@ -419,6 +419,11 @@ HRESULT d3d10_geometry_shader_init(struct d3d10_geometry_shader *shader, struct
return S_OK;
}
+static inline struct d3d10_pixel_shader *impl_from_ID3D10PixelShader(ID3D10PixelShader *iface)
+{
+ return CONTAINING_RECORD(iface, struct d3d10_pixel_shader, vtbl);
+}
+
/* IUnknown methods */
static HRESULT STDMETHODCALLTYPE d3d10_pixel_shader_QueryInterface(ID3D10PixelShader *iface,
@@ -553,3 +558,12 @@ HRESULT d3d10_pixel_shader_init(struct d3d10_pixel_shader *shader, struct d3d10_
return S_OK;
}
+
+struct d3d10_pixel_shader *unsafe_impl_from_ID3D10PixelShader(ID3D10PixelShader *iface)
+{
+ if (!iface)
+ return NULL;
+ assert(iface->lpVtbl == &d3d10_pixel_shader_vtbl);
+
+ return impl_from_ID3D10PixelShader(iface);
+}
More information about the wine-cvs
mailing list