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_Direct3DBaseTexture9_hpp 16#define D3D9_Direct3DBaseTexture9_hpp 17 18#include "Direct3DResource9.hpp" 19 20#include <d3d9.h> 21 22namespace sw 23{ 24 class Resource; 25} 26 27namespace D3D9 28{ 29 class Direct3DBaseTexture9 : public IDirect3DBaseTexture9, public Direct3DResource9 30 { 31 public: 32 Direct3DBaseTexture9(Direct3DDevice9 *device, D3DRESOURCETYPE type, D3DFORMAT format, D3DPOOL pool, unsigned long levels, unsigned long usage); 33 34 virtual ~Direct3DBaseTexture9(); 35 36 // IUnknown methods 37 long __stdcall QueryInterface(const IID &iid, void **object); 38 unsigned long __stdcall AddRef(); 39 unsigned long __stdcall Release(); 40 41 // IDirect3DResource9 methods 42 long __stdcall GetDevice(IDirect3DDevice9 **device); 43 long __stdcall SetPrivateData(const GUID &guid, const void *data, unsigned long size, unsigned long flags); 44 long __stdcall GetPrivateData(const GUID &guid, void *data, unsigned long *size); 45 long __stdcall FreePrivateData(const GUID &guid); 46 unsigned long __stdcall SetPriority(unsigned long newPriority); 47 unsigned long __stdcall GetPriority(); 48 void __stdcall PreLoad(); 49 D3DRESOURCETYPE __stdcall GetType(); 50 51 // IDirect3DBaseTexture9 methods 52 unsigned long __stdcall SetLOD(unsigned long newLOD); 53 unsigned long __stdcall GetLOD(); 54 unsigned long __stdcall GetLevelCount(); 55 long __stdcall SetAutoGenFilterType(D3DTEXTUREFILTERTYPE filterType); 56 D3DTEXTUREFILTERTYPE __stdcall GetAutoGenFilterType(); 57 void __stdcall GenerateMipSubLevels(); 58 59 // Intenal methods 60 sw::Resource *getResource() const; 61 unsigned long getInternalLevelCount() const; 62 unsigned long getUsage() const; 63 D3DFORMAT getFormat() const; 64 65 protected: 66 // Creation parameters 67 unsigned long levels; // Recalculated when 0 68 const unsigned long usage; 69 const D3DFORMAT format; 70 71 sw::Resource *resource; 72 73 private: 74 D3DTEXTUREFILTERTYPE filterType; 75 unsigned long LOD; 76 }; 77} 78 79#endif // D3D9_Direct3DBaseTexture9_hpp 80