Commit 9add6759 authored by cutealien's avatar cutealien

Add parameter DisplayAdapter to allow selecting the card when more than one...

Add parameter DisplayAdapter to allow selecting the card when more than one card is in the system. Only D3D support so far and not yet tested (test-system will arrive in a few days).

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@3311 dfc29bdd-3216-0410-991c-e03cc46cb475
parent afe6da7d
...@@ -37,6 +37,7 @@ namespace irr ...@@ -37,6 +37,7 @@ namespace irr
EventReceiver(0), EventReceiver(0),
WindowId(0), WindowId(0),
LoggingLevel(ELL_INFORMATION), LoggingLevel(ELL_INFORMATION),
DisplayAdapter(0),
SDK_version_do_not_use(IRRLICHT_SDK_VERSION) SDK_version_do_not_use(IRRLICHT_SDK_VERSION)
{ {
} }
...@@ -64,6 +65,7 @@ namespace irr ...@@ -64,6 +65,7 @@ namespace irr
EventReceiver = other.EventReceiver; EventReceiver = other.EventReceiver;
WindowId = other.WindowId; WindowId = other.WindowId;
LoggingLevel = other.LoggingLevel; LoggingLevel = other.LoggingLevel;
DisplayAdapter = 0;
return *this; return *this;
} }
...@@ -239,6 +241,10 @@ namespace irr ...@@ -239,6 +241,10 @@ namespace irr
*/ */
ELOG_LEVEL LoggingLevel; ELOG_LEVEL LoggingLevel;
//! Allows to select which graphic card is used for rendering when more than one card is in the system.
/** So far only supported on D3D */
u32 DisplayAdapter;
//! Don't use or change this parameter. //! Don't use or change this parameter.
/** Always set it to IRRLICHT_SDK_VERSION, which is done by default. /** Always set it to IRRLICHT_SDK_VERSION, which is done by default.
This is needed for sdk version checks. */ This is needed for sdk version checks. */
......
...@@ -34,7 +34,7 @@ CD3D8Driver::CD3D8Driver(const core::dimension2d<u32>& screenSize, HWND window, ...@@ -34,7 +34,7 @@ CD3D8Driver::CD3D8Driver(const core::dimension2d<u32>& screenSize, HWND window,
WindowId(0), SceneSourceRect(0), WindowId(0), SceneSourceRect(0),
LastVertexType((video::E_VERTEX_TYPE)-1), MaxTextureUnits(0), MaxUserClipPlanes(0), LastVertexType((video::E_VERTEX_TYPE)-1), MaxTextureUnits(0), MaxUserClipPlanes(0),
MaxLightDistance(0), LastSetLight(-1), DeviceLost(false), MaxLightDistance(0), LastSetLight(-1), DeviceLost(false),
DriverWasReset(true) DriverWasReset(true), DisplayAdapter(0)
{ {
#ifdef _DEBUG #ifdef _DEBUG
setDebugName("CD3D8Driver"); setDebugName("CD3D8Driver");
...@@ -143,10 +143,11 @@ void CD3D8Driver::createMaterialRenderers() ...@@ -143,10 +143,11 @@ void CD3D8Driver::createMaterialRenderers()
//! initialises the Direct3D API //! initialises the Direct3D API
bool CD3D8Driver::initDriver(const core::dimension2d<u32>& screenSize, bool CD3D8Driver::initDriver(const core::dimension2d<u32>& screenSize,
HWND hwnd, u32 bits, bool fullScreen, bool pureSoftware, HWND hwnd, u32 bits, bool fullScreen, bool pureSoftware,
bool highPrecisionFPU, bool vsync, u8 antiAlias) bool highPrecisionFPU, bool vsync, u8 antiAlias, u32 displayAdapter)
{ {
HRESULT hr; HRESULT hr;
typedef IDirect3D8 * (__stdcall *D3DCREATETYPE)(UINT); typedef IDirect3D8 * (__stdcall *D3DCREATETYPE)(UINT);
DisplayAdapter = displayAdapter;
#if defined( _IRR_XBOX_PLATFORM_) #if defined( _IRR_XBOX_PLATFORM_)
D3DCREATETYPE d3dCreate = (D3DCREATETYPE) &Direct3DCreate8; D3DCREATETYPE d3dCreate = (D3DCREATETYPE) &Direct3DCreate8;
...@@ -179,7 +180,7 @@ bool CD3D8Driver::initDriver(const core::dimension2d<u32>& screenSize, ...@@ -179,7 +180,7 @@ bool CD3D8Driver::initDriver(const core::dimension2d<u32>& screenSize,
// print device information // print device information
D3DADAPTER_IDENTIFIER8 dai; D3DADAPTER_IDENTIFIER8 dai;
if (!FAILED(pID3D->GetAdapterIdentifier(D3DADAPTER_DEFAULT, D3DENUM_NO_WHQL_LEVEL, &dai))) if (!FAILED(pID3D->GetAdapterIdentifier(DisplayAdapter, D3DENUM_NO_WHQL_LEVEL, &dai)))
{ {
char tmp[512]; char tmp[512];
...@@ -194,7 +195,7 @@ bool CD3D8Driver::initDriver(const core::dimension2d<u32>& screenSize, ...@@ -194,7 +195,7 @@ bool CD3D8Driver::initDriver(const core::dimension2d<u32>& screenSize,
} }
D3DDISPLAYMODE d3ddm; D3DDISPLAYMODE d3ddm;
hr = pID3D->GetAdapterDisplayMode(D3DADAPTER_DEFAULT, &d3ddm); hr = pID3D->GetAdapterDisplayMode(DisplayAdapter, &d3ddm);
if (FAILED(hr)) if (FAILED(hr))
{ {
os::Printer::log("Error: Could not get Adapter Display mode.", ELL_ERROR); os::Printer::log("Error: Could not get Adapter Display mode.", ELL_ERROR);
...@@ -236,7 +237,7 @@ bool CD3D8Driver::initDriver(const core::dimension2d<u32>& screenSize, ...@@ -236,7 +237,7 @@ bool CD3D8Driver::initDriver(const core::dimension2d<u32>& screenSize,
while(antiAlias > 0) while(antiAlias > 0)
{ {
if(!FAILED(pID3D->CheckDeviceMultiSampleType(D3DADAPTER_DEFAULT, if(!FAILED(pID3D->CheckDeviceMultiSampleType(DisplayAdapter,
devtype , present.BackBufferFormat, !fullScreen, devtype , present.BackBufferFormat, !fullScreen,
(D3DMULTISAMPLE_TYPE)antiAlias))) (D3DMULTISAMPLE_TYPE)antiAlias)))
{ {
...@@ -255,18 +256,18 @@ bool CD3D8Driver::initDriver(const core::dimension2d<u32>& screenSize, ...@@ -255,18 +256,18 @@ bool CD3D8Driver::initDriver(const core::dimension2d<u32>& screenSize,
if (StencilBuffer) if (StencilBuffer)
{ {
present.AutoDepthStencilFormat = D3DFMT_D24S8; present.AutoDepthStencilFormat = D3DFMT_D24S8;
if(FAILED(pID3D->CheckDeviceFormat(D3DADAPTER_DEFAULT, devtype, if(FAILED(pID3D->CheckDeviceFormat(DisplayAdapter, devtype,
present.BackBufferFormat, D3DUSAGE_DEPTHSTENCIL, present.BackBufferFormat, D3DUSAGE_DEPTHSTENCIL,
D3DRTYPE_SURFACE, present.AutoDepthStencilFormat))) D3DRTYPE_SURFACE, present.AutoDepthStencilFormat)))
{ {
#if !defined( _IRR_XBOX_PLATFORM_) #if !defined( _IRR_XBOX_PLATFORM_)
present.AutoDepthStencilFormat = D3DFMT_D24X4S4; present.AutoDepthStencilFormat = D3DFMT_D24X4S4;
if(FAILED(pID3D->CheckDeviceFormat(D3DADAPTER_DEFAULT, devtype, if(FAILED(pID3D->CheckDeviceFormat(DisplayAdapter, devtype,
present.BackBufferFormat, D3DUSAGE_DEPTHSTENCIL, present.BackBufferFormat, D3DUSAGE_DEPTHSTENCIL,
D3DRTYPE_SURFACE, present.AutoDepthStencilFormat))) D3DRTYPE_SURFACE, present.AutoDepthStencilFormat)))
{ {
present.AutoDepthStencilFormat = D3DFMT_D15S1; present.AutoDepthStencilFormat = D3DFMT_D15S1;
if(FAILED(pID3D->CheckDeviceFormat(D3DADAPTER_DEFAULT, devtype, if(FAILED(pID3D->CheckDeviceFormat(DisplayAdapter, devtype,
present.BackBufferFormat, D3DUSAGE_DEPTHSTENCIL, present.BackBufferFormat, D3DUSAGE_DEPTHSTENCIL,
D3DRTYPE_SURFACE, present.AutoDepthStencilFormat))) D3DRTYPE_SURFACE, present.AutoDepthStencilFormat)))
{ {
...@@ -277,7 +278,7 @@ bool CD3D8Driver::initDriver(const core::dimension2d<u32>& screenSize, ...@@ -277,7 +278,7 @@ bool CD3D8Driver::initDriver(const core::dimension2d<u32>& screenSize,
#endif #endif
} }
else else
if(FAILED(pID3D->CheckDepthStencilMatch(D3DADAPTER_DEFAULT, devtype, if(FAILED(pID3D->CheckDepthStencilMatch(DisplayAdapter, devtype,
present.BackBufferFormat, present.BackBufferFormat, present.AutoDepthStencilFormat))) present.BackBufferFormat, present.BackBufferFormat, present.AutoDepthStencilFormat)))
{ {
os::Printer::log("Depth-stencil format is not compatible with display format, disabling stencil buffer.", ELL_WARNING); os::Printer::log("Depth-stencil format is not compatible with display format, disabling stencil buffer.", ELL_WARNING);
...@@ -289,17 +290,17 @@ bool CD3D8Driver::initDriver(const core::dimension2d<u32>& screenSize, ...@@ -289,17 +290,17 @@ bool CD3D8Driver::initDriver(const core::dimension2d<u32>& screenSize,
{ {
#if !defined( _IRR_XBOX_PLATFORM_) #if !defined( _IRR_XBOX_PLATFORM_)
present.AutoDepthStencilFormat = D3DFMT_D32; present.AutoDepthStencilFormat = D3DFMT_D32;
if(FAILED(pID3D->CheckDeviceFormat(D3DADAPTER_DEFAULT, devtype, if(FAILED(pID3D->CheckDeviceFormat(DisplayAdapter, devtype,
present.BackBufferFormat, D3DUSAGE_DEPTHSTENCIL, present.BackBufferFormat, D3DUSAGE_DEPTHSTENCIL,
D3DRTYPE_SURFACE, present.AutoDepthStencilFormat))) D3DRTYPE_SURFACE, present.AutoDepthStencilFormat)))
{ {
present.AutoDepthStencilFormat = D3DFMT_D24X8; present.AutoDepthStencilFormat = D3DFMT_D24X8;
if(FAILED(pID3D->CheckDeviceFormat(D3DADAPTER_DEFAULT, devtype, if(FAILED(pID3D->CheckDeviceFormat(DisplayAdapter, devtype,
present.BackBufferFormat, D3DUSAGE_DEPTHSTENCIL, present.BackBufferFormat, D3DUSAGE_DEPTHSTENCIL,
D3DRTYPE_SURFACE, present.AutoDepthStencilFormat))) D3DRTYPE_SURFACE, present.AutoDepthStencilFormat)))
{ {
present.AutoDepthStencilFormat = D3DFMT_D16; present.AutoDepthStencilFormat = D3DFMT_D16;
if(FAILED(pID3D->CheckDeviceFormat(D3DADAPTER_DEFAULT, devtype, if(FAILED(pID3D->CheckDeviceFormat(DisplayAdapter, devtype,
present.BackBufferFormat, D3DUSAGE_DEPTHSTENCIL, present.BackBufferFormat, D3DUSAGE_DEPTHSTENCIL,
D3DRTYPE_SURFACE, present.AutoDepthStencilFormat))) D3DRTYPE_SURFACE, present.AutoDepthStencilFormat)))
{ {
...@@ -310,7 +311,7 @@ bool CD3D8Driver::initDriver(const core::dimension2d<u32>& screenSize, ...@@ -310,7 +311,7 @@ bool CD3D8Driver::initDriver(const core::dimension2d<u32>& screenSize,
} }
#else #else
present.AutoDepthStencilFormat = D3DFMT_D16; present.AutoDepthStencilFormat = D3DFMT_D16;
if(FAILED(pID3D->CheckDeviceFormat(D3DADAPTER_DEFAULT, devtype, if(FAILED(pID3D->CheckDeviceFormat(DisplayAdapter, devtype,
present.BackBufferFormat, D3DUSAGE_DEPTHSTENCIL, present.BackBufferFormat, D3DUSAGE_DEPTHSTENCIL,
D3DRTYPE_SURFACE, present.AutoDepthStencilFormat))) D3DRTYPE_SURFACE, present.AutoDepthStencilFormat)))
{ {
...@@ -328,7 +329,7 @@ bool CD3D8Driver::initDriver(const core::dimension2d<u32>& screenSize, ...@@ -328,7 +329,7 @@ bool CD3D8Driver::initDriver(const core::dimension2d<u32>& screenSize,
#endif #endif
if (pureSoftware) if (pureSoftware)
{ {
hr = pID3D->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_REF, hwnd, hr = pID3D->CreateDevice(DisplayAdapter, D3DDEVTYPE_REF, hwnd,
fpuPrecision | D3DCREATE_SOFTWARE_VERTEXPROCESSING, &present, &pID3DDevice); fpuPrecision | D3DCREATE_SOFTWARE_VERTEXPROCESSING, &present, &pID3DDevice);
if (FAILED(hr)) if (FAILED(hr))
...@@ -336,14 +337,14 @@ bool CD3D8Driver::initDriver(const core::dimension2d<u32>& screenSize, ...@@ -336,14 +337,14 @@ bool CD3D8Driver::initDriver(const core::dimension2d<u32>& screenSize,
} }
else else
{ {
hr = pID3D->CreateDevice(D3DADAPTER_DEFAULT, devtype, hwnd, hr = pID3D->CreateDevice(DisplayAdapter, devtype, hwnd,
fpuPrecision | D3DCREATE_HARDWARE_VERTEXPROCESSING, &present, &pID3DDevice); fpuPrecision | D3DCREATE_HARDWARE_VERTEXPROCESSING, &present, &pID3DDevice);
if(FAILED(hr)) if(FAILED(hr))
hr = pID3D->CreateDevice(D3DADAPTER_DEFAULT, devtype, hwnd, hr = pID3D->CreateDevice(DisplayAdapter, devtype, hwnd,
fpuPrecision | D3DCREATE_MIXED_VERTEXPROCESSING , &present, &pID3DDevice); fpuPrecision | D3DCREATE_MIXED_VERTEXPROCESSING , &present, &pID3DDevice);
if(FAILED(hr)) if(FAILED(hr))
hr = pID3D->CreateDevice(D3DADAPTER_DEFAULT, devtype, hwnd, hr = pID3D->CreateDevice(DisplayAdapter, devtype, hwnd,
fpuPrecision | D3DCREATE_SOFTWARE_VERTEXPROCESSING, &present, &pID3DDevice); fpuPrecision | D3DCREATE_SOFTWARE_VERTEXPROCESSING, &present, &pID3DDevice);
if (FAILED(hr)) if (FAILED(hr))
os::Printer::log("Was not able to create Direct3D8 device.", ELL_ERROR); os::Printer::log("Was not able to create Direct3D8 device.", ELL_ERROR);
...@@ -2347,13 +2348,13 @@ namespace video ...@@ -2347,13 +2348,13 @@ namespace video
IVideoDriver* createDirectX8Driver(const core::dimension2d<u32>& screenSize, IVideoDriver* createDirectX8Driver(const core::dimension2d<u32>& screenSize,
HWND window, u32 bits, bool fullscreen, bool stencilbuffer, HWND window, u32 bits, bool fullscreen, bool stencilbuffer,
io::IFileSystem* io, bool pureSoftware, bool highPrecisionFPU, io::IFileSystem* io, bool pureSoftware, bool highPrecisionFPU,
bool vsync, u8 antiAlias) bool vsync, u8 antiAlias, u32 displayAdapter)
{ {
CD3D8Driver* dx8 = new CD3D8Driver(screenSize, window, fullscreen, CD3D8Driver* dx8 = new CD3D8Driver(screenSize, window, fullscreen,
stencilbuffer, io, pureSoftware); stencilbuffer, io, pureSoftware);
if (!dx8->initDriver(screenSize, window, bits, fullscreen, if (!dx8->initDriver(screenSize, window, bits, fullscreen,
pureSoftware, highPrecisionFPU, vsync, antiAlias)) pureSoftware, highPrecisionFPU, vsync, antiAlias, displayAdapter))
{ {
dx8->drop(); dx8->drop();
dx8 = 0; dx8 = 0;
......
...@@ -108,7 +108,7 @@ namespace video ...@@ -108,7 +108,7 @@ namespace video
//! initialises the Direct3D API //! initialises the Direct3D API
bool initDriver(const core::dimension2d<u32>& screenSize, HWND hwnd, bool initDriver(const core::dimension2d<u32>& screenSize, HWND hwnd,
u32 bits, bool fullScreen, bool pureSoftware, u32 bits, bool fullScreen, bool pureSoftware,
bool highPrecisionFPU, bool vsync, u8 antiAlias); bool highPrecisionFPU, bool vsync, u8 antiAlias, u32 displayAdapter);
//! \return Returns the name of the video driver. Example: In case of the DIRECT3D8 //! \return Returns the name of the video driver. Example: In case of the DIRECT3D8
//! driver, it would return "Direct3D8.1". //! driver, it would return "Direct3D8.1".
...@@ -319,6 +319,8 @@ namespace video ...@@ -319,6 +319,8 @@ namespace video
bool DriverWasReset; bool DriverWasReset;
SColorf AmbientLight; SColorf AmbientLight;
u32 DisplayAdapter;
}; };
} // end namespace video } // end namespace video
......
...@@ -36,7 +36,7 @@ CD3D9Driver::CD3D9Driver(const core::dimension2d<u32>& screenSize, HWND window, ...@@ -36,7 +36,7 @@ CD3D9Driver::CD3D9Driver(const core::dimension2d<u32>& screenSize, HWND window,
MaxLightDistance(0.f), LastSetLight(-1), Cached2DModeSignature(0), MaxLightDistance(0.f), LastSetLight(-1), Cached2DModeSignature(0),
ColorFormat(ECF_A8R8G8B8), DeviceLost(false), ColorFormat(ECF_A8R8G8B8), DeviceLost(false),
Fullscreen(fullscreen), DriverWasReset(true), OcclusionQuerySupport(false), Fullscreen(fullscreen), DriverWasReset(true), OcclusionQuerySupport(false),
AlphaToCoverageSupport(false) AlphaToCoverageSupport(false), DisplayAdapter(0)
{ {
#ifdef _DEBUG #ifdef _DEBUG
setDebugName("CD3D9Driver"); setDebugName("CD3D9Driver");
...@@ -160,11 +160,12 @@ void CD3D9Driver::createMaterialRenderers() ...@@ -160,11 +160,12 @@ void CD3D9Driver::createMaterialRenderers()
//! initialises the Direct3D API //! initialises the Direct3D API
bool CD3D9Driver::initDriver(const core::dimension2d<u32>& screenSize, bool CD3D9Driver::initDriver(const core::dimension2d<u32>& screenSize,
HWND hwnd, u32 bits, bool fullScreen, bool pureSoftware, HWND hwnd, u32 bits, bool fullScreen, bool pureSoftware,
bool highPrecisionFPU, bool vsync, u8 antiAlias) bool highPrecisionFPU, bool vsync, u8 antiAlias, u32 displayAdapter)
{ {
HRESULT hr; HRESULT hr;
Fullscreen = fullScreen; Fullscreen = fullScreen;
CurrentDepthBufferSize = screenSize; CurrentDepthBufferSize = screenSize;
DisplayAdapter = displayAdapter;
if (!pID3D) if (!pID3D)
{ {
...@@ -197,7 +198,7 @@ bool CD3D9Driver::initDriver(const core::dimension2d<u32>& screenSize, ...@@ -197,7 +198,7 @@ bool CD3D9Driver::initDriver(const core::dimension2d<u32>& screenSize,
// print device information // print device information
D3DADAPTER_IDENTIFIER9 dai; D3DADAPTER_IDENTIFIER9 dai;
if (!FAILED(pID3D->GetAdapterIdentifier(D3DADAPTER_DEFAULT, 0, &dai))) if (!FAILED(pID3D->GetAdapterIdentifier(DisplayAdapter, 0, &dai)))
{ {
char tmp[512]; char tmp[512];
...@@ -225,7 +226,7 @@ bool CD3D9Driver::initDriver(const core::dimension2d<u32>& screenSize, ...@@ -225,7 +226,7 @@ bool CD3D9Driver::initDriver(const core::dimension2d<u32>& screenSize,
} }
D3DDISPLAYMODE d3ddm; D3DDISPLAYMODE d3ddm;
hr = pID3D->GetAdapterDisplayMode(D3DADAPTER_DEFAULT, &d3ddm); hr = pID3D->GetAdapterDisplayMode(DisplayAdapter, &d3ddm);
if (FAILED(hr)) if (FAILED(hr))
{ {
os::Printer::log("Error: Could not get Adapter Display mode.", ELL_ERROR); os::Printer::log("Error: Could not get Adapter Display mode.", ELL_ERROR);
...@@ -261,7 +262,7 @@ bool CD3D9Driver::initDriver(const core::dimension2d<u32>& screenSize, ...@@ -261,7 +262,7 @@ bool CD3D9Driver::initDriver(const core::dimension2d<u32>& screenSize,
present.Windowed = TRUE; present.Windowed = TRUE;
} }
UINT adapter = D3DADAPTER_DEFAULT; UINT adapter = DisplayAdapter;
D3DDEVTYPE devtype = D3DDEVTYPE_HAL; D3DDEVTYPE devtype = D3DDEVTYPE_HAL;
#ifndef _IRR_D3D_NO_SHADER_DEBUGGING #ifndef _IRR_D3D_NO_SHADER_DEBUGGING
devtype = D3DDEVTYPE_REF; devtype = D3DDEVTYPE_REF;
...@@ -369,7 +370,7 @@ bool CD3D9Driver::initDriver(const core::dimension2d<u32>& screenSize, ...@@ -369,7 +370,7 @@ bool CD3D9Driver::initDriver(const core::dimension2d<u32>& screenSize,
DWORD fpuPrecision = highPrecisionFPU ? D3DCREATE_FPU_PRESERVE : 0; DWORD fpuPrecision = highPrecisionFPU ? D3DCREATE_FPU_PRESERVE : 0;
if (pureSoftware) if (pureSoftware)
{ {
hr = pID3D->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_REF, hwnd, hr = pID3D->CreateDevice(DisplayAdapter, D3DDEVTYPE_REF, hwnd,
fpuPrecision | D3DCREATE_SOFTWARE_VERTEXPROCESSING, &present, &pID3DDevice); fpuPrecision | D3DCREATE_SOFTWARE_VERTEXPROCESSING, &present, &pID3DDevice);
if (FAILED(hr)) if (FAILED(hr))
...@@ -432,13 +433,13 @@ bool CD3D9Driver::initDriver(const core::dimension2d<u32>& screenSize, ...@@ -432,13 +433,13 @@ bool CD3D9Driver::initDriver(const core::dimension2d<u32>& screenSize,
OcclusionQuerySupport=(pID3DDevice->CreateQuery(D3DQUERYTYPE_OCCLUSION, NULL) == S_OK); OcclusionQuerySupport=(pID3DDevice->CreateQuery(D3DQUERYTYPE_OCCLUSION, NULL) == S_OK);
if (VendorID==0x10DE)//NVidia if (VendorID==0x10DE)//NVidia
AlphaToCoverageSupport = (pID3D->CheckDeviceFormat(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, AlphaToCoverageSupport = (pID3D->CheckDeviceFormat(DisplayAdapter, D3DDEVTYPE_HAL,
D3DFMT_X8R8G8B8, 0,D3DRTYPE_SURFACE, D3DFMT_X8R8G8B8, 0,D3DRTYPE_SURFACE,
(D3DFORMAT)MAKEFOURCC('A', 'T', 'O', 'C')) == S_OK); (D3DFORMAT)MAKEFOURCC('A', 'T', 'O', 'C')) == S_OK);
else if (VendorID==0x1002)//ATI else if (VendorID==0x1002)//ATI
AlphaToCoverageSupport = true; // TODO: Check unknown AlphaToCoverageSupport = true; // TODO: Check unknown
#if 0 #if 0
AlphaToCoverageSupport = (pID3D->CheckDeviceFormat(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, AlphaToCoverageSupport = (pID3D->CheckDeviceFormat(DisplayAdapter, D3DDEVTYPE_HAL,
D3DFMT_X8R8G8B8, 0,D3DRTYPE_SURFACE, D3DFMT_X8R8G8B8, 0,D3DRTYPE_SURFACE,
(D3DFORMAT)MAKEFOURCC('A','2','M','1')) == S_OK); (D3DFORMAT)MAKEFOURCC('A','2','M','1')) == S_OK);
#endif #endif
...@@ -3412,10 +3413,10 @@ namespace video ...@@ -3412,10 +3413,10 @@ namespace video
IVideoDriver* createDirectX9Driver(const core::dimension2d<u32>& screenSize, IVideoDriver* createDirectX9Driver(const core::dimension2d<u32>& screenSize,
HWND window, u32 bits, bool fullscreen, bool stencilbuffer, HWND window, u32 bits, bool fullscreen, bool stencilbuffer,
io::IFileSystem* io, bool pureSoftware, bool highPrecisionFPU, io::IFileSystem* io, bool pureSoftware, bool highPrecisionFPU,
bool vsync, u8 antiAlias) bool vsync, u8 antiAlias, u32 displayAdapter)
{ {
CD3D9Driver* dx9 = new CD3D9Driver(screenSize, window, fullscreen, stencilbuffer, io, pureSoftware); CD3D9Driver* dx9 = new CD3D9Driver(screenSize, window, fullscreen, stencilbuffer, io, pureSoftware);
if (!dx9->initDriver(screenSize, window, bits, fullscreen, pureSoftware, highPrecisionFPU, vsync, antiAlias)) if (!dx9->initDriver(screenSize, window, bits, fullscreen, pureSoftware, highPrecisionFPU, vsync, antiAlias, displayAdapter))
{ {
dx9->drop(); dx9->drop();
dx9 = 0; dx9 = 0;
......
...@@ -193,7 +193,7 @@ namespace video ...@@ -193,7 +193,7 @@ namespace video
//! initialises the Direct3D API //! initialises the Direct3D API
bool initDriver(const core::dimension2d<u32>& screenSize, HWND hwnd, bool initDriver(const core::dimension2d<u32>& screenSize, HWND hwnd,
u32 bits, bool fullScreen, bool pureSoftware, u32 bits, bool fullScreen, bool pureSoftware,
bool highPrecisionFPU, bool vsync, u8 antiAlias); bool highPrecisionFPU, bool vsync, u8 antiAlias, u32 displayAdapter);
//! \return Returns the name of the video driver. Example: In case of the DIRECT3D8 //! \return Returns the name of the video driver. Example: In case of the DIRECT3D8
//! driver, it would return "Direct3D8.1". //! driver, it would return "Direct3D8.1".
...@@ -461,6 +461,8 @@ namespace video ...@@ -461,6 +461,8 @@ namespace video
bool DriverWasReset; bool DriverWasReset;
bool OcclusionQuerySupport; bool OcclusionQuerySupport;
bool AlphaToCoverageSupport; bool AlphaToCoverageSupport;
u32 DisplayAdapter;
}; };
......
...@@ -312,9 +312,9 @@ bool CD3D9Texture::createTexture(u32 flags, IImage * image) ...@@ -312,9 +312,9 @@ bool CD3D9Texture::createTexture(u32 flags, IImage * image)
{ {
LPDIRECT3D9 intf = Driver->getExposedVideoData().D3D9.D3D9; LPDIRECT3D9 intf = Driver->getExposedVideoData().D3D9.D3D9;
D3DDISPLAYMODE d3ddm; D3DDISPLAYMODE d3ddm;
intf->GetAdapterDisplayMode(D3DADAPTER_DEFAULT, &d3ddm); intf->GetAdapterDisplayMode(Driver->DisplayAdapter, &d3ddm);
if (D3D_OK==intf->CheckDeviceFormat(D3DADAPTER_DEFAULT,D3DDEVTYPE_HAL,d3ddm.Format,D3DUSAGE_AUTOGENMIPMAP,D3DRTYPE_TEXTURE,format)) if (D3D_OK==intf->CheckDeviceFormat(Driver->DisplayAdapter,D3DDEVTYPE_HAL,d3ddm.Format,D3DUSAGE_AUTOGENMIPMAP,D3DRTYPE_TEXTURE,format))
{ {
usage = D3DUSAGE_AUTOGENMIPMAP; usage = D3DUSAGE_AUTOGENMIPMAP;
HardwareMipMaps = true; HardwareMipMaps = true;
......
...@@ -32,13 +32,13 @@ namespace irr ...@@ -32,13 +32,13 @@ namespace irr
#ifdef _IRR_COMPILE_WITH_DIRECT3D_8_ #ifdef _IRR_COMPILE_WITH_DIRECT3D_8_
IVideoDriver* createDirectX8Driver(const core::dimension2d<u32>& screenSize, HWND window, IVideoDriver* createDirectX8Driver(const core::dimension2d<u32>& screenSize, HWND window,
u32 bits, bool fullscreen, bool stencilbuffer, io::IFileSystem* io, u32 bits, bool fullscreen, bool stencilbuffer, io::IFileSystem* io,
bool pureSoftware, bool highPrecisionFPU, bool vsync, u8 antiAlias); bool pureSoftware, bool highPrecisionFPU, bool vsync, u8 antiAlias, u32 displayAdapter);
#endif #endif
#ifdef _IRR_COMPILE_WITH_DIRECT3D_9_ #ifdef _IRR_COMPILE_WITH_DIRECT3D_9_
IVideoDriver* createDirectX9Driver(const core::dimension2d<u32>& screenSize, HWND window, IVideoDriver* createDirectX9Driver(const core::dimension2d<u32>& screenSize, HWND window,
u32 bits, bool fullscreen, bool stencilbuffer, io::IFileSystem* io, u32 bits, bool fullscreen, bool stencilbuffer, io::IFileSystem* io,
bool pureSoftware, bool highPrecisionFPU, bool vsync, u8 antiAlias); bool pureSoftware, bool highPrecisionFPU, bool vsync, u8 antiAlias, u32 displayAdapter);
#endif #endif
#ifdef _IRR_COMPILE_WITH_OPENGL_ #ifdef _IRR_COMPILE_WITH_OPENGL_
...@@ -226,7 +226,7 @@ void CIrrDeviceSDL::createDriver() ...@@ -226,7 +226,7 @@ void CIrrDeviceSDL::createDriver()
VideoDriver = video::createDirectX8Driver(CreationParams.WindowSize, Info.window, VideoDriver = video::createDirectX8Driver(CreationParams.WindowSize, Info.window,
CreationParams.Bits, CreationParams.Fullscreen, CreationParams.Stencilbuffer, CreationParams.Bits, CreationParams.Fullscreen, CreationParams.Stencilbuffer,
FileSystem, false, CreationParams.HighPrecisionFPU, CreationParams.Vsync, FileSystem, false, CreationParams.HighPrecisionFPU, CreationParams.Vsync,
CreationParams.AntiAlias); CreationParams.AntiAlias, CreationParams.DisplayAdapter);
if (!VideoDriver) if (!VideoDriver)
{ {
...@@ -244,7 +244,7 @@ void CIrrDeviceSDL::createDriver() ...@@ -244,7 +244,7 @@ void CIrrDeviceSDL::createDriver()
VideoDriver = video::createDirectX9Driver(CreationParams.WindowSize, Info.window, VideoDriver = video::createDirectX9Driver(CreationParams.WindowSize, Info.window,
CreationParams.Bits, CreationParams.Fullscreen, CreationParams.Stencilbuffer, CreationParams.Bits, CreationParams.Fullscreen, CreationParams.Stencilbuffer,
FileSystem, false, CreationParams.HighPrecisionFPU, CreationParams.Vsync, FileSystem, false, CreationParams.HighPrecisionFPU, CreationParams.Vsync,
CreationParams.AntiAlias); CreationParams.AntiAlias, CreationParams.DisplayAdapter);
if (!VideoDriver) if (!VideoDriver)
{ {
......
...@@ -25,13 +25,13 @@ namespace irr ...@@ -25,13 +25,13 @@ namespace irr
#ifdef _IRR_COMPILE_WITH_DIRECT3D_8_ #ifdef _IRR_COMPILE_WITH_DIRECT3D_8_
IVideoDriver* createDirectX8Driver(const core::dimension2d<u32>& screenSize, HWND window, IVideoDriver* createDirectX8Driver(const core::dimension2d<u32>& screenSize, HWND window,
u32 bits, bool fullscreen, bool stencilbuffer, io::IFileSystem* io, u32 bits, bool fullscreen, bool stencilbuffer, io::IFileSystem* io,
bool pureSoftware, bool highPrecisionFPU, bool vsync, u8 antiAlias); bool pureSoftware, bool highPrecisionFPU, bool vsync, u8 antiAlias, u32 displayAdapter);
#endif #endif
#ifdef _IRR_COMPILE_WITH_DIRECT3D_9_ #ifdef _IRR_COMPILE_WITH_DIRECT3D_9_
IVideoDriver* createDirectX9Driver(const core::dimension2d<u32>& screenSize, HWND window, IVideoDriver* createDirectX9Driver(const core::dimension2d<u32>& screenSize, HWND window,
u32 bits, bool fullscreen, bool stencilbuffer, io::IFileSystem* io, u32 bits, bool fullscreen, bool stencilbuffer, io::IFileSystem* io,
bool pureSoftware, bool highPrecisionFPU, bool vsync, u8 antiAlias); bool pureSoftware, bool highPrecisionFPU, bool vsync, u8 antiAlias, u32 displayAdapter);
#endif #endif
#ifdef _IRR_COMPILE_WITH_OPENGL_ #ifdef _IRR_COMPILE_WITH_OPENGL_
...@@ -666,7 +666,7 @@ void CIrrDeviceWin32::createDriver() ...@@ -666,7 +666,7 @@ void CIrrDeviceWin32::createDriver()
VideoDriver = video::createDirectX8Driver(CreationParams.WindowSize, HWnd, VideoDriver = video::createDirectX8Driver(CreationParams.WindowSize, HWnd,
CreationParams.Bits, CreationParams.Fullscreen, CreationParams.Stencilbuffer, CreationParams.Bits, CreationParams.Fullscreen, CreationParams.Stencilbuffer,
FileSystem, false, CreationParams.HighPrecisionFPU, CreationParams.Vsync, FileSystem, false, CreationParams.HighPrecisionFPU, CreationParams.Vsync,
CreationParams.AntiAlias); CreationParams.AntiAlias, CreationParams.DisplayAdapter);
if (!VideoDriver) if (!VideoDriver)
{ {
...@@ -684,7 +684,7 @@ void CIrrDeviceWin32::createDriver() ...@@ -684,7 +684,7 @@ void CIrrDeviceWin32::createDriver()
VideoDriver = video::createDirectX9Driver(CreationParams.WindowSize, HWnd, VideoDriver = video::createDirectX9Driver(CreationParams.WindowSize, HWnd,
CreationParams.Bits, CreationParams.Fullscreen, CreationParams.Stencilbuffer, CreationParams.Bits, CreationParams.Fullscreen, CreationParams.Stencilbuffer,
FileSystem, false, CreationParams.HighPrecisionFPU, CreationParams.Vsync, FileSystem, false, CreationParams.HighPrecisionFPU, CreationParams.Vsync,
CreationParams.AntiAlias); CreationParams.AntiAlias, CreationParams.DisplayAdapter);
if (!VideoDriver) if (!VideoDriver)
{ {
......
...@@ -30,13 +30,13 @@ namespace irr ...@@ -30,13 +30,13 @@ namespace irr
#ifdef _IRR_COMPILE_WITH_DIRECT3D_8_ #ifdef _IRR_COMPILE_WITH_DIRECT3D_8_
IVideoDriver* createDirectX8Driver(const core::dimension2d<s32>& screenSize, HWND window, IVideoDriver* createDirectX8Driver(const core::dimension2d<s32>& screenSize, HWND window,
u32 bits, bool fullscreen, bool stencilbuffer, io::IFileSystem* io, u32 bits, bool fullscreen, bool stencilbuffer, io::IFileSystem* io,
bool pureSoftware, bool highPrecisionFPU, bool vsync, bool antiAlias); bool pureSoftware, bool highPrecisionFPU, bool vsync, bool antiAlias, u32 displayAdapter);
#endif #endif
#ifdef _IRR_COMPILE_WITH_DIRECT3D_9_ #ifdef _IRR_COMPILE_WITH_DIRECT3D_9_
IVideoDriver* createDirectX9Driver(const core::dimension2d<s32>& screenSize, HWND window, IVideoDriver* createDirectX9Driver(const core::dimension2d<s32>& screenSize, HWND window,
u32 bits, bool fullscreen, bool stencilbuffer, io::IFileSystem* io, u32 bits, bool fullscreen, bool stencilbuffer, io::IFileSystem* io,
bool pureSoftware, bool highPrecisionFPU, bool vsync, bool antiAlias); bool pureSoftware, bool highPrecisionFPU, bool vsync, bool antiAlias, u32 displayAdapter);
#endif #endif
#ifdef _IRR_COMPILE_WITH_OPENGL_ #ifdef _IRR_COMPILE_WITH_OPENGL_
...@@ -471,7 +471,8 @@ void CIrrDeviceWinCE::createDriver() ...@@ -471,7 +471,8 @@ void CIrrDeviceWinCE::createDriver()
case video::EDT_DIRECT3D8: case video::EDT_DIRECT3D8:
#ifdef _IRR_COMPILE_WITH_DIRECT3D_8_ #ifdef _IRR_COMPILE_WITH_DIRECT3D_8_
VideoDriver = video::createDirectX8Driver(CreationParams.WindowSize, HWnd, CreationParams.Bits, CreationParams.Fullscreen, VideoDriver = video::createDirectX8Driver(CreationParams.WindowSize, HWnd, CreationParams.Bits, CreationParams.Fullscreen,
CreationParams.Stencilbuffer, FileSystem, false, CreationParams.HighPrecisionFPU, CreationParams.Vsync, CreationParams.AntiAlias); CreationParams.Stencilbuffer, FileSystem, false, CreationParams.HighPrecisionFPU, CreationParams.Vsync, CreationParams.AntiAlias
, CreationParams.DisplayAdapter);
if (!VideoDriver) if (!VideoDriver)
{ {
os::Printer::log("Could not create DIRECT3D8 Driver.", ELL_ERROR); os::Printer::log("Could not create DIRECT3D8 Driver.", ELL_ERROR);
...@@ -485,7 +486,8 @@ void CIrrDeviceWinCE::createDriver() ...@@ -485,7 +486,8 @@ void CIrrDeviceWinCE::createDriver()
case video::EDT_DIRECT3D9: case video::EDT_DIRECT3D9:
#ifdef _IRR_COMPILE_WITH_DIRECT3D_9_ #ifdef _IRR_COMPILE_WITH_DIRECT3D_9_
VideoDriver = video::createDirectX9Driver(CreationParams.WindowSize, HWnd, CreationParams.Bits, CreationParams.Fullscreen, VideoDriver = video::createDirectX9Driver(CreationParams.WindowSize, HWnd, CreationParams.Bits, CreationParams.Fullscreen,
CreationParams.Stencilbuffer, FileSystem, false, CreationParams.HighPrecisionFPU, CreationParams.Vsync, CreationParams.AntiAlias); CreationParams.Stencilbuffer, FileSystem, false, CreationParams.HighPrecisionFPU, CreationParams.Vsync, CreationParams.AntiAlias
, CreationParams.DisplayAdapter);
if (!VideoDriver) if (!VideoDriver)
{ {
os::Printer::log("Could not create DIRECT3D9 Driver.", ELL_ERROR); os::Printer::log("Could not create DIRECT3D9 Driver.", ELL_ERROR);
......
...@@ -438,6 +438,7 @@ ...@@ -438,6 +438,7 @@
Optimization="2" Optimization="2"
InlineFunctionExpansion="1" InlineFunctionExpansion="1"
EnableIntrinsicFunctions="false" EnableIntrinsicFunctions="false"
WholeProgramOptimization="false"
AdditionalIncludeDirectories="..\..\include;zlib" AdditionalIncludeDirectories="..\..\include;zlib"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;_IRR_STATIC_LIB_;_CRT_SECURE_NO_DEPRECATE" PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;_IRR_STATIC_LIB_;_CRT_SECURE_NO_DEPRECATE"
StringPooling="true" StringPooling="true"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment