Sign in to follow this  

FSAA not working

This topic is 3294 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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);

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

This topic is 3294 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this