Direct3DTexture9.hpp revision ee16f0de07d4b02a81c1c9ac716d631e67f487fc
1// SwiftShader Software Renderer
2//
3// Copyright(c) 2005-2011 TransGaming Inc.
4//
5// All rights reserved. No part of this software may be copied, distributed, transmitted,
6// transcribed, stored in a retrieval system, translated into any human or computer
7// language by any means, or disclosed to third parties without the explicit written
8// agreement of TransGaming Inc. Without such an agreement, no rights or licenses, express
9// or implied, including but not limited to any patent rights, are granted to you.
10//
11
12#ifndef D3D9_Direct3DTexture9_hpp
13#define D3D9_Direct3DTexture9_hpp
14
15#include "Direct3DBaseTexture9.hpp"
16
17#include "Config.hpp"
18
19#include <d3d9.h>
20
21namespace D3D9
22{
23	class Direct3DSurface9;
24
25	class Direct3DTexture9 : public IDirect3DTexture9, public Direct3DBaseTexture9
26	{
27	public:
28		Direct3DTexture9(Direct3DDevice9 *device, unsigned int width, unsigned int height, unsigned int levels, unsigned long usage, D3DFORMAT format, D3DPOOL pool);
29
30		virtual ~Direct3DTexture9();
31
32		// IUnknown methods
33		long __stdcall QueryInterface(const IID &iid, void **object);
34		unsigned long __stdcall AddRef();
35		unsigned long __stdcall Release();
36
37		// IDirect3DResource9 methods
38		long __stdcall GetDevice(IDirect3DDevice9 **device);
39		long __stdcall SetPrivateData(const GUID &guid, const void *data, unsigned long size, unsigned long flags);
40		long __stdcall GetPrivateData(const GUID &guid, void *data, unsigned long *size);
41		long __stdcall FreePrivateData(const GUID &guid);
42		unsigned long __stdcall SetPriority(unsigned long newPriority);
43		unsigned long __stdcall GetPriority();
44		void __stdcall PreLoad();
45		D3DRESOURCETYPE __stdcall GetType();
46
47		// IDirect3DBaseTexture9 methods
48		unsigned long __stdcall SetLOD(unsigned long newLOD);
49		unsigned long __stdcall GetLOD();
50		unsigned long __stdcall GetLevelCount();
51		long __stdcall SetAutoGenFilterType(D3DTEXTUREFILTERTYPE filterType);
52		D3DTEXTUREFILTERTYPE __stdcall GetAutoGenFilterType();
53		void __stdcall GenerateMipSubLevels();
54
55		// IDirect3DTexture9 methods
56		long __stdcall GetLevelDesc(unsigned int level, D3DSURFACE_DESC *description);
57		long __stdcall GetSurfaceLevel(unsigned int level, IDirect3DSurface9 **surface);
58		long __stdcall LockRect(unsigned int level, D3DLOCKED_RECT *lockedRect, const RECT *rect, unsigned long flags);
59		long __stdcall UnlockRect(unsigned int level);
60		long __stdcall AddDirtyRect(const RECT *dirtyRect);
61
62		// Internal methods
63		Direct3DSurface9 *getInternalSurfaceLevel(unsigned int level);
64
65	private:
66		// Creation parameters
67		const unsigned int width;
68		const unsigned int height;
69
70		Direct3DSurface9 *surfaceLevel[MIPMAP_LEVELS];
71	};
72}
73
74#endif // D3D9_Direct3DTexture9_hpp
75