# Why would anti-aliasing work for the debug runtime but not the retail runtime?

I'm experimenting with setting various graphical settings in my Direct3D9 application, and I'm currently facing a curious problem with anti-aliasing. When running under the debug runtime, AA works as expected, and I don't have any errors or warnings. But when running under the retail runtime, the image isn't anti-aliased at all. I don't get any errors, the device creates and executes just fine.

As I honestly have little idea where the problem is, I will simply give a relatively high-level overview of the architecture involved, rather than specific problematic code. Simply put, I render my 3D content to a texture, which I then render to the back buffer.

Why would this be?

• Is the D3D runtime the only thing that changes or do you have different targets for your application that use a different runtime (e.g. Debug/Release)? If that's the latter, you might try disabling your Debug features one by one to get closer to your Release target. Maybe you've got an #ifdef _DEBUG somewhere that's screwing things up. – Laurent Couvidou Apr 2 '12 at 11:34
• @lorancou: No, I'm running the Debug build in both cases and just changing the runtime in the D3D control panel. – DeadMG Apr 2 '12 at 11:51
• So you might have a non-initialized variable issue. Using the debug runtime, D3D initializes something to 0 and everything works fine. But using the retail runtime this something doesn't get initialized and holds some random data, so your anti-aliasing breaks. My advice is to try initializing everything that's not, and next time to develop directly with the retail runtime; I'd only use the debug runtime once in a while to look for issues. – Laurent Couvidou Apr 2 '12 at 13:17
• @lorancou: I use an always_initialized<T> helper class to guarantee initialization at all times in all modes. – DeadMG Apr 2 '12 at 20:40
• This doesn't guarantee you're initializing D3D completely. Maybe you didn't initialize your viewport with IDirect3DDevice9::SetViewport. Or one of the parameters you use here is not using your always_initialized helper. Or your helper doesn't do what you think it does. Maybe you called IDirect3DDevice9::BeginScene but not IDirect3DDevice9::EndScene. It's weird that you don't get any errors with the debug runtime though, we might be missing something more obvious. – Laurent Couvidou Apr 3 '12 at 10:17