Commit 83761d20 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

d3d8: Get rid of IDirect3DBaseTexture8Impl.

parent 715fd2ae
......@@ -17,7 +17,6 @@
*/
#include "config.h"
#include <assert.h>
#include "d3d8_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3d8);
......
......@@ -23,6 +23,7 @@
#ifndef __WINE_D3D8_PRIVATE_H
#define __WINE_D3D8_PRIVATE_H
#include <assert.h>
#include <stdarg.h>
#define NONAMELESSUNION
......@@ -293,21 +294,6 @@ HRESULT indexbuffer_init(IDirect3DIndexBuffer8Impl *buffer, IDirect3DDevice8Impl
UINT size, DWORD usage, D3DFORMAT format, D3DPOOL pool) DECLSPEC_HIDDEN;
IDirect3DIndexBuffer8Impl *unsafe_impl_from_IDirect3DIndexBuffer8(IDirect3DIndexBuffer8 *iface) DECLSPEC_HIDDEN;
/* --------------------- */
/* IDirect3DBaseTexture8 */
/* --------------------- */
/*****************************************************************************
* IDirect3DBaseTexture8 implementation structure
*/
struct IDirect3DBaseTexture8Impl
{
/* IUnknown fields */
const IDirect3DBaseTexture8Vtbl *lpVtbl;
LONG ref;
struct wined3d_texture *wined3d_texture;
};
struct d3d8_texture
{
IDirect3DBaseTexture8 IDirect3DBaseTexture8_iface;
......@@ -318,12 +304,11 @@ struct d3d8_texture
HRESULT cubetexture_init(struct d3d8_texture *texture, IDirect3DDevice8Impl *device,
UINT edge_length, UINT levels, DWORD usage, D3DFORMAT format, D3DPOOL pool) DECLSPEC_HIDDEN;
HRESULT texture_init(struct d3d8_texture *texture, IDirect3DDevice8Impl *device,
UINT width, UINT height, UINT levels, DWORD usage, D3DFORMAT format, D3DPOOL pool) DECLSPEC_HIDDEN;
HRESULT volumetexture_init(struct d3d8_texture *texture, IDirect3DDevice8Impl *device,
UINT width, UINT height, UINT depth, UINT levels, DWORD usage, D3DFORMAT format, D3DPOOL pool) DECLSPEC_HIDDEN;
struct d3d8_texture *unsafe_impl_from_IDirect3DBaseTexture8(IDirect3DBaseTexture8 *iface) DECLSPEC_HIDDEN;
struct d3d8_vertex_declaration
{
......
......@@ -1032,14 +1032,17 @@ static HRESULT WINAPI IDirect3DDevice8Impl_UpdateTexture(IDirect3DDevice8 *iface
IDirect3DBaseTexture8 *src_texture, IDirect3DBaseTexture8 *dst_texture)
{
IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
struct d3d8_texture *src_impl, *dst_impl;
HRESULT hr;
TRACE("iface %p, src_texture %p, dst_texture %p.\n", iface, src_texture, dst_texture);
src_impl = unsafe_impl_from_IDirect3DBaseTexture8(src_texture);
dst_impl = unsafe_impl_from_IDirect3DBaseTexture8(dst_texture);
wined3d_mutex_lock();
hr = wined3d_device_update_texture(This->wined3d_device,
((IDirect3DBaseTexture8Impl *)src_texture)->wined3d_texture,
((IDirect3DBaseTexture8Impl *)dst_texture)->wined3d_texture);
src_impl->wined3d_texture, dst_impl->wined3d_texture);
wined3d_mutex_unlock();
return hr;
......@@ -1732,17 +1735,20 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetTexture(IDirect3DDevice8 *iface,
return D3D_OK;
}
static HRESULT WINAPI IDirect3DDevice8Impl_SetTexture(IDirect3DDevice8 *iface, DWORD Stage,
IDirect3DBaseTexture8 *pTexture)
static HRESULT WINAPI IDirect3DDevice8Impl_SetTexture(IDirect3DDevice8 *iface, DWORD stage,
IDirect3DBaseTexture8 *texture)
{
IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
struct d3d8_texture *texture_impl;
HRESULT hr;
TRACE("iface %p, stage %u, texture %p.\n", iface, Stage, pTexture);
TRACE("iface %p, stage %u, texture %p.\n", iface, stage, texture);
texture_impl = unsafe_impl_from_IDirect3DBaseTexture8(texture);
wined3d_mutex_lock();
hr = wined3d_device_set_texture(This->wined3d_device, Stage,
pTexture ? ((IDirect3DBaseTexture8Impl *)pTexture)->wined3d_texture : NULL);
hr = wined3d_device_set_texture(This->wined3d_device, stage,
texture_impl ? texture_impl->wined3d_texture : NULL);
wined3d_mutex_unlock();
return hr;
......
......@@ -19,7 +19,6 @@
*/
#include "config.h"
#include <assert.h>
#include "d3d8_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3d8);
......
......@@ -1137,6 +1137,16 @@ static const IDirect3DVolumeTexture8Vtbl Direct3DVolumeTexture8_Vtbl =
d3d8_texture_3d_AddDirtyBox
};
struct d3d8_texture *unsafe_impl_from_IDirect3DBaseTexture8(IDirect3DBaseTexture8 *iface)
{
if (!iface)
return NULL;
assert(iface->lpVtbl == (const IDirect3DBaseTexture8Vtbl *)&Direct3DTexture8_Vtbl
|| iface->lpVtbl == (const IDirect3DBaseTexture8Vtbl *)&Direct3DCubeTexture8_Vtbl
|| iface->lpVtbl == (const IDirect3DBaseTexture8Vtbl *)&Direct3DVolumeTexture8_Vtbl);
return CONTAINING_RECORD(iface, struct d3d8_texture, IDirect3DBaseTexture8_iface);
}
static void STDMETHODCALLTYPE d3d8_texture_wined3d_object_destroyed(void *parent)
{
HeapFree(GetProcessHeap(), 0, parent);
......
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