d3d9: Use unsafe_impl_from_IDirect3DSurface9 for app provided ifaces.
This commit is contained in:
parent
640234c504
commit
a7530e7892
|
@ -241,6 +241,7 @@ typedef struct IDirect3DSurface9Impl
|
||||||
HRESULT surface_init(IDirect3DSurface9Impl *surface, IDirect3DDevice9Impl *device,
|
HRESULT surface_init(IDirect3DSurface9Impl *surface, IDirect3DDevice9Impl *device,
|
||||||
UINT width, UINT height, D3DFORMAT format, BOOL lockable, BOOL discard, UINT level,
|
UINT width, UINT height, D3DFORMAT format, BOOL lockable, BOOL discard, UINT level,
|
||||||
DWORD usage, D3DPOOL pool, D3DMULTISAMPLE_TYPE multisample_type, DWORD multisample_quality) DECLSPEC_HIDDEN;
|
DWORD usage, D3DPOOL pool, D3DMULTISAMPLE_TYPE multisample_type, DWORD multisample_quality) DECLSPEC_HIDDEN;
|
||||||
|
IDirect3DSurface9Impl *unsafe_impl_from_IDirect3DSurface9(IDirect3DSurface9 *iface) DECLSPEC_HIDDEN;
|
||||||
|
|
||||||
/* ---------------------- */
|
/* ---------------------- */
|
||||||
/* IDirect3DVertexBuffer9 */
|
/* IDirect3DVertexBuffer9 */
|
||||||
|
|
|
@ -400,7 +400,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_SetCursorProperties(IDirect3DDevice9E
|
||||||
UINT XHotSpot, UINT YHotSpot, IDirect3DSurface9 *pCursorBitmap)
|
UINT XHotSpot, UINT YHotSpot, IDirect3DSurface9 *pCursorBitmap)
|
||||||
{
|
{
|
||||||
IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface);
|
IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface);
|
||||||
IDirect3DSurface9Impl *pSurface = (IDirect3DSurface9Impl*)pCursorBitmap;
|
IDirect3DSurface9Impl *pSurface = unsafe_impl_from_IDirect3DSurface9(pCursorBitmap);
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
TRACE("iface %p, hotspot_x %u, hotspot_y %u, bitmap %p.\n",
|
TRACE("iface %p, hotspot_x %u, hotspot_y %u, bitmap %p.\n",
|
||||||
|
@ -970,15 +970,16 @@ static HRESULT WINAPI IDirect3DDevice9Impl_UpdateSurface(IDirect3DDevice9Ex *ifa
|
||||||
IDirect3DSurface9 *pDestinationSurface, const POINT *pDestPoint)
|
IDirect3DSurface9 *pDestinationSurface, const POINT *pDestPoint)
|
||||||
{
|
{
|
||||||
IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface);
|
IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface);
|
||||||
|
IDirect3DSurface9Impl *src = unsafe_impl_from_IDirect3DSurface9(pSourceSurface);
|
||||||
|
IDirect3DSurface9Impl *dst = unsafe_impl_from_IDirect3DSurface9(pDestinationSurface);
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
TRACE("iface %p, src_surface %p, src_rect %p, dst_surface %p, dst_point %p.\n",
|
TRACE("iface %p, src_surface %p, src_rect %p, dst_surface %p, dst_point %p.\n",
|
||||||
iface, pSourceSurface, pSourceRect, pDestinationSurface, pDestPoint);
|
iface, pSourceSurface, pSourceRect, pDestinationSurface, pDestPoint);
|
||||||
|
|
||||||
wined3d_mutex_lock();
|
wined3d_mutex_lock();
|
||||||
hr = wined3d_device_update_surface(This->wined3d_device,
|
hr = wined3d_device_update_surface(This->wined3d_device, src->wined3d_surface, pSourceRect,
|
||||||
((IDirect3DSurface9Impl *)pSourceSurface)->wined3d_surface, pSourceRect,
|
dst->wined3d_surface, pDestPoint);
|
||||||
((IDirect3DSurface9Impl *)pDestinationSurface)->wined3d_surface, pDestPoint);
|
|
||||||
wined3d_mutex_unlock();
|
wined3d_mutex_unlock();
|
||||||
|
|
||||||
return hr;
|
return hr;
|
||||||
|
@ -1004,8 +1005,8 @@ static HRESULT WINAPI IDirect3DDevice9Impl_UpdateTexture(IDirect3DDevice9Ex *ifa
|
||||||
static HRESULT WINAPI IDirect3DDevice9Impl_GetRenderTargetData(IDirect3DDevice9Ex *iface,
|
static HRESULT WINAPI IDirect3DDevice9Impl_GetRenderTargetData(IDirect3DDevice9Ex *iface,
|
||||||
IDirect3DSurface9 *pRenderTarget, IDirect3DSurface9 *pDestSurface)
|
IDirect3DSurface9 *pRenderTarget, IDirect3DSurface9 *pDestSurface)
|
||||||
{
|
{
|
||||||
IDirect3DSurface9Impl *renderTarget = (IDirect3DSurface9Impl *)pRenderTarget;
|
IDirect3DSurface9Impl *renderTarget = unsafe_impl_from_IDirect3DSurface9(pRenderTarget);
|
||||||
IDirect3DSurface9Impl *destSurface = (IDirect3DSurface9Impl *)pDestSurface;
|
IDirect3DSurface9Impl *destSurface = unsafe_impl_from_IDirect3DSurface9(pDestSurface);
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
TRACE("iface %p, render_target %p, dst_surface %p.\n", iface, pRenderTarget, pDestSurface);
|
TRACE("iface %p, render_target %p, dst_surface %p.\n", iface, pRenderTarget, pDestSurface);
|
||||||
|
@ -1022,7 +1023,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_GetFrontBufferData(IDirect3DDevice9Ex
|
||||||
UINT iSwapChain, IDirect3DSurface9 *pDestSurface)
|
UINT iSwapChain, IDirect3DSurface9 *pDestSurface)
|
||||||
{
|
{
|
||||||
IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface);
|
IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface);
|
||||||
IDirect3DSurface9Impl *destSurface = (IDirect3DSurface9Impl *)pDestSurface;
|
IDirect3DSurface9Impl *destSurface = unsafe_impl_from_IDirect3DSurface9(pDestSurface);
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
TRACE("iface %p, swapchain %u, dst_surface %p.\n", iface, iSwapChain, pDestSurface);
|
TRACE("iface %p, swapchain %u, dst_surface %p.\n", iface, iSwapChain, pDestSurface);
|
||||||
|
@ -1037,8 +1038,8 @@ static HRESULT WINAPI IDirect3DDevice9Impl_GetFrontBufferData(IDirect3DDevice9Ex
|
||||||
static HRESULT WINAPI IDirect3DDevice9Impl_StretchRect(IDirect3DDevice9Ex *iface, IDirect3DSurface9 *pSourceSurface,
|
static HRESULT WINAPI IDirect3DDevice9Impl_StretchRect(IDirect3DDevice9Ex *iface, IDirect3DSurface9 *pSourceSurface,
|
||||||
const RECT *pSourceRect, IDirect3DSurface9 *pDestSurface, const RECT *pDestRect, D3DTEXTUREFILTERTYPE Filter)
|
const RECT *pSourceRect, IDirect3DSurface9 *pDestSurface, const RECT *pDestRect, D3DTEXTUREFILTERTYPE Filter)
|
||||||
{
|
{
|
||||||
IDirect3DSurface9Impl *src = (IDirect3DSurface9Impl *) pSourceSurface;
|
IDirect3DSurface9Impl *src = unsafe_impl_from_IDirect3DSurface9(pSourceSurface);
|
||||||
IDirect3DSurface9Impl *dst = (IDirect3DSurface9Impl *) pDestSurface;
|
IDirect3DSurface9Impl *dst = unsafe_impl_from_IDirect3DSurface9(pDestSurface);
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
TRACE("iface %p, src_surface %p, src_rect %p, dst_surface %p, dst_rect %p, filter %#x.\n",
|
TRACE("iface %p, src_surface %p, src_rect %p, dst_surface %p, dst_rect %p, filter %#x.\n",
|
||||||
|
@ -1062,7 +1063,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_ColorFill(IDirect3DDevice9Ex *iface,
|
||||||
((color >> 24) & 0xff) / 255.0f,
|
((color >> 24) & 0xff) / 255.0f,
|
||||||
};
|
};
|
||||||
IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface);
|
IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface);
|
||||||
IDirect3DSurface9Impl *surface = (IDirect3DSurface9Impl *)pSurface;
|
IDirect3DSurface9Impl *surface = unsafe_impl_from_IDirect3DSurface9(pSurface);
|
||||||
struct wined3d_resource *wined3d_resource;
|
struct wined3d_resource *wined3d_resource;
|
||||||
struct wined3d_resource_desc desc;
|
struct wined3d_resource_desc desc;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
@ -1124,7 +1125,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_SetRenderTarget(IDirect3DDevice9Ex *i
|
||||||
DWORD RenderTargetIndex, IDirect3DSurface9 *pRenderTarget)
|
DWORD RenderTargetIndex, IDirect3DSurface9 *pRenderTarget)
|
||||||
{
|
{
|
||||||
IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface);
|
IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface);
|
||||||
IDirect3DSurface9Impl *pSurface = (IDirect3DSurface9Impl*)pRenderTarget;
|
IDirect3DSurface9Impl *pSurface = unsafe_impl_from_IDirect3DSurface9(pRenderTarget);
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
TRACE("iface %p, idx %u, surface %p.\n", iface, RenderTargetIndex, pRenderTarget);
|
TRACE("iface %p, idx %u, surface %p.\n", iface, RenderTargetIndex, pRenderTarget);
|
||||||
|
@ -1190,13 +1191,11 @@ static HRESULT WINAPI IDirect3DDevice9Impl_SetDepthStencilSurface(IDirect3DDevic
|
||||||
IDirect3DSurface9 *pZStencilSurface)
|
IDirect3DSurface9 *pZStencilSurface)
|
||||||
{
|
{
|
||||||
IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface);
|
IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface);
|
||||||
IDirect3DSurface9Impl *pSurface;
|
IDirect3DSurface9Impl *pSurface = unsafe_impl_from_IDirect3DSurface9(pZStencilSurface);
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
TRACE("iface %p, depth_stencil %p.\n", iface, pZStencilSurface);
|
TRACE("iface %p, depth_stencil %p.\n", iface, pZStencilSurface);
|
||||||
|
|
||||||
pSurface = (IDirect3DSurface9Impl*)pZStencilSurface;
|
|
||||||
|
|
||||||
wined3d_mutex_lock();
|
wined3d_mutex_lock();
|
||||||
hr = wined3d_device_set_depth_stencil(This->wined3d_device, pSurface ? pSurface->wined3d_surface : NULL);
|
hr = wined3d_device_set_depth_stencil(This->wined3d_device, pSurface ? pSurface->wined3d_surface : NULL);
|
||||||
wined3d_mutex_unlock();
|
wined3d_mutex_unlock();
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
#include <assert.h>
|
||||||
#include "d3d9_private.h"
|
#include "d3d9_private.h"
|
||||||
|
|
||||||
WINE_DEFAULT_DEBUG_CHANNEL(d3d9);
|
WINE_DEFAULT_DEBUG_CHANNEL(d3d9);
|
||||||
|
@ -423,3 +424,12 @@ HRESULT surface_init(IDirect3DSurface9Impl *surface, IDirect3DDevice9Impl *devic
|
||||||
|
|
||||||
return D3D_OK;
|
return D3D_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IDirect3DSurface9Impl *unsafe_impl_from_IDirect3DSurface9(IDirect3DSurface9 *iface)
|
||||||
|
{
|
||||||
|
if (!iface)
|
||||||
|
return NULL;
|
||||||
|
assert(iface->lpVtbl == &Direct3DSurface9_Vtbl);
|
||||||
|
|
||||||
|
return impl_from_IDirect3DSurface9(iface);
|
||||||
|
}
|
||||||
|
|
|
@ -98,15 +98,17 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH IDirect3DSwapChain9Impl_Present(LPDIRECT
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI IDirect3DSwapChain9Impl_GetFrontBufferData(LPDIRECT3DSWAPCHAIN9 iface, IDirect3DSurface9* pDestSurface) {
|
static HRESULT WINAPI IDirect3DSwapChain9Impl_GetFrontBufferData(IDirect3DSwapChain9 *iface,
|
||||||
|
IDirect3DSurface9 *pDestSurface)
|
||||||
|
{
|
||||||
IDirect3DSwapChain9Impl *This = (IDirect3DSwapChain9Impl *)iface;
|
IDirect3DSwapChain9Impl *This = (IDirect3DSwapChain9Impl *)iface;
|
||||||
|
IDirect3DSurface9Impl *dst = unsafe_impl_from_IDirect3DSurface9(pDestSurface);
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
TRACE("iface %p, surface %p.\n", iface, pDestSurface);
|
TRACE("iface %p, surface %p.\n", iface, pDestSurface);
|
||||||
|
|
||||||
wined3d_mutex_lock();
|
wined3d_mutex_lock();
|
||||||
hr = wined3d_swapchain_get_front_buffer_data(This->wined3d_swapchain,
|
hr = wined3d_swapchain_get_front_buffer_data(This->wined3d_swapchain, dst->wined3d_surface);
|
||||||
((IDirect3DSurface9Impl *)pDestSurface)->wined3d_surface);
|
|
||||||
wined3d_mutex_unlock();
|
wined3d_mutex_unlock();
|
||||||
|
|
||||||
return hr;
|
return hr;
|
||||||
|
|
Loading…
Reference in New Issue