Debug graphics with VS2013. Error on launch.

Started by
4 comments, last by Volgogradetzzz 9 years, 3 months ago

Greetings.

I'm trying to create some simple project - just render a quad. I made something wrong and I can't see an output. I want to use Graphics Debugger, but on launch I have an error

No such interface supported

on creating swap chain with CreateSwapChainForHwnd. Using debug or release configuration is fine - everything creates and I see back buffer clear color on render. This problem occurs only when I'm starting graphics debug.

Advertisement

Can you describe the OS and update level that you are working on? I believe you need to have the platform update on Win7 for the graphics debugger to work...

Also keep in mind that VS has _two_ graphics debuggers. The old one is a modified PIX that works on older versions of Windows. The new one requires some kernel/WDDM updates that are only available in Windows 8.1+.

If you're trying to debug a newer feature level of D3D, you may need the new debugger, which again _only_ works on Windows 8.1+. You could try using a lower feature level. If all you need is simple stuff, feature level 9_3 may even be enough. CreateSwapChainForHwnd is also part of the latest versions of DXGI and may not be supported by the old PIX-based debugger; try using the regular 11.0 interfaces instead of the 11.1 interfaces.

Sean Middleditch – Game Systems Engineer – Join my team!

Hello Jason,

I'm happy that you replied. I'm your fun, your book is amazing smile.png.

I found a workaround, but still have questions. Hope that experienced guys help me.

On Win8 everything works without problems. So I'll talk about Win7 only. On Win7 I have lastest updates. Previously I used this code to get a factory:


ComPtr<IDXGIFactory2> factory2;
HRESULT hr = CreateDXGIFactory1(__uuidof(IDXGIFactory1), (void**)(&factory2));

This code was called after device and context creation. Now I can see that I'm creating IDXGIFactory2 with CreateDXGIFactory1 method. That's weird, but this works!! How!!??

Now I use this this code for factory obtain:


ComPtr<IDXGIDevice> dxgiDevice;
device->QueryInterface(__uuidof(IDXGIDevice), reinterpret_cast<void**>(dxgiDevice.GetAddressOf()));

ComPtr<IDXGIAdapter> adapter;
dxgiDevice->GetAdapter(&adapter);

ComPtr<IDXGIFactory1> factory1;
adapter->GetParent(__uuidof(IDXGIFactory1), reinterpret_cast<void**>(factory1.GetAddressOf()));

ComPtr<IDXGIFactory2> factory2;
factory1.Get()->QueryInterface(__uuidof(IDXGIFactory2), reinterpret_cast<void**>(factory2.GetAddressOf()));

This code also works. And in addition debugger works too.

So my question - what is a correct way to get a factory? Is it absolutelly wrong to get it using CreateDXGIFactory1? Or should I obtain it throug existing device? Sorry if unclear, please feel free to correct/ask.

@SeanMiddleditch Thank you for reply. You're right - CreateSwapChainForHwnd needs IDXGIFactory2 interface. I tried win32 sample on Win7 - https://code.msdn.microsoft.com/windowsdesktop/Direct3D-Tutorial-Win32-829979ef - this sample uses lastest factory and it works.

Thanks for the comment on the book - I'm glad that you enjoyed it!

Regarding the use of the wrong pointer type in those functions, you have to consider what is there in your code. Since you cast the pointer to a (void**) there is no way for the compiler to know what type the pointer actually is. This is one of the issues with COM in general, that the user is in charge of making sure the types being requested are actually matching the pointer type!

It is fairly common for this to work fine in 99% of the cases, but you could get burned with a very strange error that is nearly impossible to debug - so make sure your types match the pointers you put them into!

Thank you, thats right. In addition, after investigation I found next thing (http://msdn.microsoft.com/en-us/library/windows/desktop/hh404556%28v=vs.85%29.aspx):

"Because you can create a Direct3D device without creating a swap chain, you might need to retrieve the factory that is used to create the device in order to create a swap chain."

It seems that this is my case - I created device first. Next I created a swap chain, but I didn't retrieve factory but created new! It's strange thought that it works with debug/release config.

This topic is closed to new replies.

Advertisement