|
@@ -120,7 +120,7 @@ GFXFormat GFXPCD3D9Device::selectSupportedFormat(GFXTextureProfile *profile,
|
|
usage |= D3DUSAGE_QUERY_FILTER;
|
|
usage |= D3DUSAGE_QUERY_FILTER;
|
|
|
|
|
|
D3DDISPLAYMODE mode;
|
|
D3DDISPLAYMODE mode;
|
|
- D3D9Assert(mD3D->GetAdapterDisplayMode(D3DADAPTER_DEFAULT, &mode), "Unable to get adapter mode.");
|
|
|
|
|
|
+ D3D9Assert(mD3D->GetAdapterDisplayMode(mAdapterIndex, &mode), "Unable to get adapter mode.");
|
|
|
|
|
|
D3DRESOURCETYPE type;
|
|
D3DRESOURCETYPE type;
|
|
if(texture)
|
|
if(texture)
|
|
@@ -130,7 +130,7 @@ GFXFormat GFXPCD3D9Device::selectSupportedFormat(GFXTextureProfile *profile,
|
|
|
|
|
|
for(U32 i=0; i<formats.size(); i++)
|
|
for(U32 i=0; i<formats.size(); i++)
|
|
{
|
|
{
|
|
- if(mD3D->CheckDeviceFormat(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, mode.Format,
|
|
|
|
|
|
+ if(mD3D->CheckDeviceFormat(mAdapterIndex, D3DDEVTYPE_HAL, mode.Format,
|
|
usage, type, GFXD3D9TextureFormat[formats[i]]) == D3D_OK)
|
|
usage, type, GFXD3D9TextureFormat[formats[i]]) == D3D_OK)
|
|
return formats[i];
|
|
return formats[i];
|
|
}
|
|
}
|
|
@@ -259,9 +259,12 @@ void GFXPCD3D9Device::enumerateAdapters( Vector<GFXAdapter*> &adapterList )
|
|
D3DADAPTER_IDENTIFIER9 temp;
|
|
D3DADAPTER_IDENTIFIER9 temp;
|
|
d3d9->GetAdapterIdentifier( adapterIndex, NULL, &temp ); // The NULL is the flags which deal with WHQL
|
|
d3d9->GetAdapterIdentifier( adapterIndex, NULL, &temp ); // The NULL is the flags which deal with WHQL
|
|
|
|
|
|
- dStrcpy( toAdd->mName, temp.Description );
|
|
|
|
|
|
+ dStrncpy(toAdd->mName, temp.Description, GFXAdapter::MaxAdapterNameLen);
|
|
dStrncat(toAdd->mName, " (D3D9)", GFXAdapter::MaxAdapterNameLen);
|
|
dStrncat(toAdd->mName, " (D3D9)", GFXAdapter::MaxAdapterNameLen);
|
|
|
|
|
|
|
|
+ // And the output display device name
|
|
|
|
+ dStrncpy(toAdd->mOutputName, temp.DeviceName, GFXAdapter::MaxAdapterNameLen);
|
|
|
|
+
|
|
// Video mode enumeration.
|
|
// Video mode enumeration.
|
|
Vector<D3DFORMAT> formats( __FILE__, __LINE__ );
|
|
Vector<D3DFORMAT> formats( __FILE__, __LINE__ );
|
|
formats.push_back( D3DFMT_R5G6B5 ); // D3DFMT_R5G6B5 - 16bit format
|
|
formats.push_back( D3DFMT_R5G6B5 ); // D3DFMT_R5G6B5 - 16bit format
|
|
@@ -303,10 +306,10 @@ void GFXPCD3D9Device::enumerateVideoModes()
|
|
|
|
|
|
for( S32 i = 0; i < formats.size(); i++ )
|
|
for( S32 i = 0; i < formats.size(); i++ )
|
|
{
|
|
{
|
|
- for( U32 j = 0; j < mD3D->GetAdapterModeCount( D3DADAPTER_DEFAULT, formats[i] ); j++ )
|
|
|
|
|
|
+ for( U32 j = 0; j < mD3D->GetAdapterModeCount( mAdapterIndex, formats[i] ); j++ )
|
|
{
|
|
{
|
|
D3DDISPLAYMODE mode;
|
|
D3DDISPLAYMODE mode;
|
|
- mD3D->EnumAdapterModes( D3DADAPTER_DEFAULT, formats[i], j, &mode );
|
|
|
|
|
|
+ mD3D->EnumAdapterModes( mAdapterIndex, formats[i], j, &mode );
|
|
|
|
|
|
GFXVideoMode toAdd;
|
|
GFXVideoMode toAdd;
|
|
|
|
|
|
@@ -392,7 +395,7 @@ void GFXPCD3D9Device::init( const GFXVideoMode &mode, PlatformWindow *window /*
|
|
deviceFlags |= D3DCREATE_PUREDEVICE;
|
|
deviceFlags |= D3DCREATE_PUREDEVICE;
|
|
#endif
|
|
#endif
|
|
|
|
|
|
- hres = createDevice( D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, winHwnd, deviceFlags, &d3dpp);
|
|
|
|
|
|
+ hres = createDevice( mAdapterIndex, D3DDEVTYPE_HAL, winHwnd, deviceFlags, &d3dpp);
|
|
|
|
|
|
if (FAILED(hres) && hres != D3DERR_OUTOFVIDEOMEMORY)
|
|
if (FAILED(hres) && hres != D3DERR_OUTOFVIDEOMEMORY)
|
|
{
|
|
{
|
|
@@ -403,7 +406,7 @@ void GFXPCD3D9Device::init( const GFXVideoMode &mode, PlatformWindow *window /*
|
|
// try mixed mode
|
|
// try mixed mode
|
|
deviceFlags &= (~D3DCREATE_HARDWARE_VERTEXPROCESSING);
|
|
deviceFlags &= (~D3DCREATE_HARDWARE_VERTEXPROCESSING);
|
|
deviceFlags |= D3DCREATE_MIXED_VERTEXPROCESSING;
|
|
deviceFlags |= D3DCREATE_MIXED_VERTEXPROCESSING;
|
|
- hres = createDevice( D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL,
|
|
|
|
|
|
+ hres = createDevice( mAdapterIndex, D3DDEVTYPE_HAL,
|
|
winHwnd, deviceFlags,
|
|
winHwnd, deviceFlags,
|
|
&d3dpp);
|
|
&d3dpp);
|
|
|
|
|
|
@@ -413,7 +416,7 @@ void GFXPCD3D9Device::init( const GFXVideoMode &mode, PlatformWindow *window /*
|
|
Con::errorf(" Failed to create mixed mode device, trying software device");
|
|
Con::errorf(" Failed to create mixed mode device, trying software device");
|
|
deviceFlags &= (~D3DCREATE_MIXED_VERTEXPROCESSING);
|
|
deviceFlags &= (~D3DCREATE_MIXED_VERTEXPROCESSING);
|
|
deviceFlags |= D3DCREATE_SOFTWARE_VERTEXPROCESSING;
|
|
deviceFlags |= D3DCREATE_SOFTWARE_VERTEXPROCESSING;
|
|
- hres = createDevice( D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL,
|
|
|
|
|
|
+ hres = createDevice( mAdapterIndex, D3DDEVTYPE_HAL,
|
|
winHwnd, deviceFlags,
|
|
winHwnd, deviceFlags,
|
|
&d3dpp);
|
|
&d3dpp);
|
|
|
|
|
|
@@ -446,7 +449,7 @@ void GFXPCD3D9Device::init( const GFXVideoMode &mode, PlatformWindow *window /*
|
|
Con::printf(" Cur. D3DDevice ref count=%d", mD3DDevice->AddRef() - 1);
|
|
Con::printf(" Cur. D3DDevice ref count=%d", mD3DDevice->AddRef() - 1);
|
|
mD3DDevice->Release();
|
|
mD3DDevice->Release();
|
|
|
|
|
|
- mTextureManager = new GFXD3D9TextureManager( mD3DDevice );
|
|
|
|
|
|
+ mTextureManager = new GFXD3D9TextureManager( mD3DDevice, mAdapterIndex );
|
|
|
|
|
|
// Now reacquire all the resources we trashed earlier
|
|
// Now reacquire all the resources we trashed earlier
|
|
reacquireDefaultPoolResources();
|
|
reacquireDefaultPoolResources();
|
|
@@ -510,7 +513,7 @@ void GFXPCD3D9Device::init( const GFXVideoMode &mode, PlatformWindow *window /*
|
|
|
|
|
|
Con::printf( " Using Direct3D9Ex: %s", isD3D9Ex() ? "Yes" : "No" );
|
|
Con::printf( " Using Direct3D9Ex: %s", isD3D9Ex() ? "Yes" : "No" );
|
|
|
|
|
|
- mCardProfiler = new GFXD3D9CardProfiler();
|
|
|
|
|
|
+ mCardProfiler = new GFXD3D9CardProfiler(mAdapterIndex);
|
|
mCardProfiler->init();
|
|
mCardProfiler->init();
|
|
|
|
|
|
gScreenShot = new ScreenShotD3D;
|
|
gScreenShot = new ScreenShotD3D;
|
|
@@ -956,7 +959,7 @@ void GFXPCD3D9Device::_validateMultisampleParams(D3DFORMAT format, D3DMULTISAMPL
|
|
if (aatype != D3DMULTISAMPLE_NONE)
|
|
if (aatype != D3DMULTISAMPLE_NONE)
|
|
{
|
|
{
|
|
DWORD MaxSampleQualities;
|
|
DWORD MaxSampleQualities;
|
|
- mD3D->CheckDeviceMultiSampleType(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, format, FALSE, D3DMULTISAMPLE_NONMASKABLE, &MaxSampleQualities);
|
|
|
|
|
|
+ mD3D->CheckDeviceMultiSampleType(mAdapterIndex, D3DDEVTYPE_HAL, format, FALSE, D3DMULTISAMPLE_NONMASKABLE, &MaxSampleQualities);
|
|
aatype = D3DMULTISAMPLE_NONMASKABLE;
|
|
aatype = D3DMULTISAMPLE_NONMASKABLE;
|
|
aalevel = getMin((U32)aalevel, (U32)MaxSampleQualities-1);
|
|
aalevel = getMin((U32)aalevel, (U32)MaxSampleQualities-1);
|
|
}
|
|
}
|