• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #include "Direct3DBaseTexture8.hpp"
16 
17 #include "Resource.hpp"
18 #include "Debug.hpp"
19 
20 namespace D3D8
21 {
Direct3DBaseTexture8(Direct3DDevice8 * device,D3DRESOURCETYPE type,unsigned long levels,unsigned long usage)22 	Direct3DBaseTexture8::Direct3DBaseTexture8(Direct3DDevice8 *device, D3DRESOURCETYPE type, unsigned long levels, unsigned long usage) : Direct3DResource8(device, type, 0), levels(levels), usage(usage)
23 	{
24 		filterType = D3DTEXF_LINEAR;
25 		LOD = 0;
26 
27 		resource = new sw::Resource(0);
28 	}
29 
~Direct3DBaseTexture8()30 	Direct3DBaseTexture8::~Direct3DBaseTexture8()
31 	{
32 		resource->destruct();
33 	}
34 
QueryInterface(const IID & iid,void ** object)35 	long Direct3DBaseTexture8::QueryInterface(const IID &iid, void **object)
36 	{
37 		TRACE("");
38 
39 		if(iid == IID_IDirect3DBaseTexture8 ||
40 		   iid == IID_IDirect3DResource8 ||
41 		   iid == IID_IUnknown)
42 		{
43 			AddRef();
44 			*object = this;
45 
46 			return S_OK;
47 		}
48 
49 		*object = 0;
50 
51 		return NOINTERFACE(iid);
52 	}
53 
AddRef()54 	unsigned long Direct3DBaseTexture8::AddRef()
55 	{
56 		TRACE("");
57 
58 		return Direct3DResource8::AddRef();
59 	}
60 
Release()61 	unsigned long Direct3DBaseTexture8::Release()
62 	{
63 		TRACE("");
64 
65 		return Direct3DResource8::Release();
66 	}
67 
FreePrivateData(const GUID & guid)68 	long Direct3DBaseTexture8::FreePrivateData(const GUID &guid)
69 	{
70 		TRACE("");
71 
72 		return Direct3DResource8::FreePrivateData(guid);
73 	}
74 
GetPrivateData(const GUID & guid,void * data,unsigned long * size)75 	long Direct3DBaseTexture8::GetPrivateData(const GUID &guid, void *data, unsigned long *size)
76 	{
77 		TRACE("");
78 
79 		return Direct3DResource8::GetPrivateData(guid, data, size);
80 	}
81 
PreLoad()82 	void Direct3DBaseTexture8::PreLoad()
83 	{
84 		TRACE("");
85 
86 		Direct3DResource8::PreLoad();
87 	}
88 
SetPrivateData(const GUID & guid,const void * data,unsigned long size,unsigned long flags)89 	long Direct3DBaseTexture8::SetPrivateData(const GUID &guid, const void *data, unsigned long size, unsigned long flags)
90 	{
91 		TRACE("");
92 
93 		return Direct3DResource8::SetPrivateData(guid, data, size, flags);
94 	}
95 
GetDevice(IDirect3DDevice8 ** device)96 	long Direct3DBaseTexture8::GetDevice(IDirect3DDevice8 **device)
97 	{
98 		TRACE("");
99 
100 		return Direct3DResource8::GetDevice(device);
101 	}
102 
SetPriority(unsigned long newPriority)103 	unsigned long Direct3DBaseTexture8::SetPriority(unsigned long newPriority)
104 	{
105 		TRACE("");
106 
107 		return Direct3DResource8::SetPriority(newPriority);
108 	}
109 
GetPriority()110 	unsigned long Direct3DBaseTexture8::GetPriority()
111 	{
112 		TRACE("");
113 
114 		return Direct3DResource8::GetPriority();
115 	}
116 
GetType()117 	D3DRESOURCETYPE Direct3DBaseTexture8::GetType()
118 	{
119 		TRACE("");
120 
121 		return Direct3DResource8::GetType();
122 	}
123 
GetLevelCount()124 	unsigned long Direct3DBaseTexture8::GetLevelCount()
125 	{
126 		TRACE("");
127 
128 		return levels;
129 	}
130 
GetLOD()131 	unsigned long Direct3DBaseTexture8::GetLOD()
132 	{
133 		TRACE("");
134 
135 		return LOD;
136 	}
137 
SetLOD(unsigned long newLOD)138 	unsigned long Direct3DBaseTexture8::SetLOD(unsigned long newLOD)
139 	{
140 		TRACE("");
141 
142 		LOD = newLOD;
143 
144 		return 0;   // TODO
145 	}
146 
getResource() const147 	sw::Resource *Direct3DBaseTexture8::getResource() const
148 	{
149 		return resource;
150 	}
151 
getInternalLevelCount()152 	unsigned long Direct3DBaseTexture8::getInternalLevelCount()
153 	{
154 		return levels;
155 	}
156 }
157