Home | History | Annotate | Download | only in D3D8
      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 D3D8_Direct3DBaseTexture8_hpp
     16 #define D3D8_Direct3DBaseTexture8_hpp
     17 
     18 #include "Direct3DResource8.hpp"
     19 
     20 #include <d3d8.h>
     21 
     22 namespace sw
     23 {
     24 	class Resource;
     25 }
     26 
     27 namespace D3D8
     28 {
     29 	class Direct3DBaseTexture8 : public IDirect3DBaseTexture8, public Direct3DResource8
     30 	{
     31 	public:
     32 		Direct3DBaseTexture8(Direct3DDevice8 *device, D3DRESOURCETYPE type, unsigned long levels, unsigned long usage);
     33 
     34 		~Direct3DBaseTexture8() override;
     35 
     36 		// IUnknown methods
     37 		long __stdcall QueryInterface(const IID &iid, void **object) override;
     38 		unsigned long __stdcall AddRef() override;
     39 		unsigned long __stdcall Release() override;
     40 
     41 		// IDirect3DResource8 methods
     42 		long __stdcall FreePrivateData(const GUID &guid) override;
     43 		long __stdcall GetPrivateData(const GUID &guid, void *data, unsigned long *size) override;
     44 		void __stdcall PreLoad() override;
     45 		long __stdcall SetPrivateData(const GUID &guid, const void *data, unsigned long size, unsigned long flags) override;
     46 		long __stdcall GetDevice(IDirect3DDevice8 **device) override;
     47 		unsigned long __stdcall SetPriority(unsigned long newPriority) override;
     48 		unsigned long __stdcall GetPriority() override;
     49 		D3DRESOURCETYPE __stdcall GetType() override;
     50 
     51 		// IDirect3DBaseTexture8 methods
     52 		unsigned long __stdcall GetLevelCount() override;
     53 		unsigned long __stdcall GetLOD() override;
     54 		unsigned long __stdcall SetLOD(unsigned long newLOD) override;
     55 
     56 		// Intenal methods
     57 		sw::Resource *getResource() const;
     58 		unsigned long getInternalLevelCount();
     59 
     60 	protected:
     61 		// Creation paramters
     62 		unsigned long levels;   // Recalculated when 0
     63 		const unsigned long usage;
     64 
     65 		sw::Resource *resource;
     66 
     67 	private:
     68 		D3DTEXTUREFILTERTYPE filterType;
     69 		unsigned long LOD;
     70 	};
     71 }
     72 
     73 #endif // D3D8_Direct3DBaseTexture8_hpp
     74