blob: 3aafd45adaf7fb1c7d549cc21e270ebfaeef9a56 [file] [log] [blame]
Nicolas Capens0bac2852016-05-07 06:09:58 -04001// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
Nicolas Capensee16f0d2015-07-16 17:40:10 -04002//
Nicolas Capens0bac2852016-05-07 06:09:58 -04003// 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
Nicolas Capensee16f0d2015-07-16 17:40:10 -04006//
Nicolas Capens0bac2852016-05-07 06:09:58 -04007// http://www.apache.org/licenses/LICENSE-2.0
Nicolas Capensee16f0d2015-07-16 17:40:10 -04008//
Nicolas Capens0bac2852016-05-07 06:09:58 -04009// 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.
Nicolas Capensee16f0d2015-07-16 17:40:10 -040014
15#ifndef D3D9_Direct3DVertexDeclaration9_hpp
16#define D3D9_Direct3DVertexDeclaration9_hpp
17
18#include "Unknown.hpp"
19
20#include <d3d9.h>
21
22namespace 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
Nicolas Capens3b9e1ea2017-06-12 12:43:48 -040032 ~Direct3DVertexDeclaration9() override;
Nicolas Capensee16f0d2015-07-16 17:40:10 -040033
34 // IUnknown methods
Nicolas Capens3b9e1ea2017-06-12 12:43:48 -040035 long __stdcall QueryInterface(const IID &iid, void **object) override;
36 unsigned long __stdcall AddRef() override;
37 unsigned long __stdcall Release() override;
Nicolas Capensee16f0d2015-07-16 17:40:10 -040038
39 // IDirect3DVertexDeclaration9 methods
Nicolas Capens3b9e1ea2017-06-12 12:43:48 -040040 long __stdcall GetDevice(IDirect3DDevice9 **device) override;
41 long __stdcall GetDeclaration(D3DVERTEXELEMENT9 *declaration, unsigned int *numElements) override;
Nicolas Capensee16f0d2015-07-16 17:40:10 -040042
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;
Nicolas Capens3b9e1ea2017-06-12 12:43:48 -040053
Nicolas Capensee16f0d2015-07-16 17:40:10 -040054 int numElements;
55 unsigned long FVF;
56 bool preTransformed;
57 };
58}
59
60#endif // D3D9_Direct3DVertexDeclaration9_hpp