Allow setting D3DCREATE_MULTITHREADED when creating Direct3D drivers.
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@4167 dfc29bdd-3216-0410-991c-e03cc46cb475master
parent
3810ecb40c
commit
ac94777f6d
|
@ -43,6 +43,7 @@ namespace irr
|
|||
LoggingLevel(ELL_INFORMATION),
|
||||
#endif
|
||||
DisplayAdapter(0),
|
||||
DriverMultithreaded(false),
|
||||
UsePerformanceTimer(true),
|
||||
SDK_version_do_not_use(IRRLICHT_SDK_VERSION)
|
||||
{
|
||||
|
@ -72,6 +73,7 @@ namespace irr
|
|||
EventReceiver = other.EventReceiver;
|
||||
WindowId = other.WindowId;
|
||||
LoggingLevel = other.LoggingLevel;
|
||||
DriverMultithreaded = other.DriverMultithreaded;
|
||||
DisplayAdapter = other.DisplayAdapter;
|
||||
UsePerformanceTimer = other.UsePerformanceTimer;
|
||||
return *this;
|
||||
|
@ -268,6 +270,12 @@ namespace irr
|
|||
/** So far only supported on D3D */
|
||||
u32 DisplayAdapter;
|
||||
|
||||
//! Create the driver multithreaded.
|
||||
/** Default is false. Enabling this can slow down your application.
|
||||
Note that this does _not_ make Irrlicht threadsafe, but only the underlying driver-API for the graphiccard.
|
||||
So far only supported on D3D. */
|
||||
bool DriverMultithreaded;
|
||||
|
||||
//! Enables use of high performance timers on Windows platform.
|
||||
/** When performance timers are not used, standard GetTickCount()
|
||||
is used instead which usually has worse resolution, but also less
|
||||
|
|
|
@ -326,11 +326,12 @@ bool CD3D8Driver::initDriver(const core::dimension2d<u32>& screenSize,
|
|||
DWORD fpuPrecision = 0;
|
||||
#else
|
||||
DWORD fpuPrecision = highPrecisionFPU ? D3DCREATE_FPU_PRESERVE : 0;
|
||||
DWORD multithreaded = Params.DriverMultithreaded ? D3DCREATE_MULTITHREADED : 0;
|
||||
#endif
|
||||
if (pureSoftware)
|
||||
{
|
||||
hr = pID3D->CreateDevice(DisplayAdapter, D3DDEVTYPE_REF, hwnd,
|
||||
fpuPrecision | D3DCREATE_SOFTWARE_VERTEXPROCESSING, &present, &pID3DDevice);
|
||||
fpuPrecision | multithreaded | D3DCREATE_SOFTWARE_VERTEXPROCESSING, &present, &pID3DDevice);
|
||||
|
||||
if (FAILED(hr))
|
||||
os::Printer::log("Was not able to create Direct3D8 software device.", ELL_ERROR);
|
||||
|
@ -338,14 +339,14 @@ bool CD3D8Driver::initDriver(const core::dimension2d<u32>& screenSize,
|
|||
else
|
||||
{
|
||||
hr = pID3D->CreateDevice(DisplayAdapter, devtype, hwnd,
|
||||
fpuPrecision | D3DCREATE_HARDWARE_VERTEXPROCESSING, &present, &pID3DDevice);
|
||||
fpuPrecision | multithreaded | D3DCREATE_HARDWARE_VERTEXPROCESSING, &present, &pID3DDevice);
|
||||
|
||||
if(FAILED(hr))
|
||||
hr = pID3D->CreateDevice(DisplayAdapter, devtype, hwnd,
|
||||
fpuPrecision | D3DCREATE_MIXED_VERTEXPROCESSING , &present, &pID3DDevice);
|
||||
fpuPrecision | multithreaded | D3DCREATE_MIXED_VERTEXPROCESSING , &present, &pID3DDevice);
|
||||
if(FAILED(hr))
|
||||
hr = pID3D->CreateDevice(DisplayAdapter, devtype, hwnd,
|
||||
fpuPrecision | D3DCREATE_SOFTWARE_VERTEXPROCESSING, &present, &pID3DDevice);
|
||||
fpuPrecision | multithreaded | D3DCREATE_SOFTWARE_VERTEXPROCESSING, &present, &pID3DDevice);
|
||||
if (FAILED(hr))
|
||||
os::Printer::log("Was not able to create Direct3D8 device.", ELL_ERROR);
|
||||
}
|
||||
|
|
|
@ -375,6 +375,7 @@ bool CD3D9Driver::initDriver(HWND hwnd, bool pureSoftware)
|
|||
// create device
|
||||
|
||||
DWORD fpuPrecision = Params.HighPrecisionFPU ? D3DCREATE_FPU_PRESERVE : 0;
|
||||
DWORD multithreaded = Params.DriverMultithreaded ? D3DCREATE_MULTITHREADED : 0;
|
||||
if (pureSoftware)
|
||||
{
|
||||
if (FAILED(pID3D->CreateDevice(Params.DisplayAdapter, D3DDEVTYPE_REF, hwnd,
|
||||
|
@ -384,15 +385,15 @@ bool CD3D9Driver::initDriver(HWND hwnd, bool pureSoftware)
|
|||
else
|
||||
{
|
||||
HRESULT hr = pID3D->CreateDevice(adapter, devtype, hwnd,
|
||||
fpuPrecision | D3DCREATE_HARDWARE_VERTEXPROCESSING, &present, &pID3DDevice);
|
||||
fpuPrecision | multithreaded | D3DCREATE_HARDWARE_VERTEXPROCESSING, &present, &pID3DDevice);
|
||||
|
||||
if(FAILED(hr))
|
||||
hr = pID3D->CreateDevice(adapter, devtype, hwnd,
|
||||
fpuPrecision | D3DCREATE_MIXED_VERTEXPROCESSING , &present, &pID3DDevice);
|
||||
fpuPrecision | multithreaded | D3DCREATE_MIXED_VERTEXPROCESSING , &present, &pID3DDevice);
|
||||
|
||||
if(FAILED(hr))
|
||||
hr = pID3D->CreateDevice(adapter, devtype, hwnd,
|
||||
fpuPrecision | D3DCREATE_SOFTWARE_VERTEXPROCESSING, &present, &pID3DDevice);
|
||||
fpuPrecision | multithreaded | D3DCREATE_SOFTWARE_VERTEXPROCESSING, &present, &pID3DDevice);
|
||||
|
||||
if (FAILED(hr))
|
||||
os::Printer::log("Was not able to create Direct3D9 device.", ELL_ERROR);
|
||||
|
|
Loading…
Reference in New Issue