When creating the device, by default, DirectX changes FPU precision to single-precision round-to-nearest mode. If or the flag, D3DCREATE_FPU_PRESERVE to the behaviorFlag of the createDevice call, it tells DirectX not to change FPU precision and to use the FPU precision that the application is using.
The code to change this is as follows -
In CD3D8Driver.cpp, around line 278, change the if( pureSoftware ) block to this -
Code: Select all
if (pureSoftware)
{
hr = pID3D->CreateDevice( D3DADAPTER_DEFAULT, D3DDEVTYPE_REF, hwnd,
D3DCREATE_SOFTWARE_VERTEXPROCESSING | D3DCREATE_FPU_PRESERVE, &present, &pID3DDevice);
if (FAILED(hr))
os::Printer::log("Was not able to create Direct3D8 software device.", ELL_ERROR);
}
else
{
hr = pID3D->CreateDevice( D3DADAPTER_DEFAULT, devtype, hwnd,
D3DCREATE_HARDWARE_VERTEXPROCESSING | D3DCREATE_FPU_PRESERVE, &present, &pID3DDevice);
if(FAILED(hr))
{
hr = pID3D->CreateDevice( D3DADAPTER_DEFAULT, devtype, hwnd,
D3DCREATE_MIXED_VERTEXPROCESSING | D3DCREATE_FPU_PRESERVE , &present, &pID3DDevice);
if(FAILED(hr))
{
hr = pID3D->CreateDevice( D3DADAPTER_DEFAULT, devtype, hwnd,
D3DCREATE_SOFTWARE_VERTEXPROCESSING | D3DCREATE_FPU_PRESERVE, &present, &pID3DDevice);
if (FAILED(hr))
os::Printer::log("Was not able to create Direct3D8 device.", ELL_ERROR);
}
}
}
Code: Select all
if (pureSoftware)
{
hr = pID3D->CreateDevice( D3DADAPTER_DEFAULT, D3DDEVTYPE_REF, hwnd,
D3DCREATE_SOFTWARE_VERTEXPROCESSING | D3DCREATE_FPU_PRESERVE, &present, &pID3DDevice);
if (FAILED(hr))
os::Printer::log("Was not able to create Direct3D9 software device.", ELL_ERROR);
}
else
{
hr = pID3D->CreateDevice( D3DADAPTER_DEFAULT, devtype, hwnd,
D3DCREATE_HARDWARE_VERTEXPROCESSING | D3DCREATE_FPU_PRESERVE, &present, &pID3DDevice);
if(FAILED(hr))
{
hr = pID3D->CreateDevice( D3DADAPTER_DEFAULT, devtype, hwnd,
D3DCREATE_MIXED_VERTEXPROCESSING | D3DCREATE_FPU_PRESERVE, &present, &pID3DDevice);
if(FAILED(hr))
{
hr = pID3D->CreateDevice( D3DADAPTER_DEFAULT, devtype, hwnd,
D3DCREATE_SOFTWARE_VERTEXPROCESSING | D3DCREATE_FPU_PRESERVE, &present, &pID3DDevice);
if (FAILED(hr))
os::Printer::log("Was not able to create Direct3D9 device.", ELL_ERROR);
}
}
}