Turning on Multisampling
by Thomas Phillips · in Torque Game Engine Advanced · 10/08/2006 (11:23 am) · 2 replies
Despite the shader issues, I would like to turn on multisampling. I have modified the gfxD3DDevice.cpp code (GFXD3DDevice::setupPresentParams) thusly:
This code runs successfully, but the success dialog is then followed by a failure message (in GFXD3DDevice::init):
Does anyone know why the device would fail to initialize after enabling multisamping? If something is wrong, shouldn't some other error be reported before this point? (BTW, I'm running this on a GeForce 5200 FX.)
Tom
// @tsphillips Turned on multisampling.
d3dpp.MultiSampleType = D3DMULTISAMPLE_NONE; // default
d3dpp.MultiSampleQuality = 0; // default
D3DMULTISAMPLE_TYPE mst = D3DMULTISAMPLE_2_SAMPLES;
DWORD quality = 0;
if (SUCCEEDED(mD3D->CheckDeviceMultiSampleType(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, D3DFMT_X8R8G8B8, true, mst, &quality)))
{
if (SUCCEEDED(mD3D->CheckDeviceMultiSampleType(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, D3DFMT_D24S8, true, mst, &quality)))
{
d3dpp.MultiSampleType = D3DMULTISAMPLE_2_SAMPLES;
d3dpp.MultiSampleQuality = 0; // 0
Platform::AlertOK("Multisampling Enabled", "Multisampling has been enabled.");
} else {
Platform::AlertOK("Multisampling Failed", "Multisampling not supported for depth buffer format.");
} // if-else
} else {
Platform::AlertOK("Multisampling Failed", "Multisampling not supported for back buffer format.");
} // if-elseThis code runs successfully, but the success dialog is then followed by a failure message (in GFXD3DDevice::init):
// Gracefully die if they can't give us a device.
if(!mD3DDevice)
{
Platform::AlertOK("DirectX Error!", "Failed to initialize Direct3D! Make sure you have DirectX 9 installed, and "
"are running a graphics card that supports Pixel Shader 1.1.");
Platform::forceShutdown(1);
}Does anyone know why the device would fail to initialize after enabling multisamping? If something is wrong, shouldn't some other error be reported before this point? (BTW, I'm running this on a GeForce 5200 FX.)
Tom
#2
Tom
10/16/2006 (7:13 pm)
Using D3DMULTISAMPLE_NONMASKABLE gets me the same results. It's as is something else is getting set that is incompatible with mutlisampling, but whatever it is doesn't seem to have error checking around it. :-(Tom
Torque Owner Kevin Johnson
try .MultiSampleType = D3DMULTISAMPLE_NONMASKABLE
then drill through the quality levels, til you find the best supported level.
Also make sure you re initialize this whenever you get a device reset/lost device, or youll get a crash too..
FYI - my 5200fx only does nonmaskable, 2 samples (fx5200go)