Well.. gave it my best shot... hopefully i used it semi-correctly. (Feel free to scream at me if I used it wrong and am an idiot).
Seems to produce better image quality. So I'm guessing it works.. thnx for the help..
Oh yeah.. what exactly is MultiSampleQuality?? My device returns 4 Does that refer to 4x or something else?
If I don't subtract 1 from this number before setting I get a crash.
Code:
extern IDirect3D9 *g_pD3D9;
extern IDirect3DDevice9 * g_pD3DDevice9;
bool InitD3D(HWND hWnd)
{
g_pD3D9 = Direct3DCreate9(D3D_SDK_VERSION);
if(g_pD3D9 == NULL)
return false;
D3DDISPLAYMODE d3ddm;
g_pD3D9->GetAdapterDisplayMode(D3DADAPTER_DEFAULT,
&d3ddm);
D3DPRESENT_PARAMETERS d3dpp;
memset(&d3dpp, 0, sizeof(d3dpp));
d3dpp.BackBufferWidth = g_nScreenWidth;
d3dpp.BackBufferHeight = g_nScreenHeight;
d3dpp.BackBufferFormat = d3ddm.Format;
d3dpp.BackBufferCount = 1;
d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
d3dpp.EnableAutoDepthStencil = true;
d3dpp.AutoDepthStencilFormat = D3DFMT_D16;
d3dpp.hDeviceWindow = hWnd;
d3dpp.Windowed = true;
DWORD total;
if(SUCCEEDED(g_pD3D9->CheckDeviceMultiSampleType(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL,
d3ddm.Format,
true,
D3DMULTISAMPLE_NONMASKABLE,
&total)))
{
d3dpp.MultiSampleType = D3DMULTISAMPLE_NONMASKABLE;
d3dpp.MultiSampleQuality = total - 1;
}
d3dpp.FullScreen_RefreshRateInHz = D3DPRESENT_RATE_DEFAULT;
d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;
if(FAILED(g_pD3D9->CreateDevice(D3DADAPTER_DEFAULT,
D3DDEVTYPE_HAL,
hWnd,
D3DCREATE_SOFTWARE_VERTEXPROCESSING,
&d3dpp,
&g_pD3DDevice9)))
return false;
return true;
}