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_Direct3DVertexDeclaration9_hpp 16 #define D3D9_Direct3DVertexDeclaration9_hpp 17 18 #include "Unknown.hpp" 19 20 #include <d3d9.h> 21 22 namespace D3D9 23 { 24 class Direct3DDevice9; 25 26 class Direct3DVertexDeclaration9 : public IDirect3DVertexDeclaration9, public Unknown 27 { 28 public: 29 Direct3DVertexDeclaration9(Direct3DDevice9 *device, const D3DVERTEXELEMENT9 *vertexElements); 30 Direct3DVertexDeclaration9(Direct3DDevice9 *device, unsigned long FVF); 31 32 virtual ~Direct3DVertexDeclaration9(); 33 34 // IUnknown methods 35 long __stdcall QueryInterface(const IID &iid, void **object); 36 unsigned long __stdcall AddRef(); 37 unsigned long __stdcall Release(); 38 39 // IDirect3DVertexDeclaration9 methods 40 long __stdcall GetDevice(IDirect3DDevice9 **device); 41 long __stdcall GetDeclaration(D3DVERTEXELEMENT9 *declaration, unsigned int *numElements); 42 43 // Internal methods 44 unsigned long getFVF() const; 45 bool isPreTransformed() const; 46 47 private: 48 unsigned long computeFVF(); // If equivalent to FVF, else 0 49 50 // Creation parameters 51 Direct3DDevice9 *const device; 52 D3DVERTEXELEMENT9 *vertexElement; 53 54 int numElements; 55 unsigned long FVF; 56 bool preTransformed; 57 }; 58 } 59 60 #endif // D3D9_Direct3DVertexDeclaration9_hpp 61