1// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//    http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15#ifndef D3D9_Direct3DVolumeTexture9_hpp
16#define D3D9_Direct3DVolumeTexture9_hpp
17
18#include "Direct3DBaseTexture9.hpp"
19
20#include "Config.hpp"
21
22#include <d3d9.h>
23
24namespace D3D9
25{
26	class Direct3DVolume9;
27
28	class Direct3DVolumeTexture9 : public IDirect3DVolumeTexture9, public Direct3DBaseTexture9
29	{
30	public:
31		Direct3DVolumeTexture9(Direct3DDevice9 *device, unsigned int width, unsigned int height, unsigned int depth, unsigned int levels, unsigned long usage, D3DFORMAT format, D3DPOOL pool);
32
33		~Direct3DVolumeTexture9() override;
34
35		// IUnknown methods
36		long __stdcall QueryInterface(const IID &iid, void **object) override;
37		unsigned long __stdcall AddRef() override;
38		unsigned long __stdcall Release() override;
39
40		// IDirect3DResource9 methods
41		long __stdcall GetDevice(IDirect3DDevice9 **device) override;
42		long __stdcall SetPrivateData(const GUID &guid, const void *data, unsigned long size, unsigned long flags) override;
43		long __stdcall GetPrivateData(const GUID &guid, void *data, unsigned long *size) override;
44		long __stdcall FreePrivateData(const GUID &guid) override;
45		unsigned long __stdcall SetPriority(unsigned long newPriority) override;
46		unsigned long __stdcall GetPriority() override;
47		void __stdcall PreLoad() override;
48		D3DRESOURCETYPE __stdcall GetType() override;
49
50		// IDirect3DBaseTexture9 methods
51		unsigned long __stdcall SetLOD(unsigned long newLOD) override;
52		unsigned long __stdcall GetLOD() override;
53		unsigned long __stdcall GetLevelCount() override;
54		long __stdcall SetAutoGenFilterType(D3DTEXTUREFILTERTYPE filterType) override;
55		D3DTEXTUREFILTERTYPE __stdcall GetAutoGenFilterType() override;
56		void __stdcall GenerateMipSubLevels() override;
57
58		// IDirect3DVolumeTexture9 methods
59		long __stdcall GetLevelDesc(unsigned int level, D3DVOLUME_DESC *description) override;
60		long __stdcall GetVolumeLevel(unsigned int level, IDirect3DVolume9 **volume) override;
61		long __stdcall LockBox(unsigned int level, D3DLOCKED_BOX *lockedVolume, const D3DBOX *box, unsigned long flags) override;
62		long __stdcall UnlockBox(unsigned int level) override;
63		long __stdcall AddDirtyBox(const D3DBOX *dirtyBox) override;
64
65		// Internal methods
66		Direct3DVolume9 *getInternalVolumeLevel(unsigned int level);
67
68	private:
69		// Creation parameters
70		const unsigned int width;
71		const unsigned int height;
72		const unsigned int depth;
73
74		Direct3DVolume9 *volumeLevel[sw::MIPMAP_LEVELS];
75	};
76}
77
78#endif // D3D9_Direct3DVolumeTexture9_hpp
79