blob: 40f31a3fe0bc2b61c435927a6d27d9bda2521db5 [file] [log] [blame]
Nicolas Capens17b29fd2016-09-15 09:32:16 -04001// 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_Direct3DTexture8_hpp
16#define D3D8_Direct3DTexture8_hpp
17
18#include "Direct3DBaseTexture8.hpp"
19
20#include "Direct3DSurface8.hpp"
21
22#include "Config.hpp"
23
24#include <d3d8.h>
25
26namespace D3D8
27{
28 class Direct3DTexture8 : public IDirect3DTexture8, public Direct3DBaseTexture8
29 {
Nicolas Capens3b9e1ea2017-06-12 12:43:48 -040030 public:
Nicolas Capens17b29fd2016-09-15 09:32:16 -040031 Direct3DTexture8(Direct3DDevice8 *device, unsigned int width, unsigned int height, unsigned int levels, unsigned long usage, D3DFORMAT format, D3DPOOL pool);
32
Nicolas Capens3b9e1ea2017-06-12 12:43:48 -040033 ~Direct3DTexture8() override;
Nicolas Capens17b29fd2016-09-15 09:32:16 -040034
35 // IUnknown methods
Nicolas Capens3b9e1ea2017-06-12 12:43:48 -040036 long __stdcall QueryInterface(const IID &iid, void **object) override;
37 unsigned long __stdcall AddRef() override;
38 unsigned long __stdcall Release() override;
Nicolas Capens17b29fd2016-09-15 09:32:16 -040039
40 // IDirect3DResource8 methods
Nicolas Capens3b9e1ea2017-06-12 12:43:48 -040041 long __stdcall FreePrivateData(const GUID &guid) override;
42 long __stdcall GetPrivateData(const GUID &guid, void *data, unsigned long *size) override;
43 void __stdcall PreLoad() override;
44 long __stdcall SetPrivateData(const GUID &guid, const void *data, unsigned long size, unsigned long flags) override;
45 long __stdcall GetDevice(IDirect3DDevice8 **device) override;
46 unsigned long __stdcall SetPriority(unsigned long newPriority) override;
47 unsigned long __stdcall GetPriority() override;
48 D3DRESOURCETYPE __stdcall GetType() override;
Nicolas Capens17b29fd2016-09-15 09:32:16 -040049
50 // IDirect3DBaseTexture methods
Nicolas Capens3b9e1ea2017-06-12 12:43:48 -040051 unsigned long __stdcall GetLevelCount() override;
52 unsigned long __stdcall GetLOD() override;
53 unsigned long __stdcall SetLOD(unsigned long newLOD) override;
Nicolas Capens17b29fd2016-09-15 09:32:16 -040054
55 // IDirect3DTexture8 methods
Nicolas Capens3b9e1ea2017-06-12 12:43:48 -040056 long __stdcall GetLevelDesc(unsigned int level, D3DSURFACE_DESC *description) override;
57 long __stdcall LockRect(unsigned int level, D3DLOCKED_RECT *lockedRect, const RECT *rect, unsigned long flags) override;
58 long __stdcall GetSurfaceLevel(unsigned int level, IDirect3DSurface8 **surface) override;
59 long __stdcall UnlockRect(unsigned int level) override;
60 long __stdcall AddDirtyRect(const RECT *dirtyRect) override;
Nicolas Capens17b29fd2016-09-15 09:32:16 -040061
62 // Internal methods
63 Direct3DSurface8 *getInternalSurfaceLevel(unsigned int level);
64
65 private:
66 // Creation parameters
67 const unsigned int width;
68 const unsigned int height;
69 const D3DFORMAT format;
70 const D3DPOOL pool;
71
72 Direct3DSurface8 *surfaceLevel[sw::MIPMAP_LEVELS];
73 };
74}
75
76#endif // D3D8_Direct3DTexture8_hpp