FSAA not working

Started by
3 comments, last by Adam_42 15 years, 4 months ago
When I enable the full scene antialiasing in DirectX 9, latest SDK, the program crashes at point where I create the vertex declaration claiming about null pointer access violation. I checked the hardware if it supports the requested FSAA samplers, and it does. What could be the problem?
Advertisement
A null pointer on a Create function, eh? Would it be a reasonable assumption that this create call is the first call you make on your IDirect3DDevice9 instance? That you don't check the result of CreateDevice() and blindly carry on despite not having created a valid device?

How did you check and configure MSAA? Have you checked for error codes and debug output? If so, what information do you get?

Have you cross-referenced your code against the SDK samples? They'll show you all the options your hardware supports so you can verify what does/doesn't work very quickly.


hth
Jack

<hr align="left" width="25%" />
Jack Hoxley <small>[</small><small> Forum FAQ | Revised FAQ | MVP Profile | Developer Journal ]</small>

Well the device is not created when FSAA is set. I tried playing with device type and vertex processing mode, but nothing changed. I got null device, with error code of invalid call. I run the program in debug mode, and using the debug version of libraries.
Actually here's some code may help:


memset(d3dpp, 0, sizeof(D3DPRESENT_PARAMETERS));

// Common attribs
d3dpp->Windowed = m_win.windowed;
d3dpp->hDeviceWindow = m_win.hwnd;
d3dpp->SwapEffect = D3DSWAPEFFECT_DISCARD;
d3dpp->EnableAutoDepthStencil = TRUE;
d3dpp->AutoDepthStencilFormat = D3DFMT_D16;
d3dpp->Flags = D3DPRESENTFLAG_LOCKABLE_BACKBUFFER;

//, D3DDEVTYPE_HAL, m_win.hwnd, D3DCREATE_HARDWARE_VERTEXPROCESSING
if (m_d3d->CheckDeviceMultiSampleType(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, D3DFMT_A8R8G8B8, TRUE, D3DMULTISAMPLE_4_SAMPLES, NULL) == D3D_OK)
{
d3dpp->MultiSampleType = D3DMULTISAMPLE_4_SAMPLES;
}

// Render dims are the same as the client
// Pixel format is the same as the desktop
if (m_win.windowed) {
// They are already set by the create and resize functions
//m_win.render_width = client area width
//m_win.render_height = client area height
d3dpp->BackBufferWidth = 0; // So that D3D uses the client area dimensions
d3dpp->BackBufferFormat = D3DFMT_UNKNOWN;
} else {
// Render dims are the current dispmode resolution
d3dpp->BackBufferWidth = m_disp.dispmode[m_disp.curmode].xres;
d3dpp->BackBufferHeight = m_disp.dispmode[m_disp.curmode].yres;
d3dpp->FullScreen_RefreshRateInHz = m_disp.dispmode[m_disp.curmode].refresh;
// Pixel format is the display setting format
d3dpp->BackBufferFormat = m_disp.format;
}

....

rslt = m_d3d->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, m_win.hwnd,
D3DCREATE_HARDWARE_VERTEXPROCESSING, &d3dpp, &m_dev);
From: http://msdn.microsoft.com/en-us/library/bb174313(VS.85).aspx

Quote:Back buffers created as part of the device are only lockable if D3DPRESENTFLAG_LOCKABLE_BACKBUFFER is specified in the presentation parameters. (Multisampled back buffers and depth surfaces are never lockable.)


Try setting the flags to 0 instead of D3DPRESENTFLAG_LOCKABLE_BACKBUFFER.

This topic is closed to new replies.

Advertisement