Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
alexbevi
GitHub Repository: alexbevi/BizHawk
Path: blob/master/libmupen64plus/D3D8Interceptor/Direct3DTexture8Functions.cpp
2 views
1
#include "d3d8Wrapper.h"
2
3
extern "C"
4
{
5
namespace D3D8Wrapper
6
{
7
D3D8Wrapper::IDirect3DTexture8::IDirect3DTexture8(D3D8Base::IDirect3DTexture8* realTexture) : IDirect3DBaseTexture8((D3D8Base::IDirect3DBaseTexture8*) realTexture)
8
{
9
LOG("IDirect3DTexture8::IDirect3DTexture8( " << realTexture << " )\n");
10
m_pD3D = realTexture;
11
}
12
13
D3D8Wrapper::IDirect3DTexture8* D3D8Wrapper::IDirect3DTexture8::GetTexture(D3D8Base::IDirect3DTexture8* realTexture)
14
{
15
LOG("IDirect3DTexture8::GetTexture( " << realTexture << " )\n");
16
D3D8Wrapper::IDirect3DTexture8* wrappedTexture = (D3D8Wrapper::IDirect3DTexture8*) D3D8Wrapper::IDirect3DResource8::m_List.GetDataPtr(realTexture);
17
if( wrappedTexture == NULL )
18
{
19
wrappedTexture = new D3D8Wrapper::IDirect3DTexture8(realTexture);
20
D3D8Wrapper::IDirect3DResource8::m_List.AddMember(realTexture, wrappedTexture);
21
return wrappedTexture;
22
}
23
24
wrappedTexture->m_ulRef++;
25
return wrappedTexture;
26
}
27
28
STDMETHODIMP D3D8Wrapper::IDirect3DTexture8::GetLevelDesc(UINT Level,D3D8Base::D3DSURFACE_DESC *pDesc)
29
{
30
LOG("IDirect3DTexture8::GetLevelDesc( " << Level << " , " << pDesc << " ) [ " << this << " ]\n");
31
return m_pD3D->GetLevelDesc(Level,pDesc);
32
}
33
34
STDMETHODIMP D3D8Wrapper::IDirect3DTexture8::GetSurfaceLevel(UINT Level,D3D8Wrapper::IDirect3DSurface8** ppSurfaceLevel)
35
{
36
LOG("IDirect3DTexture8::GetSurfaceLevel( " << Level << " , " << ppSurfaceLevel << " ) [ " << this << " ]\n");
37
38
D3D8Base::IDirect3DSurface8* realD3D = NULL;
39
40
HRESULT hr = m_pD3D->GetSurfaceLevel(Level,&realD3D);
41
42
D3D8Wrapper::IDirect3DSurface8* wrappedD3D = D3D8Wrapper::IDirect3DSurface8::GetSurface(realD3D);
43
44
*ppSurfaceLevel = wrappedD3D;
45
46
return hr;
47
}
48
49
STDMETHODIMP D3D8Wrapper::IDirect3DTexture8::LockRect(UINT Level,D3D8Base::D3DLOCKED_RECT* pLockedRect,CONST RECT* pRect,DWORD Flags)
50
{
51
LOG("IDirect3DTexture8::LockRect( " << Level << " , " << pLockedRect << " , " << pRect << " , " << Flags << " ) [ " << this << " ]\n");
52
return m_pD3D->LockRect(Level,pLockedRect,pRect,Flags);
53
}
54
55
STDMETHODIMP D3D8Wrapper::IDirect3DTexture8::UnlockRect(UINT Level)
56
{
57
LOG("IDirect3DTexture8::UnlockRect() [ " << this << " ]\n");
58
return m_pD3D->UnlockRect(Level);
59
}
60
61
STDMETHODIMP D3D8Wrapper::IDirect3DTexture8::AddDirtyRect(CONST RECT* pDirtyRect)
62
{
63
LOG("IDirect3DTexture8::AddDirtyRect( " << pDirtyRect << " ) [ " << this << " ]\n");
64
return m_pD3D->AddDirtyRect(pDirtyRect);
65
}
66
}
67
}
68