1 | ///////////////////////////////////////////////////////////////////////////////
|
---|
2 | //
|
---|
3 | // ## ######
|
---|
4 | // ###### ###
|
---|
5 | // ## ############### Shark 3D Engine (www.shark3d.com)
|
---|
6 | // ########## # # #
|
---|
7 | // ######## Copyright (c) 1996-2006 Spinor GmbH.
|
---|
8 | // ######### # # # All rights reserved.
|
---|
9 | // ## ##########
|
---|
10 | // ##
|
---|
11 | //
|
---|
12 | ///////////////////////////////////////////////////////////////////////////////
|
---|
13 |
|
---|
14 | //@cpp
|
---|
15 | #ifndef S3D_DRV_D3D9_ENUM_H
|
---|
16 | #define S3D_DRV_D3D9_ENUM_H
|
---|
17 |
|
---|
18 | #include "drv_d3d9_types.h"
|
---|
19 | #include "drv_d3d9_param.h"
|
---|
20 |
|
---|
21 | ///////////////////////////////////////////////////////////////////////////////
|
---|
22 |
|
---|
23 | //@
|
---|
24 | typedef s3d_CUtilArray<D3DFORMAT> s3d_CDrvD3d9FmtArray;
|
---|
25 |
|
---|
26 | //@
|
---|
27 | typedef s3d_CUtilMap<D3DFORMAT, s3d_CDrvD3d9FmtArray> s3d_CDrvD3d9FmtMap;
|
---|
28 |
|
---|
29 | ///////////////////////////////////////////////////////////////////////////////
|
---|
30 |
|
---|
31 | //@
|
---|
32 | struct s3d_CDrvD3d9EnumAdapterFmt
|
---|
33 | {
|
---|
34 | // AdapterFmt->BackBufferFmts
|
---|
35 | s3d_CDrvD3d9FmtMap m_BackBufFmtMap;
|
---|
36 | // BackBufferFmt->DepthstencilFmts
|
---|
37 | s3d_CDrvD3d9FmtMap m_DepthFmtMap;
|
---|
38 | };
|
---|
39 |
|
---|
40 | //@
|
---|
41 | typedef s3d_CUtilArray<s3d_CDrvD3d9EnumAdapterFmt>
|
---|
42 | s3d_CDrvD3d9EnumAdapterFmtArray;
|
---|
43 |
|
---|
44 | ///////////////////////////////////////////////////////////////////////////////
|
---|
45 |
|
---|
46 | //@
|
---|
47 | struct s3d_CDrvD3d9EnumEntry
|
---|
48 | {
|
---|
49 | int m_Adapter;
|
---|
50 | D3DFORMAT m_AdapterFmt;
|
---|
51 | s3d_CDrvGfxEnumEntry m_GfxEnumEntry;
|
---|
52 |
|
---|
53 | int Compare(const s3d_CDrvD3d9EnumEntry &e) const;
|
---|
54 | bool operator==(const s3d_CDrvD3d9EnumEntry &e) const;
|
---|
55 | bool operator<(const s3d_CDrvD3d9EnumEntry &e) const;
|
---|
56 | static int KeyOfFmt(D3DFORMAT Fmt);
|
---|
57 | };
|
---|
58 |
|
---|
59 | //@
|
---|
60 | typedef s3d_CUtilArray<s3d_CDrvD3d9EnumEntry> s3d_CDrvD3d9EnumArray;
|
---|
61 |
|
---|
62 | ///////////////////////////////////////////////////////////////////////////////
|
---|
63 |
|
---|
64 | //@
|
---|
65 | struct s3d_CDrvD3d9EnumRef
|
---|
66 | {
|
---|
67 | int m_Adapter;
|
---|
68 | D3DFORMAT m_AdapterFmt;
|
---|
69 | int m_Width;
|
---|
70 | int m_Height;
|
---|
71 | int m_Depth;
|
---|
72 | int m_Freq;
|
---|
73 | bool m_Fullscreen;
|
---|
74 |
|
---|
75 | static int Compare(
|
---|
76 | const s3d_CDrvD3d9EnumEntry &Entry,
|
---|
77 | const s3d_CDrvD3d9EnumRef &Ref);
|
---|
78 | };
|
---|
79 |
|
---|
80 | S3D_SYS_INLINE
|
---|
81 | bool operator ==(
|
---|
82 | const s3d_CDrvD3d9EnumEntry &Entry, const s3d_CDrvD3d9EnumRef &Ref)
|
---|
83 | {
|
---|
84 | return s3d_CDrvD3d9EnumRef::Compare(Entry, Ref) == 0;
|
---|
85 | }
|
---|
86 |
|
---|
87 | S3D_SYS_INLINE
|
---|
88 | bool operator <(
|
---|
89 | const s3d_CDrvD3d9EnumEntry &Entry, const s3d_CDrvD3d9EnumRef &Ref)
|
---|
90 | {
|
---|
91 | return s3d_CDrvD3d9EnumRef::Compare(Entry, Ref) < 0;
|
---|
92 | }
|
---|
93 |
|
---|
94 | ///////////////////////////////////////////////////////////////////////////////
|
---|
95 |
|
---|
96 | //@
|
---|
97 | class s3d_CDrvD3d9Enum
|
---|
98 | {
|
---|
99 | public:
|
---|
100 | bool Enumerate(
|
---|
101 | s3d_CUtilMsgHandler *MsgHandler, s3d_CUtilStr_cr Info,
|
---|
102 | s3d_CUtilMemPool *MemPool, s3d_CDrvD3d9Param *D3dParam,
|
---|
103 | LPDIRECT3D9 D3d,
|
---|
104 | bool Fullscreen, bool NoStencil);
|
---|
105 | void CollectEntries(
|
---|
106 | s3d_CUtilArray<s3d_CDrvGfxEnumEntry> &EnumArray);
|
---|
107 | bool SearchEntry(
|
---|
108 | s3d_CDrvD3d9EnumEntry &EnumEntry, UINT Adapter,
|
---|
109 | int Prop, int Width, int Height, int Depth, int Frequency,
|
---|
110 | bool Fullscreen);
|
---|
111 | void GetBufferFmts(
|
---|
112 | int Depth, D3DFORMAT &BackBufFmt, D3DFORMAT &DepthStencilFmt,
|
---|
113 | const s3d_CDrvD3d9EnumEntry &EnumEntry);
|
---|
114 |
|
---|
115 | private:
|
---|
116 | s3d_CDrvD3d9EnumArray m_ModeArray;
|
---|
117 | s3d_CDrvD3d9EnumAdapterFmtArray m_AdapterFmtArray;
|
---|
118 |
|
---|
119 | bool CheckRequirements(const D3DCAPS9 &Caps);
|
---|
120 | };
|
---|
121 | ///////////////////////////////////////////////////////////////////////////////
|
---|
122 |
|
---|
123 | #endif
|
---|