blob: b59e4a937c869c2941d3daece16390613543402f [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_Direct3DIndexBuffer9_hpp
16#define D3D9_Direct3DIndexBuffer9_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 Direct3DIndexBuffer9 : public IDirect3DIndexBuffer9, public Direct3DResource9
30 {
31 public:
32 Direct3DIndexBuffer9(Direct3DDevice9 *device, unsigned int length, unsigned long usage, D3DFORMAT format, D3DPOOL pool);
33
Nicolas Capens3b9e1ea2017-06-12 12:43:48 -040034 ~Direct3DIndexBuffer9() override;
Nicolas Capensee16f0d2015-07-16 17:40:10 -040035
36 // IUnknown methods
Nicolas Capens3b9e1ea2017-06-12 12:43:48 -040037 long __stdcall QueryInterface(const IID &iid, void **object) override;
38 unsigned long __stdcall AddRef() override;
39 unsigned long __stdcall Release() override;
Nicolas Capensee16f0d2015-07-16 17:40:10 -040040
41 // IDirect3DResource9 methods
Nicolas Capens3b9e1ea2017-06-12 12:43:48 -040042 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(IDirect3DDevice9 **device) override;
47 unsigned long __stdcall SetPriority(unsigned long newPriority) override;
48 unsigned long __stdcall GetPriority() override;
49 D3DRESOURCETYPE __stdcall GetType() override;
Nicolas Capensee16f0d2015-07-16 17:40:10 -040050
51 // IDirect3DIndexBuffer9 methods
Nicolas Capens3b9e1ea2017-06-12 12:43:48 -040052 long __stdcall GetDesc(D3DINDEXBUFFER_DESC *description) override;
53 long __stdcall Lock(unsigned int offset, unsigned int size, void **data, unsigned long flags) override;
54 long __stdcall Unlock() override;
55
Nicolas Capensee16f0d2015-07-16 17:40:10 -040056 // Internal methods
57 sw::Resource *getResource() const;
58 bool is32Bit() const;
59
60 private:
61 // Creation parameters
62 const unsigned int length;
63 const long usage;
64 const D3DFORMAT format;
65
66 sw::Resource *indexBuffer;
67 int lockCount;
68 };
69}
70
71#endif // D3D9_Direct3DIndexBuffer9_hpp