79{
80 TRenderD3DInterface* pRenderer =
TSTATICCAST( TRenderD3DInterface, a_pRenderer );
81
84 TUINT32 uiAdapterModeCount = pRenderer->
GetDirect3D()->GetAdapterModeCount( uiAdapterIndex );
85
86 for (
TUINT32 i = 0; i < uiAdapterModeCount; i++ )
87 {
88 auto pMode =
new Mode();
89
90 pMode->SetOwnerAdapter( this );
91 pMode->SetModeIndex( i );
92
93 pRenderer->
GetDirect3D()->EnumAdapterModes( uiAdapterIndex, i, &pMode->GetD3DDisplayMode() );
94
95 for (
TUINT32 k = 0; k < uiNumSupportedDevices; k++ )
96 {
97 auto pDevice =
TSTATICCAST( TD3DAdapter::Mode::Device, pMode->GetDevice( k ) );
98
99 pDevice->SetOwnerMode( pMode );
100 pDevice->SetDeviceIndex( k );
101
103 HRESULT hRes = pRenderer->
GetDirect3D()->CheckDeviceType(
104 uiAdapterIndex,
106 pMode->GetD3DDisplayMode().Format,
107 pMode->GetD3DDisplayMode().Format,
108 FALSE
109 );
110
111 if ( SUCCEEDED( hRes ) )
112 {
113 auto& caps = pDevice->GetD3DCaps();
114
116 {
117 pDevice->m_bIsSoftware =
TTRUE;
118 }
119
120 if ( caps.Caps2 & D3DCAPS2_CANRENDERWINDOWED )
121 {
122 pDevice->m_bCanRenderWindowed =
TTRUE;
123 }
124
125 if ( caps.DevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT )
126 {
127 pDevice->m_bSupportsTransformation =
TTRUE;
128 pDevice->m_bSupportsPureDevice = caps.DevCaps & D3DDEVCAPS_PUREDEVICE;
129 }
130
131 if ( caps.DevCaps & D3DDEVCAPS_NPATCHES )
132 {
133 pDevice->m_bSupportsNPatches =
TTRUE;
134 }
135
136 if ( pDevice->SupportsHardwareTransfomations() )
137 {
138 if ( pDevice->SupportsPureDevice() )
139 {
140 pDevice->m_eFlags |= D3DCREATE_HARDWARE_VERTEXPROCESSING;
141 }
142 else
143 {
144 pDevice->m_eFlags |= D3DCREATE_MIXED_VERTEXPROCESSING;
145 }
146 }
147 else
148 {
149 pDevice->m_eFlags |= D3DCREATE_SOFTWARE_VERTEXPROCESSING;
150 }
151
153 {
155 {
156 HRESULT hCheck = pRenderer->
GetDirect3D()->CheckDeviceFormat(
157 uiAdapterIndex,
159 pMode->GetD3DDisplayMode().Format,
160 D3DUSAGE_DEPTHSTENCIL,
161 D3DRTYPE_SURFACE,
163 );
164
165 if ( SUCCEEDED( hCheck ) )
166 {
167 HRESULT hMatch = pRenderer->
GetDirect3D()->CheckDepthStencilMatch(
168 uiAdapterIndex,
170 pMode->GetD3DDisplayMode().Format,
171 pMode->GetD3DDisplayMode().Format,
173 );
174
175 if ( SUCCEEDED( hMatch ) )
176 {
177 pDevice->m_aSupportedDSFormats[ j ] =
TTRUE;
178 }
179 }
180 }
181 }
182 }
183 }
184
186 }
187}
#define TSTATICCAST(POINTERTYPE, VALUE)
virtual TUINT32 GetAdapterIndex() const override
virtual TUINT32 GetNumSupportedDevices() const override
static constexpr D3DFORMAT DEPTHSTENCILFORMATS[]
static constexpr TUINT32 NUMDEPTHSTENCILFORMATS
static constexpr D3DDEVTYPE DEVICETYPES[NUMSUPPORTEDDEVICES]
TFORCEINLINE IDirect3D8 * GetDirect3D() const
Gets the Direct3D interface.
TNodeList< Mode > * GetModeList()